From 4be96d95bec598c2c687ac15fe7177fb2090ed3a Mon Sep 17 00:00:00 2001 From: Calclavia Date: Sat, 25 Jan 2014 14:08:55 +0800 Subject: [PATCH] Fixed some conveyor belt upward and downward movement --- .../mechanical/belt/BlockConveyorBelt.java | 36 ++++++++++++------- .../mechanical/belt/TileConveyorBelt.java | 3 +- .../mechanical/logistic/BlockManipulator.java | 2 +- .../mechanical/network/MechanicalNetwork.java | 2 +- 4 files changed, 26 insertions(+), 17 deletions(-) diff --git a/src/main/java/resonantinduction/mechanical/belt/BlockConveyorBelt.java b/src/main/java/resonantinduction/mechanical/belt/BlockConveyorBelt.java index 8c648ca4..47b49017 100644 --- a/src/main/java/resonantinduction/mechanical/belt/BlockConveyorBelt.java +++ b/src/main/java/resonantinduction/mechanical/belt/BlockConveyorBelt.java @@ -118,6 +118,18 @@ public class BlockConveyorBelt extends BlockRI 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 (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)) { @@ -285,35 +297,33 @@ public class BlockConveyorBelt extends BlockRI SlantType slantType = tile.getSlant(); ForgeDirection direction = tile.getDirection(); + if (slantType != SlantType.NONE) + { + entity.onGround = false; + } + if (slantType == SlantType.UP) { - if (entity.motionY < 0.2) - { - entity.addVelocity(0, 0.2, 0); - } + //We need at least 0.25 to move items up. + entity.motionY = Math.max(0.25, maxSpeed); } else if (slantType == SlantType.DOWN) { - if (entity.motionY > -0.1) - { - entity.addVelocity(0, -0.1, 0); - } + entity.motionY = -maxSpeed; } if (direction.offsetX != 0) { entity.motionX = direction.offsetX * maxSpeed; - entity.motionZ = 0; + entity.motionZ /= 2; } if (direction.offsetZ != 0) { entity.motionZ = direction.offsetZ * maxSpeed; - entity.motionX = 0; + entity.motionX /= 2; } - entity.motionY += 0.125f * maxSpeed; - if (entity instanceof EntityItem) { if (direction.offsetX != 0) diff --git a/src/main/java/resonantinduction/mechanical/belt/TileConveyorBelt.java b/src/main/java/resonantinduction/mechanical/belt/TileConveyorBelt.java index de0e7987..080d5c0c 100644 --- a/src/main/java/resonantinduction/mechanical/belt/TileConveyorBelt.java +++ b/src/main/java/resonantinduction/mechanical/belt/TileConveyorBelt.java @@ -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) { - 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()); - // (float) ((angle + getMoveVelocity() / 20) % Math.PI); double beltPercentage = angle / (2 * Math.PI); // Sync the animation. Slant belts are slower. diff --git a/src/main/java/resonantinduction/mechanical/logistic/BlockManipulator.java b/src/main/java/resonantinduction/mechanical/logistic/BlockManipulator.java index d40a9cb6..326b42c4 100644 --- a/src/main/java/resonantinduction/mechanical/logistic/BlockManipulator.java +++ b/src/main/java/resonantinduction/mechanical/logistic/BlockManipulator.java @@ -20,7 +20,7 @@ public class BlockManipulator extends BlockImprintable public BlockManipulator() { super("manipulator"); - this.setBlockBounds(0, 0, 0, 1, 0.29f, 1); + this.setBlockBounds(0, 0, 0, 1, 0.09f, 1); } @Override diff --git a/src/main/java/resonantinduction/mechanical/network/MechanicalNetwork.java b/src/main/java/resonantinduction/mechanical/network/MechanicalNetwork.java index f0067dc5..80f7f6ff 100644 --- a/src/main/java/resonantinduction/mechanical/network/MechanicalNetwork.java +++ b/src/main/java/resonantinduction/mechanical/network/MechanicalNetwork.java @@ -150,7 +150,7 @@ public class MechanicalNetwork extends Network 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(); }