Esempio n. 1
0
  @Override
  public void onNetworksCreated(List<FluidNetwork> networks) {
    if (fluidStored != null && FMLCommonHandler.instance().getEffectiveSide().isServer()) {
      int[] caps = new int[networks.size()];
      int cap = 0;

      for (FluidNetwork network : networks) {
        caps[networks.indexOf(network)] = network.getCapacity();
        cap += network.getCapacity();
      }

      fluidStored.amount = Math.min(cap, fluidStored.amount);

      int[] values = ListUtils.calcPercentInt(ListUtils.percent(caps), fluidStored.amount);

      for (FluidNetwork network : networks) {
        int index = networks.indexOf(network);

        if (values[index] > 0) {
          network.fluidStored = new FluidStack(fluidStored.getFluid(), values[index]);
          network.fluidScale = network.getScale();
          network.refFluid = fluidStored.getFluid();
        }
      }
    }

    fluidScale = 0;
    fluidStored = null;
    refFluid = null;
  }
Esempio n. 2
0
  @Override
  protected FluidNetwork create(Collection<IGridTransmitter<FluidNetwork>> collection) {
    FluidNetwork network = new FluidNetwork(collection);
    network.refFluid = refFluid;

    if (fluidStored != null) {
      if (network.fluidStored == null) {
        network.fluidStored = fluidStored;
      } else {
        network.fluidStored.amount += fluidStored.amount;
      }
    }

    network.fluidScale = network.getScale();

    return network;
  }
Esempio n. 3
0
  @Override
  protected FluidNetwork create(IGridTransmitter<FluidNetwork>... varTransmitters) {
    FluidNetwork network = new FluidNetwork(varTransmitters);
    network.refFluid = refFluid;

    if (fluidStored != null) {
      if (network.fluidStored == null) {
        network.fluidStored = fluidStored;
      } else {
        network.fluidStored.amount += fluidStored.amount;
      }
    }

    network.fluidScale = network.getScale();

    fluidScale = 0;
    refFluid = null;
    fluidStored = null;

    return network;
  }