Paper icon indicating copy to clipboard operation
Paper copied to clipboard

Add removalreason to EntityRemoveFromWorldEvent

Open kennytv opened this issue 1 year ago • 4 comments

Upstream's EntityRemoveEvent was deprecated for coming almost a decade late, but they have the one addition of a reason that we're missing in EntityRemoveFromWorldEvent. Same thing applies to the knockback events I believe

kennytv avatar Feb 23 '24 18:02 kennytv

do we just call the paper event in CraftEventFactory#callEntityRemoveEvent instead of ServerLevel.EntityCallbacks#onTrackingEnd with the Cause converting to EntityRemoveFromWorldEvent.RemovalReason (Since EntityRemoveEvent.Cause is deprecated and will be removed in the future we would have to add separate removal reasons) or does it make sense to do it differently?

Leguan16 avatar Feb 23 '24 22:02 Leguan16

On a related note, EntityRemoveEvent isn't always called on chunk unload, as the chunk system rewrite does not end up calling Entity#setRemoved in some circumstances, just EntityCallbacks#onTrackingEnd.

TonytheMacaroni avatar Feb 24 '24 18:02 TonytheMacaroni