Fixed an issue where Parts/Blocks would not properly identify them selves with the proper ItemStack.
This commit is contained in:
@@ -3,7 +3,6 @@ package appeng.core;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.WeightedRandomChestContent;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraftforge.common.ChestGenHooks;
|
||||
@@ -63,6 +62,7 @@ import appeng.core.features.AEFeatureHandler;
|
||||
import appeng.core.features.ColoredItemDefinition;
|
||||
import appeng.core.features.DamagedItemDefinition;
|
||||
import appeng.core.features.IAEFeature;
|
||||
import appeng.core.features.ItemStackSrc;
|
||||
import appeng.core.features.NullItemDefinition;
|
||||
import appeng.core.features.registries.P2PTunnelRegistry;
|
||||
import appeng.core.features.registries.entries.BasicCellHandler;
|
||||
@@ -149,7 +149,7 @@ public class Registration
|
||||
try
|
||||
{
|
||||
Field f = materialClass.getField( "material" + mat.name() );
|
||||
ItemStack is = ((ItemMaterial) materialItem.item()).createMaterial( mat );
|
||||
ItemStackSrc is = ((ItemMaterial) materialItem.item()).createMaterial( mat );
|
||||
if ( is != null )
|
||||
f.set( materials, new DamagedItemDefinition( is ) );
|
||||
else
|
||||
@@ -173,7 +173,7 @@ public class Registration
|
||||
Enum varients[] = type.getVarients();
|
||||
if ( varients == null )
|
||||
{
|
||||
ItemStack is = ((ItemPart) partItem.item()).createPart( type, null );
|
||||
ItemStackSrc is = ((ItemPart) partItem.item()).createPart( type, null );
|
||||
if ( is != null )
|
||||
f.set( parts, new DamagedItemDefinition( is ) );
|
||||
else
|
||||
@@ -187,7 +187,7 @@ public class Registration
|
||||
|
||||
for (Enum v : varients)
|
||||
{
|
||||
ItemStack is = ((ItemPart) partItem.item()).createPart( type, v );
|
||||
ItemStackSrc is = ((ItemPart) partItem.item()).createPart( type, v );
|
||||
if ( is != null )
|
||||
def.add( (AEColor) v, is );
|
||||
}
|
||||
|
||||
@@ -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