Updated Upstream (Paper)

Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@e4a5a894 Update to Minecraft 26.1.1
PaperMC/Paper@92a4d8db Update "Only write chunk data to disk if it serializes without throwing"
PaperMC/Paper@02d9cbce Update "Entity load/save limit per chunk"
PaperMC/Paper@cb696286 Update "Attempt to recalculate regionfile header if it is corrupt"
PaperMC/Paper@4662bab9 Update "Incremental chunk and player saving"
PaperMC/Paper@4dddc82f Implement new version schema: `<mcver>.build.<paper_build_no>-<paper_status>` / `<mcver>.local-SNAPSHOT`
PaperMC/Paper@fc0a9980 Set channel to ALPHA
PaperMC/Paper@a4fa0357 update gradle wrapper
PaperMC/Paper@a15ceb7a Update fill-gradle to 1.0.11
PaperMC/Paper@52f7e24e Publish to releases repository
PaperMC/Paper@bb7ff8f0 Update "Optimise general POI access"
PaperMC/Paper@ac42a07e Update "Flush regionfiles on save configuration option"
PaperMC/Paper@14357cc5 Avoid using the regionfile directory name to determine if it is chunk data
PaperMC/Paper@a2f4d349 Update "Optimise collision checking in player move packet handling"
PaperMC/Paper@50303a0e Update "Add explicit flush support to Log4j AsyncAppender"
PaperMC/Paper@7bc4f895 Shift unapplied patches
PaperMC/Paper@62ba2c4f Update "Improve keepalive ping system"
PaperMC/Paper@f6d27019 Update "Optimise EntityScheduler ticking"
PaperMC/Paper@4d8d06c7 Fix WorldBorder#setCenter ignoring new values on 26.1.1 (#13741)
PaperMC/Paper@f9da8035 update unpick definitions
PaperMC/Paper@fc71a133 [ci/skip] fixup previous commit
PaperMC/Paper@4c91cd34 Lazy set Entity.projectileSource in AbstractProjectile#getShooter
PaperMC/Paper@3d1da60c Cache the climbing check in activation range (#12764)
PaperMC/Paper@575630f3 feat: Optimize ServerWaypointManager when locator bar is disabled
PaperMC/Paper@742daf02 [ci/skip] fixup previous commit
PaperMC/Paper@d29063da Rebuild patches
PaperMC/Paper@ce581c3c Bump deps to match Vanilla versions (#13744)
PaperMC/Paper@f3e9a934 Fix attack check
PaperMC/Paper@b4743b58 Fix gamerule loading in Management Protocol (#13753)
PaperMC/Paper@c53ac8a1 Add PlayerToggleEntityAgeLockEvent (#13742)
PaperMC/Paper@59081719 fixup previous event
PaperMC/Paper@7b49b586 Update "Optional per player mob spawns"
PaperMC/Paper@1fae14c2 Update "Improve cancelling PreCreatureSpawnEvent with per player mob spawns"
PaperMC/Paper@c40cb75b Update "Optimize Hoppers"
PaperMC/Paper@edad1e4c Update "Anti-Xray"
PaperMC/Paper@106a934d [ci/skip] Drop stale TODO
PaperMC/Paper@77c0866f handle legacy uid in vanilla migration and always write metadata during migration
This commit is contained in:
granny
2026-04-07 17:41:32 -07:00
parent 3e5ff62f29
commit d53e7784d6
38 changed files with 254 additions and 301 deletions

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/core/dispenser/DispenseItemBehavior.java
+++ b/net/minecraft/core/dispenser/DispenseItemBehavior.java
@@ -690,5 +_,22 @@
@@ -691,5 +_,22 @@
DispenserBlock.registerBehavior(Items.TNT_MINECART, new MinecartDispenseItemBehavior(EntityType.TNT_MINECART));
DispenserBlock.registerBehavior(Items.HOPPER_MINECART, new MinecartDispenseItemBehavior(EntityType.HOPPER_MINECART));
DispenserBlock.registerBehavior(Items.COMMAND_BLOCK_MINECART, new MinecartDispenseItemBehavior(EntityType.COMMAND_BLOCK_MINECART));

View File

@@ -25,7 +25,7 @@
getTPS(this.tickTimes1m, interval),
getTPS(this.tickTimes5m, interval),
getTPS(this.tickTimes15m, interval)
@@ -1038,6 +_,15 @@
@@ -1046,6 +_,15 @@
LOGGER.info("Stopping server");
Commands.COMMAND_SENDING_POOL.shutdownNow(); // Paper - Perf: Async command map building; Shutdown and don't bother finishing
@@ -41,7 +41,7 @@
// CraftBukkit start
if (this.server != null) {
this.server.spark.disable(); // Paper - spark
@@ -1132,6 +_,8 @@
@@ -1140,6 +_,8 @@
this.safeShutdown(wait, false);
}
public void safeShutdown(final boolean wait, final boolean isRestarting) {
@@ -50,7 +50,7 @@
this.isRestarting = isRestarting;
this.hasLoggedStop = true; // Paper - Debugging
if (this.isDebugging()) io.papermc.paper.util.TraceUtil.dumpTraceForThread("Server stopped"); // Paper - Debugging
@@ -1313,11 +_,21 @@
@@ -1321,11 +_,21 @@
}
// Paper end - Add onboarding message for initial server start
// Paper start - Improve outdated version checking
@@ -73,7 +73,7 @@
while (this.running) {
final long tickStart = System.nanoTime(); // Paper - improve tick loop
long thisTickNanos; // Paper - improve tick loop - diff on change, expect this to be tick interval
@@ -1331,9 +_,11 @@
@@ -1339,9 +_,11 @@
final long ticksBehind = Math.max(1L, this.tickSchedule.getPeriodsAhead(thisTickNanos, tickStart));
final long catchup = (long)Math.max(
1,
@@ -86,7 +86,7 @@
// adjust ticksBehind so that it is not greater-than catchup
if (ticksBehind - catchup > 0L) {
final long difference = ticksBehind - catchup;
@@ -1943,7 +_,7 @@
@@ -1964,7 +_,7 @@
}
public String getServerModName() {

View File

@@ -161,7 +161,7 @@
weatherData.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.
@@ -1970,7 +_,7 @@
@@ -1979,7 +_,7 @@
Explosion.BlockInteraction blockInteraction = switch (interactionType) {
case NONE -> Explosion.BlockInteraction.KEEP;
case BLOCK -> this.getDestroyType(GameRules.BLOCK_EXPLOSION_DROP_DECAY);
@@ -170,7 +170,7 @@
? this.getDestroyType(GameRules.MOB_EXPLOSION_DROP_DECAY)
: Explosion.BlockInteraction.KEEP;
case TNT -> this.getDestroyType(GameRules.TNT_EXPLOSION_DROP_DECAY);
@@ -2901,7 +_,7 @@
@@ -2910,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

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -448,6 +_,9 @@
@@ -454,6 +_,9 @@
public boolean isRealPlayer; // Paper
public com.destroystokyo.paper.event.entity.@Nullable PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper - PlayerNaturallySpawnCreaturesEvent
public org.bukkit.event.player.PlayerQuitEvent.@Nullable QuitReason quitReason = null; // Paper - Add API for quit reason; there are a lot of changes to do if we change all methods leading to the event
@@ -10,7 +10,7 @@
// Paper start - rewrite chunk system
private ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader.PlayerChunkLoaderData chunkLoader;
@@ -521,6 +_,9 @@
@@ -527,6 +_,9 @@
this.respawnConfig = input.read("respawn", ServerPlayer.RespawnConfig.CODEC).orElse(null);
this.spawnExtraParticlesOnFall = input.getBooleanOr("spawn_extra_particles_on_fall", false);
this.raidOmenPosition = input.read("raid_omen_position", BlockPos.CODEC).orElse(null);
@@ -20,7 +20,7 @@
// Paper start - Expand PlayerGameModeChangeEvent
this.loadGameTypes(input);
}
@@ -562,6 +_,9 @@
@@ -568,6 +_,9 @@
output.store("ShoulderEntityRight", CompoundTag.CODEC, this.getShoulderEntityRight());
}
this.getBukkitEntity().setExtraData(output); // CraftBukkit
@@ -30,7 +30,7 @@
}
private void saveParentVehicle(final ValueOutput playerOutput) {
@@ -1197,6 +_,7 @@
@@ -1203,6 +_,7 @@
// Paper - moved up to sendClientboundPlayerCombatKillPacket()
sendClientboundPlayerCombatKillPacket(event.getShowDeathMessages(), deathScreenMessage); // Paper - Expand PlayerDeathEvent
Team team = this.getTeam();
@@ -38,7 +38,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) {
@@ -1305,6 +_,13 @@
@@ -1311,6 +_,13 @@
if (this.isInvulnerableTo(level, source)) {
return false;
} else {
@@ -52,15 +52,15 @@
Entity entity = source.getEntity();
if (!( // Paper - split the if statement. If below statement is false, hurtServer would not have been evaluated. Return false.
!(entity instanceof Player playerx && !this.canHarmPlayer(playerx))
@@ -1564,6 +_,7 @@
@@ -1570,6 +_,7 @@
profiler.pop();
profiler.push("placing");
+ this.portalPos = org.bukkit.craftbukkit.util.CraftLocation.toBlockPosition(exit); // Purpur - Fix stuck in portals
+ this.portalPos = org.bukkit.craftbukkit.util.CraftLocation.toBlockPos(exit); // Purpur - Fix stuck in portals
this.setServerLevel(newLevel);
this.connection.internalTeleport(PositionMoveRotation.of(transition), transition.relatives()); // CraftBukkit - use internal teleport without event
this.connection.resetPosition();
@@ -1680,7 +_,7 @@
@@ -1686,7 +_,7 @@
),
monster -> monster.isPreventingPlayerRest(this.level(), this)
);
@@ -69,7 +69,7 @@
return Either.left(Player.BedSleepingProblem.NOT_SAFE);
}
}
@@ -1720,8 +_,19 @@
@@ -1726,8 +_,19 @@
CriteriaTriggers.SLEPT_IN_BED.trigger(this);
});
if (!this.level().canSleepThroughNights()) {
@@ -90,7 +90,7 @@
this.level().updateSleepingPlayerList();
return result;
@@ -1815,6 +_,7 @@
@@ -1821,6 +_,7 @@
@Override
public void openTextEdit(final SignBlockEntity sign, final boolean isFrontText) {
@@ -98,7 +98,7 @@
this.connection.send(new ClientboundBlockUpdatePacket(this.level(), sign.getBlockPos()));
this.connection.send(new ClientboundOpenSignEditorPacket(sign.getBlockPos(), isFrontText));
}
@@ -2158,6 +_,26 @@
@@ -2164,6 +_,26 @@
this.lastSentExp = -1; // CraftBukkit - Added to reset
}
@@ -125,7 +125,7 @@
@Override
public void completeUsingItem() {
if (!this.useItem.isEmpty() && this.isUsingItem()) {
@@ -2397,6 +_,20 @@
@@ -2403,6 +_,20 @@
);
}
@@ -146,7 +146,7 @@
@Override
public void sendSystemMessage(final Component message) {
this.sendSystemMessage(message, false);
@@ -2548,7 +_,67 @@
@@ -2554,7 +_,67 @@
public void resetLastActionTime() {
this.lastActionTime = Util.getMillis();
@@ -215,7 +215,7 @@
public ServerStatsCounter getStats() {
return this.stats;
@@ -3173,4 +_,65 @@
@@ -3179,4 +_,65 @@
return (org.bukkit.craftbukkit.entity.CraftPlayer) super.getBukkitEntity();
}
// CraftBukkit end

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -370,6 +_,7 @@
@@ -371,6 +_,7 @@
}
return false;
}
@@ -8,7 +8,7 @@
}
// CraftBukkit end
@@ -500,6 +_,7 @@
@@ -501,6 +_,7 @@
public InteractionResult useItemOn(
final ServerPlayer player, final Level level, final ItemStack itemStack, final InteractionHand hand, final BlockHitResult hitResult
) {
@@ -16,7 +16,7 @@
BlockPos pos = hitResult.getBlockPos();
BlockState state = level.getBlockState(pos);
boolean cancelledBlock = false;
@@ -548,7 +_,7 @@
@@ -549,7 +_,7 @@
boolean haveSomethingInOurHands = !player.getMainHandItem().isEmpty() || !player.getOffhandItem().isEmpty();
boolean suppressUsingBlock = player.isSecondaryUseActive() && haveSomethingInOurHands;
ItemStack usedItemStack = itemStack.copy();
@@ -25,7 +25,7 @@
InteractionResult itemUse = state.useItemOn(player.getItemInHand(hand), level, player, hand, hitResult);
if (itemUse.consumesAction()) {
CriteriaTriggers.ITEM_USED_ON_BLOCK.trigger(player, pos, usedItemStack);
@@ -594,4 +_,18 @@
@@ -595,4 +_,18 @@
public void setLevel(final ServerLevel newLevel) {
this.level = newLevel;
}

View File

@@ -1,14 +1,19 @@
--- a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -44,6 +_,7 @@
private long keepAliveChallenge;
@@ -40,10 +_,11 @@
public final Connection connection; // Paper
private final boolean transferred;
//private long keepAliveTime; // Paper - improve keepalives
- //private boolean keepAlivePending; // Paper - improve keepalives
+ private boolean keepAlivePending; // Paper - improve keepalives // Purpur - Alternative Keepalive Handling
//private long keepAliveChallenge; // Paper - improve keepalives
private long closedListenerTime;
private boolean closed = false;
+ private it.unimi.dsi.fastutil.longs.LongList keepAlives = new it.unimi.dsi.fastutil.longs.LongArrayList(); // Purpur - Alternative Keepalive Handling
private int latency;
private volatile int latency; // Paper - improve keepalives - make volatile
private final io.papermc.paper.util.KeepAlive keepAlive; // Paper - improve keepalives
private volatile boolean suspendFlushingOnServerThread = false;
// CraftBukkit start
@@ -53,6 +_,10 @@
@@ -54,6 +_,10 @@
public final java.util.Map<java.util.UUID, net.kyori.adventure.resource.ResourcePackCallback> packCallbacks = new java.util.concurrent.ConcurrentHashMap<>(); // Paper - adventure resource pack callbacks
private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit
protected static final net.minecraft.resources.Identifier MINECRAFT_BRAND = net.minecraft.resources.Identifier.withDefaultNamespace("brand"); // Paper - Brand support
@@ -19,24 +24,26 @@
// Paper start - retain certain values
public @Nullable String playerBrand;
public final java.util.Set<String> pluginMessagerChannels;
@@ -100,6 +_,16 @@
@Override
public void handleKeepAlive(final ServerboundKeepAlivePacket packet) {
@@ -105,6 +_,18 @@
// Paper start - improve keepalives
long now = System.nanoTime();
io.papermc.paper.util.KeepAlive.PendingKeepAlive pending = this.keepAlive.pendingKeepAlives.peek();
+ // Purpur start - Alternative Keepalive Handling
+ if (org.purpurmc.purpur.PurpurConfig.useAlternateKeepAlive) {
+ if (this.keepAlivePending && !keepAlives.isEmpty() && keepAlives.contains(packet.getId())) {
+ int ping = (int) (Util.getMillis() - packet.getId());
+ this.latency = (this.latency * 3 + ping) / 4;
+ int updatedLatency = (this.latency * 3 + ping) / 4;
+ this.latency = updatedLatency;
+ this.keepAlivePending = false;
+ keepAlives.clear(); // we got a valid response, lets roll with it and forget the rest
+ }
+ return;
+ } else
+ // Purpur end - Alternative Keepalive Handling
if (this.keepAlivePending && packet.getId() == this.keepAliveChallenge) {
int time = (int)(Util.getMillis() - this.keepAliveTime);
this.latency = (this.latency * 3 + time) / 4;
@@ -149,6 +_,12 @@
if (pending != null && pending.challengeId() == packet.getId()) {
this.keepAlive.pendingKeepAlives.remove(pending);
@@ -179,6 +_,12 @@
return;
}
@@ -49,24 +56,27 @@
if (identifier.equals(MINECRAFT_BRAND)) {
this.playerBrand = new net.minecraft.network.FriendlyByteBuf(io.netty.buffer.Unpooled.wrappedBuffer(data)).readUtf(256);
}
@@ -236,6 +_,20 @@
// Paper start - give clients a longer time to respond to pings as per pre 1.12.2 timings
// This should effectively place the keepalive handling back to "as it was" before 1.12.2
final long elapsedTime = now - this.keepAliveTime;
@@ -264,6 +_,23 @@
Profiler.get().push("keepAlive");
long now = Util.getMillis();
// Paper start - improve keepalives
+ // Purpur start - Alternative Keepalive Handling
+ if (org.purpurmc.purpur.PurpurConfig.useAlternateKeepAlive) {
+ if (elapsedTime >= 1000L) { // 1 second
+ if (this.keepAlivePending && !this.processedDisconnect && keepAlives.size() * 1000L >= KEEPALIVE_LIMIT) {
+ this.disconnect(TIMEOUT_DISCONNECTION_MESSAGE, io.papermc.paper.connection.DisconnectionReason.TIMEOUT); // Paper - kick event cause
+ } else if (this.checkIfClosed(now)) {
+ this.keepAlivePending = true;
+ this.keepAliveTime = now; // hijack this field for 1 second intervals
+ this.keepAlives.add(now); // currentTime is ID
+ this.send(new ClientboundKeepAlivePacket(now));
+ if (this.checkIfClosed(now) && !this.processedDisconnect) {
+ long currTime = System.nanoTime();
+ if ((currTime - this.keepAlive.lastKeepAliveTx) >= java.util.concurrent.TimeUnit.SECONDS.toNanos(1L)) { // 1 second
+ this.keepAlive.lastKeepAliveTx = currTime;
+ if (this.keepAlivePending && !this.processedDisconnect && keepAlives.size() * 1000L >= KEEPALIVE_LIMIT) {
+ this.disconnect(TIMEOUT_DISCONNECTION_MESSAGE, io.papermc.paper.connection.DisconnectionReason.TIMEOUT);
+ } else if (this.checkIfClosed(now)) {
+ this.keepAlivePending = true;
+ this.keepAlives.add(now); // currentTime is ID
+ this.send(new ClientboundKeepAlivePacket(now));
+ }
+ }
+ }
+ } else
+ // Purpur end - Alternative Keepalive Handling
if (!this.isSingleplayerOwner() && elapsedTime >= 15000L) { // use vanilla's 15000L between keep alive packets
if (this.keepAlivePending) {
if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected
if (this.checkIfClosed(now) && !this.processedDisconnect) {
long currTime = System.nanoTime();

View File

@@ -34,7 +34,7 @@
this.disconnect(Component.translatable("multiplayer.disconnect.idling"), org.bukkit.event.player.PlayerKickEvent.Cause.IDLING); // Paper - kick event cause
}
}
@@ -682,6 +_,8 @@
@@ -693,6 +_,8 @@
this.lastYaw = to.getYaw();
this.lastPitch = to.getPitch();
@@ -43,7 +43,7 @@
Location oldTo = to.clone();
PlayerMoveEvent event = new PlayerMoveEvent(player, from, to);
this.cserver.getPluginManager().callEvent(event);
@@ -738,6 +_,7 @@
@@ -772,6 +_,7 @@
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.level());
if (packet.getId() == this.awaitingTeleport) {
if (this.awaitingPositionFromClient == null) {
@@ -51,7 +51,7 @@
this.disconnect(Component.translatable("multiplayer.disconnect.invalid_player_movement"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PLAYER_MOVEMENT); // Paper - kick event cause
return;
}
@@ -1306,6 +_,10 @@
@@ -1340,6 +_,10 @@
final int maxBookPageSize = pageMax.intValue();
final double multiplier = Math.clamp(io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.bookSize.totalMultiplier, 0.3D, 1D);
long byteAllowed = maxBookPageSize;
@@ -62,7 +62,7 @@
for (final String page : pageList) {
final int byteLength = page.getBytes(java.nio.charset.StandardCharsets.UTF_8).length;
byteTotal += byteLength;
@@ -1330,7 +_,8 @@
@@ -1364,7 +_,8 @@
}
if (byteTotal > byteAllowed) {
@@ -72,7 +72,7 @@
this.disconnectAsync(Component.literal("Book too large!"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // Paper - kick event cause // Paper - add proper async disconnect
return;
}
@@ -1349,31 +_,45 @@
@@ -1383,31 +_,45 @@
Optional<String> title = packet.title();
title.ifPresent(contents::add);
contents.addAll(packet.pages());
@@ -122,7 +122,7 @@
writtenBook.set(
DataComponents.WRITTEN_BOOK_CONTENT, new WrittenBookContent(this.filterableFromOutgoing(title), this.player.getPlainTextName(), 0, pages, true)
);
@@ -1386,6 +_,16 @@
@@ -1420,6 +_,16 @@
return this.player.isTextFilteringEnabled() ? Filterable.passThrough(text.filteredOrEmpty()) : Filterable.from(text);
}
@@ -139,7 +139,7 @@
@Override
public void handleEntityTagQuery(final ServerboundEntityTagQueryPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.level());
@@ -1425,7 +_,15 @@
@@ -1459,7 +_,15 @@
@Override
public void handleMovePlayer(final ServerboundMovePlayerPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.level());
@@ -156,7 +156,7 @@
this.disconnect(Component.translatable("multiplayer.disconnect.invalid_player_movement"), org.bukkit.event.player.PlayerKickEvent.Cause.INVALID_PLAYER_MOVEMENT); // Paper - kick event cause
} else {
ServerLevel level = this.player.level();
@@ -1609,7 +_,7 @@
@@ -1644,7 +_,7 @@
movedWrongly = true;
if (event.getLogWarning())
// Paper end
@@ -165,7 +165,7 @@
} // Paper
}
@@ -1664,6 +_,8 @@
@@ -1709,6 +_,8 @@
this.lastYaw = to.getYaw();
this.lastPitch = to.getPitch();
@@ -174,7 +174,7 @@
Location oldTo = to.clone();
PlayerMoveEvent event = new PlayerMoveEvent(player, from, to);
this.cserver.getPluginManager().callEvent(event);
@@ -1719,6 +_,13 @@
@@ -1764,6 +_,13 @@
this.player.tryResetCurrentImpulseContext();
}
@@ -188,7 +188,7 @@
this.player.checkMovementStatistics(this.player.getX() - startX, this.player.getY() - startY, this.player.getZ() - startZ);
this.lastGoodX = this.player.getX();
this.lastGoodY = this.player.getY();
@@ -1739,6 +_,17 @@
@@ -1784,6 +_,17 @@
}
}
@@ -206,7 +206,7 @@
private boolean shouldCheckPlayerMovement(final boolean isFallFlying) {
if (this.isSingleplayerOwner()) {
return false;
@@ -2150,6 +_,7 @@
@@ -2228,6 +_,7 @@
boolean cancelled;
if (hitResult == null || hitResult.getType() != HitResult.Type.BLOCK) {
@@ -214,7 +214,7 @@
org.bukkit.event.player.PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.RIGHT_CLICK_AIR, itemStack, hand);
cancelled = event.useItemInHand() == Event.Result.DENY;
} else {
@@ -2791,6 +_,7 @@
@@ -2869,6 +_,7 @@
ItemStack mainHandItem = this.player.getMainHandItem();
if (this.player.isWithinAttackRange(mainHandItem, targetBounds, io.papermc.paper.configuration.GlobalConfiguration.get().misc.clientInteractionLeniencyDistance.or(3.0))) { // Paper - configurable lenience
if (!mainHandItem.has(DataComponents.PIERCING_WEAPON)) {
@@ -222,7 +222,7 @@
if (target instanceof ItemEntity
|| target instanceof ExperienceOrb
|| target == this.player
@@ -3572,7 +_,7 @@
@@ -3650,7 +_,7 @@
@Override
public void handleChangeGameMode(final ServerboundChangeGameModePacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.level());

View File

@@ -8,7 +8,7 @@
// CraftBukkit start - moved down
LOGGER.info(
"{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", // Paper - add world identifier
@@ -436,6 +_,7 @@
@@ -437,6 +_,7 @@
}
public net.kyori.adventure.text.@Nullable Component remove(final ServerPlayer player, final net.kyori.adventure.text.Component leaveMessage) {
// Paper end - Fix kick event leave message not being sent
@@ -16,7 +16,7 @@
ServerLevel level = player.level();
player.awardStat(Stats.LEAVE_GAME);
// CraftBukkit start - Quitting must be before we do final save of data, in case plugins need to modify it
@@ -771,6 +_,20 @@
@@ -772,6 +_,20 @@
}
}
@@ -37,7 +37,7 @@
public void broadcastAll(final Packet<?> packet, final ResourceKey<Level> dimension) {
for (ServerPlayer player : this.players) {
if (player.level().dimension() == dimension) {
@@ -864,6 +_,7 @@
@@ -865,6 +_,7 @@
case ADMINS -> EntityEvent.PERMISSION_LEVEL_ADMINS;
case OWNERS -> EntityEvent.PERMISSION_LEVEL_OWNERS;
};
@@ -45,7 +45,7 @@
player.connection.send(new ClientboundEntityEventPacket(player, eventId));
}
@@ -875,7 +_,7 @@
@@ -876,7 +_,7 @@
// Paper start - whitelist verify event / login event
public LoginResult canBypassFullServerLogin(final NameAndId nameAndId, final LoginResult currentResult) {

View File

@@ -1,11 +1,11 @@
--- a/net/minecraft/world/entity/ai/behavior/AcquirePoi.java
+++ b/net/minecraft/world/entity/ai/behavior/AcquirePoi.java
@@ -89,7 +_,7 @@
}
@@ -90,7 +_,7 @@
};
Set<Pair<Holder<PoiType>, BlockPos>> poiPositions = poiManager.findAllClosestFirstWithType(
- poiType, cacheTest, body.blockPosition(), 48, PoiManager.Occupancy.HAS_SPACE
+ poiType, cacheTest, body.blockPosition(), level.purpurConfig.villagerAcquirePoiSearchRadius, PoiManager.Occupancy.HAS_SPACE // Purpur - Configurable villager search radius
)
.limit(5L)
.filter(px -> validPoi.test(level, (BlockPos)px.getSecond()))
// Paper start - optimise POI searches
java.util.List<Pair<Holder<PoiType>, BlockPos>> poiPositionsRaw = new java.util.ArrayList<>();
- ca.spottedleaf.moonrise.patches.poi_lookup.PoiAccess.findNearestPoiPositions(poiManager, poiType, cacheTest, body.blockPosition(), SCAN_RANGE, Double.MAX_VALUE, PoiManager.Occupancy.HAS_SPACE, ca.spottedleaf.moonrise.patches.poi_lookup.PoiAccess.LOAD_FOR_SEARCHING, 5, poiPositionsRaw);
+ ca.spottedleaf.moonrise.patches.poi_lookup.PoiAccess.findNearestPoiPositions(poiManager, poiType, cacheTest, body.blockPosition(), level.purpurConfig.villagerAcquirePoiSearchRadius, Double.MAX_VALUE, PoiManager.Occupancy.HAS_SPACE, ca.spottedleaf.moonrise.patches.poi_lookup.PoiAccess.LOAD_FOR_SEARCHING, 5, poiPositionsRaw); // Purpur - Configurable villager search radius
Set<Pair<Holder<PoiType>, BlockPos>> poiPositions = new java.util.HashSet<>(poiPositionsRaw.size());
for (Pair<Holder<PoiType>, BlockPos> pair : poiPositionsRaw) {
if (validPoi.test(level, pair.getSecond())) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/ai/behavior/TransportItemsBetweenContainers.java
+++ b/net/minecraft/world/entity/ai/behavior/TransportItemsBetweenContainers.java
@@ -286,7 +_,7 @@
@@ -287,7 +_,7 @@
LevelChunk levelChunk = level.getChunkSource().getChunkNow(chunkPos.x(), chunkPos.z());
if (levelChunk != null) {
for (BlockEntity potentialTarget : levelChunk.getBlockEntities().values()) {
@@ -9,7 +9,7 @@
double distance = chestBlockEntity.getBlockPos().distToCenterSqr(body.position());
if (distance < closestDistance) {
TransportItemsBetweenContainers.TransportItemTarget targetValidToPick = this.isTargetValidToPick(
@@ -375,7 +_,11 @@
@@ -376,7 +_,11 @@
}
private boolean isTargetBlocked(final Level level, final TransportItemsBetweenContainers.TransportItemTarget target) {
@@ -22,7 +22,7 @@
}
private boolean targetHasNotChanged(final Level level, final TransportItemsBetweenContainers.TransportItemTarget target) {
@@ -455,7 +_,7 @@
@@ -456,7 +_,7 @@
}
private boolean isWantedBlock(final PathfinderMob mob, final BlockState block) {
@@ -31,7 +31,7 @@
}
private static double getInteractionRange(final PathfinderMob body) {
@@ -507,6 +_,11 @@
@@ -508,6 +_,11 @@
}
private static boolean matchesLeavingItemsRequirement(final PathfinderMob body, final Container container) {
@@ -43,7 +43,7 @@
return container.isEmpty() || hasItemMatchingHandItem(body, container);
}
@@ -544,7 +_,7 @@
@@ -545,7 +_,7 @@
int slot = 0;
for (ItemStack itemStack : container) {

View File

@@ -1,14 +1,11 @@
--- a/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java
+++ b/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java
@@ -54,9 +_,9 @@
@@ -54,7 +_,7 @@
}
};
Set<Pair<Holder<PoiType>, BlockPos>> pois = poiManager.findAllWithType(
- e -> e.is(PoiTypes.HOME), cacheTest, body.blockPosition(), 48, PoiManager.Occupancy.ANY
+ e -> e.is(PoiTypes.HOME), cacheTest, body.blockPosition(), level.purpurConfig.villagerNearestBedSensorSearchRadius, PoiManager.Occupancy.ANY
- e -> e.is(PoiTypes.HOME), cacheTest, body.blockPosition(), AcquirePoi.SCAN_RANGE, PoiManager.Occupancy.ANY
+ e -> e.is(PoiTypes.HOME), cacheTest, body.blockPosition(), level.purpurConfig.villagerNearestBedSensorSearchRadius, PoiManager.Occupancy.ANY // Purpur - Configurable villager search radius
)
- .collect(Collectors.toSet());
+ .collect(Collectors.toSet()); // Purpur - Configurable villager search radius
.collect(Collectors.toSet());
Path path = AcquirePoi.findPathToPois(body, pois);
if (path != null && path.canReach()) {
BlockPos targetPos = path.getTarget();

View File

@@ -36,9 +36,9 @@
if (this.isInWater()) {
+ if (canFly()) setNoGravity(!wasTouchingWater); // Purpur - Flying squids! Oh my!
if (this.tentacleMovement < (float) Math.PI) {
float tentacleScale = this.tentacleMovement / (float) Math.PI;
this.tentacleAngle = Mth.sin(tentacleScale * tentacleScale * (float) Math.PI) * (float) Math.PI * 0.25F;
if (this.tentacleMovement < Mth.PI) {
float tentacleScale = this.tentacleMovement / Mth.PI;
this.tentacleAngle = Mth.sin(tentacleScale * tentacleScale * Mth.PI) * Mth.PI * 0.25F;
@@ -321,7 +_,7 @@
int noActionTime = this.squid.getNoActionTime();
if (noActionTime > 100) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
+++ b/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
@@ -965,6 +_,7 @@
@@ -959,6 +_,7 @@
@Override
protected boolean canRide(final Entity vehicle) {
@@ -8,7 +8,7 @@
return false;
}
@@ -1000,7 +_,7 @@
@@ -994,7 +_,7 @@
boolean shouldDrop = level.getGameRules().get(GameRules.MOB_DROPS);
int xpCount = 500;

View File

@@ -70,7 +70,7 @@
}
float totalDamage = baseDamage + magicBoost;
@@ -1746,7 +_,23 @@
@@ -1740,7 +_,23 @@
@Override
protected int getBaseExperienceReward(final ServerLevel level) {
@@ -95,7 +95,7 @@
}
@Override
@@ -1789,6 +_,13 @@
@@ -1783,6 +_,13 @@
public boolean addItem(final ItemStack itemStack) {
return this.inventory.add(itemStack);
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/inventory/AbstractContainerMenu.java
+++ b/net/minecraft/world/inventory/AbstractContainerMenu.java
@@ -64,6 +_,7 @@
@@ -65,6 +_,7 @@
private final List<ContainerListener> containerListeners = Lists.newArrayList();
private @Nullable ContainerSynchronizer synchronizer;
private boolean suppressRemoteUpdates;

View File

@@ -43,7 +43,7 @@
public int getDamageValue() {
return Mth.clamp(this.getOrDefault(DataComponents.DAMAGE, 0), 0, this.getMaxDamage());
}
@@ -1240,6 +_,12 @@
@@ -1246,6 +_,12 @@
public boolean isEnchanted() {
return !this.getOrDefault(DataComponents.ENCHANTMENTS, ItemEnchantments.EMPTY).isEmpty();
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/Level.java
+++ b/net/minecraft/world/level/Level.java
@@ -169,10 +_,54 @@
@@ -170,10 +_,54 @@
}
// Paper end - add paper world config
@@ -55,16 +55,16 @@
public CraftWorld getWorld() {
return this.world;
}
@@ -848,6 +_,8 @@
@@ -850,6 +_,8 @@
// Paper end - getblock optimisations - cache world height/sections
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(bukkitName); // 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(), environment); // Purpur - Purpur config files
+ this.purpurConfig = new org.purpurmc.purpur.PurpurWorldConfig(bukkitName, environment); // Purpur - Purpur config files
+ this.playerBreedingCooldowns = this.getNewBreedingCooldownCache(); // Purpur - Add adjustable breeding cooldown to config
this.generator = generator;
this.world = new CraftWorld((ServerLevel) this, generator, biomeProvider, environment);
@@ -2188,4 +_,14 @@
@@ -2192,4 +_,14 @@
return this.moonrise$getEntityLookup().getEntityCount(); // Paper - rewrite chunk system
}
// Paper end - allow patching this logic

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/NaturalSpawner.java
+++ b/net/minecraft/world/level/NaturalSpawner.java
@@ -216,7 +_,7 @@
@@ -289,7 +_,7 @@
pos.set(x, yStart, z);
double xx = x + 0.5;
double zz = z + 0.5;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/DragonEggBlock.java
+++ b/net/minecraft/world/level/block/DragonEggBlock.java
@@ -49,6 +_,7 @@
@@ -50,6 +_,7 @@
}
private void teleport(final BlockState state, final Level level, final BlockPos pos) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/ObserverBlock.java
+++ b/net/minecraft/world/level/block/ObserverBlock.java
@@ -81,6 +_,7 @@
@@ -82,6 +_,7 @@
final RandomSource random
) {
if (state.getValue(FACING) == directionToNeighbour && !state.getValue(POWERED)) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/entity/BlockEntity.java
+++ b/net/minecraft/world/level/block/entity/BlockEntity.java
@@ -107,6 +_,10 @@
@@ -108,6 +_,10 @@
input.read("PublicBukkitValues", CompoundTag.CODEC)
.ifPresent(this.persistentDataContainer::putAll);
// Paper end - read persistent data container
@@ -11,7 +11,7 @@
}
public final void loadWithComponents(final ValueInput input) {
@@ -119,6 +_,11 @@
@@ -120,6 +_,11 @@
}
protected void saveAdditional(final ValueOutput output) {
@@ -23,7 +23,7 @@
}
public final CompoundTag saveWithFullMetadata(final HolderLookup.Provider registries) {
@@ -412,4 +_,16 @@
@@ -414,4 +_,16 @@
return this.blockEntity.getNameForReporting() + "@" + this.blockEntity.getBlockPos();
}
}

View File

@@ -1,8 +1,8 @@
--- a/net/minecraft/world/level/chunk/storage/EntityStorage.java
+++ b/net/minecraft/world/level/chunk/storage/EntityStorage.java
@@ -97,6 +_,7 @@
ListTag entities = new ListTag();
chunk.getEntities().forEach(e -> {
@@ -108,6 +_,7 @@
}
// Paper end - Entity load/save limit per chunk
TagValueOutput output = TagValueOutput.createWithContext(reporter.forChild(e.problemPath()), e.registryAccess());
+ if (!e.canSaveToDisk()) return; // Purpur - Add canSaveToDisk to Entity
if (e.save(output)) {

View File

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