Adjusted semantics of path markers to fix vertical building, fix #1514

This commit is contained in:
SpaceToad 2014-04-30 09:30:52 +02:00
parent 7f3978cc18
commit 0817c409ee
2 changed files with 12 additions and 8 deletions

View file

@ -69,7 +69,7 @@ public class TileBuilder extends TileAbstractBuilder implements IMachine {
AxisAlignedBB oldBoundingBox = null;
ForgeDirection o = null;
public PathIterator(BlockIndex from, Iterator<BlockIndex> it) {
public PathIterator(BlockIndex from, Iterator<BlockIndex> it, ForgeDirection initialDir) {
this.to = it.next();
currentIterator = it;
@ -91,7 +91,9 @@ public class TileBuilder extends TileAbstractBuilder implements IMachine {
lastDistance = (ix - to.x) * (ix - to.x) + (iy - to.y)
* (iy - to.y) + (iz - to.z) * (iz - to.z);
if (Math.abs(dx) > Math.abs(dz)) {
if (dx == 0 && dz == 0) {
o = initialDir;
} else if (Math.abs(dx) > Math.abs(dz)) {
if (dx > 0) {
o = ForgeDirection.EAST;
} else {
@ -151,7 +153,7 @@ public class TileBuilder extends TileAbstractBuilder implements IMachine {
public PathIterator iterate() {
if (currentIterator.hasNext()) {
PathIterator next = new PathIterator(to, currentIterator);
PathIterator next = new PathIterator(to, currentIterator, o);
next.oldBoundingBox = oldBoundingBox;
return next;
@ -237,10 +239,6 @@ public class TileBuilder extends TileAbstractBuilder implements IMachine {
}
if (path != null && pathLasers.size() == 0) {
path.getFirst().x = xCoord;
path.getFirst().y = yCoord;
path.getFirst().z = zCoord;
createLasersForPath();
sendNetworkUpdate();
@ -339,7 +337,9 @@ public class TileBuilder extends TileAbstractBuilder implements IMachine {
if (currentPathIterator == null) {
Iterator<BlockIndex> it = path.iterator();
BlockIndex start = it.next();
currentPathIterator = new PathIterator(start, it);
currentPathIterator = new PathIterator(start, it,
ForgeDirection.values()[worldObj.getBlockMetadata(
xCoord, yCoord, zCoord)].getOpposite());
}
bluePrintBuilder = currentPathIterator.next();

View file

@ -292,6 +292,10 @@ public class Box implements IBox {
}
public Box extendToEncompass (Box toBeContained) {
if (!toBeContained.initialized) {
return;
}
if (toBeContained.xMin < xMin) {
xMin = toBeContained.xMin;
}