diff --git a/dependencies.gradle b/dependencies.gradle index d7b4a44..002ed1f 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -16,4 +16,6 @@ dependencies { compileOnly("com.gregoriust.gregtech:gregtech_1.7.10:6.14.23:dev") { transitive = false } compileOnly("curse.maven:thaumcraft-nei-plugin-225095:2241913") { transitive = false } compileOnly("curse.maven:thermal-expansion-69163:2388759") { transitive = false } + + runtime("curse.maven:cofh-core-69162:2388751") } diff --git a/src/main/java/com/github/vfyjxf/nee/nei/NEECraftingHandler.java b/src/main/java/com/github/vfyjxf/nee/nei/NEECraftingHandler.java index e2b1bad..47ab943 100644 --- a/src/main/java/com/github/vfyjxf/nee/nei/NEECraftingHandler.java +++ b/src/main/java/com/github/vfyjxf/nee/nei/NEECraftingHandler.java @@ -172,6 +172,8 @@ public class NEECraftingHandler implements IOverlayHandler { } } + ItemUtils.transformGTTool(stack); + //Fix ItemStack with wrong meta if (stack.getItemDamage() == 32767) { stack.setItemDamage(0); diff --git a/src/main/java/com/github/vfyjxf/nee/utils/ItemUtils.java b/src/main/java/com/github/vfyjxf/nee/utils/ItemUtils.java index 690a984..ec395a0 100644 --- a/src/main/java/com/github/vfyjxf/nee/utils/ItemUtils.java +++ b/src/main/java/com/github/vfyjxf/nee/utils/ItemUtils.java @@ -6,6 +6,7 @@ import com.github.vfyjxf.nee.processor.IRecipeProcessor; import com.github.vfyjxf.nee.processor.RecipeProcessor; import com.google.gson.Gson; import com.google.gson.JsonSyntaxException; +import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -206,4 +207,23 @@ public final class ItemUtils { return false; } + public static void transformGTTool(ItemStack stack) { + if (!Loader.isModLoaded("gregtech")) return; + try { + Class GTToolClazz = Class.forName("gregtech.api.items.GT_MetaGenerated_Tool"); + if (GTToolClazz.isAssignableFrom(stack.getItem().getClass())) { + NBTTagCompound NBT = stack.getTagCompound(); + if (NBT == null) { + NBT = new NBTTagCompound(); + NBTTagCompound NBTToolStats = new NBTTagCompound(); + NBTToolStats.setString("PrimaryMaterial", "Neutronium"); + NBTToolStats.setString("SecondaryMaterial", "Neutronium"); + NBTToolStats.setInteger("MaxDamage", 65536000); + NBT.setTag("GT.ToolStats", NBTToolStats); + stack.setTagCompound(NBT); + } + } + } catch (ClassNotFoundException ignored) {} + } + }