mirror of
https://github.com/jonesdevelopment/sonar.git
synced 2026-11-05 17:22:34 -05:00
Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ef6602c2da | ||
|
|
698edd543c | ||
|
|
d1b0240d83 | ||
|
|
b67477be87 |
No files matched your search
@@ -76,7 +76,8 @@ public enum ProtocolVersion {
|
||||
MINECRAFT_1_21_7(772, "1.21.7"),
|
||||
MINECRAFT_1_21_9(773, "1.21.9"),
|
||||
MINECRAFT_1_21_11(774, "1.21.11"),
|
||||
MINECRAFT_26_1(775, "26.1");
|
||||
MINECRAFT_26_1(775, "26.1"),
|
||||
MINECRAFT_26_2(776, "26.2");
|
||||
|
||||
private final int protocol;
|
||||
private final String name;
|
||||
|
||||
@@ -105,7 +105,9 @@ public class SonarPacketPreparer {
|
||||
public final SonarPacket[] REGISTRY_SYNC_1_21_5 = RegistryDataPacket.of(DimensionRegistry.CODEC_1_21_5);
|
||||
public final SonarPacket[] REGISTRY_SYNC_1_21_11 = RegistryDataPacket.of(DimensionRegistry.CODEC_1_21_11);
|
||||
public final SonarPacket[] REGISTRY_SYNC_26_1 = RegistryDataPacket.of(DimensionRegistry.CODEC_26_1);
|
||||
public final SonarPacket[] REGISTRY_SYNC_26_2 = RegistryDataPacket.of(DimensionRegistry.CODEC_26_2);
|
||||
public final SonarPacket TAGS_UPDATE_26_1 = UpdateTagsPacket.of(DimensionRegistry.TAGS_26_1);
|
||||
public final SonarPacket TAGS_UPDATE_26_2 = UpdateTagsPacket.of(DimensionRegistry.TAGS_26_2);
|
||||
public final SonarPacket START_WRITING_CHUNKS = new GameEventPacket(13, 0);
|
||||
public final static SonarPacket INVALID_HELD_ITEM_SLOT = new SetHeldItemPacket(-1);
|
||||
public final SonarPacket RANDOM_KEEP_ALIVE = new SonarPacketSnapshot(new KeepAlivePacket(RANDOM.nextInt()));
|
||||
@@ -152,7 +154,7 @@ public class SonarPacketPreparer {
|
||||
if (username.length() > 16) {
|
||||
username = username.substring(0, 16);
|
||||
}
|
||||
loginSuccess = new SonarPacketSnapshot(new LoginSuccessPacket(uuid, username, true));
|
||||
loginSuccess = new SonarPacketSnapshot(new LoginSuccessPacket(uuid, username, true, UUID.randomUUID()));
|
||||
|
||||
// Prepare JoinGame packet
|
||||
joinGame = new SonarPacketSnapshot(new JoinGamePacket(PLAYER_ENTITY_ID,
|
||||
@@ -162,7 +164,7 @@ public class SonarPacketPreparer {
|
||||
new String[]{"minecraft:overworld"}, "minecraft:overworld", "flat",
|
||||
DimensionType.OVERWORLD, RANDOM.nextLong() & 1337,
|
||||
false, true, false,
|
||||
false, false, false, true));
|
||||
false, false, false, true, false));
|
||||
|
||||
// Prepare the gravity check
|
||||
maxMovementTick = Sonar.get0().getConfig().getVerification().getGravity().getMaxMovementTicks();
|
||||
@@ -294,14 +296,18 @@ public class SonarPacketPreparer {
|
||||
}
|
||||
|
||||
public static @Nullable SonarPacket getTagsPacket(final @NotNull ProtocolVersion protocolVersion) {
|
||||
if (protocolVersion.greaterThanOrEquals(ProtocolVersion.MINECRAFT_26_1)) {
|
||||
if (protocolVersion.greaterThanOrEquals(ProtocolVersion.MINECRAFT_26_2)) {
|
||||
return TAGS_UPDATE_26_2;
|
||||
} else if (protocolVersion.greaterThanOrEquals(ProtocolVersion.MINECRAFT_26_1)) {
|
||||
return TAGS_UPDATE_26_1;
|
||||
}
|
||||
return null; // apparently doesn't crash the client; we're safe... for now.
|
||||
}
|
||||
|
||||
public static SonarPacket[] getRegistryPackets(final @NotNull ProtocolVersion protocolVersion) {
|
||||
if (protocolVersion.greaterThanOrEquals(ProtocolVersion.MINECRAFT_26_1)) {
|
||||
if (protocolVersion.greaterThanOrEquals(ProtocolVersion.MINECRAFT_26_2)) {
|
||||
return REGISTRY_SYNC_26_2;
|
||||
} else if (protocolVersion.greaterThanOrEquals(ProtocolVersion.MINECRAFT_26_1)) {
|
||||
return REGISTRY_SYNC_26_1;
|
||||
} else if (protocolVersion.greaterThanOrEquals(ProtocolVersion.MINECRAFT_1_21_11)) {
|
||||
return REGISTRY_SYNC_1_21_11;
|
||||
|
||||
+4
@@ -42,7 +42,9 @@ public final class DimensionRegistry {
|
||||
public final CompoundBinaryTag CODEC_1_21_5;
|
||||
public final CompoundBinaryTag CODEC_1_21_11;
|
||||
public final CompoundBinaryTag CODEC_26_1;
|
||||
public final CompoundBinaryTag CODEC_26_2;
|
||||
public final CompoundBinaryTag TAGS_26_1;
|
||||
public final CompoundBinaryTag TAGS_26_2;
|
||||
|
||||
static {
|
||||
CODEC_1_16 = getCodec("codec_1_16.nbt");
|
||||
@@ -59,7 +61,9 @@ public final class DimensionRegistry {
|
||||
CODEC_1_21_5 = getCodec("codec_1_21_5.nbt");
|
||||
CODEC_1_21_11 = getCodec("codec_1_21_11.nbt");
|
||||
CODEC_26_1 = getCodec("codec_26_1.nbt");
|
||||
CODEC_26_2 = getCodec("codec_26_2.nbt");
|
||||
TAGS_26_1 = getCodec("tags_26_1.nbt");
|
||||
TAGS_26_2 = getCodec("tags_26_2.nbt");
|
||||
}
|
||||
|
||||
private @NotNull CompoundBinaryTag getCodec(final @NotNull String fileName) {
|
||||
|
||||
+5
@@ -38,6 +38,7 @@ public final class LoginSuccessPacket implements SonarPacket {
|
||||
private UUID uuid;
|
||||
private String username;
|
||||
private boolean strictErrorHandling;
|
||||
private UUID sessionId;
|
||||
|
||||
@Override
|
||||
public void encode(final ByteBuf byteBuf, final @NotNull ProtocolVersion protocolVersion) throws Exception {
|
||||
@@ -61,6 +62,10 @@ public final class LoginSuccessPacket implements SonarPacket {
|
||||
// Whether the client should disconnect on its own if it receives invalid data from the server
|
||||
byteBuf.writeBoolean(strictErrorHandling);
|
||||
}
|
||||
|
||||
if (protocolVersion.greaterThanOrEquals(ProtocolVersion.MINECRAFT_26_2)) {
|
||||
ProtocolUtil.writeUUID(byteBuf, sessionId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+5
@@ -58,6 +58,7 @@ public final class JoinGamePacket implements SonarPacket {
|
||||
private boolean flat;
|
||||
private boolean limitedCrafting;
|
||||
private boolean secureProfile;
|
||||
private boolean onlineMode;
|
||||
|
||||
@Override
|
||||
public void encode(final @NotNull ByteBuf byteBuf, final @NotNull ProtocolVersion protocolVersion) throws Exception {
|
||||
@@ -171,6 +172,10 @@ public final class JoinGamePacket implements SonarPacket {
|
||||
if (protocolVersion.greaterThanOrEquals(ProtocolVersion.MINECRAFT_1_20_5)) {
|
||||
byteBuf.writeBoolean(secureProfile);
|
||||
}
|
||||
|
||||
if (protocolVersion.greaterThanOrEquals(ProtocolVersion.MINECRAFT_26_2)) {
|
||||
byteBuf.writeBoolean(onlineMode);
|
||||
}
|
||||
}
|
||||
|
||||
private static CompoundBinaryTag getCodec(final @NotNull ProtocolVersion protocolVersion) {
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in new issue
Block a user