Jump to content

Recommended Posts

Posted (edited)

Edit: format is "key =value" no specific forced format like I think they should. The reason why item. or whatever is because it's hard coded into the objects specific adds a prefix and or suffix

 

How does minecraft know what format the line files are suppose to be parsed? I took a look at twlight forest yes there are some fixed formats but, they have their own custom ones and how does minecraft know how to parse it?
 

twilightforest.book.tfstronghold.4

 

From the previous formats I have seen I would normally assume it would be object.stringname.identifier or object.string.string.identifier where identifier  is ".tooltip". ".name" or ".desc" but, this above breaks the format. I would like to know this because I am going to be making a dynamic lang file that loads automatically from peoples registered objects and load it into the game from an IResourcePack.

 

If I had to guess I gues it would always be parsed as "groupname"."stringinternal"."identifier" but, some of them don't contain the identifier at all I am so confused. To make matters worse the middle string can contain a "." so assuming there is two formats with a "." and without is also a wrong assumption 

advancement.twilight_magic_map_focus=With Fire It Writes

 

Edited by jredfox
Posted (edited)
5 minutes ago, diesieben07 said:

It's simply key=value. Minecraft does not care one bit about the format of the keys. Also, note that 1.13 will change lang files to be JSON based.

are you sure so if I had an item I could simply use "icepickaxe=Ice Pickaxe" as a lang and it would work for my item or is there more to it?

well if that's the case I would have a hard time using my line library as it's always a specific parsing format. It would have to be string = key like you said but, that would put more strain on the coder changing lang entries

Edited by jredfox
Posted
Just now, diesieben07 said:

Yes, that would work. This is why you should always include your Mod ID in your lang keys, to avoid conflicts (they are simply thrown into a global map).

Well thanks for pointing this out your a life saver. Was wondering why there was no specific forced format pattern I could find

Posted (edited)
2 hours ago, diesieben07 said:

Yes, that would work. This is why you should always include your Mod ID in your lang keys, to avoid conflicts (they are simply thrown into a global map).

didn't work just tried it

Lang:

vanillalife:obsidian_pickaxe=Obsidian Pickaxe

Code:

  public static final String modid = "vanillalife";

  @Mod.EventHandler
  public void preInit(FMLPreInitializationEvent event)
  {
	opic = new ItemBasicPickaxe(obsidian_material,modid + ":" + "obsidian_pickaxe");
  }

ItemBasicPickaxe:

	public ItemBasicPickaxe(ToolMaterial material,String id,CreativeTabs tab) {
		super(material);
		this.setRegistryName(id);
		this.setUnlocalizedName(id);
		this.setCreativeTab(tab);
		
		MainJava.items.add(this);
		ForgeRegistries.ITEMS.register(this);
	}


 

2018-04-04_08_34_27.thumb.png.71293c1689f4f600dfd3255d31881a9c.png

Edited by jredfox
Posted
1 minute ago, diesieben07 said:

I am assuming your ItemBasicPickaxe calls Item::setUnlocalizedName. As you can see in Item::getUnlocalizedName, "item." is automatically prepended. Item::getItemStackDisplayName then appends ".name". If you do not want this default behavior, you need to override these methods.

ok I was assuming their would be confusing behavior in lang. Thanks this helped

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.