Jump to content

1.7.10 Issue with recipe and Oredictionary [Solved]


Anarchysage

Recommended Posts

So way back in the days of 1.4.X, freind helped me with this code, however i need to alter it and i cant get it to work. So basically making an item when crafting with a "ingotTin"(intend to do this code for all the ingots(modpack i use and know alot of people use, spawns different ingots in dungeons)), and it wont resolve and im not a perfect modder but im trying.

 

Anyways, its 1.7.10(yes i know old, dont care, not updating till all favorite mods come out, plus, slowly converting blocks to 1.9 in different dev).

 

This is the original code that allows any ingotTin to craft into my blockTin and back into first registered ingotTin

		if (Storageprops.enabletin) {
		if (!OreDictionary.getOres("ingotTin").isEmpty()) {
			GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(
					StorageBlockMod, 1, 0), "xxx", "xxx", "xxx", 'x',
					"ingotTin"));
			ItemStack tiningot;
			tiningot = OreDictionary.getOres("ingotTin").get(0);
			ItemStack result = tiningot.copy();
			result.stackSize = 9;
			GameRegistry.addShapelessRecipe(result, new ItemStack(
					StorageBlockMod, 1, 0));
			if (Storageprops.gregtechcompat) {
				OreDictionary.registerOre("blockTin", new ItemStack(
						StorageBlockMod, 1, 0));
			}
		}
	}

 

 

This is the one im trying to make work.

	public static void bypassrecipes() {
	// Registers the Item itself and recipe for item
	oredictionarybook = new oredictionarybook(Storageprops.oredictionarybook - 256);
	GameRegistry.registerItem(oredictionarybook, "oredictionarybook");
	GameRegistry.addRecipe(new ItemStack(oredictionarybook, 1),
			"xxx", "xyx", "xxx", 'x', Items.iron_ingot, 'y', Items.emerald);
				//Attempt to fix this.....
	if (!OreDictionary.getOres("ingotTin").isEmpty()) {
		//GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(
		//		StorageBlockMod, 1, 0), "xxx", "xxx", "xxx", 'x',
		//		"ingotTin"));
		ItemStack tiningot;
		tiningot = OreDictionary.getOres("ingotTin").get(0);
		ItemStack result = tiningot.copy();
		result.stackSize = 1;
		GameRegistry.addRecipe(new ShapedOreRecipe(result), " x ", "xyx", " x ", 'x',
				"ingotTin", 'y', oredictionarybook );

		//GameRegistry.addShapelessRecipe(result, new ItemStack(
		//		StorageBlockMod, 1, 0));
		//GameRegistry.addShapelessRecipe(new ShapedOreRecipe(result),
		//		new ItemStack(result), new ItemStack(oredictionarybook, 1, 
		//				OreDictionary.WILDCARD_VALUE));			
		}
	}

 

And it gives me this error

Description Resource Path Location Type

The method addRecipe(ItemStack, Object...) in the type GameRegistry is not applicable for the arguments (ShapedOreRecipe, String, String, String, char, String, char, Item) OreDictionaryBypass.java /Minecraft/src/main/java/com/vanityblocks/Registrations line 32 Java Problem

 

I, cant figure it out for the life of me.

Link to comment
Share on other sites

You need to create the

ShapedOreRecipe

with the result, pattern and inputs and then call

GameRegistry.addRecipe(IRecipe)

to add it.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Items.bucket), "I I", " I ", 'I', "ingotIron"))

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

		if (!OreDictionary.getOres("ingotTin").isEmpty()) {
		// testing purposes
		OreDictionary.registerOre("ingotTin", new ItemStack(
				Items.paper));
		ItemStack tiningot;
		tiningot = OreDictionary.getOres("ingotTin").get(0);
		ItemStack result = tiningot.copy();
		result.stackSize = 1;
		GameRegistry.addRecipe(new ShapedOreRecipe(tiningot));
		GameRegistry.addShapedRecipe(tiningot,  " x ", "xyx", " x ", 'x',
				"ingotTin", 'y', oredictionarybook );	
		}

 

 

Thats what i did, no errors but doesnt work

 

so i changed to this

		if (!OreDictionary.getOres("ingotTin").isEmpty()) {
		// testing purposes
		OreDictionary.registerOre("ingotTin", new ItemStack(
				Items.paper));
		ItemStack tiningot;
		tiningot = OreDictionary.getOres("ingotTin").get(0);
		ItemStack result = tiningot.copy();
		result.stackSize = 1;
		//GameRegistry.addRecipe(new ShapedOreRecipe(tiningot));
		GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(tiningot)," x ", "xyx", " x ", 'x',
				"ingotTin", 'y', oredictionarybook ));
		GameRegistry.addRecipe(new ShapedOreRecipe(tiningot));
		//GameRegistry.addShapedRecipe(tiningot,  " x ", "xyx", " x ", 'x',
		//		"ingotTin", 'y', oredictionarybook );	
		}

and i get this error

Description Resource Path Location Type

The constructor ItemStack(ItemStack) is undefined OreDictionaryBypass.java /Minecraft/src/main/java/com/vanityblocks/Registrations line 33 Java Problem

 

Link to comment
Share on other sites

tiningot

is an

ItemStack

and there's no

ItemStack(ItemStack)

constructor. Use

tiningot

directly instead of trying to create a new

ItemStack

from it.

 

Creating a

ShapedOreRecipe

without a pattern or input will crash the game.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

off topic question, is it possible to have another prebuilt mod in my dev enviroment so i can test this without building?

 

Yes, you can add it as a dependency through Gradle or put it in the mods folder (but not both). Since you're using 1.7.10, it must be a dev/deobfuscated build of the mod; unless you're running the dev version of CodeChickenCore, which will deobfuscate mods at runtime. In 1.8+, ForgeGradle can deobfuscate dependencies on disk. In 1.8.9+, FML can deobfuscate mods at runtime; completely removing the need for dev builds.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

Thanks, that worked, thanks for not being rude and helping, #minecraftforge tends to be rude xD

 

 

package com.vanityblocks.Registrations;

import com.vanityblocks.Storageprops;
import com.vanityblocks.Items.oredictionarybook;

import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
import cpw.mods.fml.common.registry.GameRegistry;

public class OreDictionaryBypass {
public static Item oredictionarybook;

public static void bypassrecipes() {
	// Registers the Item itself and recipe for item
	oredictionarybook = new oredictionarybook(Storageprops.oredictionarybook - 256);
	GameRegistry.registerItem(oredictionarybook, "oredictionarybook");
	GameRegistry.addRecipe(new ItemStack(oredictionarybook, 1),
			"xyx", "yzy", "xyx", 'x', Items.iron_ingot, 'y', Items.emerald, 'z', Items.book);
	//Attempt to fix this.....
	// testing purposes
	//OreDictionary.registerOre("ingotTin", new ItemStack(
	//		Items.paper));
	if (!OreDictionary.getOres("ingotTin").isEmpty()) {
		ItemStack tiningot;
		tiningot = OreDictionary.getOres("ingotTin").get(0);
		ItemStack result = tiningot.copy();
		result.stackSize = 1;
		//GameRegistry.addRecipe(new ShapedOreRecipe(result, " x ", "xyx", " x ", 'x',
		//		"ingotTin", 'y', oredictionarybook ));
		GameRegistry.addRecipe(new ShapelessOreRecipe(result, "ingotTin", oredictionarybook ));
		}
	}
}

 

So for anyone who needs it, theres the code, it uses "result" to define itemstack count, and shapeless and shaped recipe

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.