minecraft_25w45a_unobfuscated/net/minecraft/network/protocol/game/ServerboundRenameItemPacket.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 ServerboundRenameItemPacket
implements Packet<ServerGamePacketListener> {
public static final StreamCodec<FriendlyByteBuf, ServerboundRenameItemPacket> STREAM_CODEC = Packet.codec(ServerboundRenameItemPacket::write, ServerboundRenameItemPacket::new);
private final String name;
public ServerboundRenameItemPacket(String name) {
this.name = name;
}
private ServerboundRenameItemPacket(FriendlyByteBuf input) {
this.name = input.readUtf();
}
private void write(FriendlyByteBuf output) {
output.writeUtf(this.name);
}
@Override
public PacketType<ServerboundRenameItemPacket> type() {
return GamePacketTypes.SERVERBOUND_RENAME_ITEM;
}
@Override
public void handle(ServerGamePacketListener listener) {
listener.handleRenameItem(this);
}
public String getName() {
return this.name;
}
}