Skip to content

Commit

Permalink
Added survival autobuild for Bacterial Vat and fixed survival autobui…
Browse files Browse the repository at this point in the history
…ld for Fluid Shaper
  • Loading branch information
OmdaCZ committed Sep 24, 2024
1 parent 0c442d9 commit 207b170
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 23 deletions.
12 changes: 10 additions & 2 deletions src/main/java/bartworks/common/tileentities/multis/MTEBioVat.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

import javax.annotation.Nullable;

import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks;
Expand Down Expand Up @@ -83,8 +84,11 @@
import gregtech.api.util.GTUtility;
import gregtech.api.util.MultiblockTooltipBuilder;
import gregtech.api.util.ParallelHelper;
import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable;
import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment;

public class MTEBioVat extends MTEEnhancedMultiBlockBase<MTEBioVat> {
public class MTEBioVat extends MTEEnhancedMultiBlockBase<MTEBioVat>
implements ISurvivalConstructable{

public static final HashMap<Coords, Integer> staticColorMap = new HashMap<>();

Expand Down Expand Up @@ -782,7 +786,11 @@ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirec
public void construct(ItemStack itemStack, boolean b) {
this.buildPiece(STRUCTURE_PIECE_MAIN, itemStack, b, 2, 3, 0);
}

@Override
public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) {
if (mMachine) return -1;
return survivialBuildPiece(STRUCTURE_PIECE_MAIN, stackSize, 2, 3, 0, elementBudget, env, false, true);
}
@Override
public String[] getInfoData() {
final String[] baseInfoData = super.getInfoData();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,34 +248,37 @@ public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBu
int built = survivialBuildPiece(STRUCTURE_PIECE_MAIN, stackSize, 3, 4, 0, elementBudget, env, false, true);
if (built >= 0) return built;
int tTotalWidth = Math.min(stackSize.stackSize + 1, 6);
for (int i = 1; i < tTotalWidth - 1; i++) {
for (int i = 1; i < tTotalWidth; i++) {
mWidth = i;
nWidth = i;
built = survivialBuildPiece(MS_LEFT_MID, stackSize, 3 + 2 * i, 4, 0, elementBudget, env, false, true);
if (built >= 0) return built;
built = survivialBuildPiece(MS_RIGHT_MID, stackSize, -2 - 2 * i, 4, 0, elementBudget, env, false, true);
if (built >= 0) return built;
}
if (mWidth == tTotalWidth - 2) return survivialBuildPiece(
MS_END,
stackSize,
(2 + tTotalWidth) * 2 - 4,
4,
0,
elementBudget,
env,
false,
true);
else return survivialBuildPiece(
MS_END,
stackSize,
(-2 - tTotalWidth) * 2 + 4,
4,
0,
elementBudget,
env,
false,
true);
if (mWidth == tTotalWidth - 1) {
built += survivialBuildPiece(
MS_END,
stackSize,
(3 + tTotalWidth) * 2 - 4,
4,
0,
elementBudget,
env,
false,
true);
built += survivialBuildPiece(
MS_END,
stackSize,
(-3 - tTotalWidth) * 2 + 4,
4,
0,
elementBudget,
env,
false,
true);
}
return built;
}

@Override
Expand Down

0 comments on commit 207b170

Please sign in to comment.