ThePhaseCat / phases-discord-rich-presence

Adding Discord Rich Presence to Minecraft in a simple and light way!
MIT License
5 stars 1 forks source link

Fixed a bug in non-English environments where the main hand was considered to be holding an item even though it was not holding an item #12

Closed TheWhiteDog9487 closed 3 weeks ago

TheWhiteDog9487 commented 3 weeks ago

In the current version, if the Minecraft client is in a non-English language, when not holding any items, it will be misjudged because client.player.getStackInHand(Hand.MAIN_HAND).getName().getString() gets the name of the corresponding language instead of the English "Air", which actually displays "Holding Air".

Screenshot Snipaste_2024-11-05_07-25-53
TheWhiteDog9487 commented 3 weeks ago

Additionally, I'm going to try to see if I can move the fields in the screenshot below from the Java code to a separate JSON per language in the src\main\resources\assets\phases-discord-rich-presence\lang folder, and then translate them using Text.translatableWithFallback() in the Java code so that they can also be localized. But this change would be a big one and I'm not sure if I can do it, so I wanted to ask for your opinion.

Screenshot Snipaste_2024-11-05_07-21-35
ThePhaseCat commented 3 weeks ago

If you can do it, that would be cool and would allow for other languages to be supported. I never actually knew this was a problem, so if it's possible to do it, that would be great, but I understand if it ends up not being possible!

TheWhiteDog9487 commented 3 weeks ago

If you can do it, that would be cool and would allow for other languages to be supported. I never actually knew this was a problem, so if it's possible to do it, that would be great, but I understand if it ends up not being possible!

OK, I will try my best to see if I can complete it, but I don't know if it will be completed in the end, and how long it will take. Now if you think it's okay, you may merge or close this PR. If I complete this feature in the end, I will open a new pull request separately.

TheWhiteDog9487 commented 3 weeks ago

@ThePhaseCat I have already completed this feature. The changes are huge. I tested it a bit and found no serious problems. Should I push it directly to Girhub or open a new pull request after you merge it? In addition, there is a problem I can't solve. If you switch the language in the game after turning on the advanced mode, the default values ​​of the fields that use translations, such as mainAdvancedModeDetail in the Mod Configuration interface, will not be changed. You must restart the game to change to the modified language. I don't know how to solve this.

ThePhaseCat commented 3 weeks ago

Could you make a separate pull request for that?

TheWhiteDog9487 commented 3 weeks ago

Could you make a separate pull request for that?

If I push to this branch now, the two commits will be merged into this pull request. So I need to wait for this pull request to be merged, and the next time I open a pull request, there will only be one commit.

TheWhiteDog9487 commented 3 weeks ago

Could you make a separate pull request for that?

If you don't want to merge this pull request now, then I need to push it to another branch, and you will need to merge it into the other branch later.

ThePhaseCat commented 3 weeks ago

If you give me like 5-6 hours I'll be able to merge this one if you're willing to wait

ThePhaseCat commented 3 weeks ago

had time to merge in between classes!

TheWhiteDog9487 commented 2 weeks ago

had time to merge in between classes!

Thanks for help!