Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-11-17 05:20:14 +01:00
Instead of re-encoding the client-server registry, pass through the original
Dieser Commit ist enthalten in:
Ursprung
697d08baa4
Commit
022ae0fc00
@ -54,6 +54,7 @@ public class JoinGame implements MinecraftPacket {
|
|||||||
private int simulationDistance; // 1.18+
|
private int simulationDistance; // 1.18+
|
||||||
private @Nullable Pair<String, Long> lastDeathPosition;
|
private @Nullable Pair<String, Long> lastDeathPosition;
|
||||||
private CompoundBinaryTag chatTypeRegistry; // placeholder, 1.19+
|
private CompoundBinaryTag chatTypeRegistry; // placeholder, 1.19+
|
||||||
|
private @Nullable CompoundBinaryTag originalRegistryContainerTag;
|
||||||
|
|
||||||
public int getEntityId() {
|
public int getEntityId() {
|
||||||
return entityId;
|
return entityId;
|
||||||
@ -285,6 +286,7 @@ public class JoinGame implements MinecraftPacket {
|
|||||||
ImmutableSet<DimensionData> readData =
|
ImmutableSet<DimensionData> readData =
|
||||||
DimensionRegistry.fromGameData(dimensionRegistryContainer, version);
|
DimensionRegistry.fromGameData(dimensionRegistryContainer, version);
|
||||||
this.dimensionRegistry = new DimensionRegistry(readData, levelNames);
|
this.dimensionRegistry = new DimensionRegistry(readData, levelNames);
|
||||||
|
this.originalRegistryContainerTag = registryContainer;
|
||||||
|
|
||||||
String dimensionIdentifier;
|
String dimensionIdentifier;
|
||||||
String levelName = null;
|
String levelName = null;
|
||||||
@ -378,21 +380,25 @@ public class JoinGame implements MinecraftPacket {
|
|||||||
}
|
}
|
||||||
buf.writeByte(previousGamemode);
|
buf.writeByte(previousGamemode);
|
||||||
ProtocolUtils.writeStringArray(buf, dimensionRegistry.getLevelNames().toArray(new String[0]));
|
ProtocolUtils.writeStringArray(buf, dimensionRegistry.getLevelNames().toArray(new String[0]));
|
||||||
CompoundBinaryTag.Builder registryContainer = CompoundBinaryTag.builder();
|
if (this.originalRegistryContainerTag != null) {
|
||||||
ListBinaryTag encodedDimensionRegistry = dimensionRegistry.encodeRegistry(version);
|
ProtocolUtils.writeCompoundTag(buf, this.originalRegistryContainerTag);
|
||||||
if (version.compareTo(ProtocolVersion.MINECRAFT_1_16_2) >= 0) {
|
|
||||||
CompoundBinaryTag.Builder dimensionRegistryEntry = CompoundBinaryTag.builder();
|
|
||||||
dimensionRegistryEntry.putString("type", "minecraft:dimension_type");
|
|
||||||
dimensionRegistryEntry.put("value", encodedDimensionRegistry);
|
|
||||||
registryContainer.put("minecraft:dimension_type", dimensionRegistryEntry.build());
|
|
||||||
registryContainer.put("minecraft:worldgen/biome", biomeRegistry);
|
|
||||||
if (version.compareTo(ProtocolVersion.MINECRAFT_1_19) >= 0) {
|
|
||||||
registryContainer.put("minecraft:chat_type", chatTypeRegistry);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
registryContainer.put("dimension", encodedDimensionRegistry);
|
CompoundBinaryTag.Builder registryContainer = CompoundBinaryTag.builder();
|
||||||
|
ListBinaryTag encodedDimensionRegistry = dimensionRegistry.encodeRegistry(version);
|
||||||
|
if (version.compareTo(ProtocolVersion.MINECRAFT_1_16_2) >= 0) {
|
||||||
|
CompoundBinaryTag.Builder dimensionRegistryEntry = CompoundBinaryTag.builder();
|
||||||
|
dimensionRegistryEntry.putString("type", "minecraft:dimension_type");
|
||||||
|
dimensionRegistryEntry.put("value", encodedDimensionRegistry);
|
||||||
|
registryContainer.put("minecraft:dimension_type", dimensionRegistryEntry.build());
|
||||||
|
registryContainer.put("minecraft:worldgen/biome", biomeRegistry);
|
||||||
|
if (version.compareTo(ProtocolVersion.MINECRAFT_1_19) >= 0) {
|
||||||
|
registryContainer.put("minecraft:chat_type", chatTypeRegistry);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
registryContainer.put("dimension", encodedDimensionRegistry);
|
||||||
|
}
|
||||||
|
ProtocolUtils.writeCompoundTag(buf, registryContainer.build());
|
||||||
}
|
}
|
||||||
ProtocolUtils.writeCompoundTag(buf, registryContainer.build());
|
|
||||||
if (version.compareTo(ProtocolVersion.MINECRAFT_1_16_2) >= 0
|
if (version.compareTo(ProtocolVersion.MINECRAFT_1_16_2) >= 0
|
||||||
&& version.compareTo(ProtocolVersion.MINECRAFT_1_19) < 0) {
|
&& version.compareTo(ProtocolVersion.MINECRAFT_1_19) < 0) {
|
||||||
ProtocolUtils.writeCompoundTag(buf, currentDimensionData.serializeDimensionDetails());
|
ProtocolUtils.writeCompoundTag(buf, currentDimensionData.serializeDimensionDetails());
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren