Search in sources :

Example 1 with PacketSSetOwner

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

the class EntitySecurityCamera method emitLight.

public void emitLight() {
    Block block = this.worldObj.getBlock((int) Math.floor(this.posX), (int) (this.posY - 1.0D), (int) Math.floor(this.posZ));
    if (block instanceof BlockSecurityCamera) {
        this.toggleLightCooldown = 30;
        int meta = this.worldObj.getBlockMetadata((int) Math.floor(this.posX), (int) (this.posY - 1.0D), (int) Math.floor(this.posZ));
        ItemStack[] modules = null;
        if (!((CustomizableSCTE) this.worldObj.getTileEntity((int) Math.floor(this.posX), (int) (this.posY - 1.0D), (int) Math.floor(this.posZ))).getModules().isEmpty()) {
            modules = ((CustomizableSCTE) this.worldObj.getTileEntity((int) Math.floor(this.posX), (int) (this.posY - 1.0D), (int) Math.floor(this.posZ))).itemStacks;
        }
        if (block == mod_SecurityCraft.securityCamera) {
            mod_SecurityCraft.network.sendToServer(new PacketSetBlockAndMetadata((int) Math.floor(this.posX), (int) (this.posY - 1.0D), (int) Math.floor(this.posZ), "securitycraft:securityCameraLit", meta));
            mod_SecurityCraft.network.sendToServer(new PacketSSetOwner((int) Math.floor(this.posX), (int) (this.posY - 1.0D), (int) Math.floor(this.posZ), ((IOwnable) this.worldObj.getTileEntity((int) Math.floor(this.posX), (int) (this.posY - 1.0D), (int) Math.floor(this.posZ))).getOwner().getUUID(), ((IOwnable) this.worldObj.getTileEntity((int) Math.floor(this.posX), (int) (this.posY - 1.0D), (int) Math.floor(this.posZ))).getOwner().getName()));
            if (modules != null) {
                mod_SecurityCraft.network.sendToServer(new PacketSAddModules((int) Math.floor(this.posX), (int) (this.posY - 1.0D), (int) Math.floor(this.posZ), modules));
            }
        }
    }
}
Also used : CustomizableSCTE(net.geforcemods.securitycraft.api.CustomizableSCTE) PacketSAddModules(net.geforcemods.securitycraft.network.packets.PacketSAddModules) Block(net.minecraft.block.Block) PacketSetBlockAndMetadata(net.geforcemods.securitycraft.network.packets.PacketSetBlockAndMetadata) ItemStack(net.minecraft.item.ItemStack) BlockSecurityCamera(net.geforcemods.securitycraft.blocks.BlockSecurityCamera) PacketSSetOwner(net.geforcemods.securitycraft.network.packets.PacketSSetOwner)

Aggregations

CustomizableSCTE (net.geforcemods.securitycraft.api.CustomizableSCTE)1 BlockSecurityCamera (net.geforcemods.securitycraft.blocks.BlockSecurityCamera)1 PacketSAddModules (net.geforcemods.securitycraft.network.packets.PacketSAddModules)1 PacketSSetOwner (net.geforcemods.securitycraft.network.packets.PacketSSetOwner)1 PacketSetBlockAndMetadata (net.geforcemods.securitycraft.network.packets.PacketSetBlockAndMetadata)1 Block (net.minecraft.block.Block)1 ItemStack (net.minecraft.item.ItemStack)1