mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-16 19:55:06 +00:00
Better Filename Handling for Abilities, Dash Directional Improvements, Fixed Duplicate Ability Name Handling
This commit is contained in:
1 parent
71dbf77def
commit
3de8cd49b6
23 files changed
+752
-178
No files matched your search
@@ -54,6 +54,7 @@ public class ClientTickHandler {
|
||||
private long buttonTime = 0L;
|
||||
private final int[] ignoreKeys = new int[]{157, 29, 54, 42, 184, 56, 220, 219};
|
||||
private boolean lastSpecialKeyDown = false;
|
||||
private boolean wasMovementSuppressed = false;
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.LOWEST)
|
||||
public void onClientTick(TickEvent.ClientTickEvent event) {
|
||||
@@ -84,9 +85,15 @@ public class ClientTickHandler {
|
||||
lastSpecialKeyDown = specialKeyDown;
|
||||
}
|
||||
|
||||
boolean suppressMovement = mc.currentScreen == null && ClientAbilityState.shouldSuppressMovementInput();
|
||||
if (!suppressMovement && wasMovementSuppressed) {
|
||||
syncMovementKeyStates(mc);
|
||||
}
|
||||
wasMovementSuppressed = suppressMovement;
|
||||
|
||||
// Suppress player input during ability-controlled phases.
|
||||
// Only suppress when no GUI screen is open (screens already capture input).
|
||||
if (mc.currentScreen == null && ClientAbilityState.shouldSuppressMovementInput()) {
|
||||
if (suppressMovement) {
|
||||
// Unpress movement keybinds at the source BEFORE updatePlayerMoveState() reads them.
|
||||
KeyBinding.setKeyBindState(mc.gameSettings.keyBindForward.getKeyCode(), false);
|
||||
KeyBinding.setKeyBindState(mc.gameSettings.keyBindBack.getKeyCode(), false);
|
||||
@@ -301,6 +308,27 @@ public class ClientTickHandler {
|
||||
|| keyCode == mc.gameSettings.keyBindSprint.getKeyCode();
|
||||
}
|
||||
|
||||
private void syncMovementKeyStates(Minecraft mc) {
|
||||
syncKeyBindingState(mc.gameSettings.keyBindForward);
|
||||
syncKeyBindingState(mc.gameSettings.keyBindBack);
|
||||
syncKeyBindingState(mc.gameSettings.keyBindLeft);
|
||||
syncKeyBindingState(mc.gameSettings.keyBindRight);
|
||||
syncKeyBindingState(mc.gameSettings.keyBindJump);
|
||||
syncKeyBindingState(mc.gameSettings.keyBindSneak);
|
||||
syncKeyBindingState(mc.gameSettings.keyBindSprint);
|
||||
}
|
||||
|
||||
private void syncKeyBindingState(KeyBinding keyBinding) {
|
||||
int keyCode = keyBinding.getKeyCode();
|
||||
boolean pressed;
|
||||
if (keyCode < 0) {
|
||||
pressed = Mouse.isButtonDown(keyCode + 100);
|
||||
} else {
|
||||
pressed = Keyboard.isKeyDown(keyCode);
|
||||
}
|
||||
KeyBinding.setKeyBindState(keyCode, pressed);
|
||||
}
|
||||
|
||||
private boolean isIgnoredKey(int key) {
|
||||
int[] var2 = this.ignoreKeys;
|
||||
int var3 = var2.length;
|
||||
|
||||
Reference in new issue
Block a user