testserver/Spigot-Server-Patches/0028-Drop-falling-block-ent...

57 lines
2.3 KiB
Diff

From 4e3e279e87216581baf20ca7826b1fb31e8649b1 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Wed, 30 Jul 2014 03:31:43 -0500
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 df602bd..5a36e1e 100644
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
@@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.Iterator;
import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+import org.github.paperspigot.PaperSpigotWorldConfig;
public class EntityFallingBlock extends Entity {
@@ -67,6 +68,17 @@ public class EntityFallingBlock extends Entity {
++this.ticksLived;
this.motY -= 0.03999999910593033D;
this.move(this.motX, this.motY, this.motZ);
+
+ // PaperSpigot start - Drop falling blocks above the specified height
+ if (PaperSpigotWorldConfig.fallingBlockHeightNerf != 0 && this.locY > PaperSpigotWorldConfig.fallingBlockHeightNerf) {
+ if (this.dropItem) {
+ this.a(new ItemStack(this.id, 1, this.id.getDropData(this.data)), 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 39bbd62..5e72313 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -169,4 +169,11 @@ public class PaperSpigotWorldConfig
keepSpawnInMemory = getBoolean( "keep-spawn-loaded", true );
log( "Keep spawn chunk loaded: " + keepSpawnInMemory );
}
+
+ public static double fallingBlockHeightNerf;
+ private void fallingBlockHeightNerf()
+ {
+ // Technically a little disingenuous as it applies to all falling blocks but alas, backwards compat prevails!
+ fallingBlockHeightNerf = getDouble( "tnt-entity-height-nerf", 0 );
+ }
}
--
1.9.1