Examples of IGasHandler


Examples of mekanism.api.gas.IGasHandler

  protected final Map<ForgeDirection, Integer> externalRedstoneSignals = new HashMap<ForgeDirection, Integer>();
  protected boolean redstoneStateDirty = true;

  public IGasHandler getExternalHandler(ForgeDirection direction) {
    IGasHandler con = GasUtil.getExternalGasHandler(getBundle().getWorld(), getLocation().getLocation(direction));
    return (con != null && !(con instanceof IConduitBundle)) ? con : null;
  }
View Full Code Here

Examples of mekanism.api.gas.IGasHandler

    return GasUtil.getGasHandler(getBundle().getWorld(), bc);
  }

  @Override
  public boolean canConnectToExternal(ForgeDirection direction, boolean ignoreDisabled) {
    IGasHandler h = getExternalHandler(direction);
    if(h == null) {
      return false;
    }
    return true;
  }
View Full Code Here

Examples of mekanism.api.gas.IGasHandler

      return true;
    }
    if(!externalConnections.contains(dir)) {
      return false;
    }
    IGasHandler ext = getExternalHandler(dir);
    if(ext instanceof TileReservoir) { // dont push to an auto ejecting
      // resevoir or we loop
      TileReservoir tr = (TileReservoir) ext;
      return !tr.isMultiblock() || !tr.isAutoEject();
    }
View Full Code Here

Examples of mekanism.api.gas.IGasHandler

    }
    return isGasConduitEnabled;
  }

  public static IGasHandler getExternalGasHandler(IBlockAccess world, BlockCoord bc) {
    IGasHandler con = getGasHandler(world, bc);
    return (con != null && !(con instanceof IConduitBundle)) ? con : null;
  }
View Full Code Here

Examples of mekanism.api.gas.IGasHandler

      if(!outputIterator.hasNext()) {
        outputIterator = outputs.iterator();
      }
      GasOutput output = outputIterator.next();
      if(output != null) {
        IGasHandler cont = getTankContainer(output.location);
        if(cont != null) {
          GasStack offer = tank.getGas().copy();
          int filled = cont.receiveGas(output.dir, offer);
          if(filled > 0) {
            tank.addAmount(-filled);

          }
        }
View Full Code Here

Examples of mekanism.api.gas.IGasHandler

    if(tank.isFull()) {
      return false;
    }

    IGasHandler extTank = getTankContainer(advancedGasConduit, dir);
    if(extTank != null) {
      int maxExtract = Math.min(maxExtractPerTick, tank.getAvailableSpace());

      if(gasType == null || !tank.containsValidGas()) {
        GasStack drained = extTank.drawGas(dir.getOpposite(), maxExtract);
        if(drained == null || drained.amount <= 0) {
          return false;
        }
        setGasType(drained);
        tank.setGas(drained.copy());
        return true;
      }

      GasStack couldDrain = gasType.copy();
      couldDrain.amount = maxExtract;

      //      GasStack drained = extTank.drain(dir.getOpposite(), couldDrain, true);
      //      if(drained == null || drained.amount <= 0) {
      //        return false;
      //      }
      //      tank.addAmount(drained.amount);    

      //Have to use this 'double handle' approach to work around an issue with TiC
      GasStack drained = extTank.drawGas(dir.getOpposite(), maxExtract);
      if(drained == null || drained.amount == 0) {
        return false;
      } else {
        if(drained.isGasEqual(getGasType())) {
          tank.addAmount(drained.amount);
View Full Code Here

Examples of mekanism.api.gas.IGasHandler

                                }
                            }
                        }
                        else if (EnergyConfigHandler.isMekanismLoaded() && tileEntity instanceof IGasHandler)
                        {
                            IGasHandler gasHandler = (IGasHandler) tileEntity;

                            for (ForgeDirection direction : ForgeDirection.VALID_DIRECTIONS)
                            {
                                TileEntity tile = new BlockVec3(tileEntity).getTileEntityOnSide(tileEntity.getWorldObj(), direction);

                                if (gasHandler.canReceiveGas(direction, (Gas) EnergyConfigHandler.gasOxygen) && this.getTransmitters().contains(tile))
                                {
                                    int oxygenToSend = (int) Math.floor(totalOxygen / this.oxygenTiles.size());

                                    if (oxygenToSend > 0)
                                    {
                                        remainingUsableOxygen -= gasHandler.receiveGas(direction, (new GasStack((Gas) EnergyConfigHandler.gasOxygen, oxygenToSend)));
                                    }
                                }
                            }
                        }
                    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.