This commit is contained in:
valeri manijashvili 2024-05-04 08:35:52 +01:00 committed by GitHub
commit 2c5479e3cd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 2 deletions

View File

@ -32,6 +32,7 @@ import java.util.Map;
import java.util.logging.Level;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.HashMap;
import static com.Acrobot.Breeze.Utils.StringUtil.getMinecraftCharWidth;
import static com.Acrobot.Breeze.Utils.StringUtil.getMinecraftStringWidth;
@ -124,8 +125,16 @@ public class MaterialUtil {
if (oneMeta == twoMeta || oneMeta == null || twoMeta == null) {
return oneMeta == twoMeta;
}
Map<String, Object> oneSerMeta = oneMeta.serialize();
Map<String, Object> twoSerMeta = twoMeta.serialize();
Map<String, Object> oneSerMeta = new HashMap<>(oneMeta.serialize());
Map<String, Object> twoSerMeta = new HashMap<>(twoMeta.serialize());
if (!Properties.EXCLUDED_ITEM_ATTRIBUTES.isEmpty()) {
for (String ignoreKey : Properties.EXCLUDED_ITEM_ATTRIBUTES) {
oneSerMeta.remove(ignoreKey);
twoSerMeta.remove(ignoreKey);
}
}
if (oneSerMeta.equals(twoSerMeta)) {
return true;
}

View File

@ -340,4 +340,10 @@ public class Properties {
@PrecededBySpace
@ConfigurationComment("Add stock counter to quantity line?")
public static boolean USE_STOCK_COUNTER = false;
@PrecededBySpace
@ConfigurationComment("Exclude these enchantments from the similarity check when comparing items")
@Parser("StringSet")
public static Set<String> EXCLUDED_ITEM_ATTRIBUTES = new LinkedHashSet<>();
}