Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-11-17 05:20:14 +01:00
Merge branch 'future/1.16.2' of https://github.com/Xernium/Velocity into Xernium-future/1.16.2
Dieser Commit ist enthalten in:
Commit
b8a2d97935
@ -36,7 +36,8 @@ public enum ProtocolVersion {
|
|||||||
MINECRAFT_1_15_1(575, "1.15.1"),
|
MINECRAFT_1_15_1(575, "1.15.1"),
|
||||||
MINECRAFT_1_15_2(578, "1.15.2"),
|
MINECRAFT_1_15_2(578, "1.15.2"),
|
||||||
MINECRAFT_1_16(735, "1.16"),
|
MINECRAFT_1_16(735, "1.16"),
|
||||||
MINECRAFT_1_16_1(736, "1.16.1");
|
MINECRAFT_1_16_1(736, "1.16.1"),
|
||||||
|
MINECRAFT_1_16_2(741, "1.16.2");
|
||||||
|
|
||||||
private final int protocol;
|
private final int protocol;
|
||||||
private final String name;
|
private final String name;
|
||||||
|
@ -79,27 +79,22 @@ public final class DimensionRegistry {
|
|||||||
* Encodes the stored Dimension registry as CompoundTag.
|
* Encodes the stored Dimension registry as CompoundTag.
|
||||||
* @return the CompoundTag containing identifier:type mappings
|
* @return the CompoundTag containing identifier:type mappings
|
||||||
*/
|
*/
|
||||||
public CompoundTag encodeRegistry() {
|
public ListTag encodeRegistry() {
|
||||||
CompoundTag ret = new CompoundTag();
|
|
||||||
ListTag list = new ListTag(TagType.COMPOUND);
|
ListTag list = new ListTag(TagType.COMPOUND);
|
||||||
for (DimensionData iter : registeredDimensions.values()) {
|
for (DimensionData iter : registeredDimensions.values()) {
|
||||||
list.add(iter.encodeAsCompundTag());
|
list.add(iter.encodeAsCompundTag());
|
||||||
}
|
}
|
||||||
ret.put("dimension", list);
|
return list;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decodes a CompoundTag storing a dimension registry.
|
* Decodes a CompoundTag storing a dimension registry.
|
||||||
* @param toParse CompoundTag containing a dimension registry
|
* @param toParse CompoundTag containing a dimension registry
|
||||||
*/
|
*/
|
||||||
public static ImmutableSet<DimensionData> fromGameData(CompoundTag toParse) {
|
public static ImmutableSet<DimensionData> fromGameData(ListTag toParse) {
|
||||||
Preconditions.checkNotNull(toParse, "CompoundTag cannot be null");
|
Preconditions.checkNotNull(toParse, "ListTag cannot be null");
|
||||||
Preconditions.checkArgument(toParse.contains("dimension", TagType.LIST),
|
|
||||||
"CompoundTag does not contain a dimension list");
|
|
||||||
ListTag dimensions = toParse.getList("dimension");
|
|
||||||
ImmutableSet.Builder<DimensionData> mappings = ImmutableSet.builder();
|
ImmutableSet.Builder<DimensionData> mappings = ImmutableSet.builder();
|
||||||
for (Tag iter : dimensions) {
|
for (Tag iter : toParse) {
|
||||||
if (iter instanceof CompoundTag) {
|
if (iter instanceof CompoundTag) {
|
||||||
mappings.add(DimensionData.decodeCompoundTag((CompoundTag) iter));
|
mappings.add(DimensionData.decodeCompoundTag((CompoundTag) iter));
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_13;
|
|||||||
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_14;
|
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_14;
|
||||||
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_15;
|
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_15;
|
||||||
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_16;
|
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_16;
|
||||||
|
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_16_2;
|
||||||
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_4;
|
import static com.velocitypowered.api.network.ProtocolVersion.MINECRAFT_1_9_4;
|
||||||
@ -122,7 +123,8 @@ public enum StateRegistry {
|
|||||||
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),
|
map(0x1F, MINECRAFT_1_14, false),
|
||||||
map(0x20, MINECRAFT_1_16, false));
|
map(0x20, MINECRAFT_1_16, false),
|
||||||
|
map(0x21, MINECRAFT_1_16_2, 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),
|
||||||
@ -139,39 +141,45 @@ public enum StateRegistry {
|
|||||||
map(0x0E, MINECRAFT_1_9, false),
|
map(0x0E, MINECRAFT_1_9, false),
|
||||||
map(0x10, MINECRAFT_1_13, false),
|
map(0x10, MINECRAFT_1_13, false),
|
||||||
map(0x11, MINECRAFT_1_15, false),
|
map(0x11, MINECRAFT_1_15, false),
|
||||||
map(0x10, MINECRAFT_1_16, false));
|
map(0x10, MINECRAFT_1_16, false),
|
||||||
|
map(0x0F, MINECRAFT_1_16_2, 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(0x12, MINECRAFT_1_15, false),
|
map(0x12, MINECRAFT_1_15, false),
|
||||||
map(0x11, MINECRAFT_1_16, false));
|
map(0x11, MINECRAFT_1_16, false),
|
||||||
|
map(0x10, MINECRAFT_1_16_2, 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(0x19, MINECRAFT_1_13, false),
|
map(0x19, MINECRAFT_1_13, false),
|
||||||
map(0x18, MINECRAFT_1_14, false),
|
map(0x18, MINECRAFT_1_14, false),
|
||||||
map(0x19, MINECRAFT_1_15, false),
|
map(0x19, MINECRAFT_1_15, false),
|
||||||
map(0x18, MINECRAFT_1_16, false));
|
map(0x18, MINECRAFT_1_16, false),
|
||||||
|
map(0x17, MINECRAFT_1_16_2, 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(0x1B, MINECRAFT_1_13, false),
|
map(0x1B, MINECRAFT_1_13, false),
|
||||||
map(0x1A, MINECRAFT_1_14, false),
|
map(0x1A, MINECRAFT_1_14, false),
|
||||||
map(0x1B, MINECRAFT_1_15, false),
|
map(0x1B, MINECRAFT_1_15, false),
|
||||||
map(0x1A, MINECRAFT_1_16, false));
|
map(0x1A, MINECRAFT_1_16, false),
|
||||||
|
map(0x19, MINECRAFT_1_16_2, 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(0x21, MINECRAFT_1_13, false),
|
map(0x21, MINECRAFT_1_13, false),
|
||||||
map(0x20, MINECRAFT_1_14, false),
|
map(0x20, MINECRAFT_1_14, false),
|
||||||
map(0x21, MINECRAFT_1_15, false),
|
map(0x21, MINECRAFT_1_15, false),
|
||||||
map(0x20, MINECRAFT_1_16, false));
|
map(0x20, MINECRAFT_1_16, false),
|
||||||
|
map(0x1F, MINECRAFT_1_16_2, 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(0x25, MINECRAFT_1_13, false),
|
map(0x25, MINECRAFT_1_13, false),
|
||||||
map(0x25, MINECRAFT_1_14, false),
|
map(0x25, MINECRAFT_1_14, false),
|
||||||
map(0x26, MINECRAFT_1_15, false),
|
map(0x26, MINECRAFT_1_15, false),
|
||||||
map(0x25, MINECRAFT_1_16, false));
|
map(0x25, MINECRAFT_1_16, false),
|
||||||
|
map(0x24, MINECRAFT_1_16_2, 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),
|
||||||
@ -180,7 +188,8 @@ public enum StateRegistry {
|
|||||||
map(0x38, MINECRAFT_1_13, true),
|
map(0x38, MINECRAFT_1_13, true),
|
||||||
map(0x3A, MINECRAFT_1_14, true),
|
map(0x3A, MINECRAFT_1_14, true),
|
||||||
map(0x3B, MINECRAFT_1_15, true),
|
map(0x3B, MINECRAFT_1_15, true),
|
||||||
map(0x3A, MINECRAFT_1_16, true));
|
map(0x3A, MINECRAFT_1_16, true),
|
||||||
|
map(0x39, MINECRAFT_1_16_2, 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),
|
||||||
@ -189,7 +198,8 @@ public enum StateRegistry {
|
|||||||
map(0x37, MINECRAFT_1_13, true),
|
map(0x37, MINECRAFT_1_13, true),
|
||||||
map(0x39, MINECRAFT_1_14, true),
|
map(0x39, MINECRAFT_1_14, true),
|
||||||
map(0x3A, MINECRAFT_1_15, true),
|
map(0x3A, MINECRAFT_1_15, true),
|
||||||
map(0x39, MINECRAFT_1_16, true));
|
map(0x39, MINECRAFT_1_16, true),
|
||||||
|
map(0x38, MINECRAFT_1_16_2, 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),
|
||||||
@ -216,7 +226,8 @@ public enum StateRegistry {
|
|||||||
map(0x30, MINECRAFT_1_13, false),
|
map(0x30, MINECRAFT_1_13, false),
|
||||||
map(0x33, MINECRAFT_1_14, false),
|
map(0x33, MINECRAFT_1_14, false),
|
||||||
map(0x34, MINECRAFT_1_15, false),
|
map(0x34, MINECRAFT_1_15, false),
|
||||||
map(0x33, MINECRAFT_1_16, false));
|
map(0x33, MINECRAFT_1_16, false),
|
||||||
|
map(0x32, MINECRAFT_1_16_2, false));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
LOGIN {
|
LOGIN {
|
||||||
|
@ -8,6 +8,9 @@ import com.velocitypowered.proxy.connection.registry.DimensionInfo;
|
|||||||
import com.velocitypowered.proxy.connection.registry.DimensionRegistry;
|
import com.velocitypowered.proxy.connection.registry.DimensionRegistry;
|
||||||
import com.velocitypowered.proxy.protocol.*;
|
import com.velocitypowered.proxy.protocol.*;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import net.kyori.nbt.CompoundTag;
|
||||||
|
import net.kyori.nbt.ListTag;
|
||||||
|
import net.kyori.nbt.TagType;
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
|
|
||||||
public class JoinGame implements MinecraftPacket {
|
public class JoinGame implements MinecraftPacket {
|
||||||
@ -17,7 +20,8 @@ public class JoinGame implements MinecraftPacket {
|
|||||||
private int dimension;
|
private int dimension;
|
||||||
private long partialHashedSeed; // 1.15+
|
private long partialHashedSeed; // 1.15+
|
||||||
private short difficulty;
|
private short difficulty;
|
||||||
private short maxPlayers;
|
private boolean isHardcore;
|
||||||
|
private int maxPlayers;
|
||||||
private @Nullable String levelType;
|
private @Nullable String levelType;
|
||||||
private int viewDistance; // 1.14+
|
private int viewDistance; // 1.14+
|
||||||
private boolean reducedDebugInfo;
|
private boolean reducedDebugInfo;
|
||||||
@ -25,6 +29,7 @@ public class JoinGame implements MinecraftPacket {
|
|||||||
private DimensionRegistry dimensionRegistry; // 1.16+
|
private DimensionRegistry dimensionRegistry; // 1.16+
|
||||||
private DimensionInfo dimensionInfo; // 1.16+
|
private DimensionInfo dimensionInfo; // 1.16+
|
||||||
private short previousGamemode; // 1.16+
|
private short previousGamemode; // 1.16+
|
||||||
|
private CompoundTag biomeRegistry; // 1.16.2+
|
||||||
|
|
||||||
public int getEntityId() {
|
public int getEntityId() {
|
||||||
return entityId;
|
return entityId;
|
||||||
@ -62,11 +67,11 @@ public class JoinGame implements MinecraftPacket {
|
|||||||
this.difficulty = difficulty;
|
this.difficulty = difficulty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public short getMaxPlayers() {
|
public int getMaxPlayers() {
|
||||||
return maxPlayers;
|
return maxPlayers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMaxPlayers(short maxPlayers) {
|
public void setMaxPlayers(int maxPlayers) {
|
||||||
this.maxPlayers = maxPlayers;
|
this.maxPlayers = maxPlayers;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,6 +123,22 @@ public class JoinGame implements MinecraftPacket {
|
|||||||
this.previousGamemode = previousGamemode;
|
this.previousGamemode = previousGamemode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getIsHardcore() {
|
||||||
|
return isHardcore;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsHardcore(boolean isHardcore) {
|
||||||
|
this.isHardcore = isHardcore;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CompoundTag getBiomeRegistry() {
|
||||||
|
return biomeRegistry;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBiomeRegistry(CompoundTag biomeRegistry) {
|
||||||
|
this.biomeRegistry = biomeRegistry;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "JoinGame{"
|
return "JoinGame{"
|
||||||
@ -126,6 +147,7 @@ public class JoinGame implements MinecraftPacket {
|
|||||||
+ ", dimension=" + dimension
|
+ ", dimension=" + dimension
|
||||||
+ ", partialHashedSeed=" + partialHashedSeed
|
+ ", partialHashedSeed=" + partialHashedSeed
|
||||||
+ ", difficulty=" + difficulty
|
+ ", difficulty=" + difficulty
|
||||||
|
+ ", isHardcore=" + isHardcore
|
||||||
+ ", maxPlayers=" + maxPlayers
|
+ ", maxPlayers=" + maxPlayers
|
||||||
+ ", levelType='" + levelType + '\''
|
+ ", levelType='" + levelType + '\''
|
||||||
+ ", viewDistance=" + viewDistance
|
+ ", viewDistance=" + viewDistance
|
||||||
@ -139,13 +161,30 @@ public class JoinGame 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.entityId = buf.readInt();
|
this.entityId = buf.readInt();
|
||||||
this.gamemode = buf.readByte();
|
if (version.compareTo(ProtocolVersion.MINECRAFT_1_16_2) >= 0) {
|
||||||
|
this.isHardcore = buf.readBoolean();
|
||||||
|
this.gamemode = buf.readByte();
|
||||||
|
} else {
|
||||||
|
this.gamemode = buf.readByte();
|
||||||
|
this.isHardcore = (this.gamemode & 0x08) != 0;
|
||||||
|
this.gamemode &= ~0x08;
|
||||||
|
}
|
||||||
String dimensionIdentifier = null;
|
String dimensionIdentifier = null;
|
||||||
String levelName = null;
|
String levelName = null;
|
||||||
if (version.compareTo(ProtocolVersion.MINECRAFT_1_16) >= 0) {
|
if (version.compareTo(ProtocolVersion.MINECRAFT_1_16) >= 0) {
|
||||||
this.previousGamemode = buf.readByte();
|
this.previousGamemode = buf.readByte();
|
||||||
ImmutableSet<String> levelNames = ImmutableSet.copyOf(ProtocolUtils.readStringArray(buf));
|
ImmutableSet<String> levelNames = ImmutableSet.copyOf(ProtocolUtils.readStringArray(buf));
|
||||||
ImmutableSet<DimensionData> readData = DimensionRegistry.fromGameData(ProtocolUtils.readCompoundTag(buf));
|
CompoundTag registryContainer = ProtocolUtils.readCompoundTag(buf);
|
||||||
|
ListTag dimensionRegistryContainer = null;
|
||||||
|
if (version.compareTo(ProtocolVersion.MINECRAFT_1_16_2) >= 0) {
|
||||||
|
dimensionRegistryContainer = registryContainer.getCompound("minecraft:dimension_type")
|
||||||
|
.getList("value", TagType.COMPOUND);
|
||||||
|
this.biomeRegistry = registryContainer.getCompound("minecraft:worldgen/biome");
|
||||||
|
} else {
|
||||||
|
dimensionRegistryContainer = registryContainer.getList("dimension", TagType.COMPOUND);
|
||||||
|
}
|
||||||
|
ImmutableSet<DimensionData> readData =
|
||||||
|
DimensionRegistry.fromGameData(dimensionRegistryContainer);
|
||||||
this.dimensionRegistry = new DimensionRegistry(readData, levelNames);
|
this.dimensionRegistry = new DimensionRegistry(readData, levelNames);
|
||||||
dimensionIdentifier = ProtocolUtils.readString(buf);
|
dimensionIdentifier = ProtocolUtils.readString(buf);
|
||||||
levelName = ProtocolUtils.readString(buf);
|
levelName = ProtocolUtils.readString(buf);
|
||||||
@ -160,7 +199,11 @@ public class JoinGame implements MinecraftPacket {
|
|||||||
if (version.compareTo(ProtocolVersion.MINECRAFT_1_15) >= 0) {
|
if (version.compareTo(ProtocolVersion.MINECRAFT_1_15) >= 0) {
|
||||||
this.partialHashedSeed = buf.readLong();
|
this.partialHashedSeed = buf.readLong();
|
||||||
}
|
}
|
||||||
this.maxPlayers = buf.readUnsignedByte();
|
if (version.compareTo(ProtocolVersion.MINECRAFT_1_16_2) >= 0) {
|
||||||
|
this.maxPlayers = ProtocolUtils.readVarInt(buf);
|
||||||
|
} else {
|
||||||
|
this.maxPlayers = buf.readUnsignedByte();
|
||||||
|
}
|
||||||
if (version.compareTo(ProtocolVersion.MINECRAFT_1_16) < 0) {
|
if (version.compareTo(ProtocolVersion.MINECRAFT_1_16) < 0) {
|
||||||
this.levelType = ProtocolUtils.readString(buf, 16);
|
this.levelType = ProtocolUtils.readString(buf, 16);
|
||||||
}
|
}
|
||||||
@ -181,12 +224,28 @@ public class JoinGame 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(entityId);
|
buf.writeInt(entityId);
|
||||||
buf.writeByte(gamemode);
|
if (version.compareTo(ProtocolVersion.MINECRAFT_1_16_2) >= 0) {
|
||||||
|
buf.writeBoolean(isHardcore);
|
||||||
|
buf.writeByte(gamemode);
|
||||||
|
} else {
|
||||||
|
buf.writeByte(isHardcore ? gamemode | 0x8 : gamemode);
|
||||||
|
}
|
||||||
if (version.compareTo(ProtocolVersion.MINECRAFT_1_16) >= 0) {
|
if (version.compareTo(ProtocolVersion.MINECRAFT_1_16) >= 0) {
|
||||||
buf.writeByte(previousGamemode);
|
buf.writeByte(previousGamemode);
|
||||||
ProtocolUtils.writeStringArray(buf, dimensionRegistry.getLevelNames().toArray(
|
ProtocolUtils.writeStringArray(buf, dimensionRegistry.getLevelNames().toArray(
|
||||||
new String[dimensionRegistry.getLevelNames().size()]));
|
new String[dimensionRegistry.getLevelNames().size()]));
|
||||||
ProtocolUtils.writeCompoundTag(buf, dimensionRegistry.encodeRegistry());
|
CompoundTag registryContainer = new CompoundTag();
|
||||||
|
ListTag encodedDimensionRegistry = dimensionRegistry.encodeRegistry();
|
||||||
|
if (version.compareTo(ProtocolVersion.MINECRAFT_1_16_2) >= 0) {
|
||||||
|
CompoundTag dimensionRegistryDummy = new CompoundTag();
|
||||||
|
dimensionRegistryDummy.putString("type", "minecraft:dimension_type");
|
||||||
|
dimensionRegistryDummy.put("value", encodedDimensionRegistry);
|
||||||
|
registryContainer.put("minecraft:dimension_type", dimensionRegistryDummy);
|
||||||
|
registryContainer.put("minecraft:worldgen/biome", biomeRegistry);
|
||||||
|
} else {
|
||||||
|
registryContainer.put("dimension", encodedDimensionRegistry);
|
||||||
|
}
|
||||||
|
ProtocolUtils.writeCompoundTag(buf, registryContainer);
|
||||||
ProtocolUtils.writeString(buf, dimensionInfo.getRegistryIdentifier());
|
ProtocolUtils.writeString(buf, dimensionInfo.getRegistryIdentifier());
|
||||||
ProtocolUtils.writeString(buf, dimensionInfo.getLevelName());
|
ProtocolUtils.writeString(buf, dimensionInfo.getLevelName());
|
||||||
} else if (version.compareTo(ProtocolVersion.MINECRAFT_1_9_1) >= 0) {
|
} else if (version.compareTo(ProtocolVersion.MINECRAFT_1_9_1) >= 0) {
|
||||||
@ -200,7 +259,11 @@ public class JoinGame implements MinecraftPacket {
|
|||||||
if (version.compareTo(ProtocolVersion.MINECRAFT_1_15) >= 0) {
|
if (version.compareTo(ProtocolVersion.MINECRAFT_1_15) >= 0) {
|
||||||
buf.writeLong(partialHashedSeed);
|
buf.writeLong(partialHashedSeed);
|
||||||
}
|
}
|
||||||
buf.writeByte(maxPlayers);
|
if (version.compareTo(ProtocolVersion.MINECRAFT_1_16_2) >= 0) {
|
||||||
|
ProtocolUtils.writeVarInt(buf, maxPlayers);
|
||||||
|
} else {
|
||||||
|
buf.writeByte(maxPlayers);
|
||||||
|
}
|
||||||
if (version.compareTo(ProtocolVersion.MINECRAFT_1_16) < 0) {
|
if (version.compareTo(ProtocolVersion.MINECRAFT_1_16) < 0) {
|
||||||
if (levelType == null) {
|
if (levelType == null) {
|
||||||
throw new IllegalStateException("No level type specified.");
|
throw new IllegalStateException("No level type specified.");
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren