private void doPlenish() {
    if (usedNodes.size() >= MAX_NODES) {
      finishedCalc = true;
      return;
    }

    if (activeNodes.isEmpty()) {
      if (usedNodes.isEmpty()) {
        Coord4D below = Coord4D.get(this).getFromSide(ForgeDirection.DOWN);

        if (!canReplace(below, true, true)) {
          finishedCalc = true;
          return;
        }

        activeNodes.add(below);
      } else {
        finishedCalc = true;
        return;
      }
    }

    Set<Coord4D> toRemove = new HashSet<Coord4D>();

    for (Coord4D coord : activeNodes) {
      if (coord.exists(worldObj)) {
        if (canReplace(coord, true, false)) {
          worldObj.setBlock(
              coord.xCoord,
              coord.yCoord,
              coord.zCoord,
              MekanismUtils.getFlowingBlock(fluidTank.getFluid().getFluid()),
              0,
              3);

          setEnergy(getEnergy() - usage.fluidicPlenisherUsage);
          fluidTank.drain(FluidContainerRegistry.BUCKET_VOLUME, true);
        }

        for (ForgeDirection dir : dirs) {
          Coord4D sideCoord = coord.getFromSide(dir);

          if (sideCoord.exists(worldObj) && canReplace(sideCoord, true, true)) {
            activeNodes.add(sideCoord);
          }
        }

        toRemove.add(coord);
        break;
      } else {
        toRemove.add(coord);
      }
    }

    for (Coord4D coord : toRemove) {
      activeNodes.remove(coord);
      usedNodes.add(coord);
    }
  }
  @Override
  public void onUpdate() {
    if (!worldObj.isRemote) {
      ChargeUtils.discharge(2, this);

      if (inventory[0] != null) {
        if (inventory[0].getItem() instanceof IFluidContainerItem
            && ((IFluidContainerItem) inventory[0].getItem()).getFluid(inventory[0]) != null) {
          if (((IFluidContainerItem) inventory[0].getItem())
              .getFluid(inventory[0])
              .getFluid()
              .canBePlacedInWorld()) {
            fluidTank.fill(FluidContainerUtils.extractFluid(fluidTank, inventory[0]), true);

            if (((IFluidContainerItem) inventory[0].getItem()).getFluid(inventory[0]) == null
                || fluidTank.getFluidAmount() == fluidTank.getCapacity()) {
              if (inventory[1] == null) {
                inventory[1] = inventory[0].copy();
                inventory[0] = null;

                markDirty();
              }
            }
          }
        } else if (FluidContainerRegistry.isFilledContainer(inventory[0])) {
          FluidStack itemFluid = FluidContainerRegistry.getFluidForFilledItem(inventory[0]);

          if ((fluidTank.getFluid() == null && itemFluid.amount <= fluidTank.getCapacity())
              || fluidTank.getFluid().amount + itemFluid.amount <= fluidTank.getCapacity()) {
            if ((fluidTank.getFluid() != null && !fluidTank.getFluid().isFluidEqual(itemFluid))
                || !itemFluid.getFluid().canBePlacedInWorld()) {
              return;
            }

            ItemStack containerItem = inventory[0].getItem().getContainerItem(inventory[0]);

            boolean filled = false;

            if (containerItem != null) {
              if (inventory[1] == null
                  || (inventory[1].isItemEqual(containerItem)
                      && inventory[1].stackSize + 1 <= containerItem.getMaxStackSize())) {
                inventory[0] = null;

                if (inventory[1] == null) {
                  inventory[1] = containerItem;
                } else {
                  inventory[1].stackSize++;
                }

                filled = true;
              }
            } else {
              inventory[0].stackSize--;

              if (inventory[0].stackSize == 0) {
                inventory[0] = null;
              }

              filled = true;
            }

            if (filled) {
              fluidTank.fill(itemFluid, true);
              markDirty();
            }
          }
        }
      }

      if (getEnergy() >= usage.fluidicPlenisherUsage
          && worldObj.getWorldTime() % 10 == 0
          && fluidTank.getFluidAmount() >= FluidContainerRegistry.BUCKET_VOLUME) {
        if (fluidTank.getFluid().getFluid().canBePlacedInWorld()) {
          if (!finishedCalc) {
            doPlenish();
          } else {
            Coord4D below = Coord4D.get(this).getFromSide(ForgeDirection.DOWN);

            if (canReplace(below, false, false)
                && getEnergy() >= usage.fluidicPlenisherUsage
                && fluidTank.getFluidAmount() >= FluidContainerRegistry.BUCKET_VOLUME) {
              if (fluidTank.getFluid().getFluid().canBePlacedInWorld()) {
                worldObj.setBlock(
                    below.xCoord,
                    below.yCoord,
                    below.zCoord,
                    MekanismUtils.getFlowingBlock(fluidTank.getFluid().getFluid()),
                    0,
                    3);

                setEnergy(getEnergy() - usage.fluidicPlenisherUsage);
                fluidTank.drain(FluidContainerRegistry.BUCKET_VOLUME, true);
              }
            }
          }
        }
      }
    }
  }