Eliminate lots of itemstack copying in pure daisy recipe matching. Should give enough of a lag improvement until 1.13 gets here :P

This commit is contained in:
Vincent Lee committed 2018-09-02 22:21:21 -05:00
1 parent 0b526c1b31
commit 8595d27f41
1 file changed
+3 -15
@@ -26,7 +26,6 @@ import java.util.Map;
public class RecipePureDaisy {
public static final int DEFAULT_TIME = 150;
private static final Map<String, List<ItemStack>> oreMap = new HashMap<>();
private final Object input;
private final IBlockState outputState;
@@ -64,21 +63,10 @@ public class RecipePureDaisy {
if(stack.isEmpty())
return false;
List<ItemStack> ores;
if(oreMap.containsKey(entry))
ores = oreMap.get(entry);
else {
ores = OreDictionary.getOres(entry);
oreMap.put(entry, ores);
}
for(ItemStack ostack : ores) {
ItemStack cstack = ostack.copy();
if(cstack.getItemDamage() == Short.MAX_VALUE)
cstack.setItemDamage(stack.getItemDamage());
if(stack.isItemEqual(cstack))
for(ItemStack ostack : OreDictionary.getOres(entry, false)) {
if(OreDictionary.itemMatches(ostack, stack, false)) {
return true;
}
}
return false;