Updated Upstream (Paper)

Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@7b66699b 26.2-rc-2
PaperMC/Paper@bb676e22 actual 26.2-rc-2
PaperMC/Paper@a737972b Fix isAllowedInPeaceful call
PaperMC/Paper@c35810c3 Update deps to match Vanilla
PaperMC/Paper@e5643cd4 Update Vex#getSummoner return type
PaperMC/Paper@e00936a3 [ci/skip] update log4j for the api
PaperMC/Paper@eb5df78f fix wither spawning parity and remove openSign var
PaperMC/Paper@d1aca9a6 Apply most remaining feature patches
This commit is contained in:
granny
2026-06-12 17:35:54 -07:00
parent 779f1f2613
commit 0c913568e6
42 changed files with 274 additions and 287 deletions

View File

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

View File

@@ -25,7 +25,7 @@
getTPS(this.tickTimes1m, interval),
getTPS(this.tickTimes5m, interval),
getTPS(this.tickTimes15m, interval)
@@ -955,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
@@ -1044,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
@@ -1210,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
@@ -1228,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;
@@ -1852,7 +_,7 @@
@@ -1972,7 +_,7 @@
}
public String getServerModName() {

View File

@@ -9,7 +9,7 @@
private final LevelDebugSynchronizers debugSynchronizers = new LevelDebugSynchronizers(this);
// CraftBukkit start
@@ -389,8 +_,25 @@
@@ -644,8 +_,25 @@
// CraftBukkit end
this.tickTime = tickTime;
this.server = server;
@@ -36,15 +36,15 @@
ChunkGenerator generator = levelStem.generator();
// CraftBukkit start
// Paper start - per-world time
@@ -481,6 +_,7 @@
this.environmentAttributes = EnvironmentAttributeSystem.builder().addDefaultLayers(this).build();
this.updateSkyBrightness();
@@ -739,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.getGameTime(); // Purpur - Configurable daylight cycle
}
// Paper start
@@ -549,7 +_,7 @@
@@ -807,7 +_,7 @@
}
int percentage = this.getGameRules().get(GameRules.PLAYERS_SLEEPING_PERCENTAGE);
@@ -53,7 +53,7 @@
Optional<Holder<WorldClock>> defaultClock = this.dimensionType().defaultClock();
org.bukkit.event.world.ClockTimeSkipEvent event = null; // Paper - per-world time
if (this.getGameRules().get(GameRules.ADVANCE_TIME) && defaultClock.isPresent()) {
@@ -759,9 +_,18 @@
@@ -1048,9 +_,18 @@
&& this.random.nextDouble() < difficulty.getEffectiveDifficulty() * this.paperConfig().entities.spawning.skeletonHorseThunderSpawnChance.or(0.01) // Paper - Configurable spawn chances for skeleton horses
&& !this.getBlockState(pos.below()).is(BlockTags.LIGHTNING_RODS);
if (isTrap) {
@@ -73,7 +73,7 @@
horse.setAge(0);
horse.setPos(pos.getX(), pos.getY(), pos.getZ());
this.addFreshEntity(horse, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING); // CraftBukkit
@@ -796,9 +_,35 @@
@@ -1085,9 +_,35 @@
if (state.is(Blocks.SNOW)) {
int currentLayers = state.getValue(SnowLayerBlock.LAYERS);
if (currentLayers < Math.min(maxHeight, 8)) {
@@ -109,7 +109,7 @@
}
} else {
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, topPos, Blocks.SNOW.defaultBlockState(), Block.UPDATE_ALL, null); // CraftBukkit
@@ -819,7 +_,7 @@
@@ -1108,7 +_,7 @@
p -> p.is(PoiTypes.LIGHTNING_ROD),
lightningRodPos -> lightningRodPos.getY() == this.getHeight(Heightmap.Types.WORLD_SURFACE, lightningRodPos.getX(), lightningRodPos.getZ()) - 1,
center,
@@ -118,7 +118,7 @@
PoiManager.Occupancy.ANY
);
return nearbyLightningRod.map(blockPos -> blockPos.above(1));
@@ -867,8 +_,26 @@
@@ -1156,8 +_,26 @@
int percentage = this.getGameRules().get(GameRules.PLAYERS_SLEEPING_PERCENTAGE);
Component message;
if (this.sleepStatus.areEnoughSleeping(percentage)) {
@@ -145,7 +145,7 @@
message = Component.translatable("sleep.players_sleeping", this.sleepStatus.amountSleeping(), this.sleepStatus.sleepersNeeded(percentage));
}
@@ -1034,6 +_,7 @@
@@ -1323,6 +_,7 @@
public void resetWeatherCycle() {
WeatherData weatherData = this.getWeatherData();
// CraftBukkit start
@@ -153,7 +153,7 @@
weatherData.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....
@@ -1041,6 +_,7 @@
@@ -1330,6 +_,7 @@
weatherData.setRainTime(0);
}
// CraftBukkit end
@@ -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.
@@ -1690,7 +_,7 @@
@@ -2001,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);
@@ -2586,7 +_,7 @@
@@ -2920,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
@@ -436,6 +_,9 @@
@@ -441,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
@@ -8,9 +8,9 @@
+ private boolean compassBar = false; // Purpur - Add compass command
+ private boolean ramBar = false; // Purpur - Implement rambar commands
public ServerPlayer(final MinecraftServer server, final ServerLevel level, final GameProfile gameProfile, final ClientInformation clientInformation) {
super(level, gameProfile);
@@ -480,6 +_,9 @@
// Paper start - rewrite chunk system
private ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader.PlayerChunkLoaderData chunkLoader;
@@ -515,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);
}
@@ -522,6 +_,9 @@
@@ -557,6 +_,9 @@
output.store("ShoulderEntityRight", CompoundTag.CODEC, this.getShoulderEntityRight());
}
this.getBukkitEntity().setExtraData(output); // CraftBukkit
@@ -30,15 +30,15 @@
}
private void saveParentVehicle(final ValueOutput playerOutput) {
@@ -1158,6 +_,7 @@
@@ -1194,6 +_,7 @@
// Paper - moved up to sendClientboundPlayerCombatKillPacket()
sendClientboundPlayerCombatKillPacket(event.getShowDeathMessages(), deathScreenMessage); // Paper - Expand PlayerDeathEvent
this.sendClientboundPlayerCombatKillPacket(event.getShowDeathMessages(), deathScreenMessage); // Paper - Expand PlayerDeathEvent
Team team = this.getTeam();
+ if (org.purpurmc.purpur.PurpurConfig.deathMessageOnlyBroadcastToAffectedPlayer) this.sendSystemMessage(deathMessage); else // Purpur - Configurable broadcast settings
if (team == null || team.getDeathMessageVisibility() == Team.Visibility.ALWAYS) {
this.server.getPlayerList().broadcastSystemMessage(deathMessage, false);
} else if (team.getDeathMessageVisibility() == Team.Visibility.HIDE_FOR_OTHER_TEAMS) {
@@ -1267,6 +_,13 @@
@@ -1303,6 +_,13 @@
return false;
}
@@ -52,7 +52,7 @@
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 player && !this.canHarmPlayer(player))
@@ -1508,7 +_,7 @@
@@ -1544,7 +_,7 @@
}
if (newLevel.dimension() == lastDimension) {
@@ -61,7 +61,7 @@
this.connection.resetPosition();
transition.postTeleportTransition().onTransition(this);
return this;
@@ -1531,6 +_,7 @@
@@ -1567,6 +_,7 @@
profiler.pop();
profiler.push("placing");
@@ -69,7 +69,7 @@
this.setServerLevel(newLevel);
this.connection.internalTeleport(PositionMoveRotation.of(transition), transition.relatives()); // CraftBukkit - use internal teleport without event
this.connection.resetPosition();
@@ -1643,7 +_,7 @@
@@ -1679,7 +_,7 @@
new AABB(bedCenter.x() - 8.0, bedCenter.y() - 5.0, bedCenter.z() - 8.0, bedCenter.x() + 8.0, bedCenter.y() + 5.0, bedCenter.z() + 8.0),
monster -> monster.isPreventingPlayerRest(this.level(), this)
);
@@ -78,7 +78,7 @@
return Either.left(Player.BedSleepingProblem.NOT_SAFE);
}
}
@@ -1679,7 +_,17 @@
@@ -1715,7 +_,17 @@
CriteriaTriggers.SLEPT_IN_BED.trigger(this);
});
if (!this.level().canSleepThroughNights()) {
@@ -97,7 +97,7 @@
}
this.level().updateSleepingPlayerList();
@@ -1774,6 +_,7 @@
@@ -1810,6 +_,7 @@
@Override
public void openTextEdit(final SignBlockEntity sign, final boolean isFrontText) {
@@ -105,7 +105,7 @@
this.connection.send(new ClientboundBlockUpdatePacket(this.level(), sign.getBlockPos()));
this.connection.send(new ClientboundOpenSignEditorPacket(sign.getBlockPos(), isFrontText));
}
@@ -2118,6 +_,26 @@
@@ -2154,6 +_,26 @@
this.lastSentExp = -1; // CraftBukkit - Added to reset
}
@@ -132,7 +132,7 @@
@Override
public void completeUsingItem() {
if (!this.useItem.isEmpty() && this.isUsingItem()) {
@@ -2355,6 +_,20 @@
@@ -2391,6 +_,20 @@
);
}
@@ -153,7 +153,7 @@
@Override
public void sendSystemMessage(final Component message) {
this.sendSystemMessage(message, false);
@@ -2506,7 +_,67 @@
@@ -2542,7 +_,67 @@
public void resetLastActionTime() {
this.lastActionTime = Util.getMillis();
@@ -222,7 +222,7 @@
public ServerStatsCounter getStats() {
return this.stats;
@@ -3131,4 +_,65 @@
@@ -3167,4 +_,65 @@
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
@@ -297,6 +_,7 @@
@@ -327,6 +_,7 @@
int chunkX = SectionPos.blockToSectionCoord(pos.getX());
int chunkZ = SectionPos.blockToSectionCoord(pos.getZ());
// Paper start - Buffer OOB setBlock calls

View File

@@ -34,7 +34,7 @@
this.disconnect(Component.translatable("multiplayer.disconnect.idling"), org.bukkit.event.player.PlayerKickEvent.Cause.IDLING); // Paper - kick event cause
}
}
@@ -685,6 +_,8 @@
@@ -696,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);
@@ -741,6 +_,7 @@
@@ -775,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;
}
@@ -1312,6 +_,10 @@
@@ -1346,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;
@@ -1336,7 +_,8 @@
@@ -1370,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;
}
@@ -1355,31 +_,45 @@
@@ -1389,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)
);
@@ -1392,6 +_,16 @@
@@ -1426,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());
@@ -1431,7 +_,15 @@
@@ -1465,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();
@@ -1615,7 +_,7 @@
@@ -1650,7 +_,7 @@
movedWrongly = true;
if (event.getLogWarning())
// Paper end
@@ -165,7 +165,7 @@
} // Paper
}
@@ -1670,6 +_,8 @@
@@ -1715,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);
@@ -1725,6 +_,13 @@
@@ -1770,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();
@@ -1745,6 +_,17 @@
@@ -1790,6 +_,17 @@
}
}
@@ -206,7 +206,7 @@
private boolean shouldCheckPlayerMovement(final boolean isFallFlying) {
if (this.isSingleplayerOwner()) {
return false;
@@ -2158,6 +_,7 @@
@@ -2231,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 {
@@ -2801,6 +_,7 @@
@@ -2874,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
@@ -3584,7 +_,7 @@
@@ -3656,7 +_,7 @@
@Override
public void handleChangeGameMode(final ServerboundChangeGameModePacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.level());

View File

@@ -3,12 +3,12 @@
@@ -165,6 +_,7 @@
SlotProvider,
DebugValueSource,
TypedInstance<EntityType<?>> {
TypedInstance<EntityType<?>>, 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 int CURRENT_LEVEL = 2;
static boolean isLevelAtLeast(ValueInput input, int level) {
@@ -341,8 +_,9 @@
@@ -297,8 +_,9 @@
public double xOld;
public double yOld;
public double zOld;
@@ -19,7 +19,7 @@
public int tickCount;
private int remainingFireTicks;
private final EntityFluidInteraction fluidInteraction = new EntityFluidInteraction(Set.of(FluidTags.WATER, FluidTags.LAVA));
@@ -375,8 +_,8 @@
@@ -331,8 +_,8 @@
public @Nullable 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};
@@ -427,6 +_,7 @@
@@ -382,6 +_,7 @@
private final int despawnTime; // Paper - entity despawn time limit
public int totalEntityAge; // Paper - age-like counter for all entities
public final io.papermc.paper.entity.activation.ActivationType activationType = io.papermc.paper.entity.activation.ActivationType.activationTypeFor(this); // Paper - EAR 2/tracking ranges
@@ -38,9 +38,9 @@
// Paper start - EAR 2
public final boolean defaultActivationState;
public long activatedTick = Integer.MIN_VALUE;
@@ -444,11 +_,23 @@
@@ -549,11 +_,23 @@
}
// Paper end
// Paper end - optimise entity tracker
+ // Purpur start - Add canSaveToDisk to Entity
+ public boolean canSaveToDisk() {
@@ -62,7 +62,7 @@
this.position = Vec3.ZERO;
this.blockPosition = BlockPos.ZERO;
this.chunkPosition = ChunkPos.ZERO;
@@ -850,6 +_,7 @@
@@ -955,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
@@ -70,7 +70,7 @@
this.onBelowWorld();
}
}
@@ -1945,7 +_,7 @@
@@ -2092,7 +_,7 @@
}
public boolean fireImmune() {
@@ -79,7 +79,7 @@
}
public boolean causeFallDamage(final double fallDistance, final float damageModifier, final DamageSource damageSource) {
@@ -2531,7 +_,7 @@
@@ -2682,7 +_,7 @@
output.putBoolean("Bukkit.invisible", this.persistentInvisibility);
}
// SPIGOT-6907: re-implement LivingEntity#setMaximumAir()
@@ -88,7 +88,7 @@
output.putInt("Bukkit.MaxAirSupply", this.getMaxAirSupply());
}
output.putInt("Spigot.ticksLived", this.totalEntityAge); // Paper
@@ -2617,6 +_,11 @@
@@ -2768,6 +_,11 @@
output.putBoolean("Paper.FreezeLock", true);
}
// Paper end
@@ -100,7 +100,7 @@
} catch (Throwable t) {
CrashReport report = CrashReport.forThrowable(t, "Saving entity NBT");
CrashReportCategory category = report.addCategory("Entity being saved");
@@ -2740,6 +_,9 @@
@@ -2891,6 +_,9 @@
}
freezeLocked = input.getBooleanOr("Paper.FreezeLock", false);
// Paper end
@@ -110,7 +110,7 @@
} catch (Throwable t) {
CrashReport report = CrashReport.forThrowable(t, "Loading entity NBT");
CrashReportCategory category = report.addCategory("Entity being loaded");
@@ -2916,6 +_,7 @@
@@ -3156,6 +_,7 @@
if (this.isAlive() && this instanceof Leashable leashable) {
if (leashable.getLeashHolder() == player) {
if (!this.level().isClientSide()) {
@@ -118,7 +118,7 @@
// Paper start - EntityUnleashEvent
if (!org.bukkit.craftbukkit.event.CraftEventFactory.handlePlayerUnleashEntityEvent(
leashable, player, hand, !player.hasInfiniteMaterials(), true
@@ -3323,15 +_,18 @@
@@ -3563,15 +_,18 @@
return Vec3.directionFromRotation(this.getRotationVector());
}
@@ -138,7 +138,7 @@
}
}
}
@@ -4065,7 +_,7 @@
@@ -4311,7 +_,7 @@
}
public boolean canUsePortal(final boolean ignorePassenger) {
@@ -147,7 +147,7 @@
}
public boolean canTeleport(final Level from, final Level to) {
@@ -4615,6 +_,12 @@
@@ -4863,6 +_,12 @@
return Mth.lerp(partial, this.yRotO, this.yRot);
}
@@ -160,7 +160,7 @@
public boolean touchingUnloadedChunk() {
AABB box = this.getBoundingBox().inflate(1.0);
int x0 = Mth.floor(box.minX);
@@ -4909,7 +_,7 @@
@@ -5166,7 +_,7 @@
}
public float maxUpStep() {

View File

@@ -105,7 +105,7 @@
if (damage < 0.0F) {
damage = 0.0F;
}
@@ -1724,10 +_,10 @@
@@ -1722,10 +_,10 @@
protected @Nullable Player resolvePlayerResponsibleForDamage(final DamageSource source) {
Entity sourceEntity = source.getEntity();
if (sourceEntity instanceof Player playerSource) {
@@ -118,7 +118,7 @@
} else {
this.lastHurtByPlayer = null;
this.lastHurtByPlayerMemoryTime = 0;
@@ -1779,6 +_,17 @@
@@ -1777,6 +_,17 @@
}
}
@@ -136,23 +136,18 @@
final org.bukkit.inventory.EquipmentSlot handSlot = (usedHand != null) ? org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(usedHand) : null;
final EntityResurrectEvent event = new EntityResurrectEvent((org.bukkit.entity.LivingEntity) this.getBukkitEntity(), handSlot);
event.setCancelled(protectionItem == null);
@@ -1956,6 +_,7 @@
@@ -1930,8 +_,10 @@
protected void dropAllDeathLoot(final ServerLevel level, final DamageSource source) {
boolean playerKilled = this.lastHurtByPlayerMemoryTime > 0;
this.dropEquipment(level); // CraftBukkit - from below
if (this.shouldDropLoot(level)) {
+ if (!(source.is(net.minecraft.world.damagesource.DamageTypes.CRAMMING) && level().purpurConfig.disableDropsOnCrammingDeath)) { // Purpur - Disable loot drops on death by cramming
this.dropFromLootTable(level, source, playerKilled);
// Paper start
final boolean prev = this.clearEquipmentSlots;
@@ -1964,6 +_,7 @@
// Paper end
this.dropCustomDeathLoot(level, source, playerKilled);
this.clearEquipmentSlots = prev; // Paper
+ } // Purpur - Disable loot drops on death by cramming
+ }
}
// CraftBukkit start - Call death event // Paper start - call advancement triggers with correct entity equipment
@@ -3323,6 +_,7 @@
this.dropEquipment(level);
@@ -3280,6 +_,7 @@
float dmg = (float)(diff * 10.0 - 3.0);
if (dmg > 0.0F) {
this.playSound(this.getFallDamageSound((int)dmg), 1.0F, 1.0F);
@@ -160,7 +155,7 @@
this.hurt(this.damageSources().flyIntoWall(), dmg);
}
}
@@ -4816,6 +_,12 @@
@@ -4773,6 +_,12 @@
? slot == EquipmentSlot.MAINHAND && this.canUseSlot(EquipmentSlot.MAINHAND)
: slot == equippable.slot() && this.canUseSlot(equippable.slot()) && equippable.canBeEquippedBy(this.typeHolder());
}

