package com.dairymoose.modernlife.network.play.client;

import com.dairymoose.modernlife.core.ModernLifeCommon;
import com.dairymoose.modernlife.items.CameraItem;
import java.util.function.Supplier;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.ServerGamePacketListener;
import net.minecraft.server.network.ServerGamePacketListenerImpl;
import net.minecraft.world.entity.player.Player;
import net.minecraftforge.network.NetworkEvent;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

/* loaded from: outputsrg.jar:com/dairymoose/modernlife/network/play/client/ServerboundStopUsingCameraPacket.class */
public class ServerboundStopUsingCameraPacket implements Packet<ServerGamePacketListener> {
    private static final Logger LOGGER = LogManager.getLogger();

    public ServerboundStopUsingCameraPacket() {
    }

    public ServerboundStopUsingCameraPacket(FriendlyByteBuf buffer) {
        read(buffer);
    }

    public void read(FriendlyByteBuf buffer) {
    }

    public void write(FriendlyByteBuf buffer) {
    }

    public void handle(Supplier<NetworkEvent.Context> ctx) {
        ctx.get().enqueueWork(() -> {
            ((NetworkEvent.Context) ctx.get()).getSender();
            handle((ServerGamePacketListener) ((NetworkEvent.Context) ctx.get()).getNetworkManager().getPacketListener());
        });
        ctx.get().setPacketHandled(true);
    }

    public void handle(ServerGamePacketListener p_148833_1_) {
        ModernLifeCommon.LOGGER.debug("Handle ServerboundStopUsingCameraPacket");
        if (p_148833_1_ instanceof ServerGamePacketListenerImpl) {
            ServerGamePacketListenerImpl handler = (ServerGamePacketListenerImpl) p_148833_1_;
            Player player = handler.player;
            CameraItem.usingCameraServer.put(player, false);
        }
    }
}
