minecraft_25w45a_unobfuscated/net/minecraft/network/protocol/game/ServerboundSelectTradePacket.java
2025-11-24 22:52:51 +03:00

45 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;
public class ServerboundSelectTradePacket
implements Packet<ServerGamePacketListener> {
public static final StreamCodec<FriendlyByteBuf, ServerboundSelectTradePacket> STREAM_CODEC = Packet.codec(ServerboundSelectTradePacket::write, ServerboundSelectTradePacket::new);
private final int item;
public ServerboundSelectTradePacket(int item) {
this.item = item;
}
private ServerboundSelectTradePacket(FriendlyByteBuf input) {
this.item = input.readVarInt();
}
private void write(FriendlyByteBuf output) {
output.writeVarInt(this.item);
}
@Override
public PacketType<ServerboundSelectTradePacket> type() {
return GamePacketTypes.SERVERBOUND_SELECT_TRADE;
}
@Override
public void handle(ServerGamePacketListener listener) {
listener.handleSelectTrade(this);
}
public int getItem() {
return this.item;
}
}