1.20-pre3 and pre4

This commit is contained in:
basaigh 2023-05-20 17:24:12 +01:00
parent b9c34476fb
commit f937d9ba74
3 changed files with 2 additions and 8 deletions

View file

@ -199,9 +199,9 @@ public class MinecraftCodec {
}
public static final PacketCodec CODEC = PacketCodec.builder()
.protocolVersion((1 << 30) | 135)
.protocolVersion((1 << 30) | 137)
.helper(() -> new MinecraftCodecHelper(LEVEL_EVENTS, SOUND_NAMES))
.minecraftVersion("1.20-pre2")
.minecraftVersion("1.20-pre4")
.state(ProtocolState.HANDSHAKE, PacketStateCodec.builder()
.registerServerboundPacket(0x00, ClientIntentionPacket.class, ClientIntentionPacket::new)
)

View file

@ -13,17 +13,14 @@ import java.io.IOException;
@With
@AllArgsConstructor
public class ClientboundPlayerCombatEndPacket implements MinecraftPacket {
private final int killerId;
private final int duration;
public ClientboundPlayerCombatEndPacket(ByteBuf in, MinecraftCodecHelper helper) throws IOException {
this.duration = helper.readVarInt(in);
this.killerId = in.readInt();
}
@Override
public void serialize(ByteBuf out, MinecraftCodecHelper helper) throws IOException {
helper.writeVarInt(out, this.duration);
out.writeInt(this.killerId);
}
}

View file

@ -15,19 +15,16 @@ import java.io.IOException;
@AllArgsConstructor
public class ClientboundPlayerCombatKillPacket implements MinecraftPacket {
private final int playerId;
private final int killerId;
private final Component message;
public ClientboundPlayerCombatKillPacket(ByteBuf in, MinecraftCodecHelper helper) throws IOException {
this.playerId = helper.readVarInt(in);
this.killerId = in.readInt();
this.message = helper.readComponent(in);
}
@Override
public void serialize(ByteBuf out, MinecraftCodecHelper helper) throws IOException {
helper.writeVarInt(out, this.playerId);
out.writeInt(this.killerId);
helper.writeComponent(out, this.message);
}
}