diff options
author | isXander <xandersmith2008@gmail.com> | 2023-06-03 23:10:03 +0100 |
---|---|---|
committer | isXander <xandersmith2008@gmail.com> | 2023-06-04 16:25:09 +0100 |
commit | 3e36feeef60e56ef8cb7f737ac8eeab9fbcd6abb (patch) | |
tree | f9c3395b4da2235681b87a35ac5056a0724a181b /common/src/main/java/dev/isxander/yacl/mixin | |
parent | d00a486d3bdf6105f8ca8af1034c384058b8c832 (diff) | |
download | YetAnotherConfigLib-3e36feeef60e56ef8cb7f737ac8eeab9fbcd6abb.tar.gz YetAnotherConfigLib-3e36feeef60e56ef8cb7f737ac8eeab9fbcd6abb.tar.bz2 YetAnotherConfigLib-3e36feeef60e56ef8cb7f737ac8eeab9fbcd6abb.zip |
Change package and modid to yacl3 and yet_another_config_lib_3 respectively
Diffstat (limited to 'common/src/main/java/dev/isxander/yacl/mixin')
4 files changed, 0 insertions, 85 deletions
diff --git a/common/src/main/java/dev/isxander/yacl/mixin/AbstractSelectionListMixin.java b/common/src/main/java/dev/isxander/yacl/mixin/AbstractSelectionListMixin.java deleted file mode 100644 index 1b53e96..0000000 --- a/common/src/main/java/dev/isxander/yacl/mixin/AbstractSelectionListMixin.java +++ /dev/null @@ -1,25 +0,0 @@ -package dev.isxander.yacl.mixin; - -import net.minecraft.client.gui.components.AbstractSelectionList; -import org.objectweb.asm.Opcodes; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Redirect; - -import java.util.List; - -@Mixin(AbstractSelectionList.class) -public abstract class AbstractSelectionListMixin<E extends AbstractSelectionList.Entry<E>> { - @Shadow public abstract List<E> children(); - - /** - * Mojang use the field access of children to get max index to loop through keyboard navigation to find the next entry. - * YACL modifies these children() method to filter out hidden entries, so we need to redirect the field access to the - * method, so we don't get ArrayIndexOutOfBoundsException. - */ - @Redirect(method = "nextEntry(Lnet/minecraft/client/gui/navigation/ScreenDirection;Ljava/util/function/Predicate;Lnet/minecraft/client/gui/components/AbstractSelectionList$Entry;)Lnet/minecraft/client/gui/components/AbstractSelectionList$Entry;", at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/components/AbstractSelectionList;children:Ljava/util/List;", opcode = Opcodes.GETFIELD)) - private List<E> modifyChildrenCall(AbstractSelectionList<E> instance) { - return children(); - } -} diff --git a/common/src/main/java/dev/isxander/yacl/mixin/ContainerEventHandlerMixin.java b/common/src/main/java/dev/isxander/yacl/mixin/ContainerEventHandlerMixin.java deleted file mode 100644 index d864e17..0000000 --- a/common/src/main/java/dev/isxander/yacl/mixin/ContainerEventHandlerMixin.java +++ /dev/null @@ -1,31 +0,0 @@ -package dev.isxander.yacl.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;")) - private 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(); - } -} diff --git a/common/src/main/java/dev/isxander/yacl/mixin/MinecraftMixin.java b/common/src/main/java/dev/isxander/yacl/mixin/MinecraftMixin.java deleted file mode 100644 index c33eed7..0000000 --- a/common/src/main/java/dev/isxander/yacl/mixin/MinecraftMixin.java +++ /dev/null @@ -1,16 +0,0 @@ -package dev.isxander.yacl.mixin; - -import dev.isxander.yacl.gui.ImageRenderer; -import net.minecraft.client.Minecraft; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(Minecraft.class) -public class MinecraftMixin { - @Inject(method = "close", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/telemetry/ClientTelemetryManager;close()V")) - private void closeImages(CallbackInfo ci) { - ImageRenderer.closeAll(); - } -} diff --git a/common/src/main/java/dev/isxander/yacl/mixin/OptionInstanceAccessor.java b/common/src/main/java/dev/isxander/yacl/mixin/OptionInstanceAccessor.java deleted file mode 100644 index 4eea9a9..0000000 --- a/common/src/main/java/dev/isxander/yacl/mixin/OptionInstanceAccessor.java +++ /dev/null @@ -1,13 +0,0 @@ -package dev.isxander.yacl.mixin; - -import net.minecraft.client.OptionInstance; -import org.jetbrains.annotations.ApiStatus; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -@ApiStatus.Internal -@Mixin(OptionInstance.class) -public interface OptionInstanceAccessor<T> { - @Accessor - T getInitialValue(); -} |