2025-11-24 22:52:51 +03:00

46 lines
1.3 KiB
Java

/*
* Decompiled with CFR 0.152.
*/
package net.minecraft.network.protocol.game;
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.world.InteractionHand;
public class ServerboundSwingPacket
implements Packet<ServerGamePacketListener> {
public static final StreamCodec<FriendlyByteBuf, ServerboundSwingPacket> STREAM_CODEC = Packet.codec(ServerboundSwingPacket::write, ServerboundSwingPacket::new);
private final InteractionHand hand;
public ServerboundSwingPacket(InteractionHand hand) {
this.hand = hand;
}
private ServerboundSwingPacket(FriendlyByteBuf input) {
this.hand = input.readEnum(InteractionHand.class);
}
private void write(FriendlyByteBuf output) {
output.writeEnum(this.hand);
}
@Override
public PacketType<ServerboundSwingPacket> type() {
return GamePacketTypes.SERVERBOUND_SWING;
}
@Override
public void handle(ServerGamePacketListener listener) {
listener.handleAnimate(this);
}
public InteractionHand getHand() {
return this.hand;
}
}