aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/metatileentity/implementations
diff options
context:
space:
mode:
authorGlease <4586901+Glease@users.noreply.github.com>2021-06-08 08:54:20 +0800
committerGlease <4586901+Glease@users.noreply.github.com>2021-07-30 14:34:37 +0800
commit38e0b4eb935f8aa4d5950889eb1928af085af192 (patch)
tree4a6ed6d692907fa52ea6721c626e85c0685afcc1 /src/main/java/gregtech/api/metatileentity/implementations
parentd736caaf43e43c2bd250f1b5d9a91c8dd06a6147 (diff)
downloadGT5-Unofficial-38e0b4eb935f8aa4d5950889eb1928af085af192.tar.gz
GT5-Unofficial-38e0b4eb935f8aa4d5950889eb1928af085af192.tar.bz2
GT5-Unofficial-38e0b4eb935f8aa4d5950889eb1928af085af192.zip
migrate a few more multis over
also removed the stupid ConcurrentHashMap in GT_MetaTileEntity_CubicMultiBlockBase Signed-off-by: Glease <4586901+Glease@users.noreply.github.com>
Diffstat (limited to 'src/main/java/gregtech/api/metatileentity/implementations')
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_CubicMultiBlockBase.java39
1 files changed, 16 insertions, 23 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 ef53c1bca2..c84ca61eec 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
@@ -6,9 +6,7 @@ import com.gtnewhorizon.structurelib.structure.StructureDefinition;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import net.minecraft.item.ItemStack;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.defer;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
@@ -30,7 +28,20 @@ import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
*/
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";
- private static final ConcurrentMap<Integer, IStructureDefinition<?>> STRUCTURE_DEFINITIONS = new ConcurrentHashMap<>();
+ protected static final IStructureDefinition<GT_MetaTileEntity_CubicMultiBlockBase<?>> STRUCTURE_DEFINITION = StructureDefinition.<GT_MetaTileEntity_CubicMultiBlockBase<?>>builder()
+ .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][]{
+ {"hhh", "hhh", "hhh"},
+ {"h-h", "hhh", "hhh"},
+ {"hhh", "hhh", "hhh"},
+ }))
+ .addElement('h', ofChain(
+ defer(t -> ofHatchAdder(GT_MetaTileEntity_CubicMultiBlockBase::addToMachineList, t.getHatchTextureIndex(), 1)),
+ onElementPass(
+ GT_MetaTileEntity_CubicMultiBlockBase::onCorrectCasingAdded,
+ defer(GT_MetaTileEntity_CubicMultiBlockBase::getCasingElement)
+ )
+ ))
+ .build();
private int mCasingAmount = 0;
protected GT_MetaTileEntity_CubicMultiBlockBase(int aID, String aName, String aNameRegional) {
@@ -41,24 +52,6 @@ public abstract class GT_MetaTileEntity_CubicMultiBlockBase<T extends GT_MetaTil
super(aName);
}
-
- private static IStructureDefinition<? extends GT_MetaTileEntity_CubicMultiBlockBase<?>> createStructure(GT_MetaTileEntity_CubicMultiBlockBase<?> aTile) {
- return StructureDefinition.<GT_MetaTileEntity_CubicMultiBlockBase<?>>builder()
- .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][]{
- {"hhh", "hhh", "hhh"},
- {"h-h", "hhh", "hhh"},
- {"hhh", "hhh", "hhh"},
- }))
- .addElement('h', ofChain(
- ofHatchAdder(GT_MetaTileEntity_CubicMultiBlockBase::addToMachineList, aTile.getHatchTextureIndex(), 1),
- onElementPass(
- GT_MetaTileEntity_CubicMultiBlockBase::onCorrectCasingAdded,
- aTile.getCasingElement()
- )
- ))
- .build();
- }
-
/**
* Create a simple 3x3x3 hollow cubic structure made of a single type of machine casing and accepts hatches everywhere.
* <p>
@@ -67,7 +60,7 @@ public abstract class GT_MetaTileEntity_CubicMultiBlockBase<T extends GT_MetaTil
@Override
@SuppressWarnings("unchecked")
public IStructureDefinition<T> getStructureDefinition() {
- return (IStructureDefinition<T>) STRUCTURE_DEFINITIONS.computeIfAbsent(getBaseMetaTileEntity().getMetaTileID(), o -> createStructure(this));
+ return (IStructureDefinition<T>) STRUCTURE_DEFINITION;
}
@Override