Add CreeperSwellEvent#13912
Conversation
|
Example usages: cancel_fall_damage_swell.mp4sound_on_swell.mp4 |
|
|
After reading your reply, I noticed a bug that would let a primed creeper's swell level to continue to change even if the event was cancelled. It happened because cancelling the event set the final swell change to 0, so the vanilla logic kicked in and continued to increment the swell level. Now, the
The client does render an unswell, but it seems like the client is only programmed to render a full swell in one direction. For example, if I use this code in a plugin to only allow a creeper to swell half-way: @EventHandler
public void onCreeperSwell(CreeperSwellEvent event) {
if (event.getCurrentSwell() + event.getFinalSwellChange() > event.getMaxSwell()/2)
event.setCancelled(true);
}the client still sees the creeper swelling completely: stop_swell_halfway.mp4
It depends, if the creeper was ignited and is not being primed, it will simply unswell. But if the creeper is actively being primed (e.g. due to proximity), then yes, the creeper is stuck at max swell and tries to explode until it's no longer being primed: cancel_explosion_and_swell.mp4Although, I think this is desired behavior rather than a bug? If you cancel a |
There's currently no event that fires when a creeper's swell level changes, and there's currently no way to stop a creeper from swelling.
CreeperIgniteEventdoes not fire when a creeper primes due to proximity,EntityExplodeEventonly fires at the end of swelling, andGenericGameEventof typeGameEvent.PRIME_FUSEdoesn't allow for cancelling and doesn't fire for individual swell steps.The proposed
CreeperSwellEventfires whenever a creeper's internal swell level changes, and it also differentiates different reasons for the swell:PRIMED(proximity or ignition),FALL_DAMAGE(falling from a height), orCUSTOM(plugin adjusting swell).Fixes #12620