I need to use the minecraft:wool instad of Items.wool (or Blocks.wool) as I am making a mod that works of my other mod and going like petco:ing and a metadata is the only way of accessing it. I am using wool to test though. Thanks for your quick reply
An Item instance doesn't have a metadata value, all you need to retrieve it from GameRegistry is the name it was registered with. Metadata is part of the ItemStack, as master801 said.
Item wool = GameRegistry.findItem("minecraft", "wool"); // Retrieve the Wool Item instance from GameRegistry
ItemStack whiteWool = new ItemStack(wool, 1, 0); // Create an ItemStack of Wool with metadata 0
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
An ",courier">Item instance doesn't have a metadata value, all you need to retrieve it from ",courier">GameRegistry is the name it was registered with. Metadata is part of the ",courier">ItemStack, as master801 said.
Item wool = GameRegistry.findItem("minecraft", "wool"); // Retrieve the Wool Item instance from GameRegistry
ItemStack whiteWool = new ItemStack(wool, 1, 0); // Create an ItemStack of Wool with metadata 0
Honestly, instead of using the game registry, you could just use the getItemFromBlock method in the Item class.
Honestly, instead of using the game registry, you could just use the getItemFromBlock method in the Item class.
But I think the OP was just using wool for initial testing, they said that they wanted to access an item from another mod using its name.
If you already have a reference to the Block (e.g. wool or any other vanilla block), you can get the corresponding Item without GameRegistry; but if you're using something from another mod without compiling against it (what I believe the OP wants to do), you need to use GameRegistry to get references to its Item and Block instances.
Once you have an Item or Block reference, you can create an ItemStack of it and set the metadata value of that ItemStack.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Hi,
Just wondering how to link a name to a metadata item from minecraft, I am needing this for use with my item, but am using wool as a test.
Item wooltest = GameData.getItemRegistry().getObject("minecraft:wool 11");
this crashes the game. How do I link the metadata to that name. I know it is something simple, but can't find what.
Ugh, this is going to break, but I hope you understand it.
I need to use the minecraft:wool instad of Items.wool (or Blocks.wool) as I am making a mod that works of my other mod and going like petco:ing and a metadata is the only way of accessing it. I am using wool to test though. Thanks for your quick reply
An Item instance doesn't have a metadata value, all you need to retrieve it from GameRegistry is the name it was registered with. Metadata is part of the ItemStack, as master801 said.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Honestly, instead of using the game registry, you could just use the getItemFromBlock method in the Item class.
But I think the OP was just using wool for initial testing, they said that they wanted to access an item from another mod using its name.
If you already have a reference to the Block (e.g. wool or any other vanilla block), you can get the corresponding Item without GameRegistry; but if you're using something from another mod without compiling against it (what I believe the OP wants to do), you need to use GameRegistry to get references to its Item and Block instances.
Once you have an Item or Block reference, you can create an ItemStack of it and set the metadata value of that ItemStack.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.