Elevator Block? Broken. Cannot go up.
Legion495 opened this issue ยท 2 comments
I ran into this bug in a modpack made by myself. Here are some techniques to use when debugging this, in case anyone needs them:
tldr: This is caused by mixin conflicts with other mods.
- Read the code. The
teleportUp()
function does the real work for teleporting the player upwards. It is called upon receiving a serverbound packet of typeJUMP
, which is sent by the client in the handler for a jump event. The triggering of the event is injected into Minecraft source with a mixin calledMixinKeyBinding
. - Analyze possible conflicts on the mixin that disables the triggering of a jump event. Use
-Dmixin.debug.export=true
as a JVM argument to export patched bytecode (in this case, we need to examine the patched code ofnet.minecraft.client.option.KeyBinding#onKeyPressed
). Navigate torun/.mixin.out
under.minecraft
folder, and use a decompiler to check the classKeyBinding
. Most of the case you can see that code injected by another mod cancelled the execution of any other remaining code in the functiononKeyPressed
, including what has been injected by TechReborn. Simply remove that conflicting mod would be enough.
An example is provided below, where the injection performed by Modern Keybinding disabled any other injection:
@Environment(EnvType.CLIENT)
public class KeyBinding implements ... {
...
public static void onKeyPressed(InputUtil.Key key) {
CallbackInfo callbackInfo2 = new CallbackInfo("onKeyPressed", true);
handler$zeo000$mkb$inject$onKeyPressed(key, callbackInfo2);
if (!callbackInfo2.isCancelled()) {
KeyBinding keyBinding = (KeyBinding)KEY_TO_BINDINGS.get(key);
if (keyBinding != null) {
handler$zml000$reborncore$onKeyPressed(key, (CallbackInfo)null, keyBinding);
int var10001 = keyBinding.timesPressed + 1;
handler$zml000$reborncore$onKeyPressed(key, (CallbackInfo)null, keyBinding);
keyBinding.timesPressed = var10001;
}
}
}
...
@MixinMerged(
mixin = "committee.nova.mkb.mixin.MixinKeyBinding",
priority = 1000,
sessionId = "c281a675-014a-461e-abd2-85503f16c90e"
)
private static void handler$zeo000$mkb$inject$onKeyPressed(InputUtil.Key key, CallbackInfo ci) {
ci.cancel(); // NOTE: this cancels everything follows in onKeyPressed including injection by RebornCore
if (ModernKeyBinding.nonConflictKeys()) {
MAP.lookupActives(key).forEach((k) -> {
((IKeyBinding)k).press();
});
} else {
KeyBinding keyBinding = MAP.lookupActive(key);
if (keyBinding != null) {
((IKeyBinding)keyBinding).press();
}
}
}
}
Reported on https://github.com/AMPZNetwork/All-The-Fabric-5