Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-11-17 05:20:14 +01:00
1.14-pre5
Dieser Commit ist enthalten in:
Ursprung
7a5d8d424a
Commit
ac192c281c
@ -26,7 +26,8 @@ public enum ProtocolVersion {
|
|||||||
MINECRAFT_1_12_2(340, "1.12.2"),
|
MINECRAFT_1_12_2(340, "1.12.2"),
|
||||||
MINECRAFT_1_13(393, "1.13"),
|
MINECRAFT_1_13(393, "1.13"),
|
||||||
MINECRAFT_1_13_1(401, "1.13.1"),
|
MINECRAFT_1_13_1(401, "1.13.1"),
|
||||||
MINECRAFT_1_13_2(404, "1.13.2");
|
MINECRAFT_1_13_2(404, "1.13.2"),
|
||||||
|
MINECRAFT_1_14(476, "1.14");
|
||||||
|
|
||||||
private final int protocol;
|
private final int protocol;
|
||||||
private final String name;
|
private final String name;
|
||||||
@ -38,7 +39,7 @@ public enum ProtocolVersion {
|
|||||||
/**
|
/**
|
||||||
* Represents the highest supported version.
|
* Represents the highest supported version.
|
||||||
*/
|
*/
|
||||||
public static final ProtocolVersion MAXIMUM_VERSION = MINECRAFT_1_13_2;
|
public static final ProtocolVersion MAXIMUM_VERSION = MINECRAFT_1_14;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The user-friendly representation of the lowest and highest supported versions.
|
* The user-friendly representation of the lowest and highest supported versions.
|
||||||
|
@ -9,6 +9,7 @@ import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_12_2;
|
|||||||
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_13;
|
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_13;
|
||||||
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_13_1;
|
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_13_1;
|
||||||
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_13_2;
|
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_13_2;
|
||||||
|
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_14;
|
||||||
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_8;
|
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_8;
|
||||||
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_9;
|
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_9;
|
||||||
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_9_1;
|
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_9_1;
|
||||||
@ -91,104 +92,123 @@ public enum StateRegistry {
|
|||||||
map(0x01, MINECRAFT_1_9, false),
|
map(0x01, MINECRAFT_1_9, false),
|
||||||
map(0x02, MINECRAFT_1_12, false),
|
map(0x02, MINECRAFT_1_12, false),
|
||||||
map(0x01, MINECRAFT_1_12_1, false),
|
map(0x01, MINECRAFT_1_12_1, false),
|
||||||
map(0x05, MINECRAFT_1_13, false));
|
map(0x05, MINECRAFT_1_13, false),
|
||||||
|
map(0x06, MINECRAFT_1_14, false));
|
||||||
serverbound.register(Chat.class, Chat::new,
|
serverbound.register(Chat.class, Chat::new,
|
||||||
map(0x01, MINECRAFT_1_8, false),
|
map(0x01, MINECRAFT_1_8, false),
|
||||||
map(0x02, MINECRAFT_1_9, false),
|
map(0x02, MINECRAFT_1_9, false),
|
||||||
map(0x03, MINECRAFT_1_12, false),
|
map(0x03, MINECRAFT_1_12, false),
|
||||||
map(0x02, MINECRAFT_1_12_1, false),
|
map(0x02, MINECRAFT_1_12_1, false),
|
||||||
map(0x02, MINECRAFT_1_13, false));
|
map(0x02, MINECRAFT_1_13, false),
|
||||||
|
map(0x03, MINECRAFT_1_14, false));
|
||||||
serverbound.register(ClientSettings.class, ClientSettings::new,
|
serverbound.register(ClientSettings.class, ClientSettings::new,
|
||||||
map(0x15, MINECRAFT_1_8, false),
|
map(0x15, MINECRAFT_1_8, false),
|
||||||
map(0x04, MINECRAFT_1_9, false),
|
map(0x04, MINECRAFT_1_9, false),
|
||||||
map(0x05, MINECRAFT_1_12, false),
|
map(0x05, MINECRAFT_1_12, false),
|
||||||
map(0x04, MINECRAFT_1_12_1, false),
|
map(0x04, MINECRAFT_1_12_1, false),
|
||||||
map(0x04, MINECRAFT_1_13, false));
|
map(0x04, MINECRAFT_1_13, false),
|
||||||
|
map(0x05, MINECRAFT_1_14, false));
|
||||||
serverbound.register(PluginMessage.class, PluginMessage::new,
|
serverbound.register(PluginMessage.class, PluginMessage::new,
|
||||||
map(0x17, MINECRAFT_1_8, false),
|
map(0x17, MINECRAFT_1_8, false),
|
||||||
map(0x09, MINECRAFT_1_9, false),
|
map(0x09, MINECRAFT_1_9, false),
|
||||||
map(0x0A, MINECRAFT_1_12, false),
|
map(0x0A, MINECRAFT_1_12, false),
|
||||||
map(0x09, MINECRAFT_1_12_1, false),
|
map(0x09, MINECRAFT_1_12_1, false),
|
||||||
map(0x0A, MINECRAFT_1_13, false));
|
map(0x0A, MINECRAFT_1_13, false),
|
||||||
|
map(0x0B, MINECRAFT_1_14, false));
|
||||||
serverbound.register(KeepAlive.class, KeepAlive::new,
|
serverbound.register(KeepAlive.class, KeepAlive::new,
|
||||||
map(0x00, MINECRAFT_1_8, false),
|
map(0x00, MINECRAFT_1_8, false),
|
||||||
map(0x0B, MINECRAFT_1_9, false),
|
map(0x0B, MINECRAFT_1_9, false),
|
||||||
map(0x0C, MINECRAFT_1_12, false),
|
map(0x0C, MINECRAFT_1_12, false),
|
||||||
map(0x0B, MINECRAFT_1_12_1, false),
|
map(0x0B, MINECRAFT_1_12_1, false),
|
||||||
map(0x0E, MINECRAFT_1_13, false));
|
map(0x0E, MINECRAFT_1_13, false),
|
||||||
|
map(0x0F, MINECRAFT_1_14, false));
|
||||||
serverbound.register(ResourcePackResponse.class, ResourcePackResponse::new,
|
serverbound.register(ResourcePackResponse.class, ResourcePackResponse::new,
|
||||||
map(0x19, MINECRAFT_1_8, false),
|
map(0x19, MINECRAFT_1_8, false),
|
||||||
map(0x16, MINECRAFT_1_9, false),
|
map(0x16, MINECRAFT_1_9, false),
|
||||||
map(0x18, MINECRAFT_1_12, false),
|
map(0x18, MINECRAFT_1_12, false),
|
||||||
map(0x1D, MINECRAFT_1_13, false));
|
map(0x1D, MINECRAFT_1_13, false),
|
||||||
|
map(0x1F, MINECRAFT_1_14, false));
|
||||||
|
|
||||||
clientbound.register(BossBar.class, BossBar::new,
|
clientbound.register(BossBar.class, BossBar::new,
|
||||||
map(0x0C, MINECRAFT_1_9, false),
|
map(0x0C, MINECRAFT_1_9, false),
|
||||||
map(0x0C, MINECRAFT_1_12, false),
|
map(0x0C, MINECRAFT_1_12, false),
|
||||||
map(0x0C, MINECRAFT_1_13, false));
|
map(0x0C, MINECRAFT_1_13, false),
|
||||||
|
map(0x0C, MINECRAFT_1_14, false));
|
||||||
clientbound.register(Chat.class, Chat::new,
|
clientbound.register(Chat.class, Chat::new,
|
||||||
map(0x02, MINECRAFT_1_8, true),
|
map(0x02, MINECRAFT_1_8, true),
|
||||||
map(0x0F, MINECRAFT_1_9, true),
|
map(0x0F, MINECRAFT_1_9, true),
|
||||||
map(0x0F, MINECRAFT_1_12, true),
|
map(0x0F, MINECRAFT_1_12, true),
|
||||||
map(0x0E, MINECRAFT_1_13, true));
|
map(0x0E, MINECRAFT_1_13, true),
|
||||||
|
map(0x0E, MINECRAFT_1_14, false));
|
||||||
clientbound.register(TabCompleteResponse.class, TabCompleteResponse::new,
|
clientbound.register(TabCompleteResponse.class, TabCompleteResponse::new,
|
||||||
map(0x3A, MINECRAFT_1_8, false),
|
map(0x3A, MINECRAFT_1_8, false),
|
||||||
map(0x0E, MINECRAFT_1_9, false),
|
map(0x0E, MINECRAFT_1_9, false),
|
||||||
map(0x0E, MINECRAFT_1_12, false),
|
map(0x0E, MINECRAFT_1_12, false),
|
||||||
map(0x10, MINECRAFT_1_13, false));
|
map(0x10, MINECRAFT_1_13, false),
|
||||||
|
map(0x10, MINECRAFT_1_14, false));
|
||||||
clientbound.register(AvailableCommands.class, AvailableCommands::new,
|
clientbound.register(AvailableCommands.class, AvailableCommands::new,
|
||||||
map(0x11, MINECRAFT_1_13, false));
|
map(0x11, MINECRAFT_1_13, false),
|
||||||
|
map(0x11, MINECRAFT_1_14, false));
|
||||||
clientbound.register(PluginMessage.class, PluginMessage::new,
|
clientbound.register(PluginMessage.class, PluginMessage::new,
|
||||||
map(0x3F, MINECRAFT_1_8, false),
|
map(0x3F, MINECRAFT_1_8, false),
|
||||||
map(0x18, MINECRAFT_1_9, false),
|
map(0x18, MINECRAFT_1_9, false),
|
||||||
map(0x18, MINECRAFT_1_12, false),
|
map(0x18, MINECRAFT_1_12, false),
|
||||||
map(0x19, MINECRAFT_1_13, false));
|
map(0x19, MINECRAFT_1_13, false),
|
||||||
|
map(0x18, MINECRAFT_1_14, false));
|
||||||
clientbound.register(Disconnect.class, Disconnect::new,
|
clientbound.register(Disconnect.class, Disconnect::new,
|
||||||
map(0x40, MINECRAFT_1_8, false),
|
map(0x40, MINECRAFT_1_8, false),
|
||||||
map(0x1A, MINECRAFT_1_9, false),
|
map(0x1A, MINECRAFT_1_9, false),
|
||||||
map(0x1A, MINECRAFT_1_12, false),
|
map(0x1A, MINECRAFT_1_12, false),
|
||||||
map(0x1B, MINECRAFT_1_13, false));
|
map(0x1B, MINECRAFT_1_13, false),
|
||||||
|
map(0x1A, MINECRAFT_1_14, false));
|
||||||
clientbound.register(KeepAlive.class, KeepAlive::new,
|
clientbound.register(KeepAlive.class, KeepAlive::new,
|
||||||
map(0x00, MINECRAFT_1_8, false),
|
map(0x00, MINECRAFT_1_8, false),
|
||||||
map(0x1F, MINECRAFT_1_9, false),
|
map(0x1F, MINECRAFT_1_9, false),
|
||||||
map(0x1F, MINECRAFT_1_12, false),
|
map(0x1F, MINECRAFT_1_12, false),
|
||||||
map(0x21, MINECRAFT_1_13, false));
|
map(0x21, MINECRAFT_1_13, false),
|
||||||
|
map(0x20, MINECRAFT_1_14, false));
|
||||||
clientbound.register(JoinGame.class, JoinGame::new,
|
clientbound.register(JoinGame.class, JoinGame::new,
|
||||||
map(0x01, MINECRAFT_1_8, false),
|
map(0x01, MINECRAFT_1_8, false),
|
||||||
map(0x23, MINECRAFT_1_9, false),
|
map(0x23, MINECRAFT_1_9, false),
|
||||||
map(0x23, MINECRAFT_1_12, false),
|
map(0x23, MINECRAFT_1_12, false),
|
||||||
map(0x25, MINECRAFT_1_13, false));
|
map(0x25, MINECRAFT_1_13, false),
|
||||||
|
map(0x25, MINECRAFT_1_14, false));
|
||||||
clientbound.register(Respawn.class, Respawn::new,
|
clientbound.register(Respawn.class, Respawn::new,
|
||||||
map(0x07, MINECRAFT_1_8, true),
|
map(0x07, MINECRAFT_1_8, true),
|
||||||
map(0x33, MINECRAFT_1_9, true),
|
map(0x33, MINECRAFT_1_9, true),
|
||||||
map(0x34, MINECRAFT_1_12, true),
|
map(0x34, MINECRAFT_1_12, true),
|
||||||
map(0x35, MINECRAFT_1_12_1, true),
|
map(0x35, MINECRAFT_1_12_1, true),
|
||||||
map(0x38, MINECRAFT_1_13, true));
|
map(0x38, MINECRAFT_1_13, true),
|
||||||
|
map(0x3A, MINECRAFT_1_14, true));
|
||||||
clientbound.register(ResourcePackRequest.class, ResourcePackRequest::new,
|
clientbound.register(ResourcePackRequest.class, ResourcePackRequest::new,
|
||||||
map(0x48, MINECRAFT_1_8, true),
|
map(0x48, MINECRAFT_1_8, true),
|
||||||
map(0x32, MINECRAFT_1_9, true),
|
map(0x32, MINECRAFT_1_9, true),
|
||||||
map(0x33, MINECRAFT_1_12, true),
|
map(0x33, MINECRAFT_1_12, true),
|
||||||
map(0x34, MINECRAFT_1_12_1, true),
|
map(0x34, MINECRAFT_1_12_1, true),
|
||||||
map(0x37, MINECRAFT_1_13, true));
|
map(0x37, MINECRAFT_1_13, true),
|
||||||
|
map(0x39, MINECRAFT_1_14, true));
|
||||||
clientbound.register(HeaderAndFooter.class, HeaderAndFooter::new,
|
clientbound.register(HeaderAndFooter.class, HeaderAndFooter::new,
|
||||||
map(0x47, MINECRAFT_1_8, true),
|
map(0x47, MINECRAFT_1_8, true),
|
||||||
map(0x48, MINECRAFT_1_9, true),
|
map(0x48, MINECRAFT_1_9, true),
|
||||||
map(0x47, MINECRAFT_1_9_4, true),
|
map(0x47, MINECRAFT_1_9_4, true),
|
||||||
map(0x49, MINECRAFT_1_12, true),
|
map(0x49, MINECRAFT_1_12, true),
|
||||||
map(0x4A, MINECRAFT_1_12_1, true),
|
map(0x4A, MINECRAFT_1_12_1, true),
|
||||||
map(0x4E, MINECRAFT_1_13, true));
|
map(0x4E, MINECRAFT_1_13, true),
|
||||||
|
map(0x53, MINECRAFT_1_14, true));
|
||||||
clientbound.register(TitlePacket.class, TitlePacket::new,
|
clientbound.register(TitlePacket.class, TitlePacket::new,
|
||||||
map(0x45, MINECRAFT_1_8, true),
|
map(0x45, MINECRAFT_1_8, true),
|
||||||
map(0x45, MINECRAFT_1_9, true),
|
map(0x45, MINECRAFT_1_9, true),
|
||||||
map(0x47, MINECRAFT_1_12, true),
|
map(0x47, MINECRAFT_1_12, true),
|
||||||
map(0x48, MINECRAFT_1_12_1, true),
|
map(0x48, MINECRAFT_1_12_1, true),
|
||||||
map(0x4B, MINECRAFT_1_13, true));
|
map(0x4B, MINECRAFT_1_13, true),
|
||||||
|
map(0x4F, MINECRAFT_1_14, true));
|
||||||
clientbound.register(PlayerListItem.class, PlayerListItem::new,
|
clientbound.register(PlayerListItem.class, PlayerListItem::new,
|
||||||
map(0x38, MINECRAFT_1_8, false),
|
map(0x38, MINECRAFT_1_8, false),
|
||||||
map(0x2D, MINECRAFT_1_9, false),
|
map(0x2D, MINECRAFT_1_9, false),
|
||||||
map(0x2D, MINECRAFT_1_12, false),
|
map(0x2D, MINECRAFT_1_12, false),
|
||||||
map(0x2E, MINECRAFT_1_12_1, false),
|
map(0x2E, MINECRAFT_1_12_1, false),
|
||||||
map(0x30, MINECRAFT_1_13, false));
|
map(0x30, MINECRAFT_1_13, false),
|
||||||
|
map(0x33, MINECRAFT_1_14, false));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
LOGIN {
|
LOGIN {
|
||||||
@ -198,7 +218,8 @@ public enum StateRegistry {
|
|||||||
serverbound.register(EncryptionResponse.class, EncryptionResponse::new,
|
serverbound.register(EncryptionResponse.class, EncryptionResponse::new,
|
||||||
genericMappings(0x01));
|
genericMappings(0x01));
|
||||||
serverbound.register(LoginPluginResponse.class, LoginPluginResponse::new,
|
serverbound.register(LoginPluginResponse.class, LoginPluginResponse::new,
|
||||||
map(0x02, MINECRAFT_1_13, false));
|
map(0x02, MINECRAFT_1_13, false),
|
||||||
|
map(0x02, MINECRAFT_1_14, false));
|
||||||
|
|
||||||
clientbound.register(Disconnect.class, Disconnect::new,
|
clientbound.register(Disconnect.class, Disconnect::new,
|
||||||
genericMappings(0x00));
|
genericMappings(0x00));
|
||||||
@ -209,7 +230,8 @@ public enum StateRegistry {
|
|||||||
clientbound.register(SetCompression.class, SetCompression::new,
|
clientbound.register(SetCompression.class, SetCompression::new,
|
||||||
genericMappings(0x03));
|
genericMappings(0x03));
|
||||||
clientbound.register(LoginPluginMessage.class, LoginPluginMessage::new,
|
clientbound.register(LoginPluginMessage.class, LoginPluginMessage::new,
|
||||||
map(0x04, MINECRAFT_1_13, false));
|
map(0x04, MINECRAFT_1_13, false),
|
||||||
|
map(0x04, MINECRAFT_1_14, false));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -231,6 +253,7 @@ public enum StateRegistry {
|
|||||||
LINKED_PROTOCOL_VERSIONS.put(MINECRAFT_1_12, EnumSet.of(MINECRAFT_1_12_1));
|
LINKED_PROTOCOL_VERSIONS.put(MINECRAFT_1_12, EnumSet.of(MINECRAFT_1_12_1));
|
||||||
LINKED_PROTOCOL_VERSIONS.put(MINECRAFT_1_12_1, EnumSet.of(MINECRAFT_1_12_2));
|
LINKED_PROTOCOL_VERSIONS.put(MINECRAFT_1_12_1, EnumSet.of(MINECRAFT_1_12_2));
|
||||||
LINKED_PROTOCOL_VERSIONS.put(MINECRAFT_1_13, EnumSet.of(MINECRAFT_1_13_1, MINECRAFT_1_13_2));
|
LINKED_PROTOCOL_VERSIONS.put(MINECRAFT_1_13, EnumSet.of(MINECRAFT_1_13_1, MINECRAFT_1_13_2));
|
||||||
|
//for 1.14 ???
|
||||||
}
|
}
|
||||||
|
|
||||||
private final Direction direction;
|
private final Direction direction;
|
||||||
@ -396,7 +419,8 @@ public enum StateRegistry {
|
|||||||
map(id, MINECRAFT_1_8, false),
|
map(id, MINECRAFT_1_8, false),
|
||||||
map(id, MINECRAFT_1_9, false),
|
map(id, MINECRAFT_1_9, false),
|
||||||
map(id, MINECRAFT_1_12, false),
|
map(id, MINECRAFT_1_12, false),
|
||||||
map(id, MINECRAFT_1_13, false)
|
map(id, MINECRAFT_1_13, false),
|
||||||
|
map(id, MINECRAFT_1_14, false)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ public class JoinGame implements MinecraftPacket {
|
|||||||
private short difficulty;
|
private short difficulty;
|
||||||
private short maxPlayers;
|
private short maxPlayers;
|
||||||
private @Nullable String levelType;
|
private @Nullable String levelType;
|
||||||
|
private int viewDistance; //1.14+
|
||||||
private boolean reducedDebugInfo;
|
private boolean reducedDebugInfo;
|
||||||
|
|
||||||
public int getEntityId() {
|
public int getEntityId() {
|
||||||
@ -68,6 +69,14 @@ public class JoinGame implements MinecraftPacket {
|
|||||||
this.levelType = levelType;
|
this.levelType = levelType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getViewDistance() {
|
||||||
|
return viewDistance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setViewDistance(int viewDistance) {
|
||||||
|
this.viewDistance = viewDistance;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isReducedDebugInfo() {
|
public boolean isReducedDebugInfo() {
|
||||||
return reducedDebugInfo;
|
return reducedDebugInfo;
|
||||||
}
|
}
|
||||||
@ -85,6 +94,7 @@ public class JoinGame implements MinecraftPacket {
|
|||||||
+ ", difficulty=" + difficulty
|
+ ", difficulty=" + difficulty
|
||||||
+ ", maxPlayers=" + maxPlayers
|
+ ", maxPlayers=" + maxPlayers
|
||||||
+ ", levelType='" + levelType + '\''
|
+ ", levelType='" + levelType + '\''
|
||||||
|
+ ", viewDistance=" + viewDistance
|
||||||
+ ", reducedDebugInfo=" + reducedDebugInfo
|
+ ", reducedDebugInfo=" + reducedDebugInfo
|
||||||
+ '}';
|
+ '}';
|
||||||
}
|
}
|
||||||
@ -98,9 +108,14 @@ public class JoinGame implements MinecraftPacket {
|
|||||||
} else {
|
} else {
|
||||||
this.dimension = buf.readByte();
|
this.dimension = buf.readByte();
|
||||||
}
|
}
|
||||||
this.difficulty = buf.readUnsignedByte();
|
if (version.compareTo(ProtocolVersion.MINECRAFT_1_13_2) <= 0) {
|
||||||
|
this.difficulty = buf.readUnsignedByte();
|
||||||
|
}
|
||||||
this.maxPlayers = buf.readUnsignedByte();
|
this.maxPlayers = buf.readUnsignedByte();
|
||||||
this.levelType = ProtocolUtils.readString(buf, 16);
|
this.levelType = ProtocolUtils.readString(buf, 16);
|
||||||
|
if (version.compareTo(ProtocolVersion.MINECRAFT_1_14) >= 0) {
|
||||||
|
this.viewDistance = ProtocolUtils.readVarInt(buf);
|
||||||
|
}
|
||||||
this.reducedDebugInfo = buf.readBoolean();
|
this.reducedDebugInfo = buf.readBoolean();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,12 +128,17 @@ public class JoinGame implements MinecraftPacket {
|
|||||||
} else {
|
} else {
|
||||||
buf.writeByte(dimension);
|
buf.writeByte(dimension);
|
||||||
}
|
}
|
||||||
buf.writeByte(difficulty);
|
if (version.compareTo(ProtocolVersion.MINECRAFT_1_13_2) <= 0) {
|
||||||
|
buf.writeByte(difficulty);
|
||||||
|
}
|
||||||
buf.writeByte(maxPlayers);
|
buf.writeByte(maxPlayers);
|
||||||
if (levelType == null) {
|
if (levelType == null) {
|
||||||
throw new IllegalStateException("No level type specified.");
|
throw new IllegalStateException("No level type specified.");
|
||||||
}
|
}
|
||||||
ProtocolUtils.writeString(buf, levelType);
|
ProtocolUtils.writeString(buf, levelType);
|
||||||
|
if (version.compareTo(ProtocolVersion.MINECRAFT_1_14) >= 0) {
|
||||||
|
ProtocolUtils.writeVarInt(buf,viewDistance);
|
||||||
|
}
|
||||||
buf.writeBoolean(reducedDebugInfo);
|
buf.writeBoolean(reducedDebugInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,9 @@ public class Respawn implements MinecraftPacket {
|
|||||||
@Override
|
@Override
|
||||||
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||||
this.dimension = buf.readInt();
|
this.dimension = buf.readInt();
|
||||||
this.difficulty = buf.readUnsignedByte();
|
if (version.compareTo(ProtocolVersion.MINECRAFT_1_13_2) <= 0) {
|
||||||
|
this.difficulty = buf.readUnsignedByte();
|
||||||
|
}
|
||||||
this.gamemode = buf.readUnsignedByte();
|
this.gamemode = buf.readUnsignedByte();
|
||||||
this.levelType = ProtocolUtils.readString(buf, 16);
|
this.levelType = ProtocolUtils.readString(buf, 16);
|
||||||
}
|
}
|
||||||
@ -76,7 +78,9 @@ public class Respawn implements MinecraftPacket {
|
|||||||
@Override
|
@Override
|
||||||
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
public void encode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
|
||||||
buf.writeInt(dimension);
|
buf.writeInt(dimension);
|
||||||
buf.writeByte(difficulty);
|
if (version.compareTo(ProtocolVersion.MINECRAFT_1_13_2) <= 0) {
|
||||||
|
buf.writeByte(difficulty);
|
||||||
|
}
|
||||||
buf.writeByte(gamemode);
|
buf.writeByte(gamemode);
|
||||||
ProtocolUtils.writeString(buf, levelType);
|
ProtocolUtils.writeString(buf, levelType);
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren