mirror of
https://github.com/PaperMC/Paper.git
synced 2025-02-03 22:21:37 +01:00
SPIGOT-6586: EntityChangeBlockEvent for falling block does not cancel properly
By: md_5 <git@md-5.net>
This commit is contained in:
parent
64174260d1
commit
453d93caa5
@ -18,19 +18,20 @@
|
|||||||
this.level.a(blockposition, false);
|
this.level.a(blockposition, false);
|
||||||
} else if (!this.level.isClientSide) {
|
} else if (!this.level.isClientSide) {
|
||||||
this.die();
|
this.die();
|
||||||
@@ -165,6 +167,11 @@
|
@@ -165,6 +167,12 @@
|
||||||
this.blockState = (IBlockData) this.blockState.set(BlockProperties.WATERLOGGED, true);
|
this.blockState = (IBlockData) this.blockState.set(BlockProperties.WATERLOGGED, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ if (CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, this.blockState).isCancelled()) {
|
+ if (CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, this.blockState).isCancelled()) {
|
||||||
|
+ this.die(); // SPIGOT-6586 called before the event in previous versions
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
+ // CraftBukkit end
|
+ // CraftBukkit end
|
||||||
if (this.level.setTypeAndData(blockposition, this.blockState, 3)) {
|
if (this.level.setTypeAndData(blockposition, this.blockState, 3)) {
|
||||||
((WorldServer) this.level).getChunkProvider().chunkMap.broadcast(this, new PacketPlayOutBlockChange(blockposition, this.level.getType(blockposition)));
|
((WorldServer) this.level).getChunkProvider().chunkMap.broadcast(this, new PacketPlayOutBlockChange(blockposition, this.level.getType(blockposition)));
|
||||||
this.die();
|
this.die();
|
||||||
@@ -238,7 +245,7 @@
|
@@ -238,7 +246,7 @@
|
||||||
if (i < 0) {
|
if (i < 0) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
@ -39,7 +40,7 @@
|
|||||||
DamageSource damagesource1;
|
DamageSource damagesource1;
|
||||||
|
|
||||||
if (this.blockState.getBlock() instanceof Fallable) {
|
if (this.blockState.getBlock() instanceof Fallable) {
|
||||||
@@ -254,7 +261,9 @@
|
@@ -254,7 +262,9 @@
|
||||||
float f2 = (float) Math.min(MathHelper.d((float) i * this.fallDamagePerDistance), this.fallDamageMax);
|
float f2 = (float) Math.min(MathHelper.d((float) i * this.fallDamagePerDistance), this.fallDamageMax);
|
||||||
|
|
||||||
this.level.getEntities(this, this.getBoundingBox(), predicate).forEach((entity) -> {
|
this.level.getEntities(this, this.getBoundingBox(), predicate).forEach((entity) -> {
|
||||||
|
Loading…
Reference in New Issue
Block a user