Package crazypants.enderio.machine

Examples of crazypants.enderio.machine.MachineRecipeInput


    List<MachineRecipeInput> result = new ArrayList<MachineRecipeInput>();

    VatRecipe rec = (VatRecipe) getRecipeForInputs(inputs);
    FluidStack inputFluidStack = rec.getRequiredFluidInput(inputs);
    result.add(new MachineRecipeInput(0, inputFluidStack));

    for (MachineRecipeInput ri : inputs) {
      if(!ri.isFluid() && ri.item != null) {
        ItemStack st = ri.item.copy();
        st.stackSize = rec.getNumConsumed(ri.item);
        result.add(new MachineRecipeInput(ri.slotNumber, st));
      }
    }
    return result;

  }
View Full Code Here


    List<MachineRecipeInput> result = new ArrayList<MachineRecipeInput>(inputs.length);
    for(MachineRecipeInput input : inputs) {
      if(input != null && input.item != null) {
        ItemStack resStack = input.item.copy();
        resStack.stackSize = 1;
        MachineRecipeInput mri = new MachineRecipeInput(input.slotNumber, resStack);
        result.add(mri);
      }     
    }   
    return result;
  }
View Full Code Here

  @Override
  protected boolean isMachineItemValidForSlot(int slot, ItemStack item) {
    if(!slotDefinition.isInputSlot(slot)) {
      return false;
    }
    MachineRecipeInput newInput = new MachineRecipeInput(slot, item);
    int otherSlot = slot == 0 ? 1 : 0;   
    if(inventory[otherSlot] == null) {
      List<IMachineRecipe> recipes = MachineRecipeRegistry.instance.getRecipesForInput(getMachineName(), newInput);
      if(recipes.isEmpty()) {
        return false;
      }   
      for(IMachineRecipe rec : recipes) {
        if(rec != null && rec.isValidInput(newInput)) {
          return true;
        }
      } 
    } else {
      MachineRecipeInput[] inputs = new MachineRecipeInput[] {
          newInput,
          new MachineRecipeInput(otherSlot, inventory[otherSlot])
      };
      return MachineRecipeRegistry.instance.getRecipeForInputs(getMachineName(), inputs) != null;
    }
    return false;
  }
View Full Code Here

    List<MachineRecipeInput> result = new ArrayList<MachineRecipeInput>(inputs.length);
    for(MachineRecipeInput input : inputs) {
      if(input != null && input.item != null) {
        ItemStack resStack = input.item.copy();
        resStack.stackSize = 1;
        MachineRecipeInput mri = new MachineRecipeInput(input.slotNumber, resStack);
        result.add(mri);
      }     
    }   
    return result;
  }
View Full Code Here

  public IRecipe getRecipeForInput(ItemStack input) {
    if(input == null) {
      return null;
    }
    for (Recipe recipe : recipes) {
      if(recipe.isInputForRecipe(new MachineRecipeInput(0, input))) {
        return recipe;
      }
    }
    return null;
  }
View Full Code Here

  private IRecipe getRecipeForInputs(List<ItemStack> inputs) {
    MachineRecipeInput[] ins = new MachineRecipeInput[inputs.size()];

    for (int i = 0; i < inputs.size(); i++) {
      ins[i] = new MachineRecipeInput(-1, inputs.get(i));
    }
    return getRecipeForInputs(ins);
  }
View Full Code Here

    List<MachineRecipeInput> result = new ArrayList<MachineRecipeInput>();
    for (RecipeInput ri : rec.getInputs()) {
      for (MachineRecipeInput input : inputs) {
        if(input != null && (input.item != null || input.fluid != null)) {
          if(ri.isInput(input.item) && (ri.getSlotNumber() == -1 || ri.getSlotNumber() == input.slotNumber)) {
            result.add(new MachineRecipeInput(input.slotNumber, ri.getInput().copy()));
            break;
          } else if(ri.isInput(input.fluid)) {
            result.add(new MachineRecipeInput(input.slotNumber, ri.getFluidInput().copy()));
            break;
          }
        }
      }
    }
View Full Code Here

  @Override
  public List<MachineRecipeInput> getQuantitiesConsumed(MachineRecipeInput[] inputs) {
    int consumed = 0;
    List<MachineRecipeInput> result = new ArrayList<MachineRecipeInput>();
    for (MachineRecipeInput ri : inputs) {
      if(isValidInput(new MachineRecipeInput(ri.slotNumber, ri.item)) && consumed < 3 && ri != null && ri.item != null) {
        int available = ri.item.stackSize;
        int canUse = 3 - consumed;
        int use = Math.min(canUse, available);
        if(use > 0) {
          ItemStack st = ri.item.copy();
          st.stackSize = use;
          result.add(new MachineRecipeInput(ri.slotNumber, st));
          consumed += use;
        }
      }
    }
    return result;
View Full Code Here

  }

  @Override
  protected boolean isMachineItemValidForSlot(int i, ItemStack itemstack) {
    MachineRecipeInput[] inputs = getRecipeInputs();
    inputs[i] = new MachineRecipeInput(i, itemstack);
    return VatRecipeManager.getInstance().isValidInput(inputs);
  }
View Full Code Here

  @Override
  protected MachineRecipeInput[] getRecipeInputs() {
    MachineRecipeInput[] res = new MachineRecipeInput[slotDefinition.getNumInputSlots() + 1];
    int fromSlot = slotDefinition.minInputSlot;
    for (int i = 0; i < res.length - 1; i++) {
      res[i] = new MachineRecipeInput(fromSlot, inventory[fromSlot]);
      fromSlot++;
    }

    res[res.length - 1] = new MachineRecipeInput(0, inputTank.getFluid());

    return res;
  }
View Full Code Here

TOP

Related Classes of crazypants.enderio.machine.MachineRecipeInput

Copyright © 2018 www.massapicom. 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.