package com.github.steveice10.mc.protocol.packet.ingame.server;

import com.github.steveice10.mc.protocol.data.MagicValues;
import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode;
import com.github.steveice10.mc.protocol.data.game.setting.Difficulty;
import com.github.steveice10.mc.protocol.data.game.world.WorldType;
import com.github.steveice10.mc.protocol.packet.MinecraftPacket;
import com.github.steveice10.packetlib.io.NetInput;
import com.github.steveice10.packetlib.io.NetOutput;

import java.io.IOException;

public class ServerRespawnPacket extends MinecraftPacket {
    private int dimension;
    private Difficulty difficulty;
    private GameMode gamemode;
    private WorldType worldType;

    @SuppressWarnings("unused")
    private ServerRespawnPacket() {
    }

    public ServerRespawnPacket(int dimension, Difficulty difficulty, GameMode gamemode, WorldType worldType) {
        this.dimension = dimension;
        this.difficulty = difficulty;
        this.gamemode = gamemode;
        this.worldType = worldType;
    }

    public int getDimension() {
        return this.dimension;
    }

    public Difficulty getDifficulty() {
        return this.difficulty;
    }

    public GameMode getGameMode() {
        return this.gamemode;
    }

    public WorldType getWorldType() {
        return this.worldType;
    }

    @Override
    public void read(NetInput in) throws IOException {
        this.dimension = in.readInt();
        this.difficulty = MagicValues.key(Difficulty.class, in.readUnsignedByte());
        this.gamemode = MagicValues.key(GameMode.class, in.readUnsignedByte());
        this.worldType = MagicValues.key(WorldType.class, in.readString().toLowerCase());
    }

    @Override
    public void write(NetOutput out) throws IOException {
        out.writeInt(this.dimension);
        out.writeByte(MagicValues.value(Integer.class, this.difficulty));
        out.writeByte(MagicValues.value(Integer.class, this.gamemode));
        out.writeString(MagicValues.value(String.class, this.worldType));
    }
}

@@ -58,16 +58,45 @@
 erver;%0A%0A
+import java.io.IOException;%0A%0A
 import c
@@ -225,79 +225,8 @@
 de;%0A
-import com.github.steveice10.mc.protocol.data.game.setting.Difficulty;%0A
 impo
@@ -464,37 +464,8 @@
 t;%0A%0A
-import java.io.IOException;%0A%0A
 publ
@@ -519,16 +519,17 @@
 acket %7B%0A
+%0A
     priv
@@ -551,43 +551,8 @@
 on;%0A
-    private Difficulty difficulty;%0A
     
@@ -736,31 +736,8 @@
 ion,
- Difficulty difficulty,
  Gam
@@ -815,46 +815,8 @@
 on;%0A
-        this.difficulty = difficulty;%0A
     
@@ -962,87 +962,8 @@
  %7D%0A%0A
-    public Difficulty getDifficulty() %7B%0A        return this.difficulty;%0A    %7D%0A%0A
     
@@ -1219,92 +1219,8 @@
 ();%0A
-        this.difficulty = MagicValues.key(Difficulty.class, in.readUnsignedByte());%0A
     
@@ -1506,82 +1506,8 @@
 n);%0A
-        out.writeByte(MagicValues.value(Integer.class, this.difficulty));%0A
     

Update RespawnPacket