From 7ca02b69a8b33f19f96340a69c0111cd1ae36e70 Mon Sep 17 00:00:00 2001 From: Integer Limit <103940576+IntegerLimit@users.noreply.github.com> Date: Fri, 12 Jul 2024 16:02:29 +1000 Subject: [PATCH] Misc AE2 Patches --- dependencies.gradle | 6 ++- gradle.properties | 3 +- .../nomiceu/nomilabs/core/LabsLateMixin.java | 17 ++++--- .../nomilabs/mixin/ae2/AEBaseGuiMixin.java | 50 +++++++++++++++++++ .../mixin/ae2/InscriberRecipeMixin.java | 47 +++++++++++++++++ .../mixins.nomilabs.appliedenergistics2.json | 14 ++++++ 6 files changed, 126 insertions(+), 11 deletions(-) create mode 100644 src/main/java/com/nomiceu/nomilabs/mixin/ae2/AEBaseGuiMixin.java create mode 100644 src/main/java/com/nomiceu/nomilabs/mixin/ae2/InscriberRecipeMixin.java create mode 100644 src/main/resources/mixins.nomilabs.appliedenergistics2.json diff --git a/dependencies.gradle b/dependencies.gradle index 284c4edf..db2ce3db 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -93,7 +93,7 @@ dependencies { compileOnly rfg.deobf("curse.maven:chisel-235279:2915375") // Version 1.0.2.45 // AE2, Used in Naquadah Reactors (AE2 Unofficial Extended Life used) (from CurseForge) - compileOnly rfg.deobf("curse.maven:ae2-extended-life-570458:4851091") // Version 0.55.27 + compileOnly rfg.deobf("curse.maven:ae2-extended-life-570458:5378163") // Version 0.56.5 // DeepMobEvolution, Used in DME Data Hatch (from CurseForge) compileOnly rfg.deobf("curse.maven:dme-737252:5043404") // Version 1.2.2 @@ -174,8 +174,10 @@ dependencies { runtimeOnly "curse.maven:ctm-267602:2915363" // Version 1.0.2.31 } + // This Mod has a Temporary Mixin to fix a Bug, which may be fixed in a Later Version! + // Check/Remove the mixin after updating! if (project.enable_ae2.toBoolean()) { - runtimeOnly "curse.maven:ae2-extended-life-570458:4851091" // Version 0.55.27 + runtimeOnly "curse.maven:ae2-extended-life-570458:4851091" // Version 0.56.5 } if (project.enable_dme.toBoolean()) { diff --git a/gradle.properties b/gradle.properties index 71beabc5..c98b74af 100644 --- a/gradle.properties +++ b/gradle.properties @@ -226,7 +226,8 @@ enable_ender_io = false enable_chisel = false # Whether to enable AE2 in runtime. Enables AE2 Blocks in DME Sim Chamber and Naq Reactors. -# If this is set to false, those blocks will be set to air. +# Also, for .56.5, also fixes mouse tweaks interactions with terminals. +# If this is set to false, those blocks will be set to air. The mixin will not apply. enable_ae2 = false # Whether to enable DME in runtime. Enables the DME Dat Hatch. diff --git a/src/main/java/com/nomiceu/nomilabs/core/LabsLateMixin.java b/src/main/java/com/nomiceu/nomilabs/core/LabsLateMixin.java index a1246f42..2a98e33e 100644 --- a/src/main/java/com/nomiceu/nomilabs/core/LabsLateMixin.java +++ b/src/main/java/com/nomiceu/nomilabs/core/LabsLateMixin.java @@ -43,7 +43,8 @@ public class LabsLateMixin implements ILateMixinLoader { LabsConfig.modIntegration.enableFTBUtilsIntegration), new AbstractMap.SimpleImmutableEntry<>(LabsValues.TOP_ADDONS_MODID, LabsConfig.modIntegration.enableTopAddonsIntegration), - new AbstractMap.SimpleImmutableEntry<>(LabsValues.TOP_MODID, true)) + new AbstractMap.SimpleImmutableEntry<>(LabsValues.TOP_MODID, true), + new AbstractMap.SimpleImmutableEntry<>(LabsValues.AE2_MODID, true)) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); @Override @@ -58,26 +59,26 @@ public boolean shouldMixinConfigQueue(String mixinConfig) { if (parts.length != 4) { LOGGER.fatal("Mixin Config Check Failed! Invalid Length."); - LOGGER.fatal("Mixin Config: " + mixinConfig); + LOGGER.fatal("Mixin Config: {}", mixinConfig); return true; } if (!Objects.equals(parts[1], LabsValues.LABS_MODID)) { LOGGER.error("Non Nomi-Labs Mixin Found in Mixin Queue. This is probably an error. Skipping..."); - LOGGER.error("Mixin Config: " + mixinConfig); + LOGGER.error("Mixin Config: {}", mixinConfig); return true; } if (!Loader.isModLoaded(parts[2])) { - LOGGER.error("Mod '" + parts[2] + - "' is not loaded. If this is a normal Nomi-CEu instance, this is probably an error."); - LOGGER.error("Not Loading Mixin Config " + mixinConfig); + LOGGER.error("Mod '{}' is not loaded. If this is a normal Nomi-CEu instance, this is probably an error.", + parts[2]); + LOGGER.error("Not Loading Mixin Config {}", mixinConfig); return false; } if (!modMixinsConfig.containsKey(parts[2]) || !modMixinsConfig.get(parts[2])) { - LOGGER.info("Integration for Mod '" + parts[2] + "' is not enabled, or does not exist."); - LOGGER.info("Not Loading Mixin Config " + mixinConfig); + LOGGER.info("Integration for Mod '{}' is not enabled, or does not exist.", parts[2]); + LOGGER.info("Not Loading Mixin Config {}", mixinConfig); return false; } diff --git a/src/main/java/com/nomiceu/nomilabs/mixin/ae2/AEBaseGuiMixin.java b/src/main/java/com/nomiceu/nomilabs/mixin/ae2/AEBaseGuiMixin.java new file mode 100644 index 00000000..33b19be5 --- /dev/null +++ b/src/main/java/com/nomiceu/nomilabs/mixin/ae2/AEBaseGuiMixin.java @@ -0,0 +1,50 @@ +package com.nomiceu.nomilabs.mixin.ae2; + +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.Slot; + +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.CallbackInfoReturnable; + +import appeng.client.gui.AEBaseGui; + +/** + * Fixes Mouse Tweaks Interactions in Terminals, for AE2 v0.56.5. + */ +@Mixin(value = AEBaseGui.class, remap = false) +public abstract class AEBaseGuiMixin extends GuiContainer { + + /** + * Mandatory Ignored Constructor + */ + public AEBaseGuiMixin(Container inventorySlotsIn) { + super(inventorySlotsIn); + } + + @Inject(method = "MT_isMouseTweaksDisabled", at = @At("HEAD"), cancellable = true) + public void setMouseTweaksEnabled(CallbackInfoReturnable cir) { + cir.setReturnValue(false); + } + + @Inject(method = "MT_isIgnored", at = @At("HEAD"), cancellable = true) + public void setMouseTweaksNotIgnored(Slot slot, CallbackInfoReturnable cir) { + cir.setReturnValue(false); + } + + @Inject(method = "MT_disableRMBDraggingFunctionality", at = @At("HEAD"), cancellable = true) + public void newRMBDraggingFunctionality(CallbackInfoReturnable cir) { + if (dragSplitting && dragSplittingButton == 1) { + dragSplitting = false; + if (getSlotUnderMouse() != null && + getSlotUnderMouse().isItemValid(mc.player.inventory.getItemStack())) + ignoreMouseUp = true; + + cir.setReturnValue(true); + } + + cir.setReturnValue(false); + } +} diff --git a/src/main/java/com/nomiceu/nomilabs/mixin/ae2/InscriberRecipeMixin.java b/src/main/java/com/nomiceu/nomilabs/mixin/ae2/InscriberRecipeMixin.java new file mode 100644 index 00000000..862c2111 --- /dev/null +++ b/src/main/java/com/nomiceu/nomilabs/mixin/ae2/InscriberRecipeMixin.java @@ -0,0 +1,47 @@ +package com.nomiceu.nomilabs.mixin.ae2; + +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +import javax.annotation.Nonnull; + +import net.minecraft.item.ItemStack; + +import org.jetbrains.annotations.Nullable; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Mutable; +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; + +import appeng.api.features.InscriberProcessType; +import appeng.core.features.registries.inscriber.InscriberRecipe; + +/** + * Fixes Inscriber Recipes, In GroovyScript, for AE2 v0.56.5. + */ +@Mixin(value = InscriberRecipe.class, remap = false) +public class InscriberRecipeMixin { + + @Mutable + @Shadow + @Final + @Nonnull + private List maybeTop; + + @Mutable + @Shadow + @Final + @Nonnull + private List maybeBot; + + @Inject(method = "", at = @At("RETURN")) + public void setMaybeTopBottomProperly(Collection inputs, ItemStack output, @Nullable List top, + @Nullable List bot, InscriberProcessType type, CallbackInfo ci) { + maybeTop = top == null || top.isEmpty() ? Collections.emptyList() : top; + maybeBot = bot == null || bot.isEmpty() ? Collections.emptyList() : bot; + } +} diff --git a/src/main/resources/mixins.nomilabs.appliedenergistics2.json b/src/main/resources/mixins.nomilabs.appliedenergistics2.json new file mode 100644 index 00000000..4293af1d --- /dev/null +++ b/src/main/resources/mixins.nomilabs.appliedenergistics2.json @@ -0,0 +1,14 @@ +{ + "package": "com.nomiceu.nomilabs.mixin.ae2", + "refmap": "mixins.nomilabs.refmap.json", + "target": "@env(DEFAULT)", + "minVersion": "0.8", + "compatibilityLevel": "JAVA_8", + "mixins": [ + "InscriberRecipeMixin" + ], + "client": [ + "AEBaseGuiMixin" + ], + "server": [] +}