@@ -111,6 +111,8 @@ public ResourceLocation parseResource(String path){
111
111
112
112
protected Map <ToggleKeyMapping , Boolean > wasToggleKeyDown = new HashMap <>();
113
113
114
+ protected boolean forceRawKeyDown = false ;
115
+
114
116
public final List <Module > modules = new ArrayList <>();
115
117
116
118
public InvMove () {
@@ -179,7 +181,7 @@ private boolean handleToggleMovementKey(Screen screen, boolean couldMove) {
179
181
return couldMove ;
180
182
}
181
183
182
- public void onInputUpdate (Input input ){
184
+ public void onInputUpdate (Input input , boolean sneaking , float sneakSpeed ){
183
185
if (Minecraft .getInstance ().player == null ) {
184
186
return ;
185
187
}
@@ -262,16 +264,7 @@ public void onInputUpdate(Input input){
262
264
}
263
265
264
266
// tick movement
265
- // TODO: consider mixing into KeyboardInput::tick or KeyMapping::isDown instead of this for better compatibility
266
- // that would also fix swift sneak (gh-21)
267
- manualTickMovement (input , Minecraft .getInstance ().player .isMovingSlowly (), Minecraft .getInstance ().player .isSpectator ());
268
-
269
- // set sprinting using raw keybind data
270
- // edit: this is commented out to let vanilla handle it (requires an extra mixin on forge)
271
- // letting vanilla do it might fix some bugs with other mods that affect sprinting
272
- // if(!Minecraft.getInstance().player.isSprinting() && !Minecraft.getInstance().player.isCrouching()) {
273
- // Minecraft.getInstance().player.setSprinting(rawIsKeyDown(Minecraft.getInstance().options.keySprint));
274
- // }
267
+ inputTickRaw (input , sneaking , sneakSpeed );
275
268
276
269
}else if (Minecraft .getInstance ().screen != null ){
277
270
// we are in a screen that we can't move in
@@ -366,29 +359,16 @@ public static Field[] getDeclaredFieldsSuper(Class<?> aClass) {
366
359
}
367
360
368
361
/**
369
- * Clone of Input.tick but uses raw keybind data
362
+ * Calls Input.tick but forces using raw keybind data
370
363
*/
371
- public void manualTickMovement (Input input , boolean slow , boolean noDampening ) {
372
-
373
- input .up = rawIsKeyDown (Minecraft .getInstance ().options .keyUp );
374
- input .down = rawIsKeyDown (Minecraft .getInstance ().options .keyDown );
375
- input .left = rawIsKeyDown (Minecraft .getInstance ().options .keyLeft );
376
- input .right = rawIsKeyDown (Minecraft .getInstance ().options .keyRight );
377
- input .forwardImpulse = input .up == input .down ? 0.0F : (float )(input .up ? 1 : -1 );
378
- input .leftImpulse = input .left == input .right ? 0.0F : (float )(input .left ? 1 : -1 );
379
- input .jumping = rawIsKeyDown (Minecraft .getInstance ().options .keyJump ) && InvMoveConfig .MOVEMENT .JUMP .get ();
380
-
381
- input .shiftKeyDown = rawIsKeyDown (Minecraft .getInstance ().options .keyShift );
382
- if (!noDampening && (input .shiftKeyDown || slow )) {
383
- input .leftImpulse = (float )((double )input .leftImpulse * 0.3D );
384
- input .forwardImpulse = (float )((double )input .forwardImpulse * 0.3D );
385
- }
364
+ public void inputTickRaw (Input input , boolean sneaking , float sneakSpeed ) {
365
+ forceRawKeyDown = true ;
366
+ input .tick (sneaking , sneakSpeed );
367
+ forceRawKeyDown = false ;
386
368
}
387
369
388
- public static boolean rawIsKeyDown (KeyMapping key ){
389
- // this field is accesswidened
390
- // can't use the method because it has extra conditions in forge
391
- return key .isDown ;
370
+ public boolean shouldForceRawKeyDown () {
371
+ return forceRawKeyDown ;
392
372
}
393
373
394
374
/**
0 commit comments