Extracts item comparison from Platform into their own helper. (#2555)

* Extracts item comparison from Platform into their own helper.

Renamed methods to be more more fitting for the actual comparison.
Added documentation about each methods behaviour.
This commit is contained in:
yueh
2016-11-04 09:27:52 +01:00
committed by GitHub
parent f85ab7ddc2
commit 1e20086799
53 changed files with 555 additions and 471 deletions
@@ -327,7 +327,7 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
return ta == tb;
}
return Platform.NBTEqualityTest( ta, tb );
return Platform.itemComparisons().isNbtTagEqual( ta, tb );
}
}
return false;
@@ -100,7 +100,7 @@ public class AEItemDef
if( this.getTagCompound() != null && otherStack.hasTagCompound() )
{
return Platform.NBTEqualityTest( this.getTagCompound(), otherStack.getTagCompound() );
return Platform.itemComparisons().isNbtTagEqual( this.getTagCompound(), otherStack.getTagCompound() );
}
return true;
@@ -522,7 +522,7 @@ public final class AEItemStack extends AEStack<IAEItemStack> implements IAEItemS
return ta == tb;
}
return Platform.NBTEqualityTest( ta, tb );
return Platform.itemComparisons().isNbtTagEqual( ta, tb );
}
}
return false;
@@ -136,7 +136,7 @@ public class AESharedNBT extends NBTTagCompound implements IAETagCompound
x.setTag( name, c.getTag( name ).copy() );
}
x.hash = Platform.NBTOrderlessHash( c );
x.hash = Platform.itemComparisons().createUnorderedNbtHash( c );
final ItemStack isc = new ItemStack( itemID, 1, damageValue );
isc.setTagCompound( c );
@@ -36,7 +36,7 @@ public class SharedSearchObject
public SharedSearchObject( final Item itemID, final int damageValue, final NBTTagCompound tagCompound )
{
this.def = ( damageValue << Platform.DEF_OFFSET ) | Item.REGISTRY.getIDForObject( itemID );
this.hash = Platform.NBTOrderlessHash( tagCompound );
this.hash = Platform.itemComparisons().createUnorderedNbtHash( tagCompound );
this.setCompound( tagCompound );
}
@@ -60,7 +60,7 @@ public class SharedSearchObject
final SharedSearchObject other = (SharedSearchObject) obj;
if( this.def == other.def && this.hash == other.hash )
{
return Platform.NBTEqualityTest( this.getCompound(), other.getCompound() );
return Platform.itemComparisons().isNbtTagEqual( this.getCompound(), other.getCompound() );
}
return false;
}