Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Add the PlayerXpEvent events (add XP points/level, pickup XP orb) #89

Merged
merged 4 commits into from
Jun 20, 2020

Conversation

ZNixian
Copy link
Member

@ZNixian ZNixian commented Jun 17, 2020

Required for Curios, See #84.

I can't remember if it is in Forge, but I've marked PlayerPickupXpEvent as deprecated as it's removed in Forge for 1.15. It seems to have been the original event for interacting with XP pickups, until it was superseded by the PlayerXpEvent family of events.

When PlayerXpEvent.XpChange is cancelled, there is a very small behavioural difference to Forge: PlayerEntity.addScore (with zero as an argument) and PlayerEntity.getNextLevelExperience are called. The former calls get and set on a DataTracker, the latter doesn't call any other methods (and while other mods hooking getNextLevelExperience is plausible, one would expect those not to have any side-effects).

Since a @ModifyVariable mixin is used, it's not (as far as I know) straightforward to also properly cancel this event, though of course it can be done if you think it might make a difference.

@ZNixian ZNixian mentioned this pull request Jun 17, 2020
15 tasks
Copy link
Member

@TheGlitch76 TheGlitch76 left a comment

Choose a reason for hiding this comment

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

The complex Inject looks suspicious, please make sure it works. One small nitpick besides that.

@ZNixian ZNixian requested a review from TheGlitch76 June 19, 2020 06:57
Copy link
Member

@TheGlitch76 TheGlitch76 left a comment

Choose a reason for hiding this comment

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

Just need a module version bump and this is good to go

@ZNixian ZNixian merged commit b9e9615 into PatchworkMC:master Jun 20, 2020
@ZNixian ZNixian deleted the player-xp-events branch June 20, 2020 01:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants