Jump to content

Dynamically-created items: item graphics and names


Feldherren

Recommended Posts

For plugin-testing purposes (currently), I've written something that can dynamically create simple items based on either the contents of a configuration file, or in-game commands (that, along with creating said item, add the right details to the configuration file), and use a command or output a message when used on things. I've run into a couple of minor issues with this - they work, but they only have unlocalised names, and .

 

First, items created from either the configuration file or in-game commands only have unlocalised names; since the unlocalised name is different for each item, and since these items aren't made in advance, the EN_lang file doesn't contain a proper name for them. Is there a way to give items proper names when created, since I don't know what names are going to be used in advance?

 

Second, items created via in-game commands function properly, but don't have the expected item graphic, instead acting as if they have no graphic. If the server is restarted and the item created from the configuration file, they do. Is this a result of attempting to register an item too late, and, again, is there a way to fix this?

 

Possibly relevant: constructor of basic item

	public ItemMagicWand(String name, String newCommand)
{
	setUnlocalizedName(MagicWands.MODID + "_" + name);
	setTextureName(MagicWands.MODID + ":" + "magicWand");
	GameRegistry.registerItem(this, name);
	setCreativeTab(CreativeTabs.tabMisc);

	command = newCommand;
	if(command.charAt(0) == "/".toCharArray()[0])
		isCommand = true;
	else
		isCommand = false;
}

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.