Merge pull request #38 from BoomEaro/feature/1.19.1

Support 1.19.1
This commit is contained in:
Max 2022-07-28 02:21:08 -05:00 committed by GitHub
commit d474498ef6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 2330 additions and 17 deletions

View File

@ -44,7 +44,10 @@ public class PacketChatMessage implements PacketOut {
@Override @Override
public void encode(ByteMessage msg, Version version) { public void encode(ByteMessage msg, Version version) {
msg.writeString(jsonData); msg.writeString(jsonData);
if (version.moreOrEqual(Version.V1_19)) { if (version.moreOrEqual(Version.V1_19_1)) {
msg.writeBoolean(position.index == PositionLegacy.ACTION_BAR.index);
}
else if (version.moreOrEqual(Version.V1_19)) {
msg.writeVarInt(position.index); msg.writeVarInt(position.index);
} }
else { else {

View File

@ -198,7 +198,12 @@ public class PacketJoinGame implements PacketOut {
msg.writeByte(gameMode); msg.writeByte(gameMode);
msg.writeByte(previousGameMode); msg.writeByte(previousGameMode);
msg.writeStringsArray(worldNames); msg.writeStringsArray(worldNames);
if (version.moreOrEqual(Version.V1_19_1)) {
msg.writeCompoundTag(dimensionRegistry.getCodec_1_19_1());
}
else {
msg.writeCompoundTag(dimensionRegistry.getCodec_1_19()); msg.writeCompoundTag(dimensionRegistry.getCodec_1_19());
}
msg.writeString(worldName); // World type msg.writeString(worldName); // World type
msg.writeString(worldName); msg.writeString(worldName);
msg.writeLong(hashedSeed); msg.writeLong(hashedSeed);

View File

@ -85,7 +85,8 @@ public enum State {
map(0x0F, V1_14, V1_15_2), map(0x0F, V1_14, V1_15_2),
map(0x10, V1_16, V1_16_4), map(0x10, V1_16, V1_16_4),
map(0x0F, V1_17, V1_18_2), map(0x0F, V1_17, V1_18_2),
map(0x11, V1_19, V1_19) map(0x11, V1_19, V1_19),
map(0x12, V1_19_1, V1_19_1)
); );
clientBound.register(PacketDeclareCommands::new, clientBound.register(PacketDeclareCommands::new,
@ -94,7 +95,7 @@ public enum State {
map(0x11, V1_16, V1_16_1), map(0x11, V1_16, V1_16_1),
map(0x10, V1_16_2, V1_16_4), map(0x10, V1_16_2, V1_16_4),
map(0x12, V1_17, V1_18_2), map(0x12, V1_17, V1_18_2),
map(0x0F, V1_19, V1_19) map(0x0F, V1_19, V1_19_1)
); );
clientBound.register(PacketJoinGame::new, clientBound.register(PacketJoinGame::new,
map(0x01, V1_8, V1_8), map(0x01, V1_8, V1_8),
@ -104,7 +105,8 @@ public enum State {
map(0x25, V1_16, V1_16_1), map(0x25, V1_16, V1_16_1),
map(0x24, V1_16_2, V1_16_4), map(0x24, V1_16_2, V1_16_4),
map(0x26, V1_17, V1_18_2), map(0x26, V1_17, V1_18_2),
map(0x23, V1_19, V1_19) map(0x23, V1_19, V1_19),
map(0x25, V1_19_1, V1_19_1)
); );
clientBound.register(PacketPluginMessage::new, clientBound.register(PacketPluginMessage::new,
map(0x19, V1_13, V1_13_2), map(0x19, V1_13, V1_13_2),
@ -113,7 +115,8 @@ public enum State {
map(0x18, V1_16, V1_16_1), map(0x18, V1_16, V1_16_1),
map(0x17, V1_16_2, V1_16_4), map(0x17, V1_16_2, V1_16_4),
map(0x18, V1_17, V1_18_2), map(0x18, V1_17, V1_18_2),
map(0x15, V1_19, V1_19) map(0x15, V1_19, V1_19),
map(0x16, V1_19_1, V1_19_1)
); );
clientBound.register(PacketPlayerAbilities::new, clientBound.register(PacketPlayerAbilities::new,
map(0x39, V1_8, V1_8), map(0x39, V1_8, V1_8),
@ -125,7 +128,8 @@ public enum State {
map(0x31, V1_16, V1_16_1), map(0x31, V1_16, V1_16_1),
map(0x30, V1_16_2, V1_16_4), map(0x30, V1_16_2, V1_16_4),
map(0x32, V1_17, V1_18_2), map(0x32, V1_17, V1_18_2),
map(0x2F, V1_19, V1_19) map(0x2F, V1_19, V1_19),
map(0x31, V1_19_1, V1_19_1)
); );
clientBound.register(PacketPlayerPositionAndLook::new, clientBound.register(PacketPlayerPositionAndLook::new,
map(0x08, V1_8, V1_8), map(0x08, V1_8, V1_8),
@ -137,7 +141,8 @@ public enum State {
map(0x35, V1_16, V1_16_1), map(0x35, V1_16, V1_16_1),
map(0x34, V1_16_2, V1_16_4), map(0x34, V1_16_2, V1_16_4),
map(0x38, V1_17, V1_18_2), map(0x38, V1_17, V1_18_2),
map(0x36, V1_19, V1_19) map(0x36, V1_19, V1_19),
map(0x39, V1_19_1, V1_19_1)
); );
clientBound.register(PacketKeepAlive::new, clientBound.register(PacketKeepAlive::new,
map(0x00, V1_8, V1_8), map(0x00, V1_8, V1_8),
@ -148,7 +153,8 @@ public enum State {
map(0x20, V1_16, V1_16_1), map(0x20, V1_16, V1_16_1),
map(0x1F, V1_16_2, V1_16_4), map(0x1F, V1_16_2, V1_16_4),
map(0x21, V1_17, V1_18_2), map(0x21, V1_17, V1_18_2),
map(0x1E, V1_19, V1_19) map(0x1E, V1_19, V1_19),
map(0x20, V1_19_1, V1_19_1)
); );
clientBound.register(PacketChatMessage::new, clientBound.register(PacketChatMessage::new,
map(0x02, V1_8, V1_8), map(0x02, V1_8, V1_8),
@ -157,14 +163,15 @@ public enum State {
map(0x0F, V1_15, V1_15_2), map(0x0F, V1_15, V1_15_2),
map(0x0E, V1_16, V1_16_4), map(0x0E, V1_16, V1_16_4),
map(0x0F, V1_17, V1_18_2), map(0x0F, V1_17, V1_18_2),
map(0x5F, V1_19, V1_19) map(0x5F, V1_19, V1_19),
map(0x62, V1_19_1, V1_19_1)
); );
clientBound.register(PacketBossBar::new, clientBound.register(PacketBossBar::new,
map(0x0C, V1_9, V1_14_4), map(0x0C, V1_9, V1_14_4),
map(0x0D, V1_15, V1_15_2), map(0x0D, V1_15, V1_15_2),
map(0x0C, V1_16, V1_16_4), map(0x0C, V1_16, V1_16_4),
map(0x0D, V1_17, V1_18_2), map(0x0D, V1_17, V1_18_2),
map(0x0A, V1_19, V1_19) map(0x0A, V1_19, V1_19_1)
); );
clientBound.register(PacketPlayerInfo::new, clientBound.register(PacketPlayerInfo::new,
map(0x38, V1_8, V1_8), map(0x38, V1_8, V1_8),
@ -176,7 +183,8 @@ public enum State {
map(0x33, V1_16, V1_16_1), map(0x33, V1_16, V1_16_1),
map(0x32, V1_16_2, V1_16_4), map(0x32, V1_16_2, V1_16_4),
map(0x36, V1_17, V1_18_2), map(0x36, V1_17, V1_18_2),
map(0x34, V1_19, V1_19) map(0x34, V1_19, V1_19),
map(0x37, V1_19_1, V1_19_1)
); );
clientBound.register(PacketTitleLegacy::new, clientBound.register(PacketTitleLegacy::new,
map(0x45, V1_8, V1_11_1), map(0x45, V1_8, V1_11_1),
@ -189,15 +197,18 @@ public enum State {
); );
clientBound.register(PacketTitleSetTitle::new, clientBound.register(PacketTitleSetTitle::new,
map(0x59, V1_17, V1_17_1), map(0x59, V1_17, V1_17_1),
map(0x5A, V1_18, V1_19) map(0x5A, V1_18, V1_19),
map(0x5D, V1_19_1, V1_19_1)
); );
clientBound.register(PacketTitleSetSubTitle::new, clientBound.register(PacketTitleSetSubTitle::new,
map(0x57, V1_17, V1_17_1), map(0x57, V1_17, V1_17_1),
map(0x58, V1_18, V1_19) map(0x58, V1_18, V1_19),
map(0x5B, V1_19_1, V1_19_1)
); );
clientBound.register(PacketTitleTimes::new, clientBound.register(PacketTitleTimes::new,
map(0x5A, V1_17, V1_17_1), map(0x5A, V1_17, V1_17_1),
map(0x5B, V1_18, V1_19) map(0x5B, V1_18, V1_19),
map(0x5E, V1_19_1, V1_19_1)
); );
clientBound.register(PacketPlayerListHeader::new, clientBound.register(PacketPlayerListHeader::new,
map(0x47, V1_8, V1_8), map(0x47, V1_8, V1_8),
@ -211,7 +222,8 @@ public enum State {
map(0x53, V1_16, V1_16_4), map(0x53, V1_16, V1_16_4),
map(0x5E, V1_17, V1_17_1), map(0x5E, V1_17, V1_17_1),
map(0x5F, V1_18, V1_18_2), map(0x5F, V1_18, V1_18_2),
map(0x60, V1_19, V1_19) map(0x60, V1_19, V1_19),
map(0x63, V1_19_1, V1_19_1)
); );
} }
}; };

View File

@ -59,7 +59,8 @@ public enum Version {
V1_18(757), V1_18(757),
// 1.18.1 has same protocol number // 1.18.1 has same protocol number
V1_18_2(758), V1_18_2(758),
V1_19(759); V1_19(759),
V1_19_1(760);
private static final Map<Integer, Version> VERSION_MAP; private static final Map<Integer, Version> VERSION_MAP;
private static final Version MAX; private static final Version MAX;

View File

@ -37,6 +37,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 codec_1_19;
private CompoundBinaryTag codec_1_19_1;
private CompoundBinaryTag oldCodec; private CompoundBinaryTag oldCodec;
public DimensionRegistry(LimboServer server) { public DimensionRegistry(LimboServer server) {
@ -55,6 +56,10 @@ public final class DimensionRegistry {
return codec_1_19; return codec_1_19;
} }
public CompoundBinaryTag getCodec_1_19_1() {
return codec_1_19_1;
}
public CompoundBinaryTag getOldCodec() { public CompoundBinaryTag getOldCodec() {
return oldCodec; return oldCodec;
} }
@ -71,6 +76,7 @@ public final class DimensionRegistry {
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_19 = readCodecFile("/dimension/codec_1_19.snbt"); codec_1_19 = readCodecFile("/dimension/codec_1_19.snbt");
codec_1_19_1 = readCodecFile("/dimension/codec_1_19_1.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");

File diff suppressed because it is too large Load Diff