Additional clean up

This commit is contained in:
Brady 2019-12-19 11:58:47 -06:00
parent aa3bd80ab2
commit 6759917a2f
No known key found for this signature in database
GPG Key ID: 73A788379A197567
3 changed files with 11 additions and 52 deletions

View File

@ -38,6 +38,9 @@ public class FillSchematic extends AbstractSchematic {
@Override
public IBlockState desiredState(int x, int y, int z, IBlockState current, List<IBlockState> approxPlaceable) {
// TODO: is this even necessary???
// Builder will already handle logic that requires breaking blocks before replacing them, and non-api Fill Schematic
// is used for clear area and doesn't have any issues.
if (bom.matches(current)) {
return current;
} else if (current.getBlock() != Blocks.AIR) {

View File

@ -17,22 +17,17 @@
package baritone.utils.schematic;
import baritone.api.schematic.ISchematic;
import baritone.api.schematic.AbstractSchematic;
import net.minecraft.block.state.IBlockState;
import java.util.List;
public class FillSchematic implements ISchematic {
public class FillSchematic extends AbstractSchematic {
private final int widthX;
private final int heightY;
private final int lengthZ;
private final IBlockState state;
public FillSchematic(int widthX, int heightY, int lengthZ, IBlockState state) {
this.widthX = widthX;
this.heightY = heightY;
this.lengthZ = lengthZ;
super(widthX, heightY, lengthZ);
this.state = state;
}
@ -40,19 +35,4 @@ public class FillSchematic implements ISchematic {
public IBlockState desiredState(int x, int y, int z, IBlockState current, List<IBlockState> approxPlaceable) {
return state;
}
@Override
public int widthX() {
return widthX;
}
@Override
public int heightY() {
return heightY;
}
@Override
public int lengthZ() {
return lengthZ;
}
}

View File

@ -17,23 +17,20 @@
package baritone.utils.schematic;
import baritone.api.schematic.AbstractSchematic;
import baritone.api.schematic.ISchematic;
import baritone.api.schematic.MaskSchematic;
import net.minecraft.block.BlockAir;
import net.minecraft.block.state.IBlockState;
import java.util.List;
import java.util.OptionalInt;
import java.util.function.Predicate;
public class MapArtSchematic extends AbstractSchematic {
public class MapArtSchematic extends MaskSchematic {
private final ISchematic child;
private final int[][] heightMap;
public MapArtSchematic(ISchematic schematic) {
super(schematic.widthX(), schematic.heightY(), schematic.lengthZ());
this.child = schematic;
super(schematic);
heightMap = new int[schematic.widthX()][schematic.lengthZ()];
@ -63,28 +60,7 @@ public class MapArtSchematic extends AbstractSchematic {
}
@Override
public boolean inSchematic(int x, int y, int z, IBlockState currentState) {
// in map art, we only care about coordinates in or above the art
return this.child.inSchematic(x, y, z, currentState) && y >= heightMap[x][z];
}
@Override
public IBlockState desiredState(int x, int y, int z, IBlockState current, List<IBlockState> approxPlaceable) {
return this.child.desiredState(x, y, z, current, approxPlaceable);
}
@Override
public int widthX() {
return this.child.widthX();
}
@Override
public int heightY() {
return this.child.heightY();
}
@Override
public int lengthZ() {
return this.child.lengthZ();
protected boolean partOfMask(int x, int y, int z, IBlockState currentState) {
return y >= heightMap[x][z];
}
}