Skip to content
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
Expand Up @@ -5,7 +5,7 @@
if (spawnEnemies) {
if (level.getGameRules().get(GameRules.SPAWN_PHANTOMS)) {
+ // Paper start - Ability to control player's insomnia and phantoms
+ if (level.paperConfig().entities.behavior.phantomsSpawnAttemptMaxSeconds <= 0) {
+ if (level.paperConfig().entities.behavior.phantomsSpawnAttemptMaxSeconds <= 0 || level.paperConfig().entities.behavior.playerInsomniaStartTicks < 0) {
+ return;
+ }
+ // Paper end - Ability to control player's insomnia and phantoms
Expand All @@ -25,6 +25,15 @@
BlockPos blockPos = serverPlayer.blockPosition();
if (!level.dimensionType().hasSkyLight() || blockPos.getY() >= level.getSeaLevel() && level.canSeeSky(blockPos)) {
DifficultyInstance currentDifficultyAt = level.getCurrentDifficultyAt(blockPos);
@@ -39,7 +_,7 @@
ServerStatsCounter stats = serverPlayer.getStats();
int i = Mth.clamp(stats.getValue(Stats.CUSTOM.get(Stats.TIME_SINCE_REST)), 1, Integer.MAX_VALUE);
int i1 = 24000;
- if (randomSource.nextInt(i) >= 72000) {
+ if (randomSource.nextInt(i) >= level.paperConfig().entities.behavior.playerInsomniaStartTicks) { // Paper - Ability to control player's insomnia and phantoms
BlockPos blockPos1 = blockPos.above(20 + randomSource.nextInt(15))
.east(-10 + randomSource.nextInt(21))
.south(-10 + randomSource.nextInt(21));
@@ -50,13 +_,23 @@
int i2 = 1 + randomSource.nextInt(currentDifficultyAt.getDifficulty().getId() + 1);

Expand Down
Loading