Jump to content

Recommended Posts

Posted

So this has been bugging me for a little while, but as the name that showed up was accurate enough I just left it as it was.  Now though I'd like to actually fix it.

 

Here's the thing: all of items I've made for this one mod all display in-game with the same name: "Artifact"

I'd like to fix that so that the armor items are "Artifact Armor" ideally with material designations.  The only place this shows up is the creative inventory (as the item's name is later controlled by NBT data, which works great).

 

I have no language file entries for these items yet, and have removed the LanguageRegistry entries for them as well.  I've even gone so far as to remove the setUnlocalizedName from them, NOTHING causes it to change.  The items don't even inherit from each other.

 

All my code can be found here:

https://github.com/Draco18s/Artifacts/tree/master/draco18s/artifacts

 

DragonArtifacts.java is the main mod class and the two item classes are ItemArtifact.java and ItemArtifactArmor.java inside /item

Codebase hasn't change significantly from last night.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

thought you removed unlocalised name?

 

public ItemArtifact(int par1) {

                super(par1);

                setMaxStackSize(1);

                setNoRepair();

                weaponDamage = 0.0F;

                setMaxDamage(128);

                setCreativeTab(CreativeTabs.tabCombat);

                setUnlocalizedName("Artifact");

}

Posted

I didn't push what I'm working with to Github.  The code is not currently working, so why would I push a broken version?

 

What I mean is that

setUnlocalizedName("Artifact");

line I've changed to

setUnlocalizedName("Banana");

and it still displays in-game as "Artifact":

 

artifact.png

artifact2.png

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

And....

 

Solved my own problem.

 

I figured that "Artifact" was a string that was coming from somewhere, so I did a workspace-wide search.

 

ItemArtifact#getItemDisplayName()

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Yeah getItemDisplayName(ItemStack par1) is the best function to set names.

But not every mod does support that xD.

 

I am currently trying to make a LanguagePackSupport for that.

 

Posted

I have been reengineering my getItemDisplayName function to be language-good.

 

    public String getItemDisplayName(ItemStack par1ItemStack)
    {
    	String n = "";
    	if(par1ItemStack.stackTagCompound != null) {
    		if(doEnchName) {
    			if(par1ItemStack.stackTagCompound.getString("enchName").length() > 0)
				n += StatCollector.translateToLocal(par1ItemStack.stackTagCompound.getString("enchName")) + " ";
		}
		if(doAdjName) {
			if(par1ItemStack.stackTagCompound.getString("preadj").length() > 0)
				n += StatCollector.translateToLocal("pre."+par1ItemStack.stackTagCompound.getString("preadj")) + " ";
		}
		if(doMatName) {
			n += StatCollector.translateToLocal("mat."+par1ItemStack.stackTagCompound.getString("matName")) + " ";
		}
		if(!(doEnchName || doMatName || doAdjName)) {
			n += StatCollector.translateToLocal("type.Artifact") + " ";
		}
		n += StatCollector.translateToLocal("type."+par1ItemStack.stackTagCompound.getString("iconName"));
		if(doAdjName) {
			if(par1ItemStack.stackTagCompound.getString("postadj").length() > 0)
				n += " " + StatCollector.translateToLocal("post."+par1ItemStack.stackTagCompound.getString("postadj"));
		}
    	}
	if(n.length() < 1) {
		n = StatCollector.translateToLocal("type.Artifact");
	}
        return n;
    }

 

And entering all the unlocalized pieces to a localization file.  Downside is that I switched over to using vanilla's names for enchantments, so instead of "Efficient Gold Whatever" it's now "Efficiency Gold Whatever" but oh well.  Enchantments in item names makes them super long (as noted, there are config values for each piece).

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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.