2017-06-19 03:36:55 +02:00
|
|
|
From 1938ff2b5f43d68ca8fe67b1f69bb0ed77776b3b Mon Sep 17 00:00:00 2001
|
2016-06-04 10:11:03 +02:00
|
|
|
From: Martin Panzer <postremus1996@googlemail.com>
|
|
|
|
Date: Fri, 3 Jun 2016 23:13:39 +0200
|
|
|
|
Subject: [PATCH] Fix FallingBlocks being stuck on fences
|
|
|
|
|
|
|
|
Fallingblocks would previously only check if directly beneath them a block exists. They also
|
|
|
|
hover on top of the 1.5 block tall hitbox of fences during these check. This
|
|
|
|
resulted in them always thinking they would be on air.
|
|
|
|
|
|
|
|
We now first check, if if we are already on the ground.
|
|
|
|
if not, we check if the falling block is inside of the hitbox of the block at y - 1.
|
|
|
|
|
2016-07-29 03:54:48 +02:00
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2017-06-19 03:36:55 +02:00
|
|
|
index d2a54235..c74071eb 100644
|
2016-07-29 03:54:48 +02:00
|
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2017-05-14 20:05:01 +02:00
|
|
|
@@ -336,4 +336,9 @@ public class PaperWorldConfig {
|
|
|
|
preventTntFromMovingInWater = getBoolean("prevent-tnt-from-moving-in-water", false);
|
|
|
|
log("Prevent TNT from moving in water: " + preventTntFromMovingInWater);
|
2016-07-29 03:54:48 +02:00
|
|
|
}
|
|
|
|
+
|
|
|
|
+ public boolean altFallingBlockOnGround;
|
|
|
|
+ private void altFallingBlockOnGround() {
|
|
|
|
+ altFallingBlockOnGround = getBoolean("use-alternate-fallingblock-onGround-detection", false);
|
|
|
|
+ }
|
|
|
|
}
|
2016-06-04 10:11:03 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/BlockFalling.java b/src/main/java/net/minecraft/server/BlockFalling.java
|
2017-06-19 03:36:55 +02:00
|
|
|
index 67439575..1086e311 100644
|
2016-06-04 10:11:03 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/BlockFalling.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/BlockFalling.java
|
2016-11-17 03:23:38 +01:00
|
|
|
@@ -71,6 +71,12 @@ public class BlockFalling extends Block {
|
2016-06-04 10:11:03 +02:00
|
|
|
return block == Blocks.FIRE || material == Material.AIR || material == Material.WATER || material == Material.LAVA;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ // Paper start - OBFHELPER
|
|
|
|
+ public static boolean canMoveThrough(IBlockData blockdata) {
|
2017-05-31 10:04:52 +02:00
|
|
|
+ return BlockFalling.x(blockdata);
|
2016-06-04 10:11:03 +02:00
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
+
|
2017-05-14 20:05:01 +02:00
|
|
|
public void a(World world, BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) {}
|
2016-11-17 03:23:38 +01:00
|
|
|
|
2017-05-14 20:05:01 +02:00
|
|
|
public void a_(World world, BlockPosition blockposition) {}
|
2016-06-04 10:11:03 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
2017-06-19 03:36:55 +02:00
|
|
|
index f4bb2e65..328ee251 100644
|
2016-06-04 10:11:03 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
2017-05-14 20:05:01 +02:00
|
|
|
@@ -3,6 +3,7 @@ package net.minecraft.server;
|
2016-06-04 10:11:03 +02:00
|
|
|
import com.google.common.collect.Lists;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Iterator;
|
|
|
|
+import java.util.List;
|
|
|
|
import javax.annotation.Nullable;
|
|
|
|
|
|
|
|
import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
2017-05-31 10:04:52 +02:00
|
|
|
@@ -120,10 +121,10 @@ public class EntityFallingBlock extends Entity {
|
|
|
|
}
|
2017-05-14 20:05:01 +02:00
|
|
|
} else {
|
2016-06-04 10:11:03 +02:00
|
|
|
IBlockData iblockdata = this.world.getType(blockposition);
|
2017-05-31 10:04:52 +02:00
|
|
|
-
|
|
|
|
- if (!flag1 && BlockFalling.x(this.world.getType(new BlockPosition(this.locX, this.locY - 0.009999999776482582D, this.locZ)))) {
|
|
|
|
+
|
2016-06-04 10:11:03 +02:00
|
|
|
+ if (!isOnGround()) {
|
|
|
|
this.onGround = false;
|
|
|
|
- // return; // CraftBukkit
|
2016-07-29 03:54:48 +02:00
|
|
|
+ if (this.world.paperConfig.altFallingBlockOnGround) return; // Paper
|
2016-06-04 10:11:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
this.motX *= 0.699999988079071D;
|
2017-05-14 20:05:01 +02:00
|
|
|
@@ -179,6 +180,32 @@ public class EntityFallingBlock extends Entity {
|
2016-06-04 10:11:03 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+ // Paper start
|
|
|
|
+ private boolean isOnGround() {
|
|
|
|
+ BlockPosition where = new BlockPosition(this.locX, this.locY - 0.009999999776482582D, this.locZ);
|
2016-07-29 03:54:48 +02:00
|
|
|
+ boolean cannotMoveThrough = !BlockFalling.canMoveThrough(this.world.getType(where));
|
|
|
|
+ if (!this.world.paperConfig.altFallingBlockOnGround) return cannotMoveThrough;
|
2016-06-04 10:11:03 +02:00
|
|
|
+
|
2016-07-29 03:54:48 +02:00
|
|
|
+ if (cannotMoveThrough) {
|
2016-06-04 10:11:03 +02:00
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ IBlockData blockData = this.world.getType(where.down());
|
|
|
|
+ if (BlockFalling.canMoveThrough(blockData)) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<AxisAlignedBB> list = new ArrayList<>();
|
|
|
|
+ addCollisions(blockData, getWorld(), where, this.getBoundingBox(), list, this);
|
|
|
|
+ return list.size() > 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // OBFHELPER
|
|
|
|
+ private void addCollisions(IBlockData blockData, World world, BlockPosition where, AxisAlignedBB collider, List<AxisAlignedBB> list, Entity entity) {
|
2016-12-20 23:34:27 +01:00
|
|
|
+ blockData.a(world, where, collider, list, entity, false);
|
2016-06-04 10:11:03 +02:00
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
+
|
|
|
|
public void e(float f, float f1) {
|
|
|
|
Block block = this.block.getBlock();
|
|
|
|
|
|
|
|
--
|
2017-06-19 03:36:55 +02:00
|
|
|
2.13.1.windows.2
|
2016-06-04 10:11:03 +02:00
|
|
|
|