Skip to content

Commit

Permalink
Merge pull request #38 from BoomEaro/feature/1.19.1
Browse files Browse the repository at this point in the history
Support 1.19.1
  • Loading branch information
Nan1t authored Jul 28, 2022
2 parents 90364e4 + b221d88 commit d474498
Show file tree
Hide file tree
Showing 6 changed files with 2,330 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ public void setSender(UUID sender) {
@Override
public void encode(ByteMessage msg, Version version) {
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);
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,12 @@ public void encode(ByteMessage msg, Version version) {
msg.writeByte(gameMode);
msg.writeByte(previousGameMode);
msg.writeStringsArray(worldNames);
msg.writeCompoundTag(dimensionRegistry.getCodec_1_19());
if (version.moreOrEqual(Version.V1_19_1)) {
msg.writeCompoundTag(dimensionRegistry.getCodec_1_19_1());
}
else {
msg.writeCompoundTag(dimensionRegistry.getCodec_1_19());
}
msg.writeString(worldName); // World type
msg.writeString(worldName);
msg.writeLong(hashedSeed);
Expand Down
40 changes: 26 additions & 14 deletions src/main/java/ru/nanit/limbo/protocol/registry/State.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ public enum State {
map(0x0F, V1_14, V1_15_2),
map(0x10, V1_16, V1_16_4),
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,
Expand All @@ -94,7 +95,7 @@ public enum State {
map(0x11, V1_16, V1_16_1),
map(0x10, V1_16_2, V1_16_4),
map(0x12, V1_17, V1_18_2),
map(0x0F, V1_19, V1_19)
map(0x0F, V1_19, V1_19_1)
);
clientBound.register(PacketJoinGame::new,
map(0x01, V1_8, V1_8),
Expand All @@ -104,7 +105,8 @@ public enum State {
map(0x25, V1_16, V1_16_1),
map(0x24, V1_16_2, V1_16_4),
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,
map(0x19, V1_13, V1_13_2),
Expand All @@ -113,7 +115,8 @@ public enum State {
map(0x18, V1_16, V1_16_1),
map(0x17, V1_16_2, V1_16_4),
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,
map(0x39, V1_8, V1_8),
Expand All @@ -125,7 +128,8 @@ public enum State {
map(0x31, V1_16, V1_16_1),
map(0x30, V1_16_2, V1_16_4),
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,
map(0x08, V1_8, V1_8),
Expand All @@ -137,7 +141,8 @@ public enum State {
map(0x35, V1_16, V1_16_1),
map(0x34, V1_16_2, V1_16_4),
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,
map(0x00, V1_8, V1_8),
Expand All @@ -148,7 +153,8 @@ public enum State {
map(0x20, V1_16, V1_16_1),
map(0x1F, V1_16_2, V1_16_4),
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,
map(0x02, V1_8, V1_8),
Expand All @@ -157,14 +163,15 @@ public enum State {
map(0x0F, V1_15, V1_15_2),
map(0x0E, V1_16, V1_16_4),
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,
map(0x0C, V1_9, V1_14_4),
map(0x0D, V1_15, V1_15_2),
map(0x0C, V1_16, V1_16_4),
map(0x0D, V1_17, V1_18_2),
map(0x0A, V1_19, V1_19)
map(0x0A, V1_19, V1_19_1)
);
clientBound.register(PacketPlayerInfo::new,
map(0x38, V1_8, V1_8),
Expand All @@ -176,7 +183,8 @@ public enum State {
map(0x33, V1_16, V1_16_1),
map(0x32, V1_16_2, V1_16_4),
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,
map(0x45, V1_8, V1_11_1),
Expand All @@ -189,15 +197,18 @@ public enum State {
);
clientBound.register(PacketTitleSetTitle::new,
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,
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,
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,
map(0x47, V1_8, V1_8),
Expand All @@ -211,7 +222,8 @@ public enum State {
map(0x53, V1_16, V1_16_4),
map(0x5E, V1_17, V1_17_1),
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)
);
}
};
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/ru/nanit/limbo/protocol/registry/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ public enum Version {
V1_18(757),
// 1.18.1 has same protocol number
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 Version MAX;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public final class DimensionRegistry {
private CompoundBinaryTag codec_1_16;
private CompoundBinaryTag codec_1_18_2;
private CompoundBinaryTag codec_1_19;
private CompoundBinaryTag codec_1_19_1;
private CompoundBinaryTag oldCodec;

public DimensionRegistry(LimboServer server) {
Expand All @@ -55,6 +56,10 @@ public CompoundBinaryTag getCodec_1_19() {
return codec_1_19;
}

public CompoundBinaryTag getCodec_1_19_1() {
return codec_1_19_1;
}

public CompoundBinaryTag getOldCodec() {
return oldCodec;
}
Expand All @@ -71,6 +76,7 @@ public void load(String def) throws IOException {
codec_1_16 = readCodecFile("/dimension/codec_1_16.snbt");
codec_1_18_2 = readCodecFile("/dimension/codec_1_18_2.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
oldCodec = readCodecFile("/dimension/codec_old.snbt");

Expand Down
Loading

0 comments on commit d474498

Please sign in to comment.