forked from Clones/Controlify
🤝 Re-add compatibility with YACL
This commit is contained in:
BIN
assets/icon.png
Normal file
BIN
assets/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
@ -1,9 +1,7 @@
|
|||||||
package dev.isxander.controlify.compatibility.yacl;
|
package dev.isxander.controlify.compatibility.yacl;
|
||||||
|
|
||||||
import dev.isxander.controlify.api.buttonguide.ButtonGuideApi;
|
|
||||||
import dev.isxander.controlify.api.buttonguide.ButtonGuidePredicate;
|
|
||||||
import dev.isxander.controlify.api.buttonguide.ButtonRenderPosition;
|
|
||||||
import dev.isxander.controlify.controller.Controller;
|
import dev.isxander.controlify.controller.Controller;
|
||||||
|
import dev.isxander.controlify.mixins.compat.yacl.YACLScreenCategoryTabAccessor;
|
||||||
import dev.isxander.controlify.screenop.ScreenProcessor;
|
import dev.isxander.controlify.screenop.ScreenProcessor;
|
||||||
import dev.isxander.yacl.gui.YACLScreen;
|
import dev.isxander.yacl.gui.YACLScreen;
|
||||||
|
|
||||||
@ -15,9 +13,10 @@ public class YACLScreenProcessor extends ScreenProcessor<YACLScreen> {
|
|||||||
@Override
|
@Override
|
||||||
protected void handleButtons(Controller<?, ?> controller) {
|
protected void handleButtons(Controller<?, ?> controller) {
|
||||||
if (controller.bindings().GUI_ABSTRACT_ACTION_1.justPressed()) {
|
if (controller.bindings().GUI_ABSTRACT_ACTION_1.justPressed()) {
|
||||||
|
if (screen.tabManager.getCurrentTab() instanceof YACLScreen.CategoryTab categoryTab) {
|
||||||
|
((YACLScreenCategoryTabAccessor) categoryTab).getSaveFinishedButton().onPress();
|
||||||
|
}
|
||||||
playClackSound();
|
playClackSound();
|
||||||
// if (screen.tabManager.getCurrentTab() instanceof )
|
|
||||||
// screen.finishedSaveButton.onPress();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
super.handleButtons(controller);
|
super.handleButtons(controller);
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
package dev.isxander.controlify.mixins.compat.yacl;
|
||||||
|
|
||||||
|
import dev.isxander.yacl.gui.YACLScreen;
|
||||||
|
import net.minecraft.client.gui.components.Button;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
|
|
||||||
|
@Mixin(YACLScreen.CategoryTab.class)
|
||||||
|
public interface YACLScreenCategoryTabAccessor {
|
||||||
|
@Accessor
|
||||||
|
Button getSaveFinishedButton();
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
package dev.isxander.controlify.mixins.compat.yacl;
|
||||||
|
|
||||||
|
import dev.isxander.controlify.api.buttonguide.ButtonGuideApi;
|
||||||
|
import dev.isxander.controlify.api.buttonguide.ButtonGuidePredicate;
|
||||||
|
import dev.isxander.controlify.api.buttonguide.ButtonRenderPosition;
|
||||||
|
import dev.isxander.yacl.api.ConfigCategory;
|
||||||
|
import dev.isxander.yacl.gui.YACLScreen;
|
||||||
|
import net.minecraft.client.gui.components.Button;
|
||||||
|
import org.spongepowered.asm.mixin.Final;
|
||||||
|
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.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
@Mixin(YACLScreen.CategoryTab.class)
|
||||||
|
public class YACLScreenCategoryTabMixin {
|
||||||
|
@Shadow @Final private Button saveFinishedButton;
|
||||||
|
|
||||||
|
@Inject(method = "<init>", at = @At("RETURN"))
|
||||||
|
private void onConstructCategory(YACLScreen this$0, ConfigCategory category, CallbackInfo ci) {
|
||||||
|
ButtonGuideApi.addGuideToButton(saveFinishedButton, bindings -> bindings.GUI_ABSTRACT_ACTION_1, ButtonRenderPosition.TEXT, ButtonGuidePredicate.ALWAYS);
|
||||||
|
}
|
||||||
|
}
|
@ -24,6 +24,8 @@
|
|||||||
"compat.sodium.SodiumOptionsGUIMixin",
|
"compat.sodium.SodiumOptionsGUIMixin",
|
||||||
"compat.yacl.CyclingControllerElementMixin",
|
"compat.yacl.CyclingControllerElementMixin",
|
||||||
"compat.yacl.SliderControllerElementMixin",
|
"compat.yacl.SliderControllerElementMixin",
|
||||||
|
"compat.yacl.YACLScreenCategoryTabAccessor",
|
||||||
|
"compat.yacl.YACLScreenCategoryTabMixin",
|
||||||
"compat.yacl.YACLScreenMixin",
|
"compat.yacl.YACLScreenMixin",
|
||||||
"core.ClientPacketListenerMixin",
|
"core.ClientPacketListenerMixin",
|
||||||
"core.GuiMixin",
|
"core.GuiMixin",
|
||||||
|
Reference in New Issue
Block a user