Jump to content

[1.9] en_US.lang/json - Anyway to pull names from a library/reference class?


Recommended Posts

Posted

EDIT: Added screenshot to better explain, see bottom link.

 

I think I know the answer to this is that it's not possible...however I figured I'd ask to make sure.

 

I have a library/reference class with final String values of my items/blocks/etc for use with gameRegistry, unlocalized name, etc.

 

I can use this class in all of my java classes of course, but when it comes to the json files and en_lang, I'm hard coding/typing the string value myself which I hate because if I change the name of a block in my reference library, I have to then find the 3 .json's, manually edit them, and then go into my lang and edit that. If I ever add more languages that's just going to continue the work.

 

Anyone know of a solution by chance?

 

 

EDIT: http://i.imgur.com/WueyFSt.png - Here is what I'm talking about for example.

www.YouTube.com/WeiseGamer

www.twitter.com/WeiseGamer

Posted

No. (But you shouldn't be changing registry names in the first place.)

 

I shouldn't change a registry name, as in you've never refactored before?

 

Outside of refactoring, which I think is completely viable, the point still stands that I'm hard coding the value I have stored in a final String into the json and lang that I'd rather not hard code in case of typos (which is why we avoid hard coding to begin with, right programmers who can't type?).

www.YouTube.com/WeiseGamer

www.twitter.com/WeiseGamer

Posted

Json and lang files are data. Not code.

You can not reference code in them.

Simple as that.

If you MUST have a weird setup like this then write a script to generate the lang and json files.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Posted

Json and lang files are data. Not code.

You can not reference code in them.

Simple as that.

If you MUST have a weird setup like this then write a script to generate the lang and json files.

 

Thanks Lex!

 

I figured as much, and may do the script for fun. I'm being stubborn and don't like having to go to three places for a block to paste the same string in, but I understand.

www.YouTube.com/WeiseGamer

www.twitter.com/WeiseGamer

Posted

XKCD 1319 is applicable.

 

But yes, you could use a script to generate things like JSON files and language files. However as Lex said, they are fundamentally different things.

 

Hah, right. I guess I worked in 1.7.10 last, now having to make 4 files for a block just bothers me, though I love how flexible it can be overall. I just don't like to hard code and then creating 4 hard coded references to the same string is cringing at times, completely understand the difference in a Java class, a JSON, and the lang but it would be nice if someone knew of a solution, hence the post :D

 

4 files - Lang, model, blockstate, block item.

www.YouTube.com/WeiseGamer

www.twitter.com/WeiseGamer

Posted

4 files - Lang, model, blockstate, block item.

For a simple "normal cube" block you only need the blockstate json: http://mcforge.readthedocs.io/en/latest/blockstates/forgeBlockstates/

 

I thought you had to do:

 

assets.modid.blockstates -json

assets.modid.models.block -json

assets.modid.models.item -json

 

Then still the lang of course because you are naming it in game.

 

Am I missing something here? I mean, you can use a base json file and copy/paste it over and over, but you still need to name the texture for it on a basic cube no? block/cube_all can be used, but you still need to say what the texture is, then link the model and the item to it I thought?

www.YouTube.com/WeiseGamer

www.twitter.com/WeiseGamer

Posted

Thank you! This helps so much....I've been making all 4 additions each time for simple cubes, holy crap.

 

I know you guys get crap for being blunt, but I appreciate it!

www.YouTube.com/WeiseGamer

www.twitter.com/WeiseGamer

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.