Fix new block data for EntityChangeBlockEvent

Also standardizes how to handle EntityChangeBlockEvent before a removeBlock or destroyBlock
call. Always use 'state.getFluidState().createLegacyBlock()' to get the new state instead of
just using the 'air' state.

Also fixes the new block data for EntityBreakDoorEvent (a sub-event from
EntityChangeBlockEvent)

Co-authored-by: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
This commit is contained in:
SoSeDiK
2022-03-21 20:00:53 +02:00
parent 8f23a7f6af
commit 58f0db0820
14 changed files with 25 additions and 21 deletions

View File

@@ -110,7 +110,7 @@
if (WitherBoss.canDestroy(iblockdata)) {
+ // CraftBukkit start
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, Blocks.AIR.defaultBlockState())) {
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, iblockdata.getFluidState().createLegacyBlock())) { // Paper - fix wrong block state
+ continue;
+ }
+ // CraftBukkit end