From 5ea5183724134c5ca6259ef7efcf46209661ecc7 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Wed, 24 Oct 2018 15:23:33 +0100 Subject: + Added ASM patch for GT MetaTile Tooltips. % Improve GT ASM. --- .../gtPlusPlus/api/helpers/MaterialHelper.java | 41 +++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) (limited to 'src/Java/gtPlusPlus/api/helpers') diff --git a/src/Java/gtPlusPlus/api/helpers/MaterialHelper.java b/src/Java/gtPlusPlus/api/helpers/MaterialHelper.java index 0acee40a0f..43f8ddeb19 100644 --- a/src/Java/gtPlusPlus/api/helpers/MaterialHelper.java +++ b/src/Java/gtPlusPlus/api/helpers/MaterialHelper.java @@ -2,10 +2,15 @@ package gtPlusPlus.api.helpers; import net.minecraft.item.ItemStack; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; + import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; - +import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Fluid; +import gregtech.api.util.GT_OreDictUnificator; import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.ItemUtils; public class MaterialHelper { @@ -17,4 +22,38 @@ public class MaterialHelper { return ItemUtils.getGregtechOreStack(oreprefix, material, amount); } + /** + * Generates a 16 Fluid Pipe + * @see {@code Example: Copper 16x Pipe (Materials.Copper, Materials.Copper.mName, "Copper", ID, 60, 1000, true)} + * @param aMaterial - Pipe Material + * @param name - Pipe Internal name + * @param displayName - Pipe Display Name + * @param aID - Pipe's Meta ID + * @param baseCapacity - Pipes Base Capacity + * @param heatCapacity - Pipe Max Temp + * @param gasProof - Is Gas Proof? + * @return A boolean which corresponds to whether or not the Pipe was registered to the Ore Dictionary. + */ + public static boolean generateHexadecuplePipe(Materials aMaterial, String name, String displayName, int aID, + int baseCapacity, int heatCapacity, boolean gasProof) { + if (Utils.getGregtechVersionAsInt() >= 50930) { + try { + Class aPipeEntity = GT_MetaPipeEntity_Fluid.class; + Constructor constructor = aPipeEntity + .getConstructor(new Class[] { int.class, String.class, String.class, float.class, + Materials.class, int.class, int.class, boolean.class, int.class }); + if (constructor != null) { + GT_MetaPipeEntity_Fluid aPipe; + aPipe = constructor.newInstance(aID, "GT_Pipe_" + name + "_Hexadecuple", + "Hexadecuple " + displayName + " Fluid Pipe", 1.0F, aMaterial, baseCapacity, heatCapacity, + gasProof, 16); + return GT_OreDictUnificator.registerOre("pipeHexadecuple" + aMaterial, aPipe.getStackForm(1L)); + } + + } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException + | IllegalArgumentException | InvocationTargetException e) { + } + } + return false; + } } -- cgit