the (un)binding of isa(d)a(sh)c

asbcc ascdsvcac scaociac c
This commit is contained in:
Pheonix 2022-04-10 00:49:49 +01:00
parent 6dc3ebaf51
commit 49d81ef3da
6 changed files with 97 additions and 77 deletions

View File

@ -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: действовать с осторожностью!");
+ "Ñ<EFBFBD>поÑ<EFBFBD>об-528: дейÑ<C2B9>ÑвоваÑÑŒ Ñ<> оÑ<C2BE>ÑорожноÑ<C2BE>Ñью!");
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);

View File

@ -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;

View File

@ -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();

View File

@ -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
}
}

View File

@ -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();

View File

@ -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