Skip to content

Commit

Permalink
1.20.2-pre1
Browse files Browse the repository at this point in the history
  • Loading branch information
basaigh committed Sep 6, 2023
1 parent 182022e commit 1c57135
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.github.steveice10.mc.protocol.codec.MinecraftCodec;
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.PlayerSpawnInfo;
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.VersionInfo;
Expand Down Expand Up @@ -87,15 +88,18 @@ public static void main(String[] args) {
16,
false,
false,
"minecraft:overworld",
"minecraft:world",
100,
GameMode.SURVIVAL,
GameMode.SURVIVAL,
false,
false,
null,
100
new PlayerSpawnInfo(
"minecraft:overworld",
"minecraft:world",
100,
GameMode.SURVIVAL,
GameMode.SURVIVAL,
false,
false,
null,
100
)
))
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
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.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.common.serverbound.ServerboundCustomPayloadPacket;
import com.github.steveice10.mc.protocol.packet.common.serverbound.ServerboundKeepAlivePacket;
Expand Down Expand Up @@ -208,9 +208,9 @@ public class MinecraftCodec {
}

public static final PacketCodec CODEC = PacketCodec.builder()
.protocolVersion((1 << 30) | 147)
.protocolVersion((1 << 30) | 148)
.helper(() -> new MinecraftCodecHelper(LEVEL_EVENTS, SOUND_NAMES))
.minecraftVersion("23w35a")
.minecraftVersion("1.20.2-pre1")
.state(ProtocolState.HANDSHAKE, PacketStateCodec.builder()
.registerServerboundPacket(0x00, ClientIntentionPacket.class, ClientIntentionPacket::new)
)
Expand Down Expand Up @@ -239,11 +239,12 @@ public class MinecraftCodec {
.registerClientboundPacket(0x06, ClientboundResourcePackPacket.class, ClientboundResourcePackPacket::new)
.registerClientboundPacket(0x07, ClientboundUpdateEnabledFeaturesPacket.class, ClientboundUpdateEnabledFeaturesPacket::new)
.registerClientboundPacket(0x08, ClientboundUpdateTagsPacket.class, ClientboundUpdateTagsPacket::new)
.registerServerboundPacket(0x00, ServerboundCustomPayloadPacket.class, ServerboundCustomPayloadPacket::new)
.registerServerboundPacket(0x01, ServerboundFinishConfigurationPacket.class, ServerboundFinishConfigurationPacket::new)
.registerServerboundPacket(0x02, ServerboundKeepAlivePacket.class, ServerboundKeepAlivePacket::new)
.registerServerboundPacket(0x03, ServerboundPongPacket.class, ServerboundPongPacket::new)
.registerClientboundPacket(0x04, ServerboundResourcePackPacket.class, ServerboundResourcePackPacket::new)
.registerServerboundPacket(0x00, ServerboundClientInformationPacket.class, ServerboundClientInformationPacket::new)
.registerServerboundPacket(0x01, ServerboundCustomPayloadPacket.class, ServerboundCustomPayloadPacket::new)
.registerServerboundPacket(0x02, ServerboundFinishConfigurationPacket.class, ServerboundFinishConfigurationPacket::new)
.registerServerboundPacket(0x03, ServerboundKeepAlivePacket.class, ServerboundKeepAlivePacket::new)
.registerServerboundPacket(0x04, ServerboundPongPacket.class, ServerboundPongPacket::new)
.registerClientboundPacket(0x05, ServerboundResourcePackPacket.class, ServerboundResourcePackPacket::new)
).state(ProtocolState.GAME, PacketStateCodec.builder()
.registerClientboundPacket(0x00, ClientboundDelimiterPacket.class, ClientboundDelimiterPacket::new)
.registerClientboundPacket(0x01, ClientboundAddEntityPacket.class, ClientboundAddEntityPacket::new)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,14 @@ public enum MapIconType {
GREEN_BANNER,
RED_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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ public enum GameEvent {
THUNDER_STRENGTH,
PUFFERFISH_STING_SOUND,
AFFECTED_BY_ELDER_GUARDIAN,
ENABLE_RESPAWN_SCREEN;
ENABLE_RESPAWN_SCREEN,
LIMITED_CRAFTING;

private static final GameEvent[] VALUES = values();

Expand Down
Original file line number Diff line number Diff line change
@@ -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];
}
}
Original file line number Diff line number Diff line change
@@ -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.MinecraftPacket;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public class ClientboundLoginPacket implements MinecraftPacket {
private final int simulationDistance;
private final boolean reducedDebugInfo;
private final boolean enableRespawnScreen;
private final boolean doLimitedCrafting;
private final PlayerSpawnInfo commonPlayerSpawnInfo;

public ClientboundLoginPacket(ByteBuf in, MinecraftCodecHelper helper) throws IOException {
Expand All @@ -42,6 +43,7 @@ public ClientboundLoginPacket(ByteBuf in, MinecraftCodecHelper helper) throws IO
this.simulationDistance = helper.readVarInt(in);
this.reducedDebugInfo = in.readBoolean();
this.enableRespawnScreen = in.readBoolean();
this.doLimitedCrafting = in.readBoolean();
this.commonPlayerSpawnInfo = helper.readPlayerSpawnInfo(in);
}

Expand All @@ -58,6 +60,7 @@ public void serialize(ByteBuf out, MinecraftCodecHelper helper) throws IOExcepti
helper.writeVarInt(out, this.simulationDistance);
out.writeBoolean(this.reducedDebugInfo);
out.writeBoolean(this.enableRespawnScreen);
out.writeBoolean(this.doLimitedCrafting);
helper.writePlayerSpawnInfo(out, this.commonPlayerSpawnInfo);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public ClientboundGameEventPacket(ByteBuf in, MinecraftCodecHelper helper) {
this.value = EnterCreditsValue.from((int) value);
} else if (this.notification == GameEvent.ENABLE_RESPAWN_SCREEN) {
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) {
this.value = new RainStrengthValue(value);
} else if (this.notification == GameEvent.THUNDER_STRENGTH) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

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.PlayerSpawnInfo;
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.VersionInfo;
Expand Down Expand Up @@ -51,7 +52,7 @@ public class MinecraftProtocolTest {
null,
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;

Expand Down

0 comments on commit 1c57135

Please sign in to comment.