Ejemplo n.º 1
0
 @Override
 public int getChannelsInUse() {
   int channelsInUse = 0;
   IGridNode node = getNode();
   if (node != null) {
     for (IGridConnection gc : node.getConnections()) {
       channelsInUse = Math.max(channelsInUse, gc.getUsedChannels());
     }
   }
   return channelsInUse;
 }
  @Override
  public void removeCable(ImmersiveNetHandler.Connection connection) {
    if (!worldObj.isRemote) {
      ChunkCoordinates opposite = connection.end;
      if (connection.end.equals(Utils.toCC(this))) {
        opposite = connection.start;
      }

      for (IGridConnection gridConnection : gridConnections) {
        DimensionalCoord locA = gridConnection.a().getGridBlock().getLocation();
        DimensionalCoord locB = gridConnection.b().getGridBlock().getLocation();
        if ((opposite.posX == locA.x && opposite.posZ == locA.z && opposite.posY == locA.y)
            || (opposite.posX == locB.x && opposite.posZ == locB.z && opposite.posY == locB.y)) {
          gridConnection.destroy();
          gridConnections.remove(gridConnection);
          break;
        }
      }
    }

    super.removeCable(connection);
  }