Currently the Ender Dragon takes roughly 3x the explosion damage when compared to vanilla 1.19.3. This is caused by a single damage value being calculated for the EntityEnderDragon and then being uniformly applied to every EntityComplexPart belonging to that dragon.
This is resolved by restoring the vanilla behavior of calculating explosion damage separately for each EntityComplexPart.
An IllegalStateException may occur when an entity is damaged by fire or a potion effect immediately after an EntityComplexPart is damaged by an explosion.
This is fixed by performing the instanceof EntityComplexPart check prior to setting CraftEventFactory.entityDamage.
A previous fix for SPIGOT-6814 implemented a callback function for the
PDC implementation that could be set to actively define a chunk as
unsaved, allowing chunks that have not been mutated through block
changes to still require saving if the chunks pdc was mutated.
This implementation however would pass a callback that references the
chunk access internally, meaning the PDC now actively holds onto a
callback that holds a reference to the entire chunk.
Aditionally, this change also impacted the pdc for item metas and
entities for really no reason whatsoever.
This commit re-implements the fix by introducing a new child of the pdc
implementation that the chunk now uses as its pdc. This specific
implementation maintains a dirty flag that is set to `true` on any form
of mutation and set back to false by the chunk that owns the PDC
whenever the chunk itself is flag as no longer dirty.
During block destruction, the type of the block may already have been set to AIR while the TileEntity has not yet been removed.
Also, TileEntity#getOwner() skips the whole BlockState construction now if the block is of type AIR.
This removes the previous workaround again of returning a dummy CraftBlockEntityState in this case.