From 98f83ad5e48b7d3ed37daef03deb0b23120e1323 Mon Sep 17 00:00:00 2001 From: AlgorithmX2 Date: Wed, 2 Jul 2014 00:06:44 -0500 Subject: [PATCH] instead of itemid use the Item system hash. for hash generation purposes should improve lookup type stuff. --- util/item/AEItemDef.java | 9 ++++++--- util/item/AEItemStack.java | 3 +-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/util/item/AEItemDef.java b/util/item/AEItemDef.java index bcdd2ac7..bb7800ef 100644 --- a/util/item/AEItemDef.java +++ b/util/item/AEItemDef.java @@ -37,17 +37,20 @@ public class AEItemDef static AESharedNBT lowTag = new AESharedNBT( Integer.MIN_VALUE ); static AESharedNBT highTag = new AESharedNBT( Integer.MAX_VALUE ); + public AEItemDef(Item it) { + item = it; + itemID = System.identityHashCode( item ); + } + public AEItemDef copy() { - AEItemDef t = new AEItemDef(); + AEItemDef t = new AEItemDef( item ); t.def = def; - t.item = item; t.damageValue = damageValue; t.dspDamage = dspDamage; t.maxDamage = maxDamage; t.tagCompound = tagCompound; t.isOre = isOre; - t.itemID = itemID; return t; } diff --git a/util/item/AEItemStack.java b/util/item/AEItemStack.java index 3f7dce11..5defa307 100644 --- a/util/item/AEItemStack.java +++ b/util/item/AEItemStack.java @@ -57,8 +57,7 @@ public final class AEItemStack extends AEStack implements IAEItemS if ( is == null ) throw new RuntimeException( "Invalid Itemstack." ); - def = new AEItemDef(); - def.item = is.getItem(); + def = new AEItemDef( is.getItem() ); if ( def.item == null ) throw new RuntimeException( "This ItemStack is bad, it has a null item." );