Experimental support for 1.21

This commit is contained in:
Nan1t 2024-06-14 12:51:09 +03:00
parent 48346762bf
commit 94edb65dac
5 changed files with 2860 additions and 30 deletions

View File

@ -199,7 +199,7 @@ public final class PacketSnapshots {
PACKET_REGISTRY_DATA = PacketSnapshot.of(packetRegistryData);
Dimension dimension1_20_5 = server.getDimensionRegistry().getDimension_1_20_5();
Dimension dimension1_20_5 = server.getDimensionRegistry().getDimension_1_21();
List<PacketSnapshot> packetRegistries = new ArrayList<>();
CompoundBinaryTag dimensionTag = dimension1_20_5.getData();
for (String registryType : dimensionTag.keySet()) {

View File

@ -66,7 +66,7 @@ public enum State {
);
serverBound.register(
PacketLoginAcknowledged::new,
map(0x03, V1_20_2, V1_20_5)
map(0x03, V1_20_2, Version.getMax())
);
clientBound.register(PacketDisconnect::new,
map(0x00, Version.getMin(), Version.getMax())
@ -84,43 +84,43 @@ public enum State {
clientBound.register(
PacketPluginMessage::new,
map(0x00, V1_20_2, V1_20_3),
map(0x01, V1_20_5, V1_20_5)
map(0x01, V1_20_5, V1_21)
);
clientBound.register(
PacketDisconnect::new,
map(0x01, V1_20_2, V1_20_3),
map(0x02, V1_20_5, V1_20_5)
map(0x02, V1_20_5, V1_21)
);
clientBound.register(
PacketFinishConfiguration::new,
map(0x02, V1_20_2, V1_20_3),
map(0x03, V1_20_5, V1_20_5)
map(0x03, V1_20_5, V1_21)
);
clientBound.register(
PacketKeepAlive::new,
map(0x03, V1_20_2, V1_20_3),
map(0x04, V1_20_5, V1_20_5)
map(0x04, V1_20_5, V1_21)
);
clientBound.register(
PacketRegistryData::new,
map(0x05, V1_20_2, V1_20_3),
map(0x07, V1_20_5, V1_20_5)
map(0x07, V1_20_5, V1_21)
);
serverBound.register(
PacketPluginMessage::new,
map(0x01, V1_20_2, V1_20_3),
map(0x02, V1_20_2, V1_20_5)
map(0x02, V1_20_2, V1_21)
);
serverBound.register(
PacketFinishConfiguration::new,
map(0x02, V1_20_2, V1_20_3),
map(0x03, V1_20_5, V1_20_5)
map(0x03, V1_20_5, V1_21)
);
serverBound.register(
PacketKeepAlive::new,
map(0x03, V1_20_2, V1_20_3),
map(0x04, V1_20_5, V1_20_5)
map(0x04, V1_20_5, V1_21)
);
}
},
@ -141,7 +141,7 @@ public enum State {
map(0x12, V1_19_4, V1_20),
map(0x14, V1_20_2, V1_20_2),
map(0x15, V1_20_3, V1_20_3),
map(0x18, V1_20_5, V1_20_5)
map(0x18, V1_20_5, V1_21)
);
clientBound.register(PacketDeclareCommands::new,
@ -153,7 +153,7 @@ public enum State {
map(0x0F, V1_19, V1_19_1),
map(0x0E, V1_19_3, V1_19_3),
map(0x10, V1_19_4, V1_20),
map(0x11, V1_20_2, V1_20_5)
map(0x11, V1_20_2, V1_21)
);
clientBound.register(PacketJoinGame::new,
map(0x01, V1_7_2, V1_8),
@ -168,7 +168,7 @@ public enum State {
map(0x24, V1_19_3, V1_19_3),
map(0x28, V1_19_4, V1_20),
map(0x29, V1_20_2, V1_20_3),
map(0x2B, V1_20_5, V1_20_5)
map(0x2B, V1_20_5, V1_21)
);
clientBound.register(PacketPluginMessage::new,
map(0x19, V1_13, V1_13_2),
@ -182,7 +182,7 @@ public enum State {
map(0x15, V1_19_3, V1_19_3),
map(0x17, V1_19_4, V1_20),
map(0x18, V1_20_2, V1_20_3),
map(0x19, V1_20_5, V1_20_5)
map(0x19, V1_20_5, V1_21)
);
clientBound.register(PacketPlayerAbilities::new,
map(0x39, V1_7_2, V1_8),
@ -199,7 +199,7 @@ public enum State {
map(0x30, V1_19_3, V1_19_3),
map(0x34, V1_19_4, V1_20),
map(0x36, V1_20_2, V1_20_3),
map(0x38, V1_20_5, V1_20_5)
map(0x38, V1_20_5, V1_21)
);
clientBound.register(PacketPlayerPositionAndLook::new,
map(0x08, V1_7_2, V1_8),
@ -216,7 +216,7 @@ public enum State {
map(0x38, V1_19_3, V1_19_3),
map(0x3C, V1_19_4, V1_20),
map(0x3E, V1_20_2, V1_20_3),
map(0x40, V1_20_5, V1_20_5)
map(0x40, V1_20_5, V1_21)
);
clientBound.register(PacketKeepAlive::new,
map(0x00, V1_7_2, V1_8),
@ -232,7 +232,7 @@ public enum State {
map(0x1F, V1_19_3, V1_19_3),
map(0x23, V1_19_4, V1_20),
map(0x24, V1_20_2, V1_20_3),
map(0x26, V1_20_5, V1_20_5)
map(0x26, V1_20_5, V1_21)
);
clientBound.register(PacketChatMessage::new,
map(0x02, V1_7_2, V1_8),
@ -247,7 +247,7 @@ public enum State {
map(0x64, V1_19_4, V1_20),
map(0x67, V1_20_2, V1_20_2),
map(0x69, V1_20_3, V1_20_3),
map(0x6C, V1_20_5, V1_20_5)
map(0x6C, V1_20_5, V1_21)
);
clientBound.register(PacketBossBar::new,
map(0x0C, V1_9, V1_14_4),
@ -256,7 +256,7 @@ public enum State {
map(0x0D, V1_17, V1_18_2),
map(0x0A, V1_19, V1_19_3),
map(0x0B, V1_19_4, V1_20),
map(0x0A, V1_20_2, V1_20_5)
map(0x0A, V1_20_2, V1_21)
);
clientBound.register(PacketPlayerInfo::new,
map(0x38, V1_7_2, V1_8),
@ -273,7 +273,7 @@ public enum State {
map(0x36, V1_19_3, V1_19_3),
map(0x3A, V1_19_4, V1_20),
map(0x3C, V1_20_2, V1_20_3),
map(0x3E, V1_20_5, V1_20_5)
map(0x3E, V1_20_5, V1_21)
);
clientBound.register(PacketTitleLegacy::new,
map(0x45, V1_8, V1_11_1),
@ -292,7 +292,7 @@ public enum State {
map(0x5F, V1_19_4, V1_20),
map(0x61, V1_20_2, V1_20_2),
map(0x63, V1_20_3, V1_20_3),
map(0x65, V1_20_5, V1_20_5)
map(0x65, V1_20_5, V1_21)
);
clientBound.register(PacketTitleSetSubTitle::new,
map(0x57, V1_17, V1_17_1),
@ -302,7 +302,7 @@ public enum State {
map(0x5D, V1_19_4, V1_20),
map(0x5F, V1_20_2, V1_20_2),
map(0x61, V1_20_3, V1_20_3),
map(0x63, V1_20_5, V1_20_5)
map(0x63, V1_20_5, V1_21)
);
clientBound.register(PacketTitleTimes::new,
map(0x5A, V1_17, V1_17_1),
@ -312,7 +312,7 @@ public enum State {
map(0x60, V1_19_4, V1_20),
map(0x62, V1_20_2, V1_20_2),
map(0x64, V1_20_3, V1_20_3),
map(0x66, V1_20_5, V1_20_5)
map(0x66, V1_20_5, V1_21)
);
clientBound.register(PacketPlayerListHeader::new,
map(0x47, V1_8, V1_8),
@ -332,22 +332,22 @@ public enum State {
map(0x65, V1_19_4, V1_20),
map(0x68, V1_20_2, V1_20_2),
map(0x6A, V1_20_3, V1_20_3),
map(0x6D, V1_20_5, V1_20_5)
map(0x6D, V1_20_5, V1_21)
);
clientBound.register(PacketSpawnPosition::new,
map(0x4C, V1_19_3, V1_19_3),
map(0x50, V1_19_4, V1_20),
map(0x52, V1_20_2, V1_20_2),
map(0x54, V1_20_3, V1_20_3),
map(0x56, V1_20_5, V1_20_5)
map(0x56, V1_20_5, V1_21)
);
clientBound.register(PacketGameEvent::new,
map(0x20, V1_20_3, V1_20_3),
map(0x22, V1_20_5, V1_20_5)
map(0x22, V1_20_5, V1_21)
);
clientBound.register(PacketEmptyChunk::new,
map(0x25, V1_20_3, V1_20_3),
map(0x27, V1_20_5, V1_20_5)
map(0x27, V1_20_5, V1_21)
);
}
};

View File

@ -72,7 +72,9 @@ public enum Version {
// 1.20.1 has same protocol number
V1_20_2(764),
V1_20_3(765),
V1_20_5(766);
V1_20_5(766),
// 1.20.6 has same protocol number
V1_21(767);
private static final Map<Integer, Version> VERSION_MAP;
private static final Version MAX;

View File

@ -34,6 +34,7 @@ public final class DimensionRegistry {
private Dimension defaultDimension_1_16;
private Dimension defaultDimension_1_18_2;
private Dimension dimension_1_20_5;
private Dimension dimension_1_21;
private CompoundBinaryTag codec_1_16;
private CompoundBinaryTag codec_1_18_2;
@ -41,6 +42,7 @@ public final class DimensionRegistry {
private CompoundBinaryTag codec_1_19_1;
private CompoundBinaryTag codec_1_19_4;
private CompoundBinaryTag codec_1_20;
private CompoundBinaryTag codec_1_21;
private CompoundBinaryTag oldCodec;
public DimensionRegistry(LimboServer server) {
@ -71,6 +73,10 @@ public final class DimensionRegistry {
return codec_1_20;
}
public CompoundBinaryTag getCodec_1_21() {
return codec_1_21;
}
public CompoundBinaryTag getOldCodec() {
return oldCodec;
}
@ -87,20 +93,26 @@ public final class DimensionRegistry {
return dimension_1_20_5;
}
public Dimension getDimension_1_21() {
return dimension_1_21;
}
public void load(String def) throws IOException {
// On 1.16-1.16.1 different codec format
oldCodec = readCodecFile("/dimension/codec_old.snbt");
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");
codec_1_19_4 = readCodecFile("/dimension/codec_1_19_4.snbt");
codec_1_20 = readCodecFile("/dimension/codec_1_20.snbt");
// On 1.16-1.16.1 different codec format
oldCodec = readCodecFile("/dimension/codec_old.snbt");
codec_1_21 = readCodecFile("/dimension/codec_1_21.snbt");
defaultDimension_1_16 = getDefaultDimension(def, codec_1_16);
defaultDimension_1_18_2 = getDefaultDimension(def, codec_1_18_2);
dimension_1_20_5 = getModernDimension(def, codec_1_20);
dimension_1_21 = getModernDimension(def, codec_1_21);
}
private Dimension getDefaultDimension(String def, CompoundBinaryTag tag) {

File diff suppressed because it is too large Load Diff