1.20.2-pre1

This commit is contained in:
basaigh 2023-09-06 18:04:10 +01:00
parent 182022e061
commit 1c57135e6c
9 changed files with 51 additions and 20 deletions

View file

@ -11,6 +11,7 @@ import com.github.steveice10.mc.protocol.ServerLoginHandler;
import com.github.steveice10.mc.protocol.codec.MinecraftCodec; import com.github.steveice10.mc.protocol.codec.MinecraftCodec;
import com.github.steveice10.mc.protocol.data.ProtocolState; import com.github.steveice10.mc.protocol.data.ProtocolState;
import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode;
import com.github.steveice10.mc.protocol.data.game.entity.player.PlayerSpawnInfo;
import com.github.steveice10.mc.protocol.data.status.PlayerInfo; import com.github.steveice10.mc.protocol.data.status.PlayerInfo;
import com.github.steveice10.mc.protocol.data.status.ServerStatusInfo; import com.github.steveice10.mc.protocol.data.status.ServerStatusInfo;
import com.github.steveice10.mc.protocol.data.status.VersionInfo; import com.github.steveice10.mc.protocol.data.status.VersionInfo;
@ -87,15 +88,18 @@ public class MinecraftProtocolTest {
16, 16,
false, false,
false, false,
"minecraft:overworld",
"minecraft:world",
100,
GameMode.SURVIVAL,
GameMode.SURVIVAL,
false, false,
false, new PlayerSpawnInfo(
null, "minecraft:overworld",
100 "minecraft:world",
100,
GameMode.SURVIVAL,
GameMode.SURVIVAL,
false,
false,
null,
100
)
)) ))
); );

View file

