From 0e356af890b8dd415145fdfd5489a6f75e5f9a9b Mon Sep 17 00:00:00 2001 From: acrylic-style Date: Tue, 5 Nov 2024 17:43:28 +0900 Subject: [PATCH] fix merge error --- .../com/github/mori01231/lifecore/util/ItemUtil.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/github/mori01231/lifecore/util/ItemUtil.java b/src/main/java/com/github/mori01231/lifecore/util/ItemUtil.java index cbfdabd..68e44cf 100644 --- a/src/main/java/com/github/mori01231/lifecore/util/ItemUtil.java +++ b/src/main/java/com/github/mori01231/lifecore/util/ItemUtil.java @@ -50,9 +50,8 @@ public static boolean isProbablyAdminSword(@Nullable ItemStack stack) { } @Contract("null, _ -> null") - public static @Nullable NBTBase getTag(@Nullable ItemStack stack, @NotNull String key) { - if (stack == null || stack.getType().isAir()) return null; - NBTTagCompound tag = CraftItemStack.asNMSCopy(stack).getTag(); + public static @Nullable Tag getTag(@Nullable ItemStack stack, @NotNull String key) { + CompoundTag tag = getCustomData(stack); if (tag == null) return null; return tag.get(key); } @@ -65,8 +64,7 @@ public static boolean isProbablyAdminSword(@Nullable ItemStack stack) { } public static int getIntTag(@Nullable ItemStack stack, @NotNull String key) { - if (stack == null || stack.getType().isAir()) return 0; - NBTTagCompound tag = CraftItemStack.asNMSCopy(stack).getTag(); + CompoundTag tag = getCustomData(stack); if (tag == null) return 0; return tag.getInt(key); } @@ -193,7 +191,7 @@ public static ItemStack restoreTag(@Nullable ItemStack stack) { ItemStack newStack = setTag(stack, null, backup); for (String bypassTag : RESTORE_BYPASS_SET) { if (containsTag(stack, bypassTag)) { - NBTBase value = getTag(stack, bypassTag); + Tag value = getTag(stack, bypassTag); assert value != null; newStack = setTag(newStack, bypassTag, value); }