Skip to content

Commit

Permalink
fix speedupAnimations setting also disabling fast placing keybind (#435)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexdoru authored Nov 10, 2024
1 parent 08610bc commit bfca8a0
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import com.mitchej123.hodgepodge.util.ManagedEnum;

import biomesoplenty.common.eventhandler.client.gui.WorldTypeMessageEventHandler;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.ModMetadata;
Expand Down Expand Up @@ -43,17 +42,14 @@ public static void postInit() {
}

FMLCommonHandler.instance().bus().register(ClientTicker.INSTANCE);
ClientRegistry.registerKeyBinding(ClientKeyListener.FastBlockPlacingKey);

MinecraftForge.EVENT_BUS.register(new ReloadSoundsGui());

if (TweaksConfig.addSystemInfo) {
MinecraftForge.EVENT_BUS.register(DebugScreenHandler.INSTANCE);
}

if (FixesConfig.speedupAnimations) {
FMLCommonHandler.instance().bus().register(new ClientKeyListener());
}
FMLCommonHandler.instance().bus().register(new ClientKeyListener());

if (Compat.isIC2CropPluginPresent()) {
ModMetadata meta = Loader.instance().getIndexedModList().get("Ic2Nei").getMetadata();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
import com.gtnewhorizon.gtnhlib.util.AboveHotbarHUD;
import com.mitchej123.hodgepodge.client.HodgepodgeClient;
import com.mitchej123.hodgepodge.config.DebugConfig;
import com.mitchej123.hodgepodge.config.FixesConfig;
import com.mitchej123.hodgepodge.config.TweaksConfig;

import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.InputEvent;
import cpw.mods.fml.relauncher.Side;
Expand All @@ -24,34 +26,39 @@ public class ClientKeyListener {
.translateToLocal("key.fastBlockPlacing.enabled");
private static final String fastBlockPlacingDisabled = StatCollector
.translateToLocal("key.fastBlockPlacing.disabled");

public static KeyBinding FastBlockPlacingKey = new KeyBinding(
private static final KeyBinding fastBlockPlacingKey = new KeyBinding(
"key.fastBlockPlacing.desc",
Keyboard.KEY_NONE,
"key.hodgepodge.category");

public ClientKeyListener() {
ClientRegistry.registerKeyBinding(fastBlockPlacingKey);
}

@SubscribeEvent
public void keyPressed(InputEvent.KeyInputEvent event) {
int key = Keyboard.getEventKey();
boolean released = !Keyboard.getEventKeyState();
if (released) {
if (Minecraft.getMinecraft().gameSettings.showDebugInfo && GuiScreen.isShiftKeyDown()
&& GuiScreen.isCtrlKeyDown()) {
if (key == Keyboard.KEY_N) {
HodgepodgeClient.animationsMode.next();
} else if (key == Keyboard.KEY_D && DebugConfig.renderDebug) {
HodgepodgeClient.renderDebugMode.next();
if (TweaksConfig.fastBlockPlacingServerSide && fastBlockPlacingKey.isPressed()) {
TweaksConfig.fastBlockPlacing = !TweaksConfig.fastBlockPlacing;
AboveHotbarHUD.renderTextAboveHotbar(
(TweaksConfig.fastBlockPlacing ? fastBlockPlacingEnabled : fastBlockPlacingDisabled),
40,
false,
false);
return;
}
if (FixesConfig.speedupAnimations) {
int key = Keyboard.getEventKey();
boolean released = !Keyboard.getEventKeyState();
if (released) {
if (Minecraft.getMinecraft().gameSettings.showDebugInfo && GuiScreen.isShiftKeyDown()
&& GuiScreen.isCtrlKeyDown()) {
if (key == Keyboard.KEY_N) {
HodgepodgeClient.animationsMode.next();
} else if (key == Keyboard.KEY_D && DebugConfig.renderDebug) {
HodgepodgeClient.renderDebugMode.next();
}
}
}
} else {
if (TweaksConfig.fastBlockPlacingServerSide && FastBlockPlacingKey.isPressed()) {
TweaksConfig.fastBlockPlacing = !TweaksConfig.fastBlockPlacing;
AboveHotbarHUD.renderTextAboveHotbar(
(TweaksConfig.fastBlockPlacing ? fastBlockPlacingEnabled : fastBlockPlacingDisabled),
40,
false,
false);
}
}
}
}

0 comments on commit bfca8a0

Please sign in to comment.