From fb03ffdd430f0cfcc31e3b42dff331c75225b8bc Mon Sep 17 00:00:00 2001 From: Ableytner Date: Tue, 19 Nov 2024 23:35:33 +0100 Subject: [PATCH 1/2] implement getAllowedHatches for implosion compressor --- .../machines/multi/MTEImplosionCompressor.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTEImplosionCompressor.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTEImplosionCompressor.java index 742ff79ff60..6a264133c03 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEImplosionCompressor.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEImplosionCompressor.java @@ -2,14 +2,22 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; +import static gregtech.api.enums.HatchElement.Energy; +import static gregtech.api.enums.HatchElement.InputBus; +import static gregtech.api.enums.HatchElement.Maintenance; +import static gregtech.api.enums.HatchElement.Muffler; +import static gregtech.api.enums.HatchElement.OutputBus; import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_IMPLOSION_COMPRESSOR; import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_IMPLOSION_COMPRESSOR_ACTIVE; import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_IMPLOSION_COMPRESSOR_ACTIVE_GLOW; import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_IMPLOSION_COMPRESSOR_GLOW; +import java.util.List; + import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; +import com.google.common.collect.ImmutableList; import com.gtnewhorizon.structurelib.structure.IStructureElement; import gregtech.GTMod; @@ -17,6 +25,7 @@ import gregtech.api.enums.SoundResource; import gregtech.api.enums.Textures; import gregtech.api.enums.Textures.BlockIcons; +import gregtech.api.interfaces.IHatchElement; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -123,6 +132,11 @@ protected IStructureElement> getCasingElement() { return ofChain(ofBlock(GregTechAPI.sBlockCasings2, 0), ofBlock(GregTechAPI.sBlockCasings3, 4)); } + @Override + protected List>> getAllowedHatches() { + return ImmutableList.of(InputBus, OutputBus, Maintenance, Energy, Muffler); + } + @Override protected int getHatchTextureIndex() { return 16; From 54e1cfd1e653e6d771c2ed6b668c0f576369d0c6 Mon Sep 17 00:00:00 2001 From: Ableytner Date: Tue, 19 Nov 2024 23:37:36 +0100 Subject: [PATCH 2/2] implement ISurvivalConstructable for density^2 --- .../advanced/MTEAdvImplosionCompressor.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvImplosionCompressor.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvImplosionCompressor.java index 58e86b705b8..a2d19200ced 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvImplosionCompressor.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/MTEAdvImplosionCompressor.java @@ -14,7 +14,9 @@ import net.minecraft.item.ItemStack; +import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; import com.gtnewhorizon.structurelib.structure.StructureDefinition; import gregtech.api.enums.SoundResource; @@ -30,7 +32,8 @@ import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GTPPMultiBlockBase; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; -public class MTEAdvImplosionCompressor extends GTPPMultiBlockBase { +public class MTEAdvImplosionCompressor extends GTPPMultiBlockBase + implements ISurvivalConstructable { private int mCasing; private static IStructureDefinition STRUCTURE_DEFINITION = null; @@ -86,7 +89,7 @@ public IStructureDefinition getStructureDefinition() ofChain( buildHatchAdder(MTEAdvImplosionCompressor.class) .atLeast(InputBus, OutputBus, Maintenance, Energy, Muffler) - .casingIndex(48) + .casingIndex(getCasingTextureId()) .dot(1) .build(), onElementPass(x -> ++x.mCasing, ofBlock(sBlockCasings4, 0)))) @@ -100,6 +103,12 @@ public void construct(ItemStack stackSize, boolean hintsOnly) { buildPiece(mName, stackSize, hintsOnly, 1, 1, 0); } + @Override + public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { + if (mMachine) return -1; + return survivialBuildPiece(mName, stackSize, 1, 1, 0, elementBudget, env, false, true); + } + @Override public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { mCasing = 0;