ignore repair-cost attribute when check ItemStack equals()

This commit is contained in:
v_manijashvili 2023-11-26 09:43:41 +04:00
parent 2388da62a5
commit c7ee705012
1 changed files with 5 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;
@ -136,8 +137,10 @@ 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());
oneSerMeta.remove("repair-cost");
twoSerMeta.remove("repair-cost");
if (oneSerMeta.equals(twoSerMeta)) {
return true;
}