2013-12-27 16:59:59 -06:00
|
|
|
package appeng.util.item;
|
|
|
|
|
2014-02-08 19:34:52 -06:00
|
|
|
import net.minecraft.item.Item;
|
2013-12-27 16:59:59 -06:00
|
|
|
import net.minecraft.nbt.NBTTagCompound;
|
2014-01-01 03:03:00 -06:00
|
|
|
import appeng.util.Platform;
|
2013-12-27 16:59:59 -06:00
|
|
|
|
|
|
|
public class SharedSearchObject
|
|
|
|
{
|
|
|
|
|
|
|
|
int def;
|
|
|
|
int hash;
|
|
|
|
NBTTagCompound compound;
|
|
|
|
public AESharedNBT shared;
|
|
|
|
|
2014-02-08 19:34:52 -06:00
|
|
|
public SharedSearchObject(Item itemID, int damageValue, NBTTagCompound tagCompound) {
|
|
|
|
def = (damageValue << Platform.DEF_OFFSET) | Item.itemRegistry.getIDForObject( itemID );
|
2013-12-27 16:59:59 -06:00
|
|
|
hash = Platform.NBTOrderlessHash( tagCompound );
|
|
|
|
compound = tagCompound;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean equals(Object obj)
|
|
|
|
{
|
|
|
|
if ( obj == null )
|
|
|
|
return false;
|
|
|
|
SharedSearchObject b = (SharedSearchObject) obj;
|
|
|
|
if ( def == b.def && hash == b.hash )
|
|
|
|
{
|
|
|
|
return Platform.NBTEqualityTest( compound, b.compound );
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int hashCode()
|
|
|
|
{
|
|
|
|
return def ^ hash;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|