use of net.geforcemods.securitycraft.network.packets.PacketSMountCamera 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;
}
}
Aggregations