Search in sources :

Example 1 with PacketSRemoveCameraTag

use of net.geforcemods.securitycraft.network.packets.PacketSRemoveCameraTag in project SecurityCraft by Geforce132.

the class GuiCameraMonitor method actionPerformed.

@Override
protected void actionPerformed(GuiButton guibutton) {
    if (guibutton.id == -1)
        mc.displayGuiScreen(new GuiCameraMonitor(playerInventory, cameraMonitor, nbtTag, page - 1));
    else if (guibutton.id == 0)
        mc.displayGuiScreen(new GuiCameraMonitor(playerInventory, cameraMonitor, nbtTag, page + 1));
    else if (guibutton.id < 11) {
        int camID = guibutton.id + ((page - 1) * 10);
        CameraView view = (cameraMonitor.getCameraPositions(nbtTag).get(camID - 1));
        if (BlockUtils.getBlock(Minecraft.getMinecraft().theWorld, view.getLocation()) == SCContent.securityCamera) {
            ((BlockSecurityCamera) BlockUtils.getBlock(Minecraft.getMinecraft().theWorld, view.getLocation())).mountCamera(Minecraft.getMinecraft().theWorld, view.x, view.y, view.z, camID, Minecraft.getMinecraft().thePlayer);
            SecurityCraft.network.sendToServer(new PacketSMountCamera(view.x, view.y, view.z, camID));
            Minecraft.getMinecraft().thePlayer.closeScreen();
        } else
            guibutton.enabled = false;
    } else {
        int camID = (guibutton.id - 10) + ((page - 1) * 10);
        SecurityCraft.network.sendToServer(new PacketSRemoveCameraTag(playerInventory.getCurrentItem(), camID));
        nbtTag.removeTag(ItemCameraMonitor.getTagNameFromPosition(nbtTag, cameraMonitor.getCameraPositions(nbtTag).get(camID - 1)));
        guibutton.enabled = false;
        cameraButtons[(camID - 1) % 10].enabled = false;
    }
}
Also used : PacketSMountCamera(net.geforcemods.securitycraft.network.packets.PacketSMountCamera) PacketSRemoveCameraTag(net.geforcemods.securitycraft.network.packets.PacketSRemoveCameraTag) BlockSecurityCamera(net.geforcemods.securitycraft.blocks.BlockSecurityCamera) CameraView(net.geforcemods.securitycraft.misc.CameraView)

Aggregations

BlockSecurityCamera (net.geforcemods.securitycraft.blocks.BlockSecurityCamera)1 CameraView (net.geforcemods.securitycraft.misc.CameraView)1 PacketSMountCamera (net.geforcemods.securitycraft.network.packets.PacketSMountCamera)1 PacketSRemoveCameraTag (net.geforcemods.securitycraft.network.packets.PacketSRemoveCameraTag)1