Paper
Paper copied to clipboard
When cancelled VillagerCareerChangeEvent particle still spawn
Expected behavior
When cancelled career change default particle don't spawn.
Observed/Actual behavior
When cancelled career change but default particle still spawn.
Steps/models to reproduce
@EventHandler
public void onVillagerCareerChange(VillagerCareerChangeEvent e) {
if (e.getReason() == VillagerCareerChangeEvent.ChangeReason.EMPLOYED) {
e.setCancelled(true);
}
}
Plugin and Datapack List
Only my plugin
Paper version
git-Paper-265 (MC: 1.19.2) (Implementing API version 1.19.2-R0.1-SNAPSHOT) (Git: 117579c)
Other
No response
Hmm the error is because NMS later of modify the memory for the potential and the job site send the particle for happy and try with a optional to set the Career where the event is..
not sure if the particle need to be moved for the completation of the behaviour in NMS..
Yea it is a bit of a philosophical question. The entity event right now is part of the villager assigning its job site. This does not correlate with a change in profession, e.g. cancelling the event may not really have to cancel it, just how the event rn does not remove the job site memory when cancelled.
Yeah.. maybe need more comments for think in a PR.. i mean i can move the code for the particles later when the job is set and the event not cancel... but not sure if this affect the perspective of the entity with the particles... like said the particles can be more a start process than a finish process...
Based on where the particles are spawned in the logic surrounding assigning job site, this is works as intended. Take the following example where a villager exists and has a job next to a composter. This villager has been traded with so will not lose its profession when the composter is destroyed. Destroy the composter and place a new one. The villager will emit particles but no VillagerCareerChangeEvent will be fired because it didn't change. Therefore the particles are because of the job site being assigned, not the career changed.