View File

@@ -61,7 +61,7 @@
// Paper start - allow changing despawnInPeaceful
this.despawnInPeacefulOverride = readDespawnInPeacefulOverride(input);
}
@@ -1289,7 +_,7 @@
@@ -1287,7 +_,7 @@
);
}
@@ -70,7 +70,7 @@
return groupData;
}
@@ -1646,6 +_,7 @@
@@ -1644,6 +_,7 @@
}
this.postPiercingAttack();

View File

@@ -1,11 +1,11 @@
--- a/net/minecraft/world/entity/ai/behavior/AcquirePoi.java
+++ b/net/minecraft/world/entity/ai/behavior/AcquirePoi.java
@@ -95,7 +_,7 @@
return true;
@@ -96,7 +_,7 @@
};
Set<Pair<Holder<PoiType>, BlockPos>> poiPositions = poiManager.findAllClosestFirstWithType(
- poiType, cacheTest, body.blockPosition(), SCAN_RANGE, 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

@@ -20,10 +20,10 @@
}
@Override
@@ -722,6 +_,29 @@
return slot == EquipmentSlot.MAINHAND;
@@ -715,6 +_,29 @@
private boolean trusts(final LivingEntity entity) {
return this.getTrustedEntities().anyMatch(trusted -> trusted.matches(entity));
}
// Paper end
+
+ // Purpur start - Tulips change fox type
+ @Override
@@ -49,4 +49,4 @@
+ // Purpur end - Tulips change fox type
@Override
// Paper start - Cancellable death event
// Paper start - Fix MC-153010 (dropCustomDeathLoot is only called when shouldDropLoot = true)

