2021-03-15 23:00:00 +01:00
|
|
|
--- a/net/minecraft/world/entity/item/EntityFallingBlock.java
|
|
|
|
+++ b/net/minecraft/world/entity/item/EntityFallingBlock.java
|
|
|
|
@@ -43,6 +43,8 @@
|
|
|
|
import net.minecraft.world.phys.MovingObjectPositionBlock;
|
|
|
|
import net.minecraft.world.phys.Vec3D;
|
2014-11-25 22:32:16 +01:00
|
|
|
|
|
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
|
|
|
+
|
|
|
|
public class EntityFallingBlock extends Entity {
|
|
|
|
|
2015-02-26 23:41:06 +01:00
|
|
|
private IBlockData block;
|
2021-03-15 23:00:00 +01:00
|
|
|
@@ -109,7 +111,7 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
|
|
|
|
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) {
|
2014-11-25 22:32:16 +01:00
|
|
|
this.die();
|
2021-03-15 23:00:00 +01:00
|
|
|
@@ -161,6 +163,11 @@
|
2019-04-23 04:00:00 +02:00
|
|
|
this.block = (IBlockData) this.block.set(BlockProperties.C, true);
|
|
|
|
}
|
2016-03-22 08:04:02 +01:00
|
|
|
|
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);
|
2021-03-15 23:00:00 +01:00
|
|
|
@@ -217,7 +224,9 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
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) {
|