Updated Upstream (Paper)

Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@55a16d8 Fix Varint21FrameDecoder cached length buf usage
PaperMC/Paper@e6e37ba Add api to resolve components (#7648)
PaperMC/Paper@7168438 [ci skip] Rework workflows to support optional paperclip build (#8583)
PaperMC/Paper@da230d5 More vanilla friendly methods to update trades (#8478)
PaperMC/Paper@8aff07a Add /paper dumplisteners command (#8507)
PaperMC/Paper@b8919a7 pr command action fixes (#8591)
PaperMC/Paper@185fa48 Fix chest relooting mechanics (#8580)
PaperMC/Paper@b4beac0 Fixes potential issues arising from optimizing getPlayerByUUID (#8585)
PaperMC/Paper@f637b1a Fix async entity add due to fungus trees (#7626)
PaperMC/Paper@414ea80 ItemStack damage API (#7801)
PaperMC/Paper@d98c370 Add displayName methods for advancements (#8584)
PaperMC/Paper@44bb599 Add Tick TemporalUnit (#5445)
PaperMC/Paper@9f7eef8 Friction API (#6611)
PaperMC/Paper@4048d3e Allow using degrees for ArmorStand rotations (#7847)
PaperMC/Paper@f59c802 Schoolable Fish API (#7089)
PaperMC/Paper@21b964a Added ability to control player's insomnia and phantoms spawning (#6500)
PaperMC/Paper@f1583fc Add `/paper dumplisteners tofile` and increase detail of command output (#8592)
This commit is contained in:
BillyGalbreath
2022-11-26 18:48:36 -06:00
parent a8b26671d1
commit 47dc2e92f5
90 changed files with 546 additions and 565 deletions

View File

@@ -5,21 +5,19 @@ Subject: [PATCH] Add phantom spawning options
diff --git a/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java b/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java
index 2093d08bccbfbe096ea24cc4f70cbfdfa07d6a56..8f0add62c1fff6e14e83dc9eb87c5c20c6517b91 100644
index ee299451437822544f0c79cc878110c959ec5dc4..9cb157bfcbcd309fbe7f763159592a56d2b43ed9 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java
@@ -41,8 +41,8 @@ public class PhantomSpawner implements CustomSpawner {
if (this.nextTick > 0) {
return 0;
} else {
- this.nextTick += (60 + randomsource.nextInt(60)) * 20;
@@ -51,7 +51,7 @@ public class PhantomSpawner implements CustomSpawner {
int spawnAttemptMaxSeconds = world.paperConfig().entities.behavior.phantomsSpawnAttemptMaxSeconds;
this.nextTick += (spawnAttemptMinSeconds + randomsource.nextInt(spawnAttemptMaxSeconds - spawnAttemptMinSeconds + 1)) * 20;
// Paper end
- if (world.getSkyDarken() < 5 && world.dimensionType().hasSkyLight()) {
+ this.nextTick += world.purpurConfig.phantomSpawnDelayMin + randomsource.nextInt(world.purpurConfig.phantomSpawnDelayMax - world.purpurConfig.phantomSpawnDelayMin + 1); // Purpur
+ if (world.getSkyDarken() < world.purpurConfig.phantomSpawnMinSkyDarkness && world.dimensionType().hasSkyLight()) { // Purpur
return 0;
} else {
int i = 0;
@@ -54,22 +54,22 @@ public class PhantomSpawner implements CustomSpawner {
@@ -63,10 +63,10 @@ public class PhantomSpawner implements CustomSpawner {
if (!entityhuman.isSpectator() && (!world.paperConfig().entities.behavior.phantomsDoNotSpawnOnCreativePlayers || !entityhuman.isCreative())) { // Paper
BlockPos blockposition = entityhuman.blockPosition();
@@ -32,13 +30,7 @@ index 2093d08bccbfbe096ea24cc4f70cbfdfa07d6a56..8f0add62c1fff6e14e83dc9eb87c5c20
ServerStatsCounter serverstatisticmanager = ((ServerPlayer) entityhuman).getStats();
int j = Mth.clamp(serverstatisticmanager.getValue(Stats.CUSTOM.get(Stats.TIME_SINCE_REST)), (int) 1, Integer.MAX_VALUE);
boolean flag2 = true;
- if (randomsource.nextInt(j) >= 72000) {
- BlockPos blockposition1 = blockposition.above(20 + randomsource.nextInt(15)).east(-10 + randomsource.nextInt(21)).south(-10 + randomsource.nextInt(21));
+ if (randomsource.nextInt(j) >= world.purpurConfig.phantomSpawnMinTimeSinceSlept) { // Purpur
+ BlockPos blockposition1 = blockposition.above(world.purpurConfig.phantomSpawnMinOverhead + randomsource.nextInt(world.purpurConfig.phantomSpawnMaxOverhead - world.purpurConfig.phantomSpawnMinOverhead + 1)).east(-world.purpurConfig.phantomSpawnOverheadRadius + randomsource.nextInt(world.purpurConfig.phantomSpawnOverheadRadius * 2 + 1)).south(-world.purpurConfig.phantomSpawnOverheadRadius + randomsource.nextInt(world.purpurConfig.phantomSpawnOverheadRadius * 2 + 1)); // Purpur
BlockState iblockdata = world.getBlockState(blockposition1);
FluidState fluid = world.getFluidState(blockposition1);
@@ -78,7 +78,7 @@ public class PhantomSpawner implements CustomSpawner {
if (NaturalSpawner.isValidEmptySpawnBlock(world, blockposition1, iblockdata, fluid, EntityType.PHANTOM)) {
SpawnGroupData groupdataentity = null;
@@ -48,42 +40,30 @@ index 2093d08bccbfbe096ea24cc4f70cbfdfa07d6a56..8f0add62c1fff6e14e83dc9eb87c5c20
for (int l = 0; l < k; ++l) {
// Paper start
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index 3a216283fd76991539b494afacbaeb011fb8f8ec..b45d0094151d12724705bfa65eef52e5bdcb8426 100644
index 3a216283fd76991539b494afacbaeb011fb8f8ec..55ea8e64bea557ceac97426b24e4cca96a9c5d0a 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -1058,6 +1058,18 @@ public class PurpurWorldConfig {
@@ -1058,6 +1058,12 @@ public class PurpurWorldConfig {
public double phantomAttackedByCrystalRadius = 0.0D;
public float phantomAttackedByCrystalDamage = 1.0F;
public double phantomOrbitCrystalRadius = 0.0D;
+ public int phantomSpawnDelayMin = 1200;
+ public int phantomSpawnDelayMax = 2400;
+ public int phantomSpawnMinSkyDarkness = 5;
+ public boolean phantomSpawnOnlyAboveSeaLevel = true;
+ public boolean phantomSpawnOnlyWithVisibleSky = true;
+ public double phantomSpawnLocalDifficultyChance = 3.0D;
+ public int phantomSpawnMinTimeSinceSlept = 72000;
+ public int phantomSpawnMinOverhead = 20;
+ public int phantomSpawnMaxOverhead = 35;
+ public int phantomSpawnOverheadRadius = 10;
+ public int phantomSpawnMinPerAttempt = 1;
+ public int phantomSpawnMaxPerAttempt = -1;
private void phantomSettings() {
phantomRidable = getBoolean("mobs.phantom.ridable", phantomRidable);
phantomRidableInWater = getBoolean("mobs.phantom.ridable-in-water", phantomRidableInWater);
@@ -1082,6 +1094,18 @@ public class PurpurWorldConfig {
@@ -1082,6 +1088,12 @@ public class PurpurWorldConfig {
phantomAttackedByCrystalRadius = getDouble("mobs.phantom.attacked-by-crystal-range", phantomAttackedByCrystalRadius);
phantomAttackedByCrystalDamage = (float) getDouble("mobs.phantom.attacked-by-crystal-damage", phantomAttackedByCrystalDamage);
phantomOrbitCrystalRadius = getDouble("mobs.phantom.orbit-crystal-radius", phantomOrbitCrystalRadius);
+ phantomSpawnDelayMin = getInt("mobs.phantom.spawn.delay.min", phantomSpawnDelayMin);
+ phantomSpawnDelayMax = getInt("mobs.phantom.spawn.delay.max", phantomSpawnDelayMax);
+ phantomSpawnMinSkyDarkness = getInt("mobs.phantom.spawn.min-sky-darkness", phantomSpawnMinSkyDarkness);
+ phantomSpawnOnlyAboveSeaLevel = getBoolean("mobs.phantom.spawn.only-above-sea-level", phantomSpawnOnlyAboveSeaLevel);
+ phantomSpawnOnlyWithVisibleSky = getBoolean("mobs.phantom.spawn.only-with-visible-sky", phantomSpawnOnlyWithVisibleSky);
+ phantomSpawnLocalDifficultyChance = getDouble("mobs.phantom.spawn.local-difficulty-chance", phantomSpawnLocalDifficultyChance);
+ phantomSpawnMinTimeSinceSlept = getInt("mobs.phantom.spawn.min-time-since-slept", phantomSpawnMinTimeSinceSlept);
+ phantomSpawnMinOverhead = getInt("mobs.phantom.spawn.overhead.min", phantomSpawnMinOverhead);
+ phantomSpawnMaxOverhead = getInt("mobs.phantom.spawn.overhead.max", phantomSpawnMaxOverhead);
+ phantomSpawnOverheadRadius = getInt("mobs.phantom.spawn.overhead.radius", phantomSpawnOverheadRadius);
+ phantomSpawnMinPerAttempt = getInt("mobs.phantom.spawn.per-attempt.min", phantomSpawnMinPerAttempt);
+ phantomSpawnMaxPerAttempt = getInt("mobs.phantom.spawn.per-attempt.max", phantomSpawnMaxPerAttempt);
}