Browse Source

Fix an issue where crosses appear in mushroom biomes (#56)

Co-authored-by: Your Name <you@example.com>
Ian Howell 5 years ago
parent
commit
201bf3c748

+ 6 - 3
fabric/src/main/java/me/shedaniel/lightoverlay/fabric/LightOverlay.java

@@ -117,9 +117,12 @@ public class LightOverlay implements ClientModInitializer {
                                     map.put(blockPos.asLong(), Integer.valueOf(level));
                                 }
                             } else {
-                                CrossType type = getCrossType(blockPos, downPos, world, block, sky, entityContext);
-                                if (type != CrossType.NONE) {
-                                    map.put(blockPos.asLong(), type);
+                                SpawnSettings spawnSettings = world.getBiomeAccess().getBiome(blockPos).getSpawnSettings();
+                                if (spawnSettings.getCreatureSpawnProbability() > 0 && !spawnSettings.getSpawnEntry(EntityCategory.MONSTER).isEmpty()) {
+                                    CrossType type = getCrossType(blockPos, downPos, world, block, sky, entityContext);
+                                    if (type != CrossType.NONE) {
+                                        map.put(blockPos.asLong(), type);
+                                    }
                                 }
                             }
                         }

+ 6 - 3
forge/src/main/java/me/shedaniel/lightoverlay/forge/LightOverlayClient.java

@@ -261,9 +261,12 @@ public class LightOverlayClient {
                                     map.put(blockPos.toLong(), Integer.valueOf(level));
                                 }
                             } else {
-                                CrossType type = getCrossType(blockPos, downPos, world, block, sky, entityContext);
-                                if (type != CrossType.NONE) {
-                                    map.put(blockPos.toLong(), type);
+                                MobSpawnInfo spawnInfo = world.getBiomeManager().getBiome(blockPos).func_242433_b();
+                                if (spawnInfo.func_242557_a() > 0 && !spawnInfo.func_242559_a(EntityClassification.MONSTER).isEmpty()) {
+                                    CrossType type = getCrossType(blockPos, downPos, world, block, sky, entityContext);
+                                    if (type != CrossType.NONE) {
+                                        map.put(blockPos.toLong(), type);
+                                    }
                                 }
                             }
                         }