Code cleanup

This commit is contained in:
LemADEC 2015-11-13 22:02:16 +01:00
parent 5f71714993
commit 114432331b

View file

@ -16,13 +16,13 @@ import cr0s.warpdrive.WarpDrive;
public class BlockMiningLaser extends BlockContainer {
private IIcon[] iconBuffer;
private final static int ICON_TOP = 5;
public final static int ICON_IDLE = 0;
public final static int ICON_MININGLOWPOWER = 1;
public final static int ICON_MININGPOWERED = 2;
public final static int ICON_SCANNINGLOWPOWER = 3;
public final static int ICON_SCANNINGPOWERED = 4;
private final static int ICON_TOP = 5;
public BlockMiningLaser() {
super(Material.rock);
setHardness(0.5F);
@ -30,7 +30,7 @@ public class BlockMiningLaser extends BlockContainer {
setCreativeTab(WarpDrive.creativeTabWarpDrive);
this.setBlockName("warpdrive.collection.MiningLaser");
}
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
iconBuffer = new IIcon[16];
@ -42,7 +42,7 @@ public class BlockMiningLaser extends BlockContainer {
iconBuffer[ICON_SCANNINGLOWPOWER] = par1IconRegister.registerIcon("warpdrive:collection/miningLaser_scanningLowPower");
iconBuffer[ICON_SCANNINGPOWERED ] = par1IconRegister.registerIcon("warpdrive:collection/miningLaser_scanningPowered");
}
@Override
public IIcon getIcon(int side, int metadata) {
if (side == 0 || side == 1) {
@ -54,44 +54,38 @@ public class BlockMiningLaser extends BlockContainer {
return null;
}
}
@Override
public TileEntity createNewTileEntity(World var1, int i) {
return new TileEntityMiningLaser();
}
/**
* Returns the quantity of items to drop on block destruction.
*/
@Override
public int quantityDropped(Random par1Random) {
return 1;
}
/**
* Returns the ID of the items to drop on destruction.
* Returns the item to drop on destruction.
*/
@Override
public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(this);
}
/**
* Called upon block activation (right click on the block.)
*/
@Override
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
return false;
}
TileEntityMiningLaser miningLaser = (TileEntityMiningLaser)par1World.getTileEntity(par2, par3, par4);
if (miningLaser != null && (par5EntityPlayer.getHeldItem() == null)) {
WarpDrive.addChatMessage(par5EntityPlayer, miningLaser.getStatus());
return true;
}
return false;
}
}