Minor refractor/cleanup on belts

This commit is contained in:
Robert S 2014-03-24 22:50:53 -04:00
parent e5d68fb593
commit 2b4bac211d
2 changed files with 295 additions and 301 deletions

View file

@ -21,11 +21,9 @@ import calclavia.lib.render.block.BlockRenderingHandler;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; 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 class BlockConveyorBelt extends BlockTile
{ {
public BlockConveyorBelt(int id) public BlockConveyorBelt(int id)
@ -38,13 +36,9 @@ public class BlockConveyorBelt extends BlockTile
@Override @Override
public void onBlockAdded(World world, int x, int y, int z) public void onBlockAdded(World world, int x, int y, int z)
{ {
TileEntity t = world.getBlockTileEntity(x, y, z); TileEntity tile = world.getBlockTileEntity(x, y, z);
if (tile instanceof TileConveyorBelt)
if (t != null && t instanceof TileConveyorBelt) ((TileConveyorBelt) tile).mechanicalNode.reconstruct();
{
TileConveyorBelt tileEntity = (TileConveyorBelt) t;
tileEntity.mechanicalNode.reconstruct();
}
} }
@Override @Override
@ -218,7 +212,7 @@ public class BlockConveyorBelt extends BlockTile
} }
@Override @Override
public boolean onUseWrench(World world, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ) 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 original = world.getBlockMetadata(x, y, z);
int change = 2; int change = 2;
@ -246,7 +240,7 @@ public class BlockConveyorBelt extends BlockTile
} }
@Override @Override
public boolean onSneakUseWrench(World world, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ) 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); TileConveyorBelt tileEntity = (TileConveyorBelt) world.getBlockTileEntity(x, y, z);
@ -348,7 +342,7 @@ public class BlockConveyorBelt extends BlockTile
/** Returns the TileEntity used by this block. */ /** Returns the TileEntity used by this block. */
@Override @Override
public TileEntity createNewTileEntity(World var1) public TileEntity createNewTileEntity(World world)
{ {
return new TileConveyorBelt(); return new TileConveyorBelt();
} }

View file

@ -142,7 +142,7 @@ public class TileConveyorBelt extends TileMechanical implements IBelt, IRotatabl
if (this.worldObj.isRemote) 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); worldObj.playSound(this.xCoord, this.yCoord, this.zCoord, Reference.PREFIX + "conveyor", 0.5f, 0.5f + 0.15f * (float) getMoveVelocity(), true);
} }