Skip to content

Commit

Permalink
Fix NEI preview for Implosion Compressor and Density^2 (#3522)
Browse files Browse the repository at this point in the history
Co-authored-by: Martin Robertz <[email protected]>
Co-authored-by: Mary <[email protected]>
  • Loading branch information
3 people authored Nov 23, 2024
1 parent e69032e commit c7cb999
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,30 @@

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;
import gregtech.api.GregTechAPI;
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;
Expand Down Expand Up @@ -123,6 +132,11 @@ protected IStructureElement<MTECubicMultiBlockBase<?>> getCasingElement() {
return ofChain(ofBlock(GregTechAPI.sBlockCasings2, 0), ofBlock(GregTechAPI.sBlockCasings3, 4));
}

@Override
protected List<IHatchElement<? super MTECubicMultiBlockBase<?>>> getAllowedHatches() {
return ImmutableList.of(InputBus, OutputBus, Maintenance, Energy, Muffler);
}

@Override
protected int getHatchTextureIndex() {
return 16;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<MTEAdvImplosionCompressor> {
public class MTEAdvImplosionCompressor extends GTPPMultiBlockBase<MTEAdvImplosionCompressor>
implements ISurvivalConstructable {

private int mCasing;
private static IStructureDefinition<MTEAdvImplosionCompressor> STRUCTURE_DEFINITION = null;
Expand Down Expand Up @@ -86,7 +89,7 @@ public IStructureDefinition<MTEAdvImplosionCompressor> 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))))
Expand All @@ -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;
Expand Down

0 comments on commit c7cb999

Please sign in to comment.