Code cleanup
This commit is contained in:
parent
f780c5125e
commit
7de3ab0439
1 changed files with 17 additions and 19 deletions
|
@ -18,9 +18,12 @@ import cr0s.warpdrive.WarpDrive;
|
|||
|
||||
public class BlockShipController extends BlockContainer {
|
||||
private IIcon[] iconBuffer;
|
||||
|
||||
private final int ICON_INACTIVE_SIDE = 0, ICON_BOTTOM = 1, ICON_TOP = 2, ICON_SIDE_ACTIVATED = 3;
|
||||
|
||||
|
||||
private final int ICON_INACTIVE_SIDE = 0;
|
||||
private final int ICON_BOTTOM = 1;
|
||||
private final int ICON_TOP = 2;
|
||||
private final int ICON_SIDE_ACTIVATED = 3;
|
||||
|
||||
public BlockShipController() {
|
||||
super(Material.rock);
|
||||
setHardness(0.5F);
|
||||
|
@ -28,7 +31,7 @@ public class BlockShipController extends BlockContainer {
|
|||
setCreativeTab(WarpDrive.creativeTabWarpDrive);
|
||||
setBlockName("warpdrive.movement.ShipController");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
|
@ -46,7 +49,7 @@ public class BlockShipController extends BlockContainer {
|
|||
iconBuffer[ICON_SIDE_ACTIVATED + 5] = par1IconRegister.registerIcon("warpdrive:movement/shipControllerSideActive5");
|
||||
iconBuffer[ICON_SIDE_ACTIVATED + 6] = par1IconRegister.registerIcon("warpdrive:movement/shipControllerSideActive6");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
if (side == 0) {
|
||||
|
@ -54,7 +57,7 @@ public class BlockShipController extends BlockContainer {
|
|||
} else if (side == 1) {
|
||||
return iconBuffer[ICON_TOP];
|
||||
}
|
||||
|
||||
|
||||
if (metadata == 0) { // Inactive state
|
||||
return iconBuffer[ICON_INACTIVE_SIDE];
|
||||
} else if (metadata > 0) { // Activated, in metadata stored mode number
|
||||
|
@ -64,39 +67,34 @@ public class BlockShipController extends BlockContainer {
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1, int i) {
|
||||
return new TileEntityShipController();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 items 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;
|
||||
}
|
||||
|
||||
|
||||
if (par5EntityPlayer.getHeldItem() == null) {
|
||||
TileEntityShipController controller = (TileEntityShipController)par1World.getTileEntity(par2, par3, par4);
|
||||
if (controller != null) {
|
||||
|
@ -105,7 +103,7 @@ public class BlockShipController extends BlockContainer {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue