Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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.

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 <||||    >

  • Author

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...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.