From d5beca8e524f50cc3a85c87a5b4f6e2dbc384a2e Mon Sep 17 00:00:00 2001 From: Jason Mitchell Date: Sat, 17 Feb 2024 16:07:32 -0800 Subject: [PATCH] Reduce number of item copies. Backport from 1.12 https://github.com/VazkiiMods/Botania/commit/8595d27f4181f11006586442e42e03988a329c58 (#44) --- .../botania/api/recipe/RecipePureDaisy.java | 23 +++---------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/src/main/java/vazkii/botania/api/recipe/RecipePureDaisy.java b/src/main/java/vazkii/botania/api/recipe/RecipePureDaisy.java index 19248e69bd..dc942ab4ae 100644 --- a/src/main/java/vazkii/botania/api/recipe/RecipePureDaisy.java +++ b/src/main/java/vazkii/botania/api/recipe/RecipePureDaisy.java @@ -10,10 +10,6 @@ */ package vazkii.botania.api.recipe; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.world.World; @@ -22,8 +18,6 @@ public class RecipePureDaisy { - private static final Map> oreMap = new HashMap(); - Object input; Block output; int outputMeta; @@ -53,21 +47,10 @@ public boolean isOreDict(ItemStack stack, String entry) { if(stack == null || stack.getItem() == null) return false; - List 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;