Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import com.therandomlabs.randompatches.RandomPatches;
import com.therandomlabs.randompatches.client.BoundKeyAccessor;
import com.therandomlabs.randompatches.client.RPKeyBindingHandler;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.options.KeyBinding;
import net.minecraft.client.util.InputUtil;
Expand Down Expand Up @@ -106,6 +107,11 @@ private void conflicts(KeyBinding keyBinding, CallbackInfoReturnable<Boolean> in
@SuppressWarnings("ConstantConditions")
@Inject(method = "setKeyPressed", at = @At("HEAD"), cancellable = true)
private static void setKeyPressed(InputUtil.Key key, boolean pressed, CallbackInfo info) {
// Amecs implements the same fix. Performing it twice breaks sticky key bindings
if (FabricLoader.getInstance().isModLoaded("amecsapi")) {
return;
}

//In vanilla, setPressed is only called on the most recently registered KeyBinding.
keysById.values().stream().filter(keyBinding -> key.equals(
((KeyBindingMixin) (Object) keyBinding).getBoundKey())
Expand Down