Skip to content

Commit

Permalink
Misc AE2 Patches
Browse files Browse the repository at this point in the history
  • Loading branch information
IntegerLimit committed Jul 12, 2024
1 parent 5d9fc69 commit 7ca02b6
Show file tree
Hide file tree
Showing 6 changed files with 126 additions and 11 deletions.
6 changes: 4 additions & 2 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()) {
Expand Down
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
17 changes: 9 additions & 8 deletions src/main/java/com/nomiceu/nomilabs/core/LabsLateMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
}

Expand Down
50 changes: 50 additions & 0 deletions src/main/java/com/nomiceu/nomilabs/mixin/ae2/AEBaseGuiMixin.java
Original file line number Diff line number Diff line change
@@ -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<Boolean> cir) {
cir.setReturnValue(false);
}

@Inject(method = "MT_isIgnored", at = @At("HEAD"), cancellable = true)
public void setMouseTweaksNotIgnored(Slot slot, CallbackInfoReturnable<Boolean> cir) {
cir.setReturnValue(false);
}

@Inject(method = "MT_disableRMBDraggingFunctionality", at = @At("HEAD"), cancellable = true)
public void newRMBDraggingFunctionality(CallbackInfoReturnable<Boolean> cir) {
if (dragSplitting && dragSplittingButton == 1) {
dragSplitting = false;
if (getSlotUnderMouse() != null &&
getSlotUnderMouse().isItemValid(mc.player.inventory.getItemStack()))
ignoreMouseUp = true;

cir.setReturnValue(true);
}

cir.setReturnValue(false);
}
}
Original file line number Diff line number Diff line change
@@ -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<ItemStack> maybeTop;

@Mutable
@Shadow
@Final
@Nonnull
private List<ItemStack> maybeBot;

@Inject(method = "<init>", at = @At("RETURN"))
public void setMaybeTopBottomProperly(Collection<ItemStack> inputs, ItemStack output, @Nullable List<ItemStack> top,
@Nullable List<ItemStack> bot, InscriberProcessType type, CallbackInfo ci) {
maybeTop = top == null || top.isEmpty() ? Collections.emptyList() : top;
maybeBot = bot == null || bot.isEmpty() ? Collections.emptyList() : bot;
}
}
14 changes: 14 additions & 0 deletions src/main/resources/mixins.nomilabs.appliedenergistics2.json
Original file line number Diff line number Diff line change
@@ -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": []
}

0 comments on commit 7ca02b6

Please sign in to comment.