/** Returns a fixed size DEEP copy of the list */ public static NonNullList<ItemStack> deepCopyFixedNonNullList(NonNullList<ItemStack> in) { return RecipeMatchRegistry.copyItemStackArray(in); }
protected void setTooltips(List<String> tooltips) { // convert \n in localized text to actual newlines if(tooltips != null) { for(int i = 0; i < tooltips.size(); i++) { tooltips.set(i, LocUtils.convertNewlines(tooltips.get(i))); } } this.tooltips = tooltips; }
private NonNullList<ItemStack> getInputs() { NonNullList<ItemStack> input = NonNullList.withSize(tile.getSizeInventory() - 1, ItemStack.EMPTY); for(int i = 1; i < tile.getSizeInventory(); i++) { input.set(i - 1, tile.getStackInSlot(i)); } return input; }
/** Registers a casting recipe for casting table */ public static void registerTableCasting(ItemStack output, ItemStack cast, Fluid fluid, int amount) { RecipeMatch rm = null; if(cast != ItemStack.EMPTY) { rm = RecipeMatch.ofNBT(cast); } registerTableCasting(new CastingRecipe(output, rm, fluid, amount)); }
public boolean matches(ItemStack input) { return this.input != null && this.input.matches(ListUtil.getListFrom(input)).isPresent(); }
/** Registers this itemstack NBT-SENSITIVE to melt into amount of the given fluid. */ public static void registerMelting(ItemStack stack, Fluid fluid, int amount) { registerMelting(new MeltingRecipe(new RecipeMatch.ItemCombination(amount, stack), fluid)); }
/** * Adds a new drying recipe * * @param input Input ItemStack * @param output Output ItemStack * @param time Recipe time in ticks */ public static void registerDryingRecipe(ItemStack input, ItemStack output, int time) { if(output.isEmpty() || input.isEmpty()) { return; } addDryingRecipe(new DryingRecipe(new RecipeMatch.Item(input, 1), output, time)); }
/** * Adds a new drying recipe * * @param oredict Input ore dictionary entry * @param output Output ItemStack * @param time Recipe time in ticks */ public static void registerDryingRecipe(String oredict, ItemStack output, int time) { if(output.isEmpty() || oredict == null) { return; } addDryingRecipe(new DryingRecipe(new RecipeMatch.Oredict(oredict, 1), output, time)); }
@Override public List<List<ItemStack>> getItems() { ImmutableList.Builder<List<ItemStack>> builder = ImmutableList.builder(); for(RecipeMatch rm : items) { List<ItemStack> in = rm.getInputs(); if(!in.isEmpty()) { builder.add(in); } } return builder.build(); } }
/** Registers a casting recipe for the casting basin */ public static void registerBasinCasting(ItemStack output, ItemStack cast, Fluid fluid, int amount) { RecipeMatch rm = null; if(!cast.isEmpty()) { rm = RecipeMatch.ofNBT(cast); } registerBasinCasting(new CastingRecipe(output, rm, fluid, amount)); }
public boolean matches(ItemStack stack) { return input.matches(ListUtil.getListFrom(stack)).isPresent(); }
/** Registers this block with all its metadatas to melt into amount of the given fluid. */ public static void registerMelting(Block block, Fluid fluid, int amount) { ItemStack stack = new ItemStack(block, 1, OreDictionary.WILDCARD_VALUE); registerMelting(new MeltingRecipe(new RecipeMatch.Item(stack, 1, amount), fluid)); }
public static void registerMelting(String oredict, Fluid fluid, int amount) { registerMelting(new MeltingRecipe(new RecipeMatch.Oredict(oredict, 1, amount), fluid)); }
@Override public List<List<ItemStack>> getItems() { ImmutableList.Builder<List<ItemStack>> builder = ImmutableList.builder(); for(RecipeMatch rm : items) { List<ItemStack> in = rm.getInputs(); if(!in.isEmpty()) { builder.add(in); } } return builder.build(); }
public void setText(List<String> text, List<String> tooltips) { // convert \n in localized text to actual newlines if(text != null) { text = Lists.newArrayList(text); for(int i = 0; i < text.size(); i++) { text.set(i, LocUtils.convertNewlines(text.get(i))); } } this.text = text; updateSliderParameters(); setTooltips(tooltips); }
@Override public boolean matches(ItemStack cast, Fluid fluid) { if((cast.isEmpty() && this.cast == null) || (this.cast != null && this.cast.matches(ListUtil.getListFrom(cast)).isPresent())) { return this.fluid.getFluid() == fluid; } return false; }
public static List<MeltingRecipe> getSmeltingRecipes() { List<MeltingRecipe> recipes = new ArrayList<>(); for(MeltingRecipe recipe : TinkerRegistry.getAllMeltingRecipies()) { if(recipe.output != null && recipe.input != null && recipe.input.getInputs() != null && recipe.input.getInputs().size() > 0) { recipes.add(recipe); } } return recipes; } }
public static List<DryingRecipe> getDryingRecipes() { List<DryingRecipe> recipes = new ArrayList<>(); for(DryingRecipe recipe : TinkerRegistry.getAllDryingRecipes()) { if(recipe.output != null && recipe.input != null && recipe.input.getInputs() != null && recipe.input.getInputs().size() > 0) { recipes.add(recipe); } } return recipes; } }
public DryingRecipeWrapper(DryingRecipe recipe) { this.input = ImmutableList.of(recipe.input.getInputs()); this.output = ImmutableList.of(recipe.getResult()); this.time = recipe.getTime(); }
public CastingRecipeWrapper(CastingRecipe recipe, IDrawable castingBlock) { // cast is not required if(recipe.cast != null) { cast = recipe.cast.getInputs(); } else { cast = ImmutableList.of(); } this.inputFluid = ImmutableList.of(recipe.getFluid()); this.recipe = recipe; this.output = ImmutableList.of(recipe.getResult()); this.castingBlock = castingBlock; }