@Override
  public boolean getInitiallySelected(GuiElementCheckbox checkbox) {
    if (checkbox.equals(this.checkboxRedstoneSignal)) {
      return this.controller.redstoneActivation;
    } else if (checkbox.equals(this.checkboxPlayerDistance)) {
      return this.controller.playerDistanceActivation;
    } else if (checkbox.equals(this.checkboxOpenForPlayer)) {
      return this.controller.playerNameMatches;
    } else if (checkbox.equals(this.checkboxInvertSelection)) {
      return this.controller.invertSelection;
    } else if (checkbox.equals(this.checkboxHorizontalMode)) {
      return this.controller.horizontalModeEnabled;
    }

    return false;
  }
 @Override
 public void onSelectionChanged(GuiElementCheckbox checkbox, boolean newSelected) {
   if (checkbox.equals(this.checkboxRedstoneSignal)) {
     this.controller.redstoneActivation = newSelected;
     GalacticraftCore.packetPipeline.sendToServer(
         new PacketSimple(
             EnumSimplePacket.S_ON_ADVANCED_GUI_CLICKED_INT,
             new Object[] {
               0,
               this.controller.xCoord,
               this.controller.yCoord,
               this.controller.zCoord,
               this.controller.redstoneActivation ? 1 : 0
             }));
     // PacketDispatcher.sendPacketToServer(PacketUtil.createPacket(GalacticraftCore.CHANNEL,
     // EnumPacketServer.ON_ADVANCED_GUI_CLICKED_INT, new Object[] { 0,
     // this.controller.xCoord, this.controller.yCoord,
     // this.controller.zCoord, this.controller.redstoneActivation ? 1 :
     // 0 }));
   } else if (checkbox.equals(this.checkboxPlayerDistance)) {
     this.controller.playerDistanceActivation = newSelected;
     GalacticraftCore.packetPipeline.sendToServer(
         new PacketSimple(
             EnumSimplePacket.S_ON_ADVANCED_GUI_CLICKED_INT,
             new Object[] {
               1,
               this.controller.xCoord,
               this.controller.yCoord,
               this.controller.zCoord,
               this.controller.playerDistanceActivation ? 1 : 0
             }));
     // PacketDispatcher.sendPacketToServer(PacketUtil.createPacket(GalacticraftCore.CHANNEL,
     // EnumPacketServer.ON_ADVANCED_GUI_CLICKED_INT, new Object[] { 1,
     // this.controller.xCoord, this.controller.yCoord,
     // this.controller.zCoord, this.controller.playerDistanceActivation
     // ? 1 : 0 }));
   } else if (checkbox.equals(this.checkboxOpenForPlayer)) {
     this.controller.playerNameMatches = newSelected;
     GalacticraftCore.packetPipeline.sendToServer(
         new PacketSimple(
             EnumSimplePacket.S_ON_ADVANCED_GUI_CLICKED_INT,
             new Object[] {
               3,
               this.controller.xCoord,
               this.controller.yCoord,
               this.controller.zCoord,
               this.controller.playerNameMatches ? 1 : 0
             }));
     // PacketDispatcher.sendPacketToServer(PacketUtil.createPacket(GalacticraftCore.CHANNEL,
     // EnumPacketServer.ON_ADVANCED_GUI_CLICKED_INT, new Object[] { 3,
     // this.controller.xCoord, this.controller.yCoord,
     // this.controller.zCoord, this.controller.playerNameMatches ? 1 : 0
     // }));
   } else if (checkbox.equals(this.checkboxInvertSelection)) {
     this.controller.invertSelection = newSelected;
     GalacticraftCore.packetPipeline.sendToServer(
         new PacketSimple(
             EnumSimplePacket.S_ON_ADVANCED_GUI_CLICKED_INT,
             new Object[] {
               4,
               this.controller.xCoord,
               this.controller.yCoord,
               this.controller.zCoord,
               this.controller.invertSelection ? 1 : 0
             }));
     // PacketDispatcher.sendPacketToServer(PacketUtil.createPacket(GalacticraftCore.CHANNEL,
     // EnumPacketServer.ON_ADVANCED_GUI_CLICKED_INT, new Object[] { 4,
     // this.controller.xCoord, this.controller.yCoord,
     // this.controller.zCoord, this.controller.invertSelection ? 1 : 0
     // }));
   } else if (checkbox.equals(this.checkboxHorizontalMode)) {
     this.controller.lastHorizontalModeEnabled = this.controller.horizontalModeEnabled;
     this.controller.horizontalModeEnabled = newSelected;
     GalacticraftCore.packetPipeline.sendToServer(
         new PacketSimple(
             EnumSimplePacket.S_ON_ADVANCED_GUI_CLICKED_INT,
             new Object[] {
               5,
               this.controller.xCoord,
               this.controller.yCoord,
               this.controller.zCoord,
               this.controller.horizontalModeEnabled ? 1 : 0
             }));
     // PacketDispatcher.sendPacketToServer(PacketUtil.createPacket(GalacticraftCore.CHANNEL,
     // EnumPacketServer.ON_ADVANCED_GUI_CLICKED_INT, new Object[] { 5,
     // this.controller.xCoord, this.controller.yCoord,
     // this.controller.zCoord, this.controller.horizontalModeEnabled ? 1
     // : 0 }));
   }
 }