PaperMC/Spigot-Server-Patches/0017-Drop-falling-block-entities-that-are-above-the-speci.patch

51 lines
2.1 KiB
Diff

From c9860a2e12193e696b71bdab28696fd08e55ccce Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Sat, 7 Mar 2015 22:03:47 -0600
Subject: [PATCH] Drop falling block entities that are above the specified
height
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
index ce91553..ef93776 100644
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
@@ -69,6 +69,17 @@ public class EntityFallingBlock extends Entity {
this.motY -= 0.03999999910593033D;
this.move(this.motX, this.motY, this.motZ);
+
+ // PaperSpigot start - Drop falling blocks above the specified height
+ if (this.world.paperSpigotConfig.fallingBlockHeightNerf != 0 && this.locY > this.world.paperSpigotConfig.fallingBlockHeightNerf) {
+ if (this.dropItem) {
+ this.a(new ItemStack(block, 1, block.getDropData(this.block)), 0.0F);
+ }
+
+ this.die();
+ }
+ // PaperSpigot end
+
this.motX *= 0.9800000190734863D;
this.motY *= 0.9800000190734863D;
this.motZ *= 0.9800000190734863D;
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 8d707f7..ebe0a4f 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -146,4 +146,14 @@ public class PaperSpigotWorldConfig
keepSpawnInMemory = getBoolean( "keep-spawn-loaded", true );
log( "Keep spawn chunk loaded: " + keepSpawnInMemory );
}
+
+ public int fallingBlockHeightNerf;
+ private void fallingBlockheightNerf()
+ {
+ fallingBlockHeightNerf = getInt( "falling-block-height-nerf", 0 );
+ if ( fallingBlockHeightNerf != 0 )
+ {
+ log( "Falling Block Height Limit set to Y: " + fallingBlockHeightNerf );
+ }
+ }
}
--
1.9.1