mirror of
https://github.com/Nan1t/NanoLimbo.git
synced 2025-07-09 19:40:14 +02:00
Fix Join Game packet and Login packet, add new codec for 1.19
This commit is contained in:
parent
ac8eda05ad
commit
272c37bb79
@ -74,8 +74,8 @@ public final class PacketSnapshots {
|
|||||||
joinGame.setReducedDebugInfo(true);
|
joinGame.setReducedDebugInfo(true);
|
||||||
joinGame.setDebug(false);
|
joinGame.setDebug(false);
|
||||||
joinGame.setViewDistance(0);
|
joinGame.setViewDistance(0);
|
||||||
joinGame.setWorldName("minecraft:world");
|
joinGame.setWorldName("minecraft:overworld");
|
||||||
joinGame.setWorldNames("minecraft:world");
|
joinGame.setWorldNames("minecraft:overworld");
|
||||||
joinGame.setHashedSeed(0);
|
joinGame.setHashedSeed(0);
|
||||||
joinGame.setDimensionRegistry(server.getDimensionRegistry());
|
joinGame.setDimensionRegistry(server.getDimensionRegistry());
|
||||||
|
|
||||||
|
@ -190,21 +190,6 @@ public class ByteMessage extends ByteBuf {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeProperties(Property[] properties) {
|
|
||||||
writeVarInt(properties.length);
|
|
||||||
for (Property prop : properties) {
|
|
||||||
writeString(prop.getName());
|
|
||||||
writeString(prop.getValue());
|
|
||||||
if (prop.getSignature() != null) {
|
|
||||||
buf.writeBoolean(true);
|
|
||||||
writeString(prop.getSignature());
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
buf.writeBoolean(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Delegated methods */
|
/* Delegated methods */
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,38 +0,0 @@
|
|||||||
package ru.nanit.limbo.protocol;
|
|
||||||
|
|
||||||
public class Property {
|
|
||||||
|
|
||||||
private String name;
|
|
||||||
private String value;
|
|
||||||
private String signature;
|
|
||||||
|
|
||||||
public Property(String name, String value, String signature) {
|
|
||||||
this.name = name;
|
|
||||||
this.value = value;
|
|
||||||
this.signature = signature;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setValue(String value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSignature() {
|
|
||||||
return signature;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSignature(String signature) {
|
|
||||||
this.signature = signature;
|
|
||||||
}
|
|
||||||
}
|
|
@ -19,7 +19,6 @@ package ru.nanit.limbo.protocol.packets.login;
|
|||||||
|
|
||||||
import ru.nanit.limbo.protocol.ByteMessage;
|
import ru.nanit.limbo.protocol.ByteMessage;
|
||||||
import ru.nanit.limbo.protocol.PacketOut;
|
import ru.nanit.limbo.protocol.PacketOut;
|
||||||
import ru.nanit.limbo.protocol.Property;
|
|
||||||
import ru.nanit.limbo.protocol.registry.Version;
|
import ru.nanit.limbo.protocol.registry.Version;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -46,7 +45,7 @@ public class PacketLoginSuccess implements PacketOut {
|
|||||||
}
|
}
|
||||||
msg.writeString(username);
|
msg.writeString(username);
|
||||||
if (version.moreOrEqual(Version.V1_19)) {
|
if (version.moreOrEqual(Version.V1_19)) {
|
||||||
msg.writeProperties(new Property[0]);
|
msg.writeVarInt(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,11 +17,15 @@
|
|||||||
|
|
||||||
package ru.nanit.limbo.protocol.packets.play;
|
package ru.nanit.limbo.protocol.packets.play;
|
||||||
|
|
||||||
|
import net.kyori.adventure.nbt.TagStringIO;
|
||||||
import ru.nanit.limbo.protocol.ByteMessage;
|
import ru.nanit.limbo.protocol.ByteMessage;
|
||||||
import ru.nanit.limbo.protocol.PacketOut;
|
import ru.nanit.limbo.protocol.PacketOut;
|
||||||
import ru.nanit.limbo.protocol.registry.Version;
|
import ru.nanit.limbo.protocol.registry.Version;
|
||||||
|
import ru.nanit.limbo.server.Logger;
|
||||||
import ru.nanit.limbo.world.dimension.DimensionRegistry;
|
import ru.nanit.limbo.world.dimension.DimensionRegistry;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
public class PacketJoinGame implements PacketOut {
|
public class PacketJoinGame implements PacketOut {
|
||||||
|
|
||||||
private int entityId;
|
private int entityId;
|
||||||
@ -199,9 +203,8 @@ public class PacketJoinGame implements PacketOut {
|
|||||||
msg.writeByte(gameMode);
|
msg.writeByte(gameMode);
|
||||||
msg.writeByte(previousGameMode);
|
msg.writeByte(previousGameMode);
|
||||||
msg.writeStringsArray(worldNames);
|
msg.writeStringsArray(worldNames);
|
||||||
msg.writeCompoundTag(dimensionRegistry.getCodec_1_18_2());
|
msg.writeCompoundTag(dimensionRegistry.getCodec_1_19());
|
||||||
msg.writeCompoundTag(dimensionRegistry.getDefaultDimension_1_18_2().getData());
|
msg.writeString(worldName); // World type
|
||||||
//msg.writeString("minecraft:overworld");
|
|
||||||
msg.writeString(worldName);
|
msg.writeString(worldName);
|
||||||
msg.writeLong(hashedSeed);
|
msg.writeLong(hashedSeed);
|
||||||
msg.writeVarInt(maxPlayers);
|
msg.writeVarInt(maxPlayers);
|
||||||
|
@ -36,6 +36,7 @@ public final class DimensionRegistry {
|
|||||||
|
|
||||||
private CompoundBinaryTag codec_1_16;
|
private CompoundBinaryTag codec_1_16;
|
||||||
private CompoundBinaryTag codec_1_18_2;
|
private CompoundBinaryTag codec_1_18_2;
|
||||||
|
private CompoundBinaryTag codec_1_19;
|
||||||
private CompoundBinaryTag oldCodec;
|
private CompoundBinaryTag oldCodec;
|
||||||
|
|
||||||
public DimensionRegistry(LimboServer server) {
|
public DimensionRegistry(LimboServer server) {
|
||||||
@ -50,6 +51,10 @@ public final class DimensionRegistry {
|
|||||||
return codec_1_18_2;
|
return codec_1_18_2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CompoundBinaryTag getCodec_1_19() {
|
||||||
|
return codec_1_19;
|
||||||
|
}
|
||||||
|
|
||||||
public CompoundBinaryTag getOldCodec() {
|
public CompoundBinaryTag getOldCodec() {
|
||||||
return oldCodec;
|
return oldCodec;
|
||||||
}
|
}
|
||||||
@ -65,6 +70,8 @@ public final class DimensionRegistry {
|
|||||||
public void load(String def) throws IOException {
|
public void load(String def) throws IOException {
|
||||||
codec_1_16 = readCodecFile("/dimension/codec_1_16.snbt");
|
codec_1_16 = readCodecFile("/dimension/codec_1_16.snbt");
|
||||||
codec_1_18_2 = readCodecFile("/dimension/codec_1_18_2.snbt");
|
codec_1_18_2 = readCodecFile("/dimension/codec_1_18_2.snbt");
|
||||||
|
codec_1_18_2 = readCodecFile("/dimension/codec_1_18_2.snbt");
|
||||||
|
codec_1_19 = readCodecFile("/dimension/codec_1_19.snbt");
|
||||||
// On 1.16-1.16.1 different codec format
|
// On 1.16-1.16.1 different codec format
|
||||||
oldCodec = readCodecFile("/dimension/codec_old.snbt");
|
oldCodec = readCodecFile("/dimension/codec_old.snbt");
|
||||||
|
|
||||||
|
2101
src/main/resources/dimension/codec_1_19.snbt
Normal file
2101
src/main/resources/dimension/codec_1_19.snbt
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user