Jump to content

Recommended Posts

Posted

Hello everyone.

 

I'm having some problems with addStringLocalizations with multiname blocks.

 

When I'm adding localizations I use something like this:

    public void build(){
        for(int i = 0; i < names.length; i++){
            String buildedname = new StringBuilder()
                    .append(MyMod.id)
                    .append(".")
                    .append(prefix)
                    .append(".")
                    .append(names[i].replace(' ', '_').toLowerCase())
                    .append(".name")
                    .toString();
            LanguageRegistry.instance().addStringLocalization(buildedname, "en_US", names[i]);
        }
    }

 

Where prefix e MyMod.id are Strings and names is an array of Strings containing block names.

 

In the ItemBlock I'm using something like this:

    @Override
    public String getItemNameIS(ItemStack is){
        String buildedname = new StringBuilder()
                .append(MyMod.id)
                .append(".ore.")
                .append(MyMod.instance.oreItemNames[is.getItemDamage()].replace(' ', '_').toLowerCase())
                .append(".name")
                .toString();
        return buildedname;
    }

 

The problem is that minecraft won't display names.

 

I've already checked if the builded localizations are equals and if the ItemBlock is actually used.

Also my game is running in English.

 

Thank you all.

Posted

as far as i can see you missed the "tile." notation

heres a bsp from my code (without your stringbuilder just for reference)

for(int i = 1; i < 8; ++i) {
     LanguageRegistry.instance().addStringLocalization("tile.testblock.sub"+i+".name", "Maschine V"+(i+1));
}

and this part is taken from my itemblock:

@Override
public String getItemNameIS(ItemStack itemstack) {
    return getItemName() + ".sub" + itemstack.getItemDamage();
}

your problem seems to be the mymod.id and prefix.

instead you have to use the blockname. (testblock in my case)

Garbage Collection In Progress <||||    >

Posted

Ok, I've fixed it, thank you a lot.

 

Basically you always have to add ".name" to the string when registering it. You don't have to put it when building the string in getItemNameIS.

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.