Jump to content
  • Home
  • Files
  • Docs
  • Merch
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • Help with changing name of a block [Solved]
1.13 Update Notes for Mod Creators
Sign in to follow this  
Followers 1
myriath

Help with changing name of a block [Solved]

By myriath, September 5 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

myriath    0

myriath

myriath    0

  • Tree Puncher
  • myriath
  • Members
  • 0
  • 8 posts
Posted September 5 (edited)

I've got a block that has a randomized name and I need to be able to change what the player sees in their inventory to that name instead of tile.x.name

 

Is there any way to do that that doesn't involve putting every possible name that can come from my random name generator into the lang file?

Edited September 6 by myriath
Solved
  • Quote

Share this post


Link to post
Share on other sites

DaemonUmbra    358

DaemonUmbra

DaemonUmbra    358

  • Reality Controller
  • DaemonUmbra
  • Forum Team
  • 358
  • 6400 posts
Posted September 5

Is it truly random or is it a game of pick a name from piles A, B, and C, your item's name is now ABC

  • Quote

Share this post


Link to post
Share on other sites

myriath    0

myriath

myriath    0

  • Tree Puncher
  • myriath
  • Members
  • 0
  • 8 posts
Posted September 5

It's truly random

  • Quote

Share this post


Link to post
Share on other sites

Animefan8888    677

Animefan8888

Animefan8888    677

  • Reality Controller
  • Animefan8888
  • Forge Modder
  • 677
  • 5746 posts
Posted September 5
7 minutes ago, myriath said:

It's truly random

So its generate n number of characters A-Z/a-z?

  • Quote

Share this post


Link to post
Share on other sites

myriath    0

myriath

myriath    0

  • Tree Puncher
  • myriath
  • Members
  • 0
  • 8 posts
Posted September 5
4 minutes ago, Animefan8888 said:

So its generate n number of characters A-Z/a-z?

Basically, yes.

  • Quote

Share this post


Link to post
Share on other sites

ZigTheHedge    2

ZigTheHedge

ZigTheHedge    2

  • Tree Puncher
  • ZigTheHedge
  • Members
  • 2
  • 42 posts
Posted September 5

It won't be translated, right? If so, what's the problem? Just return your translated name from Block::getUnlocalizedName override.

  • Quote

Share this post


Link to post
Share on other sites

diesieben07    6679

diesieben07

diesieben07    6679

  • Reality Controller
  • diesieben07
  • Forum Team
  • 6679
  • 45660 posts
Posted September 5
5 hours ago, ZigTheHedge said:

It won't be translated, right? If so, what's the problem? Just return your translated name from Block::getUnlocalizedName override.

If the name is already translated getDisplayName(ItemStack) should be overridden in the BlockItem instead (1.14.4 names).

  • Quote

Share this post


Link to post
Share on other sites

myriath    0

myriath

myriath    0

  • Tree Puncher
  • myriath
  • Members
  • 0
  • 8 posts
Posted September 5
6 hours ago, ZigTheHedge said:

It won't be translated, right? If so, what's the problem? Just return your translated name from Block::getUnlocalizedName override.

When I do that the name turns into x.name in the inventory, how would I get rid of the .name part?

  • Quote

Share this post


Link to post
Share on other sites

myriath    0

myriath

myriath    0

  • Tree Puncher
  • myriath
  • Members
  • 0
  • 8 posts
Posted September 5
28 minutes ago, diesieben07 said:

If the name is already translated getDisplayName(ItemStack) should be overridden in the BlockItem instead (1.14.4 names).

Is that something new in 1.14 or is it in a lot of other versions as well?

  • Quote

Share this post


Link to post
Share on other sites

diesieben07    6679

diesieben07

diesieben07    6679

  • Reality Controller
  • diesieben07
  • Forum Team
  • 6679
  • 45660 posts
Posted September 5
3 minutes ago, myriath said:

Is that something new in 1.14 or is it in a lot of other versions as well?

In 1.12.2 it would be Item#getItemStackDisplayName that you override. Older versions are no longer supported on this forum due to their age.

  • Quote

Share this post


Link to post
Share on other sites

myriath    0

myriath

myriath    0

  • Tree Puncher
  • myriath
  • Members
  • 0
  • 8 posts
Posted September 5
Just now, diesieben07 said:

In 1.12.2 it would be Item#getItemStackDisplayName that you override. Older versions are no longer supported on this forum due to their age.

Ok, I'll have to take a look when I have time, thank you.

  • Quote

Share this post


Link to post
Share on other sites

myriath    0

myriath

myriath    0

  • Tree Puncher
  • myriath
  • Members
  • 0
  • 8 posts
Posted September 5

It seems as though this would work, however I don't know how to get the name into the custom ItemBlock class and into the registry. Overriding works fine for a static name, but I don't know how I'd update it from the Main class of the mod.

  • Quote

Share this post


Link to post
Share on other sites

Animefan8888    677

Animefan8888

Animefan8888    677

  • Reality Controller
  • Animefan8888
  • Forge Modder
  • 677
  • 5746 posts
