mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-17 19:05:31 +00:00
Cleanup
This commit is contained in:
1 parent
ce3d891eaa
commit
9989451c1c
64 files changed
+234
-439
No files matched your search
@@ -99,12 +99,7 @@ public class BackpackDefinition implements IBackpackDefinition {
|
||||
// isValidItem can get called multiple times per tick if the player's inventory is full
|
||||
// and they are standing on multiple items.
|
||||
// It is a slow call, so we need a cache to make it fast
|
||||
private Map<ItemStack, Boolean> isValidItemCache = new LinkedHashMap<ItemStack, Boolean>() {
|
||||
@Override
|
||||
protected boolean removeEldestEntry(Map.Entry<ItemStack, Boolean> eldest) {
|
||||
return size() > 64;
|
||||
}
|
||||
};
|
||||
private final Map<ItemStack, Boolean> isValidItemCache = new ValidItemCache();
|
||||
|
||||
@Override
|
||||
public boolean isValidItem(EntityPlayer player, ItemStack itemstack) {
|
||||
@@ -128,4 +123,11 @@ public class BackpackDefinition implements IBackpackDefinition {
|
||||
isValidItemCache.put(itemstack, false);
|
||||
return false;
|
||||
}
|
||||
|
||||
private static class ValidItemCache extends LinkedHashMap<ItemStack, Boolean> {
|
||||
@Override
|
||||
protected boolean removeEldestEntry(Map.Entry<ItemStack, Boolean> eldest) {
|
||||
return size() > 64;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user