new comparison methods.

This commit is contained in:
AlgorithmX2
2013-12-28 14:55:31 -06:00
parent 22fafa697a
commit e733df5448
2 changed files with 52 additions and 1 deletions
+33
View File
@@ -3,7 +3,10 @@ package appeng.util.item;
import java.util.List;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTBase;
import appeng.api.storage.data.IAETagCompound;
import appeng.util.Platform;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -38,4 +41,34 @@ public class AEItemDef
t.maxDamage = maxDamage;
return t;
}
@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;
}
}