aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/metatileentity
diff options
context:
space:
mode:
authorGlease <4586901+Glease@users.noreply.github.com>2021-08-01 02:59:57 +0800
committerGlease <4586901+Glease@users.noreply.github.com>2021-08-01 02:59:57 +0800
commit290e3d4ddf85fa6f912f5c81028a3032fb6ca1c7 (patch)
treee5951870823f276651cc0a7d7c8b5b97e1da5ae2 /src/main/java/gregtech/api/metatileentity
parent550343a732972184bc488451ae639c620988c972 (diff)
downloadGT5-Unofficial-290e3d4ddf85fa6f912f5c81028a3032fb6ca1c7.tar.gz
GT5-Unofficial-290e3d4ddf85fa6f912f5c81028a3032fb6ca1c7.tar.bz2
GT5-Unofficial-290e3d4ddf85fa6f912f5c81028a3032fb6ca1c7.zip
Fix off by one in cubic multi base and tooltip builder
Also added a command to toggle structure lib debug print. Signed-off-by: Glease <4586901+Glease@users.noreply.github.com>
Diffstat (limited to 'src/main/java/gregtech/api/metatileentity')
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_CubicMultiBlockBase.java57
1 files changed, 6 insertions, 51 deletions
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 de36b845b2..3854a96cda 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,56 +13,19 @@ 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, accepts hatches everywhere.
- *
+ * A simple 3x3x3 hollow cubic multiblock, that can be arbitrarily rotated, made of a single type of machine casing and accepts hatches everywhere.
* Controller will be placed in front center of the structure.
* <p>
* 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.
* <p>
* Implementation tips:
- * <ul>
- * <li>To restrict hatches, override {@link #addDynamoToMachineList(IGregTechTileEntity, int)} and its cousins instead of overriding the whole
+ * 1. To restrict hatches, override {@link #addDynamoToMachineList(IGregTechTileEntity, int)} and its cousins instead of overriding the whole
* {@link #getStructureDefinition()} or change {@link #checkHatches(IGregTechTileEntity, ItemStack)}. The former is a total overkill, while the later cannot
* stop the structure check early.
- * Example 1: Require ULV input only:
- * <pre>
- * {@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;
- * }
- * }</pre>
- * Example 2: Allow dynamo, muffler and prevent energy hatch
- * <pre>
- * {@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);
- * }
- * }</pre></li>
- * <li>To limit rotation, override {@link #getInitialAlignmentLimits()}</li>
- *</ul>
- * @param <T> this
+ * 2. To limit rotation, override {@link #getInitialAlignmentLimits()}
+ *
+ * @param <T>
*/
public abstract class GT_MetaTileEntity_CubicMultiBlockBase<T extends GT_MetaTileEntity_CubicMultiBlockBase<T>> extends GT_MetaTileEntity_EnhancedMultiBlockBase<T> {
protected static final String STRUCTURE_PIECE_MAIN = "main";
@@ -95,14 +58,6 @@ public abstract class GT_MetaTileEntity_CubicMultiBlockBase<T extends GT_MetaTil
super(aName);
}
- @Override
- public boolean addToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) {
- return addInputToMachineList(aTileEntity, aBaseCasingIndex) ||
- addOutputToMachineList(aTileEntity, aBaseCasingIndex) ||
- addEnergyInputToMachineList(aTileEntity, aBaseCasingIndex) ||
- addMaintenanceToMachineList(aTileEntity, aBaseCasingIndex);
- }
-
/**
* Create a simple 3x3x3 hollow cubic structure made of a single type of machine casing and accepts hatches everywhere.
* <p>
@@ -123,7 +78,7 @@ public abstract class GT_MetaTileEntity_CubicMultiBlockBase<T extends GT_MetaTil
public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
mCasingAmount = 0;
return checkPiece(STRUCTURE_PIECE_MAIN, 1, 1, 0) &&
- mCasingAmount > getRequiredCasingCount() &&
+ mCasingAmount >= getRequiredCasingCount() &&
checkHatches(aBaseMetaTileEntity, aStack);
}