try to fix server-side crashes again
This commit is contained in:
@@ -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()) {
|
||||
@@ -25,4 +16,4 @@ public class ClientEvents {
|
||||
Minecraft.getInstance().setScreen(new AbilitySlotsScreen());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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