gt:             else if (this.protocol.minZ != this.protocol.maxZ)
context: package micdoodle8.mods.galacticraft.core.tile;
  
  import cpw.mods.fml.relauncher.Side;
  import micdoodle8.mods.galacticraft.api.vector.Vector3;
  import micdoodle8.mods.galacticraft.core.GalacticraftCore;
  import micdoodle8.mods.galacticraft.core.blocks.GCBlocks;
  import micdoodle8.mods.miccore.Annotations.NetworkedField;
  import net.minecraft.block.Block;
  import net.minecraft.block.material.Material;
  import net.minecraft.entity.player.EntityPlayer;
  import net.minecraft.nbt.NBTTagCompound;
  import net.minecraft.util.AxisAlignedBB;
  
  import java.util.ArrayList;
  import java.util.List;
  
  public class TileEntityAirLockController extends TileEntityAirLock
  {
      @NetworkedField(targetSide = Side.CLIENT)
      public boolean redstoneActivation;
      @NetworkedField(targetSide = Side.CLIENT)
      public boolean playerDistanceActivation;
      @NetworkedField(targetSide = Side.CLIENT)
      public int playerDistanceSelection;
      @NetworkedField(targetSide = Side.CLIENT)
      public boolean playerNameMatches;
      @NetworkedField(targetSide = Side.CLIENT)
      public String playerToOpenFor = "";
      @NetworkedField(targetSide = Side.CLIENT)
      public boolean invertSelection;
      @NetworkedField(targetSide = Side.CLIENT)
      public boolean horizontalModeEnabled;
      public boolean lastHorizontalModeEnabled;
      @NetworkedField(targetSide = Side.CLIENT)
      public String ownerName = "";
  
      @NetworkedField(targetSide = Side.CLIENT)
      public boolean active;
      public boolean lastActive;
      public ArrayList<TileEntityAirLock> otherAirLocks;
      public ArrayList<TileEntityAirLock> lastOtherAirLocks;
      private AirLockProtocol protocol;
      private AirLockProtocol lastProtocol;
  
      public TileEntityAirLockController()
      {
          this.lastProtocol = this.protocol;
      }
  
      @SuppressWarnings("rawtypes")
      @Override
      public void updateEntity()
      {
          super.updateEntity();
   
          if (!this.worldObj.isRemote)
          {
              this.active = false;
  
              if (this.redstoneActivation)
              {
                  this.active = !this.worldObj.isBlockIndirectlyGettingPowered(this.xCoord, this.yCoord, this.zCoord);
              }
  
              if ((this.active || !this.redstoneActivation) && this.playerDistanceActivation)
              {
                  double distance = 0.0F;
  
                  switch (this.playerDistanceSelection)
                  {
                  case 0:
                      distance = 1.0D;
                      break;
                  case 1:
                      distance = 2.0D;
                      break;
                  case 2:
                      distance = 5.0D;
                      break;
                  case 3:
                      distance = 10.0D;
                      break;
                  }
  
                  Vector3 thisPos = new Vector3(this).translate(0.5F);
                  Vector3 minPos = new Vector3(thisPos).translate(-distance);
                  Vector3 maxPos = new Vector3(thisPos).translate(distance);
                  AxisAlignedBB matchingRegion = AxisAlignedBB.getBoundingBox(minPos.x, minPos.y, minPos.z, maxPos.x, maxPos.y, maxPos.z);
                  List playersWithin = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, matchingRegion);
  
                  boolean foundPlayer = false;
  
                  for (int i = 0; i < playersWithin.size(); i++)
                  {
                      Object o = playersWithin.get(i);
  
                      if (o instanceof EntityPlayer)
                      {
                          if (this.playerNameMatches)
                          {
                              if (((EntityPlayer) o).getGameProfile().getName().equalsIgnoreCase(this.playerToOpenFor))
                              {
                                  foundPlayer = true;
                                  break;
                              }
                          }
                          else
                          {
                              foundPlayer = true;
                              break;
                          }
                      }
                  }
  
                  this.active = !foundPlayer;
              }
  
              if (this.invertSelection)
              {
                  this.active = !this.active;
              }
  
              if (this.protocol == null)
              {
                  this.protocol = this.lastProtocol = new AirLockProtocol(this);
              }
  
              if (this.ticks % 10 == 0)
              {
                  if (this.horizontalModeEnabled != this.lastHorizontalModeEnabled)
                  {
                      this.unsealAirLock();
                  }
                  else
                  {
                      this.otherAirLocks = this.protocol.calculate(this.horizontalModeEnabled);
  
                      if (this.active && (this.otherAirLocks != null || 
                      		(this.lastOtherAirLocks != null && this.otherAirLocks != this.lastOtherAirLocks) || 
                      		(this.lastOtherAirLocks != null && this.otherAirLocks.size() != this.lastOtherAirLocks.size())))
                      {
                          this.sealAirLock();
                      }
                      else if (!this.active && this.lastActive || this.otherAirLocks == null && this.lastOtherAirLocks != null)
                      {
                          this.unsealAirLock();
                      }
                  }
  
                  if (this.active != this.lastActive)
                  {
                      this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord);
                  }
  
                  this.lastActive = this.active;
                  this.lastOtherAirLocks = this.otherAirLocks;
                  this.lastProtocol = this.protocol;
                  this.lastHorizontalModeEnabled = this.horizontalModeEnabled;
              }
          }
      }
  
      public void sealAirLock()
      {
          int x = this.lastProtocol.minX + (this.lastProtocol.maxX - this.lastProtocol.minX) / 2;
          int y = this.lastProtocol.minY + (this.lastProtocol.maxY - this.lastProtocol.minY) / 2;
          int z = this.lastProtocol.minZ + (this.lastProtocol.maxZ - this.lastProtocol.minZ) / 2;
  
          if (this.worldObj.getBlock(x, y, z) != GCBlocks.airLockSeal)
          {
              this.worldObj.playSoundEffect(x, y, z, GalacticraftCore.TEXTURE_PREFIX + "player.openairlock", 1.0F, 1.0F);
          }
  
          if (this.horizontalModeEnabled)
          {
              if (this.protocol.minY == this.protocol.maxY && this.protocol.minX != this.protocol.maxX && this.protocol.minZ != this.protocol.maxZ)
              {
                  for (x = this.protocol.minX + 1; x <= this.protocol.maxX - 1; x++)
                  {
                      for (z = this.protocol.minZ + 1; z <= this.protocol.maxZ - 1; z++)
                      {
                          Block blockAt = this.worldObj.getBlock(x, y, z);
  
                          if (blockAt != null && blockAt.isAir(this.worldObj, x, y, z))
                          {
                              this.worldObj.setBlock(x, this.protocol.minY, z, GCBlocks.airLockSeal, 0, 3);
                          }
                      }
                  }
              }
          }
          else
          {
              if (this.protocol.minX != this.protocol.maxX)
              {
                  for (x = this.protocol.minX + 1; x <= this.protocol.maxX - 1; x++)
                  {
                      for (y = this.protocol.minY + 1; y <= this.protocol.maxY - 1; y++)
                      {
                          Block blockAt = this.worldObj.getBlock(x, y, z);
  
                          if (blockAt != null && blockAt.isAir(this.worldObj, x, y, z))
                          {
                              this.worldObj.setBlock(x, y, this.protocol.minZ, GCBlocks.airLockSeal, 0, 3);
                          }
                      }
                  }
              }
  