package net.minecraft.network.protocol.game;

import net.minecraft.network.PacketListener;
import java.io.IOException;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.core.BlockPos;
import net.minecraft.network.protocol.Packet;

public class ClientboundLevelEventPacket implements Packet<ClientGamePacketListener> {
    private int type;
    private BlockPos pos;
    private int data;
    private boolean globalEvent;
    
    public ClientboundLevelEventPacket() {
    }
    
    public ClientboundLevelEventPacket(final int integer1, final BlockPos fk, final int integer3, final boolean boolean4) {
        this.type = integer1;
        this.pos = fk.immutable();
        this.data = integer3;
        this.globalEvent = boolean4;
    }
    
    @Override
    public void read(final FriendlyByteBuf kv) throws IOException {
        this.type = kv.readInt();
        this.pos = kv.readBlockPos();
        this.data = kv.readInt();
        this.globalEvent = kv.readBoolean();
    }
    
    @Override
    public void write(final FriendlyByteBuf kv) throws IOException {
        kv.writeInt(this.type);
        kv.writeBlockPos(this.pos);
        kv.writeInt(this.data);
        kv.writeBoolean(this.globalEvent);
    }
    
    @Override
    public void handle(final ClientGamePacketListener lw) {
        lw.handleLevelEvent(this);
    }
    
    public boolean isGlobalEvent() {
        return this.globalEvent;
    }
    
    public int getType() {
        return this.type;
    }
    
    public int getData() {
        return this.data;
    }
    
    public BlockPos getPos() {
        return this.pos;
    }
}
