From 8b6e67635a177646d3ba06adbb46cc33fc066f99 Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Tue, 5 Oct 2021 11:31:21 +1100 Subject: [PATCH] #662: Support for configuring Water Underground Creatures spawn settings By: Doc --- .../src/main/java/org/bukkit/Bukkit.java | 30 +++++++++ .../src/main/java/org/bukkit/Server.java | 27 ++++++++ paper-api/src/main/java/org/bukkit/World.java | 64 +++++++++++++++++++ 3 files changed, 121 insertions(+) diff --git a/paper-api/src/main/java/org/bukkit/Bukkit.java b/paper-api/src/main/java/org/bukkit/Bukkit.java index 9708d79c1c..6baaecacef 100644 --- a/paper-api/src/main/java/org/bukkit/Bukkit.java +++ b/paper-api/src/main/java/org/bukkit/Bukkit.java @@ -451,6 +451,27 @@ public final class Bukkit { public static int getTicksPerWaterAmbientSpawns() { return server.getTicksPerAmbientSpawns(); } + /** + * Gets the default ticks per water underground creature spawns value. + *

+ * Example Usage: + *

+ *

+ * Note: If set to 0, water underground creature spawning will be disabled. + *

+ * Minecraft default: 1. + * + * @return the default ticks per water underground creature spawn value + */ + public static int getTicksPerWaterUndergroundCreatureSpawns() { + return server.getTicksPerWaterUndergroundCreatureSpawns(); + } /** * Gets a player object by the given username. @@ -1234,6 +1255,15 @@ public final class Bukkit { return server.getAmbientSpawnLimit(); } + /** + * Get user-specified limit for number of water creature underground that can spawn + * in a chunk. + * @return the water underground creature limit + */ + public static int getWaterUndergroundCreatureSpawnLimit() { + return server.getWaterUndergroundCreatureSpawnLimit(); + } + /** * Gets user-specified limit for number of ambient mobs that can spawn in * a chunk. diff --git a/paper-api/src/main/java/org/bukkit/Server.java b/paper-api/src/main/java/org/bukkit/Server.java index 3eeaa5719a..1b53f54854 100644 --- a/paper-api/src/main/java/org/bukkit/Server.java +++ b/paper-api/src/main/java/org/bukkit/Server.java @@ -361,6 +361,26 @@ public interface Server extends PluginMessageRecipient { */ public int getTicksPerWaterAmbientSpawns(); + /** + * Gets the default ticks per water underground creature spawns value. + *

+ * Example Usage: + *

+ *

+ * Note: If set to 0, water underground creature spawning will be disabled. + *

+ * Minecraft default: 1. + * + * @return the default ticks per water underground creature spawn value + */ + public int getTicksPerWaterUndergroundCreatureSpawns(); + /** * Gets the default ticks per ambient mob spawns value. *

@@ -1035,6 +1055,13 @@ public interface Server extends PluginMessageRecipient { */ int getWaterAmbientSpawnLimit(); + /** + * Get user-specified limit for number of water creature underground that can spawn + * in a chunk. + * @return the water underground creature limit + */ + int getWaterUndergroundCreatureSpawnLimit(); + /** * Gets user-specified limit for number of ambient mobs that can spawn in * a chunk. diff --git a/paper-api/src/main/java/org/bukkit/World.java b/paper-api/src/main/java/org/bukkit/World.java index 64062724d7..20e8e21272 100644 --- a/paper-api/src/main/java/org/bukkit/World.java +++ b/paper-api/src/main/java/org/bukkit/World.java @@ -1805,6 +1805,51 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient */ public void setTicksPerWaterAmbientSpawns(int ticksPerAmbientSpawns); + /** + * Gets the default ticks per water underground creature spawns value. + *

+ * Example Usage: + *

+ *

+ * Note: If set to 0, water underground creature spawning will be disabled. + *

+ * Minecraft default: 1. + * + * @return the default ticks per water underground creature spawn value + */ + public long getTicksPerWaterUndergroundCreatureSpawns(); + + /** + * Sets the world's ticks per water underground creature spawns value + *

+ * This value determines how many ticks there are between attempts to + * spawn water underground creature. + *

+ * Example Usage: + *

+ *

+ * Note: + * If set to 0, water underground creature spawning will be disabled for this world. + *

+ * Minecraft default: 1. + * + * @param ticksPerWaterUndergroundCreatureSpawns the ticks per water underground creature spawns value you + * want to set the world to + */ + public void setTicksPerWaterUndergroundCreatureSpawns(int ticksPerWaterUndergroundCreatureSpawns); + /** * Gets the world's ticks per ambient mob spawns value *

@@ -1911,6 +1956,25 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient */ void setWaterAnimalSpawnLimit(int limit); + /** + * Gets the limit for number of water underground creature that can spawn in a chunk in + * this world + * + * @return The water underground creature spawn limit + */ + int getWaterUndergroundCreatureSpawnLimit(); + + /** + * Sets the limit for number of water underground creature that can spawn in a chunk in + * this world + *

+ * Note: If set to a negative number the world will use the + * server-wide spawn limit instead. + * + * @param limit the new mob limit + */ + void setWaterUndergroundCreatureSpawnLimit(int limit); + /** * Gets user-specified limit for number of water ambient mobs that can spawn * in a chunk.