aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0686-Make-water-animal-spawn-height-configurable.patch
blob: e523ed36f4e1ae7f4df93ecac32b307d93a9faf8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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/net/minecraft/world/entity/animal/WaterAnimal.java b/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java
index 27624b080e025d943b9c99627568f7dd66165548..9b897cf53f4bb5d366e6ac88dbed93c59d8fe541 100644
--- a/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java
+++ b/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java
@@ -73,6 +73,10 @@ public abstract class WaterAnimal extends PathfinderMob {
     public static boolean checkSurfaceWaterAnimalSpawnRules(EntityType<? extends WaterAnimal> type, LevelAccessor world, MobSpawnType reason, BlockPos pos, RandomSource random) {
         int i = world.getSeaLevel();
         int j = i - 13;
+        // Paper start - Make water animal spawn height configurable
+        i = world.getMinecraftWorld().paperConfig().entities.spawning.wateranimalSpawnHeight.maximum.or(i);
+        j = world.getMinecraftWorld().paperConfig().entities.spawning.wateranimalSpawnHeight.minimum.or(j);
+        // Paper end - Make water animal spawn height configurable
         return pos.getY() >= j && pos.getY() <= i && world.getFluidState(pos.below()).is(FluidTags.WATER) && world.getBlockState(pos.above()).is(Blocks.WATER);
     }
 }