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 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
import java.util.Iterator;
|
2018-12-25 22:00:00 +01:00
|
|
|
import java.util.List;
|
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;
|
2018-07-15 02:00:00 +02:00
|
|
|
@@ -71,7 +73,7 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
|
|
|
|
if (this.ticksLived++ == 0) {
|
|
|
|
blockposition = new BlockPosition(this);
|
|
|
|
- if (this.world.getType(blockposition).getBlock() == block) {
|
2018-07-15 02:00:00 +02:00
|
|
|
+ if (this.world.getType(blockposition).getBlock() == block && !CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, Blocks.AIR.getBlockData()).isCancelled()) {
|
2014-11-25 22:32:16 +01:00
|
|
|
this.world.setAir(blockposition);
|
2015-02-26 23:41:06 +01:00
|
|
|
} else if (!this.world.isClientSide) {
|
2014-11-25 22:32:16 +01:00
|
|
|
this.die();
|
2018-07-15 02:00:00 +02:00
|
|
|
@@ -112,7 +114,7 @@
|
2016-03-22 08:04:02 +01:00
|
|
|
|
2018-12-13 01:00:00 +01:00
|
|
|
if (!flag1 && BlockFalling.canFallThrough(this.world.getType(new BlockPosition(this.locX, this.locY - 0.009999999776482582D, this.locZ)))) {
|
2016-03-22 08:04:02 +01:00
|
|
|
this.onGround = false;
|
|
|
|
- return;
|
|
|
|
+ // return; // CraftBukkit
|
|
|
|
}
|
|
|
|
|
|
|
|
this.motX *= 0.699999988079071D;
|
2018-07-15 02:00:00 +02:00
|
|
|
@@ -121,7 +123,13 @@
|
|
|
|
if (iblockdata.getBlock() != Blocks.MOVING_PISTON) {
|
2014-11-25 22:32:16 +01:00
|
|
|
this.die();
|
2016-02-29 22:32:46 +01:00
|
|
|
if (!this.f) {
|
2018-12-13 01:00:00 +01:00
|
|
|
- if (iblockdata.getMaterial().isReplaceable() && (flag1 || !BlockFalling.canFallThrough(this.world.getType(blockposition.down()))) && this.world.setTypeAndData(blockposition, this.block, 3)) {
|
2016-03-02 07:07:08 +01:00
|
|
|
+ // CraftBukkit start
|
2018-12-13 01:00:00 +01:00
|
|
|
+ if (iblockdata.getMaterial().isReplaceable() && (flag1 || !BlockFalling.canFallThrough(this.world.getType(blockposition.down())))) {
|
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;
|
|
|
|
+ }
|
|
|
|
+ this.world.setTypeAndData(blockposition, this.block, 3);
|
|
|
|
+ // CraftBukkit end
|
|
|
|
if (block instanceof BlockFalling) {
|
2017-05-14 04:00:00 +02:00
|
|
|
((BlockFalling) block).a(this.world, blockposition, this.block, iblockdata);
|
2015-02-26 23:41:06 +01:00
|
|
|
}
|
2017-05-14 04:00:00 +02:00
|
|
|
@@ -175,7 +183,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) {
|