Updated Upstream (Paper)

Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@cdad49b7 Do not mark plugin tickets as forced; keep correct ticket types
PaperMC/Paper@a1c4fc96 Add generic ticket identifier
PaperMC/Paper@745881bb Update Moonrise common for 1.21.5
PaperMC/Paper@e9d00eb6 Apply Moonrise patch
PaperMC/Paper@ef0f0d10 Copy Moonrise 1.21.5 update over
This commit is contained in:
granny
2025-04-01 22:26:42 -07:00
parent aa0bf38f14
commit b81ab42440
15 changed files with 85 additions and 85 deletions

View File

@@ -26,7 +26,7 @@
public static <S extends MinecraftServer> S spin(Function<Thread, S> threadFunction) {
AtomicReference<S> atomicReference = new AtomicReference<>();
@@ -917,6 +_,15 @@
@@ -993,6 +_,15 @@
LOGGER.info("Stopping server");
Commands.COMMAND_SENDING_POOL.shutdownNow(); // Paper - Perf: Async command map building; Shutdown and don't bother finishing
@@ -42,7 +42,7 @@
// CraftBukkit start
if (this.server != null) {
this.server.spark.disable(); // Paper - spark
@@ -1011,6 +_,8 @@
@@ -1091,6 +_,8 @@
this.safeShutdown(waitForServer, false);
}
public void safeShutdown(boolean waitForServer, boolean isRestarting) {
@@ -51,7 +51,7 @@
this.isRestarting = isRestarting;
this.hasLoggedStop = true; // Paper - Debugging
if (isDebugging()) io.papermc.paper.util.TraceUtil.dumpTraceForThread("Server stopped"); // Paper - Debugging
@@ -1030,6 +_,7 @@
@@ -1110,6 +_,7 @@
private static final long MAX_CATCHUP_BUFFER = TICK_TIME * TPS * 60L;
private long lastTick = 0;
private long catchupTime = 0;
@@ -59,7 +59,7 @@
public final RollingAverage tps1 = new RollingAverage(60);
public final RollingAverage tps5 = new RollingAverage(60 * 5);
public final RollingAverage tps15 = new RollingAverage(60 * 15);
@@ -1115,6 +_,16 @@
@@ -1195,6 +_,16 @@
}
// Paper end - Add onboarding message for initial server start
@@ -76,7 +76,7 @@
while (this.running) {
long l;
if (!this.isPaused() && this.tickRateManager.isSprinting() && this.tickRateManager.checkShouldSprintThisTick()) {
@@ -1139,14 +_,19 @@
@@ -1219,14 +_,19 @@
if (++MinecraftServer.currentTick % MinecraftServer.SAMPLE_INTERVAL == 0) {
final long diff = currentTime - tickSection;
final java.math.BigDecimal currentTps = TPS_BASE.divide(new java.math.BigDecimal(diff), 30, java.math.RoundingMode.HALF_UP);
@@ -99,7 +99,7 @@
tickSection = currentTime;
}
// Paper end - further improve server tick loop
@@ -1171,6 +_,12 @@
@@ -1258,6 +_,12 @@
profilerFiller.popPush("nextTickWait");
this.mayHaveDelayedTasks = true;
this.delayedTasksMaxNextTickTimeNanos = Math.max(Util.getNanos() + l, this.nextTickTimeNanos);
@@ -112,7 +112,7 @@
this.startMeasuringTaskExecutionTime();
this.waitUntilNextTick();
this.finishMeasuringTaskExecutionTime();
@@ -1580,7 +_,7 @@
@@ -1668,7 +_,7 @@
long worldTime = level.getGameTime();
final ClientboundSetTimePacket worldPacket = new ClientboundSetTimePacket(worldTime, dayTime, doDaylight);
for (Player entityhuman : level.players()) {
@@ -121,7 +121,7 @@
continue;
}
ServerPlayer entityplayer = (ServerPlayer) entityhuman;
@@ -1744,7 +_,7 @@
@@ -1832,7 +_,7 @@
@DontObfuscate
public String getServerModName() {

View File

@@ -9,7 +9,7 @@
private final RandomSequences randomSequences;
// CraftBukkit start
@@ -350,7 +_,24 @@
@@ -586,7 +_,24 @@
// CraftBukkit end
this.tickTime = tickTime;
this.server = server;
@@ -35,15 +35,15 @@
this.serverLevelData = serverLevelData;
ChunkGenerator chunkGenerator = levelStem.generator();
// CraftBukkit start
@@ -431,6 +_,7 @@
this.gameEventDispatcher = new GameEventDispatcher(this);
this.randomSequences = Objects.requireNonNullElseGet(randomSequences, () -> this.getDataStorage().computeIfAbsent(RandomSequences.TYPE));
@@ -670,6 +_,7 @@
this.chunkDataController = new ca.spottedleaf.moonrise.patches.chunk_system.io.datacontroller.ChunkDataController((ServerLevel)(Object)this, this.chunkTaskScheduler);
// Paper end - rewrite chunk system
this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit
+ this.preciseTime = this.serverLevelData.getDayTime(); // Purpur - Configurable daylight cycle
}
// Paper start
@@ -477,7 +_,7 @@
@@ -716,7 +_,7 @@
}
int _int = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE);
@@ -52,7 +52,7 @@
// Paper start - create time skip event - move up calculations
final long newDayTime = this.levelData.getDayTime() + 24000L;
org.bukkit.event.world.TimeSkipEvent event = new org.bukkit.event.world.TimeSkipEvent(
@@ -594,6 +_,13 @@
@@ -835,6 +_,13 @@
this.serverLevelData.getScheduledEvents().tick(this.server, l);
Profiler.get().pop();
if (this.serverLevelData.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)) {
@@ -66,7 +66,7 @@
this.setDayTime(this.levelData.getDayTime() + 1L);
}
}
@@ -601,7 +_,21 @@
@@ -842,7 +_,21 @@
public void setDayTime(long time) {
this.serverLevelData.setDayTime(time);
@@ -89,7 +89,7 @@
public void tickCustomSpawners(boolean spawnEnemies, boolean spawnFriendlies) {
for (CustomSpawner customSpawner : this.customSpawners) {
@@ -678,9 +_,17 @@
@@ -946,9 +_,17 @@
&& this.random.nextDouble() < currentDifficultyAt.getEffectiveDifficulty() * this.paperConfig().entities.spawning.skeletonHorseThunderSpawnChance.or(0.01) // Paper - Configurable spawn chances for skeleton horses
&& !this.getBlockState(blockPos.below()).is(Blocks.LIGHTNING_ROD);
if (flag) {
@@ -109,7 +109,7 @@
skeletonHorse.setAge(0);
skeletonHorse.setPos(blockPos.getX(), blockPos.getY(), blockPos.getZ());
this.addFreshEntity(skeletonHorse, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING); // CraftBukkit
@@ -738,7 +_,7 @@
@@ -1006,7 +_,7 @@
pointOfInterestType -> pointOfInterestType.is(PoiTypes.LIGHTNING_ROD),
blockPos -> blockPos.getY() == this.getHeight(Heightmap.Types.WORLD_SURFACE, blockPos.getX(), blockPos.getZ()) - 1,
pos,
@@ -118,7 +118,7 @@
PoiManager.Occupancy.ANY
);
return optional.map(blockPos -> blockPos.above(1));
@@ -787,8 +_,26 @@
@@ -1055,8 +_,26 @@
int _int = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE);
Component component;
if (this.sleepStatus.areEnoughSleeping(_int)) {
@@ -145,7 +145,7 @@
component = Component.translatable("sleep.players_sleeping", this.sleepStatus.amountSleeping(), this.sleepStatus.sleepersNeeded(_int));
}
@@ -921,6 +_,7 @@
@@ -1189,6 +_,7 @@
@VisibleForTesting
public void resetWeatherCycle() {
// CraftBukkit start
@@ -153,7 +153,7 @@
this.serverLevelData.setRaining(false, org.bukkit.event.weather.WeatherChangeEvent.Cause.SLEEP); // Paper - Add cause to Weather/ThunderChangeEvents
// If we stop due to everyone sleeping we should reset the weather duration to some other random value.
// Not that everyone ever manages to get the whole server to sleep at the same time....
@@ -928,6 +_,7 @@
@@ -1196,6 +_,7 @@
this.serverLevelData.setRainTime(0);
}
// CraftBukkit end
@@ -161,7 +161,7 @@
this.serverLevelData.setThundering(false, org.bukkit.event.weather.ThunderChangeEvent.Cause.SLEEP); // Paper - Add cause to Weather/ThunderChangeEvents
// CraftBukkit start
// If we stop due to everyone sleeping we should reset the weather duration to some other random value.
@@ -2331,7 +_,7 @@
@@ -2644,7 +_,7 @@
// Spigot start
if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message
// Paper start - Fix merchant inventory not closing on entity removal

View File

@@ -9,9 +9,9 @@
+ private boolean compassBar = false; // Purpur - Add compass command
+ private boolean ramBar = false; // Purpur - Implement rambar commands
public ServerPlayer(MinecraftServer server, ServerLevel level, GameProfile gameProfile, ClientInformation clientInformation) {
super(level, level.getSharedSpawnPos(), level.getSharedSpawnAngle(), gameProfile);
@@ -525,6 +_,10 @@
// Paper start - rewrite chunk system
private ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader.PlayerChunkLoaderData chunkLoader;
@@ -555,6 +_,10 @@
this.respawnConfig = compound.read("respawn", ServerPlayer.RespawnConfig.CODEC).orElse(null);
this.spawnExtraParticlesOnFall = compound.getBooleanOr("spawn_extra_particles_on_fall", false);
this.raidOmenPosition = compound.read("raid_omen_position", BlockPos.CODEC).orElse(null);
@@ -22,7 +22,7 @@
}
@Override
@@ -542,6 +_,9 @@
@@ -572,6 +_,9 @@
compound.storeNullable("raid_omen_position", BlockPos.CODEC, this.raidOmenPosition);
this.saveEnderPearls(compound);
this.getBukkitEntity().setExtraData(compound); // CraftBukkit
@@ -32,7 +32,7 @@
}
private void saveParentVehicle(CompoundTag tag) {
@@ -1024,6 +_,7 @@
@@ -1054,6 +_,7 @@
)
);
Team team = this.getTeam();
@@ -40,7 +40,7 @@
if (team == null || team.getDeathMessageVisibility() == Team.Visibility.ALWAYS) {
this.server.getPlayerList().broadcastSystemMessage(deathMessage, false);
} else if (team.getDeathMessageVisibility() == Team.Visibility.HIDE_FOR_OTHER_TEAMS) {
@@ -1130,6 +_,13 @@
@@ -1160,6 +_,13 @@
if (this.isInvulnerableTo(level, damageSource)) {
return false;
} else {
@@ -54,7 +54,7 @@
Entity entity = damageSource.getEntity();
if (!( // Paper - split the if statement. If below statement is false, hurtServer would not have been evaluated. Return false.
!(entity instanceof Player player && !this.canHarmPlayer(player))
@@ -1360,6 +_,7 @@
@@ -1390,6 +_,7 @@
serverLevel.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
this.unsetRemoved();
// CraftBukkit end
@@ -62,7 +62,7 @@
this.setServerLevel(level);
this.connection.internalTeleport(PositionMoveRotation.of(teleportTransition), teleportTransition.relatives()); // CraftBukkit - use internal teleport without event
this.connection.resetPosition();
@@ -1477,7 +_,7 @@
@@ -1507,7 +_,7 @@
new AABB(vec3.x() - 8.0, vec3.y() - 5.0, vec3.z() - 8.0, vec3.x() + 8.0, vec3.y() + 5.0, vec3.z() + 8.0),
monster -> monster.isPreventingPlayerRest(this.serverLevel(), this)
);
@@ -71,7 +71,7 @@
return Either.left(Player.BedSleepingProblem.NOT_SAFE);
}
}
@@ -1514,7 +_,19 @@
@@ -1544,7 +_,19 @@
CriteriaTriggers.SLEPT_IN_BED.trigger(this);
});
if (!this.serverLevel().canSleepThroughNights()) {
@@ -92,7 +92,7 @@
}
((ServerLevel)this.level()).updateSleepingPlayerList();
@@ -1606,6 +_,7 @@
@@ -1636,6 +_,7 @@
@Override
public void openTextEdit(SignBlockEntity signEntity, boolean isFrontText) {
@@ -100,7 +100,7 @@
this.connection.send(new ClientboundBlockUpdatePacket(this.level(), signEntity.getBlockPos()));
this.connection.send(new ClientboundOpenSignEditorPacket(signEntity.getBlockPos(), isFrontText));
}
@@ -1908,6 +_,26 @@
@@ -1938,6 +_,26 @@
this.lastSentExp = -1; // CraftBukkit - Added to reset
}
@@ -127,7 +127,7 @@
@Override
public void displayClientMessage(Component chatComponent, boolean actionBar) {
this.sendSystemMessage(chatComponent, actionBar);
@@ -2125,6 +_,20 @@
@@ -2155,6 +_,20 @@
);
}
@@ -148,7 +148,7 @@
public void sendSystemMessage(Component mesage) {
this.sendSystemMessage(mesage, false);
}
@@ -2263,7 +_,67 @@
@@ -2293,7 +_,67 @@
public void resetLastActionTime() {
this.lastActionTime = Util.getMillis();
@@ -217,7 +217,7 @@
public ServerStatsCounter getStats() {
return this.stats;
@@ -2891,4 +_,56 @@
@@ -2921,4 +_,56 @@
return (org.bukkit.craftbukkit.entity.CraftPlayer) super.getBukkitEntity();
}
// CraftBukkit end

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/level/WorldGenRegion.java
+++ b/net/minecraft/server/level/WorldGenRegion.java
@@ -284,6 +_,7 @@
@@ -314,6 +_,7 @@
return true;
} else {
// Paper start - Buffer OOB setBlock calls

View File

@@ -3,12 +3,12 @@
@@ -141,6 +_,7 @@
import org.jetbrains.annotations.Contract;
public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess, ScoreHolder, DataComponentGetter {
public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess, ScoreHolder, DataComponentGetter, ca.spottedleaf.moonrise.patches.chunk_system.entity.ChunkSystemEntity, ca.spottedleaf.moonrise.patches.entity_tracker.EntityTrackerEntity { // Paper - rewrite chunk system // Paper - optimise entity tracker
+ public static javax.script.ScriptEngine scriptEngine = new javax.script.ScriptEngineManager().getEngineByName("rhino"); // Purpur - Configurable entity base attributes
// CraftBukkit start
private static final org.slf4j.Logger LOGGER = com.mojang.logging.LogUtils.getLogger();
private static final int CURRENT_LEVEL = 2;
@@ -304,8 +_,9 @@
@@ -260,8 +_,9 @@
public double xOld;
public double yOld;
public double zOld;
@@ -19,7 +19,7 @@
public int tickCount;
private int remainingFireTicks = -this.getFireImmuneTicks();
public boolean wasTouchingWater;
@@ -339,8 +_,8 @@
@@ -295,8 +_,8 @@
public PortalProcessor portalProcess;
public int portalCooldown;
private boolean invulnerable;
@@ -30,7 +30,7 @@
private boolean hasGlowingTag;
private final Set<String> tags = new io.papermc.paper.util.SizeLimitedSet<>(new it.unimi.dsi.fastutil.objects.ObjectOpenHashSet<>(), MAX_ENTITY_TAG_COUNT); // Paper - fully limit tag size - replace set impl
private final double[] pistonDeltas = new double[]{0.0, 0.0, 0.0};
@@ -394,6 +_,7 @@
@@ -350,6 +_,7 @@
public long activatedTick = Integer.MIN_VALUE;
public boolean isTemporarilyActive;
public long activatedImmunityTick = Integer.MIN_VALUE;
@@ -38,9 +38,9 @@
public void inactiveTick() {
}
@@ -406,10 +_,21 @@
@@ -512,10 +_,21 @@
}
// Paper end
// Paper end - optimise entity tracker
+ // Purpur start - Add canSaveToDisk to Entity
+ public boolean canSaveToDisk() {
@@ -60,7 +60,7 @@
this.position = Vec3.ZERO;
this.blockPosition = BlockPos.ZERO;
this.chunkPosition = ChunkPos.ZERO;
@@ -779,6 +_,7 @@
@@ -885,6 +_,7 @@
&& this.level.paperConfig().environment.netherCeilingVoidDamageHeight.test(v -> this.getY() >= v)
&& (!(this instanceof Player player) || !player.getAbilities().invulnerable))) {
// Paper end - Configurable nether ceiling damage
@@ -68,7 +68,7 @@
this.onBelowWorld();
}
}
@@ -1682,7 +_,7 @@
@@ -1830,7 +_,7 @@
}
public boolean fireImmune() {
@@ -77,7 +77,7 @@
}
public boolean causeFallDamage(double fallDistance, float damageMultiplier, DamageSource damageSource) {
@@ -1742,7 +_,7 @@
@@ -1890,7 +_,7 @@
return this.isInWater() || flag;
}
@@ -86,7 +86,7 @@
if (this.getVehicle() instanceof AbstractBoat abstractBoat && !abstractBoat.isUnderWater()) {
this.wasTouchingWater = false;
} else if (this.updateFluidHeightAndDoFluidPushing(FluidTags.WATER, 0.014)) {
@@ -2364,6 +_,13 @@
@@ -2512,6 +_,13 @@
compound.putBoolean("Paper.FreezeLock", true);
}
// Paper end
@@ -100,7 +100,7 @@
return compound;
} catch (Throwable var8) {
CrashReport crashReport = CrashReport.forThrowable(var8, "Saving entity NBT");
@@ -2481,6 +_,13 @@
@@ -2629,6 +_,13 @@
freezeLocked = compound.getBooleanOr("Paper.FreezeLock", false);
}
// Paper end
@@ -114,7 +114,7 @@
} catch (Throwable var8) {
CrashReport crashReport = CrashReport.forThrowable(var8, "Loading entity NBT");
CrashReportCategory crashReportCategory = crashReport.addCategory("Entity being loaded");
@@ -2620,6 +_,7 @@
@@ -2857,6 +_,7 @@
if (this.isAlive() && this instanceof Leashable leashable) {
if (leashable.getLeashHolder() == player) {
if (!this.level().isClientSide()) {
@@ -122,7 +122,7 @@
// CraftBukkit start - fire PlayerUnleashEntityEvent
// Paper start - Expand EntityUnleashEvent
org.bukkit.event.player.PlayerUnleashEntityEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerUnleashEntityEvent(this, player, hand, !player.hasInfiniteMaterials());
@@ -2936,15 +_,18 @@
@@ -3173,15 +_,18 @@
return Vec3.directionFromRotation(this.getRotationVector());
}
@@ -142,7 +142,7 @@
}
}
}
@@ -3149,7 +_,7 @@
@@ -3386,7 +_,7 @@
}
public int getMaxAirSupply() {
@@ -151,7 +151,7 @@
}
public int getAirSupply() {
@@ -3677,7 +_,7 @@
@@ -3914,7 +_,7 @@
// CraftBukkit end
public boolean canUsePortal(boolean allowPassengers) {
@@ -160,7 +160,7 @@
}
public boolean canTeleport(Level fromLevel, Level toLevel) {
@@ -4212,6 +_,12 @@
@@ -4451,6 +_,12 @@
return Mth.lerp(partialTick, this.yRotO, this.yRot);
}
@@ -170,10 +170,10 @@
+ }
+ // Purpur end - Stop squids floating on top of water
+
public boolean updateFluidHeightAndDoFluidPushing(TagKey<Fluid> fluidTag, double motionScale) {
// Paper start - optimise collisions
public boolean updateFluidHeightAndDoFluidPushing(final TagKey<Fluid> fluid, final double flowScale) {
if (this.touchingUnloadedChunk()) {
return false;
@@ -4552,7 +_,7 @@
@@ -4859,7 +_,7 @@
}
public float maxUpStep() {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/EntityGetter.java
+++ b/net/minecraft/world/level/EntityGetter.java
@@ -144,7 +_,7 @@
@@ -185,7 +_,7 @@
default boolean hasNearbyAlivePlayer(double x, double y, double z, double distance) {
for (Player player : this.players()) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/Level.java
+++ b/net/minecraft/world/level/Level.java
@@ -158,11 +_,55 @@
@@ -159,11 +_,55 @@
}
// Paper end - add paper world config
@@ -56,8 +56,8 @@
public CraftWorld getWorld() {
return this.world;
}
@@ -206,6 +_,8 @@
) {
@@ -839,6 +_,8 @@
// Paper end - getblock optimisations - cache world height/sections
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) levelData).getLevelName()); // Spigot
this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config
+ this.purpurConfig = new org.purpurmc.purpur.PurpurWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) levelData).getLevelName(), env); // Purpur - Purpur config files
@@ -65,7 +65,7 @@
this.generator = gen;
this.world = new CraftWorld((ServerLevel) this, gen, biomeProvider, env);
@@ -1412,4 +_,14 @@
@@ -2115,4 +_,14 @@
return this.id;
}
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/ServerExplosion.java
+++ b/net/minecraft/world/level/ServerExplosion.java
@@ -73,7 +_,7 @@
@@ -316,7 +_,7 @@
) {
this.level = level;
this.source = source;
@@ -9,7 +9,7 @@
this.center = center;
this.fire = fire;
this.blockInteraction = blockInteraction;
@@ -356,10 +_,27 @@
@@ -638,10 +_,27 @@
public void explode() {
// CraftBukkit start
@@ -35,6 +35,6 @@
+ }
+ }
+ // Purpur end - Add PreExplodeEvents
this.level.gameEvent(this.source, GameEvent.EXPLODE, this.center);
List<BlockPos> list = this.calculateExplodedPositions();
this.hurtEntities();
// Paper start - collision optimisations
this.blockCache = new it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap<>();
this.chunkPosCache = new long[CHUNK_CACHE_WIDTH * CHUNK_CACHE_WIDTH];

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
+++ b/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
@@ -49,7 +_,7 @@
@@ -238,7 +_,7 @@
// Paper start
private static void printOversizedLog(String msg, Path file, int x, int z) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/material/FlowingFluid.java
+++ b/net/minecraft/world/level/material/FlowingFluid.java
@@ -190,7 +_,7 @@
@@ -232,7 +_,7 @@
}
}
@@ -9,7 +9,7 @@
BlockState blockState1 = level.getBlockState(mutableBlockPos.setWithOffset(pos, Direction.DOWN));
FluidState fluidState1 = blockState1.getFluidState();
if (blockState1.isSolid() || this.isSourceBlockOfThisType(fluidState1)) {
@@ -267,6 +_,12 @@
@@ -319,6 +_,12 @@
}
protected abstract boolean canConvertToSource(ServerLevel level);