fix(PlayerReadWriteNBT): use NbtList for the upper list
Signed-off-by: Forgejo <forgejo@mctaylors.ddns.net>
This commit is contained in:
parent
f2b55452d5
commit
c81403ed53
1 changed files with 2 additions and 2 deletions
|
@ -53,7 +53,7 @@ public abstract class PlayerEntityMixin {
|
||||||
@Inject(method = "writeCustomDataToNbt", at = @At("TAIL"))
|
@Inject(method = "writeCustomDataToNbt", at = @At("TAIL"))
|
||||||
public void writeMyDataToNbt(NbtCompound playerNbt, CallbackInfo ci) {
|
public void writeMyDataToNbt(NbtCompound playerNbt, CallbackInfo ci) {
|
||||||
// create a new NBT record for our list
|
// 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
|
// 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 -> {
|
myList.forEach(myObject -> {
|
||||||
|
@ -71,7 +71,7 @@ public abstract class PlayerEntityMixin {
|
||||||
myObjectNbt.put("MyNotSupportedObject", myNotSupportedObjectNbt);
|
myObjectNbt.put("MyNotSupportedObject", myNotSupportedObjectNbt);
|
||||||
|
|
||||||
// put our newly created record into the list record
|
// 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
|
// finally, put our list record into the player's NBT
|
||||||
|
|
Loading…
Reference in a new issue