Skip to content
This repository has been archived by the owner on May 25, 2024. It is now read-only.

Commit

Permalink
Add survival place
Browse files Browse the repository at this point in the history
  • Loading branch information
kuba6000 authored and Dream-Master committed Oct 30, 2023
1 parent d01bc99 commit 2f9eed4
Showing 1 changed file with 21 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@

import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlocksTiered;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
import static gregtech.api.enums.GT_HatchElement.Energy;
import static gregtech.api.enums.GT_HatchElement.InputBus;
import static gregtech.api.enums.GT_HatchElement.InputHatch;
import static gregtech.api.enums.GT_HatchElement.Maintenance;
import static gregtech.api.enums.GT_HatchElement.OutputBus;
import static gregtech.api.enums.GT_HatchElement.OutputHatch;
import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_MAGIC;
import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_MAGIC_ACTIVE;
import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_MAGIC_ACTIVE_GLOW;
Expand All @@ -13,7 +18,7 @@
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TELEPORTER_ACTIVE;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TELEPORTER_ACTIVE_GLOW;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TELEPORTER_GLOW;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
import static gregtech.api.util.GT_StructureUtility.buildHatchAdder;
import static kubatech.api.Variables.StructureHologram;
import static kubatech.api.Variables.buildAuthorList;

Expand All @@ -27,7 +32,9 @@
import org.apache.commons.lang3.tuple.Pair;
import org.jetbrains.annotations.NotNull;

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.GregTech_API;
Expand All @@ -47,7 +54,8 @@
import kubatech.loaders.BlockLoader;
import kubatech.loaders.DEFCRecipes;

public class GT_MetaTileEntity_DEFusionCrafter extends KubaTechGTMultiBlockBase<GT_MetaTileEntity_DEFusionCrafter> {
public class GT_MetaTileEntity_DEFusionCrafter extends KubaTechGTMultiBlockBase<GT_MetaTileEntity_DEFusionCrafter>
implements ISurvivalConstructable {

private static final int CASING_INDEX = (1 << 7) + (15 + 48);
private int mTierCasing = 0;
Expand Down Expand Up @@ -96,12 +104,11 @@ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
})) // spotless:on
.addElement(
'N',
ofChain(
onElementPass(e -> e.mCasing++, ofBlock(BlockLoader.defcCasingBlock, 7)),
ofHatchAdder(GT_MetaTileEntity_DEFusionCrafter::addEnergyInputToMachineList, CASING_INDEX, 1),
ofHatchAdder(GT_MetaTileEntity_DEFusionCrafter::addInputToMachineList, CASING_INDEX, 1),
ofHatchAdder(GT_MetaTileEntity_DEFusionCrafter::addOutputToMachineList, CASING_INDEX, 1),
ofHatchAdder(GT_MetaTileEntity_DEFusionCrafter::addMaintenanceToMachineList, CASING_INDEX, 1)))
buildHatchAdder(GT_MetaTileEntity_DEFusionCrafter.class)
.atLeast(InputBus, InputHatch, OutputBus, OutputHatch, Energy, Maintenance)
.casingIndex(CASING_INDEX)
.dot(1)
.buildAndChain(onElementPass(e -> e.mCasing++, ofBlock(BlockLoader.defcCasingBlock, 7))))
.addElement('n', onElementPass(e -> e.mCasing++, ofBlock(BlockLoader.defcCasingBlock, 7)))
.addElement('f', ofBlock(GregTech_API.sBlockCasings4, 7))
.addElement('F', ofBlocksTiered((Block b, int m) -> {
Expand Down Expand Up @@ -253,6 +260,11 @@ public void construct(ItemStack itemStack, boolean b) {
buildPiece(STRUCTURE_PIECE_MAIN, itemStack, b, 2, 9, 0);
}

@Override
public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) {
return survivialBuildPiece(STRUCTURE_PIECE_MAIN, stackSize, 2, 9, 0, elementBudget, env, true, true);
}

@Override
public boolean supportsVoidProtection() {
return true;
Expand Down

0 comments on commit 2f9eed4

Please sign in to comment.