private static IRecipe getToolHeadSchematicRecipe(ItemStack output, String material, String type, int cost) { NonNullList<Ingredient> inputs = NonNullList.withSize(cost + 1, Ingredient.EMPTY); ItemStack schematic = new ItemStack(ModItems.schematic); NBTTagCompound nbt = new NBTTagCompound(); nbt.setString(ItemSchematic.type_tag, type); schematic.setTagCompound(nbt); Ingredient schematicIngredient = new IngredientNBT(schematic) { }; inputs.set(0, schematicIngredient); for (int i = 1; i <= cost; i++) { inputs.set(i, new OreIngredient(material)); } return new ShapelessOreRecipe(null, inputs, output); }
private boolean matchesInput(ShapelessOreRecipe recipe) { if (recipe.getIngredients().size() != getRecipeSize()) return false; Object[] input = getRecipeInput(); for (int i = 0; i < recipe.getIngredients().size(); i++) { Ingredient target = recipe.getIngredients().get(i); Object source = input[i]; if (!ItemHelper.isSameRecipeInput(target, source)) return false; } return true; }
public static JsonBrickOvenShapelessRecipe convert(ShapelessOreRecipe recipe) { List<Object> inputs = new ArrayList<>(); for (Object obj : recipe.getIngredients()) { if (obj instanceof ItemStack) { inputs.add(obj); } else if (obj instanceof List) { try { @SuppressWarnings("unchecked") String ore = RegistryUtil.getCommonOreDictName((List<ItemStack>)obj); inputs.add(ore); } catch (ClassCastException ex) { LogUtil.log(Level.ERROR, "Failed to cast list in ore dictionary conversion: " + ex.toString()); } } } return new JsonBrickOvenShapelessRecipe(recipe.getRecipeOutput(), inputs); }
public static void registerRecipe(final Class<? extends IRecipe> recipe) { if (ExtraUtils.registeredRecipes.contains(recipe)) { return; } if (!recipe.getName().startsWith("com.rwtema.")) { return; } ExtraUtils.registeredRecipes.add(recipe); LogHelper.fine("Registering " + recipe.getSimpleName() + " to RecipeSorter", new Object[0]); if (ShapedOreRecipe.class.isAssignableFrom(recipe)) { RecipeSorter.register("extrautils:" + recipe.getSimpleName(), (Class)recipe, RecipeSorter.Category.SHAPED, "after:forge:shapedore"); } else if (ShapelessOreRecipe.class.isAssignableFrom(recipe)) { RecipeSorter.register("extrautils:" + recipe.getSimpleName(), (Class)recipe, RecipeSorter.Category.SHAPELESS, "after:forge:shapelessore"); } else if (ShapedRecipes.class.isAssignableFrom(recipe)) { RecipeSorter.register("extrautils:" + recipe.getSimpleName(), (Class)recipe, RecipeSorter.Category.SHAPED, "after:minecraft:shaped before:minecraft:shapeless"); } else if (ShapelessRecipes.class.isAssignableFrom(recipe)) { RecipeSorter.register("extrautils:" + recipe.getSimpleName(), (Class)recipe, RecipeSorter.Category.SHAPELESS, "after:minecraft:shapeless before:minecraft:bookcloning"); } else { RecipeSorter.register("extrautils:" + recipe.getSimpleName(), (Class)recipe, RecipeSorter.Category.SHAPELESS, "after:forge:shapelessore"); } }
@Override public void loadCraftingRecipes(String outputId, Object... results) { if (outputId.equals("crafting") && getClass() == ShapelessRecipeHandler.class) { List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList(); for (IRecipe irecipe : allrecipes) { CachedShapelessRecipe recipe = null; if (irecipe instanceof ShapelessRecipes) recipe = shapelessRecipe((ShapelessRecipes) irecipe); else if (irecipe instanceof ShapelessOreRecipe) recipe = forgeShapelessRecipe((ShapelessOreRecipe) irecipe); if (recipe == null) continue; arecipes.add(recipe); } } else { super.loadCraftingRecipes(outputId, results); } }
@Override public void loadCraftingRecipes(ItemStack result) { List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList(); for (IRecipe irecipe : allrecipes) { if (NEIServerUtils.areStacksSameTypeCrafting(irecipe.getRecipeOutput(), result)) { CachedShapelessRecipe recipe = null; if (irecipe instanceof ShapelessRecipes) recipe = shapelessRecipe((ShapelessRecipes) irecipe); else if (irecipe instanceof ShapelessOreRecipe) recipe = forgeShapelessRecipe((ShapelessOreRecipe) irecipe); if (recipe == null) continue; arecipes.add(recipe); } } }
@Override public void loadUsageRecipes(ItemStack ingredient) { List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList(); for (IRecipe irecipe : allrecipes) { CachedShapelessRecipe recipe = null; if (irecipe instanceof ShapelessRecipes) recipe = shapelessRecipe((ShapelessRecipes) irecipe); else if (irecipe instanceof ShapelessOreRecipe) recipe = forgeShapelessRecipe((ShapelessOreRecipe) irecipe); if (recipe == null) continue; if (recipe.contains(recipe.ingredients, ingredient)) { recipe.setIngredientPermutation(recipe.ingredients, ingredient); arecipes.add(recipe); } } }
private static void buildHandlerMap() { // RecipesMapExtending extends ShapedRecipes, and causes a crash when attempting to uncraft a map HANDLERS.put(RecipesMapExtending.class, null); // vanilla Minecraft recipe handlers HANDLERS.put(ShapedRecipes.class, new ShapedRecipeHandler()); HANDLERS.put(ShapelessRecipes.class, new ShapelessRecipeHandler()); HANDLERS.put(RecipeFireworks.class, new FireworksRecipeHandler()); HANDLERS.put(RecipeTippedArrow.class, new TippedArrowRecipeHandler()); // Forge Ore Dictionary recipe handlers HANDLERS.put(ShapedOreRecipe.class, new ShapedOreRecipeHandler()); HANDLERS.put(ShapelessOreRecipe.class, new ShapelessOreRecipeHandler()); // cofh recipe handlers if (CoFHRecipeHandlers.CoverRecipeHandler.recipeClass != null) HANDLERS.put(CoFHRecipeHandlers.CoverRecipeHandler.recipeClass, new CoFHRecipeHandlers.CoverRecipeHandler()); // industrialcraft 2 recipe handlers if (ShapedIC2RecipeHandler.recipeClass != null) HANDLERS.put(ShapedIC2RecipeHandler.recipeClass, new ShapedIC2RecipeHandler()); if (ShapelessIC2RecipeHandler.recipeClass != null) HANDLERS.put(ShapelessIC2RecipeHandler.recipeClass, new ShapelessIC2RecipeHandler()); // tinker's construct recipe handlers if (TinkersRecipeHandlers.TableRecipeHandler.recipeClass != null) HANDLERS.put(TinkersRecipeHandlers.TableRecipeHandler.recipeClass, new TinkersRecipeHandlers.TableRecipeHandler()); }
@Override public NonNullList<ItemStack> getCraftingGrid(IRecipe r) { // cast the IRecipe instance ShapelessOreRecipe shapelessRecipe = (ShapelessOreRecipe)r; // get a copy of the recipe items with normalised metadata NonNullList<ItemStack> recipeStacks = copyRecipeStacks(shapelessRecipe.getIngredients()); // copyRecipeStacks(getOreRecipeItems(shapelessRecipe.getIngredients())); if (!recipeStacks.isEmpty()) { // return the itemstacks return recipeStacks; } else return NonNullList.<ItemStack>create(); }
public static void init() { GameRegistry.addRecipe(new RecipeScrewDriver()); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.LENS, 3), "AAA", 'A', "blockGlass")); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.REFLECTIVE_ALLOY, 2), Items.IRON_INGOT, Items.GOLD_INGOT)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.ASSEMBLY_TABLE), "ABA", "A A", "AAA", 'A', "ingotIron", 'B', ModBlocks.LENS)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.MAGNIFIER), "ABA", "A A", "A A", 'A', "ingotIron", 'B', ModBlocks.LENS)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.SCREW_DRIVER), " AA", " BA", "B ", 'A', "ingotIron", 'B', Items.STICK)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.LASER_PEN), " A", " BC", "D ", 'A', Blocks.STONE_BUTTON, 'B', "dustRedstone", 'C', "ingotIron", 'D', "blockGlass")); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.REFLECTIVE_ALLOY_BLOCK), "AAA", "AAA", "AAA", 'A', ModItems.REFLECTIVE_ALLOY)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.GRENADE, 3), " A ", "ABA", " A ", 'A', ModItems.REFLECTIVE_ALLOY, 'B', Blocks.TNT)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.HELMET), "AAA", "A A", " ", 'A', ModItems.REFLECTIVE_ALLOY)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.CHESTPLATE), "A A", "AAA", "AAA", 'A', ModItems.REFLECTIVE_ALLOY)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.LEGGINGS), "AAA", "A A", "A A", 'A', ModItems.REFLECTIVE_ALLOY)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.BOOTS), " ", "A A", "A A", 'A', ModItems.REFLECTIVE_ALLOY)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.LIGHT_CARTRIDGE), " A ", "ABA", " A ", 'A', ModItems.REFLECTIVE_ALLOY, 'B', Blocks.GLASS_PANE)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.SPECTROMETER), "ABC", "DEF", "DDD", 'A', "dyeRed", 'B', "dyeGreen", 'C', "dyeBlue", 'D', "ingotIron", 'F', "paneGlass", 'E', LibOreDict.REFLECTIVE_ALLOY)); GameRegistry.addShapelessRecipe(new ItemStack(ModItems.BOOK), ModItems.LASER_PEN, Items.BOOK); if (!ConfigValues.DISABLE_PHOTON_CANNON) GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.PHOTON_CANNON), " BA", "CDB", "EC ", 'A', ModBlocks.LENS, 'B', ModBlocks.MIRROR, 'C', ModItems.REFLECTIVE_ALLOY, 'D', ModBlocks.ELECTRON_EXCITER, 'E', ModBlocks.SENSOR)); }
static void setup() { if (is_setup) return; is_setup = true; reg(ItemStack.class, new WriteItemStack()); reg(Item.class, new WriteItem()); reg(Block.class, new WriteBlock()); reg(String.class, new WriteStringOreDictionary()); reg(Number.class, new WriteObjectToString()); reg(NBTBase.class, new WriteObjectToString()); reg(FluidStack.class, new WriteFluidStack()); reg(Fluid.class, new WriteFluid()); reg(Collection.class, new WriteCollection()); // IRecipe: "embedded IRecipe"; haven't seen it crop up tho reg(ShapedOreRecipe.class, new WriteShapedOreRecipe()); reg(ShapedRecipes.class, new WriteShapedRecipe()); reg(ShapelessOreRecipe.class, new WriteShapelessOreRecipe()); reg(ShapelessRecipes.class, new WriteShapelessRecipe()); reg(Map.Entry.class, new WriteEntry()); IObjectWriter.adapter.register(new ArrayAdapter()); IObjectWriter.adapter.setFallbackAdapter(new GenericAdapter<Object, IObjectWriter>(Object.class, new ReflectionWriter())); }
@Override public void loadCraftingRecipes(String outputId, Object... results) { if (outputId.equals("crafting") && getClass() == ShapelessRecipeHandler.class) { List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList(); for (IRecipe irecipe : allrecipes) { CachedShapelessRecipe recipe = null; if (irecipe instanceof ShapelessRecipes) { recipe = shapelessRecipe((ShapelessRecipes) irecipe); } else if (irecipe instanceof ShapelessOreRecipe) { recipe = forgeShapelessRecipe((ShapelessOreRecipe) irecipe); } if (recipe == null) { continue; } arecipes.add(recipe); } } else { super.loadCraftingRecipes(outputId, results); } }
@Override public void loadCraftingRecipes(ItemStack result) { List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList(); for (IRecipe irecipe : allrecipes) { if (NEIServerUtils.areStacksSameTypeCrafting(irecipe.getRecipeOutput(), result)) { CachedShapelessRecipe recipe = null; if (irecipe instanceof ShapelessRecipes) { recipe = shapelessRecipe((ShapelessRecipes) irecipe); } else if (irecipe instanceof ShapelessOreRecipe) { recipe = forgeShapelessRecipe((ShapelessOreRecipe) irecipe); } if (recipe == null) { continue; } arecipes.add(recipe); } } }
@Override public void loadUsageRecipes(ItemStack ingredient) { List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList(); for (IRecipe irecipe : allrecipes) { CachedShapelessRecipe recipe = null; if (irecipe instanceof ShapelessRecipes) { recipe = shapelessRecipe((ShapelessRecipes) irecipe); } else if (irecipe instanceof ShapelessOreRecipe) { recipe = forgeShapelessRecipe((ShapelessOreRecipe) irecipe); } if (recipe == null) { continue; } if (recipe.contains(recipe.ingredients, ingredient)) { recipe.setIngredientPermutation(recipe.ingredients, ingredient); arecipes.add(recipe); } } }
@Override public void register() { super.register(); final List<ItemStack> input = new ArrayList<ItemStack>(); input.add(new ItemStack(ItemManager.material, 1, Material.RTG_HOUSING)); final ItemStack cell = new ItemStack(ItemManager.material, 1, Material.FUEL_CELL); for (int i = 1; i < 9; i++) { input.add(cell); final ItemStack rtg = new ItemStack(ItemManager.energyCell, 1, RTGEnergyCell.RTG); RTGEnergyCell.initialize(rtg, i); final ShapelessOreRecipe shapeless = new ShapelessOreRecipe(rtg, input.toArray()); GameRegistry.addRecipe(shapeless); } }
@Override public List<RecipeLink> getRecipes() { List<RecipeLink> a = new ArrayList<RecipeLink>(); for (Object obj : RecipeRegistry.vanillaCrafting.get(ShapelessOreRecipe.class)) { ShapelessOreRecipe recipe = (ShapelessOreRecipe) obj; RecipeLink link = new RecipeLink(); for (Object stack : recipe.getInput()) { if (stack!=null) { link.inputs.add(new ItemDataStack(RecipeRegistry.flatten(stack))); } } link.outputs.add(new ItemDataStack(recipe.getRecipeOutput())); a.add(link); } return a; }
@ZenMethod public static void addShapeless(IItemStack output, IIngredient[] inputs) { if (inputs == null) { MineTweakerAPI.getLogger().logError("Large Furnace: Input set must not be null!"); return; } if (inputs.length == 0) { MineTweakerAPI.getLogger().logError("Large Furnace: Input set must not empty!"); return; } if (output == null) { MineTweakerAPI.getLogger().logError("Large Furnace: Output must not be null!"); return; } ShapelessOreRecipe recipe = constructSafely(toStack(output), toObjects(inputs)); if (recipe == null) { MineTweakerAPI.getLogger().logError("Large Furnace: Illegal recipe."); return; } MineTweakerAPI.apply(new FurnaceAdd(output, recipe)); }
private static IRecipe findRecipe(ItemStack stack, int type) { final IRecipe[] recipe = {null}; FurnaceCraftingManager.getInstance().getRecipeList().stream() .filter(xRecipe -> { if (type == TYPE_SHAPELESS) { return xRecipe instanceof ShapelessOreRecipe || xRecipe instanceof ShapelessRecipes; } else if (type == TYPE_SHAPED) { return xRecipe instanceof ShapedOreRecipe; } return xRecipe instanceof IRecipe; }) .forEachOrdered(xRecipe -> { if (areEqual(stack, ((IRecipe) xRecipe).getRecipeOutput())) { recipe[0] = (IRecipe) xRecipe; } }); return recipe[0]; }
public FurnaceRemove(ItemStack output, int type) { this.output = output; FurnaceCraftingManager.getInstance().getRecipeList().stream().filter(xRecipe -> xRecipe instanceof IRecipe) .filter(xRecipe -> { if (type == TYPE_SHAPELESS) { return xRecipe instanceof ShapelessOreRecipe || xRecipe instanceof ShapelessRecipes; } else if (type == TYPE_SHAPED) { return xRecipe instanceof ShapedOreRecipe; } return xRecipe instanceof IRecipe; }) .forEachOrdered(xRecipe -> { if (areEqual(output, ((IRecipe) xRecipe).getRecipeOutput())) { recipes.add((IRecipe) xRecipe); } }); }
private static void handleShapelessOre( List< DisplayStack > items, ShapelessOreRecipe recipe, int craftLeft, int craftTop ) { for ( int i = 0; i < recipe.getInput().size(); ++i ) { int ix = i % 3; int iy = i / 3; Object obj = recipe.getInput().get( i ); ItemStack[] stack = getAliases( obj ); int x = craftLeft + 1 + ix * 18; int y = craftTop + 1 + iy * 18; items.add( new DisplayStack( x, y, stack ) ); } items.add( new DisplayStack( craftLeft + 18 - 4 + 5, craftTop + 90 + 5, recipe.getRecipeOutput() ) ); }
@SuppressWarnings("unchecked") @Override public void loadCraftingRecipes(ItemStack result) { for (DifficultyRecipe<?> rec : DifficultyRecipe.allRecipes) { if (rec.getType() == ShapelessOreRecipe.class) { DifficultyRecipe<ShapelessOreRecipe> recipe = (DifficultyRecipe<ShapelessOreRecipe>) rec; Difficulty diff = recipe.getDifficulty(Minecraft.getMinecraft().theWorld); ShapelessOreRecipe irecipe = recipe.getRecipe(diff); if (irecipe != null && NEIServerUtils.areStacksSameTypeCrafting(irecipe.getRecipeOutput(), result)) { CachedShapelessRecipe cached = null; cached = forgeShapelessRecipe(recipe.getRecipe(diff)); if (cached == null) continue; arecipes.add(cached); this.cached.add(recipe); } } } }
@SuppressWarnings("unchecked") @Override public void loadUsageRecipes(ItemStack ingredient) { for (DifficultyRecipe<?> rec : DifficultyRecipe.allRecipes) { if (rec.getType() == ShapelessOreRecipe.class) { DifficultyRecipe<ShapelessOreRecipe> recipe = (DifficultyRecipe<ShapelessOreRecipe>) rec; CachedShapelessRecipe cached = null; cached = forgeShapelessRecipe(recipe.getRecipe(recipe.getDifficulty(Minecraft.getMinecraft().theWorld))); if (cached == null || !cached.contains(cached.ingredients, ingredient.getItem())) continue; if (cached.contains(cached.ingredients, ingredient)) { cached.setIngredientPermutation(cached.ingredients, ingredient); arecipes.add(cached); this.cached.add(recipe); } } } }
public static void init() { OreDictionary.registerOre("ingotLead", new ItemStack(ModItems.leadIngot)); OreDictionary.registerOre("oreLead", new ItemStack(ModBlocks.leadOre)); OreDictionary.registerOre("blockLead", new ItemStack(ModBlocks.leadBlock)); OreDictionary.registerOre("plateLead", new ItemStack(ModItems.plateLead)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.leadBlock), "xxx", "xxx", "xxx", 'x', "ingotLead")); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.leadIngot, 9), "blockLead")); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.plateLead, 2), "xx", 'x', "ingotLead")); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.leatherLined), Items.leather, "plateLead")); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.rebar, 9), " x", " x ", "x ", 'x', "ingotIron")); GameRegistry.addShapedRecipe(new ItemStack(Items.leather), "xxx", "xxx", "xxx", 'x', ModItems.batLeather); GameRegistry.addSmelting(ModBlocks.leadOre, new ItemStack(ModItems.leadIngot), 0.5f); GameRegistry.addSmelting(ModItems.mushroom, new ItemStack(ModItems.cookedMushroom), 0.0f); }
@Override public ShapelessOreRecipe[] getRecipesFromNBT(NBTTagCompound nbtRecipe) { ArrayList<Object> input = new ArrayList<Object>(); ItemStack newOutput = ItemStack.loadItemStackFromNBT(nbtRecipe.getCompoundTag(NBT_newOutput)); ItemStack oldOutput = ItemStack.loadItemStackFromNBT(nbtRecipe.getCompoundTag(NBT_oldOutput)); NBTTagList inputs = nbtRecipe.getTagList(NBT_input, 10); for (int i = 0; i < inputs.tagCount(); i++) { NBTTagCompound nbtInput = inputs.getCompoundTagAt(i); if (nbtInput.hasKey(NBT_oredictname)) input.add(nbtInput.getString(NBT_oredictname)); else input.add(ItemStack.loadItemStackFromNBT(nbtInput)); } return new ShapelessOreRecipe[] {new DimBasedShapelessOreRecipe(true, newOutput, input.toArray()), new DimBasedShapelessOreRecipe(false, oldOutput, input.toArray())}; }
@Override public int GetRecipesAmountFor(ItemStack stack) { int i = 0; for(Object r : CraftingManager.getInstance().getRecipeList()){ if(r instanceof IRecipe) { IRecipe res = (IRecipe) r; if(res instanceof ShapelessOreRecipe || res instanceof ShapedOreRecipe || res instanceof ShapedRecipes || res instanceof ShapelessRecipes) if(StackUtils.AreStacksEqualIgnoreData(res.getRecipeOutput(), stack)){ i += 1; } } } return i; }
public ShapelessMoarSignRecipe(IRecipe recipe, Map<ItemStack, Object> replacements) { output = recipe.getRecipeOutput(); for (Object ingred : (recipe instanceof ShapelessRecipes ? ((ShapelessRecipes) recipe).recipeItems : ((ShapelessOreRecipe) recipe).getInput())) { Object finalObj = ingred; for (Entry<ItemStack, Object> replace : replacements.entrySet()) { if (ingred instanceof ItemStack && OreDictionary.itemMatches(replace.getKey(), (ItemStack) ingred, false)) { if (replace.getValue() instanceof String) { finalObj = OreDictionary.getOres(String.valueOf(replace.getValue())); } else if (replace.getValue() instanceof MatchType || replace.getValue() instanceof MaterialInfo) { finalObj = replace.getValue(); } break; } } input.add(finalObj); } }
public static void addRecipes() { if (fertilizerEnabled) { GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ItemList.fertilizer, 8), "dustPhosphorus", "dustSaltpeter", "dustPotash", "dustMagnesium")); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ItemList.fertilizer, 6), "dustSaltpeter", "dustPotash", "dustMagnesium")); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ItemList.fertilizer, 6), "dustPhosphorus", "dustPotash", "dustMagnesium")); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ItemList.fertilizer, 6), "dustPhosphorus", "dustSaltpeter", "dustMagnesium")); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ItemList.fertilizer, 6), "dustPhosphorus", "dustSaltpeter", "dustPotash")); } if (tarEnabled) { ItemStack tarStack = new ItemStack(ItemList.tar); OreDictionary.registerOre("slimeball", tarStack.copy()); ArrayList<ItemStack> bitumenDusts = OreDictionary.getOres("dustBitumen"); if (bitumenDusts.size() > 0) { ItemStack bitumen = bitumenDusts.get(0); GameRegistry.addSmelting(bitumen.copy(), tarStack.copy(), 0.7F); } } }
private void addIronDustRecipes() { ArrayList<ItemStack> ironDusts = OreDictionary.getOres("dustIron"); if (ironDusts.size() < 1) { LogHandler.log("Iron Dust wasn't found in the ore dictionary, skipping adding Iron dust coverting recipes"); return; } ItemStack dustIron = ironDusts.get(0); if (dustIron == null) { LogHandler.log("Iron Dust wasn't found in the ore dictionary, skipping adding Iron dust coverting recipes"); return; } dustIron = dustIron.copy(); dustIron.stackSize = 2; GameRegistry.addRecipe(new ShapelessOreRecipe(dustIron.copy(), "dustShadowIron", "dustIgnatius")); GameRegistry.addRecipe(new ShapelessOreRecipe(dustIron.copy(), "dustDeepIron", "dustPrometheum")); }
public void registerRecipes() { for (int i = 0; i < resourceTypes.length; i++) { String s = resourceTypes[i]; String nm = "ingot"+Strings.formatTitleCase(s).replace(" ", ""); List<ItemStack> li = OreDictionary.getOres(nm); if (li == null || li.isEmpty()) { nm = "gem"+Strings.formatTitleCase(s).replace(" ", ""); li = OreDictionary.getOres(nm); } ItemStack stack = li.get(0).copy(); stack.stackSize = 9; String configName = Strings.formatTitleCase(resourceTypes[i]).replace(" ", ""); configName = Character.toLowerCase(configName.charAt(0)) + configName.substring(1); if (FarragoMod.config.getBoolean("compressedBlocks."+configName+".uncraftable")) { GameRegistry.addRecipe(new ShapelessOreRecipe(stack, new ItemStack(this, 1, i))); } if (FarragoMod.config.getBoolean("compressedBlocks."+configName+".craftable")) { GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(this, 1, i), nm, nm, nm, nm, nm, nm, nm, nm, nm)); } } }
@Override public IRecipeData[] getAllRecipes() { ArrayList<IRecipeData> shapelessOreList = new ArrayList<IRecipeData>(); Iterator it = CraftingManager.getInstance().getRecipeList().iterator(); while(it.hasNext()) { Object o = it.next(); if(o instanceof ShapelessOreRecipe) { shapelessOreList.add(new RecipeData((ShapelessOreRecipe)o)); } } return shapelessOreList.toArray(new IRecipeData[0]); }
@Override public String generateDescription() { if(description!=null) return description; description = getPrefix()+"!"; ArrayList items = ObfuscationReflectionHelper.getPrivateValue(ShapelessOreRecipe.class, sr, 1); for(Object o : items) { if(o instanceof ItemStack) { description += Formatter.getISDescription((ItemStack) o); } else { description += Formatter.getItemOreDescription(o); } } ItemStack result = sr.getRecipeOutput(); description+="->"+Formatter.getISDescription(result); return description; }
@Override public void registerDerivatives() { // Backup flint recipe if (Config.addFlintRecipe) { GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack( Items.flint), new ItemStack(Items.bowl), new ItemStack( Blocks.gravel))); FMLCommonHandler.instance().bus().register(new MakeGravelEvent()); } if (Config.changeEnchTableRecipe) { RemapHelper.removeAnyRecipe(new ItemStack(Blocks.enchanting_table)); GameRegistry.addRecipe(new ShapedOreRecipe( // new ItemStack(Blocks.enchanting_table), // " b ", "dWd", "WcW", // 'b', new ItemStack(Items.book), // 'd', new ItemStack(Items.diamond), // 'W', "plankWood", // 'c', "gemCopper")); } }
public static void registerPaintingRecipes(String oreDict, Block outBlock) { for (int i = 0; i <= 15; i++) { GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(outBlock, 1, i), new ItemStack(ModItems.paintbrushColoured, 1, i), oreDict)); } for (int i = 0; i <= 15; i++) { GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(outBlock, 2, i), new ItemStack(ModItems.paintbrushColoured, 1, i), oreDict, oreDict)); } for (int i = 0; i <= 15; i++) { GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(outBlock, 3, i), new ItemStack(ModItems.paintbrushColoured, 1, i), oreDict, oreDict, oreDict)); } for (int i = 0; i <= 15; i++) { GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(outBlock, 4, i), new ItemStack(ModItems.paintbrushColoured, 1, i), oreDict, oreDict, oreDict, oreDict)); } for (int i = 0; i <= 15; i++) { GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(outBlock, 5, i), new ItemStack(ModItems.paintbrushColoured, 1, i), oreDict, oreDict, oreDict, oreDict, oreDict)); } for (int i = 0; i <= 15; i++) { GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(outBlock, 6, i), new ItemStack(ModItems.paintbrushColoured, 1, i), oreDict, oreDict, oreDict, oreDict, oreDict, oreDict)); } for (int i = 0; i <= 15; i++) { GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(outBlock, 7, i), new ItemStack(ModItems.paintbrushColoured, 1, i), oreDict, oreDict, oreDict, oreDict, oreDict, oreDict, oreDict)); } for (int i = 0; i <= 15; i++) { GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(outBlock, 8, i), new ItemStack(ModItems.paintbrushColoured, 1, i), oreDict, oreDict, oreDict, oreDict, oreDict, oreDict, oreDict, oreDict)); } }
protected IntPair costs(IRecipe recipe, ItemStack target, ItemStack catalyst, boolean sanitycheck) { if(recipe.getRecipeOutput() == null) return new IntPair(); final int sizeOut = recipe.getRecipeOutput().stackSize; if(sanitycheck) { if(recipe.getRecipeSize() >= sizeOut) return new IntPair(); if(!target.isItemEqual(recipe.getRecipeOutput()) || target.hasTagCompound() || catalyst.hasTagCompound()) return new IntPair(); if(recipe.getClass() != ShapelessRecipes.class && recipe.getClass() != ShapelessOreRecipe.class && recipe.getClass() != ShapedRecipes.class && recipe.getClass() != ShapedOreRecipe.class) return new IntPair(); } if(target.stackSize+catalyst.stackSize < sizeOut) return new IntPair(); final int targetdrain = Math.min(sizeOut, target.stackSize); return new IntPair(targetdrain, sizeOut-targetdrain); }
public static void init() { // Shaped GameRegistry.addRecipe(new ItemStack(ModItems.mapleLeaf), " s ", "sss", " s ", 's', new ItemStack(Items.stick)); // Shapeless GameRegistry.addShapelessRecipe(new ItemStack(ModBlocks.flag), new ItemStack(ModItems.mapleLeaf), new ItemStack(ModItems.mapleLeaf)); // Shaped Ore Dictionary GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModItems.mapleLeaf), " s ", "sss", " s ", 's', "stickWood")); //Shapeless Ore Dictionary GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModBlocks.flag), new ItemStack(ModItems.mapleLeaf), new ItemStack(ModItems.mapleLeaf))); }
@RecipeAddition(requiredModids = "TConstruct") public static void addRecipes() { TweakingRegistry.addTweakedTooltip(heartCanister, 5, TweakingRegistry.TweakingAction.ADDED, "Added green heart", "canister recipe"); TweakingRegistry.addTweakedTooltip(heartCanister, 6, TweakingRegistry.TweakingAction.ADDED, "Added green heart", "canister recipe"); if (ConfigurationHandler.addGreenHeartRecipe) { GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(heartCanister, 1, 5), "BBB", "BHB", "BBB", 'B', Blocks.emerald_block, 'H', new ItemStack(heartCanister, 1, 3) )); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(heartCanister, 1, 6), new ItemStack(heartCanister, 1, 5), new ItemStack(heartCanister, 1, 4), Items.nether_star )); } }
@RecipeAddition(requiredModids = {"Railcraft"}, time = EventTime.WORLD_LOAD) public static void registerOres() { ItemStack plateIron = new ItemStack(plate, 1, 0); ItemStack plateSteel = new ItemStack(plate, 1, 1); ItemStack plateTin = new ItemStack(plate, 1, 2); ItemStack plateCopper = new ItemStack(plate, 1, 3); GameRegistry.addRecipe(new ShapelessOreRecipe(plateIron, "plateIron")); GameRegistry.addRecipe(new ShapelessOreRecipe(plateSteel, "plateSteel")); GameRegistry.addRecipe(new ShapelessOreRecipe(plateTin, "plateTin")); GameRegistry.addRecipe(new ShapelessOreRecipe(plateCopper, "plateCopper")); TweakingRegistry.addTweakedTooltip(plate, plateIron.getItemDamage(), TweakingAction.ADDED, "Shapeless recipe to swap", "plate types"); TweakingRegistry.addTweakedTooltip(plate, plateSteel.getItemDamage(), TweakingAction.ADDED, "Shapeless recipe to swap", "plate types"); TweakingRegistry.addTweakedTooltip(plate, plateTin.getItemDamage(), TweakingAction.ADDED, "Shapeless recipe to swap", "plate types"); TweakingRegistry.addTweakedTooltip(plate, plateCopper.getItemDamage(), TweakingAction.ADDED, "Shapeless recipe to swap", "plate types"); }