mirror of
https://github.com/Ellpeck/PrettyPipes.git
synced 2024-11-22 11:53:29 +01:00
fixed pipe items not going around corners nicely when directly connected to an inventory
This commit is contained in:
parent
9682636103
commit
10645ac54d
1 changed files with 15 additions and 11 deletions
|
@ -106,10 +106,11 @@ public class PipeItem implements INBTSerializable<CompoundNBT> {
|
||||||
double dist = new Vec3d(this.currGoalPos).squareDistanceTo(this.x - 0.5F, this.y - 0.5F, this.z - 0.5F);
|
double dist = new Vec3d(this.currGoalPos).squareDistanceTo(this.x - 0.5F, this.y - 0.5F, this.z - 0.5F);
|
||||||
if (dist < this.speed * this.speed) {
|
if (dist < this.speed * this.speed) {
|
||||||
// we're past the start of the pipe, so move to the center of the next pipe
|
// we're past the start of the pipe, so move to the center of the next pipe
|
||||||
|
BlockPos nextPos;
|
||||||
PipeTileEntity next = this.getNextTile(currPipe, false);
|
PipeTileEntity next = this.getNextTile(currPipe, false);
|
||||||
if (next == null) {
|
if (next == null) {
|
||||||
if (this.reachedDestination()) {
|
if (this.reachedDestination()) {
|
||||||
this.currGoalPos = this.destInventory;
|
nextPos = this.destInventory;
|
||||||
} else {
|
} else {
|
||||||
currPipe.items.remove(this);
|
currPipe.items.remove(this);
|
||||||
if (!currPipe.getWorld().isRemote)
|
if (!currPipe.getWorld().isRemote)
|
||||||
|
@ -117,19 +118,22 @@ public class PipeItem implements INBTSerializable<CompoundNBT> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
BlockPos nextPos = next.getPos();
|
nextPos = next.getPos();
|
||||||
if (dist >= 0.001F) {
|
}
|
||||||
// when going around corners, we want to move right up to the corner
|
float tolerance = 0.001F;
|
||||||
Vec3d motion = new Vec3d(this.x - this.lastX, this.y - this.lastY, this.z - this.lastZ);
|
if (dist >= tolerance * tolerance) {
|
||||||
Vec3d diff = new Vec3d(nextPos.getX() + 0.5F - this.x, nextPos.getY() + 0.5F - this.y, nextPos.getZ() + 0.5F - this.z);
|
// when going around corners, we want to move right up to the corner
|
||||||
if (motion.crossProduct(diff).length() >= 0.001F) {
|
Vec3d motion = new Vec3d(this.x - this.lastX, this.y - this.lastY, this.z - this.lastZ);
|
||||||
currSpeed = (float) Math.sqrt(dist);
|
Vec3d diff = new Vec3d(nextPos.getX() + 0.5F - this.x, nextPos.getY() + 0.5F - this.y, nextPos.getZ() + 0.5F - this.z);
|
||||||
} else {
|
if (motion.crossProduct(diff).length() >= tolerance) {
|
||||||
this.currGoalPos = nextPos;
|
currSpeed = (float) Math.sqrt(dist);
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
|
// we're not going around a corner, so continue
|
||||||
this.currGoalPos = nextPos;
|
this.currGoalPos = nextPos;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// distance is very small, so continue
|
||||||
|
this.currGoalPos = nextPos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue