Code cleanup

This commit is contained in:
LemADEC 2016-04-20 13:38:22 +02:00
parent 9f452beca7
commit e9d2fb1492
4 changed files with 27 additions and 27 deletions

View file

@ -2,9 +2,12 @@ package cr0s.warpdrive.api;
import net.minecraft.item.ItemStack;
@Deprecated // we should use fluid storage instead here
public interface IAirCanister {
public ItemStack emptyDrop(ItemStack can);
public ItemStack fullDrop(ItemStack can);
public boolean canContainAir(ItemStack can);
public boolean containsAir(ItemStack can);
// Return true if that itemStack is Air compatible (i.e. may or already contains air)
public boolean canContainAir(ItemStack itemStack);
public boolean containsAir(ItemStack itemStack);
public ItemStack emptyDrop(ItemStack itemStack);
public ItemStack fullDrop(ItemStack itemStack);
}

View file

@ -53,9 +53,6 @@ public class BlockShipScanner extends BlockAbstractContainer {
return 1;
}
/**
* Returns the item to drop on destruction.
*/
@Override
public Item getItemDropped(int par1, Random par2Random, int par3) {
return Item.getItemFromBlock(this);

View file

@ -29,16 +29,6 @@ public class ItemAirCanisterFull extends Item implements IAirCanister {
public IIcon getIconFromDamage(int damage) {
return icon;
}
@Override
public ItemStack emptyDrop(ItemStack itemStack) {
return WarpDrive.itemComponent.getItemStackNoCache(ComponentType.AIR_CANISTER, 1);
}
@Override
public ItemStack fullDrop(ItemStack itemStack) {
return new ItemStack(WarpDrive.itemAirCanisterFull,1);
}
@Override
public boolean canContainAir(ItemStack itemStack) {
@ -52,4 +42,14 @@ public class ItemAirCanisterFull extends Item implements IAirCanister {
public boolean containsAir(ItemStack itemStack) {
return true;
}
@Override
public ItemStack emptyDrop(ItemStack itemStack) {
return WarpDrive.itemComponent.getItemStackNoCache(ComponentType.AIR_CANISTER, 1);
}
@Override
public ItemStack fullDrop(ItemStack itemStack) {
return new ItemStack(WarpDrive.itemAirCanisterFull, 1);
}
}

View file

@ -74,6 +74,16 @@ public class ItemComponent extends Item implements IAirCanister {
}
// For empty air canister
@Override
public boolean canContainAir(ItemStack itemStack) {
return (itemStack.getItem() instanceof ItemComponent && itemStack.getItemDamage() == ComponentType.AIR_CANISTER.ordinal());
}
@Override
public boolean containsAir(ItemStack itemStack) {
return false;
}
@Override
public ItemStack fullDrop(ItemStack itemStack) {
if (canContainAir(itemStack)) {
@ -90,16 +100,6 @@ public class ItemComponent extends Item implements IAirCanister {
return null;
}
@Override
public boolean canContainAir(ItemStack itemStack) {
return (itemStack.getItem() instanceof ItemComponent && itemStack.getItemDamage() == ComponentType.AIR_CANISTER.ordinal());
}
@Override
public boolean containsAir(ItemStack itemStack) {
return false;
}
@Override
public void addInformation(ItemStack itemStack, EntityPlayer entityPlayer, List list, boolean advancedItemTooltips) {
super.addInformation(itemStack, entityPlayer, list, advancedItemTooltips);