try to fix server-side crashes again
This commit is contained in:
+1
-1
@@ -48,7 +48,7 @@ mod_name=Fretux's Skill Engine
|
||||
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
||||
mod_license=All Rights Reserved
|
||||
# The mod version. See https://semver.org/
|
||||
mod_version=1.2.8
|
||||
mod_version=1.2.9
|
||||
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
|
||||
# This should match the base package used for the mod sources.
|
||||
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package net.fretux.skillengine;
|
||||
|
||||
import com.mojang.logging.LogUtils;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.fretux.skillengine.network.PacketHandler;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
import org.slf4j.Logger;
|
||||
@@ -16,5 +18,9 @@ public class SkillEngine {
|
||||
public SkillEngine() {
|
||||
IEventBus modBus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
PacketHandler.register();
|
||||
DistExecutor.unsafeRunWhenOn(
|
||||
Dist.CLIENT,
|
||||
() -> () -> net.fretux.skillengine.client.ClientBootstrap.register(modBus)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,13 +6,8 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraftforge.client.event.RenderGuiEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
@Mod.EventBusSubscriber
|
||||
public class AbilityHudOverlay {
|
||||
|
||||
@SubscribeEvent
|
||||
public static void render(RenderGuiEvent.Post event) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
if (mc.player == null) return;
|
||||
|
||||
@@ -7,11 +7,8 @@ import net.minecraft.client.KeyMapping;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.client.event.InputEvent;
|
||||
import net.minecraftforge.client.settings.KeyConflictContext;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
@Mod.EventBusSubscriber(modid = net.fretux.skillengine.SkillEngine.MODID, value = Dist.CLIENT)
|
||||
public class AbilityKeybindHandler {
|
||||
|
||||
public static final KeyMapping ABILITY_1 = new KeyMapping(
|
||||
@@ -29,7 +26,6 @@ public class AbilityKeybindHandler {
|
||||
InputConstants.Type.KEYSYM, GLFW.GLFW_KEY_C, "key.categories.gameplay"
|
||||
);
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onInput(InputEvent.Key event) {
|
||||
if (ABILITY_1.consumeClick()) {
|
||||
if (SkilltreeClientState.getClientCooldown(1) <= 0) {
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package net.fretux.skillengine.client;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
|
||||
public final class ClientBootstrap {
|
||||
|
||||
private ClientBootstrap() {}
|
||||
|
||||
public static void register(IEventBus modBus) {
|
||||
modBus.addListener(ClientKeybinds::registerKeys);
|
||||
MinecraftForge.EVENT_BUS.addListener(ClientEvents::onKeyInput);
|
||||
MinecraftForge.EVENT_BUS.addListener(AbilityKeybindHandler::onInput);
|
||||
MinecraftForge.EVENT_BUS.addListener(ClientCooldownTicker::onClientTick);
|
||||
MinecraftForge.EVENT_BUS.addListener(AbilityHudOverlay::render);
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,8 @@
|
||||
package net.fretux.skillengine.client;
|
||||
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.event.TickEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.fretux.skillengine.SkillEngine;
|
||||
|
||||
@Mod.EventBusSubscriber(modid = SkillEngine.MODID, value = Dist.CLIENT)
|
||||
public class ClientCooldownTicker {
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onClientTick(TickEvent.ClientTickEvent event) {
|
||||
if (event.phase != TickEvent.Phase.END) return;
|
||||
for (int i = 0; i < 3; i++) {
|
||||
|
||||
@@ -2,18 +2,9 @@ package net.fretux.skillengine.client;
|
||||
|
||||
import net.fretux.skillengine.SkillEngine;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.client.event.InputEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
@Mod.EventBusSubscriber(
|
||||
modid = SkillEngine.MODID,
|
||||
value = Dist.CLIENT
|
||||
)
|
||||
|
||||
public class ClientEvents {
|
||||
@SubscribeEvent
|
||||
public static void onKeyInput(InputEvent.Key event) {
|
||||
if (ClientKeybinds.OPEN_SKILLTREE != null &&
|
||||
ClientKeybinds.OPEN_SKILLTREE.consumeClick()) {
|
||||
|
||||
@@ -2,22 +2,13 @@ package net.fretux.skillengine.client;
|
||||
|
||||
import net.fretux.skillengine.SkillEngine;
|
||||
import net.minecraft.client.KeyMapping;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.client.event.RegisterKeyMappingsEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
@Mod.EventBusSubscriber(
|
||||
modid = SkillEngine.MODID,
|
||||
bus = Mod.EventBusSubscriber.Bus.MOD,
|
||||
value = Dist.CLIENT
|
||||
)
|
||||
public class ClientKeybinds {
|
||||
public static KeyMapping OPEN_SKILLTREE;
|
||||
public static KeyMapping OPEN_ABILITIES;
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerKeys(RegisterKeyMappingsEvent event) {
|
||||
OPEN_SKILLTREE = new KeyMapping(
|
||||
"key.skillengine.openskilltree",
|
||||
|
||||
Reference in New Issue
Block a user