Make alternative falling block ground detection configurable

Workaround for GH-336
This commit is contained in:
Zach Brown 2016-07-28 20:54:48 -05:00
parent 023780514f
commit 2ea6b93c67
4 changed files with 26 additions and 12 deletions

View file

@ -21,9 +21,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
}
private void isHopperPushBased() {
isHopperPushBased = getBoolean("hopper.push-based", true);
}
+
+ public long delayChunkUnloadsBy;
+ private void delayChunkUnloadsBy() {
+ delayChunkUnloadsBy = PaperConfig.getSeconds(getString("delay-chunk-unloads-by", "0s"));
@ -32,10 +33,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ delayChunkUnloadsBy *= 1000;
+ }
+ }
+
public boolean isHopperPushBased;
private void isHopperPushBased() {
isHopperPushBased = getBoolean("hopper.push-based", true);
}
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/Chunk.java

View file

@ -10,6 +10,20 @@ 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.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
log("Old Cannon Behaviors: This feature may not be working entirely properly at the moment");
}
}
+
+ public boolean altFallingBlockOnGround;
+ private void altFallingBlockOnGround() {
+ altFallingBlockOnGround = getBoolean("use-alternate-fallingblock-onGround-detection", false);
+ }
}
diff --git a/src/main/java/net/minecraft/server/BlockFalling.java b/src/main/java/net/minecraft/server/BlockFalling.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/BlockFalling.java
@ -49,7 +63,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if (!isOnGround()) {
this.onGround = false;
- // return; // CraftBukkit
+ return; // Paper
+ if (this.world.paperConfig.altFallingBlockOnGround) return; // Paper
}
this.motX *= 0.699999988079071D;
@ -60,8 +74,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start
+ private boolean isOnGround() {
+ BlockPosition where = new BlockPosition(this.locX, this.locY - 0.009999999776482582D, this.locZ);
+ boolean cannotMoveThrough = !BlockFalling.canMoveThrough(this.world.getType(where));
+ if (!this.world.paperConfig.altFallingBlockOnGround) return cannotMoveThrough;
+
+ if (!BlockFalling.canMoveThrough(this.world.getType(where))) {
+ if (cannotMoveThrough) {
+ return true;
+ }
+

View file

@ -82,8 +82,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
log("Old Cannon Behaviors: This feature may not be working entirely properly at the moment");
}
private void altFallingBlockOnGround() {
altFallingBlockOnGround = getBoolean("use-alternate-fallingblock-onGround-detection", false);
}
+
+ public boolean isHopperPushBased;

View file

@ -11,8 +11,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
private void isHopperPushBased() {
isHopperPushBased = getBoolean("hopper.push-based", true);
delayChunkUnloadsBy *= 1000;
}
}
+
+ public boolean elytraHitWallDamage = true;