fixed previous check-in for #1575

This commit is contained in:
SpaceToad 2014-04-18 09:25:32 +02:00
parent d1dbabdabd
commit c5512cc42f
3 changed files with 32 additions and 17 deletions

View file

@ -50,9 +50,18 @@ public abstract class BptBuilderBase implements IAreaProvider {
context = bluePrint.getContext(world, box);
}
private boolean initialized = false;
protected abstract void initialize ();
public abstract BuildingSlot getNextBlock(World world, TileAbstractBuilder inv);
public boolean buildNextSlot (World world, TileAbstractBuilder builder, int x, int y, int z) {
if (!initialized) {
initialize();
initialized = true;
}
BuildingSlot slot = getNextBlock(world, builder);
if (slot != null) {

View file

@ -47,16 +47,19 @@ public class BptBuilderBlueprint extends BptBuilderBase {
public BptBuilderBlueprint(Blueprint bluePrint, World world, int x, int y, int z) {
super(bluePrint, world, x, y, z);
}
for (int j = bluePrint.sizeY - 1; j >= 0; --j) {
for (int i = 0; i < bluePrint.sizeX; ++i) {
for (int k = 0; k < bluePrint.sizeZ; ++k) {
@Override
protected void initialize () {
for (int j = blueprint.sizeY - 1; j >= 0; --j) {
for (int i = 0; i < blueprint.sizeX; ++i) {
for (int k = 0; k < blueprint.sizeZ; ++k) {
int xCoord = i + x - blueprint.anchorX;
int yCoord = j + y - blueprint.anchorY;
int zCoord = k + z - blueprint.anchorZ;
if (!clearedLocations.contains(new BlockIndex(xCoord, yCoord, zCoord))) {
SchematicBlock slot = (SchematicBlock) bluePrint.contents[i][j][k];
SchematicBlock slot = (SchematicBlock) blueprint.contents[i][j][k];
if (slot == null) {
slot = new SchematicBlock();
@ -80,15 +83,15 @@ public class BptBuilderBlueprint extends BptBuilderBase {
LinkedList<BuildingSlotBlock> tmpBuildList = new LinkedList<BuildingSlotBlock>();
for (int j = 0; j < bluePrint.sizeY; ++j) {
for (int i = 0; i < bluePrint.sizeX; ++i) {
for (int k = 0; k < bluePrint.sizeZ; ++k) {
for (int j = 0; j < blueprint.sizeY; ++j) {
for (int i = 0; i < blueprint.sizeX; ++i) {
for (int k = 0; k < blueprint.sizeZ; ++k) {
int xCoord = i + x - blueprint.anchorX;
int yCoord = j + y - blueprint.anchorY;
int zCoord = k + z - blueprint.anchorZ;
SchematicBlock slot = (SchematicBlock) bluePrint.contents[i][j][k];
SchematicBlock slot = (SchematicBlock) blueprint.contents[i][j][k];
if (slot == null) {
continue;
@ -119,7 +122,7 @@ public class BptBuilderBlueprint extends BptBuilderBase {
int seqId = 0;
for (SchematicEntity e : bluePrint.entities) {
for (SchematicEntity e : ((Blueprint) blueprint).entities) {
BuildingSlotEntity b = new BuildingSlotEntity();
b.schematic = e;

View file

@ -28,15 +28,18 @@ public class BptBuilderTemplate extends BptBuilderBase {
public BptBuilderTemplate(BlueprintBase bluePrint, World world, int x, int y, int z) {
super(bluePrint, world, x, y, z);
}
for (int j = bluePrint.sizeY - 1; j >= 0; --j) {
for (int i = 0; i < bluePrint.sizeX; ++i) {
for (int k = 0; k < bluePrint.sizeZ; ++k) {
@Override
protected void initialize () {
for (int j = blueprint.sizeY - 1; j >= 0; --j) {
for (int i = 0; i < blueprint.sizeX; ++i) {
for (int k = 0; k < blueprint.sizeZ; ++k) {
int xCoord = i + x - blueprint.anchorX;
int yCoord = j + y - blueprint.anchorY;
int zCoord = k + z - blueprint.anchorZ;
SchematicBlockBase slot = bluePrint.contents[i][j][k];
SchematicBlockBase slot = blueprint.contents[i][j][k];
if (slot == null && !clearedLocations.contains(new BlockIndex(xCoord, yCoord, zCoord))) {
BuildingSlotBlock b = new BuildingSlotBlock();
@ -53,14 +56,14 @@ public class BptBuilderTemplate extends BptBuilderBase {
}
}
for (int j = 0; j < bluePrint.sizeY; ++j) {
for (int i = 0; i < bluePrint.sizeX; ++i) {
for (int k = 0; k < bluePrint.sizeZ; ++k) {
for (int j = 0; j < blueprint.sizeY; ++j) {
for (int i = 0; i < blueprint.sizeX; ++i) {
for (int k = 0; k < blueprint.sizeZ; ++k) {
int xCoord = i + x - blueprint.anchorX;
int yCoord = j + y - blueprint.anchorY;
int zCoord = k + z - blueprint.anchorZ;
SchematicBlockBase slot = bluePrint.contents[i][j][k];
SchematicBlockBase slot = blueprint.contents[i][j][k];
if (slot != null && !builtLocations.contains(new BlockIndex(xCoord, yCoord, zCoord))) {
BuildingSlotBlock b = new BuildingSlotBlock();