mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-21 18:37:42 +01:00
Add phantom spawning options
This commit is contained in:
committed by
granny
parent
c7e0b215dc
commit
295d2c91db
@@ -0,0 +1,32 @@
|
||||
--- a/net/minecraft/world/level/levelgen/PhantomSpawner.java
|
||||
+++ b/net/minecraft/world/level/levelgen/PhantomSpawner.java
|
||||
@@ -43,7 +_,7 @@
|
||||
int spawnAttemptMaxSeconds = level.paperConfig().entities.behavior.phantomsSpawnAttemptMaxSeconds;
|
||||
this.nextTick += (spawnAttemptMinSeconds + randomSource.nextInt(spawnAttemptMaxSeconds - spawnAttemptMinSeconds + 1)) * 20;
|
||||
// Paper end - Ability to control player's insomnia and phantoms
|
||||
- if (level.getSkyDarken() < 5 && level.dimensionType().hasSkyLight()) {
|
||||
+ if (level.getSkyDarken() < level.purpurConfig.phantomSpawnMinSkyDarkness && level.dimensionType().hasSkyLight()) { // Purpur - Add phantom spawning options
|
||||
return 0;
|
||||
} else {
|
||||
int i = 0;
|
||||
@@ -51,9 +_,9 @@
|
||||
for (ServerPlayer serverPlayer : level.players()) {
|
||||
if (!serverPlayer.isSpectator() && (!level.paperConfig().entities.behavior.phantomsDoNotSpawnOnCreativePlayers || !serverPlayer.isCreative())) { // Paper - Add phantom creative and insomniac controls
|
||||
BlockPos blockPos = serverPlayer.blockPosition();
|
||||
- if (!level.dimensionType().hasSkyLight() || blockPos.getY() >= level.getSeaLevel() && level.canSeeSky(blockPos)) {
|
||||
+ if (!level.dimensionType().hasSkyLight() || (!level.purpurConfig.phantomSpawnOnlyAboveSeaLevel || blockPos.getY() >= level.getSeaLevel()) && (!level.purpurConfig.phantomSpawnOnlyWithVisibleSky || level.canSeeSky(blockPos))) { // Purpur - Add phantom spawning options
|
||||
DifficultyInstance currentDifficultyAt = level.getCurrentDifficultyAt(blockPos);
|
||||
- if (currentDifficultyAt.isHarderThan(randomSource.nextFloat() * 3.0F)) {
|
||||
+ if (currentDifficultyAt.isHarderThan(randomSource.nextFloat() * (float) level.purpurConfig.phantomSpawnLocalDifficultyChance)) { // Purpur - Add phantom spawning options
|
||||
ServerStatsCounter stats = serverPlayer.getStats();
|
||||
int i1 = Mth.clamp(stats.getValue(Stats.CUSTOM.get(Stats.TIME_SINCE_REST)), 1, Integer.MAX_VALUE);
|
||||
int i2 = 24000;
|
||||
@@ -65,7 +_,7 @@
|
||||
FluidState fluidState = level.getFluidState(blockPos1);
|
||||
if (NaturalSpawner.isValidEmptySpawnBlock(level, blockPos1, blockState, fluidState, EntityType.PHANTOM)) {
|
||||
SpawnGroupData spawnGroupData = null;
|
||||
- int i3 = 1 + randomSource.nextInt(currentDifficultyAt.getDifficulty().getId() + 1);
|
||||
+ int i3 = level.purpurConfig.phantomSpawnMinPerAttempt + level.random.nextInt((level.purpurConfig.phantomSpawnMaxPerAttempt < 0 ? currentDifficultyAt.getDifficulty().getId() : level.purpurConfig.phantomSpawnMaxPerAttempt - level.purpurConfig.phantomSpawnMinPerAttempt) + 1); // Purpur - Add phantom spawning options
|
||||
|
||||
for (int i4 = 0; i4 < i3; i4++) {
|
||||
// Paper start - PhantomPreSpawnEvent
|
||||
Reference in New Issue
Block a user