Jump to content

OreDictionary help <SOLVED>


RafaelVN

Recommended Posts

Hi I am having difficulty making a custom item interact with other mods using OreDictionary.

 

Aluminum test code:

package tutorial.generic;

import tutorial.generic.items.GenericItem;
import tutorial.generic.items.GenericMetaItem;
import tutorial.generic.items.TutResources;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;

@Mod(modid = "generic", name = "Generic", version = "1.0")
public class Generic {

@Instance(value = "generic")
public static Generic instance;

@SidedProxy(clientSide = "tutorial.generic.client.ClientProxy", serverSide = "tutorial.generic.CommonProxy")
public static CommonProxy proxy;

public static Item aluminumIngot;

@EventHandler
public void preInit(FMLPreInitializationEvent event) {		
	aluminumIngot = new GenericItem().setMaxStackSize(64)
			.setCreativeTab(CreativeTabs.tabMisc)
			.setUnlocalizedName("aluminumIngot")
			.setTextureName("generic:AluminumIngot");
	GameRegistry.registerItem(aluminumIngot, "aluminumIngot");
	OreDictionary.registerOre("ingotAluminum", aluminumIngot);
	OreDictionary.registerOre("ingotAluminium", aluminumIngot);
}

@EventHandler
public void init(FMLInitializationEvent event) {

	//Check if there are registred a item name in OreDictionary
	//I'm doing it in init when all item are registred in OreDictionary	
	System.out
			.println("////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////");
	for (ItemStack ore : OreDictionary.getOres("ingotAluminum")) {
		if (ore.getItem().getHasSubtypes())
			System.out
					.println("'ingotAluminum' registrado no OreDictionary : "
							+ ore.getItem().getUnlocalizedName(ore));
		else
			System.out
					.println("'ingotAluminum' registrado no OreDictionary : "
							+ ore.getItem().getUnlocalizedName());
	}
	System.out
			.println("////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////");
	for (ItemStack ore : OreDictionary.getOres("ingotAluminium")) {
		if (ore.getItem().getHasSubtypes())
			System.out
					.println("'ingotAluminium' registrado no OreDictionary : "
							+ ore.getItem().getUnlocalizedName(ore));
		else
			System.out
					.println("'ingotAluminium' registrado no OreDictionary : "
							+ ore.getItem().getUnlocalizedName());
	}
	System.out
			.println("////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////");

	}
}

@EventHandler
public void postInit(FMLPostInitializationEvent event) {
}

 

System.out :

Client> [20:53:28] [Client thread/INFO] [sTDOUT]: [tutorial.generic.Generic:init:58]: ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Client> [20:53:28] [Client thread/INFO] [sTDOUT]: [tutorial.generic.Generic:init:66]: 'ingotAluminum' registrado no OreDictionary : item.aluminumIngot
Client> [20:53:28] [Client thread/INFO] [sTDOUT]: [tutorial.generic.Generic:init:62]: 'ingotAluminum' registrado no OreDictionary : item.tconstruct.Materials.AluminumIngot
Client> [20:53:28] [Client thread/INFO] [sTDOUT]: [tutorial.generic.Generic:init:70]: ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Client> [20:53:28] [Client thread/INFO] [sTDOUT]: [tutorial.generic.Generic:init:78]: 'ingotAluminium' registrado no OreDictionary : item.aluminumIngot
Client> [20:53:28] [Client thread/INFO] [sTDOUT]: [tutorial.generic.Generic:init:74]: 'ingotAluminium' registrado no OreDictionary : item.tconstruct.Materials.AluminumIngot
Client> [20:53:28] [Client thread/INFO] [sTDOUT]: [tutorial.generic.Generic:init:82]: ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

 

