-
-
Notifications
You must be signed in to change notification settings - Fork 778
Some fixes for potion items #5555
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…on name, fix potion name in tipped arrows (refs GeyserMC#5255 GeyserMC#5176)
… potion components
…etting potion name in the getPotionName method?
| // Make custom effect information visible when shown in tooltip | ||
| if (potionContents != null && tooltip.showInTooltip(DataComponentTypes.POTION_CONTENTS)) { | ||
| customName += getPotionEffectInfo(potionContents, session.locale()); // TODO should this be done with lore instead? | ||
| if (javaItem instanceof PotionItem || javaItem instanceof ArrowItem) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason for adding this instanceof check? Geyser tries to match Java behaviour, and Java shows the potion effect tooltip on all items with a potion_contents component, not just these specific items, so it's probably good to do the same.
Also, given the above, I'm not sure if Geyser should show the effect in the HUD name tooltip, since Java doesn't. However, that seems up to debate to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reason for show the effects in the HUD name tooltip
Bedrock always show effects in the HUD name tooltip, and show "No Effects" when it haven't any effects. If use lore to show these custom effects, Bedrock player will only saw effects or "No Effects" by vanilla potion ID.
/give @s potion[custom_name="Test",potion_contents={custom_effects:[{id:hero_of_the_village,duration:-1},{id:unluck,amplifier:1,duration:658980}]}]


/give @s potion[custom_name="Test 2",potion_contents={custom_effects:[{id:hero_of_the_village,duration:-1},{id:unluck,amplifier:1,duration:658980}],potion:leaping}]


But wrapping line in name can resolve this problem well:
At least, It reduce some misunderstandings of players, even if it looks a little wried.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, is the instanceof check before getting potion name in the getPotionName method used to use the custom_name of the potion_contents component only on tipped arrow & potion to match the Java behavior? I understand now.
For show custom effects on next line of the name, I think it have a better method to implement this. I'll take a look at it later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bedrock always show effects in the HUD name tooltip, and show "No Effects" when it haven't any effects. If use lore to show these custom effects, Bedrock player will only saw effects or "No Effects" by vanilla potion ID.
Ah okay, thanks for clarifying! In that case, this makes sense to me. It might be good to document this in comments near the code as well, for future reference.
core/src/main/java/org/geysermc/geyser/translator/item/ItemTranslator.java
Outdated
Show resolved
Hide resolved
…, like getting potion name in the getPotionName method?" This reverts commit c002361.
…ame when potion tooltip is hidden
…potion-component
|
Heya, what's the holdup here? 😄 |
I deeply apologize, but I don't have time to continue this work for the time being. I will add some commit directly when I come back in future. |
|
Sorry I took too long. Now it can be review. |


- Feature:Make custom effect information visible & Support for customizing item name via 'custom_name' tag in 'potion_contents' component (new feature since 1.21.2) #5176
- Fix
item_namecomponent not work; Improve display of custom effects and shulker box tooltips for item names #5255Example:
/give @s potion[potion_contents={potion:long_leaping,custom_effects:[{id:luck}]}]Example:
/give @s minecraft:tipped_arrow[potion_contents={potion:leaping}]Example:
/give @s minecraft:shulker_box[container=[{slot:0,item:{id:tipped_arrow,count:1,components:{potion_contents:{potion:leaping}}}}]]potion effectscustom potion effects innormal arrow itemall items just like Java EditionExample:
/give @s apple[potion_contents={custom_effects:[{id:luck}]}]minecraft:potion_duration_scalecomponent support (new feature since 1.21.5)