mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-10 03:52:45 +01:00
b3a8254758
By: md_5 <git@md-5.net>
51 lines
2.6 KiB
Diff
51 lines
2.6 KiB
Diff
--- a/net/minecraft/world/entity/item/EntityFallingBlock.java
|
|
+++ b/net/minecraft/world/entity/item/EntityFallingBlock.java
|
|
@@ -45,6 +45,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 blockState;
|
|
@@ -114,7 +116,7 @@
|
|
|
|
if (this.time++ == 0) {
|
|
blockposition = this.getChunkCoordinates();
|
|
- if (this.level.getType(blockposition).a(block)) {
|
|
+ if (this.level.getType(blockposition).a(block) && !CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, Blocks.AIR.getBlockData()).isCancelled()) {
|
|
this.level.a(blockposition, false);
|
|
} else if (!this.level.isClientSide) {
|
|
this.die();
|
|
@@ -165,6 +167,11 @@
|
|
this.blockState = (IBlockData) this.blockState.set(BlockProperties.WATERLOGGED, true);
|
|
}
|
|
|
|
+ // CraftBukkit start
|
|
+ if (CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, this.blockState).isCancelled()) {
|
|
+ return;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
if (this.level.setTypeAndData(blockposition, this.blockState, 3)) {
|
|
((WorldServer) this.level).getChunkProvider().chunkMap.broadcast(this, new PacketPlayOutBlockChange(blockposition, this.level.getType(blockposition)));
|
|
this.die();
|
|
@@ -238,7 +245,7 @@
|
|
if (i < 0) {
|
|
return false;
|
|
} else {
|
|
- Predicate predicate;
|
|
+ Predicate<Entity> predicate; // CraftBukkit - decompile error
|
|
DamageSource damagesource1;
|
|
|
|
if (this.blockState.getBlock() instanceof Fallable) {
|
|
@@ -254,7 +261,9 @@
|
|
float f2 = (float) Math.min(MathHelper.d((float) i * this.fallDamagePerDistance), this.fallDamageMax);
|
|
|
|
this.level.getEntities(this, this.getBoundingBox(), predicate).forEach((entity) -> {
|
|
+ CraftEventFactory.entityDamage = this; // CraftBukkit
|
|
entity.damageEntity(damagesource1, f2);
|
|
+ CraftEventFactory.entityDamage = null; // CraftBukkit
|
|
});
|
|
boolean flag = this.blockState.a((Tag) TagsBlock.ANVIL);
|
|
|