Fixed an issue where Parts/Blocks would not properly identify them selves with the proper ItemStack.
This commit is contained in:
@@ -10,42 +10,42 @@ import appeng.api.util.AEColoredItemDefinition;
|
||||
public class ColoredItemDefinition implements AEColoredItemDefinition
|
||||
{
|
||||
|
||||
ItemStack colors[] = new ItemStack[17];
|
||||
ItemStackSrc colors[] = new ItemStackSrc[17];
|
||||
|
||||
@Override
|
||||
public Item item(AEColor color)
|
||||
{
|
||||
ItemStack is = colors[color.ordinal()];
|
||||
ItemStackSrc is = colors[color.ordinal()];
|
||||
|
||||
if ( is == null )
|
||||
return null;
|
||||
|
||||
return is.getItem();
|
||||
return is.item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack stack(AEColor color, int stackSize)
|
||||
{
|
||||
ItemStack is = colors[color.ordinal()];
|
||||
ItemStackSrc is = colors[color.ordinal()];
|
||||
|
||||
if ( is == null )
|
||||
return null;
|
||||
|
||||
return new ItemStack( is.getItem(), stackSize, is.getItemDamage() );
|
||||
return is.stack( stackSize );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sameAs(AEColor color, ItemStack comparableItem)
|
||||
{
|
||||
ItemStack is = colors[color.ordinal()];
|
||||
ItemStackSrc is = colors[color.ordinal()];
|
||||
|
||||
if ( comparableItem == null )
|
||||
return false;
|
||||
|
||||
return comparableItem.getItem() == is.getItem() && comparableItem.getItemDamage() == is.getItemDamage();
|
||||
return comparableItem.getItem() == is.item && comparableItem.getItemDamage() == is.damage;
|
||||
}
|
||||
|
||||
public void add(AEColor v, ItemStack is)
|
||||
public void add(AEColor v, ItemStackSrc is)
|
||||
{
|
||||
colors[v.ordinal()] = is;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ public class DamagedItemDefinition implements AEItemDefinition
|
||||
final Item baseItem;
|
||||
final int damage;
|
||||
|
||||
public DamagedItemDefinition(ItemStack is) {
|
||||
public DamagedItemDefinition(ItemStackSrc is) {
|
||||
if ( is == null )
|
||||
{
|
||||
baseItem = null;
|
||||
@@ -20,8 +20,8 @@ public class DamagedItemDefinition implements AEItemDefinition
|
||||
}
|
||||
else
|
||||
{
|
||||
baseItem = is.getItem();
|
||||
damage = is.getItemDamage();
|
||||
baseItem = is.item;
|
||||
damage = is.damage;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package appeng.core.features;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ItemStackSrc
|
||||
{
|
||||
|
||||
public final Item item;
|
||||
public final Block block;
|
||||
public final int damage;
|
||||
|
||||
public ItemStackSrc(Item i, int dmg) {
|
||||
block = null;
|
||||
item = i;
|
||||
damage = dmg;
|
||||
}
|
||||
|
||||
public ItemStackSrc(Block b, int dmg) {
|
||||
item = null;
|
||||
block = b;
|
||||
damage = dmg;
|
||||
}
|
||||
|
||||
public ItemStack stack(int i)
|
||||
{
|
||||
if ( block != null )
|
||||
return new ItemStack( block, i, damage );
|
||||
return new ItemStack( item, i, damage );
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user