@Override @Nonnull public ItemStack[] getMatchingStacks() { if (items == null) items = orbs.toArray(new ItemStack[0]); return items; }
/** * Gets an array of all variations of an item. This method will grab items from the * creative tab entries of an item, and can possibly be slow. * * @param item The item to get variations of. * @return An array of all the variations of the item. */ public static ItemStack[] getAllItems (Item item) { return findVariations(item).toArray(new ItemStack[0]); }
@Override public ItemStack[] getPermutations(ItemStack stack) { NonNullList<ItemStack> items = NonNullList.create(); stack.getItem().getSubItems(null, items); return items.toArray(new ItemStack[items.size()]); } };
private static boolean doesMatch(Block blockCheck, ScytheConfig type) { if (UtilString.isInList(type.blockWhitelist, blockCheck.getRegistryName())) { return true; } else { ItemStack bStack = new ItemStack(blockCheck); return UtilOreDictionary.doesMatchOreDict(bStack, type.oreDictWhitelist.toArray(new String[0])); } }
@Override public void onSigilUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected) { if (PlayerHelper.isFakePlayer(player)) return; ItemStack compressedStack = CompressionRegistry.compressInventory(player.inventory.mainInventory.toArray(new ItemStack[player.inventory.mainInventory.size()]), world); if (compressedStack != null) { EntityItem entityItem = new EntityItem(world, player.posX, player.posY, player.posZ, compressedStack); world.spawnEntity(entityItem); } } }
@Override public IRecipe parse(JsonContext context, JsonObject json) { ShapelessOreRecipe recipe = ShapelessOreRecipe.factory(context, json); return new ShapelessUpgradeKitRecipe(new ResourceLocation("cofh", "upgrade_kit_shapeless"), recipe.getRecipeOutput(), recipe.getIngredients().toArray()); }
@Override public IRecipe parse(JsonContext context, JsonObject json) { ShapelessOreRecipe recipe = ShapelessOreRecipe.factory(context, json); return new ShapelessColorRemoveRecipe(new ResourceLocation("cofh", "color_remove_shapeless"), recipe.getRecipeOutput(), recipe.getIngredients().toArray()); }
@SideOnly(Side.CLIENT) public MOGuideEntry setStackIcons(Block block) { NonNullList<ItemStack> stacks = NonNullList.create(); block.getSubBlocks(CreativeTabs.SEARCH, stacks); if (stacks.size() > 0) { this.stackIcons = new ItemStack[stacks.size()]; this.stackIcons = stacks.toArray(this.stackIcons); } else { this.stackIcons = new ItemStack[]{new ItemStack(block)}; } return this; }
@Override public IRecipe parse(JsonContext context, JsonObject json) { ShapelessOreRecipe recipe = ShapelessOreRecipe.factory(context, json); return new ShapelessFluidRecipe(new ResourceLocation("cofh", "fluid_shapeless"), recipe.getRecipeOutput(), recipe.getIngredients().toArray()); }
@Override public IRecipe parse(JsonContext context, JsonObject json) { ShapelessOreRecipe recipe = ShapelessOreRecipe.factory(context, json); return new ShapelessSecureRecipe(new ResourceLocation("cofh", "secure_shapeless"), recipe.getRecipeOutput(), recipe.getIngredients().toArray()); }
@Override public IRecipe parse(JsonContext context, JsonObject json) { ShapelessOreRecipe recipe = ShapelessOreRecipe.factory(context, json); return new ShapelessPotionFillRecipe(new ResourceLocation("thermalfoundation", "potion_fill_shapeless"), recipe.getRecipeOutput(), recipe.getIngredients().toArray()); }
@SideOnly(Side.CLIENT) public MOGuideEntry setStackIcons(Item item) { NonNullList<ItemStack> stacks = NonNullList.create(); item.getSubItems(CreativeTabs.SEARCH, stacks); if (stacks.size() > 0) { this.stackIcons = new ItemStack[stacks.size()]; this.stackIcons = stacks.toArray(this.stackIcons); } else { this.stackIcons = new ItemStack[]{new ItemStack(item)}; } return this; }
@Override public IRecipe parse(JsonContext context, JsonObject json) { ShapelessOreRecipe recipe = ShapelessOreRecipe.factory(context, json); return new ShapelessColorRecipe(new ResourceLocation("cofh", "color_shapeless"), recipe.getRecipeOutput(), recipe.getIngredients().toArray()); }
@Override public ItemStack[] getMatchingStacks() { if (this.items == null) { NonNullList<ItemStack> stacks = NonNullList.withSize(types.size(), ItemStack.EMPTY); for (int i = 0; i < types.size(); i++) { ItemStack stack = IronBackpacksAPI.getStack(types.get(i), specialty); stacks.set(i, stack); } this.items = stacks.toArray(new ItemStack[0]); } return this.items; }
@Override @Nonnull public ItemStack[] getMatchingStacks() { if (array == null || this.array.length != ores.size()) { NonNullList<ItemStack> lst = NonNullList.create(); for (ItemStack itemstack : this.ores) { if (itemstack.getMetadata() == OreDictionary.WILDCARD_VALUE) { itemstack.getItem().getSubItems(CreativeTabs.SEARCH, lst); } else { lst.add(itemstack); } } Collections.rotate(lst, offset); this.array = lst.toArray(new ItemStack[0]); } return this.array; }
public R fromRecipe(Recipe recipe) { this.inputs = recipe.getInputs(); this.outputs = NonNullList.from(ItemStack.EMPTY, recipe.getOutputs().toArray(new ItemStack[0])); this.chancedOutputs = new TObjectIntHashMap<>(recipe.getChancedOutputs()); this.fluidInputs = new ArrayList<>(recipe.getFluidInputs()); this.fluidOutputs = new ArrayList<>(recipe.getFluidOutputs()); this.duration = recipe.getDuration(); this.EUt = recipe.getEUt(); this.hidden = recipe.isHidden(); this.canBeBuffered = recipe.canBeBuffered(); this.needsEmptyOutput = recipe.needsEmptyOutput(); return (R) this; }
@Override public IRecipe getCraftingRecipe() { //noinspection ConstantConditions return new ShapelessOreRecipe(null, getRecipeOutput(), getIngredients().toArray(new Ingredient[getIngredients().size()])).setRegistryName(getRegistryName()); } }
public static void addTransposerFill(int energy, ItemStack input, ItemStack output, FluidStack fluid, boolean reversible) { if (!Loader.isModLoaded("thermalexpansion")) { int numDucts = MathHelper.clamp(Fluid.BUCKET_VOLUME / fluid.amount, 1, 8); NonNullList<Object> ingredients = NonNullList.create(); for (int i = 0; i < numDucts; i++) { ingredients.add(ItemHelper.cloneStack(input, 1)); } ingredients.add(new FluidIngredient(fluid.getFluid().getName())); addShapelessFluidRecipe(ItemHelper.cloneStack(output, numDucts), ingredients.toArray()); } else { ThermalExpansionHelper.addTransposerFill(energy, input, output, fluid, reversible); } }
@Override protected void onIndexUpdate(int index, ICarpenterRecipe recipe) { selectedElement.add(new TankElement(91, 1, null, () -> new FluidTankInfo(recipe.getFluidResource(), Constants.PROCESSOR_TANK_CAPACITY), CARPENTER_TANK_OVERLAY)); IDescriptiveRecipe gridRecipe = recipe.getCraftingGridRecipe(); NonNullList<NonNullList<ItemStack>> ingredients = gridRecipe.getRawIngredients(); for (int x = 0; x < 3; x++) { for (int y = 0; y < 3; y++) { int ingredientIndex = y * 3 + x; if (ingredientIndex >= ingredients.size()) { continue; } NonNullList<ItemStack> items = ingredients.get(ingredientIndex); selectedElement.add(new IngredientElement(1 + x * 19, 3 + y * 19, Ingredient.fromStacks(items.toArray(new ItemStack[items.size()])))); } } selectedElement.item(71, 41, gridRecipe.getOutput()); } }
@Override protected void onIndexUpdate(int index, IFabricatorRecipe recipe) { selectedElement.add(new TankElement(1, 33, null, () -> new FluidTankInfo(recipe.getLiquid(), 2000), FABRICATOR_TANK_OVERLAY, 16, 16)); NonNullList<NonNullList<ItemStack>> ingredients = recipe.getIngredients(); for (int x = 0; x < 3; x++) { for (int y = 0; y < 3; y++) { int ingredientIndex = y * 3 + x; if (ingredientIndex >= ingredients.size()) { continue; } NonNullList<ItemStack> items = ingredients.get(ingredientIndex); selectedElement.add(new IngredientElement(21 + x * 19, 1 + y * 19, Ingredient.fromStacks(items.toArray(new ItemStack[items.size()])))); } } ItemStack plan = recipe.getPlan(); if (!plan.isEmpty()) { selectedElement.item(91, 1, plan); } selectedElement.item(91, 39, recipe.getRecipeOutput()); NonNullList<ItemStack> smeltingInput = NonNullList.create(); Fluid recipeFluid = recipe.getLiquid().getFluid(); for (IFabricatorSmeltingRecipe s : getSmeltingInputs().get(recipeFluid)) { smeltingInput.add(s.getResource()); } if (!smeltingInput.isEmpty()) { selectedElement.add(new IngredientElement(1, 6, smeltingInput)); } }