Posted September 5
23 minutes ago, myriath said:

into the registry

No you dont do this.

 

24 minutes ago, myriath said:

Main class of the mod.

Make a variable? What are you trying to do from an end user perspective? 

  • Quote

Share this post


Link to post
Share on other sites

myriath    0

myriath

myriath    0

  • Tree Puncher
  • myriath
  • Members
  • 0
  • 8 posts
Posted September 5
3 minutes ago, Animefan8888 said:

Make a variable? What are you trying to do from an end user perspective? 

The user will see a randomly generated name for the ore and it's respective items. Say the random name is blah, you'll get Blah ore, Blah ingot, blah chestplate, etc.

 

6 minutes ago, Animefan8888 said:

No you dont do this.

How do I get the game to realize the block should use the custom ItemBlock class for it's name? Currently I'm trying to use GameRegistry.registerBlock with the block, it's respective itemblock class, and the block's unlocalized name as it's parameters. Is that not how it's supposed to be registered?

  • Quote

Share this post


Link to post
Share on other sites

Animefan8888    677

Animefan8888

Animefan8888    677

  • Reality Controller
  • Animefan8888
  • Forge Modder
  • 677
  • 5746 posts
Posted September 6
44 minutes ago, myriath said:

Currently I'm trying to use GameRegistry.registerBlock

Update to a modern version.

  • Quote

Share this post


Link to post
Share on other sites

diesieben07    6679

diesieben07

diesieben07    6679

  • Reality Controller
  • diesieben07
  • Forum Team
  • 6679
  • 45660 posts
Posted September 6

Registration happens via registries and their respective events. See the documentation. As Animefan pointed out, the fact that you still have GameRegistry.registerBlock available indicates that you are using a highly outdated version. Update to the latest version of 1.12.2 or 1.14.4.

  • Quote

Share this post


Link to post
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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

  • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 1
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • OdachiPlayz
      error!

      By OdachiPlayz · Posted 3 minutes ago

      Error: Unable to access jarfile forge-1.7.10-10.13.4.1614-1.7.10-universal.jar i used to be able to run my server with the command prompt. but now i cant even access the jarfile? i ran as administrator. 
    • KingMax
      Endsieg WW2 - Server due to start very soon - Working guns and vehicles!

      By KingMax · Posted 33 minutes ago

      Greetings Comrade/Captain/Hauptmann! Welcome to Europe's final theater of war, Scandinavia! Despite the fall of Berlin the third Reich continues to hold out in Norway and the surrounding areas, the war is not yet over. Ultimate Victory will require many more battles to be fought. Infrastructure will need to be built, tanks, planes and ships shall have to be designed and produced and factories will be needed to produce the weapons of war.Endsieg has a multitude of special mechanics found on almost no other MC servers: fully functional ground, air and sea vehicles, guns, factories and more!Will you fight for the Allies to liberate Norway from tyranny?Will you defend the Soviet motherland by finally defeating the fascist menace?Will you take up the mantle of saving the remains of the Third Reich?Will you preserve the territorial integrity of the Republic of Finland?Will you help the Kingdom of Sweden once again rise to prominence as a Baltic powerhouse?Due to launch in a short matter of days or weeks, join our discord!discord.gg/anp3BJQ
    • Crack3dC0d3
      [1.14.4] Multiple models on the same item.

      By Crack3dC0d3 · Posted 1 hour ago

      bump
    • snivinia
      unable to connect to friend's modded server

      By snivinia · Posted 1 hour ago

      my mistake, these should be the right links now https://drive.google.com/file/d/1CxPl-CVNCtOl0LWKv9U7o9WT6jBtMOe1/view?usp=sharing https://drive.google.com/file/d/11YJ-SAt7nYmloZQXOw5f4-gsxpYtDMyN/view?usp=sharing will also update in original post
    • plugsmustard
      [1.14.4] How to get Minecraft Horse model/texture to make a custom unicorn?

      By plugsmustard · Posted 1 hour ago

  • Topics

    • OdachiPlayz
      0
      error!

      By OdachiPlayz
      Started 3 minutes ago

    • KingMax
      0
      Endsieg WW2 - Server due to start very soon - Working guns and vehicles!

      By KingMax
      Started 33 minutes ago

    • Crack3dC0d3
      4
      [1.14.4] Multiple models on the same item.

      By Crack3dC0d3
      Started December 2

    • snivinia
      2
      unable to connect to friend's modded server

      By snivinia
      Started 18 hours ago

    • DragonITA
      12
      [1.14.4] How to get Minecraft Horse model/texture to make a custom unicorn?

      By DragonITA
      Started 14 hours ago

  • Who's Online (See full list)

    • JMAS
    • OdachiPlayz
    • hotdogchainsaw
    • jiichii
    • plugsmustard
    • ROMVoid
    • Zillex_
    • snivinia
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • Help with changing name of a block [Solved]
  • Theme
  • Contact Us
  • Discord

Copyright © 2019 ForgeDevelopment LLC · Ads by Curse Powered by Invision Community