From ea5c515f4769fa83f4eb6268f0b8048f76fbb0ac Mon Sep 17 00:00:00 2001 From: Glease <4586901+Glease@users.noreply.github.com> Date: Fri, 30 Jul 2021 17:34:20 +0800 Subject: Make GT_MetaTileEntity_CubicMultiBlockBase easier to use --- .../GT_MetaTileEntity_CubicMultiBlockBase.java | 55 ++++++++++++++++++++-- 1 file changed, 50 insertions(+), 5 deletions(-) (limited to 'src/main/java/gregtech/api/metatileentity/implementations') diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_CubicMultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_CubicMultiBlockBase.java index fa7bb739a9..de36b845b2 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_CubicMultiBlockBase.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_CubicMultiBlockBase.java @@ -13,19 +13,56 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; /** - * A simple 3x3x3 hollow cubic multiblock, that can be arbitrarily rotated, made of a single type of machine casing and accepts hatches everywhere. + * A simple 3x3x3 hollow cubic multiblock, that can be arbitrarily rotated, made of a single type of machine casing, accepts hatches everywhere. + * * Controller will be placed in front center of the structure. *
* Note: You cannot use different casing for the same Class. Make a new subclass for it. You also should not change the casing * dynamically, i.e. it should be a dumb method returning some sort of constant. *
* Implementation tips: - * 1. To restrict hatches, override {@link #addDynamoToMachineList(IGregTechTileEntity, int)} and its cousins instead of overriding the whole + *
+ * {@code + * @Override + * public boolean addInputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + * if (aTileEntity == null) return false; + * IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + * if (aMetaTileEntity == null) return false; + * if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { + * if (((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mTier != 0) return false; // addition + * ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); + * ((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity).mRecipeMap = getRecipeMap(); + * return mInputHatches.add((GT_MetaTileEntity_Hatch_Input) aMetaTileEntity); + * } + * if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputBus) { + * if (((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mTier != 0) return false; // addition + * ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); + * ((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity).mRecipeMap = getRecipeMap(); + * return mInputBusses.add((GT_MetaTileEntity_Hatch_InputBus) aMetaTileEntity); + * } + * return false; + * } + * }+ * Example 2: Allow dynamo, muffler and prevent energy hatch + *
+ * {@code + * @Override + * public boolean addToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + * return addInputToMachineList(aTileEntity, aBaseCasingIndex) || + * addOutputToMachineList(aTileEntity, aBaseCasingIndex) || + * addDynamoToMachineList(aTileEntity, aBaseCasingIndex) || + * addMufflerToMachineList(aTileEntity, aBaseCasingIndex) || + * addMaintenanceToMachineList(aTileEntity, aBaseCasingIndex); + * } + * }