Skip to content
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

Several fixes / changes to the holder item action #132

Merged
merged 6 commits into from
Aug 4, 2023
Merged

Conversation

apace100
Copy link
Owner

This PR includes several changes regarding the holder item action:

  1. Optimized the InventoryUtil#forEachStack method to not allocate a new set each call
  2. Changed the setting of holder entities from vanilla's setHolder to our duck interface's EntityLinkedItemStack#setEntity. This is better because it does not change vanilla semantics of the holder field.
  3. Added a test power.
  4. Renamed holder to holder_action and the entity_action field to action. This is to make it in line with other actions, like equipped_item_action, passenger_action, etc. I feel this is okay since the action hasn't been released for too long and is probably still barely used. If you think this is too late for that change, we could add an alias using the old names for backwards compatibility and make an announcement asking people to change over to the new names quickly.

Thanks Pug for pointing out the optimization potential with the method.

Copy link
Contributor

@MerchantPug MerchantPug left a comment

Choose a reason for hiding this comment

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

I don't quite see the point in keeping InventoryUtil#deduplicateSlots when we aren't using it anymore and when it's private.

If it is still used, please tell me and I'll approve. I can't quite check properly on my phone.

I feel like we could potentially implement these optimisations to the other InventoryUtil methods too.

Copy link
Contributor

@MerchantPug MerchantPug left a comment

Choose a reason for hiding this comment

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

The above is invalid, please ignore it.

MerchantPug added a commit to MerchantPug/apoli that referenced this pull request Jul 25, 2023
Copy link
Collaborator

@eggohito eggohito left a comment

Choose a reason for hiding this comment

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

Looks good! I agree on adding a path alias for it, though identifier aliasing is currently not perfect (it doesn't have a priority system of some sort similar to Prioritized.CallInstance<?>)

@MerchantPug
Copy link
Contributor

Looks good! I agree on adding a path alias for it, though identifier aliasing is currently not perfect (it doesn't have a priority system of some sort similar to Prioritized.CallInstance<?>)

Agreed on having a path alias.

# Conflicts:
#	src/main/java/io/github/apace100/apoli/mixin/LivingEntityMixin.java
#	src/main/java/io/github/apace100/apoli/util/InventoryUtil.java
@eggohito eggohito merged commit f33b0fb into 1.20 Aug 4, 2023
@eggohito eggohito deleted the fix/holder branch August 12, 2023 10:04
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.

3 participants