mirror of
https://github.com/Ellpeck/PrettyPipes.git
synced 2024-11-22 11:53:29 +01:00
made pipe item movement more accurate
This commit is contained in:
parent
ee58eb30b3
commit
03a798649a
2 changed files with 62 additions and 56 deletions
|
@ -85,7 +85,11 @@ public class PipeItem implements INBTSerializable<CompoundNBT>, ILiquidContainer
|
|||
return;
|
||||
this.lastWorldTick = worldTick;
|
||||
|
||||
float currSpeed = this.speed;
|
||||
float motionLeft = this.speed;
|
||||
while (motionLeft > 0) {
|
||||
float currSpeed = Math.min(0.25F, motionLeft);
|
||||
motionLeft -= currSpeed;
|
||||
|
||||
BlockPos myPos = new BlockPos(this.x, this.y, this.z);
|
||||
if (!myPos.equals(currPipe.getPos()) && (currPipe.getPos().equals(this.getDestPipe()) || !myPos.equals(this.startInventory))) {
|
||||
// we're done with the current pipe, so switch to the next one
|
||||
|
@ -105,10 +109,11 @@ public class PipeItem implements INBTSerializable<CompoundNBT>, ILiquidContainer
|
|||
return;
|
||||
} else {
|
||||
next.getItems().add(this);
|
||||
currPipe = next;
|
||||
}
|
||||
} else {
|
||||
double dist = Vector3d.copy(this.currGoalPos).squareDistanceTo(this.x - 0.5F, this.y - 0.5F, this.z - 0.5F);
|
||||
if (dist < this.speed * this.speed) {
|
||||
if (dist < currSpeed * currSpeed) {
|
||||
// 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);
|
||||
|
@ -152,6 +157,7 @@ public class PipeItem implements INBTSerializable<CompoundNBT>, ILiquidContainer
|
|||
this.y += dist.y * currSpeed;
|
||||
this.z += dist.z * currSpeed;
|
||||
}
|
||||
}
|
||||
|
||||
protected void onPathObstructed(PipeTileEntity currPipe, boolean tryReturn) {
|
||||
if (currPipe.getWorld().isRemote)
|
||||
|
|
|
@ -219,7 +219,7 @@ public class PipeTileEntity extends TileEntity implements INamedContainerProvide
|
|||
|
||||
public float getItemSpeed(ItemStack stack) {
|
||||
float moduleSpeed = (float) this.streamModules().mapToDouble(m -> m.getRight().getItemSpeedIncrease(m.getLeft(), this)).sum();
|
||||
float pressureSpeed = this.pressurizer != null && !this.pressurizer.isRemoved() && this.pressurizer.pressurizeItem(stack, true) ? 0.4F : 0;
|
||||
float pressureSpeed = this.pressurizer != null && !this.pressurizer.isRemoved() && this.pressurizer.pressurizeItem(stack, true) ? 0.45F : 0;
|
||||
return 0.05F + moduleSpeed + pressureSpeed;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue