2014-01-24 17:30:57 +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;
|
|
|
|
import appeng.api.util.AEColor;
|
|
|
|
import appeng.api.util.AEColoredItemDefinition;
|
|
|
|
|
|
|
|
public class ColoredItemDefinition implements AEColoredItemDefinition
|
|
|
|
{
|
|
|
|
|
2014-02-09 08:55:44 +01:00
|
|
|
ItemStackSrc colors[] = new ItemStackSrc[17];
|
2014-01-24 17:30:57 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public Item item(AEColor color)
|
|
|
|
{
|
2014-02-09 08:55:44 +01:00
|
|
|
ItemStackSrc is = colors[color.ordinal()];
|
2014-01-24 17:30:57 +01:00
|
|
|
|
|
|
|
if ( is == null )
|
|
|
|
return null;
|
|
|
|
|
2014-02-09 08:55:44 +01:00
|
|
|
return is.item;
|
2014-01-24 17:30:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public ItemStack stack(AEColor color, int stackSize)
|
|
|
|
{
|
2014-02-09 08:55:44 +01:00
|
|
|
ItemStackSrc is = colors[color.ordinal()];
|
2014-01-24 17:30:57 +01:00
|
|
|
|
|
|
|
if ( is == null )
|
|
|
|
return null;
|
|
|
|
|
2014-02-09 08:55:44 +01:00
|
|
|
return is.stack( stackSize );
|
2014-01-24 17:30:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean sameAs(AEColor color, ItemStack comparableItem)
|
|
|
|
{
|
2014-02-09 08:55:44 +01:00
|
|
|
ItemStackSrc is = colors[color.ordinal()];
|
2014-01-24 17:30:57 +01:00
|
|
|
|
|
|
|
if ( comparableItem == null )
|
|
|
|
return false;
|
|
|
|
|
2014-02-09 08:55:44 +01:00
|
|
|
return comparableItem.getItem() == is.item && comparableItem.getItemDamage() == is.damage;
|
2014-01-24 17:30:57 +01:00
|
|
|
}
|
|
|
|
|
2014-02-09 08:55:44 +01:00
|
|
|
public void add(AEColor v, ItemStackSrc is)
|
2014-01-24 17:30:57 +01:00
|
|
|
{
|
|
|
|
colors[v.ordinal()] = is;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public Block block(AEColor color)
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public Class<? extends TileEntity> entity(AEColor color)
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2014-03-10 03:11:29 +01:00
|
|
|
@Override
|
|
|
|
public ItemStack[] allStacks(int stackSize)
|
|
|
|
{
|
|
|
|
ItemStack is[] = new ItemStack[colors.length];
|
|
|
|
for (int x = 0; x < is.length; x++)
|
|
|
|
is[x] = colors[x].stack( 1 );
|
|
|
|
return is;
|
|
|
|
}
|
|
|
|
|
2014-01-24 17:30:57 +01:00
|
|
|
}
|