Skip to content

Commit 95f7c5d

Browse files
authored
Fixed NMSException: Unable to retrieve NBT data (#82)
* Convert NBTTagCompound from ItemStack now work well with 1.17 * Update src/main/java/fr/zcraft/quartzlib/components/nbt/NBT.java
1 parent 13963da commit 95f7c5d

File tree

1 file changed

+5
-1
lines changed
  • src/main/java/fr/zcraft/quartzlib/components/nbt

1 file changed

+5
-1
lines changed

src/main/java/fr/zcraft/quartzlib/components/nbt/NBT.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,11 @@ private static Object getMcNBTCompound(ItemStack item) throws NMSException {
305305
tagCompound = Reflection.call(mcItemStack.getClass(), mcItemStack, "t");
306306
} catch (Exception e) {
307307
//1.17
308-
tagCompound = Reflection.call(mcItemStack.getClass(), mcItemStack, "a");
308+
try {
309+
tagCompound = Reflection.call(mcItemStack.getClass(), mcItemStack, "getTag");
310+
} catch (Exception e2) {
311+
tagCompound = Reflection.call(mcItemStack.getClass(), mcItemStack, "a");
312+
}
309313
}
310314

311315
if (tagCompound == null) {

0 commit comments

Comments
 (0)