mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-20 03:59:37 +00:00
Merge pull request #1876 from sk89q/oredictcache-fix
Fix some performance issues with OreDictCache
This commit is contained in:
commit
26dadfe176
2 files changed
+6
-5
No files matched your search
@@ -22,7 +22,7 @@ public class ItemInfo
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
return obj instanceof BlockInfo &&
|
||||
return obj instanceof ItemInfo &&
|
||||
((ItemInfo)obj).item == item &&
|
||||
((ItemInfo)obj).meta == meta;
|
||||
}
|
||||
@@ -31,8 +31,8 @@ public class ItemInfo
|
||||
public int hashCode()
|
||||
{
|
||||
int code = 1;
|
||||
code = 31 * code + item.getUnlocalizedName().hashCode();
|
||||
code = 31 * code + meta;
|
||||
code = 31 * code + System.identityHashCode(item);
|
||||
code = 7 * code + meta;
|
||||
return code;
|
||||
}
|
||||
}
|
||||
@@ -24,10 +24,11 @@ public final class OreDictCache
|
||||
}
|
||||
|
||||
ItemInfo info = ItemInfo.get(check);
|
||||
List<String> cached = cachedKeys.get(info);
|
||||
|
||||
if(cachedKeys.get(info) != null)
|
||||
if(cached != null)
|
||||
{
|
||||
return cachedKeys.get(info);
|
||||
return cached;
|
||||
}
|
||||
|
||||
int[] idsFound = OreDictionary.getOreIDs(check);
|
||||
|
||||
Reference in new issue
Block a user