Fixed an issue where Parts/Blocks would not properly identify them selves with the proper ItemStack.

This commit is contained in:
AlgorithmX2
2014-02-09 01:55:44 -06:00
parent 7367502d75
commit 49da876b6f
9 changed files with 66 additions and 27 deletions
+8 -8
View File
@@ -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;
}
+3 -3
View File
@@ -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;
}
}
+33
View File
@@ -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 );
}
}