Jump to content

Non-Standard UnlocalizedName


yesiwearpants

Recommended Posts

Im trying to do this 'ingot.batmanplusplus:Tetsu.name=Tetsu Ingot'

here is my class file

   

public static class UnlocalItem extends Item {

	private static String unlocal;
	private static String pre;

	/**
     * Sets the unlocalized name of this item to the string passed as the parameter, prefixed by 'something'
     */
	//This Could End Badly
    public static Item setUnlocal(String unlocalizedName) {
        unlocal = unlocalizedName;
        
        return setUnlocal(unlocal);
    }

    /**
     * Translates the unlocalized name of this item, but without the .name suffix, so the translation fails and the
     * unlocalized name itself is returned.
     */
    public String getUnlocalInefficiently(ItemStack stack) {
        String s = this.getUnlocal(stack);
        return s == null ? "" : StatCollector.translateToLocal(s);
    }

    /**
     * Returns the unlocalized name of this item.
     */
    public static String getUnlocal(String prefix) {
    	pre = prefix;
        return pre + unlocal;
    }

    /**
     * Returns the unlocalized name of this item. This version accepts an ItemStack so different stacks can have
     * different names based on their damage or NBT.
     */
    public String getUnlocal(ItemStack stack) {
        return pre + this.unlocal;
    }
    
    /**
     * Gets the localized name of this block. Used for the statistics page.
     */
    @Override
    public String getItemStackDisplayName(ItemStack stack)
    {
        return ("" + StatCollector.translateToLocal(this.getUnlocalInefficiently(stack) + ".name")).trim();
    }
}

 

but I keep getting 'ingot.batmanplusplus:Tetsunull.name' instead

My Thought is that its theunlocalizedName from Item, but how is that bleedng through

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

You're welcome.

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.

Link to comment
Share on other sites

Not To Sound Rude But, Do I Really Need One?

 

If you can solve it on your own, no.  If you're asking for help, yes.

 

Any time you do something unusual, you need to have good understanding of how to do it, plus it needs to be worth the effort and risk.

 

Remember that these names are strings, so if you have a lot of them that are similar, you can probably code up some way to created the string for you.  Or you can just create them all once in a txt file and have that as a resource.

 

Basically, is the time it takes to type up all your names really longer than the time to code and debug an alternate solution?

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

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.