Update RespawnPacket

This commit is contained in:
Paul Heidenreich 2019-04-28 12:01:46 +02:00
parent 36fcac3055
commit 2f88909d48

View file

@ -1,18 +1,17 @@
package com.github.steveice10.mc.protocol.packet.ingame.server;
import java.io.IOException;
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;
@ -20,9 +19,8 @@ public class ServerRespawnPacket extends MinecraftPacket {
private ServerRespawnPacket() {
}
public ServerRespawnPacket(int dimension, Difficulty difficulty, GameMode gamemode, WorldType worldType) {
public ServerRespawnPacket(int dimension, GameMode gamemode, WorldType worldType) {
this.dimension = dimension;
this.difficulty = difficulty;
this.gamemode = gamemode;
this.worldType = worldType;
}
@ -31,10 +29,6 @@ public class ServerRespawnPacket extends MinecraftPacket {
return this.dimension;
}
public Difficulty getDifficulty() {
return this.difficulty;
}
public GameMode getGameMode() {
return this.gamemode;
}
@ -46,7 +40,6 @@ public class ServerRespawnPacket extends MinecraftPacket {
@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());
}
@ -54,7 +47,6 @@ public class ServerRespawnPacket extends MinecraftPacket {
@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));
}