Minor refractor/cleanup on belts
This commit is contained in:
parent
e5d68fb593
commit
2b4bac211d
2 changed files with 295 additions and 301 deletions
|
@ -21,361 +21,355 @@ import calclavia.lib.render.block.BlockRenderingHandler;
|
|||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/**
|
||||
* The block for the actual conveyor belt!
|
||||
/** The block for the actual conveyor belt!
|
||||
*
|
||||
* @author Calclavia, DarkGuardsman
|
||||
*/
|
||||
* @author Calclavia, DarkGuardsman */
|
||||
public class BlockConveyorBelt extends BlockTile
|
||||
{
|
||||
public BlockConveyorBelt(int id)
|
||||
{
|
||||
super(id, UniversalElectricity.machine);
|
||||
setTextureName(Reference.PREFIX + "material_metal_side");
|
||||
setBlockBounds(0, 0, 0, 1, 0.3f, 1);
|
||||
}
|
||||
public BlockConveyorBelt(int id)
|
||||
{
|
||||
super(id, UniversalElectricity.machine);
|
||||
setTextureName(Reference.PREFIX + "material_metal_side");
|
||||
setBlockBounds(0, 0, 0, 1, 0.3f, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World world, int x, int y, int z)
|
||||
{
|
||||
TileEntity t = world.getBlockTileEntity(x, y, z);
|
||||
@Override
|
||||
public void onBlockAdded(World world, int x, int y, int z)
|
||||
{
|
||||
TileEntity tile = world.getBlockTileEntity(x, y, z);
|
||||
if (tile instanceof TileConveyorBelt)
|
||||
((TileConveyorBelt) tile).mechanicalNode.reconstruct();
|
||||
}
|
||||
|
||||
if (t != null && t instanceof TileConveyorBelt)
|
||||
{
|
||||
TileConveyorBelt tileEntity = (TileConveyorBelt) t;
|
||||
tileEntity.mechanicalNode.reconstruct();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
if (world.getBlockTileEntity(x, y, z) instanceof TileConveyorBelt)
|
||||
{
|
||||
TileConveyorBelt tileEntity = (TileConveyorBelt) world.getBlockTileEntity(x, y, z);
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
if (world.getBlockTileEntity(x, y, z) instanceof TileConveyorBelt)
|
||||
{
|
||||
TileConveyorBelt tileEntity = (TileConveyorBelt) world.getBlockTileEntity(x, y, z);
|
||||
if (tileEntity.getSlant() == SlantType.UP || tileEntity.getSlant() == SlantType.DOWN)
|
||||
{
|
||||
this.setBlockBounds(0f, 0f, 0f, 1f, 0.96f, 1f);
|
||||
return;
|
||||
}
|
||||
if (tileEntity.getSlant() == SlantType.TOP)
|
||||
{
|
||||
this.setBlockBounds(0f, 0.68f, 0f, 1f, 0.96f, 1f);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (tileEntity.getSlant() == SlantType.UP || tileEntity.getSlant() == SlantType.DOWN)
|
||||
{
|
||||
this.setBlockBounds(0f, 0f, 0f, 1f, 0.96f, 1f);
|
||||
return;
|
||||
}
|
||||
if (tileEntity.getSlant() == SlantType.TOP)
|
||||
{
|
||||
this.setBlockBounds(0f, 0.68f, 0f, 1f, 0.96f, 1f);
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.setBlockBounds(0f, 0f, 0f, 1f, 0.3f, 1f);
|
||||
}
|
||||
|
||||
this.setBlockBounds(0f, 0f, 0f, 1f, 0.3f, 1f);
|
||||
}
|
||||
@Override
|
||||
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z)
|
||||
{
|
||||
TileEntity t = world.getBlockTileEntity(x, y, z);
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z)
|
||||
{
|
||||
TileEntity t = world.getBlockTileEntity(x, y, z);
|
||||
if (t != null && t instanceof TileConveyorBelt)
|
||||
{
|
||||
TileConveyorBelt tileEntity = (TileConveyorBelt) t;
|
||||
|
||||
if (t != null && t instanceof TileConveyorBelt)
|
||||
{
|
||||
TileConveyorBelt tileEntity = (TileConveyorBelt) t;
|
||||
if (tileEntity.getSlant() == SlantType.UP || tileEntity.getSlant() == SlantType.DOWN)
|
||||
{
|
||||
return AxisAlignedBB.getAABBPool().getAABB(x + this.minX, y + this.minY, z + this.minZ, (double) x + 1, (double) y + 1, (double) z + 1);
|
||||
}
|
||||
if (tileEntity.getSlant() == SlantType.TOP)
|
||||
{
|
||||
return AxisAlignedBB.getAABBPool().getAABB(x + this.minX, (double) y + 0.68f, z + this.minZ, x + this.maxX, (double) y + 0.98f, z + this.maxZ);
|
||||
}
|
||||
}
|
||||
|
||||
if (tileEntity.getSlant() == SlantType.UP || tileEntity.getSlant() == SlantType.DOWN)
|
||||
{
|
||||
return AxisAlignedBB.getAABBPool().getAABB(x + this.minX, y + this.minY, z + this.minZ, (double) x + 1, (double) y + 1, (double) z + 1);
|
||||
}
|
||||
if (tileEntity.getSlant() == SlantType.TOP)
|
||||
{
|
||||
return AxisAlignedBB.getAABBPool().getAABB(x + this.minX, (double) y + 0.68f, z + this.minZ, x + this.maxX, (double) y + 0.98f, z + this.maxZ);
|
||||
}
|
||||
}
|
||||
return AxisAlignedBB.getAABBPool().getAABB(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ);
|
||||
}
|
||||
|
||||
return AxisAlignedBB.getAABBPool().getAABB(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ);
|
||||
}
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity)
|
||||
{
|
||||
TileEntity t = world.getBlockTileEntity(x, y, z);
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity)
|
||||
{
|
||||
TileEntity t = world.getBlockTileEntity(x, y, z);
|
||||
if (t != null && t instanceof TileConveyorBelt)
|
||||
{
|
||||
TileConveyorBelt tile = (TileConveyorBelt) t;
|
||||
|
||||
if (t != null && t instanceof TileConveyorBelt)
|
||||
{
|
||||
TileConveyorBelt tile = (TileConveyorBelt) t;
|
||||
if (tile.getSlant() == SlantType.UP || tile.getSlant() == SlantType.DOWN)
|
||||
{
|
||||
AxisAlignedBB boundBottom = AxisAlignedBB.getAABBPool().getAABB(x, y, z, x + 1, y + 0.3, z + 1);
|
||||
AxisAlignedBB boundTop = null;
|
||||
|
||||
if (tile.getSlant() == SlantType.UP || tile.getSlant() == SlantType.DOWN)
|
||||
{
|
||||
AxisAlignedBB boundBottom = AxisAlignedBB.getAABBPool().getAABB(x, y, z, x + 1, y + 0.3, z + 1);
|
||||
AxisAlignedBB boundTop = null;
|
||||
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 (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);
|
||||
}
|
||||
|
||||
if (newBounds != null && par5AxisAlignedBB.intersectsWith(newBounds))
|
||||
{
|
||||
par6List.add(newBounds);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
if (tile.getSlant() == SlantType.UP)
|
||||
{
|
||||
if (direction.offsetX > 0)
|
||||
{
|
||||
boundTop = AxisAlignedBB.getAABBPool().getAABB(x + (float) direction.offsetX / 2, y, z, x + 1, y + 0.8, z + 1);
|
||||
}
|
||||
else if (direction.offsetX < 0)
|
||||
{
|
||||
boundTop = AxisAlignedBB.getAABBPool().getAABB(x, y, z, x + (float) direction.offsetX / -2, y + 0.8, z + 1);
|
||||
}
|
||||
else if (direction.offsetZ > 0)
|
||||
{
|
||||
boundTop = AxisAlignedBB.getAABBPool().getAABB(x, y, z + (float) direction.offsetZ / 2, x + 1, y + 0.8, z + 1);
|
||||
}
|
||||
else if (direction.offsetZ < 0)
|
||||
{
|
||||
boundTop = AxisAlignedBB.getAABBPool().getAABB(x, y, z, x + 1, y + 0.8, z + (float) direction.offsetZ / -2);
|
||||
}
|
||||
}
|
||||
else if (tile.getSlant() == SlantType.DOWN)
|
||||
{
|
||||
if (direction.offsetX > 0)
|
||||
{
|
||||
boundTop = AxisAlignedBB.getAABBPool().getAABB(x, y, z, x + (float) direction.offsetX / 2, y + 0.8, z + 1);
|
||||
}
|
||||
else if (direction.offsetX < 0)
|
||||
{
|
||||
boundTop = AxisAlignedBB.getAABBPool().getAABB(x + (float) direction.offsetX / -2, y, z, x + 1, y + 0.8, z + 1);
|
||||
}
|
||||
else if (direction.offsetZ > 0)
|
||||
{
|
||||
boundTop = AxisAlignedBB.getAABBPool().getAABB(x, y, z, x + 1, y + 0.8, z + (float) direction.offsetZ / 2);
|
||||
}
|
||||
else if (direction.offsetZ < 0)
|
||||
{
|
||||
boundTop = AxisAlignedBB.getAABBPool().getAABB(x, y, z + (float) direction.offsetZ / -2, x + 1, y + 0.8, z + 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (tile.getSlant() == SlantType.UP)
|
||||
{
|
||||
if (direction.offsetX > 0)
|
||||
{
|
||||
boundTop = AxisAlignedBB.getAABBPool().getAABB(x + (float) direction.offsetX / 2, y, z, x + 1, y + 0.8, z + 1);
|
||||
}
|
||||
else if (direction.offsetX < 0)
|
||||
{
|
||||
boundTop = AxisAlignedBB.getAABBPool().getAABB(x, y, z, x + (float) direction.offsetX / -2, y + 0.8, z + 1);
|
||||
}
|
||||
else if (direction.offsetZ > 0)
|
||||
{
|
||||
boundTop = AxisAlignedBB.getAABBPool().getAABB(x, y, z + (float) direction.offsetZ / 2, x + 1, y + 0.8, z + 1);
|
||||
}
|
||||
else if (direction.offsetZ < 0)
|
||||
{
|
||||
boundTop = AxisAlignedBB.getAABBPool().getAABB(x, y, z, x + 1, y + 0.8, z + (float) direction.offsetZ / -2);
|
||||
}
|
||||
}
|
||||
else if (tile.getSlant() == SlantType.DOWN)
|
||||
{
|
||||
if (direction.offsetX > 0)
|
||||
{
|
||||
boundTop = AxisAlignedBB.getAABBPool().getAABB(x, y, z, x + (float) direction.offsetX / 2, y + 0.8, z + 1);
|
||||
}
|
||||
else if (direction.offsetX < 0)
|
||||
{
|
||||
boundTop = AxisAlignedBB.getAABBPool().getAABB(x + (float) direction.offsetX / -2, y, z, x + 1, y + 0.8, z + 1);
|
||||
}
|
||||
else if (direction.offsetZ > 0)
|
||||
{
|
||||
boundTop = AxisAlignedBB.getAABBPool().getAABB(x, y, z, x + 1, y + 0.8, z + (float) direction.offsetZ / 2);
|
||||
}
|
||||
else if (direction.offsetZ < 0)
|
||||
{
|
||||
boundTop = AxisAlignedBB.getAABBPool().getAABB(x, y, z + (float) direction.offsetZ / -2, x + 1, y + 0.8, z + 1);
|
||||
}
|
||||
}
|
||||
if (par5AxisAlignedBB.intersectsWith(boundBottom))
|
||||
{
|
||||
par6List.add(boundBottom);
|
||||
}
|
||||
if (boundTop != null && par5AxisAlignedBB.intersectsWith(boundTop))
|
||||
{
|
||||
par6List.add(boundTop);
|
||||
}
|
||||
|
||||
if (par5AxisAlignedBB.intersectsWith(boundBottom))
|
||||
{
|
||||
par6List.add(boundBottom);
|
||||
}
|
||||
if (boundTop != null && par5AxisAlignedBB.intersectsWith(boundTop))
|
||||
{
|
||||
par6List.add(boundTop);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
if (tile.getSlant() == SlantType.TOP)
|
||||
{
|
||||
AxisAlignedBB newBounds = AxisAlignedBB.getAABBPool().getAABB(x, y + 0.68, z, x + 1, y + 0.98, z + 1);
|
||||
|
||||
if (tile.getSlant() == SlantType.TOP)
|
||||
{
|
||||
AxisAlignedBB newBounds = AxisAlignedBB.getAABBPool().getAABB(x, y + 0.68, z, x + 1, y + 0.98, z + 1);
|
||||
if (newBounds != null && par5AxisAlignedBB.intersectsWith(newBounds))
|
||||
{
|
||||
par6List.add(newBounds);
|
||||
}
|
||||
|
||||
if (newBounds != null && par5AxisAlignedBB.intersectsWith(newBounds))
|
||||
{
|
||||
par6List.add(newBounds);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
AxisAlignedBB newBounds = AxisAlignedBB.getAABBPool().getAABB(x, y, z, x + 1, y + 0.1, z + 1);
|
||||
|
||||
AxisAlignedBB newBounds = AxisAlignedBB.getAABBPool().getAABB(x, y, z, x + 1, y + 0.1, z + 1);
|
||||
if (newBounds != null && par5AxisAlignedBB.intersectsWith(newBounds))
|
||||
{
|
||||
par6List.add(newBounds);
|
||||
}
|
||||
}
|
||||
|
||||
if (newBounds != null && par5AxisAlignedBB.intersectsWith(newBounds))
|
||||
{
|
||||
par6List.add(newBounds);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase par5EntityLiving, ItemStack stack)
|
||||
{
|
||||
super.onBlockPlacedBy(world, x, y, z, par5EntityLiving, stack);
|
||||
int angle = MathHelper.floor_double((par5EntityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
int change = 2;
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase par5EntityLiving, ItemStack stack)
|
||||
{
|
||||
super.onBlockPlacedBy(world, x, y, z, par5EntityLiving, stack);
|
||||
int angle = MathHelper.floor_double((par5EntityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
int change = 2;
|
||||
switch (angle)
|
||||
{
|
||||
case 0:
|
||||
change = 3;
|
||||
break;
|
||||
case 1:
|
||||
change = 4;
|
||||
break;
|
||||
case 2:
|
||||
change = 2;
|
||||
break;
|
||||
case 3:
|
||||
change = 5;
|
||||
break;
|
||||
|
||||
switch (angle)
|
||||
{
|
||||
case 0:
|
||||
change = 3;
|
||||
break;
|
||||
case 1:
|
||||
change = 4;
|
||||
break;
|
||||
case 2:
|
||||
change = 2;
|
||||
break;
|
||||
case 3:
|
||||
change = 5;
|
||||
break;
|
||||
}
|
||||
world.setBlockMetadataWithNotify(x, y, z, change, 3);
|
||||
}
|
||||
|
||||
}
|
||||
world.setBlockMetadataWithNotify(x, y, z, change, 3);
|
||||
}
|
||||
@Override
|
||||
public boolean onUseWrench(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
int original = world.getBlockMetadata(x, y, z);
|
||||
int change = 2;
|
||||
|
||||
@Override
|
||||
public boolean onUseWrench(World world, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
int original = world.getBlockMetadata(x, y, z);
|
||||
int change = 2;
|
||||
switch (original)
|
||||
{
|
||||
case 2:
|
||||
change = 4;
|
||||
break;
|
||||
case 3:
|
||||
change = 5;
|
||||
break;
|
||||
case 4:
|
||||
change = 3;
|
||||
break;
|
||||
case 5:
|
||||
change = 2;
|
||||
break;
|
||||
|
||||
switch (original)
|
||||
{
|
||||
case 2:
|
||||
change = 4;
|
||||
break;
|
||||
case 3:
|
||||
change = 5;
|
||||
break;
|
||||
case 4:
|
||||
change = 3;
|
||||
break;
|
||||
case 5:
|
||||
change = 2;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
world.setBlockMetadataWithNotify(x, y, z, change, 3);
|
||||
|
||||
world.setBlockMetadataWithNotify(x, y, z, change, 3);
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean onSneakUseWrench(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
TileConveyorBelt tileEntity = (TileConveyorBelt) world.getBlockTileEntity(x, y, z);
|
||||
|
||||
@Override
|
||||
public boolean onSneakUseWrench(World world, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
TileConveyorBelt tileEntity = (TileConveyorBelt) world.getBlockTileEntity(x, y, z);
|
||||
int slantOrdinal = tileEntity.getSlant().ordinal() + 1;
|
||||
|
||||
int slantOrdinal = tileEntity.getSlant().ordinal() + 1;
|
||||
if (slantOrdinal >= SlantType.values().length)
|
||||
{
|
||||
slantOrdinal = 0;
|
||||
}
|
||||
|
||||
if (slantOrdinal >= SlantType.values().length)
|
||||
{
|
||||
slantOrdinal = 0;
|
||||
}
|
||||
tileEntity.setSlant(SlantType.values()[slantOrdinal]);
|
||||
|
||||
tileEntity.setSlant(SlantType.values()[slantOrdinal]);
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
/** Moves the entity if the belt is powered. */
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity)
|
||||
{
|
||||
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
|
||||
|
||||
/** Moves the entity if the belt is powered. */
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity)
|
||||
{
|
||||
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
|
||||
if (tileEntity instanceof TileConveyorBelt)
|
||||
{
|
||||
TileConveyorBelt tile = (TileConveyorBelt) tileEntity;
|
||||
|
||||
if (tileEntity instanceof TileConveyorBelt)
|
||||
{
|
||||
TileConveyorBelt tile = (TileConveyorBelt) tileEntity;
|
||||
if (tile.ignoreList.contains(entity))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (tile.ignoreList.contains(entity))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!world.isBlockIndirectlyGettingPowered(x, y, z))
|
||||
{
|
||||
double maxSpeed = tile.getMoveVelocity() / 20;
|
||||
|
||||
if (!world.isBlockIndirectlyGettingPowered(x, y, z))
|
||||
{
|
||||
double maxSpeed = tile.getMoveVelocity() / 20;
|
||||
if (maxSpeed > 0)
|
||||
{
|
||||
SlantType slantType = tile.getSlant();
|
||||
ForgeDirection direction = tile.getDirection();
|
||||
|
||||
if (maxSpeed > 0)
|
||||
{
|
||||
SlantType slantType = tile.getSlant();
|
||||
ForgeDirection direction = tile.getDirection();
|
||||
if (slantType != SlantType.NONE)
|
||||
{
|
||||
entity.onGround = false;
|
||||
}
|
||||
|
||||
if (slantType != SlantType.NONE)
|
||||
{
|
||||
entity.onGround = false;
|
||||
}
|
||||
if (slantType == SlantType.UP)
|
||||
{
|
||||
// We need at least 0.25 to move items up.
|
||||
entity.motionY = maxSpeed * 3;// Math.max(0.25, maxSpeed);
|
||||
}
|
||||
else if (slantType == SlantType.DOWN)
|
||||
{
|
||||
entity.motionY = -maxSpeed;
|
||||
}
|
||||
|
||||
if (slantType == SlantType.UP)
|
||||
{
|
||||
// We need at least 0.25 to move items up.
|
||||
entity.motionY = maxSpeed * 3;// Math.max(0.25, maxSpeed);
|
||||
}
|
||||
else if (slantType == SlantType.DOWN)
|
||||
{
|
||||
entity.motionY = -maxSpeed;
|
||||
}
|
||||
if (direction.offsetX != 0)
|
||||
{
|
||||
entity.motionX = direction.offsetX * maxSpeed;
|
||||
entity.motionZ /= 2;
|
||||
}
|
||||
|
||||
if (direction.offsetX != 0)
|
||||
{
|
||||
entity.motionX = direction.offsetX * maxSpeed;
|
||||
entity.motionZ /= 2;
|
||||
}
|
||||
if (direction.offsetZ != 0)
|
||||
{
|
||||
entity.motionZ = direction.offsetZ * maxSpeed;
|
||||
entity.motionX /= 2;
|
||||
}
|
||||
|
||||
if (direction.offsetZ != 0)
|
||||
{
|
||||
entity.motionZ = direction.offsetZ * maxSpeed;
|
||||
entity.motionX /= 2;
|
||||
}
|
||||
if (entity instanceof EntityItem)
|
||||
{
|
||||
if (direction.offsetX != 0)
|
||||
{
|
||||
double difference = (z + 0.5) - entity.posZ;
|
||||
entity.motionZ += difference * 0.1;
|
||||
}
|
||||
else if (direction.offsetZ != 0)
|
||||
{
|
||||
double difference = (x + 0.5) - entity.posX;
|
||||
entity.motionX += difference * 0.1;
|
||||
}
|
||||
|
||||
if (entity instanceof EntityItem)
|
||||
{
|
||||
if (direction.offsetX != 0)
|
||||
{
|
||||
double difference = (z + 0.5) - entity.posZ;
|
||||
entity.motionZ += difference * 0.1;
|
||||
}
|
||||
else if (direction.offsetZ != 0)
|
||||
{
|
||||
double difference = (x + 0.5) - entity.posX;
|
||||
entity.motionX += difference * 0.1;
|
||||
}
|
||||
((EntityItem) entity).age = 0;
|
||||
|
||||
((EntityItem) entity).age = 0;
|
||||
boolean foundSneaking = false;
|
||||
for (EntityPlayer player : (List<EntityPlayer>) world.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(x - 1, y - 1, z - 1, x + 1, y + 1, z + 1)))
|
||||
{
|
||||
if (player.isSneaking())
|
||||
foundSneaking = true;
|
||||
}
|
||||
|
||||
boolean foundSneaking = false;
|
||||
for (EntityPlayer player : (List<EntityPlayer>) world.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(x - 1, y - 1, z - 1, x + 1, y + 1, z + 1)))
|
||||
{
|
||||
if (player.isSneaking())
|
||||
foundSneaking = true;
|
||||
}
|
||||
if (foundSneaking)
|
||||
((EntityItem) entity).delayBeforeCanPickup = 0;
|
||||
else
|
||||
((EntityItem) entity).delayBeforeCanPickup = 20;
|
||||
entity.onGround = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (foundSneaking)
|
||||
((EntityItem) entity).delayBeforeCanPickup = 0;
|
||||
else
|
||||
((EntityItem) entity).delayBeforeCanPickup = 20;
|
||||
entity.onGround = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/** Returns the TileEntity used by this block. */
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world)
|
||||
{
|
||||
return new TileConveyorBelt();
|
||||
}
|
||||
|
||||
/** Returns the TileEntity used by this block. */
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1)
|
||||
{
|
||||
return new TileConveyorBelt();
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return BlockRenderingHandler.ID;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public int getRenderType()
|
||||
{
|
||||
return BlockRenderingHandler.ID;
|
||||
}
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean renderAsNormalBlock()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped(int par1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public int damageDropped(int par1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -142,7 +142,7 @@ public class TileConveyorBelt extends TileMechanical implements IBelt, IRotatabl
|
|||
|
||||
if (this.worldObj.isRemote)
|
||||
{
|
||||
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.getBlockId(this.xCoord - 1, this.yCoord, this.zCoord) != Mechanical.blockConveyorBelt.blockID && this.worldObj.getBlockId(xCoord, yCoord, zCoord - 1) != Mechanical.blockConveyorBelt.blockID)
|
||||
{
|
||||
worldObj.playSound(this.xCoord, this.yCoord, this.zCoord, Reference.PREFIX + "conveyor", 0.5f, 0.5f + 0.15f * (float) getMoveVelocity(), true);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue