Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Monster natural spawning problem due to light #11359

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: DavidTs93 <[email protected]>
Date: Thu, 5 Sep 2024 12:26:18 +0300
Subject: [PATCH] Fix Monster natural spawning problem due to light


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 e7bfce0534c7ef3a1480a1082ae8514caf78778b..15c65d11be5430e45e8da7e3e4c0da759a949979 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Monster.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Monster.java
@@ -85,6 +85,14 @@ public abstract class Monster extends PathfinderMob implements Enemy {
public float getWalkTargetValue(BlockPos pos, LevelReader world) {
return -world.getPathfindingCostFromLightLevels(pos);
}
+
+ // Paper start - Natural spawning conditions already checked
+ @Override
+ public boolean checkSpawnRules(LevelAccessor world, MobSpawnType spawnReason) {
+ if (spawnReason == MobSpawnType.NATURAL || spawnReason == MobSpawnType.CHUNK_GENERATION) return true;
+ return super.checkSpawnRules(world, spawnReason);
+ }
+ // Paper end - Natural spawning conditions already checked

public static boolean isDarkEnoughToSpawn(ServerLevelAccessor world, BlockPos pos, RandomSource random) {
if (world.getBrightness(LightLayer.SKY, pos) > random.nextInt(32)) {
Loading