Paper/patches/server/0735-Make-water-animal-spawn-height-configurable.patch
MiniDigger | Martin 1ebaffacf5 some compile fixes
2023-09-22 19:31:02 +02:00

22 lines
1.3 KiB
Diff

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 ca3b84a6f39257b3f30d3ff8724289f31c8e1ab2..96a40a1901e7e2708bfadb6f3f6c52e5d4789311 100644
--- a/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java
+++ b/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java
@@ -78,6 +78,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
+ i = world.getMinecraftWorld().paperConfig().entities.spawning.wateranimalSpawnHeight.maximum.or(i);
+ j = world.getMinecraftWorld().paperConfig().entities.spawning.wateranimalSpawnHeight.minimum.or(j);
+ // Paper end
return pos.getY() >= j && pos.getY() <= i && world.getFluidState(pos.below()).is(FluidTags.WATER) && world.getBlockState(pos.above()).is(Blocks.WATER);
}
}