diff options
author | isXander <xandersmith2008@gmail.com> | 2023-09-24 15:48:15 +0100 |
---|---|---|
committer | isXander <xandersmith2008@gmail.com> | 2023-09-24 15:48:15 +0100 |
commit | d2b67633c1d3ca0c46682b05955dafafd3597f1d (patch) | |
tree | 7e7ae123d0cb945a45eb940a12eb03a4d4e04d80 /common/src/main/java/dev/isxander/yacl3/mixin | |
parent | 554646dbd857e2fab1be8339ce8d0231ef2dbb4c (diff) | |
download | YetAnotherConfigLib-d2b67633c1d3ca0c46682b05955dafafd3597f1d.tar.gz YetAnotherConfigLib-d2b67633c1d3ca0c46682b05955dafafd3597f1d.tar.bz2 YetAnotherConfigLib-d2b67633c1d3ca0c46682b05955dafafd3597f1d.zip |
1.20.2
Diffstat (limited to 'common/src/main/java/dev/isxander/yacl3/mixin')
-rw-r--r-- | common/src/main/java/dev/isxander/yacl3/mixin/ContainerEventHandlerMixin.java | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/common/src/main/java/dev/isxander/yacl3/mixin/ContainerEventHandlerMixin.java b/common/src/main/java/dev/isxander/yacl3/mixin/ContainerEventHandlerMixin.java deleted file mode 100644 index 9fe8c58..0000000 --- a/common/src/main/java/dev/isxander/yacl3/mixin/ContainerEventHandlerMixin.java +++ /dev/null @@ -1,31 +0,0 @@ -package dev.isxander.yacl3.mixin; - -import net.minecraft.client.gui.components.events.ContainerEventHandler; -import net.minecraft.client.gui.components.events.GuiEventListener; -import net.minecraft.client.gui.components.tabs.TabNavigationBar; -import net.minecraft.client.gui.navigation.FocusNavigationEvent; -import net.minecraft.client.gui.navigation.ScreenAxis; -import net.minecraft.client.gui.navigation.ScreenDirection; -import net.minecraft.client.gui.navigation.ScreenRectangle; -import org.jetbrains.annotations.Nullable; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Redirect; - -import java.util.List; - -@Mixin(ContainerEventHandler.class) -public interface ContainerEventHandlerMixin { - /** - * This mixin is used to prevent the tab bar from being focused when navigating left or right - * through the YACL options screen. This can also apply to vanilla as navigating left or right - * should never result in focusing the always-at-the-top tab bar. - * Without this, navigating right from the option list focuses the tab bar, not the action buttons/description. - */ - @Redirect(method = {"nextFocusPathVaguelyInDirection", "nextFocusPathInDirection"}, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/components/events/ContainerEventHandler;children()Ljava/util/List;")) - default List<?> modifyFocusCandidates(ContainerEventHandler instance, ScreenRectangle screenArea, ScreenDirection direction, @Nullable GuiEventListener focused, FocusNavigationEvent event) { - if (direction.getAxis() == ScreenAxis.HORIZONTAL) - return instance.children().stream().filter(child -> !(child instanceof TabNavigationBar)).toList(); - return instance.children(); - } -} |