Skip to content

Commit b958c38

Browse files
committed
25w20a
1 parent 280be4a commit b958c38

18 files changed

Lines changed: 197 additions & 12 deletions

File tree

protocol/src/main/java/org/geysermc/mcprotocollib/protocol/codec/MinecraftCodec.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package org.geysermc.mcprotocollib.protocol.codec;
22

33
import org.geysermc.mcprotocollib.protocol.data.ProtocolState;
4+
import org.geysermc.mcprotocollib.protocol.packet.common.clientbound.ClientboundClearDialogPacket;
45
import org.geysermc.mcprotocollib.protocol.packet.common.clientbound.ClientboundCustomPayloadPacket;
56
import org.geysermc.mcprotocollib.protocol.packet.common.clientbound.ClientboundCustomReportDetailsPacket;
67
import org.geysermc.mcprotocollib.protocol.packet.common.clientbound.ClientboundDisconnectPacket;
@@ -21,6 +22,7 @@
2122
import org.geysermc.mcprotocollib.protocol.packet.configuration.clientbound.ClientboundRegistryDataPacket;
2223
import org.geysermc.mcprotocollib.protocol.packet.configuration.clientbound.ClientboundResetChatPacket;
2324
import org.geysermc.mcprotocollib.protocol.packet.configuration.clientbound.ClientboundSelectKnownPacks;
25+
import org.geysermc.mcprotocollib.protocol.packet.configuration.clientbound.ClientboundShowDialogConfigurationPacket;
2426
import org.geysermc.mcprotocollib.protocol.packet.configuration.clientbound.ClientboundUpdateEnabledFeaturesPacket;
2527
import org.geysermc.mcprotocollib.protocol.packet.configuration.serverbound.ServerboundFinishConfigurationPacket;
2628
import org.geysermc.mcprotocollib.protocol.packet.configuration.serverbound.ServerboundSelectKnownPacks;
@@ -49,6 +51,7 @@
4951
import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.ClientboundSelectAdvancementsTabPacket;
5052
import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.ClientboundServerDataPacket;
5153
import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.ClientboundSetCameraPacket;
54+
import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.ClientboundShowDialogGamePacket;
5255
import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.ClientboundSoundEntityPacket;
5356
import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.ClientboundStartConfigurationPacket;
5457
import org.geysermc.mcprotocollib.protocol.packet.ingame.clientbound.ClientboundStopSoundPacket;
@@ -156,6 +159,7 @@
156159
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.ServerboundClientTickEndPacket;
157160
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.ServerboundCommandSuggestionPacket;
158161
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.ServerboundConfigurationAcknowledgedPacket;
162+
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.ServerboundCustomClickActionPacket;
159163
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.ServerboundDebugSampleSubscriptionPacket;
160164
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.ServerboundLockDifficultyPacket;
161165
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.ServerboundPlayerLoadedPacket;
@@ -191,6 +195,7 @@
191195
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.level.ServerboundSignUpdatePacket;
192196
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.level.ServerboundTeleportToEntityPacket;
193197
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.level.ServerboundTestInstanceBlockActionPacket;
198+
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.player.ServerboundChangeGameModePacket;
194199
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.player.ServerboundInteractPacket;
195200
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerPosPacket;
196201
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.player.ServerboundMovePlayerPosRotPacket;
@@ -219,8 +224,8 @@
219224

