/* * Decompiled with CFR 0.152. */ package net.minecraft.network.protocol.game; import net.minecraft.core.BlockPos; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.Packet; import net.minecraft.network.protocol.PacketType; import net.minecraft.network.protocol.game.GamePacketTypes; import net.minecraft.network.protocol.game.ServerGamePacketListener; import net.minecraft.resources.Identifier; import net.minecraft.world.level.block.entity.JigsawBlockEntity; public class ServerboundSetJigsawBlockPacket implements Packet { public static final StreamCodec STREAM_CODEC = Packet.codec(ServerboundSetJigsawBlockPacket::write, ServerboundSetJigsawBlockPacket::new); private final BlockPos pos; private final Identifier name; private final Identifier target; private final Identifier pool; private final String finalState; private final JigsawBlockEntity.JointType joint; private final int selectionPriority; private final int placementPriority; public ServerboundSetJigsawBlockPacket(BlockPos blockPos, Identifier name, Identifier target, Identifier pool, String finalState, JigsawBlockEntity.JointType joint, int selectionPriority, int placementPriority) { this.pos = blockPos; this.name = name; this.target = target; this.pool = pool; this.finalState = finalState; this.joint = joint; this.selectionPriority = selectionPriority; this.placementPriority = placementPriority; } private ServerboundSetJigsawBlockPacket(FriendlyByteBuf input) { this.pos = input.readBlockPos(); this.name = input.readIdentifier(); this.target = input.readIdentifier(); this.pool = input.readIdentifier(); this.finalState = input.readUtf(); this.joint = JigsawBlockEntity.JointType.CODEC.byName(input.readUtf(), JigsawBlockEntity.JointType.ALIGNED); this.selectionPriority = input.readVarInt(); this.placementPriority = input.readVarInt(); } private void write(FriendlyByteBuf output) { output.writeBlockPos(this.pos); output.writeIdentifier(this.name); output.writeIdentifier(this.target); output.writeIdentifier(this.pool); output.writeUtf(this.finalState); output.writeUtf(this.joint.getSerializedName()); output.writeVarInt(this.selectionPriority); output.writeVarInt(this.placementPriority); } @Override public PacketType type() { return GamePacketTypes.SERVERBOUND_SET_JIGSAW_BLOCK; } @Override public void handle(ServerGamePacketListener listener) { listener.handleSetJigsawBlock(this); } public BlockPos getPos() { return this.pos; } public Identifier getName() { return this.name; } public Identifier getTarget() { return this.target; } public Identifier getPool() { return this.pool; } public String getFinalState() { return this.finalState; } public JigsawBlockEntity.JointType getJoint() { return this.joint; } public int getSelectionPriority() { return this.selectionPriority; } public int getPlacementPriority() { return this.placementPriority; } }