mirror of
https://github.com/GTNewHorizons/NotEnoughEnergistics.git
synced 2026-11-17 02:45:29 +00:00
Set GT tool stats on pattern terminal (#9)
This commit is contained in:
1 parent
7d6598c9fb
commit
86ce155d07
3 files changed
+24
No files matched your search
@@ -172,6 +172,8 @@ public class NEECraftingHandler implements IOverlayHandler {
|
||||
}
|
||||
}
|
||||
|
||||
ItemUtils.transformGTTool(stack);
|
||||
|
||||
//Fix ItemStack with wrong meta
|
||||
if (stack.getItemDamage() == 32767) {
|
||||
stack.setItemDamage(0);
|
||||
|
||||
@@ -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) {}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user