Initial 1.19.1-pre4 support

Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
TheMode 2022-07-10 10:11:27 +02:00
parent 7e6933d7b1
commit 9d7c845e5a
4 changed files with 56 additions and 3 deletions

View File

@ -46,8 +46,8 @@ public final class MinecraftServer {
public final static Logger LOGGER = LoggerFactory.getLogger(MinecraftServer.class);
public static final String VERSION_NAME = "1.19.1-pre3";
public static final int PROTOCOL_VERSION = 1073741920;
public static final String VERSION_NAME = "1.19.1-pre4";
public static final int PROTOCOL_VERSION = 1073741921;
// Threads
public static final String THREAD_NAME_BENCHMARK = "Ms-Benchmark";

View File

@ -35,6 +35,7 @@ public final class ServerPacketIdentifier {
public static final int CUSTOM_CHAT_COMPLETIONS = nextPlayId();
public static final int PLUGIN_MESSAGE = nextPlayId();
public static final int NAMED_SOUND_EFFECT = nextPlayId();
public static final int DELETE_CHAT_MESSAGE = nextPlayId();
public static final int DISCONNECT = nextPlayId();
public static final int ENTITY_STATUS = nextPlayId();
public static final int EXPLOSION = nextPlayId();
@ -61,6 +62,7 @@ public final class ServerPacketIdentifier {
public static final int CRAFT_RECIPE_RESPONSE = nextPlayId();
public static final int PLAYER_ABILITIES = nextPlayId();
public static final int PLAYER_CHAT = nextPlayId();
public static final int PLAYER_CHAT_HEADER = nextPlayId();
public static final int END_COMBAT_EVENT = nextPlayId();
public static final int ENTER_COMBAT_EVENT = nextPlayId();
public static final int DEATH_COMBAT_EVENT = nextPlayId();
@ -118,7 +120,7 @@ public final class ServerPacketIdentifier {
public static final int DECLARE_RECIPES = nextPlayId();
public static final int TAGS = nextPlayId();
private static int nextPlayId(){
private static int nextPlayId() {
return PLAY_ID.getAndIncrement();
}
}

View File

@ -0,0 +1,24 @@
package net.minestom.server.network.packet.server.play;
import net.minestom.server.crypto.MessageSignature;
import net.minestom.server.network.packet.server.ServerPacket;
import net.minestom.server.network.packet.server.ServerPacketIdentifier;
import net.minestom.server.utils.binary.BinaryReader;
import net.minestom.server.utils.binary.BinaryWriter;
import org.jetbrains.annotations.NotNull;
public record DeleteChatPacket(@NotNull MessageSignature signature) implements ServerPacket {
public DeleteChatPacket(BinaryReader reader) {
this(new MessageSignature(MessageSignature.UNSIGNED_SENDER, reader));
}
@Override
public void write(@NotNull BinaryWriter writer) {
writer.write(signature);
}
@Override
public int getId() {
return ServerPacketIdentifier.DELETE_CHAT_MESSAGE;
}
}

View File

@ -0,0 +1,27 @@
package net.minestom.server.network.packet.server.play;
import net.minestom.server.crypto.MessageSignature;
import net.minestom.server.network.packet.server.ServerPacket;
import net.minestom.server.network.packet.server.ServerPacketIdentifier;
import net.minestom.server.utils.binary.BinaryReader;
import net.minestom.server.utils.binary.BinaryWriter;
import org.jetbrains.annotations.NotNull;
public record PlayerChatHeaderPacket(@NotNull Object header, @NotNull MessageSignature signature,
byte[] bodyDigest) implements ServerPacket {
public PlayerChatHeaderPacket(BinaryReader reader) {
this(null, new MessageSignature(MessageSignature.UNSIGNED_SENDER, reader), reader.readByteArray());
}
@Override
public void write(@NotNull BinaryWriter writer) {
// TODO write header
writer.write(signature);
writer.writeByteArray(bodyDigest);
}
@Override
public int getId() {
return ServerPacketIdentifier.PLAYER_CHAT_HEADER;
}
}