220225
public class MinecraftCodec {
221226
public static final PacketCodec CODEC = PacketCodec.builder()
222-
.protocolVersion((1 << 30) | 249)
223-
.minecraftVersion("25w19a")
227+
.protocolVersion((1 << 30) | 250)
228+
.minecraftVersion("25w20a")
224229
.state(ProtocolState.HANDSHAKE, MinecraftPacketRegistry.builder()
225230
.registerServerboundPacket(ClientIntentionPacket.class, ClientIntentionPacket::new)
226231
)
@@ -259,6 +264,8 @@ public class MinecraftCodec {
259264
.registerClientboundPacket(ClientboundSelectKnownPacks.class, ClientboundSelectKnownPacks::new)
260265
.registerClientboundPacket(ClientboundCustomReportDetailsPacket.class, ClientboundCustomReportDetailsPacket::new)
261266
.registerClientboundPacket(ClientboundServerLinksPacket.class, ClientboundServerLinksPacket::new)
267+
.registerClientboundPacket(ClientboundClearDialogPacket.class, ClientboundClearDialogPacket::new)
268+
.registerClientboundPacket(ClientboundShowDialogConfigurationPacket.class, ClientboundShowDialogConfigurationPacket::new)
262269
.registerServerboundPacket(ServerboundClientInformationPacket.class, ServerboundClientInformationPacket::new)
263270
.registerServerboundPacket(ServerboundCookieResponsePacket.class, ServerboundCookieResponsePacket::new)
264271
.registerServerboundPacket(ServerboundCustomPayloadPacket.class, ServerboundCustomPayloadPacket::new)
@@ -400,10 +407,13 @@ public class MinecraftCodec {
400407
.registerClientboundPacket(ClientboundCustomReportDetailsPacket.class, ClientboundCustomReportDetailsPacket::new)
401408
.registerClientboundPacket(ClientboundServerLinksPacket.class, ClientboundServerLinksPacket::new)
402409
.registerClientboundPacket(ClientboundTrackedWaypointPacket.class, ClientboundTrackedWaypointPacket::new)
410+
.registerClientboundPacket(ClientboundClearDialogPacket.class, ClientboundClearDialogPacket::new)
411+
.registerClientboundPacket(ClientboundShowDialogGamePacket.class, ClientboundShowDialogGamePacket::new)
403412
.registerServerboundPacket(ServerboundAcceptTeleportationPacket.class, ServerboundAcceptTeleportationPacket::new)
404413
.registerServerboundPacket(ServerboundBlockEntityTagQueryPacket.class, ServerboundBlockEntityTagQueryPacket::new)
405414
.registerServerboundPacket(ServerboundSelectBundleItemPacket.class, ServerboundSelectBundleItemPacket::new)
406415
.registerServerboundPacket(ServerboundChangeDifficultyPacket.class, ServerboundChangeDifficultyPacket::new)
416+
.registerServerboundPacket(ServerboundChangeGameModePacket.class, ServerboundChangeGameModePacket::new)
407417
.registerServerboundPacket(ServerboundChatAckPacket.class, ServerboundChatAckPacket::new)
408418
.registerServerboundPacket(ServerboundChatCommandPacket.class, ServerboundChatCommandPacket::new)
409419
.registerServerboundPacket(ServerboundChatCommandSignedPacket.class, ServerboundChatCommandSignedPacket::new)
@@ -464,6 +474,7 @@ public class MinecraftCodec {
464474
.registerServerboundPacket(ServerboundTestInstanceBlockActionPacket.class, ServerboundTestInstanceBlockActionPacket::new)
465475
.registerServerboundPacket(ServerboundUseItemOnPacket.class, ServerboundUseItemOnPacket::new)
466476
.registerServerboundPacket(ServerboundUseItemPacket.class, ServerboundUseItemPacket::new)
477+
.registerServerboundPacket(ServerboundCustomClickActionPacket.class, ServerboundCustomClickActionPacket::new)
467478
)
468479
.build();
469480
}

protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/command/CommandNode.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ public class CommandNode {
2121
*/
2222
private final boolean executable;
2323

24+
/**
25+
* Whether restricted commands are allowed.
26+
*/
27+
private final boolean allowsRestricted;
28+
2429
/**
2530
* Child node indices.
2631
*/

protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/command/CommandParser.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public enum CommandParser {
5656
LOOT_TABLE,
5757
LOOT_PREDICATE,
5858
LOOT_MODIFIER,
59+
DIALOG,
5960
UUID;
6061

6162
private static final CommandParser[] VALUES = values();

protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/command/SuggestionType.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
public enum SuggestionType {
1212
ASK_SERVER,
13-
ALL_RECIPES,
1413
AVAILABLE_SOUNDS,
1514
SUMMONABLE_ENTITIES;
1615

protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/item/component/Equippable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
@Builder(toBuilder = true)
1010
public record Equippable(EquipmentSlot slot, Sound equipSound, @Nullable Key model, @Nullable Key cameraOverlay,
1111
@Nullable HolderSet allowedEntities, boolean dispensable, boolean swappable, boolean damageOnHurt,
12-
boolean equipOnInteract) {
12+
boolean equipOnInteract, boolean canBeSheared, Sound shearingSound) {
1313
}

protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/item/component/ItemTypes.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,9 @@ public static Equippable readEquippable(ByteBuf buf) {
172172
boolean swappable = buf.readBoolean();
173173
boolean damageOnHurt = buf.readBoolean();
174174
boolean equipOnInteract = buf.readBoolean();
175-
return new Equippable(slot, equipSound, model, cameraOverlay, allowedEntities, dispensable, swappable, damageOnHurt, equipOnInteract);
175+
boolean canBeSheared = buf.readBoolean();
176+
Sound shearingSound = MinecraftTypes.readSound(buf);
177+
return new Equippable(slot, equipSound, model, cameraOverlay, allowedEntities, dispensable, swappable, damageOnHurt, equipOnInteract, canBeSheared, shearingSound);
176178
}
177179

178180
public static void writeEquippable(ByteBuf buf, Equippable equippable) {
@@ -185,6 +187,8 @@ public static void writeEquippable(ByteBuf buf, Equippable equippable) {
185187
buf.writeBoolean(equippable.swappable());
186188
buf.writeBoolean(equippable.damageOnHurt());
187189
buf.writeBoolean(equippable.equipOnInteract());
190+
buf.writeBoolean(equippable.canBeSheared());
191+
MinecraftTypes.writeSound(buf, equippable.shearingSound());
188192
}
189193

190194
public static BlocksAttacks readBlocksAttacks(ByteBuf buf) {

protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/level/sound/BuiltinSound.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -955,6 +955,7 @@ public enum BuiltinSound implements Sound {
955955
MUSIC_DISC_CREATOR("music_disc.creator"),
956956
MUSIC_DISC_CREATOR_MUSIC_BOX("music_disc.creator_music_box"),
957957
MUSIC_DISC_PRECIPICE("music_disc.precipice"),
958+
MUSIC_DISC_TEARS("music_disc.tears"),
958959
MUSIC_DRAGON("music.dragon"),
959960
MUSIC_END("music.end"),
960961
MUSIC_GAME("music.game"),

protocol/src/main/java/org/geysermc/mcprotocollib/protocol/data/game/setting/Difficulty.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ public enum Difficulty {
99
private static final Difficulty[] VALUES = values();
1010

1111
public static Difficulty from(int id) {
12-
return VALUES[id];
12+
return VALUES[Math.floorMod(id, VALUES.length)];
1313
}
1414
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package org.geysermc.mcprotocollib.protocol.packet.common.clientbound;
2+
3+
import io.netty.buffer.ByteBuf;
4+
import lombok.AllArgsConstructor;
5+
import lombok.Data;
6+
import lombok.With;
7+
import org.geysermc.mcprotocollib.protocol.codec.MinecraftPacket;
8+
9+
@Data
10+
@With
11+
@AllArgsConstructor
12+
public class ClientboundClearDialogPacket implements MinecraftPacket {
13+
14+
public ClientboundClearDialogPacket(ByteBuf in) {
15+
}
16+
17+
@Override
18+
public void serialize(ByteBuf out) {
19+
}
20+
21+
@Override
22+
public boolean shouldRunOnGameThread() {
23+
return true;
24+
}
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package org.geysermc.mcprotocollib.protocol.packet.configuration.clientbound;
2+
3+
import io.netty.buffer.ByteBuf;
4+
import lombok.AllArgsConstructor;
5+
import lombok.Data;
6+
import lombok.With;
7+
import org.cloudburstmc.nbt.NbtMap;
8+
import org.geysermc.mcprotocollib.protocol.codec.MinecraftPacket;
9+
import org.geysermc.mcprotocollib.protocol.codec.MinecraftTypes;
10+
11+
@Data
12+
@With
13+
@AllArgsConstructor
14+
public class ClientboundShowDialogConfigurationPacket implements MinecraftPacket {
15+
private final NbtMap dialog;
16+
17+
public ClientboundShowDialogConfigurationPacket(ByteBuf in) {
18+
this.dialog = MinecraftTypes.readCompoundTag(in);
19+
}
20+
21+
@Override
22+
public void serialize(ByteBuf out) {
23+
MinecraftTypes.writeAnyTag(out, this.dialog);
24+
}
25+
26+
@Override
27+
public boolean shouldRunOnGameThread() {
28+
return true;
29+
}
30+
}

0 commit comments

Comments
 (0)