Advertisement
jayhillx

read/write info

Jan 25th, 2023
978
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.71 KB | None | 0 0
  1. /**
  2.      * Adds each player in map to the list written in the world cap.
  3.      */
  4.     public CompoundNBT writePlayer() {
  5.         CompoundNBT players = new CompoundNBT();
  6.  
  7.         for (WorldLifeData data : this.playersMap.values()) {
  8.             CompoundNBT compoundnbt = new CompoundNBT();
  9.             data.write(compoundnbt);
  10.             players.put(this.playerId.toString(), compoundnbt);
  11.         }
  12.         return players;
  13.     }
  14.  
  15.     public void readPlayer(CompoundNBT nbt) {
  16.         CompoundNBT players = nbt.getCompound("Players");
  17.  
  18.         this.playersMap.forEach((uuid, info) -> {
  19.             CompoundNBT test = info.write(nbt);
  20.  
  21.             players.put(uuid.toString(), test);
  22.         });
  23.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement