13
0
geforkt von Mirrors/Paper
Paper/nms-patches/EntityFallingBlock.patch

43 Zeilen
2.1 KiB
Diff

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/EntityFallingBlock.java
+++ b/net/minecraft/server/EntityFallingBlock.java
2018-07-15 02:00:00 +02:00
@@ -4,6 +4,8 @@
import java.util.Iterator;
2018-12-25 22:00:00 +01:00
import java.util.List;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
public class EntityFallingBlock extends Entity {
2015-02-26 23:41:06 +01:00
private IBlockData block;
2019-12-10 23:00:00 +01:00
@@ -70,7 +72,7 @@
if (this.ticksLived++ == 0) {
2020-06-25 02:00:00 +02:00
blockposition = this.getChunkCoordinates();
- if (this.world.getType(blockposition).a(block)) {
+ if (this.world.getType(blockposition).a(block) && !CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, Blocks.AIR.getBlockData()).isCancelled()) {
2019-04-23 04:00:00 +02:00
this.world.a(blockposition, false);
2015-02-26 23:41:06 +01:00
} else if (!this.world.isClientSide) {
this.die();
2020-01-21 22:00:00 +01:00
@@ -122,6 +124,11 @@
2019-04-23 04:00:00 +02:00
this.block = (IBlockData) this.block.set(BlockProperties.C, true);
}
2019-04-23 04:00:00 +02:00
+ // CraftBukkit start
2018-07-15 02:00:00 +02:00
+ if (CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, this.block).isCancelled()) {
2015-02-26 23:41:06 +01:00
+ return;
+ }
+ // CraftBukkit end
2019-04-23 04:00:00 +02:00
if (this.world.setTypeAndData(blockposition, this.block, 3)) {
if (block instanceof BlockFalling) {
2020-06-25 02:00:00 +02:00
((BlockFalling) block).a(this.world, blockposition, this.block, iblockdata, this);
2020-01-21 22:00:00 +01:00
@@ -178,7 +185,9 @@
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
+ CraftEventFactory.entityDamage = this; // CraftBukkit
entity.damageEntity(damagesource, (float) Math.min(MathHelper.d((float) i * this.fallHurtAmount), this.fallHurtMax));
+ CraftEventFactory.entityDamage = null; // CraftBukkit
}
if (flag && (double) this.random.nextFloat() < 0.05000000074505806D + (double) i * 0.05D) {