I researched the name the mod Tinker's Construct uses the item Aluminum Ingot, are 2 ('ingotAluminum' ingotAluminum '), so I registered my custom item to using these names (already tried using only one of the names and using Both) but in any of the cases got successful, I tested this using the mod MineFactory Reload (Unifier) to stack items that share the same name in OreDictionary, I've also realized tests using another type of item such as Stell Ingot mod Mekanism ('ingotSteel') and it worked correctly (even the Steel Ingot Tinker's Construct works), another thing is that when I put the Aluminium Ingot in Pulverizer of Themal Expasion mod (My custom and Tinker's mod) they all return the same to me Aluminium Dust (Proving that they have oreDict the same name).

 

Steel test code:

package tutorial.generic;

import tutorial.generic.items.GenericItem;
import tutorial.generic.items.GenericMetaItem;
import tutorial.generic.items.TutResources;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;

@Mod(modid = "generic", name = "Generic", version = "1.0")
public class Generic {

@Instance(value = "generic")
public static Generic instance;

@SidedProxy(clientSide = "tutorial.generic.client.ClientProxy", serverSide = "tutorial.generic.CommonProxy")
public static CommonProxy proxy;

public static Item steelIngot;

@EventHandler
public void preInit(FMLPreInitializationEvent event) {		
	steelIngot = new GenericItem().setMaxStackSize(64)
			.setCreativeTab(CreativeTabs.tabMisc)
			.setUnlocalizedName("steelIngot")
			.setTextureName("generic:AluminumIngot");//I didnt change name in png file 
	GameRegistry.registerItem(steelIngot, "SteelIngot");
	OreDictionary.registerOre("ingotSteel", steelIngot);
	//OreDictionary.registerOre("ingotAluminium", aluminiumIngot);
}

@EventHandler
public void init(FMLInitializationEvent event) {

	//Check if there are registred a item name in OreDictionary
	//I'm doing it in init when all item are registred in OreDictionary	
	System.out
			.println("////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////");
	for (ItemStack ore : OreDictionary.getOres("ingotAluminum")) {
		if (ore.getItem().getHasSubtypes())
			System.out
					.println("'ingotAluminum' registrado no OreDictionary : "
							+ ore.getItem().getUnlocalizedName(ore));
		else
			System.out
					.println("'ingotAluminum' registrado no OreDictionary : "
							+ ore.getItem().getUnlocalizedName());
	}
	System.out
			.println("////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////");
	for (ItemStack ore : OreDictionary.getOres("ingotAluminium")) {
		if (ore.getItem().getHasSubtypes())
			System.out
					.println("'ingotAluminum' registrado no OreDictionary : "
							+ ore.getItem().getUnlocalizedName(ore));
		else
			System.out
					.println("'ingotAluminium' registrado no OreDictionary : "
							+ ore.getItem().getUnlocalizedName());
	}
	System.out
			.println("////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////");		
}

@EventHandler
public void postInit(FMLPostInitializationEvent event) {
}

}

 

System.out:

Client> [20:53:28] [Client thread/INFO] [sTDOUT]: [tutorial.generic.Generic:init:58]: ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Client> [18:07:39] [Client thread/INFO] [sTDOUT]: [tutorial.generic.Generic:init:59]: 'ingotAluminum' registrado no OreDictionary : item.tconstruct.Materials.AluminumIngot
Client> [18:07:39] [Client thread/INFO] [sTDOUT]: [tutorial.generic.Generic:init:67]: ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Client> [18:07:39] [Client thread/INFO] [sTDOUT]: [tutorial.generic.Generic:init:71]: 'ingotAluminium' registrado no OreDictionary : item.tconstruct.Materials.AluminumIngot
Client> [18:07:39] [Client thread/INFO] [sTDOUT]: [tutorial.generic.Generic:init:79]: ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

 

I would like to know if i miss something else I need to do or if any problem is beyond me (something in the operation of the Factory Reload: Unifier, I do not know much about this mod only installed it to be able to organize my items).

 

Grateful if someone can help me.

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.



×
×
  • Create New...

Important Information

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