View File

@@ -1,6 +1,15 @@
--- a/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
+++ b/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
@@ -968,6 +_,7 @@
@@ -615,7 +_,7 @@
}
int xpCount = 500;
- if (this.dragonFight != null && !this.dragonFight.hasPreviouslyKilledDragon()) {
+ if (this.dragonFight != null && (level().purpurConfig.enderDragonAlwaysDropsFullExp || !this.dragonFight.hasPreviouslyKilledDragon())) { // Purpur - Ender dragon always drop full exp
xpCount = 12000;
}
xpCount = this.expToDrop; // CraftBukkit - SPIGOT-2420: Moved up to #getExpReward method
@@ -960,6 +_,7 @@
@Override
protected boolean canRide(final Entity vehicle) {
@@ -8,12 +17,3 @@
return false;
}
@@ -1003,7 +_,7 @@
boolean shouldDrop = level.getGameRules().get(GameRules.MOB_DROPS);
int xpCount = 500;
- if (this.dragonFight != null && !this.dragonFight.hasPreviouslyKilledDragon()) {
+ if (this.dragonFight != null && (level().purpurConfig.enderDragonAlwaysDropsFullExp || !this.dragonFight.hasPreviouslyKilledDragon())) { // Purpur - Ender dragon always drop full exp
xpCount = 12000;
}

View File

@@ -14,7 +14,7 @@
}
public ArmorStand(final Level level, final double x, final double y, final double z) {
@@ -547,6 +_,7 @@
@@ -550,6 +_,7 @@
// Paper start - Allow ArmorStands not to tick
@Override
public void tick() {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/piglin/Piglin.java
+++ b/net/minecraft/world/entity/monster/piglin/Piglin.java
@@ -182,6 +_,11 @@
@@ -183,6 +_,11 @@
public static boolean checkPiglinSpawnRules(
final EntityType<Piglin> type, final LevelAccessor level, final EntitySpawnReason spawnReason, final BlockPos pos, final RandomSource random
) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/piglin/PiglinAi.java
+++ b/net/minecraft/world/entity/monster/piglin/PiglinAi.java
@@ -664,14 +_,24 @@
@@ -660,14 +_,24 @@
}
public static boolean isWearingSafeArmor(final LivingEntity livingEntity) {

View File

@@ -1,14 +1,14 @@
--- a/net/minecraft/world/item/ItemStack.java
+++ b/net/minecraft/world/item/ItemStack.java
@@ -452,6 +_,7 @@
@@ -456,6 +_,7 @@
// revert back all captured blocks
for (org.bukkit.block.BlockState blockstate : blocks) {
((org.bukkit.craftbukkit.block.CraftBlockState) blockstate).revertPlace(true); // poi updates needs to be skipped since the poi were never registered as part of the capture
+ ((org.bukkit.craftbukkit.block.CraftBlock) blockstate.getBlock()).getBlockState().getBlock().forgetPlacer(); // Purpur - Store placer on Block when placed
for (org.bukkit.craftbukkit.block.CraftBlockState snapshot : capturedBlockStates) {
snapshot.revertPlace(true); // poi updates needs to be skipped since the poi were never registered as part of the capture
+ snapshot.getBlock().getBlockState().getBlock().forgetPlacer(); // Purpur - Store placer on Block when placed
}
SignItem.openSign = null; // SPIGOT-6758 - Reset on early return
@@ -475,6 +_,7 @@
} else {
// Change the stack to its new contents if it hasn't been tampered with.
@@ -477,6 +_,7 @@
if (!(block.getBlock() instanceof net.minecraft.world.level.block.BaseEntityBlock)) { // Containers get placed automatically
block.onPlace(level, newPos, oldBlock, true, context);
}
@@ -16,7 +16,7 @@
level.notifyAndUpdatePhysics(newPos, null, oldBlock, block, level.getBlockState(newPos), updateFlags, net.minecraft.world.level.block.Block.UPDATE_LIMIT); // send null chunk as chunk.k() returns false by this point
}
@@ -579,6 +_,26 @@
@@ -566,6 +_,26 @@
return this.isDamageableItem() && this.getDamageValue() > 0;
}
@@ -43,7 +43,7 @@
public int getDamageValue() {
return Mth.clamp(this.getOrDefault(DataComponents.DAMAGE, 0), 0, this.getMaxDamage());
}
@@ -1237,6 +_,12 @@
@@ -1230,6 +_,12 @@
public boolean isEnchanted() {
return !this.getOrDefault(DataComponents.ENCHANTMENTS, ItemEnchantments.EMPTY).isEmpty();
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/EntityGetter.java
+++ b/net/minecraft/world/level/EntityGetter.java
@@ -142,7 +_,7 @@
@@ -183,7 +_,7 @@
default boolean hasNearbyAlivePlayer(final double x, final double y, final double z, final double range) {
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
@@ -171,10 +_,54 @@
@@ -172,10 +_,54 @@
}
// Paper end - add paper world config
@@ -55,7 +55,7 @@
public CraftWorld getWorld() {
return this.world;
}
@@ -220,6 +_,8 @@
@@ -853,6 +_,8 @@
final org.bukkit.NamespacedKey worldKey = CraftNamespacedKey.fromMinecraft(dimension.identifier()); // Paper
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(bukkitName, worldKey); // Spigot
this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config
@@ -64,8 +64,8 @@
this.generator = generator;
this.world = new CraftWorld((ServerLevel) this, worldKey, biomeProvider, environment);
@@ -1505,4 +_,14 @@
return ret;
@@ -2203,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
@@ -213,7 +_,7 @@
@@ -286,7 +_,7 @@
pos.set(x, yStart, z);
double xx = x + 0.5;
double zz = z + 0.5;

View File

@@ -1,9 +1,9 @@
--- a/net/minecraft/world/level/ServerExplosion.java
+++ b/net/minecraft/world/level/ServerExplosion.java
@@ -341,6 +_,23 @@
}
public int explode() {
@@ -631,6 +_,23 @@
this.directMappedBlockCache = new ca.spottedleaf.moonrise.patches.collisions.ExplosionBlockCache[BLOCK_EXPLOSION_CACHE_WIDTH * BLOCK_EXPLOSION_CACHE_WIDTH * BLOCK_EXPLOSION_CACHE_WIDTH];
this.mutablePos = new BlockPos.MutableBlockPos();
// Paper end - collision optimisations
+ // Purpur start - add PreExplodeEvents
+ if (this.source != null) {
+ org.bukkit.Location location = new org.bukkit.Location(this.level.getWorld(), this.center.x, this.center.y, this.center.z);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/WitherSkullBlock.java
+++ b/net/minecraft/world/level/block/WitherSkullBlock.java
@@ -69,6 +_,7 @@
@@ -68,6 +_,7 @@
);
witherBoss.yBodyRot = match.getForwards().getAxis() == Direction.Axis.X ? 0.0F : 90.0F;
witherBoss.makeInvulnerable();

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/entity/BlockEntity.java
+++ b/net/minecraft/world/level/block/entity/BlockEntity.java
@@ -106,6 +_,10 @@
@@ -107,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) {
@@ -123,6 +_,11 @@
@@ -124,6 +_,11 @@
output.store("PublicBukkitValues", CompoundTag.CODEC, this.persistentDataContainer.toTagCompound());
}
// CraftBukkit end
@@ -23,7 +23,7 @@
}
public final CompoundTag saveWithFullMetadata(final HolderLookup.Provider registries) {
@@ -388,4 +_,16 @@
@@ -390,4 +_,16 @@
return this.blockEntity.getNameForReporting() + "@" + this.blockEntity.getBlockPos();
}
}

