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