Skip to content

Commit

Permalink
Fixed NMSException: Unable to retrieve NBT data (#82)
Browse files Browse the repository at this point in the history
* Convert NBTTagCompound from ItemStack now work well with 1.17

* Update src/main/java/fr/zcraft/quartzlib/components/nbt/NBT.java
  • Loading branch information
jhooc77 committed Jan 12, 2022
1 parent 13963da commit 95f7c5d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/java/fr/zcraft/quartzlib/components/nbt/NBT.java
Expand Up @@ -305,7 +305,11 @@ private static Object getMcNBTCompound(ItemStack item) throws NMSException {
tagCompound = Reflection.call(mcItemStack.getClass(), mcItemStack, "t");
} catch (Exception e) {
//1.17
tagCompound = Reflection.call(mcItemStack.getClass(), mcItemStack, "a");
try {
tagCompound = Reflection.call(mcItemStack.getClass(), mcItemStack, "getTag");
} catch (Exception e2) {
tagCompound = Reflection.call(mcItemStack.getClass(), mcItemStack, "a");
}
}

if (tagCompound == null) {
Expand Down

0 comments on commit 95f7c5d

Please sign in to comment.