2014-01-01 10:01:38 +01:00
|
|
|
package appeng.core.features;
|
|
|
|
|
|
|
|
import net.minecraft.block.Block;
|
|
|
|
import net.minecraft.item.Item;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraft.tileentity.TileEntity;
|
2014-05-10 07:00:02 +02:00
|
|
|
import net.minecraft.world.IBlockAccess;
|
2014-01-01 10:01:38 +01:00
|
|
|
import appeng.api.util.AEItemDefinition;
|
|
|
|
|
|
|
|
public class DamagedItemDefinition implements AEItemDefinition
|
|
|
|
{
|
|
|
|
|
|
|
|
final Item baseItem;
|
|
|
|
final int damage;
|
|
|
|
|
2014-02-09 08:55:44 +01:00
|
|
|
public DamagedItemDefinition(ItemStackSrc is) {
|
2014-01-01 10:01:38 +01:00
|
|
|
if ( is == null )
|
|
|
|
{
|
|
|
|
baseItem = null;
|
|
|
|
damage = -1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-02-09 08:55:44 +01:00
|
|
|
baseItem = is.item;
|
|
|
|
damage = is.damage;
|
2014-01-01 10:01:38 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public Block block()
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public Item item()
|
|
|
|
{
|
|
|
|
return baseItem;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public Class<? extends TileEntity> entity()
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public ItemStack stack(int stackSize)
|
|
|
|
{
|
|
|
|
if ( baseItem == null )
|
|
|
|
return null;
|
|
|
|
|
2014-01-20 17:41:37 +01:00
|
|
|
return new ItemStack( baseItem, stackSize, damage );
|
2014-01-01 10:01:38 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2014-05-10 07:00:02 +02:00
|
|
|
public boolean sameAsStack(ItemStack comparableItem)
|
2014-01-01 10:01:38 +01:00
|
|
|
{
|
|
|
|
if ( comparableItem == null )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return comparableItem.getItem() == baseItem && comparableItem.getItemDamage() == damage;
|
|
|
|
}
|
|
|
|
|
2014-05-10 07:00:02 +02:00
|
|
|
@Override
|
|
|
|
public boolean sameAsBlock(IBlockAccess world, int x, int y, int z)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-01-01 10:01:38 +01:00
|
|
|
}
|