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

61 lines
2.0 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.ClientGamePacketListener;
import net.minecraft.network.protocol.game.GamePacketTypes;
public class ClientboundSetExperiencePacket
implements Packet<ClientGamePacketListener> {
public static final StreamCodec<FriendlyByteBuf, ClientboundSetExperiencePacket> STREAM_CODEC = Packet.codec(ClientboundSetExperiencePacket::write, ClientboundSetExperiencePacket::new);
private final float experienceProgress;
private final int totalExperience;
private final int experienceLevel;
public ClientboundSetExperiencePacket(float experienceProgress, int totalExperience, int experienceLevel) {
this.experienceProgress = experienceProgress;
this.totalExperience = totalExperience;
this.experienceLevel = experienceLevel;
}
private ClientboundSetExperiencePacket(FriendlyByteBuf input) {
this.experienceProgress = input.readFloat();
this.experienceLevel = input.readVarInt();
this.totalExperience = input.readVarInt();
}
private void write(FriendlyByteBuf output) {
output.writeFloat(this.experienceProgress);
output.writeVarInt(this.experienceLevel);
output.writeVarInt(this.totalExperience);
}
@Override
public PacketType<ClientboundSetExperiencePacket> type() {
return GamePacketTypes.CLIENTBOUND_SET_EXPERIENCE;
}
@Override
public void handle(ClientGamePacketListener listener) {
listener.handleSetExperience(this);
}
public float getExperienceProgress() {
return this.experienceProgress;
}
public int getTotalExperience() {
return this.totalExperience;
}
public int getExperienceLevel() {
return this.experienceLevel;
}
}