From e951d10b41bc2bfbfcb178b821fac09825f023c5 Mon Sep 17 00:00:00 2001 From: Technus Date: Sun, 16 Dec 2018 21:03:04 +0100 Subject: Add simple mass overrides for replicator --- .../basic/GT_MetaTileEntity_Replicator.java | 28 ++++++++++++---------- 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Replicator.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Replicator.java index f3fcb3c5a7..bf7abe855f 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Replicator.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Replicator.java @@ -15,14 +15,22 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; import java.util.Arrays; +import java.util.HashMap; import java.util.Iterator; public class GT_MetaTileEntity_Replicator extends GT_MetaTileEntity_BasicMachine { private static int sHeaviestElementMass = 0; + public static final HashMap MASS_OVERRIDES =new HashMap<>(); + static{ + //put overrides here + //ex. + //MASS_OVERRIDES.put(Materials.get("cake"),Materials.get("cake").getMass()); + //MASS_OVERRIDES.put(Materials.get("otherCake"),1235234L); + } public GT_MetaTileEntity_Replicator(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 1, "Producing Elemental Matter", 1, 1, "Replicator.png", "", new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_REPLICATOR_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_REPLICATOR), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_REPLICATOR_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_REPLICATOR), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_REPLICATOR_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_REPLICATOR), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_REPLICATOR_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_REPLICATOR)}); + super(aID, aName, aNameRegional, aTier, 1, "Producing Elemental Matter", 1, 1, "Replicator.png", "", new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_REPLICATOR_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_REPLICATOR), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_REPLICATOR_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_REPLICATOR), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_REPLICATOR_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_REPLICATOR), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_REPLICATOR_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_REPLICATOR)); } public GT_MetaTileEntity_Replicator(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { @@ -42,8 +50,8 @@ public class GT_MetaTileEntity_Replicator if ((tFluid != null) && (tFluid.isFluidEqual(Materials.UUMatter.getFluid(1L)))) { ItemStack tDataOrb = getSpecialSlot(); if ((ItemList.Tool_DataOrb.isStackEqual(tDataOrb, false, true)) && (Behaviour_DataOrb.getDataTitle(tDataOrb).equals("Elemental-Scan"))) { - Materials tMaterial = (Materials) Element.get(Behaviour_DataOrb.getDataName(tDataOrb)).mLinkedMaterials.get(0); - long tMass = tMaterial.getMass(); + Materials tMaterial = Element.get(Behaviour_DataOrb.getDataName(tDataOrb)).mLinkedMaterials.get(0); + long tMass = MASS_OVERRIDES.getOrDefault(tMaterial,tMaterial.getMass()); if ((tFluid.amount >= tMass) && (tMass > 0L)) { this.mEUt = GT_Utility.safeInt(gregtech.api.enums.GT_Values.V[this.mTier],1); @@ -56,26 +64,22 @@ public class GT_MetaTileEntity_Replicator if ((this.mOutputItems[0] = GT_OreDictUnificator.get(OrePrefixes.cell, tMaterial, 1L)) != null) { if ((this.mOutputFluid = GT_Utility.getFluidForFilledItem(this.mOutputItems[0], true)) == null) { if (ItemList.Cell_Empty.isStackEqual(getInputAt(0))) { - if (canOutput(new ItemStack[]{this.mOutputItems[0]})) { + if (canOutput(this.mOutputItems[0])) { getInputAt(0).stackSize -= 1; - FluidStack - tmp231_230 = tFluid; - tmp231_230.amount = ((int) (tmp231_230.amount - tMass)); + tFluid.amount = ((int) (tFluid.amount - tMass)); return 2; } } } else { this.mOutputItems[0] = null; if ((getDrainableStack() == null) || ((getDrainableStack().isFluidEqual(this.mOutputFluid)) && (getDrainableStack().amount < 16000))) { - FluidStack tmp287_286 = tFluid; - tmp287_286.amount = ((int) (tmp287_286.amount - tMass)); + tFluid.amount = ((int) (tFluid.amount - tMass)); return 2; } } } - } else if (canOutput(new ItemStack[]{this.mOutputItems[0]})) { - FluidStack tmp322_321 = tFluid; - tmp322_321.amount = ((int) (tmp322_321.amount - tMass)); + } else if (canOutput(this.mOutputItems[0])) { + tFluid.amount = ((int) (tFluid.amount - tMass)); return 2; } } -- cgit From 97ca549386531ee4e0aa3432b41d8a2f2e41cd97 Mon Sep 17 00:00:00 2001 From: Technus Date: Sun, 16 Dec 2018 21:10:19 +0100 Subject: More examples???? --- .../tileentities/machines/basic/GT_MetaTileEntity_Replicator.java | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Replicator.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Replicator.java index bf7abe855f..ab7cb30f94 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Replicator.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Replicator.java @@ -27,6 +27,8 @@ public class GT_MetaTileEntity_Replicator //ex. //MASS_OVERRIDES.put(Materials.get("cake"),Materials.get("cake").getMass()); //MASS_OVERRIDES.put(Materials.get("otherCake"),1235234L); + //MASS_OVERRIDES.put(Materials.Kalendrite,1235234L); + //MASS_OVERRIDES.put(Materials.Kalendrite,Materials.Kalendrite*2); } public GT_MetaTileEntity_Replicator(int aID, String aName, String aNameRegional, int aTier) { -- cgit From 344f2105ca598daf6ef2620d6f1f466d0d56e13c Mon Sep 17 00:00:00 2001 From: Technus Date: Sun, 16 Dec 2018 21:12:33 +0100 Subject: Fix mistake in example --- .../tileentities/machines/basic/GT_MetaTileEntity_Replicator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Replicator.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Replicator.java index ab7cb30f94..7079713acf 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Replicator.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Replicator.java @@ -28,7 +28,7 @@ public class GT_MetaTileEntity_Replicator //MASS_OVERRIDES.put(Materials.get("cake"),Materials.get("cake").getMass()); //MASS_OVERRIDES.put(Materials.get("otherCake"),1235234L); //MASS_OVERRIDES.put(Materials.Kalendrite,1235234L); - //MASS_OVERRIDES.put(Materials.Kalendrite,Materials.Kalendrite*2); + //MASS_OVERRIDES.put(Materials.Kalendrite,Materials.Kalendrite.getMass()*2); } public GT_MetaTileEntity_Replicator(int aID, String aName, String aNameRegional, int aTier) { -- cgit