attempt at fixing blueprint building ordering, for #1620
This commit is contained in:
parent
ee349e00b5
commit
b30995aea0
5 changed files with 36 additions and 14 deletions
|
@ -213,12 +213,6 @@ public class SchematicBlock extends SchematicBlockBase implements Comparable<Sc
|
|||
|
||||
@Override
|
||||
public int compareTo(SchematicBlock o) {
|
||||
if (block.isOpaqueCube() == o.block.isOpaqueCube()) {
|
||||
return 0;
|
||||
} else if (block.isOpaqueCube()) {
|
||||
return -1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,6 +78,7 @@ public class BptBuilderBlueprint extends BptBuilderBase {
|
|||
b.y = yCoord;
|
||||
b.z = zCoord;
|
||||
b.mode = Mode.ClearIfInvalid;
|
||||
b.buildStage = 0;
|
||||
|
||||
buildList.add(b);
|
||||
}
|
||||
|
@ -86,7 +87,8 @@ public class BptBuilderBlueprint extends BptBuilderBase {
|
|||
}
|
||||
}
|
||||
|
||||
LinkedList<BuildingSlotBlock> tmpBuildList = new LinkedList<BuildingSlotBlock>();
|
||||
LinkedList<BuildingSlotBlock> tmpBuildCubeList = new LinkedList<BuildingSlotBlock>();
|
||||
LinkedList<BuildingSlotBlock> tmpBuildComplexList = new LinkedList<BuildingSlotBlock>();
|
||||
|
||||
for (int j = 0; j < blueprint.sizeY; ++j) {
|
||||
for (int i = 0; i < blueprint.sizeX; ++i) {
|
||||
|
@ -110,7 +112,14 @@ public class BptBuilderBlueprint extends BptBuilderBase {
|
|||
|
||||
if (!builtLocations.contains(new BlockIndex(xCoord, yCoord,
|
||||
zCoord))) {
|
||||
tmpBuildList.add(b);
|
||||
|
||||
if (((SchematicBlock) b.schematic).block.isOpaqueCube()) {
|
||||
tmpBuildCubeList.add(b);
|
||||
b.buildStage = 1;
|
||||
} else {
|
||||
tmpBuildComplexList.add(b);
|
||||
b.buildStage = 2;
|
||||
}
|
||||
} else {
|
||||
postProcessing.add(b);
|
||||
}
|
||||
|
@ -118,9 +127,11 @@ public class BptBuilderBlueprint extends BptBuilderBase {
|
|||
}
|
||||
}
|
||||
|
||||
Collections.sort(tmpBuildList);
|
||||
Collections.sort(tmpBuildCubeList);
|
||||
Collections.sort(tmpBuildComplexList);
|
||||
|
||||
buildList.addAll(tmpBuildList);
|
||||
buildList.addAll(tmpBuildCubeList);
|
||||
buildList.addAll(tmpBuildComplexList);
|
||||
|
||||
iterator = new BuildingSlotIterator(buildList);
|
||||
|
||||
|
@ -189,6 +200,11 @@ public class BptBuilderBlueprint extends BptBuilderBase {
|
|||
while (iterator.hasNext()) {
|
||||
BuildingSlotBlock slot = iterator.next();
|
||||
|
||||
if (slot.buildStage > buildList.getFirst().buildStage) {
|
||||
iterator.reset ();
|
||||
return null;
|
||||
}
|
||||
|
||||
boolean getNext = false;
|
||||
|
||||
try {
|
||||
|
|
|
@ -52,6 +52,7 @@ public class BptBuilderTemplate extends BptBuilderBase {
|
|||
b.y = yCoord;
|
||||
b.z = zCoord;
|
||||
b.mode = Mode.ClearIfInvalid;
|
||||
b.buildStage = 0;
|
||||
|
||||
buildList.add(b);
|
||||
}
|
||||
|
@ -78,6 +79,7 @@ public class BptBuilderTemplate extends BptBuilderBase {
|
|||
b.z = zCoord;
|
||||
|
||||
b.mode = Mode.Build;
|
||||
b.buildStage = 1;
|
||||
|
||||
buildList.add(b);
|
||||
}
|
||||
|
@ -135,9 +137,12 @@ public class BptBuilderTemplate extends BptBuilderBase {
|
|||
while (iterator.hasNext()) {
|
||||
BuildingSlotBlock slot = iterator.next();
|
||||
|
||||
if (slot == null) {
|
||||
break;
|
||||
} else if (slot.mode == Mode.ClearIfInvalid) {
|
||||
if (slot.buildStage > buildList.getFirst().buildStage) {
|
||||
iterator.reset ();
|
||||
return null;
|
||||
}
|
||||
|
||||
if (slot.mode == Mode.ClearIfInvalid) {
|
||||
if (BlockUtil.isSoftBlock(world, slot.x, slot.y, slot.z)
|
||||
|| BlockUtil.isUnbreakableBlock(world, slot.x, slot.y, slot.z)) {
|
||||
iterator.remove();
|
||||
|
|
|
@ -31,6 +31,8 @@ public class BuildingSlotBlock extends BuildingSlot implements Comparable<Buildi
|
|||
|
||||
public Mode mode = Mode.Build;
|
||||
|
||||
public int buildStage = 0;
|
||||
|
||||
@Override
|
||||
public SchematicBlockBase getSchematic () {
|
||||
if (schematic == null) {
|
||||
|
|
|
@ -59,4 +59,9 @@ public class BuildingSlotIterator {
|
|||
current.remove();
|
||||
}
|
||||
|
||||
public void reset () {
|
||||
current = buildList.iterator();
|
||||
nbIterations = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue