Applied-Energistics-2-tiler.../util/item/SharedSearchObject.java

41 lines
830 B
Java
Raw Normal View History

package appeng.util.item;
2014-02-09 02:34:52 +01:00
import net.minecraft.item.Item;
import net.minecraft.nbt.NBTTagCompound;
2014-01-01 10:03:00 +01:00
import appeng.util.Platform;
public class SharedSearchObject
{
int def;
int hash;
NBTTagCompound compound;
public AESharedNBT shared;
2014-02-09 02:34:52 +01:00
public SharedSearchObject(Item itemID, int damageValue, NBTTagCompound tagCompound) {
def = (damageValue << Platform.DEF_OFFSET) | Item.itemRegistry.getIDForObject( itemID );
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;
}
}