View File

@@ -2,9 +2,9 @@
+++ b/net/minecraft/world/level/chunk/storage/EntityStorage.java
@@ -94,6 +_,7 @@
ListTag entities = new ListTag();
final java.util.Map<net.minecraft.world.entity.EntityType<?>, Integer> savedEntityCounts = new java.util.HashMap<>(); // Paper - Entity load/save limit per chunk
chunk.getEntities().forEach(e -> {
TagValueOutput output = TagValueOutput.createWithContext(reporter.forChild(e.problemPath()), e.registryAccess());
+ if (!e.canSaveToDisk()) return; // Purpur - Add canSaveToDisk to Entity
if (e.save(output)) {
CompoundTag result = output.buildResult();
entities.add(result);
// Paper start - Entity load/save limit per chunk
final EntityType<?> entityType = e.getType();
final int saveLimit = this.level.paperConfig().chunks.entityPerChunkSaveLimit.getOrDefault(entityType, -1);

View File

@@ -0,0 +1,11 @@
--- a/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
+++ b/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
@@ -309,7 +_,7 @@
// Paper start
private static void printOversizedLog(String msg, Path file, int x, int z) {
- LOGGER.error("{} ({} - {},{}) Go clean it up to remove this message. /minecraft:tp {} 128 {} - DO NOT REPORT THIS TO PAPER - You may ask for help on Discord, but do not file an issue. These error messages can not be removed.", msg, file.toString().replaceAll(".+[\\\\/]", ""), x, z, x << 4, z << 4);
+ LOGGER.error("{} ({} - {},{}) Go clean it up to remove this message. /minecraft:tp {} 128 {} - DO NOT REPORT THIS TO PURPUR - You may ask for help on Discord, but do not file an issue. These error messages can not be removed.", msg, file.toString().replaceAll(".+[\\\\/]", ""), x, z, x << 4, z << 4); // Purpur - Rebrand
}
private static CompoundTag readOversizedChunk(RegionFile regionfile, ChunkPos chunkCoordinate) throws IOException {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/material/FlowingFluid.java
+++ b/net/minecraft/world/level/material/FlowingFluid.java
@@ -192,7 +_,7 @@
@@ -234,7 +_,7 @@
}
}
@@ -9,7 +9,7 @@
BlockState belowState = level.getBlockState(mutablePos.setWithOffset(pos, Direction.DOWN));
FluidState belowFluid = belowState.getFluidState();
if (belowState.isSolid() || this.isSourceBlockOfThisType(belowFluid)) {
@@ -280,6 +_,12 @@
@@ -320,6 +_,12 @@
}
protected abstract boolean canConvertToSource(ServerLevel level);