1
0
forked from Clones/Controlify

✏️ Remove vanilla override from show player list

This commit is contained in:
isXander
2023-05-07 12:46:21 +01:00
parent 09f23ff725
commit 63ebf2dc61
4 changed files with 26 additions and 1 deletions

View File

@ -240,7 +240,6 @@ public class ControllerBindings<T extends ControllerState> {
.identifier("controlify", "show_player_list") .identifier("controlify", "show_player_list")
.defaultBind(GamepadBinds.DPAD_RIGHT) .defaultBind(GamepadBinds.DPAD_RIGHT)
.category(MISC_CATEGORY) .category(MISC_CATEGORY)
.vanillaOverride(options.keyPlayerList, () -> false)
.build()); .build());
register(VMOUSE_MOVE_UP = ControllerBindingBuilder.create(controller) register(VMOUSE_MOVE_UP = ControllerBindingBuilder.create(controller)
.identifier("controlify", "vmouse_move_up") .identifier("controlify", "vmouse_move_up")

View File

@ -18,6 +18,7 @@ public class InGameInputHandler {
private final Minecraft minecraft; private final Minecraft minecraft;
private double lookInputX, lookInputY; private double lookInputX, lookInputY;
private boolean shouldShowPlayerList;
public InGameInputHandler(Controller<?, ?> controller) { public InGameInputHandler(Controller<?, ?> controller) {
this.controller = controller; this.controller = controller;
@ -38,6 +39,8 @@ public class InGameInputHandler {
} }
protected void handleKeybinds() { protected void handleKeybinds() {
shouldShowPlayerList = false;
if (Minecraft.getInstance().screen != null) if (Minecraft.getInstance().screen != null)
return; return;
@ -63,6 +66,8 @@ public class InGameInputHandler {
if (controller.bindings().TOGGLE_HUD_VISIBILITY.justPressed()) { if (controller.bindings().TOGGLE_HUD_VISIBILITY.justPressed()) {
minecraft.options.hideGui = !minecraft.options.hideGui; minecraft.options.hideGui = !minecraft.options.hideGui;
} }
shouldShowPlayerList = controller.bindings().SHOW_PLAYER_LIST.held();
} }
protected void handlePlayerLookInput() { protected void handlePlayerLookInput() {
@ -131,6 +136,10 @@ public class InGameInputHandler {
} }
} }
public boolean shouldShowPlayerList() {
return this.shouldShowPlayerList;
}
public record FunctionalLookInputModifier(BiFunction<Float, Controller<?, ?>, Float> x, BiFunction<Float, Controller<?, ?>, Float> y) implements LookInputModifier { public record FunctionalLookInputModifier(BiFunction<Float, Controller<?, ?>, Float> x, BiFunction<Float, Controller<?, ?>, Float> y) implements LookInputModifier {
@Override @Override
public float modifyX(float x, Controller<?, ?> controller) { public float modifyX(float x, Controller<?, ?> controller) {

View File

@ -0,0 +1,16 @@
package dev.isxander.controlify.mixins.core;
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import dev.isxander.controlify.Controlify;
import dev.isxander.controlify.ingame.InGameInputHandler;
import net.minecraft.client.gui.Gui;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@Mixin(Gui.class)
public class GuiMixin {
@ModifyExpressionValue(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/KeyMapping;isDown()Z"))
private boolean shouldShowPlayerList(boolean keyDown) {
return keyDown || Controlify.instance().inGameInputHandler().map(InGameInputHandler::shouldShowPlayerList).orElse(false);
}
}

View File

@ -23,6 +23,7 @@
"compat.yacl.SliderControllerElementMixin", "compat.yacl.SliderControllerElementMixin",
"compat.yacl.YACLScreenMixin", "compat.yacl.YACLScreenMixin",
"core.ClientPacketListenerMixin", "core.ClientPacketListenerMixin",
"core.GuiMixin",
"core.KeyboardHandlerMixin", "core.KeyboardHandlerMixin",
"core.MinecraftMixin", "core.MinecraftMixin",
"core.MouseHandlerMixin", "core.MouseHandlerMixin",