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 fu, final int integer3, final boolean boolean4) {
        this.type = integer1;
        this.pos = fu.immutable();
        this.data = integer3;
        this.globalEvent = boolean4;
    }
    
    @Override
    public void read(final FriendlyByteBuf mg) throws IOException {
        this.type = mg.readInt();
        this.pos = mg.readBlockPos();
        this.data = mg.readInt();
        this.globalEvent = mg.readBoolean();
    }
    
    @Override
    public void write(final FriendlyByteBuf mg) throws IOException {
        mg.writeInt(this.type);
        mg.writeBlockPos(this.pos);
        mg.writeInt(this.data);
        mg.writeBoolean(this.globalEvent);
    }
    
    @Override
    public void handle(final ClientGamePacketListener nl) {
        nl.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;
    }
}
