2013-12-27 23:59:59 +01:00
|
|
|
package appeng.util.item;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import net.minecraft.item.Item;
|
2013-12-28 21:55:31 +01:00
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraft.nbt.NBTBase;
|
2013-12-27 23:59:59 +01:00
|
|
|
import appeng.api.storage.data.IAETagCompound;
|
2013-12-28 21:55:31 +01:00
|
|
|
import appeng.util.Platform;
|
2013-12-27 23:59:59 +01:00
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
|
|
|
|
|
|
|
public class AEItemDef
|
|
|
|
{
|
|
|
|
|
|
|
|
public int myHash;
|
|
|
|
|
|
|
|
public int def;
|
|
|
|
|
|
|
|
public Item item;
|
|
|
|
public int damageValue;
|
|
|
|
|
|
|
|
public int dspDamage;
|
|
|
|
public int maxDamage;
|
|
|
|
|
|
|
|
public IAETagCompound tagCompound;
|
|
|
|
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
public String displayName;
|
|
|
|
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
public List tooltip;
|
|
|
|
|
|
|
|
public AEItemDef copy()
|
|
|
|
{
|
|
|
|
AEItemDef t = new AEItemDef();
|
|
|
|
t.def = def;
|
|
|
|
t.item = item;
|
|
|
|
t.damageValue = damageValue;
|
|
|
|
t.dspDamage = dspDamage;
|
|
|
|
t.maxDamage = maxDamage;
|
|
|
|
return t;
|
|
|
|
}
|
2013-12-28 21:55:31 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean equals(Object obj)
|
|
|
|
{
|
|
|
|
AEItemDef def = (AEItemDef) obj;
|
|
|
|
return def.damageValue == damageValue && def.item == item && tagCompound == def.tagCompound;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getDamageValueHack(ItemStack is)
|
|
|
|
{
|
|
|
|
return Item.blazeRod.getDamage( is );
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isItem(ItemStack otherStack)
|
|
|
|
{
|
|
|
|
// hackery!
|
|
|
|
int dmg = getDamageValueHack( otherStack );
|
|
|
|
|
|
|
|
if ( item == otherStack.getItem() && dmg == damageValue )
|
|
|
|
{
|
|
|
|
if ( (tagCompound != null) == otherStack.hasTagCompound() )
|
|
|
|
return true;
|
|
|
|
|
|
|
|
if ( tagCompound != null && otherStack.hasTagCompound() )
|
|
|
|
return Platform.NBTEqualityTest( (NBTBase) tagCompound, otherStack.getTagCompound() );
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
2013-12-27 23:59:59 +01:00
|
|
|
}
|