From c81403ed53d3ae8cbde7606f5280a2b9968f6c41 Mon Sep 17 00:00:00 2001 From: Octol1ttle Date: Wed, 29 Nov 2023 17:36:40 +0500 Subject: [PATCH] fix(PlayerReadWriteNBT): use NbtList for the upper list Signed-off-by: Forgejo --- player-read-write-nbt.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/player-read-write-nbt.java b/player-read-write-nbt.java index 935873b..0510c7c 100644 --- a/player-read-write-nbt.java +++ b/player-read-write-nbt.java @@ -53,7 +53,7 @@ public abstract class PlayerEntityMixin { @Inject(method = "writeCustomDataToNbt", at = @At("TAIL")) public void writeMyDataToNbt(NbtCompound playerNbt, CallbackInfo ci) { // create a new NBT record for our list - NbtCompound myListNbt = new NbtCompound(); + NbtList myListNbt = new NbtList(); // you can use a regular for-loop if you want, there's no difference. FabricMC wiki uses Iterable#forEach so that's why it's used here myList.forEach(myObject -> { @@ -71,7 +71,7 @@ public abstract class PlayerEntityMixin { myObjectNbt.put("MyNotSupportedObject", myNotSupportedObjectNbt); // put our newly created record into the list record - myListNbt.put("MyObject", myObjectNbt); + myListNbt.add(myObjectNbt); }); // finally, put our list record into the player's NBT