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 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -0,0 +0,0 @@ public class PaperWorldConfig {
private void isHopperPushBased() {
isHopperPushBased = getBoolean("hopper.push-based", true);
} }
} +
+ public long delayChunkUnloadsBy; + public long delayChunkUnloadsBy;
+ private void delayChunkUnloadsBy() { + private void delayChunkUnloadsBy() {
+ delayChunkUnloadsBy = PaperConfig.getSeconds(getString("delay-chunk-unloads-by", "0s")); + delayChunkUnloadsBy = PaperConfig.getSeconds(getString("delay-chunk-unloads-by", "0s"));
@@ -32,10 +33,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ delayChunkUnloadsBy *= 1000; + 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 diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/Chunk.java --- 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. 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. 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 diff --git a/src/main/java/net/minecraft/server/BlockFalling.java b/src/main/java/net/minecraft/server/BlockFalling.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/BlockFalling.java --- a/src/main/java/net/minecraft/server/BlockFalling.java
@@ -49,7 +63,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ if (!isOnGround()) { + if (!isOnGround()) {
this.onGround = false; this.onGround = false;
- // return; // CraftBukkit - // return; // CraftBukkit
+ return; // Paper + if (this.world.paperConfig.altFallingBlockOnGround) return; // Paper
} }
this.motX *= 0.699999988079071D; this.motX *= 0.699999988079071D;
@@ -60,8 +74,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper start + // Paper start
+ private boolean isOnGround() { + private boolean isOnGround() {
+ BlockPosition where = new BlockPosition(this.locX, this.locY - 0.009999999776482582D, this.locZ); + 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; + return true;
+ } + }
+ +

View File

@@ -82,8 +82,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -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; + public boolean isHopperPushBased;

View File

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