@Override
 public void invalidate() {
   FrequencyGrid.getWorldMap(this.worldObj)
       .getControlSystem()
       .remove(Integer.valueOf(getDeviceID()));
   super.invalidate();
 }
  @Override
  public void onNetworkHandlerEvent(int key, String value) {
    if ((key == 103) && (this.remote != null) && (getRemoteGUIinRange())) {
      EntityPlayer player = this.worldObj.getPlayerEntityByName(value);
      if (player != null) {
        player.openGui(
            ModularForceFieldSystem.instance,
            0,
            this.worldObj,
            this.remote.xCoord,
            this.remote.yCoord,
            this.remote.zCoord);
      }
    }

    if ((key == 102) && (this.remote != null)) {
      this.remote.onSwitch();
    }

    if ((key == 101) && (this.remote != null)) {
      this.remote.toogleSwitchMode();
    }

    super.onNetworkHandlerEvent(key, value);
  }
  @Override
  public void readFromNBT(NBTTagCompound nbttagcompound) {
    super.readFromNBT(nbttagcompound);
    NBTTagList nbttaglist = nbttagcompound.getTagList("Items");
    this.inventory = new ItemStack[getSizeInventory()];
    for (int i = 0; i < nbttaglist.tagCount(); i++) {
      NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.tagAt(i);

      byte byte0 = nbttagcompound1.getByte("Slot");
      if ((byte0 >= 0) && (byte0 < this.inventory.length)) {
        this.inventory[byte0] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
      }
    }
  }
  @Override
  public void writeToNBT(NBTTagCompound nbttagcompound) {
    super.writeToNBT(nbttagcompound);
    NBTTagList nbttaglist = new NBTTagList();
    for (int i = 0; i < this.inventory.length; i++) {
      if (this.inventory[i] != null) {
        NBTTagCompound nbttagcompound1 = new NBTTagCompound();
        nbttagcompound1.setByte("Slot", (byte) i);
        this.inventory[i].writeToNBT(nbttagcompound1);
        nbttaglist.appendTag(nbttagcompound1);
      }
    }

    nbttagcompound.setTag("Items", nbttaglist);
  }
  @Override
  public void updateEntity() {
    if (!this.worldObj.isRemote) {
      if (this.ticks % 20 == 0) {
        if ((getLinkedSecurityStation() != null) && (!isActive())) {
          setActive(true);
        }
        if ((getLinkedSecurityStation() == null) && (isActive())) {
          setActive(false);
        }
        refreshRemoteData();
      }
    }

    super.updateEntity();
  }