Ejemplo n.º 1
0
  public static boolean canInteractWithFluid(
      DockingStation station, IFluidFilter filter, Class<?> actionClass) {
    boolean actionFound = false;

    for (StatementSlot s : station.getActiveActions()) {
      if (actionClass.isAssignableFrom(s.statement.getClass())) {
        StatementParameterStackFilter param = new StatementParameterStackFilter(s.parameters);

        if (!param.hasFilter()) {
          actionFound = true;
          break;
        } else {
          for (ItemStack stack : param.getStacks()) {
            if (stack != null) {
              FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(stack);

              if (fluid != null && filter.matches(fluid.getFluid())) {
                actionFound = true;
                break;
              }
            }
          }
        }
      }
    }

    return actionFound;
  }
Ejemplo n.º 2
0
  public static boolean canInteractWithItem(
      DockingStation station, IStackFilter filter, Class<?> actionClass) {
    boolean actionFound = false;

    for (StatementSlot s : station.getActiveActions()) {
      if (actionClass.isAssignableFrom(s.statement.getClass())) {
        StatementParameterStackFilter param = new StatementParameterStackFilter(s.parameters);

        if (!param.hasFilter() || param.matches(filter)) {
          actionFound = true;
          break;
        }
      }
    }

    return actionFound;
  }
Ejemplo n.º 3
0
  public static Collection<ItemStack> getGateFilterStacks(DockingStation station) {
    ArrayList<ItemStack> result = new ArrayList<ItemStack>();

    for (StatementSlot slot : station.getActiveActions()) {
      if (slot.statement instanceof ActionRobotFilter) {
        for (IStatementParameter p : slot.parameters) {
          if (p != null && p instanceof StatementParameterItemStack) {
            StatementParameterItemStack param = (StatementParameterItemStack) p;
            ItemStack stack = param.getItemStack();

            if (stack != null) {
              result.add(stack);
            }
          }
        }
      }
    }

    return result;
  }