Skip to content
This repository has been archived by the owner on Feb 11, 2024. It is now read-only.

Commit

Permalink
use config
Browse files Browse the repository at this point in the history
  • Loading branch information
SiverDX committed Sep 25, 2023
1 parent 90eccf0 commit d1ae044
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public class ServerConfig {
SKY_LIGHT_LEVEL = BUILDER.comment("The maximum sky light level the Cave Dweller can spawn at").defineInRange("sky_light_level", 8, 0, 15);
BLOCK_LIGHT_LEVEL = BUILDER.comment("The maximum block light level the Cave Dweller can spawn at").defineInRange("block_light_level", 15, 0, 15);
MAXIMUM_AMOUNT = BUILDER.comment("The maximum amount of cave dwellers which can exist at the same time").defineInRange("maximum_amount", 5, 0, 100);
SPAWN_DISTANCE = BUILDER.comment("How close (in blocks) the cave dweller is allowed to spawn to its victim").defineInRange("spawn_distance", 16, 0, 64);
SPAWN_DISTANCE = BUILDER.comment("How close to players the cave dweller is allowed to spawn (in blocks)").defineInRange("spawn_distance", 16, 0, 64);
CHECK_PATH_TO_SPAWN = BUILDER.comment("If set to true the cave dweller will try to find a spawn position with a possible path to the player").define("check_path_to_spawn", true);
BUILDER.push("Dimensions");
DIMENSION_WHITELIST = BUILDER.comment("The dimensions where the Cave Dweller can spawn in (Whitelist)").defineList("dimension_whitelist", List.of("minecraft:overworld"), ServerConfig::resourcePredicate);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/de/cadentem/cave_dweller/util/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public static <T extends Mob> Optional<T> trySpawnMob(@NotNull final Entity curr

if (entity instanceof CaveDwellerEntity) {
if (entity.checkSpawnRules(level, spawnType) && entity.checkSpawnObstruction(level)) {
boolean isValidSpawn = entity.level().getNearestPlayer(entity, 16) == null;
boolean isValidSpawn = entity.level().getNearestPlayer(entity, ServerConfig.SPAWN_DISTANCE.get()) == null;

if (isValidSpawn && ServerConfig.CHECK_PATH_TO_SPAWN.get()) {
Path path = entity.getNavigation().createPath(currentVictim, 0);
Expand Down

0 comments on commit d1ae044

Please sign in to comment.