@ -127,7 +127,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundCh
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundChatPacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundChatPacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundChatSessionUpdatePacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundChatSessionUpdatePacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundClientCommandPacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundClientCommandPacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundClientInformationPacket; import com.github.steveice10.mc.protocol.packet.common.serverbound.ServerboundClientInformationPacket;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundCommandSuggestionPacket; import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundCommandSuggestionPacket;
import com.github.steveice10.mc.protocol.packet.common.serverbound.ServerboundCustomPayloadPacket; import com.github.steveice10.mc.protocol.packet.common.serverbound.ServerboundCustomPayloadPacket;
import com.github.steveice10.mc.protocol.packet.common.serverbound.ServerboundKeepAlivePacket; import com.github.steveice10.mc.protocol.packet.common.serverbound.ServerboundKeepAlivePacket;
@ -208,9 +208,9 @@ public class MinecraftCodec {
} }
public static final PacketCodec CODEC = PacketCodec.builder() public static final PacketCodec CODEC = PacketCodec.builder()
.protocolVersion((1 << 30) | 147) .protocolVersion((1 << 30) | 148)
.helper(() -> new MinecraftCodecHelper(LEVEL_EVENTS, SOUND_NAMES)) .helper(() -> new MinecraftCodecHelper(LEVEL_EVENTS, SOUND_NAMES))
.minecraftVersion("23w35a") .minecraftVersion("1.20.2-pre1")
.state(ProtocolState.HANDSHAKE, PacketStateCodec.builder() .state(ProtocolState.HANDSHAKE, PacketStateCodec.builder()
.registerServerboundPacket(0x00, ClientIntentionPacket.class, ClientIntentionPacket::new) .registerServerboundPacket(0x00, ClientIntentionPacket.class, ClientIntentionPacket::new)
) )
@ -239,11 +239,12 @@ public class MinecraftCodec {
.registerClientboundPacket(0x06, ClientboundResourcePackPacket.class, ClientboundResourcePackPacket::new) .registerClientboundPacket(0x06, ClientboundResourcePackPacket.class, ClientboundResourcePackPacket::new)
.registerClientboundPacket(0x07, ClientboundUpdateEnabledFeaturesPacket.class, ClientboundUpdateEnabledFeaturesPacket::new) .registerClientboundPacket(0x07, ClientboundUpdateEnabledFeaturesPacket.class, ClientboundUpdateEnabledFeaturesPacket::new)
.registerClientboundPacket(0x08, ClientboundUpdateTagsPacket.class, ClientboundUpdateTagsPacket::new) .registerClientboundPacket(0x08, ClientboundUpdateTagsPacket.class, ClientboundUpdateTagsPacket::new)
.registerServerboundPacket(0x00, ServerboundCustomPayloadPacket.class, ServerboundCustomPayloadPacket::new) .registerServerboundPacket(0x00, ServerboundClientInformationPacket.class, ServerboundClientInformationPacket::new)
.registerServerboundPacket(0x01, ServerboundFinishConfigurationPacket.class, ServerboundFinishConfigurationPacket::new) .registerServerboundPacket(0x01, ServerboundCustomPayloadPacket.class, ServerboundCustomPayloadPacket::new)
.registerServerboundPacket(0x02, ServerboundKeepAlivePacket.class, ServerboundKeepAlivePacket::new) .registerServerboundPacket(0x02, ServerboundFinishConfigurationPacket.class, ServerboundFinishConfigurationPacket::new)
.registerServerboundPacket(0x03, ServerboundPongPacket.class, ServerboundPongPacket::new) .registerServerboundPacket(0x03, ServerboundKeepAlivePacket.class, ServerboundKeepAlivePacket::new)
.registerClientboundPacket(0x04, ServerboundResourcePackPacket.class, ServerboundResourcePackPacket::new) .registerServerboundPacket(0x04, ServerboundPongPacket.class, ServerboundPongPacket::new)
.registerClientboundPacket(0x05, ServerboundResourcePackPacket.class, ServerboundResourcePackPacket::new)
).state(ProtocolState.GAME, PacketStateCodec.builder() ).state(ProtocolState.GAME, PacketStateCodec.builder()
.registerClientboundPacket(0x00, ClientboundDelimiterPacket.class, ClientboundDelimiterPacket::new) .registerClientboundPacket(0x00, ClientboundDelimiterPacket.class, ClientboundDelimiterPacket::new)
.registerClientboundPacket(0x01, ClientboundAddEntityPacket.class, ClientboundAddEntityPacket::new) .registerClientboundPacket(0x01, ClientboundAddEntityPacket.class, ClientboundAddEntityPacket::new)

View file

@ -27,7 +27,14 @@ public enum MapIconType {
GREEN_BANNER, GREEN_BANNER,
RED_BANNER, RED_BANNER,
BLACK_BANNER, BLACK_BANNER,
TREASURE_MARKER; TREASURE_MARKER,
DESERT_VILLAGE,
PLAINS_VILLAGE,
SAVANNA_VILLAGE,
SNOWY_VILLAGE,
TAIGA_VILLAGE,
JUNGLE_TEMPLE,
SWAMP_HUT;
private static final MapIconType[] VALUES = values(); private static final MapIconType[] VALUES = values();

View file

@ -12,7 +12,8 @@ public enum GameEvent {
THUNDER_STRENGTH, THUNDER_STRENGTH,
PUFFERFISH_STING_SOUND, PUFFERFISH_STING_SOUND,
AFFECTED_BY_ELDER_GUARDIAN, AFFECTED_BY_ELDER_GUARDIAN,
ENABLE_RESPAWN_SCREEN; ENABLE_RESPAWN_SCREEN,
LIMITED_CRAFTING;
private static final GameEvent[] VALUES = values(); private static final GameEvent[] VALUES = values();

View file

@ -0,0 +1,12 @@
package com.github.steveice10.mc.protocol.data.game.level.notify;
public enum LimitedCraftingValue implements GameEventValue {
UNLIMITED_CRAFTING,
LIMITED_CRAFTING;
private static final LimitedCraftingValue[] VALUES = values();
public static LimitedCraftingValue from(int id) {
return VALUES[id];
}
}

View file

@ -1,4 +1,4 @@
package com.github.steveice10.mc.protocol.packet.ingame.serverbound; package com.github.steveice10.mc.protocol.packet.common.serverbound;
import com.github.steveice10.mc.protocol.codec.MinecraftCodecHelper; import com.github.steveice10.mc.protocol.codec.MinecraftCodecHelper;
import com.github.steveice10.mc.protocol.codec.MinecraftPacket; import com.github.steveice10.mc.protocol.codec.MinecraftPacket;

View file

@ -27,6 +27,7 @@ public class ClientboundLoginPacket implements MinecraftPacket {
private final int simulationDistance; private final int simulationDistance;
private final boolean reducedDebugInfo; private final boolean reducedDebugInfo;
private final boolean enableRespawnScreen; private final boolean enableRespawnScreen;
private final boolean doLimitedCrafting;
private final PlayerSpawnInfo commonPlayerSpawnInfo; private final PlayerSpawnInfo commonPlayerSpawnInfo;
public ClientboundLoginPacket(ByteBuf in, MinecraftCodecHelper helper) throws IOException { public ClientboundLoginPacket(ByteBuf in, MinecraftCodecHelper helper) throws IOException {
@ -42,6 +43,7 @@ public class ClientboundLoginPacket implements MinecraftPacket {
this.simulationDistance = helper.readVarInt(in); this.simulationDistance = helper.readVarInt(in);
this.reducedDebugInfo = in.readBoolean(); this.reducedDebugInfo = in.readBoolean();
this.enableRespawnScreen = in.readBoolean(); this.enableRespawnScreen = in.readBoolean();
this.doLimitedCrafting = in.readBoolean();
this.commonPlayerSpawnInfo = helper.readPlayerSpawnInfo(in); this.commonPlayerSpawnInfo = helper.readPlayerSpawnInfo(in);
} }
@ -58,6 +60,7 @@ public class ClientboundLoginPacket implements MinecraftPacket {
helper.writeVarInt(out, this.simulationDistance); helper.writeVarInt(out, this.simulationDistance);
out.writeBoolean(this.reducedDebugInfo); out.writeBoolean(this.reducedDebugInfo);
out.writeBoolean(this.enableRespawnScreen); out.writeBoolean(this.enableRespawnScreen);
out.writeBoolean(this.doLimitedCrafting);
helper.writePlayerSpawnInfo(out, this.commonPlayerSpawnInfo); helper.writePlayerSpawnInfo(out, this.commonPlayerSpawnInfo);
} }
} }

View file

@ -31,6 +31,8 @@ public class ClientboundGameEventPacket implements MinecraftPacket {
this.value = EnterCreditsValue.from((int) value); this.value = EnterCreditsValue.from((int) value);
} else if (this.notification == GameEvent.ENABLE_RESPAWN_SCREEN) { } else if (this.notification == GameEvent.ENABLE_RESPAWN_SCREEN) {
this.value = RespawnScreenValue.from((int) value); this.value = RespawnScreenValue.from((int) value);
} else if (this.notification == GameEvent.LIMITED_CRAFTING) {
this.value = LimitedCraftingValue.from((int) value);
} else if (this.notification == GameEvent.RAIN_STRENGTH) { } else if (this.notification == GameEvent.RAIN_STRENGTH) {
this.value = new RainStrengthValue(value); this.value = new RainStrengthValue(value);
} else if (this.notification == GameEvent.THUNDER_STRENGTH) { } else if (this.notification == GameEvent.THUNDER_STRENGTH) {

View file

@ -2,6 +2,7 @@ package com.github.steveice10.mc.protocol;
import com.github.steveice10.mc.protocol.codec.MinecraftCodec; import com.github.steveice10.mc.protocol.codec.MinecraftCodec;
import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode; import com.github.steveice10.mc.protocol.data.game.entity.player.GameMode;
import com.github.steveice10.mc.protocol.data.game.entity.player.PlayerSpawnInfo;
import com.github.steveice10.mc.protocol.data.status.PlayerInfo; import com.github.steveice10.mc.protocol.data.status.PlayerInfo;
import com.github.steveice10.mc.protocol.data.status.ServerStatusInfo; import com.github.steveice10.mc.protocol.data.status.ServerStatusInfo;
import com.github.steveice10.mc.protocol.data.status.VersionInfo; import com.github.steveice10.mc.protocol.data.status.VersionInfo;
@ -51,7 +52,7 @@ public class MinecraftProtocolTest {
null, null,
false false
); );
private static final ClientboundLoginPacket JOIN_GAME_PACKET = new ClientboundLoginPacket(0, false, new String[]{"minecraft:world"}, 0, 16, 16, false, false, "overworld", "minecraft:world", 100, GameMode.SURVIVAL, GameMode.SURVIVAL, false, false, null, 100); private static final ClientboundLoginPacket JOIN_GAME_PACKET = new ClientboundLoginPacket(0, false, new String[]{"minecraft:world"}, 0, 16, 16, false, false, false, new PlayerSpawnInfo("overworld", "minecraft:world", 100, GameMode.SURVIVAL, GameMode.SURVIVAL, false, false, null, 100));
private static Server server; private static Server server;