mirror of
https://github.com/GeyserMC/MCProtocolLib.git
synced 2024-12-27 16:12:23 -05:00
24w44a
This commit is contained in:
parent
8150091888
commit
2e07e5b805
15 changed files with 90 additions and 28 deletions
|
@ -3,7 +3,7 @@ plugins {
|
||||||
jacoco
|
jacoco
|
||||||
}
|
}
|
||||||
|
|
||||||
version = "1.21.2-SNAPSHOT"
|
version = "1.21.4-SNAPSHOT"
|
||||||
description = "MCProtocolLib is a simple library for communicating with Minecraft clients and servers."
|
description = "MCProtocolLib is a simple library for communicating with Minecraft clients and servers."
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
|
@ -162,7 +162,8 @@ import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.inventory.S
|
||||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.inventory.ServerboundContainerClosePacket;
|
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.inventory.ServerboundContainerClosePacket;
|
||||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.inventory.ServerboundContainerSlotStateChangedPacket;
|
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.inventory.ServerboundContainerSlotStateChangedPacket;
|
||||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.inventory.ServerboundEditBookPacket;
|
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.inventory.ServerboundEditBookPacket;
|
||||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.inventory.ServerboundPickItemPacket;
|
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.inventory.ServerboundPickItemFromBlockPacket;
|
||||||
|
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.inventory.ServerboundPickItemFromEntityPacket;
|
||||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.inventory.ServerboundPlaceRecipePacket;
|
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.inventory.ServerboundPlaceRecipePacket;
|
||||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.inventory.ServerboundRecipeBookChangeSettingsPacket;
|
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.inventory.ServerboundRecipeBookChangeSettingsPacket;
|
||||||
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.inventory.ServerboundRecipeBookSeenRecipePacket;
|
import org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.inventory.ServerboundRecipeBookSeenRecipePacket;
|
||||||
|
@ -214,9 +215,9 @@ import org.geysermc.mcprotocollib.protocol.packet.status.serverbound.Serverbound
|
||||||
|
|
||||||
public class MinecraftCodec {
|
public class MinecraftCodec {
|
||||||
public static final PacketCodec CODEC = PacketCodec.builder()
|
public static final PacketCodec CODEC = PacketCodec.builder()
|
||||||
.protocolVersion(768)
|
.protocolVersion((1 << 30) | 220)
|
||||||
.helper(MinecraftCodecHelper::new)
|
.helper(MinecraftCodecHelper::new)
|
||||||
.minecraftVersion("1.21.3")
|
.minecraftVersion("24w44a")
|
||||||
.state(ProtocolState.HANDSHAKE, MinecraftPacketRegistry.builder()
|
.state(ProtocolState.HANDSHAKE, MinecraftPacketRegistry.builder()
|
||||||
.registerServerboundPacket(ClientIntentionPacket.class, ClientIntentionPacket::new)
|
.registerServerboundPacket(ClientIntentionPacket.class, ClientIntentionPacket::new)
|
||||||
)
|
)
|
||||||
|
@ -429,7 +430,8 @@ public class MinecraftCodec {
|
||||||
.registerServerboundPacket(ServerboundMovePlayerStatusOnlyPacket.class, ServerboundMovePlayerStatusOnlyPacket::new)
|
.registerServerboundPacket(ServerboundMovePlayerStatusOnlyPacket.class, ServerboundMovePlayerStatusOnlyPacket::new)
|
||||||
.registerServerboundPacket(ServerboundMoveVehiclePacket.class, ServerboundMoveVehiclePacket::new)
|
.registerServerboundPacket(ServerboundMoveVehiclePacket.class, ServerboundMoveVehiclePacket::new)
|
||||||
.registerServerboundPacket(ServerboundPaddleBoatPacket.class, ServerboundPaddleBoatPacket::new)
|
.registerServerboundPacket(ServerboundPaddleBoatPacket.class, ServerboundPaddleBoatPacket::new)
|
||||||
.registerServerboundPacket(ServerboundPickItemPacket.class, ServerboundPickItemPacket::new)
|
.registerServerboundPacket(ServerboundPickItemFromBlockPacket.class, ServerboundPickItemFromBlockPacket::new)
|
||||||
|
.registerServerboundPacket(ServerboundPickItemFromEntityPacket.class, ServerboundPickItemFromEntityPacket::new)
|
||||||
.registerServerboundPacket(ServerboundPingRequestPacket.class, ServerboundPingRequestPacket::new)
|
.registerServerboundPacket(ServerboundPingRequestPacket.class, ServerboundPingRequestPacket::new)
|
||||||
.registerServerboundPacket(ServerboundPlaceRecipePacket.class, ServerboundPlaceRecipePacket::new)
|
.registerServerboundPacket(ServerboundPlaceRecipePacket.class, ServerboundPlaceRecipePacket::new)
|
||||||
.registerServerboundPacket(ServerboundPlayerAbilitiesPacket.class, ServerboundPlayerAbilitiesPacket::new)
|
.registerServerboundPacket(ServerboundPlayerAbilitiesPacket.class, ServerboundPlayerAbilitiesPacket::new)
|
||||||
|
|
|
@ -73,7 +73,7 @@ import org.geysermc.mcprotocollib.protocol.data.game.level.particle.ParticleData
|
||||||
import org.geysermc.mcprotocollib.protocol.data.game.level.particle.ParticleType;
|
import org.geysermc.mcprotocollib.protocol.data.game.level.particle.ParticleType;
|
||||||
import org.geysermc.mcprotocollib.protocol.data.game.level.particle.SculkChargeParticleData;
|
import org.geysermc.mcprotocollib.protocol.data.game.level.particle.SculkChargeParticleData;
|
||||||
import org.geysermc.mcprotocollib.protocol.data.game.level.particle.ShriekParticleData;
|
import org.geysermc.mcprotocollib.protocol.data.game.level.particle.ShriekParticleData;
|
||||||
import org.geysermc.mcprotocollib.protocol.data.game.level.particle.TargetColorParticleData;
|
import org.geysermc.mcprotocollib.protocol.data.game.level.particle.TraiParticleData;
|
||||||
import org.geysermc.mcprotocollib.protocol.data.game.level.particle.VibrationParticleData;
|
import org.geysermc.mcprotocollib.protocol.data.game.level.particle.VibrationParticleData;
|
||||||
import org.geysermc.mcprotocollib.protocol.data.game.level.particle.positionsource.BlockPositionSource;
|
import org.geysermc.mcprotocollib.protocol.data.game.level.particle.positionsource.BlockPositionSource;
|
||||||
import org.geysermc.mcprotocollib.protocol.data.game.level.particle.positionsource.EntityPositionSource;
|
import org.geysermc.mcprotocollib.protocol.data.game.level.particle.positionsource.EntityPositionSource;
|
||||||
|
@ -725,7 +725,7 @@ public class MinecraftCodecHelper extends BasePacketCodecHelper {
|
||||||
case ITEM -> new ItemParticleData(this.readOptionalItemStack(buf));
|
case ITEM -> new ItemParticleData(this.readOptionalItemStack(buf));
|
||||||
case SCULK_CHARGE -> new SculkChargeParticleData(buf.readFloat());
|
case SCULK_CHARGE -> new SculkChargeParticleData(buf.readFloat());
|
||||||
case SHRIEK -> new ShriekParticleData(this.readVarInt(buf));
|
case SHRIEK -> new ShriekParticleData(this.readVarInt(buf));
|
||||||
case TRAIL -> new TargetColorParticleData(Vector3d.from(buf.readDouble(), buf.readDouble(), buf.readDouble()), buf.readInt());
|
case TRAIL -> new TraiParticleData(Vector3d.from(buf.readDouble(), buf.readDouble(), buf.readDouble()), buf.readInt(), this.readVarInt(buf));
|
||||||
case VIBRATION -> new VibrationParticleData(this.readPositionSource(buf), this.readVarInt(buf));
|
case VIBRATION -> new VibrationParticleData(this.readPositionSource(buf), this.readVarInt(buf));
|
||||||
default -> null;
|
default -> null;
|
||||||
};
|
};
|
||||||
|
@ -765,11 +765,12 @@ public class MinecraftCodecHelper extends BasePacketCodecHelper {
|
||||||
this.writeVarInt(buf, shriekData.getDelay());
|
this.writeVarInt(buf, shriekData.getDelay());
|
||||||
}
|
}
|
||||||
case TRAIL -> {
|
case TRAIL -> {
|
||||||
TargetColorParticleData targetColorData = (TargetColorParticleData) data;
|
TraiParticleData trailData = (TraiParticleData) data;
|
||||||
buf.writeDouble(targetColorData.target().getX());
|
buf.writeDouble(trailData.target().getX());
|
||||||
buf.writeDouble(targetColorData.target().getY());
|
buf.writeDouble(trailData.target().getY());
|
||||||
buf.writeDouble(targetColorData.target().getZ());
|
buf.writeDouble(trailData.target().getZ());
|
||||||
buf.writeInt(targetColorData.color());
|
buf.writeInt(trailData.color());
|
||||||
|
this.writeVarInt(buf, trailData.duration());
|
||||||
}
|
}
|
||||||
case VIBRATION -> {
|
case VIBRATION -> {
|
||||||
VibrationParticleData vibrationData = (VibrationParticleData) data;
|
VibrationParticleData vibrationData = (VibrationParticleData) data;
|
||||||
|
|
|
@ -20,6 +20,7 @@ public class PlayerListEntry {
|
||||||
private int latency;
|
private int latency;
|
||||||
private GameMode gameMode;
|
private GameMode gameMode;
|
||||||
private @Nullable Component displayName;
|
private @Nullable Component displayName;
|
||||||
|
private boolean showHat;
|
||||||
private int listOrder;
|
private int listOrder;
|
||||||
private UUID sessionId;
|
private UUID sessionId;
|
||||||
private long expiresAt;
|
private long expiresAt;
|
||||||
|
@ -27,6 +28,6 @@ public class PlayerListEntry {
|
||||||
private byte @Nullable [] keySignature;
|
private byte @Nullable [] keySignature;
|
||||||
|
|
||||||
public PlayerListEntry(UUID profileId) {
|
public PlayerListEntry(UUID profileId) {
|
||||||
this(profileId, null, false, 0, GameMode.SURVIVAL, null, 0, null, 0, null, null);
|
this(profileId, null, false, 0, GameMode.SURVIVAL, null, false, 0, null, 0, null, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ public enum PlayerListEntryAction {
|
||||||
UPDATE_LISTED,
|
UPDATE_LISTED,
|
||||||
UPDATE_LATENCY,
|
UPDATE_LATENCY,
|
||||||
UPDATE_DISPLAY_NAME,
|
UPDATE_DISPLAY_NAME,
|
||||||
|
UPDATE_HAT,
|
||||||
UPDATE_LIST_ORDER;
|
UPDATE_LIST_ORDER;
|
||||||
|
|
||||||
public static final PlayerListEntryAction[] VALUES = values();
|
public static final PlayerListEntryAction[] VALUES = values();
|
||||||
|
|
|
@ -35,6 +35,7 @@ public enum ParticleType {
|
||||||
FLAME,
|
FLAME,
|
||||||
INFESTED,
|
INFESTED,
|
||||||
CHERRY_LEAVES,
|
CHERRY_LEAVES,
|
||||||
|
PALE_OAK_LEAVES,
|
||||||
SCULK_SOUL,
|
SCULK_SOUL,
|
||||||
SCULK_CHARGE,
|
SCULK_CHARGE,
|
||||||
SCULK_CHARGE_POP,
|
SCULK_CHARGE_POP,
|
||||||
|
|
|
@ -2,5 +2,5 @@ package org.geysermc.mcprotocollib.protocol.data.game.level.particle;
|
||||||
|
|
||||||
import org.cloudburstmc.math.vector.Vector3d;
|
import org.cloudburstmc.math.vector.Vector3d;
|
||||||
|
|
||||||
public record TargetColorParticleData(Vector3d target, int color) implements ParticleData {
|
public record TraiParticleData(Vector3d target, int color, int duration) implements ParticleData {
|
||||||
}
|
}
|
|
@ -391,6 +391,7 @@ public enum BuiltinSound implements Sound {
|
||||||
ENTITY_CREAKING_UNFREEZE("entity.creaking.unfreeze"),
|
ENTITY_CREAKING_UNFREEZE("entity.creaking.unfreeze"),
|
||||||
ENTITY_CREAKING_SPAWN("entity.creaking.spawn"),
|
ENTITY_CREAKING_SPAWN("entity.creaking.spawn"),
|
||||||
ENTITY_CREAKING_SWAY("entity.creaking.sway"),
|
ENTITY_CREAKING_SWAY("entity.creaking.sway"),
|
||||||
|
ENTITY_CREAKING_TWITCH("entity.creaking.twitch"),
|
||||||
BLOCK_CREAKING_HEART_BREAK("block.creaking_heart.break"),
|
BLOCK_CREAKING_HEART_BREAK("block.creaking_heart.break"),
|
||||||
BLOCK_CREAKING_HEART_FALL("block.creaking_heart.fall"),
|
BLOCK_CREAKING_HEART_FALL("block.creaking_heart.fall"),
|
||||||
BLOCK_CREAKING_HEART_HIT("block.creaking_heart.hit"),
|
BLOCK_CREAKING_HEART_HIT("block.creaking_heart.hit"),
|
||||||
|
@ -529,6 +530,11 @@ public enum BuiltinSound implements Sound {
|
||||||
ENTITY_EVOKER_PREPARE_WOLOLO("entity.evoker.prepare_wololo"),
|
ENTITY_EVOKER_PREPARE_WOLOLO("entity.evoker.prepare_wololo"),
|
||||||
ENTITY_EXPERIENCE_BOTTLE_THROW("entity.experience_bottle.throw"),
|
ENTITY_EXPERIENCE_BOTTLE_THROW("entity.experience_bottle.throw"),
|
||||||
ENTITY_EXPERIENCE_ORB_PICKUP("entity.experience_orb.pickup"),
|
ENTITY_EXPERIENCE_ORB_PICKUP("entity.experience_orb.pickup"),
|
||||||
|
BLOCK_EYEBLOSSOM_OPEN_LONG("block.eyeblossom.open_long"),
|
||||||
|
BLOCK_EYEBLOSSOM_OPEN("block.eyeblossom.open"),
|
||||||
|
BLOCK_EYEBLOSSOM_CLOSE_LONG("block.eyeblossom.close_long"),
|
||||||
|
BLOCK_EYEBLOSSOM_CLOSE("block.eyeblossom.close"),
|
||||||
|
BLOCK_EYEBLOSSOM_IDLE("block.eyeblossom.idle"),
|
||||||
BLOCK_FENCE_GATE_CLOSE("block.fence_gate.close"),
|
BLOCK_FENCE_GATE_CLOSE("block.fence_gate.close"),
|
||||||
BLOCK_FENCE_GATE_OPEN("block.fence_gate.open"),
|
BLOCK_FENCE_GATE_OPEN("block.fence_gate.open"),
|
||||||
ITEM_FIRECHARGE_USE("item.firecharge.use"),
|
ITEM_FIRECHARGE_USE("item.firecharge.use"),
|
||||||
|
@ -1329,6 +1335,16 @@ public enum BuiltinSound implements Sound {
|
||||||
BLOCK_SPAWNER_HIT("block.spawner.hit"),
|
BLOCK_SPAWNER_HIT("block.spawner.hit"),
|
||||||
BLOCK_SPAWNER_PLACE("block.spawner.place"),
|
BLOCK_SPAWNER_PLACE("block.spawner.place"),
|
||||||
BLOCK_SPAWNER_STEP("block.spawner.step"),
|
BLOCK_SPAWNER_STEP("block.spawner.step"),
|
||||||
|
BLOCK_RESIN_BREAK("block.resin.break"),
|
||||||
|
BLOCK_RESIN_FALL("block.resin.fall"),
|
||||||
|
BLOCK_RESIN_HIT("block.resin.hit"),
|
||||||
|
BLOCK_RESIN_PLACE("block.resin.place"),
|
||||||
|
BLOCK_RESIN_STEP("block.resin.step"),
|
||||||
|
BLOCK_RESIN_BRICKS_BREAK("block.resin_bricks.break"),
|
||||||
|
BLOCK_RESIN_BRICKS_FALL("block.resin_bricks.fall"),
|
||||||
|
BLOCK_RESIN_BRICKS_HIT("block.resin_bricks.hit"),
|
||||||
|
BLOCK_RESIN_BRICKS_PLACE("block.resin_bricks.place"),
|
||||||
|
BLOCK_RESIN_BRICKS_STEP("block.resin_bricks.step"),
|
||||||
BLOCK_SPORE_BLOSSOM_BREAK("block.spore_blossom.break"),
|
BLOCK_SPORE_BLOSSOM_BREAK("block.spore_blossom.break"),
|
||||||
BLOCK_SPORE_BLOSSOM_FALL("block.spore_blossom.fall"),
|
BLOCK_SPORE_BLOSSOM_FALL("block.spore_blossom.fall"),
|
||||||
BLOCK_SPORE_BLOSSOM_HIT("block.spore_blossom.hit"),
|
BLOCK_SPORE_BLOSSOM_HIT("block.spore_blossom.hit"),
|
||||||
|
|
|
@ -80,6 +80,11 @@ public class ClientboundPlayerInfoUpdatePacket implements MinecraftPacket {
|
||||||
|
|
||||||
entry.setListOrder(listOrder);
|
entry.setListOrder(listOrder);
|
||||||
}
|
}
|
||||||
|
case UPDATE_HAT -> {
|
||||||
|
boolean showHat = in.readBoolean();
|
||||||
|
|
||||||
|
entry.setShowHat(showHat);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,6 +122,7 @@ public class ClientboundPlayerInfoUpdatePacket implements MinecraftPacket {
|
||||||
case UPDATE_LATENCY -> helper.writeVarInt(out, entry.getLatency());
|
case UPDATE_LATENCY -> helper.writeVarInt(out, entry.getLatency());
|
||||||
case UPDATE_DISPLAY_NAME -> helper.writeNullable(out, entry.getDisplayName(), helper::writeComponent);
|
case UPDATE_DISPLAY_NAME -> helper.writeNullable(out, entry.getDisplayName(), helper::writeComponent);
|
||||||
case UPDATE_LIST_ORDER -> helper.writeVarInt(out, entry.getListOrder());
|
case UPDATE_LIST_ORDER -> helper.writeVarInt(out, entry.getListOrder());
|
||||||
|
case UPDATE_HAT -> out.writeBoolean(entry.isShowHat());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,11 +14,11 @@ public class ClientboundSetHeldSlotPacket implements MinecraftPacket {
|
||||||
private final int slot;
|
private final int slot;
|
||||||
|
|
||||||
public ClientboundSetHeldSlotPacket(ByteBuf in, MinecraftCodecHelper helper) {
|
public ClientboundSetHeldSlotPacket(ByteBuf in, MinecraftCodecHelper helper) {
|
||||||
this.slot = in.readByte();
|
this.slot = helper.readVarInt(in);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void serialize(ByteBuf out, MinecraftCodecHelper helper) {
|
public void serialize(ByteBuf out, MinecraftCodecHelper helper) {
|
||||||
out.writeByte(this.slot);
|
helper.writeVarInt(out, this.slot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,13 +39,13 @@ public class ClientboundBlockEventPacket implements MinecraftPacket {
|
||||||
private static final int PISTON = 135;
|
private static final int PISTON = 135;
|
||||||
private static final int MOB_SPAWNER = 182;
|
private static final int MOB_SPAWNER = 182;
|
||||||
private static final int CHEST = 185;
|
private static final int CHEST = 185;
|
||||||
private static final int ENDER_CHEST = 358;
|
private static final int ENDER_CHEST = 365;
|
||||||
private static final int TRAPPED_CHEST = 427;
|
private static final int TRAPPED_CHEST = 434;
|
||||||
private static final int END_GATEWAY = 624;
|
private static final int END_GATEWAY = 631;
|
||||||
private static final int SHULKER_BOX_LOWER = 634;
|
private static final int SHULKER_BOX_LOWER = 641;
|
||||||
private static final int SHULKER_BOX_HIGHER = 650;
|
private static final int SHULKER_BOX_HIGHER = 657;
|
||||||
private static final int BELL = 804;
|
private static final int BELL = 811;
|
||||||
private static final int DECORATED_POT = 1076;
|
private static final int DECORATED_POT = 1083;
|
||||||
|
|
||||||
private final @NonNull Vector3i position;
|
private final @NonNull Vector3i position;
|
||||||
private final @NonNull BlockValueType type;
|
private final @NonNull BlockValueType type;
|
||||||
|
|
|
@ -16,6 +16,7 @@ import org.geysermc.mcprotocollib.protocol.data.game.level.particle.ParticleType
|
||||||
public class ClientboundLevelParticlesPacket implements MinecraftPacket {
|
public class ClientboundLevelParticlesPacket implements MinecraftPacket {
|
||||||
private final @NonNull Particle particle;
|
private final @NonNull Particle particle;
|
||||||
private final boolean longDistance;
|
private final boolean longDistance;
|
||||||
|
private final boolean alwaysShow;
|
||||||
private final double x;
|
private final double x;
|
||||||
private final double y;
|
private final double y;
|
||||||
private final double z;
|
private final double z;
|
||||||
|
@ -27,6 +28,7 @@ public class ClientboundLevelParticlesPacket implements MinecraftPacket {
|
||||||
|
|
||||||
public ClientboundLevelParticlesPacket(ByteBuf in, MinecraftCodecHelper helper) {
|
public ClientboundLevelParticlesPacket(ByteBuf in, MinecraftCodecHelper helper) {
|
||||||
this.longDistance = in.readBoolean();
|
this.longDistance = in.readBoolean();
|
||||||
|
this.alwaysShow = in.readBoolean();
|
||||||
this.x = in.readDouble();
|
this.x = in.readDouble();
|
||||||
this.y = in.readDouble();
|
this.y = in.readDouble();
|
||||||
this.z = in.readDouble();
|
this.z = in.readDouble();
|
||||||
|
@ -42,6 +44,7 @@ public class ClientboundLevelParticlesPacket implements MinecraftPacket {
|
||||||
@Override
|
@Override
|
||||||
public void serialize(ByteBuf out, MinecraftCodecHelper helper) {
|
public void serialize(ByteBuf out, MinecraftCodecHelper helper) {
|
||||||
out.writeBoolean(this.longDistance);
|
out.writeBoolean(this.longDistance);
|
||||||
|
out.writeBoolean(this.alwaysShow);
|
||||||
out.writeDouble(this.x);
|
out.writeDouble(this.x);
|
||||||
out.writeDouble(this.y);
|
out.writeDouble(this.y);
|
||||||
out.writeDouble(this.z);
|
out.writeDouble(this.z);
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
package org.geysermc.mcprotocollib.protocol.packet.ingame.serverbound.inventory;
|
||||||
|
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.With;
|
||||||
|
import org.cloudburstmc.math.vector.Vector3i;
|
||||||
|
import org.geysermc.mcprotocollib.protocol.codec.MinecraftCodecHelper;
|
||||||
|
import org.geysermc.mcprotocollib.protocol.codec.MinecraftPacket;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@With
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class ServerboundPickItemFromBlockPacket implements MinecraftPacket {
|
||||||
|
private final Vector3i pos;
|
||||||
|
private final boolean includeData;
|
||||||
|
|
||||||
|
public ServerboundPickItemFromBlockPacket(ByteBuf in, MinecraftCodecHelper helper) {
|
||||||
|
this.pos = helper.readPosition(in);
|
||||||
|
this.includeData = in.readBoolean();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void serialize(ByteBuf out, MinecraftCodecHelper helper) {
|
||||||
|
helper.writePosition(out, this.pos);
|
||||||
|
out.writeBoolean(this.includeData);
|
||||||
|
}
|
||||||
|
}
|
|
@ -10,15 +10,18 @@ import org.geysermc.mcprotocollib.protocol.codec.MinecraftPacket;
|
||||||
@Data
|
@Data
|
||||||
@With
|
@With
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class ServerboundPickItemPacket implements MinecraftPacket {
|
public class ServerboundPickItemFromEntityPacket implements MinecraftPacket {
|
||||||
private final int slot;
|
private final int id;
|
||||||
|
private final boolean includeData;
|
||||||
|
|
||||||
public ServerboundPickItemPacket(ByteBuf in, MinecraftCodecHelper helper) {
|
public ServerboundPickItemFromEntityPacket(ByteBuf in, MinecraftCodecHelper helper) {
|
||||||
this.slot = helper.readVarInt(in);
|
this.id = helper.readVarInt(in);
|
||||||
|
this.includeData = in.readBoolean();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void serialize(ByteBuf out, MinecraftCodecHelper helper) {
|
public void serialize(ByteBuf out, MinecraftCodecHelper helper) {
|
||||||
helper.writeVarInt(out, this.slot);
|
helper.writeVarInt(out, this.id);
|
||||||
|
out.writeBoolean(this.includeData);
|
||||||
}
|
}
|
||||||
}
|
}
|
Binary file not shown.
Loading…
Reference in a new issue