Jump to content

[1.12.2] Sending Localized BlockName to Client


oitsjustjose

Recommended Posts

Alright, so this one's been quite a tricky bit and I can't quite figure it out.

I'm working on the Geolosys Prospector's Pick, which is having a localization issue with blocks not from Geolosys when prospecting on a server. I figured this was because the server doesn't translate anything, but I could be wrong. Overall, I've been working on this for hours and I have absolutely no idea what I'm doing wrong. I've thought it out, and have tried using Packets to transmit the localized name from the client to the server before the server sends the notification to the player using player.sendStatusMessage(msg, true);. I'm not sure what I'm doing wrong, but for some reason, I'm getting this error

Overall, I'm confused as to why I'm having this problem in the first place and the back-and-forth between client and server is starting to confuse me. You can see my network code (and other stuff) on GitHub. And don't hesitate to call me an idiot, sidedness is not my expertise. 

Link to comment
Share on other sites

3 minutes ago, diesieben07 said:

You should send an ITextComponent (which can represent a thing to be translated) to the client instead of the already translated string.

Do you mean when I do player.sendStatusMessage(msg, true);? msg is a TextComponentTranslation, so I believe it should be translated once it gets to the client unless I'm using it all entirely wrong. And that's the thing - any translations that come from Geolosys itself worked (before I attempted all this packet stuff that isn't working) -- but other mods' blocks would come through unlocalized.

Link to comment
Share on other sites

To your first point: Fair - how would you suggest I go about getting a localized name for a block? I haven't really found any good, fully dynamic solutions.

 

And to your second: You make a good point -- so then I should reverse my logic, have the server send the BlockState to the client, and then have the client packet handler handle the localization (which as mentioned needs improvement) since that's where it should be done?

Link to comment
Share on other sites

2 hours ago, diesieben07 said:

Do not ever call other methods like Block#getItemDropped, they are not accurate.

As an example: Wheat returns Items.WHEAT_SEEDS not Items.WHEAT and cake probably returns null or air. I haven't checked 1.12 lately.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

19 minutes ago, Draco18s said:

As an example: Wheat returns Items.WHEAT_SEEDS not Items.WHEAT and cake probably returns null or air. I haven't checked 1.12 lately.

Right, this I knew - plus I want to report the block itself not what it drops -- that being said, Block#getPickBlock is closest to desireable.

Link to comment
Share on other sites

Just now, oitsjustjose said:

 Is there a difference?

Yes. There are vanilla blocks that utilize similar things, like wool and carpet.

  • Thanks 1

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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