diff --git a/src/main/java/appeng/util/item/AESharedItemStack.java b/src/main/java/appeng/util/item/AESharedItemStack.java index 7bbaf5545..4e4aeb7b8 100644 --- a/src/main/java/appeng/util/item/AESharedItemStack.java +++ b/src/main/java/appeng/util/item/AESharedItemStack.java @@ -38,12 +38,14 @@ final class AESharedItemStack implements Comparable private final ItemStack itemStack; private final int itemId; private final int itemDamage; + private final int hashCode; public AESharedItemStack( final ItemStack itemStack ) { this.itemStack = itemStack; this.itemId = Item.getIdFromItem( itemStack.getItem() ); this.itemDamage = itemStack.getItemDamage(); + this.hashCode = this.makeHashCode(); } Bounds getBounds( final FuzzyMode fuzzy, final boolean ignoreMeta ) @@ -69,7 +71,7 @@ final class AESharedItemStack implements Comparable @Override public int hashCode() { - return Objects.hash( this.itemId, this.itemDamage, this.itemStack.hasTagCompound() ? this.itemStack.getTagCompound() : 0 ); + return this.hashCode; } @Override @@ -144,6 +146,11 @@ final class AESharedItemStack implements Comparable return System.identityHashCode( this.itemStack.getTagCompound() ) - System.identityHashCode( b.getTagCompound() ); } + private int makeHashCode() + { + return Objects.hash( this.itemId, this.itemDamage, this.itemStack.hasTagCompound() ? this.itemStack.getTagCompound() : 0 ); + } + /** * Creates the lower and upper bounds for a specific shared itemstack. */