1.19-pre2

This commit is contained in:
D3ATHBRINGER13 2022-05-23 18:08:06 +01:00
parent 54073a6cf9
commit d4fa7b4458
4 changed files with 35 additions and 3 deletions

View file

@ -172,8 +172,8 @@ import com.github.steveice10.mc.protocol.packet.status.serverbound.ServerboundSt
public class MinecraftCodec {
public static final PacketCodec CODEC = PacketCodec.builder()
.protocolVersion((1 << 30) | 85)
.minecraftVersion("1.19-pre1")
.protocolVersion((1 << 30) | 86)
.minecraftVersion("1.19-pre2")
.state(ProtocolState.HANDSHAKE, PacketStateCodec.builder()
.registerServerboundPacket(0x00, ClientIntentionPacket.class, ClientIntentionPacket::new)
)

View file

@ -2,6 +2,7 @@ package com.github.steveice10.mc.protocol.packet.ingame.clientbound;
import com.github.steveice10.mc.protocol.data.MagicValues;
import com.github.steveice10.mc.protocol.data.game.NBT;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position;
import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode;
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
import com.github.steveice10.packetlib.io.NetInput;
@ -12,6 +13,7 @@ import lombok.Data;
import lombok.NonNull;
import lombok.With;
import javax.annotation.Nullable;
import java.io.IOException;
@Data
@ -37,6 +39,8 @@ public class ClientboundLoginPacket implements Packet {
private final boolean enableRespawnScreen;
private final boolean debug;
private final boolean flat;
private final @Nullable String lastDeathDimension;
private final @Nullable Position lastDeathPos;
public ClientboundLoginPacket(NetInput in) throws IOException {
this.entityId = in.readInt();
@ -61,6 +65,13 @@ public class ClientboundLoginPacket implements Packet {
this.enableRespawnScreen = in.readBoolean();
this.debug = in.readBoolean();
this.flat = in.readBoolean();
if (in.readBoolean()) {
this.lastDeathDimension = in.readString();
this.lastDeathPos = Position.read(in);
} else {
this.lastDeathDimension = null;
this.lastDeathPos = null;
}
}
@Override
@ -87,5 +98,10 @@ public class ClientboundLoginPacket implements Packet {
out.writeBoolean(this.enableRespawnScreen);
out.writeBoolean(this.debug);
out.writeBoolean(this.flat);
out.writeBoolean(this.lastDeathPos != null);
if (this.lastDeathPos != null) {
out.writeString(this.lastDeathDimension);
Position.write(out, this.lastDeathPos);
}
}
}

View file

@ -2,6 +2,7 @@ package com.github.steveice10.mc.protocol.packet.ingame.clientbound;
import com.github.steveice10.mc.protocol.data.MagicValues;
import com.github.steveice10.mc.protocol.data.game.NBT;
import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position;
import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode;
import com.github.steveice10.opennbt.tag.builtin.CompoundTag;
import com.github.steveice10.packetlib.io.NetInput;
@ -12,6 +13,7 @@ import lombok.Data;
import lombok.NonNull;
import lombok.With;
import javax.annotation.Nullable;
import java.io.IOException;
@Data
@ -26,6 +28,8 @@ public class ClientboundRespawnPacket implements Packet {
private final boolean debug;
private final boolean flat;
private final boolean copyMetadata;
private final @Nullable String lastDeathDimension;
private final @Nullable Position lastDeathPos;
public ClientboundRespawnPacket(NetInput in) throws IOException {
this.dimension = in.readString();
@ -36,6 +40,13 @@ public class ClientboundRespawnPacket implements Packet {
this.debug = in.readBoolean();
this.flat = in.readBoolean();
this.copyMetadata = in.readBoolean();
if (in.readBoolean()) {
this.lastDeathDimension = in.readString();
this.lastDeathPos = Position.read(in);
} else {
this.lastDeathDimension = null;
this.lastDeathPos = null;
}
}
@Override
@ -48,5 +59,10 @@ public class ClientboundRespawnPacket implements Packet {
out.writeBoolean(this.debug);
out.writeBoolean(this.flat);
out.writeBoolean(this.copyMetadata);
out.writeBoolean(this.lastDeathPos != null);
if (this.lastDeathPos != null) {
out.writeString(this.lastDeathDimension);
Position.write(out, this.lastDeathPos);
}
}
}

View file

@ -50,7 +50,7 @@ public class MinecraftProtocolTest {
null,
false
);
private static final ClientboundLoginPacket JOIN_GAME_PACKET = new ClientboundLoginPacket(0, false, GameMode.SURVIVAL, GameMode.SURVIVAL, 1, new String[]{"minecraft:world"}, getDimensionTag(), "dimension:overworld", "minecraft:world", 100, 0, 16, 16, false, false, false, false);
private static final ClientboundLoginPacket JOIN_GAME_PACKET = new ClientboundLoginPacket(0, false, GameMode.SURVIVAL, GameMode.SURVIVAL, 1, new String[]{"minecraft:world"}, getDimensionTag(), "dimension:overworld", "minecraft:world", 100, 0, 16, 16, false, false, false, false, null, null);
private static Server server;