Skip to content

Commit

Permalink
transfer gt++ asm fix for COFH's OreDictionaryArbiter to mixins
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexdoru committed Sep 21, 2024
1 parent 3e3560e commit 2725d06
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,13 @@ public class FixesConfig {
@Config.RequiresMcRestart
public static boolean fixCandycraftBlockSugarNPE;

// Cofh

@Config.Comment("Fix NPE in COFH's oredict")
@Config.DefaultBoolean(true)
@Config.RequiresMcRestart
public static boolean fixCofhOreDictNPE;

// Extra TiC

@Config.Comment("Disable ExtraTic's Integration with Metallurgy 3 Precious Materials Module: (Brass, Silver, Electrum & Platinum)")
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/mitchej123/hodgepodge/mixins/Mixins.java
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,9 @@ public enum Mixins {
.addMixinClasses("thermalexpansion.MixinTileInventoryTileLightFalse")
.addTargetedMod(TargetedMod.THERMALEXPANSION).setApplyIf(() -> ASMConfig.cofhWorldTransformer)
.setPhase(Phase.LATE).setSide(Side.BOTH)),
FIX_ORE_DICT_NPE(new Builder("Fix NPE in OreDictionaryArbiter")
.addMixinClasses("cofhcore.MixinOreDictionaryArbiter").setPhase(Phase.EARLY).setSide(Side.BOTH)
.addTargetedMod(TargetedMod.COFH_CORE).setApplyIf(() -> FixesConfig.fixCofhOreDictNPE)),

// Immersive engineering
JAVA12_IMMERSIVE_ENGINERRING(new Builder("Immersive Engineering Java-12 safe potion array resizing")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.mitchej123.hodgepodge.mixins.early.cofhcore;

import net.minecraft.item.ItemStack;

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;

import cofh.core.util.oredict.OreDictionaryArbiter;

@Mixin(OreDictionaryArbiter.class)
public class MixinOreDictionaryArbiter {

@Inject(method = "registerOreDictionaryEntry", at = @At("HEAD"), cancellable = true, remap = false)
private static void hodgepodge$fixNPE(ItemStack stack, String s, CallbackInfo ci) {
if (stack == null) {
ci.cancel();
}
}

}

0 comments on commit 2725d06

Please sign in to comment.