Skip to content

Conversation

@alwyn974
Copy link
Collaborator

This pull request introduces support for "arrow potions" in the Potion class and updates related classes and methods to accommodate this new feature. Key changes include adding the arrow property, modifying constructors, and updating serialization and deserialization logic to handle arrow potions.

Enhancements to Potion class:

  • Added a new arrow property to the Potion class, along with corresponding getter (isArrow) and setter (setArrow) methods. This property indicates whether the potion is an arrow potion. [1] [2]
  • Updated the Potion constructor to include the arrow parameter and added a chainable arrow() method for marking potions as arrow potions. [1] [2]

Serialization and deserialization changes:

  • Modified the toItemStack method in Potion to set the material to Material.TIPPED_ARROW for arrow potions. Adjusted how potion data is applied to the PotionMeta.
  • Updated the fromDamage method in Potion to use the switch expression for cleaner code.

Integration with other components:

  • Updated ZMenuItemStack to read the arrow property from configuration and pass it to the Potion constructor.
  • Updated MenuItemStackLoader and ItemStackLoader to handle the arrow property during potion loading from YAML configuration. [1] [2]

@alwyn974 alwyn974 requested a review from Copilot May 28, 2025 13:40
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for tipped arrow potions by introducing an "arrow" property to the Potion class and updating related constructors, serialization and YAML loaders.

  • Added a new boolean "arrow" property with appropriate getter, setter, and chainable arrow() method in the Potion class.
  • Updated Potion instantiation in ItemStackLoader, MenuItemStackLoader, and ZMenuItemStack to pass the arrow property.
  • Modified the toItemStack method in the Potion class to set the material to Material.TIPPED_ARROW when the arrow property is true.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/main/java/fr/maxlego08/menu/zcore/utils/loader/ItemStackLoader.java Loads the new arrow property from configuration and passes it to the Potion constructor.
src/main/java/fr/maxlego08/menu/loader/MenuItemStackLoader.java Reads arrow property from YAML configuration and updates Potion instantiation.
src/main/java/fr/maxlego08/menu/ZMenuItemStack.java Adjusts Potion creation to include the arrow property from configuration.
API/src/main/java/fr/maxlego08/menu/api/itemstack/Potion.java Introduces the arrow property, new chainable arrow() method, and updates serialization logic for tipped arrow potions.
Comments suppressed due to low confidence (1)

API/src/main/java/fr/maxlego08/menu/api/itemstack/Potion.java:384

  • The parameters for PotionData appear to be swapped compared to the original order. Verify that 'extended' and 'level == 2' correctly map to the 'upgraded' and 'extended' arguments as expected by the API.
meta.setBasePotionData(new PotionData(type, extended, level == 2));

@alwyn974 alwyn974 merged commit 2332dbe into Maxlego08:release/rework-gradle May 30, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant