diff options
author | Zach Brown <[email protected]> | 2016-09-10 21:42:47 -0500 |
---|---|---|
committer | Zach Brown <[email protected]> | 2016-09-10 21:44:06 -0500 |
commit | c02c01b2c531384dfe8f2d1d721113bada4892cb (patch) | |
tree | f0c0bff5bb9ab0b78f90e91160718fbe815d8afe /Spigot-Server-Patches/0013-Add-configurable-despawn-distances-for-living-entiti.patch | |
parent | c094c7880d6319fd17baf56d6b1b63d29a91c5aa (diff) | |
download | Paper-c02c01b2c531384dfe8f2d1d721113bada4892cb.tar.gz Paper-c02c01b2c531384dfe8f2d1d721113bada4892cb.zip |
Add rate limiting to PacketPlayInUseItem as well
Also removes our toggle for Spigot's option, I doubt anyone uses it.
Diffstat (limited to 'Spigot-Server-Patches/0013-Add-configurable-despawn-distances-for-living-entiti.patch')
-rw-r--r-- | Spigot-Server-Patches/0013-Add-configurable-despawn-distances-for-living-entiti.patch | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/Spigot-Server-Patches/0013-Add-configurable-despawn-distances-for-living-entiti.patch b/Spigot-Server-Patches/0013-Add-configurable-despawn-distances-for-living-entiti.patch new file mode 100644 index 0000000000..c5567efd9f --- /dev/null +++ b/Spigot-Server-Patches/0013-Add-configurable-despawn-distances-for-living-entiti.patch @@ -0,0 +1,55 @@ +From 0765aaedfd591133840b85dd8399cedb173a3b46 Mon Sep 17 00:00:00 2001 +From: Suddenly <[email protected]> +Date: Tue, 1 Mar 2016 13:51:54 -0600 +Subject: [PATCH] Add configurable despawn distances for living entities + + +diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index b1d712f..402dbe7 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -114,4 +114,20 @@ public class PaperWorldConfig { + log("Player exhaustion penalty for breaking blocks is " + blockBreakExhaustion); + log("Player exhaustion penalty for swimming is " + playerSwimmingExhaustion); + } ++ ++ public int softDespawnDistance; ++ public int hardDespawnDistance; ++ private void despawnDistances() { ++ softDespawnDistance = getInt("despawn-ranges.soft", 32); // 32^2 = 1024, Minecraft Default ++ hardDespawnDistance = getInt("despawn-ranges.hard", 128); // 128^2 = 16384, Minecraft Default ++ ++ if (softDespawnDistance > hardDespawnDistance) { ++ softDespawnDistance = hardDespawnDistance; ++ } ++ ++ log("Living Entity Despawn Ranges: Soft: " + softDespawnDistance + " Hard: " + hardDespawnDistance); ++ ++ softDespawnDistance = softDespawnDistance*softDespawnDistance; ++ hardDespawnDistance = hardDespawnDistance*hardDespawnDistance; ++ } + } +diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java +index bbf7f02..85d4b81 100644 +--- a/src/main/java/net/minecraft/server/EntityInsentient.java ++++ b/src/main/java/net/minecraft/server/EntityInsentient.java +@@ -633,13 +633,13 @@ public abstract class EntityInsentient extends EntityLiving { + double d2 = entityhuman.locZ - this.locZ; + double d3 = d0 * d0 + d1 * d1 + d2 * d2; + +- if (d3 > 16384.0D) { // CraftBukkit - remove isTypeNotPersistent() check ++ if (d3 > world.paperConfig.hardDespawnDistance) { // CraftBukkit - remove isTypeNotPersistent() check // Paper - custom despawn distances + this.die(); + } + +- if (this.ticksFarFromPlayer > 600 && this.random.nextInt(800) == 0 && d3 > 1024.0D) { // CraftBukkit - remove isTypeNotPersistent() check ++ if (this.ticksFarFromPlayer > 600 && this.random.nextInt(800) == 0 && d3 > world.paperConfig.softDespawnDistance) { // CraftBukkit - remove isTypeNotPersistent() check // Paper - custom despawn distances + this.die(); +- } else if (d3 < 1024.0D) { ++ } else if (d3 < world.paperConfig.softDespawnDistance) { // Paper - custom despawn distances + this.ticksFarFromPlayer = 0; + } + } +-- +2.10.0.windows.1 + |