mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-10 12:02:36 +01:00
9da047989c
By: md_5 <git@md-5.net>
42 lines
2.2 KiB
Diff
42 lines
2.2 KiB
Diff
--- 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;
|
|
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
|
+
|
|
public class EntityFallingBlock extends Entity {
|
|
|
|
private IBlockData block;
|
|
@@ -109,7 +111,7 @@
|
|
|
|
if (this.ticksLived++ == 0) {
|
|
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()) {
|
|
this.world.a(blockposition, false);
|
|
} else if (!this.world.isClientSide) {
|
|
this.die();
|
|
@@ -161,6 +163,11 @@
|
|
this.block = (IBlockData) this.block.set(BlockProperties.C, true);
|
|
}
|
|
|
|
+ // CraftBukkit start
|
|
+ if (CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, this.block).isCancelled()) {
|
|
+ return;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
if (this.world.setTypeAndData(blockposition, this.block, 3)) {
|
|
if (block instanceof BlockFalling) {
|
|
((BlockFalling) block).a(this.world, blockposition, this.block, iblockdata, this);
|
|
@@ -217,7 +224,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) {
|