Fixed some conveyor belt upward and downward movement

This commit is contained in:
Calclavia 2014-01-25 14:08:55 +08:00
parent 028ff3fc1a
commit 4be96d95be
4 changed files with 26 additions and 17 deletions

View file

@ -118,6 +118,18 @@ public class BlockConveyorBelt extends BlockRI
ForgeDirection direction = tile.getDirection(); ForgeDirection direction = tile.getDirection();
if (tile.getSlant() != SlantType.NONE)
{
AxisAlignedBB newBounds = AxisAlignedBB.getAABBPool().getAABB(x, y, z, x + 1, y + 0.1, z + 1);
if (newBounds != null && par5AxisAlignedBB.intersectsWith(newBounds))
{
par6List.add(newBounds);
}
return;
}
if (tile.getSlant() == SlantType.UP) if (tile.getSlant() == SlantType.UP)
{ {
if (direction.offsetX > 0) if (direction.offsetX > 0)
@ -182,7 +194,7 @@ public class BlockConveyorBelt extends BlockRI
} }
} }
AxisAlignedBB newBounds = AxisAlignedBB.getAABBPool().getAABB(x, y, z, x + 1, y + 0.3, z + 1); AxisAlignedBB newBounds = AxisAlignedBB.getAABBPool().getAABB(x, y, z, x + 1, y + 0.1, z + 1);
if (newBounds != null && par5AxisAlignedBB.intersectsWith(newBounds)) if (newBounds != null && par5AxisAlignedBB.intersectsWith(newBounds))
{ {
@ -285,35 +297,33 @@ public class BlockConveyorBelt extends BlockRI
SlantType slantType = tile.getSlant(); SlantType slantType = tile.getSlant();
ForgeDirection direction = tile.getDirection(); ForgeDirection direction = tile.getDirection();
if (slantType != SlantType.NONE)
{
entity.onGround = false;
}
if (slantType == SlantType.UP) if (slantType == SlantType.UP)
{ {
if (entity.motionY < 0.2) //We need at least 0.25 to move items up.
{ entity.motionY = Math.max(0.25, maxSpeed);
entity.addVelocity(0, 0.2, 0);
}
} }
else if (slantType == SlantType.DOWN) else if (slantType == SlantType.DOWN)
{ {
if (entity.motionY > -0.1) entity.motionY = -maxSpeed;
{
entity.addVelocity(0, -0.1, 0);
}
} }
if (direction.offsetX != 0) if (direction.offsetX != 0)
{ {
entity.motionX = direction.offsetX * maxSpeed; entity.motionX = direction.offsetX * maxSpeed;
entity.motionZ = 0; entity.motionZ /= 2;
} }
if (direction.offsetZ != 0) if (direction.offsetZ != 0)
{ {
entity.motionZ = direction.offsetZ * maxSpeed; entity.motionZ = direction.offsetZ * maxSpeed;
entity.motionX = 0; entity.motionX /= 2;
} }
entity.motionY += 0.125f * maxSpeed;
if (entity instanceof EntityItem) if (entity instanceof EntityItem)
{ {
if (direction.offsetX != 0) if (direction.offsetX != 0)

View file

@ -77,11 +77,10 @@ public class TileConveyorBelt extends TileMechanical implements IBelt, IRotatabl
{ {
if (this.ticks % 10 == 0 && this.worldObj.isRemote && this.worldObj.getBlockId(this.xCoord - 1, this.yCoord, this.zCoord) != Mechanical.blockConveyorBelt.blockID && this.worldObj.getBlockId(xCoord, yCoord, zCoord - 1) != Mechanical.blockConveyorBelt.blockID) if (this.ticks % 10 == 0 && this.worldObj.isRemote && this.worldObj.getBlockId(this.xCoord - 1, this.yCoord, this.zCoord) != Mechanical.blockConveyorBelt.blockID && this.worldObj.getBlockId(xCoord, yCoord, zCoord - 1) != Mechanical.blockConveyorBelt.blockID)
{ {
this.worldObj.playSound(this.xCoord, this.yCoord, this.zCoord, Reference.PREFIX + "conveyor", 0.5f, 0.7f, true); worldObj.playSound(this.xCoord, this.yCoord, this.zCoord, Reference.PREFIX + "conveyor", 0.5f, 0.5f + 0.15f * getMoveVelocity(), true);
} }
angle = getNetwork().getRotation(getMoveVelocity()); angle = getNetwork().getRotation(getMoveVelocity());
// (float) ((angle + getMoveVelocity() / 20) % Math.PI);
double beltPercentage = angle / (2 * Math.PI); double beltPercentage = angle / (2 * Math.PI);
// Sync the animation. Slant belts are slower. // Sync the animation. Slant belts are slower.

View file

@ -20,7 +20,7 @@ public class BlockManipulator extends BlockImprintable
public BlockManipulator() public BlockManipulator()
{ {
super("manipulator"); super("manipulator");
this.setBlockBounds(0, 0, 0, 1, 0.29f, 1); this.setBlockBounds(0, 0, 0, 1, 0.09f, 1);
} }
@Override @Override

View file

@ -150,7 +150,7 @@ public class MechanicalNetwork extends Network<IMechanicalNetwork, IMechanical>
if (deltaTime > 1) if (deltaTime > 1)
{ {
rotation = (float) (((velocity) * (deltaTime / 1000f) + rotation) % (2 * Math.PI)); rotation = (float) (((velocity) * ((double)deltaTime / 1000d) + rotation) % (2 * Math.PI));
lastRotateTime = System.currentTimeMillis(); lastRotateTime = System.currentTimeMillis();
} }