2021-12-22 12:47:15 +01:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Nassim Jahnke <jahnke.nassim@gmail.com>
|
|
|
|
Date: Thu, 16 Dec 2021 09:40:39 +0100
|
|
|
|
Subject: [PATCH] Configurable max block light for monster spawning
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2022-05-09 11:03:07 +02:00
|
|
|
index 0bae3add15f81c31e0f42dc4eb9a2c4164dcde44..1161f91ad09fa5b9a769bea1e80a7edb5da76fcf 100644
|
2021-12-22 12:47:15 +01:00
|
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
2022-05-07 19:52:32 +02:00
|
|
|
@@ -1062,4 +1062,9 @@ public class PaperWorldConfig {
|
2021-12-22 12:47:15 +01:00
|
|
|
Integer rate = table.get(columnKey, rowKey);
|
|
|
|
return rate != null && rate > -1 ? rate : def;
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ public int maxBlockLightForMonsterSpawning = -1;
|
|
|
|
+ private void minBlockLightForMobSpawning() {
|
|
|
|
+ this.maxBlockLightForMonsterSpawning = getInt("monster-spawn-max-light-level", maxBlockLightForMonsterSpawning);
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/monster/Monster.java b/src/main/java/net/minecraft/world/entity/monster/Monster.java
|
|
|
|
index 457880c9e894a83d88505cf0b7235df919eea591..1d66588cfe94d190a34dc376b4b5bff9461a3529 100644
|
|
|
|
--- a/src/main/java/net/minecraft/world/entity/monster/Monster.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/monster/Monster.java
|
|
|
|
@@ -90,7 +90,7 @@ public abstract class Monster extends PathfinderMob implements Enemy {
|
|
|
|
public static boolean isDarkEnoughToSpawn(ServerLevelAccessor world, BlockPos pos, Random random) {
|
|
|
|
if (world.getBrightness(LightLayer.SKY, pos) > random.nextInt(32)) {
|
|
|
|
return false;
|
|
|
|
- } else if (world.getBrightness(LightLayer.BLOCK, pos) > 0) {
|
|
|
|
+ } else if (world.getBrightness(LightLayer.BLOCK, pos) > (world.getLevel().paperConfig.maxBlockLightForMonsterSpawning >= 0 ? world.getLevel().paperConfig.maxBlockLightForMonsterSpawning : 0)) { // Paper - configurable max block light level
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
int i = world.getLevel().isThundering() ? world.getMaxLocalRawBrightness(pos, 10) : world.getMaxLocalRawBrightness(pos);
|