Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public void readFromNBT(NBTTagCompound nbt) {
- super.readFromNBT(nbt);
- this.playerList = new String[]{MainReferences.UNIDENTIFIED_PLAYER, MainReferences.UNIDENTIFIED_PLAYER, MainReferences.UNIDENTIFIED_PLAYER, MainReferences.UNIDENTIFIED_PLAYER, MainReferences.UNIDENTIFIED_PLAYER};
- this.setTimer(nbt.getByte("Timer"));
- this.setRotation(nbt.getByte("Rotation"));
- this.setActive(nbt.getBoolean("Active"));
- this.setSingleplayerMode(nbt.getBoolean("SingleplayerMode"));
- this.setOwner(nbt.getString("Owner"));
- if(nbt.hasKey("Players")){
- NBTTagList list = nbt.getTagList("Players");
- for(int i = 0; i < list.tagCount(); i++){
- NBTTagCompound player = (NBTTagCompound)list.tagAt(i);
- this.setPlayerList(player.getString("Name"), nbt.getByte("Slot"));
- }
- }
- }
- @Override
- public void writeToNBT(NBTTagCompound nbt) {
- super.writeToNBT(nbt);
- nbt.setByte("Timer", this.getTimer());
- nbt.setByte("Rotation", this.getRotation());
- nbt.setBoolean("Active", this.isActive());
- nbt.setBoolean("SingleplayerMode", this.isSingleplayerMode());
- nbt.setString("Owner", this.getOwner());
- NBTTagList list = new NBTTagList();
- for(int i = 0; i < this.getPlayerList().length; i++){
- if(!this.getPlayerList()[i].equals(MainReferences.UNIDENTIFIED_PLAYER)){
- NBTTagCompound player = new NBTTagCompound();
- player.setString("Name", this.getPlayerList()[i]);
- player.setByte("Slot", (byte)i);
- list.appendTag(player);
- }
- }
- if(list.tagCount() > 0){
- nbt.setTag("Players", list);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement