Files
Applied-Energistics-2/src/main/java/appeng/util/item/SharedSearchObject.java
T
yueh fd7c1ff5f8 Added checks for null and equal class to .equals()
Also switched a check for null in OreHelper#sameOre to prevent null ==
null => true
2014-09-29 12:39:40 +02:00

43 lines
901 B
Java

package appeng.util.item;
import net.minecraft.item.Item;
import net.minecraft.nbt.NBTTagCompound;
import appeng.util.Platform;
public class SharedSearchObject
{
int def;
int hash;
NBTTagCompound compound;
public AESharedNBT shared;
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;
if ( getClass() != obj.getClass() )
return false;
SharedSearchObject other = (SharedSearchObject) obj;
if ( def == other.def && hash == other.hash )
{
return Platform.NBTEqualityTest( compound, other.compound );
}
return false;
}
@Override
public int hashCode()
{
return def ^ hash;
}
}