diff --git a/src/main/java/com/hbm/config/GeneralConfig.java b/src/main/java/com/hbm/config/GeneralConfig.java index 8330e60c2..4be0e9ce8 100644 --- a/src/main/java/com/hbm/config/GeneralConfig.java +++ b/src/main/java/com/hbm/config/GeneralConfig.java @@ -24,6 +24,7 @@ public class GeneralConfig { public static boolean enableBabyMode = false; public static boolean enableReflectorCompat = false; public static boolean enableRenderDistCheck = true; + public static boolean enableCustomDashKeybind = false; public static boolean enable528 = false; public static boolean enable528ReasimBoilers = true; @@ -57,13 +58,14 @@ public class GeneralConfig { enableBabyMode = config.get(CATEGORY_GENERAL, "1.23_enableBabyMode", false).getBoolean(false); enableReflectorCompat = config.get(CATEGORY_GENERAL, "1.24_enableReflectorCompat", false).getBoolean(false); enableRenderDistCheck = config.get(CATEGORY_GENERAL, "1.25_enableRenderDistCheck", true).getBoolean(true); + enableCustomDashKeybind = config.get(CATEGORY_GENERAL, "1.26_enableCustomDashKeybind", false).getBoolean(false); final String CATEGORY_528 = CommonConfig.CATEGORY_528; config.addCustomCategoryComment(CATEGORY_528, "CAUTION\n" + "528 Mode: Please proceed with caution!\n" + "528-Modus: Lassen Sie Vorsicht walten!\n" - + "способ-528: действовать с осторожностью!"); + + "Ñ�поÑ�об-528: дейÑ�твовать Ñ� оÑ�торожноÑ�тью!"); enable528 = CommonConfig.createConfigBool(config, CATEGORY_528, "enable528Mode", "The central toggle for 528 mode.", false); enable528ReasimBoilers = CommonConfig.createConfigBool(config, CATEGORY_528, "X528_forceReasimBoilers", "Keeps the RBMK dial for ReaSim boilers on, preventing use of non-ReaSim boiler columns and forcing the use of steam in-/outlets", true); diff --git a/src/main/java/com/hbm/extprop/HbmPlayerProps.java b/src/main/java/com/hbm/extprop/HbmPlayerProps.java index 63ce1f7e4..f504db0b7 100644 --- a/src/main/java/com/hbm/extprop/HbmPlayerProps.java +++ b/src/main/java/com/hbm/extprop/HbmPlayerProps.java @@ -20,6 +20,8 @@ public class HbmPlayerProps implements IExtendedEntityProperties { private boolean[] keysPressed = new boolean[EnumKeybind.values().length]; + public boolean dashActivated = true; + public static final int dashCooldownLength = 5; public int dashCooldown = 0; diff --git a/src/main/java/com/hbm/handler/EntityEffectHandler.java b/src/main/java/com/hbm/handler/EntityEffectHandler.java index 49fa4f22d..8b9a13761 100644 --- a/src/main/java/com/hbm/handler/EntityEffectHandler.java +++ b/src/main/java/com/hbm/handler/EntityEffectHandler.java @@ -11,6 +11,7 @@ import com.hbm.explosion.ExplosionNukeSmall; import com.hbm.extprop.HbmLivingProps; import com.hbm.extprop.HbmPlayerProps; import com.hbm.extprop.HbmLivingProps.ContaminationEffect; +import com.hbm.handler.HbmKeybinds.EnumKeybind; import com.hbm.handler.radiation.ChunkRadiationManager; import com.hbm.interfaces.IArmorModDash; import com.hbm.items.armor.ArmorFSB; @@ -454,6 +455,15 @@ public class EntityEffectHandler { } int dashCount = armorDashCount + armorModDashCount; + + boolean dashActivated = false; + + + if(!GeneralConfig.enableCustomDashKeybind) { + dashActivated = !player.capabilities.isFlying && player.isSneaking(); + } else { + dashActivated = props.getKeyPressed(EnumKeybind.DASH); + } //System.out.println(dashCount); @@ -470,7 +480,7 @@ public class EntityEffectHandler { if(props.getDashCooldown() <= 0) { - if(!player.capabilities.isFlying && player.isSneaking() && stamina >= perDash) { + if(dashActivated && stamina >= perDash) { Vec3 lookingIn = player.getLookVec(); Vec3 strafeVec = player.getLookVec(); diff --git a/src/main/java/com/hbm/handler/HbmKeybinds.java b/src/main/java/com/hbm/handler/HbmKeybinds.java index 552ae9b6e..ee6a995dd 100644 --- a/src/main/java/com/hbm/handler/HbmKeybinds.java +++ b/src/main/java/com/hbm/handler/HbmKeybinds.java @@ -1,75 +1,79 @@ -package com.hbm.handler; - -import com.hbm.inventory.gui.GUICalculator; -import cpw.mods.fml.common.FMLCommonHandler; -import org.lwjgl.input.Keyboard; - -import com.hbm.extprop.HbmPlayerProps; -import com.hbm.main.MainRegistry; -import com.hbm.packet.KeybindPacket; -import com.hbm.packet.PacketDispatcher; - -import cpw.mods.fml.client.registry.ClientRegistry; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.common.gameevent.InputEvent.KeyInputEvent; -import net.minecraft.client.settings.KeyBinding; - -public class HbmKeybinds { - - public static final String category = "hbm.key"; - - public static KeyBinding calculatorKey = new KeyBinding(category + ".calculator", Keyboard.KEY_N, category); - public static KeyBinding jetpackKey = new KeyBinding(category + ".toggleBack", Keyboard.KEY_C, category); - public static KeyBinding hudKey = new KeyBinding(category + ".toggleHUD", Keyboard.KEY_V, category); - public static KeyBinding reloadKey = new KeyBinding(category + ".reload", Keyboard.KEY_R, category); - - public static KeyBinding craneUpKey = new KeyBinding(category + ".craneMoveUp", Keyboard.KEY_UP, category); - public static KeyBinding craneDownKey = new KeyBinding(category + ".craneMoveDown", Keyboard.KEY_DOWN, category); - public static KeyBinding craneLeftKey = new KeyBinding(category + ".craneMoveLeft", Keyboard.KEY_LEFT, category); - public static KeyBinding craneRightKey = new KeyBinding(category + ".craneMoveRight", Keyboard.KEY_RIGHT, category); - public static KeyBinding craneLoadKey = new KeyBinding(category + ".craneLoad", Keyboard.KEY_RETURN, category); - - public static void register() { - ClientRegistry.registerKeyBinding(calculatorKey); - ClientRegistry.registerKeyBinding(jetpackKey); - ClientRegistry.registerKeyBinding(hudKey); - ClientRegistry.registerKeyBinding(reloadKey); - - ClientRegistry.registerKeyBinding(craneUpKey); - ClientRegistry.registerKeyBinding(craneDownKey); - ClientRegistry.registerKeyBinding(craneLeftKey); - ClientRegistry.registerKeyBinding(craneRightKey); - ClientRegistry.registerKeyBinding(craneLoadKey); - } - - @SubscribeEvent - public void keyEvent(KeyInputEvent event) { - if (calculatorKey.getIsKeyPressed()) { // handle the calculator client-side only - FMLCommonHandler.instance().showGuiScreen(new GUICalculator()); - } - - HbmPlayerProps props = HbmPlayerProps.getData(MainRegistry.proxy.me()); - - for(EnumKeybind key : EnumKeybind.values()) { - boolean last = props.getKeyPressed(key); - boolean current = MainRegistry.proxy.getIsKeyPressed(key); - - if(last != current) { - PacketDispatcher.wrapper.sendToServer(new KeybindPacket(key, current)); - props.setKeyPressed(key, current); - } - } - } - - public static enum EnumKeybind { - JETPACK, - TOGGLE_JETPACK, - TOGGLE_HEAD, - RELOAD, - CRANE_UP, - CRANE_DOWN, - CRANE_LEFT, - CRANE_RIGHT, - CRANE_LOAD - } -} +package com.hbm.handler; + +import com.hbm.inventory.gui.GUICalculator; +import cpw.mods.fml.common.FMLCommonHandler; +import org.lwjgl.input.Keyboard; + +import com.hbm.extprop.HbmPlayerProps; +import com.hbm.main.MainRegistry; +import com.hbm.packet.KeybindPacket; +import com.hbm.packet.PacketDispatcher; + +import cpw.mods.fml.client.registry.ClientRegistry; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.common.gameevent.InputEvent.KeyInputEvent; +import net.minecraft.client.settings.KeyBinding; + +public class HbmKeybinds { + + public static final String category = "hbm.key"; + + public static KeyBinding calculatorKey = new KeyBinding(category + ".calculator", Keyboard.KEY_N, category); + public static KeyBinding jetpackKey = new KeyBinding(category + ".toggleBack", Keyboard.KEY_C, category); + public static KeyBinding hudKey = new KeyBinding(category + ".toggleHUD", Keyboard.KEY_V, category); + public static KeyBinding reloadKey = new KeyBinding(category + ".reload", Keyboard.KEY_R, category); + public static KeyBinding dashKey = new KeyBinding(category + ".dash", Keyboard.KEY_F, category); + + public static KeyBinding craneUpKey = new KeyBinding(category + ".craneMoveUp", Keyboard.KEY_UP, category); + public static KeyBinding craneDownKey = new KeyBinding(category + ".craneMoveDown", Keyboard.KEY_DOWN, category); + public static KeyBinding craneLeftKey = new KeyBinding(category + ".craneMoveLeft", Keyboard.KEY_LEFT, category); + public static KeyBinding craneRightKey = new KeyBinding(category + ".craneMoveRight", Keyboard.KEY_RIGHT, category); + public static KeyBinding craneLoadKey = new KeyBinding(category + ".craneLoad", Keyboard.KEY_RETURN, category); + + public static void register() { + ClientRegistry.registerKeyBinding(calculatorKey); + ClientRegistry.registerKeyBinding(jetpackKey); + ClientRegistry.registerKeyBinding(hudKey); + ClientRegistry.registerKeyBinding(reloadKey); + ClientRegistry.registerKeyBinding(dashKey); + + ClientRegistry.registerKeyBinding(craneUpKey); + ClientRegistry.registerKeyBinding(craneDownKey); + ClientRegistry.registerKeyBinding(craneLeftKey); + ClientRegistry.registerKeyBinding(craneRightKey); + ClientRegistry.registerKeyBinding(craneLoadKey); + } + + @SubscribeEvent + public void keyEvent(KeyInputEvent event) { + if (calculatorKey.getIsKeyPressed()) { // handle the calculator client-side only + FMLCommonHandler.instance().showGuiScreen(new GUICalculator()); + } + + HbmPlayerProps props = HbmPlayerProps.getData(MainRegistry.proxy.me()); + + for(EnumKeybind key : EnumKeybind.values()) { + boolean last = props.getKeyPressed(key); + boolean current = MainRegistry.proxy.getIsKeyPressed(key); + + if(last != current) { + PacketDispatcher.wrapper.sendToServer(new KeybindPacket(key, current)); + props.setKeyPressed(key, current); + System.out.println(key); + } + } + } + + public static enum EnumKeybind { + JETPACK, + TOGGLE_JETPACK, + TOGGLE_HEAD, + RELOAD, + DASH, + CRANE_UP, + CRANE_DOWN, + CRANE_LEFT, + CRANE_RIGHT, + CRANE_LOAD + } +} diff --git a/src/main/java/com/hbm/main/ClientProxy.java b/src/main/java/com/hbm/main/ClientProxy.java index 7ff79cb57..881b08d7a 100644 --- a/src/main/java/com/hbm/main/ClientProxy.java +++ b/src/main/java/com/hbm/main/ClientProxy.java @@ -1632,6 +1632,7 @@ public class ClientProxy extends ServerProxy { case TOGGLE_JETPACK: return HbmKeybinds.jetpackKey.getIsKeyPressed(); case TOGGLE_HEAD: return HbmKeybinds.hudKey.getIsKeyPressed(); case RELOAD: return HbmKeybinds.reloadKey.getIsKeyPressed(); + case DASH: return HbmKeybinds.dashKey.getIsKeyPressed(); case CRANE_UP: return HbmKeybinds.craneUpKey.getIsKeyPressed(); case CRANE_DOWN: return HbmKeybinds.craneDownKey.getIsKeyPressed(); case CRANE_LEFT: return HbmKeybinds.craneLeftKey.getIsKeyPressed(); diff --git a/src/main/resources/assets/hbm/lang/en_US.lang b/src/main/resources/assets/hbm/lang/en_US.lang index 7e2473c40..1f3111a24 100644 --- a/src/main/resources/assets/hbm/lang/en_US.lang +++ b/src/main/resources/assets/hbm/lang/en_US.lang @@ -652,6 +652,7 @@ hbm.key.craneMoveDown=Move Crane Backward hbm.key.craneMoveLeft=Move Crane Left hbm.key.craneMoveRight=Move Crane Right hbm.key.craneMoveUp=Move Crane Forward +hbm.key.dash=Dash (Unbind from Crouch in config) hbm.key.toggleBack=Toggle Backpack hbm.key.toggleHUD=Toggle HUD hbm.key.reload=Reload