Fixed ship scanner texture names

Code cleanup
This commit is contained in:
LemADEC 2015-11-13 22:43:52 +01:00
parent 2f335a0c84
commit 86c30a0cfb
2 changed files with 14 additions and 16 deletions

View file

@ -17,6 +17,9 @@ import cr0s.warpdrive.block.TileEntityAbstractEnergy;
public class BlockShipScanner extends BlockContainer { public class BlockShipScanner extends BlockContainer {
private IIcon[] iconBuffer; private IIcon[] iconBuffer;
private final static int ICON_BOTTOM = 0;
private final static int ICON_TOP = 1;
private final static int ICON_SIDE = 2;
public BlockShipScanner() { public BlockShipScanner() {
super(Material.rock); super(Material.rock);
@ -28,21 +31,22 @@ public class BlockShipScanner extends BlockContainer {
@Override @Override
public void registerBlockIcons(IIconRegister par1IconRegister) { public void registerBlockIcons(IIconRegister par1IconRegister) {
iconBuffer = new IIcon[3]; iconBuffer = new IIcon[16];
iconBuffer[0] = par1IconRegister.registerIcon("warpdrive:building/shipScannerUp"); iconBuffer[ICON_BOTTOM] = par1IconRegister.registerIcon("warpdrive:building/shipScannerBottom");
iconBuffer[1] = par1IconRegister.registerIcon("warpdrive:building/shipScannerSide"); iconBuffer[ICON_TOP ] = par1IconRegister.registerIcon("warpdrive:building/shipScannerTop");
iconBuffer[2] = par1IconRegister.registerIcon("warpdrive:building/shipScannerBottom"); iconBuffer[ICON_SIDE ] = par1IconRegister.registerIcon("warpdrive:building/shipScannerSide");
} }
@Override @Override
public IIcon getIcon(int side, int metadata) { public IIcon getIcon(int side, int metadata) {
if (side == 1) { // UP if (side == 0) {
return iconBuffer[0]; return iconBuffer[ICON_BOTTOM];
} else if (side == 0) { // DOWN }
return iconBuffer[2]; if (side == 1) {
return iconBuffer[ICON_TOP];
} }
return iconBuffer[1]; return iconBuffer[ICON_SIDE];
} }
@Override @Override
@ -50,25 +54,19 @@ public class BlockShipScanner extends BlockContainer {
return new TileEntityShipScanner(); return new TileEntityShipScanner();
} }
/**
* Returns the quantity of items to drop on block destruction.
*/
@Override @Override
public int quantityDropped(Random par1Random) { public int quantityDropped(Random par1Random) {
return 1; return 1;
} }
/** /**
* Returns the ID of the items to drop on destruction. * Returns the item to drop on destruction.
*/ */
@Override @Override
public Item getItemDropped(int par1, Random par2Random, int par3) { public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(this); return Item.getItemFromBlock(this);
} }
/**
* Called upon block activation (right click on the block.)
*/
@Override @Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9) { public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9) {
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) { if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {