Skip to content

Commit

Permalink
Add survival autobuild for Bacterial Vat and fix it for Fluid Shaper (#…
Browse files Browse the repository at this point in the history
…3273)

Co-authored-by: Mary Hopson <doyoumined@gmail.com>
Co-authored-by: GDCloud <gdcloudstrike@gmail.com>
Co-authored-by: Dream Master <dream-master@gmx.net>
Co-authored-by: Caedis <Caedis@users.noreply.github.com>
Co-authored-by: NotAPenguin <michiel.vandeginste@gmail.com>
  • Loading branch information
6 people authored Sep 25, 2024
1 parent 07b4531 commit bb79d3f
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@
import org.jetbrains.annotations.NotNull;

import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits;
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 bartworks.API.SideReference;
Expand Down Expand Up @@ -84,7 +86,7 @@
import gregtech.api.util.MultiblockTooltipBuilder;
import gregtech.api.util.ParallelHelper;

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 @@ -783,6 +785,12 @@ 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 bb79d3f

Please sign in to comment.