Open fafa-junhe opened 2 years ago
getTag() only exists on 1.17 version.
getTag()
public static Optional<Integer> getInt(ItemStack item, String key) { Optional<net.minecraft.world.item.ItemStack> item1; try { item1 = getItem(item); } catch (NoSuchFieldException | IllegalAccessException e) { return Optional.empty(); } if (item1.isEmpty()) return Optional.empty(); NBTTagCompound tag = item1.get().getTag(); // exception if (tag == null) return Optional.empty(); return !tag.contains(key) ? Optional.empty() : Optional.of(tag.getInt(key)); }
from https://github.com/NyaaCat/NyaaCore/blob/1.18/src/main/java/cat/nyaa/nyaacore/utils/ItemTagUtils.java
I don't have this problem here
getTag()
only exists on 1.17 version.from https://github.com/NyaaCat/NyaaCore/blob/1.18/src/main/java/cat/nyaa/nyaacore/utils/ItemTagUtils.java