Paper/Spigot-Server-Patches/0222-Make-max-squid-spawn-height-configurable.patch

42 lines
1.8 KiB
Diff
Raw Normal View History

From aee359f56881e681adaeaf7b2efde9bb243d4d58 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Thu, 11 Jan 2018 16:47:28 -0600
Subject: [PATCH] Make max squid spawn height configurable
I don't know why upstream made only the minimum height configurable but
whatever
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 99d6ccc598..07a8ef697f 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -413,4 +413,9 @@ public class PaperWorldConfig {
log("Max Chunk Gens Per Tick: " + maxChunkGensPerTick);
}
}
+
+ public double squidMaxSpawnHeight;
+ private void squidMaxSpawnHeight() {
+ squidMaxSpawnHeight = getDouble("squid-spawn-height.maximum", 0.0D);
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntitySquid.java b/src/main/java/net/minecraft/server/EntitySquid.java
index 1a347bae37..b9c76325db 100644
--- a/src/main/java/net/minecraft/server/EntitySquid.java
+++ b/src/main/java/net/minecraft/server/EntitySquid.java
@@ -167,7 +167,10 @@ public class EntitySquid extends EntityWaterAnimal {
}
public boolean a(GeneratorAccess generatoraccess, boolean flag) {
- return this.locY > this.world.spigotConfig.squidSpawnRangeMin && this.locY < (double) generatoraccess.getSeaLevel(); // Spigot
+ // Paper - Make max spawn height configurable
+ final double maxHeight = world.paperConfig.squidMaxSpawnHeight > 0 ? world.paperConfig.squidMaxSpawnHeight : world.getSeaLevel();
+ return this.locY > this.world.spigotConfig.squidSpawnRangeMin && this.locY < maxHeight; // Spigot
+ // Paper end
}
public void c(float f, float f1, float f2) {
--
2.21.0