mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-01 04:32:11 -07:00
Make water animal spawn height configurable (#7135)
This commit is contained in:
@@ -0,0 +1,50 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Brokkonaut <hannos17@gmx.de>
|
||||||
|
Date: Sat, 18 Dec 2021 08:26:55 +0100
|
||||||
|
Subject: [PATCH] Make water animal spawn height configurable
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||||
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
||||||
|
@@ -0,0 +0,0 @@ public class PaperWorldConfig {
|
||||||
|
mobSpawnerTickRate = getInt("mob-spawner-tick-rate", 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ public Integer waterAnimalMaxSpawnHeight;
|
||||||
|
+ private void waterAnimalMaxSpawnHeight() {
|
||||||
|
+ String v = getString("wateranimal-spawn-height.maximum", "default");
|
||||||
|
+ try {
|
||||||
|
+ waterAnimalMaxSpawnHeight = Integer.parseInt(v);
|
||||||
|
+ } catch (NumberFormatException ignored) {
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ public Integer waterAnimalMinSpawnHeight;
|
||||||
|
+ private void waterAnimalMinSpawnHeight() {
|
||||||
|
+ String v = getString("wateranimal-spawn-height.minimum", "default");
|
||||||
|
+ try {
|
||||||
|
+ waterAnimalMinSpawnHeight = Integer.parseInt(v);
|
||||||
|
+ } catch (NumberFormatException ignored) {
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
public int containerUpdateTickRate;
|
||||||
|
private void containerUpdateTickRate() {
|
||||||
|
containerUpdateTickRate = getInt("container-update-tick-rate", 1);
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java b/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java
|
||||||
|
@@ -0,0 +0,0 @@ public abstract class WaterAnimal extends PathfinderMob {
|
||||||
|
public static boolean checkSurfaceWaterAnimalSpawnRules(EntityType<? extends WaterAnimal> type, LevelAccessor world, MobSpawnType reason, BlockPos pos, Random random) {
|
||||||
|
int i = world.getSeaLevel();
|
||||||
|
int j = i - 13;
|
||||||
|
+ // Paper start
|
||||||
|
+ i = world.getMinecraftWorld().paperConfig.waterAnimalMaxSpawnHeight != null ? world.getMinecraftWorld().paperConfig.waterAnimalMaxSpawnHeight : i;
|
||||||
|
+ j = world.getMinecraftWorld().paperConfig.waterAnimalMinSpawnHeight != null ? world.getMinecraftWorld().paperConfig.waterAnimalMinSpawnHeight : j;
|
||||||
|
+ // Paper end
|
||||||
|
return world.getFluidState(pos.below()).is(FluidTags.WATER) && world.getBlockState(pos.above()).is(Blocks.WATER) && pos.getY() >= j && pos.getY() <= i;
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user