Code cleanup

This commit is contained in:
LemADEC 2015-11-13 21:55:51 +01:00
parent baf8a25057
commit d292c5e8f5

View file

@ -17,7 +17,7 @@ import cr0s.warpdrive.render.ClientCameraHandler;
public class BlockMonitor extends BlockContainer {
private IIcon iconFront;
private IIcon iconBlock;
private IIcon iconSide;
public BlockMonitor() {
super(Material.iron);
@ -28,13 +28,9 @@ public class BlockMonitor extends BlockContainer {
}
@Override
/**
* From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
*/
public IIcon getIcon(int side, int parMetadata) {
int meta = parMetadata & 3;
return side == 2 ? (meta == 0 ? this.iconFront : this.iconBlock) : (side == 3 ? (meta == 2 ? this.iconFront : this.iconBlock) : (side == 4 ? (meta == 3 ? this.iconFront : this.iconBlock) : (side == 5 ? (meta == 1 ? this.iconFront : this.iconBlock) : this.iconBlock)));
return side == 2 ? (meta == 0 ? iconFront : iconSide) : (side == 3 ? (meta == 2 ? iconFront : iconSide) : (side == 4 ? (meta == 3 ? iconFront : iconSide) : (side == 5 ? (meta == 1 ? iconFront : iconSide) : iconSide)));
}
/**
@ -43,22 +39,16 @@ public class BlockMonitor extends BlockContainer {
*/
@Override
public void registerBlockIcons(IIconRegister reg) {
this.iconFront = reg.registerIcon("warpdrive:detection/monitorFront");
this.iconBlock = reg.registerIcon("warpdrive:detection/monitorSide");
iconFront = reg.registerIcon("warpdrive:detection/monitorFront");
iconSide = reg.registerIcon("warpdrive:detection/monitorSide");
}
/**
* Called when the block is placed in the world.
*/
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityliving, ItemStack itemstack) {
int dir = Math.round(entityliving.rotationYaw / 90.0F) & 3;
world.setBlockMetadataWithNotify(x, y, z, dir, 3);
}
/**
* Called upon block activation (right click on the block.)
*/
@Override
public boolean onBlockActivated(World par1World, int x, int y, int z, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9) {
// Monitor is only reacting client side