From 526795bacd07c019fe3652c96d74cc9f91ecb1fd Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Fri, 12 Apr 2024 12:14:06 -0700 Subject: [PATCH] Update patches to handle vineflower decompiler (#10406) * Update patches to handle vineflower decompiler * update patches again to handle inlined simple lambdas * update vf again and re-apply/rebuild patches * update patches after removal of verify-merges flag * fix compile issue * remove maven local * fix some issues * address more issues * fix collision patch * use paperweight release * more fixes * update fineflower and fix patches again * add missing comment descriptor --------- Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com> --- build.gradle.kts | 6 +- patches/api/0002-Build-system-changes.patch | 2 +- patches/api/0003-Test-changes.patch | 2 +- patches/api/0005-Add-FastUtil-to-Bukkit.patch | 2 +- ...rovide-E-TE-Chunk-count-stat-methods.patch | 2 +- ...or-plugins-modifying-the-parent-of-t.patch | 2 +- ...-get-a-BlockState-without-a-snapshot.patch | 2 +- ...96-Add-Ban-Methods-to-Player-Objects.patch | 4 +- ...vide-Chunk-Coordinates-as-a-Long-API.patch | 2 +- ...Blocks-to-be-accessed-via-a-long-key.patch | 2 +- patches/api/0141-isChunkGenerated-API.patch | 2 +- ...-ray-tracing-methods-to-LivingEntity.patch | 2 +- ...156-Add-LivingEntity-getTargetEntity.patch | 2 +- .../0173-Fix-Spigot-annotation-mistakes.patch | 2 +- ...0175-PlayerDeathEvent-getItemsToKeep.patch | 2 +- patches/api/0176-Add-Heightmap-API.patch | 2 +- .../0178-Add-BlockSoundGroup-interface.patch | 2 +- ...182-Improve-Block-breakNaturally-API.patch | 2 +- ...layerDeathEvent-shouldDropExperience.patch | 2 +- patches/api/0185-Entity-Jump-API.patch | 2 +- patches/api/0195-Expose-game-version.patch | 4 +- ...yPickupItemAnimation-to-LivingEntity.patch | 2 +- ...224-Add-LivingEntity-clearActiveItem.patch | 2 +- ...9-Expose-LivingEntity-hurt-direction.patch | 2 +- patches/api/0263-Expand-world-key-API.patch | 4 +- .../0294-Add-more-line-of-sight-methods.patch | 2 +- patches/api/0297-Missing-Entity-API.patch | 2 +- patches/api/0301-Stinger-API.patch | 2 +- .../api/0342-Implement-regenerateChunk.patch | 2 +- ...Add-method-isTickingWorlds-to-Bukkit.patch | 4 +- patches/api/0364-More-Teleport-API.patch | 2 +- ...-swingHand-EquipmentSlot-convenience.patch | 2 +- .../api/0380-Add-entity-knockback-API.patch | 2 +- patches/api/0387-ItemStack-damage-API.patch | 2 +- patches/api/0389-Friction-API.patch | 2 +- .../api/0400-Add-Entity-Body-Yaw-API.patch | 2 +- ...-to-remove-all-active-potion-effects.patch | 2 +- ...place-methods-with-old-StructureType.patch | 4 +- .../api/0443-Add-Structure-check-API.patch | 2 +- .../api/0450-Add-HiddenPotionEffect-API.patch | 2 +- patches/server/0002-Remap-fixes.patch | 12 +- .../server/0003-Build-system-changes.patch | 28 +- patches/server/0004-Test-changes.patch | 2 +- patches/server/0005-Paper-config-files.patch | 12 +- patches/server/0006-MC-Dev-fixes.patch | 200 +++------- patches/server/0008-CB-fixes.patch | 24 +- patches/server/0009-MC-Utils.patch | 44 +-- patches/server/0010-Adventure.patch | 99 +++-- patches/server/0012-Paper-Metrics.patch | 4 +- patches/server/0013-Paper-Plugins.patch | 4 +- patches/server/0014-Timings-v2.patch | 2 +- ...016-Further-improve-server-tick-loop.patch | 2 +- ...-option-to-load-extra-plugin-jars-no.patch | 2 +- .../0022-Allow-nerfed-mobs-to-jump.patch | 2 +- ...4-Allow-for-toggling-of-spawn-chunks.patch | 2 +- ...ient-crashes-server-lists-and-Mojang.patch | 4 +- .../0029-Player-affects-spawning-API.patch | 10 +- ...nfigurable-top-of-nether-void-damage.patch | 2 +- .../0037-Configurable-end-credits.patch | 2 +- patches/server/0039-Optimize-explosions.patch | 4 +- patches/server/0041-Disable-thunder.patch | 2 +- .../server/0042-Disable-ice-and-snow.patch | 2 +- ...44-Implement-PlayerLocaleChangeEvent.patch | 2 +- ...figurable-container-update-tick-rate.patch | 2 +- ...051-Improve-Player-chat-API-handling.patch | 2 +- ...e-informative-in-maxHealth-exception.patch | 2 +- ...dd-configurable-portal-search-radius.patch | 2 +- .../server/0057-Add-velocity-warnings.patch | 2 +- ...oreboards-for-non-players-by-default.patch | 4 +- .../server/0069-Add-World-Util-Methods.patch | 2 +- ...0-Custom-replacement-for-eaten-items.patch | 2 +- ...th-absorb-values-and-repair-bad-data.patch | 2 +- ...072-Use-a-Shared-Random-for-Entities.patch | 8 +- ...le-spawn-chances-for-skeleton-horses.patch | 2 +- ...Entity-AddTo-RemoveFrom-World-Events.patch | 2 +- patches/server/0077-EntityPathfindEvent.patch | 38 +- ...9-Do-not-load-chunks-for-Pathfinding.patch | 10 +- ...0080-Add-PlayerUseUnknownEntityEvent.patch | 4 +- ...g-BlockPlaceEvent-triggering-physics.patch | 2 +- patches/server/0083-Optimize-DataBits.patch | 18 +- .../0085-Configurable-Player-Collision.patch | 6 +- .../0087-Configurable-RCON-IP-address.patch | 4 +- ...ityRegainHealthEvent-isFastRegen-API.patch | 2 +- ...-to-configure-frosted_ice-properties.patch | 11 +- ...y-scoreboard-teams-to-scoreboard.dat.patch | 6 +- ...able-API-and-replenishable-lootables.patch | 24 +- .../0094-Async-GameProfileCache-saving.patch | 2 +- ...r-redstone-torch-rapid-clock-removal.patch | 2 +- .../0097-Add-server-name-parameter.patch | 2 +- ...ptimise-BlockState-s-hashCode-equals.patch | 21 +- ...onfigurable-packet-in-spam-threshold.patch | 2 +- ...04-Configurable-flying-kick-messages.patch | 2 +- ...vent-Pathfinding-out-of-World-Border.patch | 4 +- ...ize-Level.hasChunkAt-BlockPosition-Z.patch | 2 +- ...figurable-Cartographer-Treasure-Maps.patch | 15 +- ...17-Properly-fix-item-duplication-bug.patch | 2 +- patches/server/0118-Firework-API-s.patch | 16 +- ...PI-for-Reason-Source-Triggering-play.patch | 2 +- .../server/0123-Cap-Entity-Collisions.patch | 4 +- ...le-async-calls-to-restart-the-server.patch | 2 +- ...oleAppender-for-console-improvements.patch | 4 +- ...-profile-lookups-to-worldgen-threads.patch | 4 +- .../0144-Fix-this-stupid-bullshit.patch | 2 +- ...n-prefixes-using-Log4J-configuration.patch | 2 +- patches/server/0151-Add-PlayerJumpEvent.patch | 2 +- .../0156-Add-PlayerArmorChangeEvent.patch | 2 +- ...-get-a-BlockState-without-a-snapshot.patch | 2 +- .../server/0161-AsyncTabCompleteEvent.patch | 2 +- ...4-PlayerNaturallySpawnCreaturesEvent.patch | 4 +- ...nt-extended-PaperServerListPingEvent.patch | 2 +- ...81-Flag-to-disable-the-channel-limit.patch | 2 +- ...0186-Block-Enderpearl-Travel-Exploit.patch | 2 +- .../0196-Fix-CraftEntity-hashCode.patch | 2 +- ...7-Configurable-LootPool-luck-formula.patch | 6 +- ...e-shield-blocking-delay-configurable.patch | 2 +- ...ackByEntityEvent-and-EntityPushedByE.patch | 40 +- ...to-disable-ender-dragon-legacy-check.patch | 2 +- .../0208-InventoryCloseEvent-Reason-API.patch | 2 +- ...r-to-keep-logging-IO-off-main-thread.patch | 2 +- ...-more-information-to-Entity.toString.patch | 2 +- patches/server/0213-EnderDragon-Events.patch | 6 +- .../server/0214-PlayerElytraBoostEvent.patch | 4 +- .../0215-PlayerLaunchProjectileEvent.patch | 66 +++- .../0216-Improve-BlockPosition-inlining.patch | 11 +- .../server/0220-SkeletonHorse-Additions.patch | 4 +- ...nd-make-tab-spam-limits-configurable.patch | 2 +- ...ies-option-to-debug-dupe-uuid-issues.patch | 6 +- ...dd-Early-Warning-Feature-to-WatchDog.patch | 2 +- ...ptimize-BlockPosition-helper-methods.patch | 4 +- .../server/0238-Optimize-MappedRegistry.patch | 10 +- ...-ray-tracing-methods-to-LivingEntity.patch | 4 +- ...e-attack-cooldown-methods-for-Player.patch | 2 +- .../server/0245-Improve-death-events.patch | 27 +- patches/server/0247-Mob-Pathfinding-API.patch | 2 +- ...interactions-from-causing-chunk-load.patch | 2 +- ...257-Add-LivingEntity-getTargetEntity.patch | 4 +- ...xception-in-entity-and-block-entity-.patch | 6 +- ...tator-target-events-and-improve-impl.patch | 2 +- ...event-players-from-moving-into-unloa.patch | 2 +- ...65-Reset-players-airTicks-on-respawn.patch | 2 +- ...er-Thread-Pool-and-Thread-Priorities.patch | 12 +- .../0268-Optimize-World-Time-Updates.patch | 2 +- ...t-allow-digging-into-unloaded-chunks.patch | 2 +- ...e-Large-Packets-disconnecting-client.patch | 11 +- ...entity-dismount-during-teleportation.patch | 4 +- patches/server/0276-Book-Size-Limits.patch | 2 +- ...-Replace-OfflinePlayer-getLastPlayed.patch | 2 +- ...vehicle-tracking-issue-on-disconnect.patch | 2 +- ...r-remove-if-the-handle-is-a-custom-p.patch | 2 +- .../0282-Async-command-map-building.patch | 2 +- .../server/0283-Brigadier-Mojang-API.patch | 4 +- ...rove-exact-choice-recipe-ingredients.patch | 46 +-- .../0287-Entity-getEntitySpawnReason.patch | 12 +- .../server/0288-Fire-event-on-GS4-query.patch | 12 +- patches/server/0291-Server-Tick-Events.patch | 2 +- ...0292-PlayerDeathEvent-getItemsToKeep.patch | 2 +- ...n-item-frames-are-modified-MC-123450.patch | 2 +- ...le-Keep-Spawn-Loaded-range-per-world.patch | 2 +- ...ate-location-if-we-failed-to-read-it.patch | 2 +- .../0304-offset-item-frame-ticking.patch | 2 +- ...revent-consuming-the-wrong-itemstack.patch | 2 +- ...nk-loads-when-villagers-try-to-find-.patch | 6 +- ...5656-Fix-Follow-Range-Initial-Target.patch | 14 +- ...layerDeathEvent-shouldDropExperience.patch | 2 +- ...Chunks-from-Hoppers-and-other-things.patch | 6 +- ...ptimise-EntityGetter-getPlayerByUUID.patch | 2 +- ...mize-call-to-getFluid-for-explosions.patch | 2 +- .../0320-Tracking-Range-Improvements.patch | 2 +- ...x-items-vanishing-through-end-portal.patch | 2 +- .../0325-Add-debug-for-sync-chunk-loads.patch | 2 +- patches/server/0328-Entity-Jump-API.patch | 2 +- ...n-to-nerf-pigmen-from-nether-portals.patch | 2 +- ...spawn-settings-and-per-player-option.patch | 2 +- ...nnections-shouldn-t-hold-up-shutdown.patch | 6 +- ...-PlayerChunkMap-adds-crashing-server.patch | 4 +- .../server/0344-Don-t-tick-dead-players.patch | 2 +- ...move-existing-players-to-world-spawn.patch | 2 +- .../server/0347-Optimize-Pathfinding.patch | 4 +- ...duce-memory-footprint-of-CompoundTag.patch | 10 +- ...vent-opening-inventories-when-frozen.patch | 2 +- ...-entity-collision-code-if-not-needed.patch | 2 +- ...-Implement-Player-Client-Options-API.patch | 4 +- ...nEvent-when-Player-is-actually-ready.patch | 2 +- ...pawn-point-if-spawn-in-unloaded-worl.patch | 2 +- ...PlayerAttackEntityCooldownResetEvent.patch | 2 +- ...item-duplication-and-teleport-issues.patch | 2 +- ...PickItem-Packet-and-kick-for-invalid.patch | 2 +- ...-per-thread-native-byte-buffer-cache.patch | 2 +- .../server/0364-misc-debugging-dumps.patch | 2 +- ...65-Prevent-teleporting-dead-entities.patch | 2 +- ...ktraces-in-log-messages-crash-report.patch | 8 +- .../server/0367-Implement-Mob-Goal-API.patch | 2 +- .../0368-Add-villager-reputation-API.patch | 4 +- ...1-Fix-PotionEffect-ignores-icon-flag.patch | 2 +- ...Wait-for-Async-Tasks-during-shutdown.patch | 2 +- ...ston-physics-inconsistency-MC-188840.patch | 4 +- ...ssing-chunks-due-to-integer-overflow.patch | 8 +- ...ld-Difficulty-Remembering-Difficulty.patch | 2 +- ...0394-Support-old-UUID-format-for-NBT.patch | 10 +- ...k-for-portal-on-world-gen-entity-add.patch | 2 +- ...4-Bukkit-world-container-is-not-used.patch | 4 +- ...ataPlayer-leak-due-from-quitting-ear.patch | 13 +- ...ze-NetworkManager-Exception-Handling.patch | 8 +- ...Fix-some-rails-connecting-improperly.patch | 12 +- patches/server/0411-Brand-support.patch | 2 +- ...-Add-methods-to-get-translation-keys.patch | 2 +- .../0426-Cache-block-data-strings.patch | 2 +- ...ortation-and-cancel-velocity-if-tele.patch | 2 +- ...-non-whitelisted-player-when-white-l.patch | 2 +- ...x-Concurrency-issue-in-ShufflingList.patch | 14 +- ...ace-order-when-capturing-blockstates.patch | 2 +- ...blockpos-allocation-from-pathfinding.patch | 22 +- ...ix-client-lag-on-advancement-loading.patch | 2 +- .../server/0451-Add-API-for-quit-reason.patch | 2 +- ...prove-performance-of-the-end-generat.patch | 26 +- ...-should-not-bypass-cramming-gamerule.patch | 2 +- .../0462-Add-PlayerShearBlockEvent.patch | 30 +- ...0465-Player-Chunk-Load-Unload-Events.patch | 10 +- patches/server/0470-Add-TargetHitEvent.patch | 8 +- .../0471-MC-4-Fix-item-position-desync.patch | 18 +- ...8-Add-PlayerFlowerPotManipulateEvent.patch | 2 +- ...484-Add-ServerResourcesReloadedEvent.patch | 2 +- ...onfigurable-door-breaking-difficulty.patch | 4 +- ...n-for-requiring-a-player-participant.patch | 2 +- ...-shield-blocking-on-dimension-change.patch | 2 +- patches/server/0508-Add-EntityMoveEvent.patch | 4 +- .../0510-Inline-shift-direction-fields.patch | 17 +- ...-entity-allow-attribute-registration.patch | 8 +- patches/server/0517-Improve-ServerGUI.patch | 10 +- ...0518-fix-converting-txt-to-json-file.patch | 2 +- ...lternative-constructor-for-Rotations.patch | 2 +- ...telist-use-configurable-kick-message.patch | 2 +- ...ItemConsumeEvent-cancelling-properly.patch | 2 +- ...557-Expand-PlayerGameModeChangeEvent.patch | 20 +- .../0564-Add-EntityInsideBlockEvent.patch | 22 +- .../0569-Add-PlayerKickEvent-causes.patch | 40 +- ...ttedContainer-instead-of-ThreadingDe.patch | 20 +- .../0575-Fix-invulnerable-end-crystals.patch | 6 +- .../0577-Fix-dangerous-end-portal-logic.patch | 2 +- ...e-Biome-Mob-Lookups-for-Mob-Spawning.patch | 14 +- .../server/0580-Line-Of-Sight-Changes.patch | 4 +- ...PlayerDropItemEvent-using-wrong-item.patch | 2 +- patches/server/0585-Missing-Entity-API.patch | 4 +- ...etChunkIfLoadedImmediately-in-places.patch | 2 +- ...k-event-leave-message-not-being-sent.patch | 2 +- ...g-for-mobs-immune-to-default-effects.patch | 2 +- ...n-t-apply-cramming-damage-to-players.patch | 2 +- ...nd-timings-for-sensors-and-behaviors.patch | 28 +- .../0595-Add-missing-forceDrop-toggles.patch | 6 +- patches/server/0596-Stinger-API.patch | 2 +- .../server/0602-Add-PlayerSetSpawnEvent.patch | 2 +- ...mize-entity-tracker-passenger-checks.patch | 2 +- ...ptimize-indirect-passenger-iteration.patch | 2 +- ...tem-frame-map-cursor-update-interval.patch | 2 +- .../0611-Add-BlockBreakBlockEvent.patch | 4 +- .../0615-Add-back-EntityPortalExitEvent.patch | 2 +- .../0619-Add-more-advancement-API.patch | 8 +- .../0622-Fix-issues-with-mob-conversion.patch | 6 +- ...26-Add-Raw-Byte-Entity-Serialization.patch | 2 +- ...-logic-for-inventories-on-chunk-unlo.patch | 2 +- ...0630-Improve-and-expand-AsyncCatcher.patch | 4 +- ...itize-ResourceLocation-error-logging.patch | 6 +- ...ally-inline-methods-in-BlockPosition.patch | 16 +- ...d-getChunkAt-has-inlined-logic-for-l.patch | 2 +- .../0647-Ensure-valid-vehicle-status.patch | 2 +- ...or-causing-a-crash-when-trying-to-ge.patch | 4 +- ...date-head-rotation-in-missing-places.patch | 2 +- ...-unintended-light-block-manipulation.patch | 4 +- ...-t-attempt-to-teleport-dead-entities.patch | 2 +- ...sive-velocity-through-repeated-crits.patch | 2 +- ...de-code-using-deprecated-for-removal.patch | 11 +- ...oversized-item-data-in-equipment-and.patch | 8 +- ...de-unnecessary-itemmeta-from-clients.patch | 4 +- .../0666-Fix-Spigot-growth-modifiers.patch | 12 +- .../server/0669-Optimize-HashMapPalette.patch | 2 +- ...ward-CraftEntity-in-teleport-command.patch | 2 +- ...max-block-light-for-monster-spawning.patch | 4 +- ...mplifiers-greater-than-127-correctly.patch | 4 +- ...ter-animal-spawn-height-configurable.patch | 6 +- ...89-Multiple-Entries-with-Scoreboards.patch | 6 +- .../server/0695-Freeze-Tick-Lock-API.patch | 6 +- ...d-missing-structure-set-seed-configs.patch | 25 +- ...sks-fairly-for-worlds-while-waiting-.patch | 2 +- ...igurable-sculk-sensor-listener-range.patch | 19 +- ...efault-CustomSpawners-in-custom-worl.patch | 2 +- ...o-worldlist-before-initing-the-world.patch | 2 +- .../0710-Fix-Entity-Position-Desync.patch | 2 +- patches/server/0711-Custom-Potion-Mixes.patch | 18 +- ...ix-swamp-hut-cat-generation-deadlock.patch | 21 +- .../0724-Add-TameableDeathMessageEvent.patch | 4 +- ...ables-running-when-mob-loot-gamerule.patch | 2 +- ...assenger-world-matches-ridden-entity.patch | 2 +- ...llow-changing-the-EnderDragon-podium.patch | 62 +-- ...E-in-CraftPersistentDataTypeRegistry.patch | 2 +- .../0740-Add-PlayerStopUsingItemEvent.patch | 2 +- .../0743-Add-support-for-Proxy-Protocol.patch | 2 +- .../0747-Sanitize-sent-BlockEntity-NBT.patch | 4 +- ...t-selector-resolving-in-books-by-def.patch | 4 +- ...entity-loading-causing-async-lookups.patch | 2 +- ...n-on-world-create-while-being-ticked.patch | 2 +- .../0752-Add-WardenAngerChangeEvent.patch | 10 +- ...-strict-advancement-dimension-checks.patch | 6 +- ...-chunk-for-dynamic-game-event-listen.patch | 4 +- ...us-missing-EntityDropItemEvent-calls.patch | 2 +- .../0765-Add-EntityPortalReadyEvent.patch | 2 +- ...-Add-and-fix-missing-BlockFadeEvents.patch | 14 +- ...ix-plugin-loggers-on-server-shutdown.patch | 2 +- ...ook-changes-from-crashing-the-server.patch | 2 +- ...ntityChangeBlockEvent-in-more-places.patch | 16 +- .../server/0780-Missing-effect-cause.patch | 14 +- ...arameter-to-ProjectileSource-launchP.patch | 2 +- ...83-Call-BlockPhysicsEvent-more-often.patch | 4 +- .../0786-fix-Jigsaw-block-kicking-user.patch | 8 +- .../0789-Fix-a-bunch-of-vanilla-bugs.patch | 76 ++-- ...4-Add-PlayerInventorySlotChangeEvent.patch | 2 +- .../0800-Add-EntityToggleSitEvent.patch | 4 +- ...tEvent-cancellation-cant-fully-preve.patch | 2 +- ...global-player-list-where-appropriate.patch | 14 +- patches/server/0816-Friction-API.patch | 2 +- .../0819-Sync-offhand-slot-in-menus.patch | 2 +- .../0820-Player-Entity-Tracking-Events.patch | 2 +- ...and-additions-to-the-SpawnReason-API.patch | 12 +- ...-for-some-hot-BlockBehavior-and-Flui.patch | 2 +- .../0827-Add-Sneaking-API-for-Entities.patch | 2 +- .../0828-Improve-logging-and-errors.patch | 6 +- .../server/0829-Improve-PortalEvents.patch | 2 +- ...sion-moving-velocity-to-VehicleBlock.patch | 2 +- ...nk-items-during-EntityResurrectEvent.patch | 2 +- ...event-sleeping-villagers-moving-towa.patch | 20 +- .../0844-Add-EntityFertilizeEggEvent.patch | 8 +- ...vancement-triggers-for-entity-damage.patch | 2 +- ...0849-Fix-text-display-error-on-spawn.patch | 16 +- ...expired-keys-from-impacting-new-join.patch | 32 +- ...-Lazy-Initialization-for-Enum-Fields.patch | 10 +- ...access-to-lookups-field-in-RegistryO.patch | 11 +- ...esh-ProjectileSource-for-projectiles.patch | 2 +- ...ll-BlockGrowEvent-for-missing-blocks.patch | 12 +- ...-to-remove-all-active-potion-effects.patch | 2 +- ...crafting-result-amount-for-fireworks.patch | 4 +- ...-Add-option-to-disable-block-updates.patch | 36 +- ...d-chunks-for-supporting-block-checks.patch | 2 +- ...nd-water-fluid-explosion-resistance-.patch | 4 +- .../server/0893-Add-whitelist-events.patch | 4 +- ...Folia-scheduler-and-owned-region-API.patch | 4 +- ...ata-neighbour-ticks-outside-of-range.patch | 10 +- .../0914-Add-Listing-API-for-Player.patch | 31 +- ...nfigurable-Region-Compression-Format.patch | 10 +- patches/server/0918-Expand-Pose-API.patch | 4 +- ...-titleOverride-to-InventoryOpenEvent.patch | 2 +- ...928-Configure-sniffer-egg-hatch-time.patch | 6 +- ...Skip-POI-finding-if-stuck-in-vehicle.patch | 18 +- ...on-on-UpgradeData.BlockFixers-class-.patch | 10 +- patches/server/0950-Optimize-VarInts.patch | 8 +- ...tem-packets-with-collector-as-source.patch | 2 +- ...g-event-call-for-entity-teleport-API.patch | 2 +- ...ly-create-LootContext-for-criterions.patch | 6 +- ...n-t-fire-sync-events-during-worldgen.patch | 4 +- ...estore-vanilla-entity-drops-behavior.patch | 6 +- patches/server/0968-Improve-Registry.patch | 4 +- ...-on-null-loc-for-EntityTeleportEvent.patch | 2 +- ...date-ResourceLocation-in-NBT-reading.patch | 16 +- ...llocation-of-Vec3D-by-entity-tracker.patch | 4 +- .../0978-Rewrite-dataconverter-system.patch | 16 +- patches/server/0979-Starlight.patch | 107 +++--- .../server/0980-Rewrite-chunk-system.patch | 269 +++++++------ ...-incremental-chunk-and-player-saving.patch | 2 +- ...ldBounds-and-getBlockState-for-inlin.patch | 14 +- ...cing-for-EntityLiving-hasLineOfSight.patch | 2 +- ...0988-Flat-bedrock-generator-settings.patch | 15 +- .../0989-Entity-Activation-Range-2.0.patch | 33 +- .../0990-Optional-per-player-mob-spawns.patch | 2 +- patches/server/0991-Anti-Xray.patch | 85 +++-- ...ng-PreCreatureSpawnEvent-with-per-pl.patch | 2 +- ...ptimize-Collision-to-not-load-chunks.patch | 98 +++-- ...oalSelector-Goal.Flag-Set-operations.patch | 39 +- ...995-Entity-load-save-limit-per-chunk.patch | 4 +- .../0997-Improved-Watchdog-Support.patch | 6 +- .../0998-Optimize-Voxel-Shape-Merging.patch | 20 +- .../0999-Write-SavedData-IO-async.patch | 4 +- ...tance-map-to-optimise-entity-tracker.patch | 2 +- ...-Optimize-Bit-Operations-by-inlining.patch | 26 +- .../1003-Remove-streams-from-hot-code.patch | 129 +++---- ...der-Remove-Streams-Optimized-collect.patch | 39 +- ...erTradeEvent-and-PlayerPurchaseEvent.patch | 2 +- ...7-Improve-boat-collision-performance.patch | 14 +- .../1008-Optimise-general-POI-access.patch | 113 +++--- ...lementation-for-blockstate-state-loo.patch | 28 +- .../1011-Optimise-random-block-ticking.patch | 12 +- ...culate-regionfile-header-if-it-is-co.patch | 10 +- ...ocity-compression-and-cipher-natives.patch | 38 +- ...l-more-information-in-watchdog-dumps.patch | 2 +- .../server/1015-Collision-optimisations.patch | 355 ++++++++++-------- ...y-type-tags-suggestions-in-selectors.patch | 34 +- .../1021-Properly-resend-entities.patch | 4 +- patches/server/1022-Optimize-Hoppers.patch | 8 +- ...3-Improve-performance-of-mass-crafts.patch | 6 +- .../1024-Actually-optimise-explosions.patch | 12 +- .../1025-Optimise-chunk-tick-iteration.patch | 2 +- .../server/1026-Lag-compensation-ticks.patch | 2 +- ...027-Optimise-nearby-player-retrieval.patch | 39 +- ...e-Oversized-block-entities-in-chunks.patch | 6 +- .../1034-Improve-tag-parser-handling.patch | 37 +- ...ing-message-for-initial-server-start.patch | 2 +- .../server/1051-Fix-DamageSource-API.patch | 2 +- 404 files changed, 2082 insertions(+), 2153 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 20d7b5902b..8a445eca12 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -11,7 +11,7 @@ plugins { java `maven-publish` id("com.github.johnrengelman.shadow") version "8.1.1" apply false - id("io.papermc.paperweight.core") version "1.5.13" + id("io.papermc.paperweight.core") version "1.5.15" } allprojects { @@ -69,7 +69,7 @@ repositories { dependencies { paramMappings("net.fabricmc:yarn:1.20.4+build.1:mergedv2") remapper("net.fabricmc:tiny-remapper:0.10.1:fat") - decompiler("net.minecraftforge:forgeflower:2.0.627.2") + decompiler("org.vineflower:vineflower:1.11.0-20240412.144930-14") spigotDecompiler("io.papermc:patched-spigot-fernflower:0.1+build.6") paperclip("io.papermc:paperclip:3.0.3") } @@ -80,7 +80,7 @@ paperweight { paramMappingsRepo = paperMavenPublicUrl remapRepo = paperMavenPublicUrl - decompileRepo = paperMavenPublicUrl + decompileRepo = "https://s01.oss.sonatype.org/content/repositories/snapshots/" craftBukkit { fernFlowerJar = layout.file(spigotDecompiler.elements.map { it.single().asFile }) diff --git a/patches/api/0002-Build-system-changes.patch b/patches/api/0002-Build-system-changes.patch index 181ce6e8d4..c70df0a834 100644 --- a/patches/api/0002-Build-system-changes.patch +++ b/patches/api/0002-Build-system-changes.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Build system changes diff --git a/build.gradle.kts b/build.gradle.kts -index fd076ab0df328818873028d333b0716d5b3796a9..4a62bb7c89c25e11e7f514fbcbc35a408ed83856 100644 +index 4756a5aa04f8a8f0a8f9ff2c7aa6776b5a6892a5..a1f46208d1f39de54b73c66c3c4284b6f8c86864 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -18,15 +18,26 @@ dependencies { diff --git a/patches/api/0003-Test-changes.patch b/patches/api/0003-Test-changes.patch index 7dff52763f..9d809b4327 100644 --- a/patches/api/0003-Test-changes.patch +++ b/patches/api/0003-Test-changes.patch @@ -12,7 +12,7 @@ Co-authored-by: Riley Park Co-authored-by: Jake Potrebic diff --git a/build.gradle.kts b/build.gradle.kts -index cc586ca58c9ef852d7154f29c2dc187047f2c64a..948bd84db9923ef43cf753b7b72bf4d0081ab43a 100644 +index a1f46208d1f39de54b73c66c3c4284b6f8c86864..be4d301b305f5cd92d2ff352bfb9c6ff9f82fd9b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -105,6 +105,12 @@ tasks.test { diff --git a/patches/api/0005-Add-FastUtil-to-Bukkit.patch b/patches/api/0005-Add-FastUtil-to-Bukkit.patch index b84756a5d7..e3121abf57 100644 --- a/patches/api/0005-Add-FastUtil-to-Bukkit.patch +++ b/patches/api/0005-Add-FastUtil-to-Bukkit.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Add FastUtil to Bukkit Doesn't expose to plugins, just allows Paper-API to use it for optimization diff --git a/build.gradle.kts b/build.gradle.kts -index b9bf992867115fe6e84091a1a0b1f220de751699..cc8f297a71eb75b3388ff1cb21a297e268894aac 100644 +index 01e3a5ba74f8d4c4c2eb010b289e2a7785b11bcc..f605e7e0f812a2297b1cecf3f37b69a8edc6b4a5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -23,6 +23,7 @@ dependencies { diff --git a/patches/api/0052-Provide-E-TE-Chunk-count-stat-methods.patch b/patches/api/0052-Provide-E-TE-Chunk-count-stat-methods.patch index 54af8d0c41..f53ba6d986 100644 --- a/patches/api/0052-Provide-E-TE-Chunk-count-stat-methods.patch +++ b/patches/api/0052-Provide-E-TE-Chunk-count-stat-methods.patch @@ -7,7 +7,7 @@ Provides counts without the ineffeciency of using .getEntities().size() which creates copy of the collections. diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 41a181b890e029f99e52ae9aad28a86f28005f9e..fa6f6c8eccd680a4e83443e472f37650e7cd05c5 100644 +index 7176e37b37c0d22605240f3c5fd34ff7846256c9..2b38b328187b853f5b36d796d3b6b359497647d8 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -49,6 +49,33 @@ import org.jetbrains.annotations.Nullable; diff --git a/patches/api/0073-Add-workaround-for-plugins-modifying-the-parent-of-t.patch b/patches/api/0073-Add-workaround-for-plugins-modifying-the-parent-of-t.patch index 3b10918fc8..31d32bcc2b 100644 --- a/patches/api/0073-Add-workaround-for-plugins-modifying-the-parent-of-t.patch +++ b/patches/api/0073-Add-workaround-for-plugins-modifying-the-parent-of-t.patch @@ -93,7 +93,7 @@ index 7cd9f98c042dc2bb80876af35c755f81bef34651..5cd236965de12392d8c7aa81307c0ff1 /** diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java -index 74b6581a97a092c44a0876e7981ff8a8e6153100..d6d3e1332e51adc5611543b2a6689efa5921a9f2 100644 +index 58d20eff7e0da2d7fcb1609d55e4284715355634..8c5597e02d71c8db66e9cd11f0a41776eb471c46 100644 --- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java +++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java @@ -67,6 +67,7 @@ public final class PluginClassLoader extends URLClassLoader implements io.paperm diff --git a/patches/api/0075-API-to-get-a-BlockState-without-a-snapshot.patch b/patches/api/0075-API-to-get-a-BlockState-without-a-snapshot.patch index 323b157741..6e95f52cbd 100644 --- a/patches/api/0075-API-to-get-a-BlockState-without-a-snapshot.patch +++ b/patches/api/0075-API-to-get-a-BlockState-without-a-snapshot.patch @@ -9,7 +9,7 @@ on the real tile entity. This is useful for where performance is needed diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java -index 870ad6cd930653e6248abcc0fce94ffafbe9ebde..9f4d383ea3d6b26d16b8b77ca4c29d2d839ad6dd 100644 +index bda4ab21b3ac2acbe328c0c6887c33283399971e..f3b3606dc5881e931853fc2631aad9ca9083474d 100644 --- a/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java @@ -272,6 +272,16 @@ public interface Block extends Metadatable, Translatable { diff --git a/patches/api/0096-Add-Ban-Methods-to-Player-Objects.patch b/patches/api/0096-Add-Ban-Methods-to-Player-Objects.patch index dca2c8b86c..4efdc4fed1 100644 --- a/patches/api/0096-Add-Ban-Methods-to-Player-Objects.patch +++ b/patches/api/0096-Add-Ban-Methods-to-Player-Objects.patch @@ -8,7 +8,7 @@ Allows a more logical API for banning players. player.banPlayer("Breaking the rules"); diff --git a/src/main/java/org/bukkit/OfflinePlayer.java b/src/main/java/org/bukkit/OfflinePlayer.java -index abbf3d6f11350ab2dd47a277771d9f46221036bd..d8a3b6cb2d0cb035b2ab09e0327bc4f0be457ff7 100644 +index abbf3d6f11350ab2dd47a277771d9f46221036bd..ef85e57f812c501fac7abe7dd27c93702f66646f 100644 --- a/src/main/java/org/bukkit/OfflinePlayer.java +++ b/src/main/java/org/bukkit/OfflinePlayer.java @@ -67,6 +67,73 @@ public interface OfflinePlayer extends ServerOperator, AnimalTamer, Configuratio @@ -86,7 +86,7 @@ index abbf3d6f11350ab2dd47a277771d9f46221036bd..d8a3b6cb2d0cb035b2ab09e0327bc4f0 /** * Adds this user to the {@link ProfileBanList}. If a previous ban exists, this will diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index b1d93f16c55d3fa9a157cf26286936a799ca8025..0c13a41b442b441cba322e03a6cd4da7efb40902 100644 +index d06f9b4d0117515fb8fcf78d416dcd2b4ef6fb4b..3b80cb874dccf2ed4fde4c621f0f022ba1112bcd 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -1173,6 +1173,186 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM diff --git a/patches/api/0133-Provide-Chunk-Coordinates-as-a-Long-API.patch b/patches/api/0133-Provide-Chunk-Coordinates-as-a-Long-API.patch index 55e2525efc..d2a1664557 100644 --- a/patches/api/0133-Provide-Chunk-Coordinates-as-a-Long-API.patch +++ b/patches/api/0133-Provide-Chunk-Coordinates-as-a-Long-API.patch @@ -44,7 +44,7 @@ index a25f112f4d679946ddcb5ec9b4d0a0e2d1795bd3..57976bbe682d2309f7d15d5dcd3ad7f8 * Gets the world containing this chunk * diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index ad7e2b624d5929beee5268151bda3abe9dfbb786..9c22650c299ab063a7e558408ce6c203c79d11fd 100644 +index 2aafd966778ee0f6adcbb3ea3772cb2104f8e687..9e941753819214e75b9d712bb59e8d49427e6f8b 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -182,6 +182,37 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient diff --git a/patches/api/0136-Allow-Blocks-to-be-accessed-via-a-long-key.patch b/patches/api/0136-Allow-Blocks-to-be-accessed-via-a-long-key.patch index fa5588a81f..6e66f2ae02 100644 --- a/patches/api/0136-Allow-Blocks-to-be-accessed-via-a-long-key.patch +++ b/patches/api/0136-Allow-Blocks-to-be-accessed-via-a-long-key.patch @@ -50,7 +50,7 @@ index 41125de49db8eafce4be59cc110ce5be06836a47..042d69e6d4584eb6d678b8ea13a3e4be * @return A new location where X/Y/Z are the center of the block */ diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 9c22650c299ab063a7e558408ce6c203c79d11fd..036a8ddc82a82800275d654d3fc00a9d30215350 100644 +index 9e941753819214e75b9d712bb59e8d49427e6f8b..48f2c64491f93e5ac720bdb19a20f3f435a7e888 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -99,6 +99,41 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient diff --git a/patches/api/0141-isChunkGenerated-API.patch b/patches/api/0141-isChunkGenerated-API.patch index 642a714f64..bfe9b14df9 100644 --- a/patches/api/0141-isChunkGenerated-API.patch +++ b/patches/api/0141-isChunkGenerated-API.patch @@ -37,7 +37,7 @@ index 042d69e6d4584eb6d678b8ea13a3e4bea78703b8..02b4ffa6b918269bd64f7c518fcceef1 /** diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 036a8ddc82a82800275d654d3fc00a9d30215350..25ff747e23e7373bb96ca9109df7e46cdefdcd2e 100644 +index 48f2c64491f93e5ac720bdb19a20f3f435a7e888..8bef6168caf0932a5a64cf69eb7988fa3191b13a 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -248,6 +248,19 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient diff --git a/patches/api/0144-Add-ray-tracing-methods-to-LivingEntity.patch b/patches/api/0144-Add-ray-tracing-methods-to-LivingEntity.patch index 40f75bfea1..46969f1d74 100644 --- a/patches/api/0144-Add-ray-tracing-methods-to-LivingEntity.patch +++ b/patches/api/0144-Add-ray-tracing-methods-to-LivingEntity.patch @@ -78,7 +78,7 @@ index 0000000000000000000000000000000000000000..c896d172519a8552a132031cb956378d + } +} diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 3a2f5ba52c6be8930f7b411476b36afc161834c9..b7bf0cc404634693d03c6700dc50c92697951c37 100644 +index 81a851580f81b2d6f6a2b2ebec38530f1d68530d..e6e0e16d122d78a160af549e4419e49dc046fb08 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java @@ -85,6 +85,98 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource diff --git a/patches/api/0156-Add-LivingEntity-getTargetEntity.patch b/patches/api/0156-Add-LivingEntity-getTargetEntity.patch index d8cc204978..8447dca548 100644 --- a/patches/api/0156-Add-LivingEntity-getTargetEntity.patch +++ b/patches/api/0156-Add-LivingEntity-getTargetEntity.patch @@ -51,7 +51,7 @@ index 0000000000000000000000000000000000000000..af8765b213390cf75fe02a6eb68aecf7 + } +} diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index b7bf0cc404634693d03c6700dc50c92697951c37..47c4096699bc0334eacf10b6403c4a4329797f0e 100644 +index e6e0e16d122d78a160af549e4419e49dc046fb08..d8ac9ce8e448f8b3bc39ec6c140db0e25d14cec7 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java @@ -175,6 +175,77 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource diff --git a/patches/api/0173-Fix-Spigot-annotation-mistakes.patch b/patches/api/0173-Fix-Spigot-annotation-mistakes.patch index daafa8ea7f..5a9e1829f9 100644 --- a/patches/api/0173-Fix-Spigot-annotation-mistakes.patch +++ b/patches/api/0173-Fix-Spigot-annotation-mistakes.patch @@ -848,7 +848,7 @@ index f124b35ec76e6cb6a1a0dc464005087043c3efd0..f50aaddf8582be55fd4860ad374d8f22 +@Deprecated(forRemoval = true) // Paper public interface LingeringPotion extends ThrownPotion { } diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 6dbd3524af80adc9dd7a94444e668220d3fccaea..3e5b7dc8f72bd211a18ec6a930c4f02beea4205a 100644 +index d8ac9ce8e448f8b3bc39ec6c140db0e25d14cec7..2f9299f407692c51dca17ca38a6135dde259b895 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java @@ -716,7 +716,9 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource diff --git a/patches/api/0175-PlayerDeathEvent-getItemsToKeep.patch b/patches/api/0175-PlayerDeathEvent-getItemsToKeep.patch index 84583589fa..cf8c6281f8 100644 --- a/patches/api/0175-PlayerDeathEvent-getItemsToKeep.patch +++ b/patches/api/0175-PlayerDeathEvent-getItemsToKeep.patch @@ -8,7 +8,7 @@ Exposes a mutable array on items a player should keep on death Example Usage: https://gist.github.com/aikar/5bb202de6057a051a950ce1f29feb0b4 diff --git a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java -index 59b84a0e07ddc214a419d5b59ab3a86c5ab63b78..3ce76cfb09f6f5eb55e950843bdd846b2b561116 100644 +index 38f81772edacb178e21c3f273e8c41ed46177d6d..9719e183036c361b909b203593c067a551b82264 100644 --- a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java +++ b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java @@ -37,7 +37,6 @@ public class PlayerDeathEvent extends EntityDeathEvent { diff --git a/patches/api/0176-Add-Heightmap-API.patch b/patches/api/0176-Add-Heightmap-API.patch index 848d5fcfcb..bfa338c360 100644 --- a/patches/api/0176-Add-Heightmap-API.patch +++ b/patches/api/0176-Add-Heightmap-API.patch @@ -102,7 +102,7 @@ index f0878c7539696cc0676e6010e88914d3850acf20..c6049747fc286acb4e8053901fcc517e /** * Creates explosion at this location with given power diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index bc5dd4182c5dd0a0d576410a68c445e3d006ae18..24ce9966140730c581c0709b14280e62a58331fa 100644 +index 0023b9737353c3c7dcfb38a143761bd8c03acf0d..0a7c97aa289687cfbf6ae1a222f5eb2850f8f43e 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -153,6 +153,87 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient diff --git a/patches/api/0178-Add-BlockSoundGroup-interface.patch b/patches/api/0178-Add-BlockSoundGroup-interface.patch index 34ee41dfd3..91f609d1e3 100644 --- a/patches/api/0178-Add-BlockSoundGroup-interface.patch +++ b/patches/api/0178-Add-BlockSoundGroup-interface.patch @@ -76,7 +76,7 @@ index 0000000000000000000000000000000000000000..ec36942128cbacae171584c89480b4aa + Sound getFallSound(); +} diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java -index da03d5964f5f007ab338980cbb67e4335b1ae4b4..2011858eb3edeab1516198021436c3df294a8ab4 100644 +index c7ef0386a09a07a2317c56274ed41218dfd7153d..f468e9751f75fd355512e033c180de967de5b2d8 100644 --- a/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java @@ -616,4 +616,25 @@ public interface Block extends Metadatable, Translatable { diff --git a/patches/api/0182-Improve-Block-breakNaturally-API.patch b/patches/api/0182-Improve-Block-breakNaturally-API.patch index d4871c1eb0..54820995ca 100644 --- a/patches/api/0182-Improve-Block-breakNaturally-API.patch +++ b/patches/api/0182-Improve-Block-breakNaturally-API.patch @@ -10,7 +10,7 @@ Adds bool param to trigger exp drops for blocks Co-authored-by: William Blake Galbreath diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java -index 2b267d4c9adcc13722d4a655a98ca16a0f9746ca..22cfffddb681a7ed95e19f4da6e2c272d22a6f69 100644 +index f468e9751f75fd355512e033c180de967de5b2d8..bf29d9b733afc7c62725d259f4920c4f211cc6d0 100644 --- a/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java @@ -481,6 +481,52 @@ public interface Block extends Metadatable, Translatable { diff --git a/patches/api/0183-PlayerDeathEvent-shouldDropExperience.patch b/patches/api/0183-PlayerDeathEvent-shouldDropExperience.patch index bc0edf43a4..fafa02c732 100644 --- a/patches/api/0183-PlayerDeathEvent-shouldDropExperience.patch +++ b/patches/api/0183-PlayerDeathEvent-shouldDropExperience.patch @@ -5,7 +5,7 @@ Subject: [PATCH] PlayerDeathEvent#shouldDropExperience diff --git a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java -index 3ce76cfb09f6f5eb55e950843bdd846b2b561116..dad291ad8cd16d24d587e771a8b60cfb5d0bce2a 100644 +index 9719e183036c361b909b203593c067a551b82264..66e9d65a8dd05bed05d0ab46ec64206a6dae0507 100644 --- a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java +++ b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java @@ -16,6 +16,7 @@ public class PlayerDeathEvent extends EntityDeathEvent { diff --git a/patches/api/0185-Entity-Jump-API.patch b/patches/api/0185-Entity-Jump-API.patch index cdbac20564..8d8898f3c1 100644 --- a/patches/api/0185-Entity-Jump-API.patch +++ b/patches/api/0185-Entity-Jump-API.patch @@ -61,7 +61,7 @@ index 0000000000000000000000000000000000000000..a6306c957fcacdcbcc8037b4ee33a167 + } +} diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index c2d6a2d45d733fff7cb6bf1d687bdff35d2be7f4..c7c242fb4ac106edad87032f0accd14d128a5b37 100644 +index 2f9299f407692c51dca17ca38a6135dde259b895..1a7d802e8c3204408402ce58377108ffac2662b9 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java @@ -1147,4 +1147,26 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource diff --git a/patches/api/0195-Expose-game-version.patch b/patches/api/0195-Expose-game-version.patch index 5cd19ffff9..698a089e9a 100644 --- a/patches/api/0195-Expose-game-version.patch +++ b/patches/api/0195-Expose-game-version.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Expose game version diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 00320a15e4edbcbab182b4064b05d3a19dc441ce..ed65e84868f6b3b9272c8266244d7ab3725a7699 100644 +index 803ca460cf91f6760d7b16e1310a23d6b09725b3..377e9979c5bbc50398d521ff038956f80d7376b1 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java @@ -159,6 +159,18 @@ public final class Bukkit { @@ -28,7 +28,7 @@ index 00320a15e4edbcbab182b4064b05d3a19dc441ce..ed65e84868f6b3b9272c8266244d7ab3 * Gets a view of all currently logged in players. This {@linkplain * Collections#unmodifiableCollection(Collection) view} is a reused diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index d606b1d1ac37a13607c893e14ad88b26d1296ab0..e87718db19c902fe385328866767e46c397b7e86 100644 +index 1575218ee7eb563b17b542b578c10d125889a7be..7ed98561c6320132501c89d70254870e6ec03e77 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java @@ -117,6 +117,16 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi diff --git a/patches/api/0209-Add-playPickupItemAnimation-to-LivingEntity.patch b/patches/api/0209-Add-playPickupItemAnimation-to-LivingEntity.patch index bc76c0005c..e862e67086 100644 --- a/patches/api/0209-Add-playPickupItemAnimation-to-LivingEntity.patch +++ b/patches/api/0209-Add-playPickupItemAnimation-to-LivingEntity.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add playPickupItemAnimation to LivingEntity diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index c7c242fb4ac106edad87032f0accd14d128a5b37..5d8433cbea6cfe6a7621d7ab110f7aa0ed120136 100644 +index 1a7d802e8c3204408402ce58377108ffac2662b9..7dbb3737cd175365b89a5c8d0542b16e812b8629 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java @@ -1169,4 +1169,29 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource diff --git a/patches/api/0224-Add-LivingEntity-clearActiveItem.patch b/patches/api/0224-Add-LivingEntity-clearActiveItem.patch index 463b79867d..c90bd62fa6 100644 --- a/patches/api/0224-Add-LivingEntity-clearActiveItem.patch +++ b/patches/api/0224-Add-LivingEntity-clearActiveItem.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add LivingEntity#clearActiveItem diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 5d8433cbea6cfe6a7621d7ab110f7aa0ed120136..f00ae13ee252c52963c7c8ce95cde984b8721f46 100644 +index 7dbb3737cd175365b89a5c8d0542b16e812b8629..bd871bf479cb9f4b31832ac5cb363f314b32a047 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java @@ -1059,6 +1059,11 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource diff --git a/patches/api/0229-Expose-LivingEntity-hurt-direction.patch b/patches/api/0229-Expose-LivingEntity-hurt-direction.patch index 0f5490de89..2bff91fc78 100644 --- a/patches/api/0229-Expose-LivingEntity-hurt-direction.patch +++ b/patches/api/0229-Expose-LivingEntity-hurt-direction.patch @@ -26,7 +26,7 @@ index 5ecfb98540c00da05b13bc5370debb89c52cc76f..083d5798ccc7f37c6df5e234c7ef2332 * Get the sleep ticks of the player. This value may be capped. * diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index f00ae13ee252c52963c7c8ce95cde984b8721f46..9c8202d672e293c963218a7f3b0d51aa4e7dec5a 100644 +index bd871bf479cb9f4b31832ac5cb363f314b32a047..54cdbfdc5d2280069045317bac919ff4689872f5 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java @@ -1199,4 +1199,22 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource diff --git a/patches/api/0263-Expand-world-key-API.patch b/patches/api/0263-Expand-world-key-API.patch index 32ba99be6d..a6e79339f4 100644 --- a/patches/api/0263-Expand-world-key-API.patch +++ b/patches/api/0263-Expand-world-key-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Expand world key API diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index b4341f5c9adcebd13a0f62ebc32d081a65d71ba4..7e049d9934df2259ea566aaa69ce118ce829529d 100644 +index e832c6a8a10bc29d9ab20cbdf394cf836eb2f6a5..4b3c91575f2609ad1b1177384f6f21151a535054 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java @@ -862,6 +862,18 @@ public final class Bukkit { @@ -56,7 +56,7 @@ index 27eff0826d5b5b48697fefd9571886e7bbce74b1..d8b1fa79dc24138dc71e32c14bda71c1 // Paper end } diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 3c64eb18b7cb6ac371b094a581da8a033e90d00f..c3e0b40a845a30790f31a0cf591bfa7f0cd87fee 100644 +index 9477563308adc64fff065eb0a50654baa0d22b84..5bb94245c33105e57131b3d0867ef707c4aed79c 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java @@ -720,6 +720,17 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi diff --git a/patches/api/0294-Add-more-line-of-sight-methods.patch b/patches/api/0294-Add-more-line-of-sight-methods.patch index fbd43414de..cd8d86699e 100644 --- a/patches/api/0294-Add-more-line-of-sight-methods.patch +++ b/patches/api/0294-Add-more-line-of-sight-methods.patch @@ -23,7 +23,7 @@ index d8b1fa79dc24138dc71e32c14bda71c1d570ed88..b68367f123f029c3ff47eab6bfabd7a8 // Paper end } diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 0ed9ad6ed755c5b46ec16e33c3d56e7f80345066..99f314f25d1d6118e0884822d428c47060373bec 100644 +index 54cdbfdc5d2280069045317bac919ff4689872f5..42ece8fd69f35fe38d9e49eed1d578d19229d721 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java @@ -622,6 +622,19 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource diff --git a/patches/api/0297-Missing-Entity-API.patch b/patches/api/0297-Missing-Entity-API.patch index be2838d08e..76a4b85361 100644 --- a/patches/api/0297-Missing-Entity-API.patch +++ b/patches/api/0297-Missing-Entity-API.patch @@ -585,7 +585,7 @@ index 6b3c9bef9a8a34ddc6ff42cf358541a2665bf5e3..9c618a27d590f186f29c5d9094fc565e + // Paper end } diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index a253ac2b60b038177e6c4f20d8367be36f10b1bd..2036e7b464f631054abb94333a8674d31bdce800 100644 +index 42ece8fd69f35fe38d9e49eed1d578d19229d721..5d62d7393dde2ccf56e9c09d44e17fdde79cf760 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java @@ -992,6 +992,7 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource diff --git a/patches/api/0301-Stinger-API.patch b/patches/api/0301-Stinger-API.patch index 2feda687e5..bef937b254 100644 --- a/patches/api/0301-Stinger-API.patch +++ b/patches/api/0301-Stinger-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Stinger API diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 13eb80455dd589e87c39a7a5570ef093c7660205..2727eef973a40b5d96f59671e0415e9544a0550c 100644 +index 5d62d7393dde2ccf56e9c09d44e17fdde79cf760..be9fa1b6209a41712767283c6329046ca2795c09 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java @@ -451,6 +451,52 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource diff --git a/patches/api/0342-Implement-regenerateChunk.patch b/patches/api/0342-Implement-regenerateChunk.patch index 8023a26d0f..923a9fbcd0 100644 --- a/patches/api/0342-Implement-regenerateChunk.patch +++ b/patches/api/0342-Implement-regenerateChunk.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Implement regenerateChunk diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 6897600a6879d88cea287cde350c1e9cd11ae96d..0eb90bfff2e12cb3ed977a581912221ac4dee6f6 100644 +index 5c61b9964e9abe76b5604c73bdd211a9c1c9b619..7ff0ac9c78c3793791afbfa344a9ced3821d9638 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -486,8 +486,8 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient diff --git a/patches/api/0360-Add-method-isTickingWorlds-to-Bukkit.patch b/patches/api/0360-Add-method-isTickingWorlds-to-Bukkit.patch index 91e4d0fdac..40b7bec1d7 100644 --- a/patches/api/0360-Add-method-isTickingWorlds-to-Bukkit.patch +++ b/patches/api/0360-Add-method-isTickingWorlds-to-Bukkit.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add method isTickingWorlds() to Bukkit. diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 986d506ae0eb91363e7fdfa19b1f9d0d840a5207..da505ee90f49983a9458cdf371db32228791fb53 100644 +index 22ec7dda6853db6539e98e8d39d8a13be8926f07..a24de4474114af533e1e8b78c4fd0e8c5edd14b8 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java @@ -806,12 +806,26 @@ public final class Bukkit { @@ -56,7 +56,7 @@ index 986d506ae0eb91363e7fdfa19b1f9d0d840a5207..da505ee90f49983a9458cdf371db3222 * @param world the world to unload * @param save whether to save the chunks before unloading diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 33458df42b41e9ef5d9728d526cc45b8199f25b4..d433a9d2fe0bb487865fec33307cc4c45af475a0 100644 +index 96f9f3ac492eb6f4628d47f0be4239ab9bc7df54..c8704bc90a4f7040e5fa1c0377d5533bd14a4249 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java @@ -673,34 +673,55 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi diff --git a/patches/api/0364-More-Teleport-API.patch b/patches/api/0364-More-Teleport-API.patch index f158c47e4e..7f4f75ceac 100644 --- a/patches/api/0364-More-Teleport-API.patch +++ b/patches/api/0364-More-Teleport-API.patch @@ -120,7 +120,7 @@ index 0000000000000000000000000000000000000000..c8b5b570d44da9524bfc59c7e11b2ae5 + +} diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java -index 9b5fe55399594c57c1b1521bea03781fd99fdf60..e2f315db8d137d7bc1b6fc83ed29032152f881f2 100644 +index 8827defeb26593cb2c2391e505b008f1190b01f3..bc1547381b08d1acbbef885d9c3ecd63f3550426 100644 --- a/src/main/java/org/bukkit/entity/Entity.java +++ b/src/main/java/org/bukkit/entity/Entity.java @@ -126,10 +126,32 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent diff --git a/patches/api/0379-Add-LivingEntity-swingHand-EquipmentSlot-convenience.patch b/patches/api/0379-Add-LivingEntity-swingHand-EquipmentSlot-convenience.patch index 75708a14a8..05a81d55ae 100644 --- a/patches/api/0379-Add-LivingEntity-swingHand-EquipmentSlot-convenience.patch +++ b/patches/api/0379-Add-LivingEntity-swingHand-EquipmentSlot-convenience.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add LivingEntity#swingHand(EquipmentSlot) convenience method diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 5500f5273624b133b48327fe74b0b2e2708d76c4..bdd34708b2e75aaa8a3365c0d7284d85e7cb61e5 100644 +index be9fa1b6209a41712767283c6329046ca2795c09..35b0eb94e291dae7a4705fa85b10d23fcd38f49e 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java @@ -1329,4 +1329,24 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource diff --git a/patches/api/0380-Add-entity-knockback-API.patch b/patches/api/0380-Add-entity-knockback-API.patch index 024e3244b0..5d411c2968 100644 --- a/patches/api/0380-Add-entity-knockback-API.patch +++ b/patches/api/0380-Add-entity-knockback-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add entity knockback API diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index bdd34708b2e75aaa8a3365c0d7284d85e7cb61e5..3943b5cb1306fb1eb830e56cea696fdc587c09f4 100644 +index 35b0eb94e291dae7a4705fa85b10d23fcd38f49e..41c5559058df9701e345f39d9d3c23e45b6d49c3 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java @@ -1349,4 +1349,18 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource diff --git a/patches/api/0387-ItemStack-damage-API.patch b/patches/api/0387-ItemStack-damage-API.patch index 2bcc0d05b3..b7b9d50930 100644 --- a/patches/api/0387-ItemStack-damage-API.patch +++ b/patches/api/0387-ItemStack-damage-API.patch @@ -8,7 +8,7 @@ to simulate damage done to an itemstack and all the logic associated with damaging them diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 3943b5cb1306fb1eb830e56cea696fdc587c09f4..a8b442cf03887ebe212a298d35cea5f6383ccfab 100644 +index 41c5559058df9701e345f39d9d3c23e45b6d49c3..812ae3368f828b388d6fd05a94cd88f2d5db9fac 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java @@ -1363,4 +1363,53 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource diff --git a/patches/api/0389-Friction-API.patch b/patches/api/0389-Friction-API.patch index 23fa01d063..4488bf7b41 100644 --- a/patches/api/0389-Friction-API.patch +++ b/patches/api/0389-Friction-API.patch @@ -59,7 +59,7 @@ index ced419f8655bff72f0257b639d5f7d73afe3c2e2..bcc6ba95bd21c7972865838c636a03f5 /** * Gets the item stack associated with this item drop. diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 041ff387a0f9e8037e2834118ef241ddb8970907..3a26b3c40f877a454c3c76b68b86776f05950002 100644 +index 812ae3368f828b388d6fd05a94cd88f2d5db9fac..017a743c1445e2c859fef0ef962e656035af12bd 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java @@ -27,7 +27,7 @@ import org.jetbrains.annotations.Nullable; diff --git a/patches/api/0400-Add-Entity-Body-Yaw-API.patch b/patches/api/0400-Add-Entity-Body-Yaw-API.patch index 6b8119d161..a34499f0db 100644 --- a/patches/api/0400-Add-Entity-Body-Yaw-API.patch +++ b/patches/api/0400-Add-Entity-Body-Yaw-API.patch @@ -53,7 +53,7 @@ index 2d6f7b2bf4cb23ef43a4dcbab2ecd2a7c7c2809c..0be4107270fb7fdba5c7d0e6f3964d33 // Paper start - Collision API diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 30222c65bcc78ff3fe5c0937c64c6fe7b0b2fe36..2e6a6c9e8e150f940842f8f134b18987412e4766 100644 +index 017a743c1445e2c859fef0ef962e656035af12bd..b8a9b56c3071d94371ab69b1a72c2e6c0692ab39 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java @@ -1412,4 +1412,22 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource diff --git a/patches/api/0410-Add-method-to-remove-all-active-potion-effects.patch b/patches/api/0410-Add-method-to-remove-all-active-potion-effects.patch index 10afeab970..47a9befa74 100644 --- a/patches/api/0410-Add-method-to-remove-all-active-potion-effects.patch +++ b/patches/api/0410-Add-method-to-remove-all-active-potion-effects.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add method to remove all active potion effects diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 949539d4614242a8d742cd75242ce753b474edf6..de0e160632e0f0f9dee61007f139f37382f58e26 100644 +index b8a9b56c3071d94371ab69b1a72c2e6c0692ab39..80df95e93b9a919af8c2e98b09b75522ee60eae6 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java @@ -657,6 +657,15 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource diff --git a/patches/api/0421-Deprecate-and-replace-methods-with-old-StructureType.patch b/patches/api/0421-Deprecate-and-replace-methods-with-old-StructureType.patch index 177761f8cd..a32c35bff3 100644 --- a/patches/api/0421-Deprecate-and-replace-methods-with-old-StructureType.patch +++ b/patches/api/0421-Deprecate-and-replace-methods-with-old-StructureType.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Deprecate and replace methods with old StructureType diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index b82260cdee74a82b78c103467f7e2888ba4d06c1..ca27559cf4aa1c2e44fdca2022e213b1b1c80f4e 100644 +index 0865830a8d9f29dee47c34a192e26e4c1304a12c..8e2942664f73b0f92beb30c7a94b720610a43c15 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java @@ -935,9 +935,6 @@ public final class Bukkit { @@ -84,7 +84,7 @@ index b82260cdee74a82b78c103467f7e2888ba4d06c1..ca27559cf4aa1c2e44fdca2022e213b1 /** * Reloads the server, refreshing settings and plugin information. diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index f18f5db804053e072134508ef38252391895549a..b4f8281d3797ec825a7671f38077cd65d5a1d76e 100644 +index bc55bf7361fb41a91766fcb2f1e4620e3db64781..78daaaa3b4f1ec1d05652287d9f9b08689bc2cbf 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java @@ -800,16 +800,15 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi diff --git a/patches/api/0443-Add-Structure-check-API.patch b/patches/api/0443-Add-Structure-check-API.patch index 693f5dbf09..00a6416368 100644 --- a/patches/api/0443-Add-Structure-check-API.patch +++ b/patches/api/0443-Add-Structure-check-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add Structure check API diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index c0ad21a3dd1f3cd9a4c66000e937e89ffc183638..c5fe36050eeaff80cfb989fe2f38370215af6fe5 100644 +index 377d57b0e603898d309a9384aa8bb9fca97673e3..35fb5047dd8a8521586a9ca9f8d70881355fb7f5 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -78,6 +78,30 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient diff --git a/patches/api/0450-Add-HiddenPotionEffect-API.patch b/patches/api/0450-Add-HiddenPotionEffect-API.patch index 49d193598e..53d4b040a2 100644 --- a/patches/api/0450-Add-HiddenPotionEffect-API.patch +++ b/patches/api/0450-Add-HiddenPotionEffect-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add HiddenPotionEffect API diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index de0e160632e0f0f9dee61007f139f37382f58e26..f5fe2abd28a3f5fa4f2adf1d63ea68a7b890d191 100644 +index 80df95e93b9a919af8c2e98b09b75522ee60eae6..65112eae8b92344796850b1e4c89e75443eab2fe 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java @@ -591,6 +591,9 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource diff --git a/patches/server/0002-Remap-fixes.patch b/patches/server/0002-Remap-fixes.patch index 3f9503543f..9a1f203f9a 100644 --- a/patches/server/0002-Remap-fixes.patch +++ b/patches/server/0002-Remap-fixes.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Remap fixes diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java -index ad3035da44c6af2fa7cc53926f33526a43740313..e89fa618fa20e3e843d8de81629e6dc551777823 100644 +index 17a400bb1710afe0b2c88ba7b0a008d4dbcbfa0c..1a4cab0b9995b733aa84b89129009a99177eee9b 100644 --- a/src/main/java/net/minecraft/core/BlockPos.java +++ b/src/main/java/net/minecraft/core/BlockPos.java -@@ -278,9 +278,11 @@ public class BlockPos extends Vec3i { +@@ -289,9 +289,11 @@ public class BlockPos extends Vec3i { public static Iterable withinManhattan(BlockPos center, int rangeX, int rangeY, int rangeZ) { int i = rangeX + rangeY + rangeZ; @@ -20,10 +20,10 @@ index ad3035da44c6af2fa7cc53926f33526a43740313..e89fa618fa20e3e843d8de81629e6dc5 + int centerY = center.getY(); + int centerZ = center.getZ(); + // Paper end - return () -> { - return new AbstractIterator() { + return () -> new AbstractIterator() { private final BlockPos.MutableBlockPos cursor = new BlockPos.MutableBlockPos(); -@@ -295,7 +297,7 @@ public class BlockPos extends Vec3i { + private int currentDepth; +@@ -305,7 +307,7 @@ public class BlockPos extends Vec3i { protected BlockPos computeNext() { if (this.zMirror) { this.zMirror = false; @@ -32,7 +32,7 @@ index ad3035da44c6af2fa7cc53926f33526a43740313..e89fa618fa20e3e843d8de81629e6dc5 return this.cursor; } else { BlockPos blockPos; -@@ -321,7 +323,7 @@ public class BlockPos extends Vec3i { +@@ -331,7 +333,7 @@ public class BlockPos extends Vec3i { int k = this.currentDepth - Math.abs(i) - Math.abs(j); if (k <= rangeZ) { this.zMirror = k != 0; diff --git a/patches/server/0003-Build-system-changes.patch b/patches/server/0003-Build-system-changes.patch index d9c9c0db74..c935af1a00 100644 --- a/patches/server/0003-Build-system-changes.patch +++ b/patches/server/0003-Build-system-changes.patch @@ -9,7 +9,7 @@ public net.minecraft.server.packs.VanillaPackResourcesBuilder safeGetPath(Ljava/ Co-authored-by: Jake Potrebic diff --git a/build.gradle.kts b/build.gradle.kts -index 74849d7b20e3c3831a6a6c3715a6e875d6ff8a48..ff9e7b4c4354d4475559213cdaa01728601859fa 100644 +index 4e0b810bd0a9991d10e13920f47f0b6d0a56f6aa..50d9182a4845564cd62b026700a7d0517c25e74d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,9 +9,7 @@ plugins { @@ -66,10 +66,10 @@ index 74849d7b20e3c3831a6a6c3715a6e875d6ff8a48..ff9e7b4c4354d4475559213cdaa01728 + jvmArgs("-DPaper.pushPaperAssetsRoot=true") } diff --git a/src/main/java/net/minecraft/resources/ResourceLocation.java b/src/main/java/net/minecraft/resources/ResourceLocation.java -index 68e3d54c79924d72b22eb3bc142ff47aa1700895..d3300e43523429fdd0e61c5aa9aed2e6bc78e07e 100644 +index 0064a1112f392379ff095f95738f1368240ca4cf..aed74e471126a8a66046a181973158d7d288d3f0 100644 --- a/src/main/java/net/minecraft/resources/ResourceLocation.java +++ b/src/main/java/net/minecraft/resources/ResourceLocation.java -@@ -26,6 +26,7 @@ public class ResourceLocation implements Comparable { +@@ -28,6 +28,7 @@ public class ResourceLocation implements Comparable { public static final char NAMESPACE_SEPARATOR = ':'; public static final String DEFAULT_NAMESPACE = "minecraft"; public static final String REALMS_NAMESPACE = "realms"; @@ -78,10 +78,10 @@ index 68e3d54c79924d72b22eb3bc142ff47aa1700895..d3300e43523429fdd0e61c5aa9aed2e6 private final String path; diff --git a/src/main/java/net/minecraft/server/packs/VanillaPackResourcesBuilder.java b/src/main/java/net/minecraft/server/packs/VanillaPackResourcesBuilder.java -index 1b65823e6c2070761dd08ce801268e95dad13065..978dd399430ae98d54fc4805800aa0214d4034e3 100644 +index 6a11d33eb44e0fde731b54a9200eb44b20a73c43..29ab3aae87de2bf14b31268239d935e49cb0fa98 100644 --- a/src/main/java/net/minecraft/server/packs/VanillaPackResourcesBuilder.java +++ b/src/main/java/net/minecraft/server/packs/VanillaPackResourcesBuilder.java -@@ -141,6 +141,15 @@ public class VanillaPackResourcesBuilder { +@@ -138,6 +138,15 @@ public class VanillaPackResourcesBuilder { public VanillaPackResourcesBuilder applyDevelopmentConfig() { developmentConfig.accept(this); @@ -98,18 +98,18 @@ index 1b65823e6c2070761dd08ce801268e95dad13065..978dd399430ae98d54fc4805800aa021 } diff --git a/src/main/java/net/minecraft/server/packs/repository/ServerPacksSource.java b/src/main/java/net/minecraft/server/packs/repository/ServerPacksSource.java -index a2a8bce29ec5540de89095574dfdc0ca9b17bbd3..d92cd89373f8373c367ce422328b9836de09096d 100644 +index dd5e32e7a64eaddab66905dba2595f2220706adb..439b9bc95ae8580fcde89f86565df39ba4040d59 100644 --- a/src/main/java/net/minecraft/server/packs/repository/ServerPacksSource.java +++ b/src/main/java/net/minecraft/server/packs/repository/ServerPacksSource.java -@@ -32,7 +32,7 @@ public class ServerPacksSource extends BuiltInPackSource { - - @VisibleForTesting +@@ -38,7 +38,7 @@ public class ServerPacksSource extends BuiltInPackSource { public static VanillaPackResources createVanillaPackSource() { -- return (new VanillaPackResourcesBuilder()).setMetadata(BUILT_IN_METADATA).exposeNamespace("minecraft").applyDevelopmentConfig().pushJarResources().build(); -+ return (new VanillaPackResourcesBuilder()).setMetadata(BUILT_IN_METADATA).exposeNamespace("minecraft", ResourceLocation.PAPER_NAMESPACE).applyDevelopmentConfig().pushJarResources().build(); // Paper - } - - @Override + return new VanillaPackResourcesBuilder() + .setMetadata(BUILT_IN_METADATA) +- .exposeNamespace("minecraft") ++ .exposeNamespace("minecraft", ResourceLocation.PAPER_NAMESPACE) // Paper + .applyDevelopmentConfig() + .pushJarResources() + .build(); diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java index 2930f37c663a1824a2d38df8e4b679aa6adbd870..67d347741db1c5a9a6568ee084388a59e35b16ea 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java diff --git a/patches/server/0004-Test-changes.patch b/patches/server/0004-Test-changes.patch index b13f9277b7..9bb625b711 100644 --- a/patches/server/0004-Test-changes.patch +++ b/patches/server/0004-Test-changes.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Test changes diff --git a/build.gradle.kts b/build.gradle.kts -index ff9e7b4c4354d4475559213cdaa01728601859fa..5304f5de52a76eee876ac8f0b2834a93b28d57aa 100644 +index 50d9182a4845564cd62b026700a7d0517c25e74d..69155f6badcd79b3479654363ca1f1d8a138a7ad 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -23,6 +23,7 @@ dependencies { diff --git a/patches/server/0005-Paper-config-files.patch b/patches/server/0005-Paper-config-files.patch index a1510b54e6..12a6e0b87c 100644 --- a/patches/server/0005-Paper-config-files.patch +++ b/patches/server/0005-Paper-config-files.patch @@ -4867,17 +4867,19 @@ index 42da710d18063aed6fd450fe31277d7daf0542c1..62e096c9cc05c387ca2413a490f44c6c private void readScoreboard(DimensionDataStorage persistentStateManager) { diff --git a/src/main/java/net/minecraft/server/Services.java b/src/main/java/net/minecraft/server/Services.java -index 1d611538d339345df065cd9c0c582d02e1fb0cc7..d200619b4aa820e273c26f2f6133589c727f8a0e 100644 +index dfbb04800d6f1dcbb909fcdfeb1ebf1a5efa6a48..5928e5f1934b8e247ba516595018ed5c633d3b5d 100644 --- a/src/main/java/net/minecraft/server/Services.java +++ b/src/main/java/net/minecraft/server/Services.java -@@ -10,14 +10,30 @@ import javax.annotation.Nullable; +@@ -10,16 +10,32 @@ import javax.annotation.Nullable; import net.minecraft.server.players.GameProfileCache; import net.minecraft.util.SignatureValidator; --public record Services(MinecraftSessionService sessionService, ServicesKeySet servicesKeySet, GameProfileRepository profileRepository, GameProfileCache profileCache) { -+// Paper start - add paper configuration files -+public record Services(MinecraftSessionService sessionService, ServicesKeySet servicesKeySet, GameProfileRepository profileRepository, GameProfileCache profileCache, @javax.annotation.Nullable io.papermc.paper.configuration.PaperConfigurations paperConfigurations) { + + public record Services( +- MinecraftSessionService sessionService, ServicesKeySet servicesKeySet, GameProfileRepository profileRepository, GameProfileCache profileCache ++ MinecraftSessionService sessionService, ServicesKeySet servicesKeySet, GameProfileRepository profileRepository, GameProfileCache profileCache, @javax.annotation.Nullable io.papermc.paper.configuration.PaperConfigurations paperConfigurations // Paper - add paper configuration files + ) { ++ // Paper start - add paper configuration files + public Services(MinecraftSessionService sessionService, ServicesKeySet servicesKeySet, GameProfileRepository profileRepository, GameProfileCache profileCache) { + this(sessionService, servicesKeySet, profileRepository, profileCache, null); + } diff --git a/patches/server/0006-MC-Dev-fixes.patch b/patches/server/0006-MC-Dev-fixes.patch index 271ad7735f..671908dd6b 100644 --- a/patches/server/0006-MC-Dev-fixes.patch +++ b/patches/server/0006-MC-Dev-fixes.patch @@ -5,10 +5,10 @@ Subject: [PATCH] MC Dev fixes diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java -index e89fa618fa20e3e843d8de81629e6dc551777823..2bb5e51f71cbf66819d198505aa4a5ecffd246c6 100644 +index 1a4cab0b9995b733aa84b89129009a99177eee9b..ead823fa2a143acb05b33152ee1e5ee4b4936a20 100644 --- a/src/main/java/net/minecraft/core/BlockPos.java +++ b/src/main/java/net/minecraft/core/BlockPos.java -@@ -383,12 +383,12 @@ public class BlockPos extends Vec3i { +@@ -405,12 +405,12 @@ public class BlockPos extends Vec3i { if (this.index == l) { return this.endOfData(); } else { @@ -20,90 +20,68 @@ index e89fa618fa20e3e843d8de81629e6dc551777823..2bb5e51f71cbf66819d198505aa4a5ec + int u = this.index / i; // Paper - decomp fix + int offsetY = u % j; // Paper - decomp fix + int offsetZ = u / j; // Paper - decomp fix - ++this.index; + this.index++; - return this.cursor.set(startX + i, startY + k, startZ + l); + return this.cursor.set(startX + offsetX, startY + offsetY, startZ + offsetZ); // Paper - decomp fix } } }; diff --git a/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java b/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java -index ac523135cfdfbac507774c8f86d731de881b0442..ca70cd2e76c94f7a284c9af47c64252855f070a4 100644 +index d14613f7d37198276c251e73703b060a971fac28..e8afaa3c1fab0435acb068426091bdf776263112 100644 --- a/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java +++ b/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java -@@ -333,7 +333,7 @@ public class BuiltInRegistries { - LOADERS.put(resourceLocation, () -> { - return initializer.run(registry); - }); -- WRITABLE_REGISTRY.register(key, registry, lifecycle); -+ WRITABLE_REGISTRY.register((ResourceKey) key, registry, lifecycle); // Paper - decompile fix +@@ -307,7 +307,7 @@ public class BuiltInRegistries { + Bootstrap.checkBootstrapCalled(() -> "registry " + key); + ResourceLocation resourceLocation = key.location(); + LOADERS.put(resourceLocation, () -> initializer.run(registry)); +- WRITABLE_REGISTRY.register((ResourceKey>)key, registry, lifecycle); ++ WRITABLE_REGISTRY.register((ResourceKey)key, registry, lifecycle); // Paper - decompile fix return registry; } +diff --git a/src/main/java/net/minecraft/nbt/TagParser.java b/src/main/java/net/minecraft/nbt/TagParser.java +index 733303e860560f4c93372326ab4efdaf21e5ace7..ebe0efe488357ae895aaf752e9bc008b96db156f 100644 +--- a/src/main/java/net/minecraft/nbt/TagParser.java ++++ b/src/main/java/net/minecraft/nbt/TagParser.java +@@ -252,11 +252,11 @@ public class TagParser { + } + + if (typeReader == ByteTag.TYPE) { +- list.add((T)((NumericTag)tag).getAsByte()); ++ list.add((T)(Byte)((NumericTag)tag).getAsByte()); // Paper - decompile fix + } else if (typeReader == LongTag.TYPE) { +- list.add((T)((NumericTag)tag).getAsLong()); ++ list.add((T)(Long)((NumericTag)tag).getAsLong()); // Paper - decompile fix + } else { +- list.add((T)((NumericTag)tag).getAsInt()); ++ list.add((T)(Integer)((NumericTag)tag).getAsInt()); // Paper - decompile fix + } + + if (!this.hasElementSeparator()) { diff --git a/src/main/java/net/minecraft/network/ConnectionProtocol.java b/src/main/java/net/minecraft/network/ConnectionProtocol.java -index bfac303dc0c11a0e741b29f3700823c69e55c798..ac1aa37329bd4d411964ea34ea8147f6db945b9a 100644 +index 68ccf051f5a769abaa0bf9508add9303c56a1193..9d6dafb4855af9ccb7bc033ebf0fca5f75ceb9c6 100644 --- a/src/main/java/net/minecraft/network/ConnectionProtocol.java +++ b/src/main/java/net/minecraft/network/ConnectionProtocol.java -@@ -220,7 +220,7 @@ public enum ConnectionProtocol { - PLAY("play", protocol().addFlow(PacketFlow.CLIENTBOUND, (new ConnectionProtocol.PacketSet()).withBundlePacket(ClientboundBundlePacket.class, ClientboundBundlePacket::new).addPacket(ClientboundAddEntityPacket.class, ClientboundAddEntityPacket::new).addPacket(ClientboundAddExperienceOrbPacket.class, ClientboundAddExperienceOrbPacket::new).addPacket(ClientboundAnimatePacket.class, ClientboundAnimatePacket::new).addPacket(ClientboundAwardStatsPacket.class, ClientboundAwardStatsPacket::new).addPacket(ClientboundBlockChangedAckPacket.class, ClientboundBlockChangedAckPacket::new).addPacket(ClientboundBlockDestructionPacket.class, ClientboundBlockDestructionPacket::new).addPacket(ClientboundBlockEntityDataPacket.class, ClientboundBlockEntityDataPacket::new).addPacket(ClientboundBlockEventPacket.class, ClientboundBlockEventPacket::new).addPacket(ClientboundBlockUpdatePacket.class, ClientboundBlockUpdatePacket::new).addPacket(ClientboundBossEventPacket.class, ClientboundBossEventPacket::new).addPacket(ClientboundChangeDifficultyPacket.class, ClientboundChangeDifficultyPacket::new).addPacket(ClientboundChunkBatchFinishedPacket.class, ClientboundChunkBatchFinishedPacket::new).addPacket(ClientboundChunkBatchStartPacket.class, ClientboundChunkBatchStartPacket::new).addPacket(ClientboundChunksBiomesPacket.class, ClientboundChunksBiomesPacket::new).addPacket(ClientboundClearTitlesPacket.class, ClientboundClearTitlesPacket::new).addPacket(ClientboundCommandSuggestionsPacket.class, ClientboundCommandSuggestionsPacket::new).addPacket(ClientboundCommandsPacket.class, ClientboundCommandsPacket::new).addPacket(ClientboundContainerClosePacket.class, ClientboundContainerClosePacket::new).addPacket(ClientboundContainerSetContentPacket.class, ClientboundContainerSetContentPacket::new).addPacket(ClientboundContainerSetDataPacket.class, ClientboundContainerSetDataPacket::new).addPacket(ClientboundContainerSetSlotPacket.class, ClientboundContainerSetSlotPacket::new).addPacket(ClientboundCooldownPacket.class, ClientboundCooldownPacket::new).addPacket(ClientboundCustomChatCompletionsPacket.class, ClientboundCustomChatCompletionsPacket::new).addPacket(ClientboundCustomPayloadPacket.class, ClientboundCustomPayloadPacket::new).addPacket(ClientboundDamageEventPacket.class, ClientboundDamageEventPacket::new).addPacket(ClientboundDeleteChatPacket.class, ClientboundDeleteChatPacket::new).addPacket(ClientboundDisconnectPacket.class, ClientboundDisconnectPacket::new).addPacket(ClientboundDisguisedChatPacket.class, ClientboundDisguisedChatPacket::new).addPacket(ClientboundEntityEventPacket.class, ClientboundEntityEventPacket::new).addPacket(ClientboundExplodePacket.class, ClientboundExplodePacket::new).addPacket(ClientboundForgetLevelChunkPacket.class, ClientboundForgetLevelChunkPacket::new).addPacket(ClientboundGameEventPacket.class, ClientboundGameEventPacket::new).addPacket(ClientboundHorseScreenOpenPacket.class, ClientboundHorseScreenOpenPacket::new).addPacket(ClientboundHurtAnimationPacket.class, ClientboundHurtAnimationPacket::new).addPacket(ClientboundInitializeBorderPacket.class, ClientboundInitializeBorderPacket::new).addPacket(ClientboundKeepAlivePacket.class, ClientboundKeepAlivePacket::new).addPacket(ClientboundLevelChunkWithLightPacket.class, ClientboundLevelChunkWithLightPacket::new).addPacket(ClientboundLevelEventPacket.class, ClientboundLevelEventPacket::new).addPacket(ClientboundLevelParticlesPacket.class, ClientboundLevelParticlesPacket::new).addPacket(ClientboundLightUpdatePacket.class, ClientboundLightUpdatePacket::new).addPacket(ClientboundLoginPacket.class, ClientboundLoginPacket::new).addPacket(ClientboundMapItemDataPacket.class, ClientboundMapItemDataPacket::new).addPacket(ClientboundMerchantOffersPacket.class, ClientboundMerchantOffersPacket::new).addPacket(ClientboundMoveEntityPacket.Pos.class, ClientboundMoveEntityPacket.Pos::read).addPacket(ClientboundMoveEntityPacket.PosRot.class, ClientboundMoveEntityPacket.PosRot::read).addPacket(ClientboundMoveEntityPacket.Rot.class, ClientboundMoveEntityPacket.Rot::read).addPacket(ClientboundMoveVehiclePacket.class, ClientboundMoveVehiclePacket::new).addPacket(ClientboundOpenBookPacket.class, ClientboundOpenBookPacket::new).addPacket(ClientboundOpenScreenPacket.class, ClientboundOpenScreenPacket::new).addPacket(ClientboundOpenSignEditorPacket.class, ClientboundOpenSignEditorPacket::new).addPacket(ClientboundPingPacket.class, ClientboundPingPacket::new).addPacket(ClientboundPongResponsePacket.class, ClientboundPongResponsePacket::new).addPacket(ClientboundPlaceGhostRecipePacket.class, ClientboundPlaceGhostRecipePacket::new).addPacket(ClientboundPlayerAbilitiesPacket.class, ClientboundPlayerAbilitiesPacket::new).addPacket(ClientboundPlayerChatPacket.class, ClientboundPlayerChatPacket::new).addPacket(ClientboundPlayerCombatEndPacket.class, ClientboundPlayerCombatEndPacket::new).addPacket(ClientboundPlayerCombatEnterPacket.class, ClientboundPlayerCombatEnterPacket::new).addPacket(ClientboundPlayerCombatKillPacket.class, ClientboundPlayerCombatKillPacket::new).addPacket(ClientboundPlayerInfoRemovePacket.class, ClientboundPlayerInfoRemovePacket::new).addPacket(ClientboundPlayerInfoUpdatePacket.class, ClientboundPlayerInfoUpdatePacket::new).addPacket(ClientboundPlayerLookAtPacket.class, ClientboundPlayerLookAtPacket::new).addPacket(ClientboundPlayerPositionPacket.class, ClientboundPlayerPositionPacket::new).addPacket(ClientboundRecipePacket.class, ClientboundRecipePacket::new).addPacket(ClientboundRemoveEntitiesPacket.class, ClientboundRemoveEntitiesPacket::new).addPacket(ClientboundRemoveMobEffectPacket.class, ClientboundRemoveMobEffectPacket::new).addPacket(ClientboundResetScorePacket.class, ClientboundResetScorePacket::new).addPacket(ClientboundResourcePackPopPacket.class, ClientboundResourcePackPopPacket::new).addPacket(ClientboundResourcePackPushPacket.class, ClientboundResourcePackPushPacket::new).addPacket(ClientboundRespawnPacket.class, ClientboundRespawnPacket::new).addPacket(ClientboundRotateHeadPacket.class, ClientboundRotateHeadPacket::new).addPacket(ClientboundSectionBlocksUpdatePacket.class, ClientboundSectionBlocksUpdatePacket::new).addPacket(ClientboundSelectAdvancementsTabPacket.class, ClientboundSelectAdvancementsTabPacket::new).addPacket(ClientboundServerDataPacket.class, ClientboundServerDataPacket::new).addPacket(ClientboundSetActionBarTextPacket.class, ClientboundSetActionBarTextPacket::new).addPacket(ClientboundSetBorderCenterPacket.class, ClientboundSetBorderCenterPacket::new).addPacket(ClientboundSetBorderLerpSizePacket.class, ClientboundSetBorderLerpSizePacket::new).addPacket(ClientboundSetBorderSizePacket.class, ClientboundSetBorderSizePacket::new).addPacket(ClientboundSetBorderWarningDelayPacket.class, ClientboundSetBorderWarningDelayPacket::new).addPacket(ClientboundSetBorderWarningDistancePacket.class, ClientboundSetBorderWarningDistancePacket::new).addPacket(ClientboundSetCameraPacket.class, ClientboundSetCameraPacket::new).addPacket(ClientboundSetCarriedItemPacket.class, ClientboundSetCarriedItemPacket::new).addPacket(ClientboundSetChunkCacheCenterPacket.class, ClientboundSetChunkCacheCenterPacket::new).addPacket(ClientboundSetChunkCacheRadiusPacket.class, ClientboundSetChunkCacheRadiusPacket::new).addPacket(ClientboundSetDefaultSpawnPositionPacket.class, ClientboundSetDefaultSpawnPositionPacket::new).addPacket(ClientboundSetDisplayObjectivePacket.class, ClientboundSetDisplayObjectivePacket::new).addPacket(ClientboundSetEntityDataPacket.class, ClientboundSetEntityDataPacket::new).addPacket(ClientboundSetEntityLinkPacket.class, ClientboundSetEntityLinkPacket::new).addPacket(ClientboundSetEntityMotionPacket.class, ClientboundSetEntityMotionPacket::new).addPacket(ClientboundSetEquipmentPacket.class, ClientboundSetEquipmentPacket::new).addPacket(ClientboundSetExperiencePacket.class, ClientboundSetExperiencePacket::new).addPacket(ClientboundSetHealthPacket.class, ClientboundSetHealthPacket::new).addPacket(ClientboundSetObjectivePacket.class, ClientboundSetObjectivePacket::new).addPacket(ClientboundSetPassengersPacket.class, ClientboundSetPassengersPacket::new).addPacket(ClientboundSetPlayerTeamPacket.class, ClientboundSetPlayerTeamPacket::new).addPacket(ClientboundSetScorePacket.class, ClientboundSetScorePacket::new).addPacket(ClientboundSetSimulationDistancePacket.class, ClientboundSetSimulationDistancePacket::new).addPacket(ClientboundSetSubtitleTextPacket.class, ClientboundSetSubtitleTextPacket::new).addPacket(ClientboundSetTimePacket.class, ClientboundSetTimePacket::new).addPacket(ClientboundSetTitleTextPacket.class, ClientboundSetTitleTextPacket::new).addPacket(ClientboundSetTitlesAnimationPacket.class, ClientboundSetTitlesAnimationPacket::new).addPacket(ClientboundSoundEntityPacket.class, ClientboundSoundEntityPacket::new).addPacket(ClientboundSoundPacket.class, ClientboundSoundPacket::new).addPacket(ClientboundStartConfigurationPacket.class, ClientboundStartConfigurationPacket::new).addPacket(ClientboundStopSoundPacket.class, ClientboundStopSoundPacket::new).addPacket(ClientboundSystemChatPacket.class, ClientboundSystemChatPacket::new).addPacket(ClientboundTabListPacket.class, ClientboundTabListPacket::new).addPacket(ClientboundTagQueryPacket.class, ClientboundTagQueryPacket::new).addPacket(ClientboundTakeItemEntityPacket.class, ClientboundTakeItemEntityPacket::new).addPacket(ClientboundTeleportEntityPacket.class, ClientboundTeleportEntityPacket::new).addPacket(ClientboundTickingStatePacket.class, ClientboundTickingStatePacket::new).addPacket(ClientboundTickingStepPacket.class, ClientboundTickingStepPacket::new).addPacket(ClientboundUpdateAdvancementsPacket.class, ClientboundUpdateAdvancementsPacket::new).addPacket(ClientboundUpdateAttributesPacket.class, ClientboundUpdateAttributesPacket::new).addPacket(ClientboundUpdateMobEffectPacket.class, ClientboundUpdateMobEffectPacket::new).addPacket(ClientboundUpdateRecipesPacket.class, ClientboundUpdateRecipesPacket::new).addPacket(ClientboundUpdateTagsPacket.class, ClientboundUpdateTagsPacket::new)).addFlow(PacketFlow.SERVERBOUND, (new ConnectionProtocol.PacketSet()).addPacket(ServerboundAcceptTeleportationPacket.class, ServerboundAcceptTeleportationPacket::new).addPacket(ServerboundBlockEntityTagQuery.class, ServerboundBlockEntityTagQuery::new).addPacket(ServerboundChangeDifficultyPacket.class, ServerboundChangeDifficultyPacket::new).addPacket(ServerboundChatAckPacket.class, ServerboundChatAckPacket::new).addPacket(ServerboundChatCommandPacket.class, ServerboundChatCommandPacket::new).addPacket(ServerboundChatPacket.class, ServerboundChatPacket::new).addPacket(ServerboundChatSessionUpdatePacket.class, ServerboundChatSessionUpdatePacket::new).addPacket(ServerboundChunkBatchReceivedPacket.class, ServerboundChunkBatchReceivedPacket::new).addPacket(ServerboundClientCommandPacket.class, ServerboundClientCommandPacket::new).addPacket(ServerboundClientInformationPacket.class, ServerboundClientInformationPacket::new).addPacket(ServerboundCommandSuggestionPacket.class, ServerboundCommandSuggestionPacket::new).addPacket(ServerboundConfigurationAcknowledgedPacket.class, ServerboundConfigurationAcknowledgedPacket::new).addPacket(ServerboundContainerButtonClickPacket.class, ServerboundContainerButtonClickPacket::new).addPacket(ServerboundContainerClickPacket.class, ServerboundContainerClickPacket::new).addPacket(ServerboundContainerClosePacket.class, ServerboundContainerClosePacket::new).addPacket(ServerboundContainerSlotStateChangedPacket.class, ServerboundContainerSlotStateChangedPacket::new).addPacket(ServerboundCustomPayloadPacket.class, ServerboundCustomPayloadPacket::new).addPacket(ServerboundEditBookPacket.class, ServerboundEditBookPacket::new).addPacket(ServerboundEntityTagQuery.class, ServerboundEntityTagQuery::new).addPacket(ServerboundInteractPacket.class, ServerboundInteractPacket::new).addPacket(ServerboundJigsawGeneratePacket.class, ServerboundJigsawGeneratePacket::new).addPacket(ServerboundKeepAlivePacket.class, ServerboundKeepAlivePacket::new).addPacket(ServerboundLockDifficultyPacket.class, ServerboundLockDifficultyPacket::new).addPacket(ServerboundMovePlayerPacket.Pos.class, ServerboundMovePlayerPacket.Pos::read).addPacket(ServerboundMovePlayerPacket.PosRot.class, ServerboundMovePlayerPacket.PosRot::read).addPacket(ServerboundMovePlayerPacket.Rot.class, ServerboundMovePlayerPacket.Rot::read).addPacket(ServerboundMovePlayerPacket.StatusOnly.class, ServerboundMovePlayerPacket.StatusOnly::read).addPacket(ServerboundMoveVehiclePacket.class, ServerboundMoveVehiclePacket::new).addPacket(ServerboundPaddleBoatPacket.class, ServerboundPaddleBoatPacket::new).addPacket(ServerboundPickItemPacket.class, ServerboundPickItemPacket::new).addPacket(ServerboundPingRequestPacket.class, ServerboundPingRequestPacket::new).addPacket(ServerboundPlaceRecipePacket.class, ServerboundPlaceRecipePacket::new).addPacket(ServerboundPlayerAbilitiesPacket.class, ServerboundPlayerAbilitiesPacket::new).addPacket(ServerboundPlayerActionPacket.class, ServerboundPlayerActionPacket::new).addPacket(ServerboundPlayerCommandPacket.class, ServerboundPlayerCommandPacket::new).addPacket(ServerboundPlayerInputPacket.class, ServerboundPlayerInputPacket::new).addPacket(ServerboundPongPacket.class, ServerboundPongPacket::new).addPacket(ServerboundRecipeBookChangeSettingsPacket.class, ServerboundRecipeBookChangeSettingsPacket::new).addPacket(ServerboundRecipeBookSeenRecipePacket.class, ServerboundRecipeBookSeenRecipePacket::new).addPacket(ServerboundRenameItemPacket.class, ServerboundRenameItemPacket::new).addPacket(ServerboundResourcePackPacket.class, ServerboundResourcePackPacket::new).addPacket(ServerboundSeenAdvancementsPacket.class, ServerboundSeenAdvancementsPacket::new).addPacket(ServerboundSelectTradePacket.class, ServerboundSelectTradePacket::new).addPacket(ServerboundSetBeaconPacket.class, ServerboundSetBeaconPacket::new).addPacket(ServerboundSetCarriedItemPacket.class, ServerboundSetCarriedItemPacket::new).addPacket(ServerboundSetCommandBlockPacket.class, ServerboundSetCommandBlockPacket::new).addPacket(ServerboundSetCommandMinecartPacket.class, ServerboundSetCommandMinecartPacket::new).addPacket(ServerboundSetCreativeModeSlotPacket.class, ServerboundSetCreativeModeSlotPacket::new).addPacket(ServerboundSetJigsawBlockPacket.class, ServerboundSetJigsawBlockPacket::new).addPacket(ServerboundSetStructureBlockPacket.class, ServerboundSetStructureBlockPacket::new).addPacket(ServerboundSignUpdatePacket.class, ServerboundSignUpdatePacket::new).addPacket(ServerboundSwingPacket.class, ServerboundSwingPacket::new).addPacket(ServerboundTeleportToEntityPacket.class, ServerboundTeleportToEntityPacket::new).addPacket(ServerboundUseItemOnPacket.class, ServerboundUseItemOnPacket::new).addPacket(ServerboundUseItemPacket.class, ServerboundUseItemPacket::new))), - STATUS("status", protocol().addFlow(PacketFlow.SERVERBOUND, (new ConnectionProtocol.PacketSet()).addPacket(ServerboundStatusRequestPacket.class, ServerboundStatusRequestPacket::new).addPacket(ServerboundPingRequestPacket.class, ServerboundPingRequestPacket::new)).addFlow(PacketFlow.CLIENTBOUND, (new ConnectionProtocol.PacketSet()).addPacket(ClientboundStatusResponsePacket.class, ClientboundStatusResponsePacket::new).addPacket(ClientboundPongResponsePacket.class, ClientboundPongResponsePacket::new))), - LOGIN("login", protocol().addFlow(PacketFlow.CLIENTBOUND, (new ConnectionProtocol.PacketSet()).addPacket(ClientboundLoginDisconnectPacket.class, ClientboundLoginDisconnectPacket::new).addPacket(ClientboundHelloPacket.class, ClientboundHelloPacket::new).addPacket(ClientboundGameProfilePacket.class, ClientboundGameProfilePacket::new).addPacket(ClientboundLoginCompressionPacket.class, ClientboundLoginCompressionPacket::new).addPacket(ClientboundCustomQueryPacket.class, ClientboundCustomQueryPacket::new)).addFlow(PacketFlow.SERVERBOUND, (new ConnectionProtocol.PacketSet()).addPacket(ServerboundHelloPacket.class, ServerboundHelloPacket::new).addPacket(ServerboundKeyPacket.class, ServerboundKeyPacket::new).addPacket(ServerboundCustomQueryAnswerPacket.class, ServerboundCustomQueryAnswerPacket::read).addPacket(ServerboundLoginAcknowledgedPacket.class, ServerboundLoginAcknowledgedPacket::new))), -- CONFIGURATION("configuration", protocol().addFlow(PacketFlow.CLIENTBOUND, (new ConnectionProtocol.PacketSet()).addPacket(ClientboundCustomPayloadPacket.class, ClientboundCustomPayloadPacket::new).addPacket(ClientboundDisconnectPacket.class, ClientboundDisconnectPacket::new).addPacket(ClientboundFinishConfigurationPacket.class, ClientboundFinishConfigurationPacket::new).addPacket(ClientboundKeepAlivePacket.class, ClientboundKeepAlivePacket::new).addPacket(ClientboundPingPacket.class, ClientboundPingPacket::new).addPacket(ClientboundRegistryDataPacket.class, ClientboundRegistryDataPacket::new).addPacket(ClientboundResourcePackPopPacket.class, ClientboundResourcePackPopPacket::new).addPacket(ClientboundResourcePackPushPacket.class, ClientboundResourcePackPushPacket::new).addPacket(ClientboundUpdateEnabledFeaturesPacket.class, ClientboundUpdateEnabledFeaturesPacket::new).addPacket(ClientboundUpdateTagsPacket.class, ClientboundUpdateTagsPacket::new)).addFlow(PacketFlow.SERVERBOUND, (new ConnectionProtocol.PacketSet()).addPacket(ServerboundClientInformationPacket.class, ServerboundClientInformationPacket::new).addPacket(ServerboundCustomPayloadPacket.class, ServerboundCustomPayloadPacket::new).addPacket(ServerboundFinishConfigurationPacket.class, ServerboundFinishConfigurationPacket::new).addPacket(ServerboundKeepAlivePacket.class, ServerboundKeepAlivePacket::new).addPacket(ServerboundPongPacket.class, ServerboundPongPacket::new).addPacket(ServerboundResourcePackPacket.class, ServerboundResourcePackPacket::new))); -+ CONFIGURATION("configuration", protocol().addFlow(PacketFlow.CLIENTBOUND, (new ConnectionProtocol.PacketSet()).addPacket(ClientboundCustomPayloadPacket.class, ClientboundCustomPayloadPacket::new).addPacket(ClientboundDisconnectPacket.class, ClientboundDisconnectPacket::new).addPacket(ClientboundFinishConfigurationPacket.class, ClientboundFinishConfigurationPacket::new).addPacket(ClientboundKeepAlivePacket.class, ClientboundKeepAlivePacket::new).addPacket(ClientboundPingPacket.class, ClientboundPingPacket::new).addPacket(ClientboundRegistryDataPacket.class, ClientboundRegistryDataPacket::new).addPacket(ClientboundResourcePackPopPacket.class, ClientboundResourcePackPopPacket::new).addPacket(ClientboundResourcePackPushPacket.class, ClientboundResourcePackPushPacket::new).addPacket(ClientboundUpdateEnabledFeaturesPacket.class, ClientboundUpdateEnabledFeaturesPacket::new).addPacket(ClientboundUpdateTagsPacket.class, ClientboundUpdateTagsPacket::new)).addFlow(PacketFlow.SERVERBOUND, (new ConnectionProtocol.PacketSet()).addPacket(ServerboundClientInformationPacket.class, ServerboundClientInformationPacket::new).addPacket(ServerboundCustomPayloadPacket.class, ServerboundCustomPayloadPacket::new).addPacket(ServerboundFinishConfigurationPacket.class, ServerboundFinishConfigurationPacket::new).addPacket(ServerboundKeepAlivePacket.class, ServerboundKeepAlivePacket::new).addPacket(ServerboundPongPacket.class, ServerboundPongPacket::new).addPacket(ServerboundResourcePackPacket.class, ServerboundResourcePackPacket::new))); // Paper - decompile fix - - public static final int NOT_REGISTERED = -1; - private final String id; -diff --git a/src/main/java/net/minecraft/network/chat/ComponentSerialization.java b/src/main/java/net/minecraft/network/chat/ComponentSerialization.java -index 60228c3778e53ca5c513cd265e5e08d151573a4f..49138ccda0f378b13c7f425be765876eb4026b06 100644 ---- a/src/main/java/net/minecraft/network/chat/ComponentSerialization.java -+++ b/src/main/java/net/minecraft/network/chat/ComponentSerialization.java -@@ -86,7 +86,7 @@ public class ComponentSerialization { - for(MapDecoder mapDecoder : this.codecs) { - DataResult dataResult = mapDecoder.decode(dynamicOps, mapLike); - if (dataResult.result().isPresent()) { -- return dataResult; -+ return (DataResult) dataResult; // Paper - decomp fix - } - } - -@@ -96,7 +96,7 @@ public class ComponentSerialization { - } - - public RecordBuilder encode(T object, DynamicOps dynamicOps, RecordBuilder recordBuilder) { -- MapEncoder mapEncoder = this.encoderGetter.apply(object); -+ MapEncoder mapEncoder = (MapEncoder) this.encoderGetter.apply(object); // Paper - decomp fix - return mapEncoder.encode(object, dynamicOps, recordBuilder); - } - -diff --git a/src/main/java/net/minecraft/network/chat/ComponentUtils.java b/src/main/java/net/minecraft/network/chat/ComponentUtils.java -index 13c8051da164bed579fbda44af059a36b8f00a0e..b6506e881ef337bfd2a7a0644296b48b7300a0f6 100644 ---- a/src/main/java/net/minecraft/network/chat/ComponentUtils.java -+++ b/src/main/java/net/minecraft/network/chat/ComponentUtils.java -@@ -129,9 +129,8 @@ public class ComponentUtils { - ComponentContents string = text.getContents(); - if (string instanceof TranslatableContents) { - TranslatableContents translatableContents = (TranslatableContents)string; -- String string = translatableContents.getKey(); - String string2 = translatableContents.getFallback(); -- return string2 != null || Language.getInstance().has(string); -+ return string2 != null || Language.getInstance().has(translatableContents.getKey()); // Paper - decompile fix - } - } - -diff --git a/src/main/java/net/minecraft/resources/RegistryDataLoader.java b/src/main/java/net/minecraft/resources/RegistryDataLoader.java -index 279df2598c54e5b035c2945c59812baf1f97356b..e1bddbbdbeea79115d0f987065c34e0f7f04d377 100644 ---- a/src/main/java/net/minecraft/resources/RegistryDataLoader.java -+++ b/src/main/java/net/minecraft/resources/RegistryDataLoader.java -@@ -92,7 +92,7 @@ public class RegistryDataLoader { - return new RegistryOps.RegistryInfoLookup() { - @Override - public Optional> lookup(ResourceKey> registryRef) { -- return Optional.ofNullable(map.get(registryRef)); -+ return Optional.ofNullable((RegistryOps.RegistryInfo) map.get(registryRef)); // Paper - decompile fix - } - }; - } +@@ -451,7 +451,7 @@ public enum ConnectionProtocol { + protocol() + .addFlow( + PacketFlow.CLIENTBOUND, +- new ConnectionProtocol.PacketSet() ++ new ConnectionProtocol.PacketSet() // Paper - decompile fix + .addPacket(ClientboundCustomPayloadPacket.class, ClientboundCustomPayloadPacket::new) + .addPacket(ClientboundDisconnectPacket.class, ClientboundDisconnectPacket::new) + .addPacket(ClientboundFinishConfigurationPacket.class, ClientboundFinishConfigurationPacket::new) +@@ -465,7 +465,7 @@ public enum ConnectionProtocol { + ) + .addFlow( + PacketFlow.SERVERBOUND, +- new ConnectionProtocol.PacketSet() ++ new ConnectionProtocol.PacketSet() // Paper - decompile fix + .addPacket(ServerboundClientInformationPacket.class, ServerboundClientInformationPacket::new) + .addPacket(ServerboundCustomPayloadPacket.class, ServerboundCustomPayloadPacket::new) + .addPacket(ServerboundFinishConfigurationPacket.class, ServerboundFinishConfigurationPacket::new) diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 15bdddae68db770690ddfcb19c7ecdbedbfa8cb7..650bf3483414751fbda7bff584af55df49cef22d 100644 +index 62e096c9cc05c387ca2413a490f44c6c66a5c41e..9c23ad38f935b2f31c0e0998e685978434202900 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -1863,7 +1863,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { MultiPackResourceManager resourcemanager = new MultiPackResourceManager(PackType.SERVER_DATA, immutablelist); -diff --git a/src/main/java/net/minecraft/server/level/Ticket.java b/src/main/java/net/minecraft/server/level/Ticket.java -index 2f66abf62d303342f5fe614fb3e35e7844497ffc..b346fa94b23d81da7da073f71dd12e672e0f079c 100644 ---- a/src/main/java/net/minecraft/server/level/Ticket.java -+++ b/src/main/java/net/minecraft/server/level/Ticket.java -@@ -21,7 +21,7 @@ public final class Ticket implements Comparable> { - return i; - } else { - int j = Integer.compare(System.identityHashCode(this.type), System.identityHashCode(ticket.type)); -- return j != 0 ? j : this.type.getComparator().compare(this.key, ticket.key); -+ return j != 0 ? j : this.type.getComparator().compare(this.key, (T)ticket.key); // Paper - decompile fix - } - } - diff --git a/src/main/java/net/minecraft/util/SortedArraySet.java b/src/main/java/net/minecraft/util/SortedArraySet.java -index 2dc801061025888192c3bf2c4c38b928c16a0165..ca788f0dcec4a117b410fe8348969e056b138b1e 100644 +index 661a6274a800ca9b91bdb809d026972d23c3b263..ea72dcb064a35bc6245bc5c94d592efedd8faf41 100644 --- a/src/main/java/net/minecraft/util/SortedArraySet.java +++ b/src/main/java/net/minecraft/util/SortedArraySet.java @@ -28,7 +28,7 @@ public class SortedArraySet extends AbstractSet { @@ -141,32 +106,6 @@ index 2dc801061025888192c3bf2c4c38b928c16a0165..ca788f0dcec4a117b410fe8348969e05 } public static SortedArraySet create(Comparator comparator) { -diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java -index e1b9e25f1f8352bf6825a5827b6b354ef7a93203..90e4e0ec0c7b0ece23c4b53f5f12b1f24e1c18ad 100644 ---- a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java -+++ b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java -@@ -101,7 +101,7 @@ public class Frog extends Animal implements VariantHolder { - - @Override - public Brain getBrain() { -- return super.getBrain(); -+ return (Brain) super.getBrain(); // Paper - decompile fix - } - - @Override -diff --git a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java -index 9799f693dc08cdfc2974959fc792ba86c5c51ceb..7bcd5498c734873b74bee503992ec4806ae61df7 100644 ---- a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java -+++ b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java -@@ -125,7 +125,7 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { - - @Override - public Brain getBrain() { -- return super.getBrain(); -+ return (Brain) super.getBrain(); // Paper - decompile fix - } - - @Override diff --git a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java index 04adc10f24f96804a5cb14e884224bb672360464..4259181bab2dc4f2d0409b56fdf81d966003376d 100644 --- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java @@ -180,42 +119,3 @@ index 04adc10f24f96804a5cb14e884224bb672360464..4259181bab2dc4f2d0409b56fdf81d96 })); this.byName = Maps.newHashMap(builder.build()); // CraftBukkit RecipeManager.LOGGER.info("Loaded {} recipes", map1.size()); -diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java -index 9fbe8ef3fea77ecbbc8689cc6472d0d5f30b7166..b8fb6d1d85e07f5165bfaf7d80807e069b595851 100644 ---- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java -+++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java -@@ -57,7 +57,7 @@ public class PalettedContainer implements PaletteResize, PalettedContainer - } - - private static > Codec codec(IdMap idList, Codec entryCodec, PalettedContainer.Strategy provider, T defaultValue, PalettedContainerRO.Unpacker reader) { -- return RecordCodecBuilder.create((instance) -> { -+ return RecordCodecBuilder.>create((instance) -> { // Paper - decompile fix - return instance.group(entryCodec.mapResult(ExtraCodecs.orElsePartial(defaultValue)).listOf().fieldOf("palette").forGetter(PalettedContainerRO.PackedData::paletteEntries), Codec.LONG_STREAM.optionalFieldOf("data").forGetter(PalettedContainerRO.PackedData::storage)).apply(instance, PalettedContainerRO.PackedData::new); - }).comapFlatMap((serialized) -> { - return reader.read(idList, provider, serialized); -diff --git a/src/main/java/net/minecraft/world/level/entity/EntityLookup.java b/src/main/java/net/minecraft/world/level/entity/EntityLookup.java -index 6b91771a4bf559881a4f3e6c98500e09b33d16e0..21a2800db22f287b9c6a8290326fdf3b94ae94b1 100644 ---- a/src/main/java/net/minecraft/world/level/entity/EntityLookup.java -+++ b/src/main/java/net/minecraft/world/level/entity/EntityLookup.java -@@ -19,7 +19,7 @@ public class EntityLookup { - public void getEntities(EntityTypeTest filter, AbortableIterationConsumer consumer) { - for(T entityAccess : this.byId.values()) { - U entityAccess2 = (U)((EntityAccess)filter.tryCast(entityAccess)); -- if (entityAccess2 != null && consumer.accept((T)entityAccess2).shouldAbort()) { -+ if (entityAccess2 != null && consumer.accept(entityAccess2).shouldAbort()) { // Paper - decompile fix - return; - } - } -diff --git a/src/main/java/net/minecraft/world/level/entity/EntitySection.java b/src/main/java/net/minecraft/world/level/entity/EntitySection.java -index 69a19dbf58cde41680d086e78b9a12ffee602dbf..5dcb7f9cab097990148f5a7c4ccbe1556afdd514 100644 ---- a/src/main/java/net/minecraft/world/level/entity/EntitySection.java -+++ b/src/main/java/net/minecraft/world/level/entity/EntitySection.java -@@ -44,7 +44,7 @@ public class EntitySection { - } else { - for(T entityAccess : collection) { - U entityAccess2 = (U)((EntityAccess)type.tryCast(entityAccess)); -- if (entityAccess2 != null && entityAccess.getBoundingBox().intersects(box) && consumer.accept((T)entityAccess2).shouldAbort()) { -+ if (entityAccess2 != null && entityAccess.getBoundingBox().intersects(box) && consumer.accept(entityAccess2).shouldAbort()) { // Paper - decompile fix - return AbortableIterationConsumer.Continuation.ABORT; - } - } diff --git a/patches/server/0008-CB-fixes.patch b/patches/server/0008-CB-fixes.patch index 98d20522e6..98a115c15e 100644 --- a/patches/server/0008-CB-fixes.patch +++ b/patches/server/0008-CB-fixes.patch @@ -52,10 +52,10 @@ index b2f37e3caf305f7f2c19c59848717bf73bd2ef5d..87c8460324ff2d2a14e1404fcfa3adb2 @Override diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java b/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java -index 161ad6ab1443b2ce33a2d7d91d189c855db0453b..15a9736a870055d639d03063c7cf67fd769fff36 100644 +index 8fa222759b8ada1674a7d3ae1c0cdf91bfd7f915..da919ad85ce06572f8e7e4c121a2c222f975c7f5 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java +++ b/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java -@@ -43,7 +43,7 @@ public class StructureCheck { +@@ -42,7 +42,7 @@ public class StructureCheck { private final Registry biomes; private final Registry structureConfigs; private final StructureTemplateManager structureTemplateManager; @@ -64,15 +64,15 @@ index 161ad6ab1443b2ce33a2d7d91d189c855db0453b..15a9736a870055d639d03063c7cf67fd private final ChunkGenerator chunkGenerator; private final RandomState randomState; private final LevelHeightAccessor heightAccessor; -@@ -53,7 +53,7 @@ public class StructureCheck { - private final Long2ObjectMap> loadedChunks = new Long2ObjectOpenHashMap<>(); - private final Map featureChecks = new HashMap<>(); - -- public StructureCheck(ChunkScanAccess chunkIoWorker, RegistryAccess registryManager, StructureTemplateManager structureTemplateManager, ResourceKey worldKey, ChunkGenerator chunkGenerator, RandomState noiseConfig, LevelHeightAccessor world, BiomeSource biomeSource, long seed, DataFixer dataFixer) { -+ public StructureCheck(ChunkScanAccess chunkIoWorker, RegistryAccess registryManager, StructureTemplateManager structureTemplateManager, ResourceKey worldKey, ChunkGenerator chunkGenerator, RandomState noiseConfig, LevelHeightAccessor world, BiomeSource biomeSource, long seed, DataFixer dataFixer) { // Paper - fix missing CB diff - this.storageAccess = chunkIoWorker; - this.registryAccess = registryManager; - this.structureTemplateManager = structureTemplateManager; +@@ -56,7 +56,7 @@ public class StructureCheck { + ChunkScanAccess chunkIoWorker, + RegistryAccess registryManager, + StructureTemplateManager structureTemplateManager, +- ResourceKey worldKey, ++ ResourceKey worldKey, // Paper - fix missing CB diff + ChunkGenerator chunkGenerator, + RandomState noiseConfig, + LevelHeightAccessor world, diff --git a/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java b/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java index 809fdf2da78293391aa5c60c04f4ad652b152eec..955b0abd4019fc45df84719eee6bf413e59d941a 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java @@ -107,7 +107,7 @@ index cd39509d383c47319b71797e5d1df41c2b8c7ab6..2cc1871c81056acd0582184bb684e672 @Override diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 19725db76dc3a12356993aed7edba507b52fe4d7..c2e1376bb06442297bda806ed8dc92f10cbbdd9a 100644 +index cc6d96c5015b4e5614e8091dc9113e82e9babc25..6f9196120177104c6e689ff1d39a06f91d04b0c8 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -122,6 +122,7 @@ public class Main { diff --git a/patches/server/0009-MC-Utils.patch b/patches/server/0009-MC-Utils.patch index 8cb6342c33..8f3da9d5b8 100644 --- a/patches/server/0009-MC-Utils.patch +++ b/patches/server/0009-MC-Utils.patch @@ -5937,10 +5937,10 @@ index 0000000000000000000000000000000000000000..d603887f4d0464f4463172fd79bcd529 + } +} diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java -index d3afd54f546ae81f1c6d1a3ca9ee4e8e5c786ae4..114f4017c4133042178c57d424f10079163835dd 100644 +index 3d4c889aa278f814f3af0af62fd38db4f1f05a45..bf17c2005aa71a627c93b3bbaa773a5902b897c1 100644 --- a/src/main/java/net/minecraft/Util.java +++ b/src/main/java/net/minecraft/Util.java -@@ -125,7 +125,7 @@ public class Util { +@@ -127,7 +127,7 @@ public class Util { } public static long getNanos() { @@ -5950,10 +5950,10 @@ index d3afd54f546ae81f1c6d1a3ca9ee4e8e5c786ae4..114f4017c4133042178c57d424f10079 public static long getEpochMillis() { diff --git a/src/main/java/net/minecraft/nbt/CompoundTag.java b/src/main/java/net/minecraft/nbt/CompoundTag.java -index c77fc9b93f3213655b2cc89f4afdec893f1cd22d..c77a6bb6885ffaaa4d9e1aa9d4770d5e847a590b 100644 +index 557702f85573da753d68fcba76dde7c74de9d12b..1e2f58f2f95c558ce28706c405050c4c5701dd40 100644 --- a/src/main/java/net/minecraft/nbt/CompoundTag.java +++ b/src/main/java/net/minecraft/nbt/CompoundTag.java -@@ -164,7 +164,7 @@ public class CompoundTag implements Tag { +@@ -159,7 +159,7 @@ public class CompoundTag implements Tag { return "TAG_Compound"; } }; @@ -5962,7 +5962,7 @@ index c77fc9b93f3213655b2cc89f4afdec893f1cd22d..c77a6bb6885ffaaa4d9e1aa9d4770d5e protected CompoundTag(Map entries) { this.tags = entries; -@@ -240,6 +240,10 @@ public class CompoundTag implements Tag { +@@ -235,6 +235,10 @@ public class CompoundTag implements Tag { this.tags.put(key, NbtUtils.createUUID(value)); } @@ -5997,7 +5997,7 @@ index e7a124403f2b07c96caaaf97d1c9023f9ec2f9d9..5b267514504497de3faa7ffa490a1792 this.receiving = side; } diff --git a/src/main/java/net/minecraft/network/PacketEncoder.java b/src/main/java/net/minecraft/network/PacketEncoder.java -index 427959874b7f167184785a582163029ad4a66df2..344c5af75c4a66bb27f3f422937c6c427c15ed25 100644 +index 522c62ff1114fa8bff41f7177f1192ab4472a6ed..d0e159f54da70bf0bd834738ced5d4b414a36142 100644 --- a/src/main/java/net/minecraft/network/PacketEncoder.java +++ b/src/main/java/net/minecraft/network/PacketEncoder.java @@ -46,7 +46,7 @@ public class PacketEncoder extends MessageToByteEncoder> { @@ -6029,7 +6029,7 @@ index 929d31aa624f035eb314dece08969b102f5781fc..e94f0361cbca873f05b5b768c68c0933 + // Paper end - MC Utils - default query payloads } diff --git a/src/main/java/net/minecraft/network/protocol/login/ServerboundCustomQueryAnswerPacket.java b/src/main/java/net/minecraft/network/protocol/login/ServerboundCustomQueryAnswerPacket.java -index 44cac39893eb968aa8ea21ee571c0dcb866ce06c..5151d68ba6ec72a7124f298253c5f0af080b2ea6 100644 +index 3ad2f40a7a1a8878290c5efd3e032572daf0b558..bcc4cd142c22e8d6957a329719353d789b826a69 100644 --- a/src/main/java/net/minecraft/network/protocol/login/ServerboundCustomQueryAnswerPacket.java +++ b/src/main/java/net/minecraft/network/protocol/login/ServerboundCustomQueryAnswerPacket.java @@ -15,7 +15,17 @@ public record ServerboundCustomQueryAnswerPacket(int transactionId, @Nullable Cu @@ -6051,7 +6051,7 @@ index 44cac39893eb968aa8ea21ee571c0dcb866ce06c..5151d68ba6ec72a7124f298253c5f0af } private static CustomQueryAnswerPayload readUnknownPayload(FriendlyByteBuf buf) { -@@ -40,4 +50,21 @@ public record ServerboundCustomQueryAnswerPacket(int transactionId, @Nullable Cu +@@ -38,4 +48,21 @@ public record ServerboundCustomQueryAnswerPacket(int transactionId, @Nullable Cu public void handle(ServerLoginPacketListener listener) { listener.handleCustomQueryPacket(this); } @@ -6959,7 +6959,7 @@ index 30fc222c384938fb4fdd4c6715295aeea57094bc..9ea829aafa7a874a784d02da889576c8 public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List list, boolean flag1, @Nullable RandomSequences randomsequences, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) { // IRegistryCustom.Dimension iregistrycustom_dimension = minecraftserver.registryAccess(); // CraftBukkit - decompile error diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index e89125da8e53cbfaa9ec5c6e56de2f7e8466c99f..a721e9cd0958d7fceed1aba8ae55fefed4e6a887 100644 +index b758a86c3d4744674faf25a6aea53c15a62ce234..c57b91c2385d118590bc419e7e6ed586d5d87422 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -259,6 +259,8 @@ public class ServerPlayer extends Player { @@ -7036,12 +7036,12 @@ index 93e0de052ea54cc1dee1ebc017fefb634eb42f8d..2e8e786407869b53cb4d7e4ec8f91fe0 GameProfileCache usercache = this.server.getProfileCache(); String s; diff --git a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java b/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java -index 337e0a7b3c14e1b1a28744920e0dc0a69e0c5a87..f5829ae484d93b547a5437b85a9621346384a11b 100644 +index 9eba8e87e34abb23c0a32cb7ffbaaf272616418a..03e8707258e9b73cf12a4750270ab7573bb1c812 100644 --- a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java +++ b/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java -@@ -78,6 +78,13 @@ public abstract class BlockableEventLoop implements Profiler +@@ -77,6 +77,13 @@ public abstract class BlockableEventLoop implements Profiler + runnable.run(); } - } + // Paper start + public void scheduleOnMain(Runnable r0) { @@ -7070,7 +7070,7 @@ index cdefbfb7a578d5f90b24f24dbc9a0fe627b91474..17e489c4650ba421a993c863426f1a20 public Entity(EntityType type, Level world) { this.id = Entity.ENTITY_COUNTER.incrementAndGet(); diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index cb0d7779a2eeadca49a99ab31217b27f5fd49e4c..864da662a81b653cd94e2270be262e912e351e21 100644 +index 36cedbf1b17a40cf15bc7207c263173d4571b466..cdac785c54e150c0886046b8d50657c0ca958438 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -259,6 +259,7 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -7107,7 +7107,7 @@ index 21fa43e0c3fabf74919f7e41d074ab1f7c061967..5e9cf929674888b3a143a0691dc6936b return this.getWalkTargetValue(pos, this.level()); } diff --git a/src/main/java/net/minecraft/world/entity/monster/Monster.java b/src/main/java/net/minecraft/world/entity/monster/Monster.java -index 86b65d66d895a4f02da002448739c122796feb4d..036d79baf372f4900681fee366bcd91c99474e5f 100644 +index f73604d762efbac400d40f536ec1782fca584efa..4701bf9ee203f2f15b0b68e84bbfa2c489b66631 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Monster.java +++ b/src/main/java/net/minecraft/world/entity/monster/Monster.java @@ -27,6 +27,7 @@ import net.minecraft.world.level.ServerLevelAccessor; @@ -7185,7 +7185,7 @@ index 1c71d2c1b16bdba1e14a8230787e4cb4ad530163..d6d8bbc98fc71997cb52521d59ebb59d FluidState getFluidState(BlockPos pos); diff --git a/src/main/java/net/minecraft/world/level/ChunkPos.java b/src/main/java/net/minecraft/world/level/ChunkPos.java -index 43bb3f5a617f4a6d719b02023a71edcb12aa9d05..2f47004a34f28a58965b1c47e78fb07ae15770cb 100644 +index 4cea6b4cad66d26a0fc66d06fa73af1eaf01b146..54cd046587c2f9dd26204bfa4eb65b8ad52b2d5e 100644 --- a/src/main/java/net/minecraft/world/level/ChunkPos.java +++ b/src/main/java/net/minecraft/world/level/ChunkPos.java @@ -20,6 +20,7 @@ public class ChunkPos { @@ -7350,7 +7350,7 @@ index bd9ea2bd012cdcf07ac322b3e0360c6c336ab1f9..bede1a64e4f04aa8e87ddb44f2cc4a1a return chunk.getBlockState(pos); } diff --git a/src/main/java/net/minecraft/world/level/LevelReader.java b/src/main/java/net/minecraft/world/level/LevelReader.java -index e6aabec35f4e27623d1fbbfb285cc78531137014..cc0d20e9f851268fe8403ac516f426ec1d008150 100644 +index daa1e9bf39666233dd80eeee0ffd76e168376889..ced67cf88c91c5270a0060a7307f36739237cbb2 100644 --- a/src/main/java/net/minecraft/world/level/LevelReader.java +++ b/src/main/java/net/minecraft/world/level/LevelReader.java @@ -26,6 +26,9 @@ public interface LevelReader extends BlockAndTintGetter, CollisionGetter, Signal @@ -7360,11 +7360,11 @@ index e6aabec35f4e27623d1fbbfb285cc78531137014..cc0d20e9f851268fe8403ac516f426ec + @Nullable ChunkAccess getChunkIfLoadedImmediately(int x, int z); // Paper - ifLoaded api (we need this since current impl blocks if the chunk is loading) + @Nullable default ChunkAccess getChunkIfLoadedImmediately(BlockPos pos) { return this.getChunkIfLoadedImmediately(pos.getX() >> 4, pos.getZ() >> 4);} + - /** @deprecated */ @Deprecated boolean hasChunk(int chunkX, int chunkZ); + diff --git a/src/main/java/net/minecraft/world/level/PathNavigationRegion.java b/src/main/java/net/minecraft/world/level/PathNavigationRegion.java -index 249b3ed33672a9a9529bd14de978722b62019314..0f1025495237aebe30132ace0832aa5718d6f9bb 100644 +index 497792978bdf0e6a53d772304770e8df3e7416ea..c5454b92ca2565461c799d7340160f9fb72c1b0f 100644 --- a/src/main/java/net/minecraft/world/level/PathNavigationRegion.java +++ b/src/main/java/net/minecraft/world/level/PathNavigationRegion.java @@ -9,6 +9,7 @@ import net.minecraft.core.Holder; @@ -7375,7 +7375,7 @@ index 249b3ed33672a9a9529bd14de978722b62019314..0f1025495237aebe30132ace0832aa57 import net.minecraft.world.entity.Entity; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.biome.Biomes; -@@ -70,7 +71,7 @@ public class PathNavigationRegion implements BlockGetter, CollisionGetter { +@@ -67,7 +68,7 @@ public class PathNavigationRegion implements BlockGetter, CollisionGetter { private ChunkAccess getChunk(int chunkX, int chunkZ) { int i = chunkX - this.centerX; int j = chunkZ - this.centerZ; @@ -7384,7 +7384,7 @@ index 249b3ed33672a9a9529bd14de978722b62019314..0f1025495237aebe30132ace0832aa57 ChunkAccess chunkAccess = this.chunks[i][j]; return (ChunkAccess)(chunkAccess != null ? chunkAccess : new EmptyLevelChunk(this.level, new ChunkPos(chunkX, chunkZ), this.plains.get())); } else { -@@ -78,6 +79,30 @@ public class PathNavigationRegion implements BlockGetter, CollisionGetter { +@@ -75,6 +76,30 @@ public class PathNavigationRegion implements BlockGetter, CollisionGetter { } } @@ -7713,10 +7713,10 @@ index d59392c322936ce89b759ac9787c8f4f0b228af6..2d6daf76a56574c9727b404feb4f8634 private short tickingFluidCount; public final PalettedContainer states; diff --git a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java -index 51a0ddcee9a9cb1040fda643a6442d2e2e15b8a0..38ec21faaa16df5485a81a581506700a5ab0a440 100644 +index 47d1a5142bdddfa89b1d84002784c1328d8ac3b4..03e5e5c5ea003ba52b9f3ee405cd77e22ea387c8 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java -@@ -72,6 +72,18 @@ public class ProtoChunk extends ChunkAccess { +@@ -81,6 +81,18 @@ public class ProtoChunk extends ChunkAccess { return new ChunkAccess.TicksToSave(this.blockTicks, this.fluidTicks); } diff --git a/patches/server/0010-Adventure.patch b/patches/server/0010-Adventure.patch index f1810399dd..5ccebb831a 100644 --- a/patches/server/0010-Adventure.patch +++ b/patches/server/0010-Adventure.patch @@ -2096,10 +2096,10 @@ index 0000000000000000000000000000000000000000..c0701d4f93a4d77a8177d2dd8d5076f9 + } +} diff --git a/src/main/java/net/minecraft/ChatFormatting.java b/src/main/java/net/minecraft/ChatFormatting.java -index e7980c88d036c617420e80bda8e1972723f97b52..efbc104acc62c5af8acf35b15f1be0d9f11113c9 100644 +index 8128ad5adc43980e6b19d87b7ade90b2d7bed699..3953972ef49e1899102116f35d9153bd81430aa7 100644 --- a/src/main/java/net/minecraft/ChatFormatting.java +++ b/src/main/java/net/minecraft/ChatFormatting.java -@@ -113,6 +113,18 @@ public enum ChatFormatting implements StringRepresentable { +@@ -110,6 +110,18 @@ public enum ChatFormatting implements StringRepresentable { return name == null ? null : FORMATTING_BY_NAME.get(cleanName(name)); } @@ -2131,19 +2131,19 @@ index db93483cfee13ca4303d7452ecbb47507dc5f89e..f6938c35ac6f6116084d3e7ec9cdc918 public CommandSourceStack(CommandSource output, Vec3 pos, Vec2 rot, ServerLevel world, int level, String name, Component displayName, MinecraftServer server, @Nullable Entity entity) { this(output, pos, rot, world, level, name, displayName, server, entity, false, CommandResultCallback.EMPTY, EntityAnchorArgument.Anchor.FEET, CommandSigningContext.ANONYMOUS, TaskChainer.immediate(server)); diff --git a/src/main/java/net/minecraft/commands/arguments/MessageArgument.java b/src/main/java/net/minecraft/commands/arguments/MessageArgument.java -index 979ea69678319338c543185ba026ad0699a388d6..a3e8b2baec7ac8a61f6cbed7095f84273be385e7 100644 +index 7511445f48d9f13106b5d45b5d5bae9172fccfe4..43a47a6d8e5043ef743c5c2d8fb802d8ba3cb8ec 100644 --- a/src/main/java/net/minecraft/commands/arguments/MessageArgument.java +++ b/src/main/java/net/minecraft/commands/arguments/MessageArgument.java -@@ -51,17 +51,21 @@ public class MessageArgument implements SignedArgument +@@ -50,17 +50,21 @@ public class MessageArgument implements SignedArgument private static void resolveSignedMessage(Consumer callback, CommandSourceStack source, PlayerChatMessage message) { MinecraftServer minecraftServer = source.getServer(); CompletableFuture completableFuture = filterPlainText(source, message); - Component component = minecraftServer.getChatDecorator().decorate(source.getPlayer(), message.decoratedContent()); -- source.getChatMessageChainer().append(completableFuture, (filtered) -> { +- source.getChatMessageChainer().append(completableFuture, filtered -> { - PlayerChatMessage playerChatMessage2 = message.withUnsignedContent(component).filter(filtered.mask()); + // Paper start - support asynchronous chat decoration + CompletableFuture componentFuture = minecraftServer.getChatDecorator().decorate(source.getPlayer(), source, message.decoratedContent()); -+ source.getChatMessageChainer().append(CompletableFuture.allOf(completableFuture, componentFuture), (filtered) -> { ++ source.getChatMessageChainer().append(CompletableFuture.allOf(completableFuture, componentFuture), filtered -> { + PlayerChatMessage playerChatMessage2 = message.withUnsignedContent(componentFuture.join().component()).filter(completableFuture.join().mask()); + // Paper end - support asynchronous chat decoration callback.accept(playerChatMessage2); @@ -2225,7 +2225,7 @@ index 9373502ede6c8a881af67db005cf12fd9313f37f..53f033d2d887909f5f905c00122d1b09 public > T readEnum(Class enumClass) { diff --git a/src/main/java/net/minecraft/network/PacketEncoder.java b/src/main/java/net/minecraft/network/PacketEncoder.java -index 344c5af75c4a66bb27f3f422937c6c427c15ed25..7070d093c80033b61a9c8495bc56153d986b6b03 100644 +index d0e159f54da70bf0bd834738ced5d4b414a36142..0d80fcee1831af59b06c4d00dc713bd4dad947fc 100644 --- a/src/main/java/net/minecraft/network/PacketEncoder.java +++ b/src/main/java/net/minecraft/network/PacketEncoder.java @@ -35,6 +35,7 @@ public class PacketEncoder extends MessageToByteEncoder> { @@ -2237,10 +2237,10 @@ index 344c5af75c4a66bb27f3f422937c6c427c15ed25..7070d093c80033b61a9c8495bc56153d try { int j = friendlyByteBuf.writerIndex(); diff --git a/src/main/java/net/minecraft/network/chat/ChatDecorator.java b/src/main/java/net/minecraft/network/chat/ChatDecorator.java -index 887b9fd625aa23c4ec828a175d63695f915232d3..8e4a4b15152c2f83444fa8017bec06bbd1389e2c 100644 +index e4624d696dcf0ddb6d42a80701dfc47ec6877540..8885e405b626daa0af1485ad734863af73b3c1f3 100644 --- a/src/main/java/net/minecraft/network/chat/ChatDecorator.java +++ b/src/main/java/net/minecraft/network/chat/ChatDecorator.java -@@ -2,12 +2,72 @@ package net.minecraft.network.chat; +@@ -2,10 +2,70 @@ package net.minecraft.network.chat; import javax.annotation.Nullable; import net.minecraft.server.level.ServerPlayer; @@ -2248,10 +2248,8 @@ index 887b9fd625aa23c4ec828a175d63695f915232d3..8e4a4b15152c2f83444fa8017bec06bb @FunctionalInterface public interface ChatDecorator { - ChatDecorator PLAIN = (sender, message) -> { -- return message; -+ return CompletableFuture.completedFuture(message); // Paper - adventure; support async chat decoration events - }; +- ChatDecorator PLAIN = (sender, message) -> message; ++ ChatDecorator PLAIN = (sender, message) -> CompletableFuture.completedFuture(message); // Paper - adventure; support async chat decoration events; - Component decorate(@Nullable ServerPlayer sender, Component message); + @io.papermc.paper.annotation.DoNotUse @Deprecated // Paper - adventure; support chat decoration events @@ -2316,10 +2314,10 @@ index 887b9fd625aa23c4ec828a175d63695f915232d3..8e4a4b15152c2f83444fa8017bec06bb + // Paper end - adventure; support async chat decoration events } diff --git a/src/main/java/net/minecraft/network/chat/ComponentSerialization.java b/src/main/java/net/minecraft/network/chat/ComponentSerialization.java -index 49138ccda0f378b13c7f425be765876eb4026b06..30568c1be4d412bfae5bd07d45b823861ec39ab3 100644 +index 48ce8553ac13a1c660a5125e17d2a173d62ca7ff..b89386d9366543f7777e6eab961938763188345f 100644 --- a/src/main/java/net/minecraft/network/chat/ComponentSerialization.java +++ b/src/main/java/net/minecraft/network/chat/ComponentSerialization.java -@@ -55,12 +55,58 @@ public class ComponentSerialization { +@@ -51,7 +51,25 @@ public class ComponentSerialization { return ExtraCodecs.orCompressed(mapCodec3, mapCodec2); } @@ -2342,11 +2340,13 @@ index 49138ccda0f378b13c7f425be765876eb4026b06..30568c1be4d412bfae5bd07d45b82386 + + private static Codec createCodec(Codec selfCodec, @javax.annotation.Nullable java.util.Locale locale) { + // Paper end - adventure; create separate codec for each locale - ComponentContents.Type[] types = new ComponentContents.Type[]{PlainTextContents.TYPE, TranslatableContents.TYPE, KeybindContents.TYPE, ScoreContents.TYPE, SelectorContents.TYPE, NbtContents.TYPE}; - MapCodec mapCodec = createLegacyComponentMatcher(types, ComponentContents.Type::codec, ComponentContents::type, "type"); - Codec codec = RecordCodecBuilder.create((instance) -> { - return instance.group(mapCodec.forGetter(Component::getContents), ExtraCodecs.strictOptionalField(ExtraCodecs.nonEmptyList(selfCodec.listOf()), "extra", List.of()).forGetter(Component::getSiblings), Style.Serializer.MAP_CODEC.forGetter(Component::getStyle)).apply(instance, MutableComponent::new); - }); + ComponentContents.Type[] types = new ComponentContents.Type[]{ + PlainTextContents.TYPE, TranslatableContents.TYPE, KeybindContents.TYPE, ScoreContents.TYPE, SelectorContents.TYPE, NbtContents.TYPE + }; +@@ -64,6 +82,34 @@ public class ComponentSerialization { + ) + .apply(instance, MutableComponent::new) + ); + // Paper start - adventure; create separate codec for each locale + final Codec origCodec = codec; + codec = new Codec<>() { @@ -2375,11 +2375,11 @@ index 49138ccda0f378b13c7f425be765876eb4026b06..30568c1be4d412bfae5bd07d45b82386 + } + }; + // Paper end - adventure; create separate codec for each locale - return Codec.either(Codec.either(Codec.STRING, ExtraCodecs.nonEmptyList(selfCodec.listOf())), codec).xmap((either) -> { - return either.map((either2) -> { - return either2.map(Component::literal, ComponentSerialization::createFromList); + return Codec.either(Codec.either(Codec.STRING, ExtraCodecs.nonEmptyList(selfCodec.listOf())), codec) + .xmap(either -> either.map(either2 -> either2.map(Component::literal, ComponentSerialization::createFromList), text -> (Component)text), text -> { + String string = text.tryCollapseToString(); diff --git a/src/main/java/net/minecraft/network/chat/ComponentUtils.java b/src/main/java/net/minecraft/network/chat/ComponentUtils.java -index b6506e881ef337bfd2a7a0644296b48b7300a0f6..57206594f305961a33542e1f8079c75bfa7c535f 100644 +index 0030c0c91e989fcdc5b7ce6490836a0e8dd3b5d5..3365aed2b67ae0e4dd0410f5190ba474f146139b 100644 --- a/src/main/java/net/minecraft/network/chat/ComponentUtils.java +++ b/src/main/java/net/minecraft/network/chat/ComponentUtils.java @@ -41,6 +41,11 @@ public class ComponentUtils { @@ -2393,12 +2393,12 @@ index b6506e881ef337bfd2a7a0644296b48b7300a0f6..57206594f305961a33542e1f8079c75b + // Paper end - adventure; pass actual vanilla component MutableComponent mutableComponent = text.getContents().resolve(source, sender, depth + 1); - for(Component component : text.getSiblings()) { + for (Component component : text.getSiblings()) { diff --git a/src/main/java/net/minecraft/network/chat/MessageSignature.java b/src/main/java/net/minecraft/network/chat/MessageSignature.java -index df9997873c4bbec184379ec14dca1bf4566eb89d..a3e2d03ffe9392cc69e850c5db7d71889a0a27ea 100644 +index 739ef5fb6f4fa37382153ba6a308ca3b451e6b05..7c3154af5d7732037c0ee965f6f8b89424461abd 100644 --- a/src/main/java/net/minecraft/network/chat/MessageSignature.java +++ b/src/main/java/net/minecraft/network/chat/MessageSignature.java -@@ -13,11 +13,12 @@ import net.minecraft.util.SignatureUpdater; +@@ -13,6 +13,7 @@ import net.minecraft.util.SignatureUpdater; import net.minecraft.util.SignatureValidator; public record MessageSignature(byte[] bytes) { @@ -2406,14 +2406,8 @@ index df9997873c4bbec184379ec14dca1bf4566eb89d..a3e2d03ffe9392cc69e850c5db7d7188 public static final Codec CODEC = ExtraCodecs.BASE64_STRING.xmap(MessageSignature::new, MessageSignature::bytes); public static final int BYTES = 256; - public MessageSignature { -- Preconditions.checkState(bs.length == 256, "Invalid message signature size"); -+ Preconditions.checkState(bytes.length == 256, "Invalid message signature size"); // Paper - decompile fix - } - - public static MessageSignature read(FriendlyByteBuf buf) { diff --git a/src/main/java/net/minecraft/network/chat/OutgoingChatMessage.java b/src/main/java/net/minecraft/network/chat/OutgoingChatMessage.java -index f8773f2982e6cd40661d138a7c32f219cda9225c..74cf1c043beef03cfd5adf481414a5ee78bef2a6 100644 +index e2def0ca552343143e495736d533b3334686fd62..c87b708c368713a23a10ad97704575ee4df27891 100644 --- a/src/main/java/net/minecraft/network/chat/OutgoingChatMessage.java +++ b/src/main/java/net/minecraft/network/chat/OutgoingChatMessage.java @@ -7,6 +7,12 @@ public interface OutgoingChatMessage { @@ -2427,10 +2421,10 @@ index f8773f2982e6cd40661d138a7c32f219cda9225c..74cf1c043beef03cfd5adf481414a5ee + // Paper end + static OutgoingChatMessage create(PlayerChatMessage message) { - return (OutgoingChatMessage)(message.isSystem() ? new OutgoingChatMessage.Disguised(message.decoratedContent()) : new OutgoingChatMessage.Player(message)); - } -@@ -14,7 +20,12 @@ public interface OutgoingChatMessage { - public static record Disguised(Component content) implements OutgoingChatMessage { + return (OutgoingChatMessage)(message.isSystem() + ? new OutgoingChatMessage.Disguised(message.decoratedContent()) +@@ -16,7 +22,12 @@ public interface OutgoingChatMessage { + public static record Disguised(@Override Component content) implements OutgoingChatMessage { @Override public void sendToPlayer(ServerPlayer sender, boolean filterMaskEnabled, ChatType.Bound params) { - sender.connection.sendDisguisedChatMessage(this.content, params); @@ -2443,7 +2437,7 @@ index f8773f2982e6cd40661d138a7c32f219cda9225c..74cf1c043beef03cfd5adf481414a5ee } } -@@ -26,7 +37,13 @@ public interface OutgoingChatMessage { +@@ -28,7 +39,13 @@ public interface OutgoingChatMessage { @Override public void sendToPlayer(ServerPlayer sender, boolean filterMaskEnabled, ChatType.Bound params) { @@ -2458,16 +2452,17 @@ index f8773f2982e6cd40661d138a7c32f219cda9225c..74cf1c043beef03cfd5adf481414a5ee sender.connection.sendPlayerChatMessage(playerChatMessage, params); } diff --git a/src/main/java/net/minecraft/network/chat/PlayerChatMessage.java b/src/main/java/net/minecraft/network/chat/PlayerChatMessage.java -index 901c1aba1653ed70f4af931835ceb12a357aff55..00560ea19c29fd0e16cbe11ab0b07f12a2ff0cb6 100644 +index d89049328641faa889b7c567123ab3a2c63b8df0..81e904e78c9fec49ac244f0a62cef75e5824f2dd 100644 --- a/src/main/java/net/minecraft/network/chat/PlayerChatMessage.java +++ b/src/main/java/net/minecraft/network/chat/PlayerChatMessage.java -@@ -14,7 +14,53 @@ import net.minecraft.Util; - import net.minecraft.util.SignatureUpdater; +@@ -15,8 +15,54 @@ import net.minecraft.util.SignatureUpdater; import net.minecraft.util.SignatureValidator; --public record PlayerChatMessage(SignedMessageLink link, @Nullable MessageSignature signature, SignedMessageBody signedBody, @Nullable Component unsignedContent, FilterMask filterMask) { -+// Paper start - adventure; support signed messages -+public record PlayerChatMessage(SignedMessageLink link, @Nullable MessageSignature signature, SignedMessageBody signedBody, @Nullable Component unsignedContent, FilterMask filterMask, @Nullable net.minecraft.network.chat.ChatDecorator.Result result) { + public record PlayerChatMessage( +- SignedMessageLink link, @Nullable MessageSignature signature, SignedMessageBody signedBody, @Nullable Component unsignedContent, FilterMask filterMask ++ SignedMessageLink link, @Nullable MessageSignature signature, SignedMessageBody signedBody, @Nullable Component unsignedContent, FilterMask filterMask, @Nullable net.minecraft.network.chat.ChatDecorator.Result result // Paper - adventure; support signed messages + ) { ++ // Paper start - adventure; support signed messages + public PlayerChatMessage(SignedMessageLink link, @Nullable MessageSignature signature, SignedMessageBody signedBody, @Nullable Component unsignedContent, FilterMask filterMask) { + this(link, signature, signedBody, unsignedContent, filterMask, null); + } @@ -2513,10 +2508,10 @@ index 901c1aba1653ed70f4af931835ceb12a357aff55..00560ea19c29fd0e16cbe11ab0b07f12 + return new AdventureView(); + } + // Paper end - adventure; support signed messages - public static final MapCodec MAP_CODEC = RecordCodecBuilder.mapCodec((instance) -> { - return instance.group(SignedMessageLink.CODEC.fieldOf("link").forGetter(PlayerChatMessage::link), MessageSignature.CODEC.optionalFieldOf("signature").forGetter((message) -> { - return Optional.ofNullable(message.signature); -@@ -39,7 +85,7 @@ public record PlayerChatMessage(SignedMessageLink link, @Nullable MessageSignatu + public static final MapCodec MAP_CODEC = RecordCodecBuilder.mapCodec( + instance -> instance.group( + SignedMessageLink.CODEC.fieldOf("link").forGetter(PlayerChatMessage::link), +@@ -47,7 +93,7 @@ public record PlayerChatMessage( } public PlayerChatMessage withUnsignedContent(Component unsignedContent) { @@ -2764,7 +2759,7 @@ index 4035faedd9f5f72f262822a9f050178d99be06e4..4c18491a627e66297627abbded1af48b public boolean logIPs() { diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index a721e9cd0958d7fceed1aba8ae55fefed4e6a887..27a1450696a633578cd44567f240cbc1a4c578ac 100644 +index c57b91c2385d118590bc419e7e6ed586d5d87422..7bad19b7e17bbdac3e8502b6a7e246070ba67e8c 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -162,6 +162,7 @@ import net.minecraft.world.damagesource.CombatTracker; @@ -3247,7 +3242,7 @@ index 2e8e786407869b53cb4d7e4ec8f91fe0a3ad8e1a..5e00df1cd2b8a6691b2f9490b1f4c3ed } diff --git a/src/main/java/net/minecraft/world/BossEvent.java b/src/main/java/net/minecraft/world/BossEvent.java -index 4c62df5a3781ec9df4a5c5f1b528649e6e8a62d1..affd1b8c7589ba59330dc0b6fc803cce4ee57397 100644 +index 80029e66d7f78aea9327edebd001d3b88b147128..42891df5db9465005d438cc4b65da2dee63d81f2 100644 --- a/src/main/java/net/minecraft/world/BossEvent.java +++ b/src/main/java/net/minecraft/world/BossEvent.java @@ -13,6 +13,7 @@ public abstract class BossEvent { @@ -4056,7 +4051,7 @@ index 9c1063d92a49c71f4458bf1634bcf9d79302ecca..f24b4732db849893fd870b4b6a49f1c4 @Override public String getTranslationKey() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 7126d8cdeea5eb23176af6a97a99b33961749d71..e78a378f0de48cde3702774970e6cda241b8ddda 100644 +index f5a5496e21e29c6ae9f497f5939823078ac8c1c0..0f51f05f334d262b3435cebce47c3b9f08936398 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -67,6 +67,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { diff --git a/patches/server/0012-Paper-Metrics.patch b/patches/server/0012-Paper-Metrics.patch index 56286148ba..3d7bf9785a 100644 --- a/patches/server/0012-Paper-Metrics.patch +++ b/patches/server/0012-Paper-Metrics.patch @@ -698,7 +698,7 @@ index 0000000000000000000000000000000000000000..6aaed8e8bf8c721fc834da5c76ac72a4 + } +} diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index faab5e8c952a2af6a286043617cded4e6ca5c3c6..813fd87df0dfed8fe46389db8333d1d9f409fbe4 100644 +index 8499eb5128d3269925ffb2c61d8532e9da47be4a..4917aa64505870a0521bc09ce4d4d3e37c03eaae 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java @@ -188,6 +188,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -710,7 +710,7 @@ index faab5e8c952a2af6a286043617cded4e6ca5c3c6..813fd87df0dfed8fe46389db8333d1d9 this.setPvpAllowed(dedicatedserverproperties.pvp); this.setFlightAllowed(dedicatedserverproperties.allowFlight); diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index 1d066ce7dcf5f548c2a34d308d4422ab4fd02e5a..0fca20580d81c461e903c8cbd1cf090f5d5083c6 100644 +index e6e070db9a6ee78e65dbff6f18cb5c8784202b9f..bd4c744c597201267418b07b9bcb522805c485eb 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java @@ -83,6 +83,7 @@ public class SpigotConfig diff --git a/patches/server/0013-Paper-Plugins.patch b/patches/server/0013-Paper-Plugins.patch index f4d48c7f53..24c7946f56 100644 --- a/patches/server/0013-Paper-Plugins.patch +++ b/patches/server/0013-Paper-Plugins.patch @@ -7117,10 +7117,10 @@ index f7114d5b8f2f93f62883e24da29afaf9f74ee1a6..8bf0630c0e06950cd99b7ae9898137f7 return foundFrame.orElse(null); diff --git a/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java b/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java -index ca70cd2e76c94f7a284c9af47c64252855f070a4..b366389fd1aed47e04884e9e495df83ec7398ca3 100644 +index d14613f7d37198276c251e73703b060a971fac28..e741062f0c9c114db47124031c6fa6a6e145a5cd 100644 --- a/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java +++ b/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java -@@ -338,7 +338,13 @@ public class BuiltInRegistries { +@@ -312,7 +312,13 @@ public class BuiltInRegistries { } public static void bootStrap() { diff --git a/patches/server/0014-Timings-v2.patch b/patches/server/0014-Timings-v2.patch index 184f493236..23cfa84192 100644 --- a/patches/server/0014-Timings-v2.patch +++ b/patches/server/0014-Timings-v2.patch @@ -1393,7 +1393,7 @@ index c4bc491eed487c0a7e30538b0fb46fde91cd7b31..382b55167dede435b034866bd394455f } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 864da662a81b653cd94e2270be262e912e351e21..da755e478d2ab1444c92afd0d916589b2e6f4df4 100644 +index cdac785c54e150c0886046b8d50657c0ca958438..13e8502640abad928282e4b1596f2ad97b4db765 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -142,7 +142,7 @@ import org.bukkit.event.entity.EntityTeleportEvent; diff --git a/patches/server/0016-Further-improve-server-tick-loop.patch b/patches/server/0016-Further-improve-server-tick-loop.patch index 5c66e16921..53f246d057 100644 --- a/patches/server/0016-Further-improve-server-tick-loop.patch +++ b/patches/server/0016-Further-improve-server-tick-loop.patch @@ -12,7 +12,7 @@ Previous implementation did not calculate TPS correctly. Switch to a realistic rolling average and factor in std deviation as an extra reporting variable diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index a6a8b5079ceaad90a79a09cab5c38a6fde6d33ee..f32aa4e03ae02d1449101c4aa89c8e0c0fa26ba5 100644 +index 3365d2ec8426888c16873a311226fa69840fa2f0..dd93d4957459556a102b9bf712dd80cb69810cb7 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -283,7 +283,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop targetPredicate) { - double d = -1.0D; -@@ -99,6 +104,20 @@ public interface EntityGetter { + double d = -1.0; +@@ -103,6 +108,20 @@ public interface EntityGetter { return this.getNearestPlayer(x, y, z, maxDistance, predicate); } @@ -132,7 +132,7 @@ index b6a3c75b84d9f768afee33aa0f226207b307c1c0..07e7851ca27ea0f8166be52b086a6504 + // Paper end - Affects Spawning API + default boolean hasNearbyAlivePlayer(double x, double y, double z, double range) { - for(Player player : this.players()) { + for (Player player : this.players()) { if (EntitySelector.NO_SPECTATORS.test(player) && EntitySelector.LIVING_ENTITY_STILL_ALIVE.test(player)) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index d53e15a3a70de8e2a405d3a39ff51a3551e82dbc..a592ee955a823309f1936a607823ff93822cd369 100644 diff --git a/patches/server/0034-Configurable-top-of-nether-void-damage.patch b/patches/server/0034-Configurable-top-of-nether-void-damage.patch index e1dc631598..7885dcabd1 100644 --- a/patches/server/0034-Configurable-top-of-nether-void-damage.patch +++ b/patches/server/0034-Configurable-top-of-nether-void-damage.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Configurable top of nether void damage Co-authored-by: Jake Potrebic diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index c21c4d6df21bc9741f087ac4a328aad04b1cda38..60d94e4d8f69fb7ab8a94a926d18d38fe1c1d6c7 100644 +index 6f687387d8f817646dacf0e0373d50db8ee80dd5..c582d2f447384ca3b46c3b8159b7114d7efef52c 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -683,7 +683,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0037-Configurable-end-credits.patch b/patches/server/0037-Configurable-end-credits.patch index d1085599d1..6c261dacae 100644 --- a/patches/server/0037-Configurable-end-credits.patch +++ b/patches/server/0037-Configurable-end-credits.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Configurable end credits diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 27a1450696a633578cd44567f240cbc1a4c578ac..3bb3312da2b91616d9d3bb4cb79259ee9e3479bd 100644 +index 7bad19b7e17bbdac3e8502b6a7e246070ba67e8c..68a376743e531dfe06bf6bd7b5be3e7d8e3154d8 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1030,6 +1030,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0039-Optimize-explosions.patch b/patches/server/0039-Optimize-explosions.patch index 9434cb4e98..2befa1204f 100644 --- a/patches/server/0039-Optimize-explosions.patch +++ b/patches/server/0039-Optimize-explosions.patch @@ -10,7 +10,7 @@ This patch adds a per-tick cache that is used for storing and retrieving an entity's exposure during an explosion. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index c6ce55d48fc71ea097a4a279fcd0dd1d4086be9b..cc2775d94f3b6ebd7f97e14e324bf292d5874de4 100644 +index b951659a8fae8929123be985d02e08f28bd1e49e..001592ec2ec34a744713d4d6c95a00955889facd 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -1489,6 +1489,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop Co-authored-by: SoSeDiK diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 01c70d149b306030c775427f744c4dfab19411cf..dedd0aa332412eec5f976959b67da5405d980ded 100644 +index 4be0935a36bd7b2e0d83e30b6edc43a6429dac22..37cba1e693490e42908f45dc68e60ac3afebbb49 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1930,7 +1930,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl diff --git a/patches/server/0054-Be-a-bit-more-informative-in-maxHealth-exception.patch b/patches/server/0054-Be-a-bit-more-informative-in-maxHealth-exception.patch index aadcfbc397..619d3c8665 100644 --- a/patches/server/0054-Be-a-bit-more-informative-in-maxHealth-exception.patch +++ b/patches/server/0054-Be-a-bit-more-informative-in-maxHealth-exception.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Be a bit more informative in maxHealth exception diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index bcab4757869428e20c67907684e02b64d2958e88..a73a5a8291ddd954f2c7b73a4895933e715c5d68 100644 +index 68c2825c2d43b3c949cc4b08035b0f5d277f34f2..844a97b0eb396835ec72b4d14c9362a2ea2a8709 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -102,7 +102,12 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { diff --git a/patches/server/0056-Add-configurable-portal-search-radius.patch b/patches/server/0056-Add-configurable-portal-search-radius.patch index 7bba890fae..df6cdd9f85 100644 --- a/patches/server/0056-Add-configurable-portal-search-radius.patch +++ b/patches/server/0056-Add-configurable-portal-search-radius.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add configurable portal search radius diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 60d94e4d8f69fb7ab8a94a926d18d38fe1c1d6c7..71c4b75901ca55e3e08fd59f0e906a0cc5334b89 100644 +index c582d2f447384ca3b46c3b8159b7114d7efef52c..8444518356f32486ee4064446f8c1396276ad015 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -3192,7 +3192,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0057-Add-velocity-warnings.patch b/patches/server/0057-Add-velocity-warnings.patch index 8439175a6d..ad776ec3f5 100644 --- a/patches/server/0057-Add-velocity-warnings.patch +++ b/patches/server/0057-Add-velocity-warnings.patch @@ -17,7 +17,7 @@ index 6135e8c0669886260afacdaa7405bf55597b17a6..2b2d0c8ed68eb86812877026a0bb5c4a static { ConfigurationSerialization.registerClass(CraftOfflinePlayer.class); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 6871fe86c9cda00d0187f3df827772200eca1bcc..4a875d038f1ab7f2bdc5f290a6ad71e4b61c6822 100644 +index 85d77772b003e56382f8c3b55fc11a9ae1ec535f..1be5c322abcec8ec32b84dec02d386e53cb5e16a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -129,10 +129,40 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { diff --git a/patches/server/0060-Disable-Scoreboards-for-non-players-by-default.patch b/patches/server/0060-Disable-Scoreboards-for-non-players-by-default.patch index b0ec269133..fae95eea55 100644 --- a/patches/server/0060-Disable-Scoreboards-for-non-players-by-default.patch +++ b/patches/server/0060-Disable-Scoreboards-for-non-players-by-default.patch @@ -11,7 +11,7 @@ So avoid looking up scoreboards and short circuit to the "not on a team" logic which is most likely to be true. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 71c4b75901ca55e3e08fd59f0e906a0cc5334b89..4dc659760272a13fc8c0f05c543bed634784af6c 100644 +index 8444518356f32486ee4064446f8c1396276ad015..9fb52c98455d547bdde6d56689528e78a5ddfed5 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -2820,6 +2820,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -23,7 +23,7 @@ index 71c4b75901ca55e3e08fd59f0e906a0cc5334b89..4dc659760272a13fc8c0f05c543bed63 } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 5ae9f9a4cb903909cb26a612a847d12515c52d91..7f85da14097ad559e5a8f82474f7a71a078b3e77 100644 +index 13e8502640abad928282e4b1596f2ad97b4db765..99e91dd930bb33a006b2be3ad678df5861eb8eeb 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -841,6 +841,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0069-Add-World-Util-Methods.patch b/patches/server/0069-Add-World-Util-Methods.patch index 527a47153c..80106855ae 100644 --- a/patches/server/0069-Add-World-Util-Methods.patch +++ b/patches/server/0069-Add-World-Util-Methods.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Add World Util Methods Methods that can be used for other patches to help improve logic. diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index eb2b4ba79488c3d43421c39852c36c4387372f38..c3138a2ff6446fb72d9eb1bd31f851d7df6b94f2 100644 +index b91df88036d3ec2579883a9c65a7b80d4c0be81b..2ad3c16bf36972ff55269612f02cdb4f558f35b7 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -347,6 +347,22 @@ public abstract class Level implements LevelAccessor, AutoCloseable { diff --git a/patches/server/0070-Custom-replacement-for-eaten-items.patch b/patches/server/0070-Custom-replacement-for-eaten-items.patch index dc47f3b1f3..fe631ab089 100644 --- a/patches/server/0070-Custom-replacement-for-eaten-items.patch +++ b/patches/server/0070-Custom-replacement-for-eaten-items.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Custom replacement for eaten items diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 7f85da14097ad559e5a8f82474f7a71a078b3e77..2356ceb62216086e7ac19e994803d5f6a0f89f83 100644 +index 99e91dd930bb33a006b2be3ad678df5861eb8eeb..13438b60bb3891e40bf0b5e942e0b2ba744121f9 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3719,10 +3719,11 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0071-handle-NaN-health-absorb-values-and-repair-bad-data.patch b/patches/server/0071-handle-NaN-health-absorb-values-and-repair-bad-data.patch index cc09649ab9..5e32ddcea2 100644 --- a/patches/server/0071-handle-NaN-health-absorb-values-and-repair-bad-data.patch +++ b/patches/server/0071-handle-NaN-health-absorb-values-and-repair-bad-data.patch @@ -5,7 +5,7 @@ Subject: [PATCH] handle NaN health/absorb values and repair bad data diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 2356ceb62216086e7ac19e994803d5f6a0f89f83..ba79c3153a2679d6a0d9ed3d1a25a999f7e78950 100644 +index 13438b60bb3891e40bf0b5e942e0b2ba744121f9..8447a47e1c493001ea9f54392e02f14da14cb25d 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -802,7 +802,13 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0072-Use-a-Shared-Random-for-Entities.patch b/patches/server/0072-Use-a-Shared-Random-for-Entities.patch index 072a1ee29a..95f53b5fed 100644 --- a/patches/server/0072-Use-a-Shared-Random-for-Entities.patch +++ b/patches/server/0072-Use-a-Shared-Random-for-Entities.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Use a Shared Random for Entities Reduces memory usage and provides ensures more randomness, Especially since a lot of garbage entity objects get created. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 4dc659760272a13fc8c0f05c543bed634784af6c..93dc90cc4e90d9db4712efff80f811d7c9d55caa 100644 +index 9fb52c98455d547bdde6d56689528e78a5ddfed5..52220795bf8a73c63837b4e07b1abf99c0344322 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -166,6 +166,79 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -99,15 +99,15 @@ index 4dc659760272a13fc8c0f05c543bed634784af6c..93dc90cc4e90d9db4712efff80f811d7 this.fluidHeight = new Object2DoubleArrayMap(2); this.fluidOnEyes = new HashSet(); diff --git a/src/main/java/net/minecraft/world/entity/animal/Squid.java b/src/main/java/net/minecraft/world/entity/animal/Squid.java -index 891d8b4c8cb73d5e310970066831ab3e2af14e91..4f32597c7af34d599f6658fe4962d41624e60419 100644 +index 1d1a4a52f3a2361688fa81ca0a2cd2e00abe652d..051fb9f1e0d91b1cb1e2dec9a03f3b26fe64c82a 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Squid.java +++ b/src/main/java/net/minecraft/world/entity/animal/Squid.java @@ -44,7 +44,7 @@ public class Squid extends WaterAnimal { public Squid(EntityType type, Level world) { super(type, world); -- this.random.setSeed((long)this.getId()); -+ //this.random.setSeed((long)this.getId()); // Paper - Share random for entities to make them more random +- this.random.setSeed(this.getId()); ++ //this.random.setSeed(this.getId()); // Paper - Share random for entities to make them more random this.tentacleSpeed = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F; } diff --git a/patches/server/0073-Configurable-spawn-chances-for-skeleton-horses.patch b/patches/server/0073-Configurable-spawn-chances-for-skeleton-horses.patch index 604e850fb3..e950cd8144 100644 --- a/patches/server/0073-Configurable-spawn-chances-for-skeleton-horses.patch +++ b/patches/server/0073-Configurable-spawn-chances-for-skeleton-horses.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Configurable spawn chances for skeleton horses diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index c9113f7e0d9e1b9861f667c40e2702c6bb1d4e53..a127acc6c44bfd078e06c74b408d62df6e85d1fe 100644 +index 5a20dc552423717f91178068dc5f8a30be13ea54..ea4eacf66651798185e1c445979a465e173571d0 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -614,7 +614,7 @@ public class ServerLevel extends Level implements WorldGenLevel { diff --git a/patches/server/0075-Entity-AddTo-RemoveFrom-World-Events.patch b/patches/server/0075-Entity-AddTo-RemoveFrom-World-Events.patch index 953744dca3..5c270f17c5 100644 --- a/patches/server/0075-Entity-AddTo-RemoveFrom-World-Events.patch +++ b/patches/server/0075-Entity-AddTo-RemoveFrom-World-Events.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Entity AddTo/RemoveFrom World Events diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 5975cc2fa72609ea5f3e6f99155d6e5bc321a321..0da9a1f428e2fa412de08296e1bafaea0ddd05d0 100644 +index 1c3b12692094c1eaa086ebb2f060b22aaf9d9b39..211f785adf6b8bfc6b974da7898cb2f4359626c9 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -2161,6 +2161,7 @@ public class ServerLevel extends Level implements WorldGenLevel { diff --git a/patches/server/0077-EntityPathfindEvent.patch b/patches/server/0077-EntityPathfindEvent.patch index c262d243bd..d46df1d840 100644 --- a/patches/server/0077-EntityPathfindEvent.patch +++ b/patches/server/0077-EntityPathfindEvent.patch @@ -6,7 +6,7 @@ Subject: [PATCH] EntityPathfindEvent Fires when an Entity decides to start moving to a location. diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/FlyingPathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/FlyingPathNavigation.java -index 3db41017c6690d4519564496edd8e7365b2f5a22..e35c38feb62c3345d82636081decc09db9f061ab 100644 +index d3a279a1a14f99aee8dd516552e5c60de92b4969..a3e0c5af4cc9323c02e88e768cbda9e46854aea1 100644 --- a/src/main/java/net/minecraft/world/entity/ai/navigation/FlyingPathNavigation.java +++ b/src/main/java/net/minecraft/world/entity/ai/navigation/FlyingPathNavigation.java @@ -40,7 +40,7 @@ public class FlyingPathNavigation extends PathNavigation { @@ -19,7 +19,7 @@ index 3db41017c6690d4519564496edd8e7365b2f5a22..e35c38feb62c3345d82636081decc09d @Override diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java -index 12564909abff7da4e5a4bb3d004a7ede2ffda12d..47de460ff5435ea6712c800c77093126908d0fce 100644 +index e8e515dc312e266f7991f150e83a2371f914c15a..8d433e354ecc91f823822a95224c9d2e2a59bbbd 100644 --- a/src/main/java/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java +++ b/src/main/java/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java @@ -41,7 +41,7 @@ public class GroundPathNavigation extends PathNavigation { @@ -28,10 +28,10 @@ index 12564909abff7da4e5a4bb3d004a7ede2ffda12d..47de460ff5435ea6712c800c77093126 @Override - public Path createPath(BlockPos target, int distance) { + public Path createPath(BlockPos target, @javax.annotation.Nullable Entity entity, int distance) { // Paper - EntityPathfindEvent - LevelChunk levelChunk = this.level.getChunkSource().getChunkNow(SectionPos.blockToSectionCoord(target.getX()), SectionPos.blockToSectionCoord(target.getZ())); - if (levelChunk == null) { - return null; -@@ -52,7 +52,7 @@ public class GroundPathNavigation extends PathNavigation { + LevelChunk levelChunk = this.level + .getChunkSource() + .getChunkNow(SectionPos.blockToSectionCoord(target.getX()), SectionPos.blockToSectionCoord(target.getZ())); +@@ -56,7 +56,7 @@ public class GroundPathNavigation extends PathNavigation { } if (blockPos.getY() > this.level.getMinBuildHeight()) { @@ -39,16 +39,18 @@ index 12564909abff7da4e5a4bb3d004a7ede2ffda12d..47de460ff5435ea6712c800c77093126 + return super.createPath(blockPos.above(), entity, distance); // Paper - EntityPathfindEvent } - while(blockPos.getY() < this.level.getMaxBuildHeight() && levelChunk.getBlockState(blockPos).isAir()) { -@@ -63,20 +63,20 @@ public class GroundPathNavigation extends PathNavigation { + while (blockPos.getY() < this.level.getMaxBuildHeight() && levelChunk.getBlockState(blockPos).isAir()) { +@@ -67,7 +67,7 @@ public class GroundPathNavigation extends PathNavigation { } if (!levelChunk.getBlockState(target).isSolid()) { - return super.createPath(target, distance); + return super.createPath(target, entity, distance); // Paper - EntityPathfindEvent } else { - BlockPos blockPos2; - for(blockPos2 = target.above(); blockPos2.getY() < this.level.getMaxBuildHeight() && levelChunk.getBlockState(blockPos2).isSolid(); blockPos2 = blockPos2.above()) { + BlockPos blockPos2 = target.above(); + +@@ -75,14 +75,14 @@ public class GroundPathNavigation extends PathNavigation { + blockPos2 = blockPos2.above(); } - return super.createPath(blockPos2, distance); @@ -65,10 +67,10 @@ index 12564909abff7da4e5a4bb3d004a7ede2ffda12d..47de460ff5435ea6712c800c77093126 private int getSurfaceY() { diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java -index fa19df17967f57b5ac99b8eee9d38864c0b7a1bb..85b3da93b6dd8e1a40d884db0721f30b9b237c69 100644 +index 480a95a7fb342b3f92306079055a06f15541200a..b5347d972c657706f8b2ed4ebf2365ba9a480895 100644 --- a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java +++ b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java -@@ -110,7 +110,13 @@ public abstract class PathNavigation { +@@ -109,7 +109,13 @@ public abstract class PathNavigation { @Nullable public Path createPath(BlockPos target, int distance) { @@ -83,7 +85,7 @@ index fa19df17967f57b5ac99b8eee9d38864c0b7a1bb..85b3da93b6dd8e1a40d884db0721f30b } @Nullable -@@ -120,7 +126,7 @@ public abstract class PathNavigation { +@@ -119,7 +125,7 @@ public abstract class PathNavigation { @Nullable public Path createPath(Entity entity, int distance) { @@ -92,7 +94,7 @@ index fa19df17967f57b5ac99b8eee9d38864c0b7a1bb..85b3da93b6dd8e1a40d884db0721f30b } @Nullable -@@ -130,6 +136,17 @@ public abstract class PathNavigation { +@@ -129,6 +135,17 @@ public abstract class PathNavigation { @Nullable protected Path createPath(Set positions, int range, boolean useHeadPos, int distance, float followRange) { @@ -109,8 +111,8 @@ index fa19df17967f57b5ac99b8eee9d38864c0b7a1bb..85b3da93b6dd8e1a40d884db0721f30b + // Paper end - EntityPathfindEvent if (positions.isEmpty()) { return null; - } else if (this.mob.getY() < (double)this.level.getMinBuildHeight()) { -@@ -139,6 +156,23 @@ public abstract class PathNavigation { + } else if (this.mob.getY() < this.level.getMinBuildHeight()) { +@@ -138,6 +155,23 @@ public abstract class PathNavigation { } else if (this.path != null && !this.path.isDone() && positions.contains(this.targetPos)) { return this.path; } else { @@ -133,9 +135,9 @@ index fa19df17967f57b5ac99b8eee9d38864c0b7a1bb..85b3da93b6dd8e1a40d884db0721f30b + // Paper end - EntityPathfindEvent this.level.getProfiler().push("pathfind"); BlockPos blockPos = useHeadPos ? this.mob.blockPosition().above() : this.mob.blockPosition(); - int i = (int)(followRange + (float)range); + int i = (int)(followRange + range); diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/WallClimberNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/WallClimberNavigation.java -index e9b49c72aa73dfcef6c136d9ed7bb5044fe8405d..185550dce31b3b31a1d1dfcebb29147131bfad66 100644 +index 0398771544d9d8751dbfea0a27aec2b5eee21383..35c95dd6be4898fcc6f55c262a1f99d7b0d34f29 100644 --- a/src/main/java/net/minecraft/world/entity/ai/navigation/WallClimberNavigation.java +++ b/src/main/java/net/minecraft/world/entity/ai/navigation/WallClimberNavigation.java @@ -16,9 +16,9 @@ public class WallClimberNavigation extends GroundPathNavigation { diff --git a/patches/server/0079-Do-not-load-chunks-for-Pathfinding.patch b/patches/server/0079-Do-not-load-chunks-for-Pathfinding.patch index 3dfd3d8f38..55c9f2fd6e 100644 --- a/patches/server/0079-Do-not-load-chunks-for-Pathfinding.patch +++ b/patches/server/0079-Do-not-load-chunks-for-Pathfinding.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Do not load chunks for Pathfinding diff --git a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java -index cd6778fa1d4261caf846ae71702621d2ec6b98c1..dbb6a7d950b1a6f58a845b4d399ead6eb6d4fe14 100644 +index 79baaf943a01912c423823e1c153c062d5316232..9e51dcaae00967bcfd30615b1d978c333fafaa8f 100644 --- a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java +++ b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java -@@ -465,7 +465,12 @@ public class WalkNodeEvaluator extends NodeEvaluator { - for(int n = -1; n <= 1; ++n) { +@@ -469,7 +469,12 @@ public class WalkNodeEvaluator extends NodeEvaluator { + for (int n = -1; n <= 1; n++) { if (l != 0 || n != 0) { pos.set(i + l, j + m, k + n); - BlockState blockState = world.getBlockState(pos); @@ -22,7 +22,7 @@ index cd6778fa1d4261caf846ae71702621d2ec6b98c1..dbb6a7d950b1a6f58a845b4d399ead6e if (blockState.is(Blocks.CACTUS) || blockState.is(Blocks.SWEET_BERRY_BUSH)) { return BlockPathTypes.DANGER_OTHER; } -@@ -481,6 +486,7 @@ public class WalkNodeEvaluator extends NodeEvaluator { +@@ -485,6 +490,7 @@ public class WalkNodeEvaluator extends NodeEvaluator { if (blockState.is(Blocks.WITHER_ROSE) || blockState.is(Blocks.POINTED_DRIPSTONE)) { return BlockPathTypes.DAMAGE_CAUTIOUS; } @@ -30,7 +30,7 @@ index cd6778fa1d4261caf846ae71702621d2ec6b98c1..dbb6a7d950b1a6f58a845b4d399ead6e } } } -@@ -490,7 +496,8 @@ public class WalkNodeEvaluator extends NodeEvaluator { +@@ -494,7 +500,8 @@ public class WalkNodeEvaluator extends NodeEvaluator { } protected static BlockPathTypes getBlockPathTypeRaw(BlockGetter world, BlockPos pos) { diff --git a/patches/server/0080-Add-PlayerUseUnknownEntityEvent.patch b/patches/server/0080-Add-PlayerUseUnknownEntityEvent.patch index 6b9696541f..06d7226a38 100644 --- a/patches/server/0080-Add-PlayerUseUnknownEntityEvent.patch +++ b/patches/server/0080-Add-PlayerUseUnknownEntityEvent.patch @@ -9,10 +9,10 @@ virtual entities/entities that are not actually known to the server. Co-authored-by: Nassim Jahnke diff --git a/src/main/java/net/minecraft/network/protocol/game/ServerboundInteractPacket.java b/src/main/java/net/minecraft/network/protocol/game/ServerboundInteractPacket.java -index 644a0fdea6576647539b96528717dbaeab498d93..221e64a66ff12a8de5c75992fc26a54a03b317e7 100644 +index b1bc671490329379e0a61466c13ca88c49259721..3a377e887989f591c671fec31208255252b58a78 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ServerboundInteractPacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ServerboundInteractPacket.java -@@ -169,4 +169,14 @@ public class ServerboundInteractPacket implements Packet> 32 >> this.divideShift); +- return (int)(index * l + m >> 32 >> this.divideShift); + //long l = Integer.toUnsignedLong(this.divideMul); // Paper - Perf: Optimize SimpleBitStorage + //long m = Integer.toUnsignedLong(this.divideAdd); // Paper - Perf: Optimize SimpleBitStorage -+ return (int) ((long) index * this.divideMulUnsigned + this.divideAddUnsigned >> 32 >> this.divideShift); // Paper - Perf: Optimize SimpleBitStorage ++ return (int) (index * this.divideMulUnsigned + this.divideAddUnsigned >> 32 >> this.divideShift); // Paper - Perf: Optimize SimpleBitStorage } @Override @@ -58,7 +58,7 @@ index f677cc252d5510a2365e73dc42bd266e56115e83..acd820b19aff4e093536cc47002a8994 int i = this.cellIndex(index); long l = this.data[i]; int j = (index - i * this.valuesPerLong) * this.bits; -@@ -91,9 +91,9 @@ public class SimpleBitStorage implements BitStorage { +@@ -282,9 +282,9 @@ public class SimpleBitStorage implements BitStorage { } @Override @@ -71,7 +71,7 @@ index f677cc252d5510a2365e73dc42bd266e56115e83..acd820b19aff4e093536cc47002a8994 int i = this.cellIndex(index); long l = this.data[i]; int j = (index - i * this.valuesPerLong) * this.bits; -@@ -101,8 +101,8 @@ public class SimpleBitStorage implements BitStorage { +@@ -292,8 +292,8 @@ public class SimpleBitStorage implements BitStorage { } @Override @@ -83,7 +83,7 @@ index f677cc252d5510a2365e73dc42bd266e56115e83..acd820b19aff4e093536cc47002a8994 long l = this.data[i]; int j = (index - i * this.valuesPerLong) * this.bits; diff --git a/src/main/java/net/minecraft/util/ZeroBitStorage.java b/src/main/java/net/minecraft/util/ZeroBitStorage.java -index 0710c72441c832a93275f3f9bd9dd7643dc0f229..b7a3f15dc1ed9e9322a86921052984c7cbd3262a 100644 +index 8dd5a5899e9b5d8b3f1a6064dd7c1580313da69e..50040c497a819cd1229042ab3cb057d34a32cacc 100644 --- a/src/main/java/net/minecraft/util/ZeroBitStorage.java +++ b/src/main/java/net/minecraft/util/ZeroBitStorage.java @@ -13,21 +13,21 @@ public class ZeroBitStorage implements BitStorage { diff --git a/patches/server/0085-Configurable-Player-Collision.patch b/patches/server/0085-Configurable-Player-Collision.patch index 2404b35354..d1204a16fd 100644 --- a/patches/server/0085-Configurable-Player-Collision.patch +++ b/patches/server/0085-Configurable-Player-Collision.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Configurable Player Collision diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java -index 3d2a689d11bfa230bab61a2a65c6051328f6b78d..cf31771648549ab6d7e4e38b30409ca48a976bea 100644 +index f767bc67fb2b63e0476771b7caabc702ce05c800..0f05f1c2a30fef68ae635f4a2476b8cd1b6a127d 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java -@@ -193,7 +193,7 @@ public class ClientboundSetPlayerTeamPacket implements Packet 11 - state.getValue(AGE) - state.getLightBlock(world, pos) && this.slightlyMelt(state, world, pos)) { - BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(); - -@@ -47,12 +48,12 @@ public class FrostedIceBlock extends IceBlock { + if ((random.nextInt(3) == 0 || this.fewerNeigboursThan(world, pos, 4)) + && world.getMaxLocalRawBrightness(pos) > 11 - state.getValue(AGE) - state.getLightBlock(world, pos) + && this.slightlyMelt(state, world, pos)) { +@@ -49,11 +50,11 @@ public class FrostedIceBlock extends IceBlock { mutableBlockPos.setWithOffset(pos, direction); BlockState blockState = world.getBlockState(mutableBlockPos); if (blockState.is(this) && !this.slightlyMelt(blockState, world, mutableBlockPos)) { @@ -24,7 +24,6 @@ index 5c8f0751def701359b388eabeb14d1dc83438c5a..f3ec0f8b8faca6aa073e76af2477f78a + world.scheduleTick(mutableBlockPos, this, Mth.nextInt(random, world.paperConfig().environment.frostedIce.delay.min, world.paperConfig().environment.frostedIce.delay.max)); // Paper - Frosted ice options } } - } else { - world.scheduleTick(pos, this, Mth.nextInt(random, 20, 40)); + world.scheduleTick(pos, this, Mth.nextInt(random, world.paperConfig().environment.frostedIce.delay.min, world.paperConfig().environment.frostedIce.delay.max)); // Paper - Frosted ice options diff --git a/patches/server/0091-Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch b/patches/server/0091-Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch index ca99379663..5ec276607a 100644 --- a/patches/server/0091-Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch +++ b/patches/server/0091-Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch @@ -5,13 +5,13 @@ Subject: [PATCH] Don't save empty scoreboard teams to scoreboard.dat diff --git a/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java b/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java -index 28e631be85fb06245e152e1f5e0bae16b7358cfd..6c3ed29e13ea78ceb1c9bb11ce0d9938bb8b4c62 100644 +index 9341349fb16256701450e452270fb85ef213e4d6..df7d9aa45d09e5aaee8c94d48bab99279335fff4 100644 --- a/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java +++ b/src/main/java/net/minecraft/world/scores/ScoreboardSaveData.java -@@ -148,6 +148,7 @@ public class ScoreboardSaveData extends SavedData { +@@ -144,6 +144,7 @@ public class ScoreboardSaveData extends SavedData { ListTag listTag = new ListTag(); - for(PlayerTeam playerTeam : this.scoreboard.getPlayerTeams()) { + for (PlayerTeam playerTeam : this.scoreboard.getPlayerTeams()) { + if (!io.papermc.paper.configuration.GlobalConfiguration.get().scoreboards.saveEmptyScoreboardTeams && playerTeam.getPlayers().isEmpty()) continue; // Paper - Don't save empty scoreboard teams to scoreboard.dat CompoundTag compoundTag = new CompoundTag(); compoundTag.putString("Name", playerTeam.getName()); diff --git a/patches/server/0092-LootTable-API-and-replenishable-lootables.patch b/patches/server/0092-LootTable-API-and-replenishable-lootables.patch index d3cd902aae..f17c37b15c 100644 --- a/patches/server/0092-LootTable-API-and-replenishable-lootables.patch +++ b/patches/server/0092-LootTable-API-and-replenishable-lootables.patch @@ -504,7 +504,7 @@ index 0000000000000000000000000000000000000000..9cfa5d36a6991067a3866e0d437749fa + } +} diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 93dc90cc4e90d9db4712efff80f811d7c9d55caa..3112eace3d9d3d7b21dfc267993cb9d84819dc11 100644 +index 52220795bf8a73c63837b4e07b1abf99c0344322..a6a97dca29c900278885b5ab1741229fcfaf7b36 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -239,6 +239,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -596,34 +596,32 @@ index 0e68f692bb9b397cffd7352e7340465b5e3719f4..58af87b8faf4f8d6bdb111c49a429466 public List transaction = new java.util.ArrayList(); private int maxStack = MAX_STACK; diff --git a/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java b/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java -index e0fbacd574e0c83c2e1d164ded8e9ccf4af30480..7529751afa2932fd16bc4591189b0358268a7b14 100644 +index 23551b97bdd865c30d7402cff0e221cfe4b1d9d4..f4ad1eea5bced6997edbc3a5ed1360b12b70f68f 100644 --- a/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java -@@ -59,10 +59,9 @@ public interface ContainerEntity extends Container, MenuProvider { +@@ -59,9 +59,8 @@ public interface ContainerEntity extends Container, MenuProvider { if (this.getLootTableSeed() != 0L) { nbt.putLong("LootTableSeed", this.getLootTableSeed()); } - } else { - ContainerHelper.saveAllItems(nbt, this.getItemStacks()); } - + ContainerHelper.saveAllItems(nbt, this.getItemStacks()); // Paper - always save the items, table may still remain } default void readChestVehicleSaveData(CompoundTag nbt) { -@@ -70,10 +69,9 @@ public interface ContainerEntity extends Container, MenuProvider { +@@ -69,9 +68,8 @@ public interface ContainerEntity extends Container, MenuProvider { if (nbt.contains("LootTable", 8)) { this.setLootTable(new ResourceLocation(nbt.getString("LootTable"))); this.setLootTableSeed(nbt.getLong("LootTableSeed")); - } else { - ContainerHelper.loadAllItems(nbt, this.getItemStacks()); } - + ContainerHelper.loadAllItems(nbt, this.getItemStacks()); // Paper - always load the items, table may still remain } default void chestVehicleDestroyed(DamageSource source, Level world, Entity vehicle) { -@@ -96,13 +94,13 @@ public interface ContainerEntity extends Container, MenuProvider { +@@ -93,13 +91,13 @@ public interface ContainerEntity extends Container, MenuProvider { default void unpackChestVehicleLootTable(@Nullable Player player) { MinecraftServer minecraftServer = this.level().getServer(); @@ -634,14 +632,14 @@ index e0fbacd574e0c83c2e1d164ded8e9ccf4af30480..7529751afa2932fd16bc4591189b0358 CriteriaTriggers.GENERATE_LOOT.trigger((ServerPlayer)player, this.getLootTable()); } -- this.setLootTable((ResourceLocation)null); +- this.setLootTable(null); + this.getLootableData().processRefill(player); // Paper - LootParams.Builder builder = (new LootParams.Builder((ServerLevel)this.level())).withParameter(LootContextParams.ORIGIN, this.position()); + LootParams.Builder builder = new LootParams.Builder((ServerLevel)this.level()).withParameter(LootContextParams.ORIGIN, this.position()); if (player != null) { builder.withLuck(player.getLuck()).withParameter(LootContextParams.THIS_ENTITY, player); -@@ -176,4 +174,13 @@ public interface ContainerEntity extends Container, MenuProvider { +@@ -171,4 +169,13 @@ public interface ContainerEntity extends Container, MenuProvider { default boolean isChestVehicleStillValid(Player player) { - return !this.isRemoved() && this.position().closerThan(player.position(), 8.0D); + return !this.isRemoved() && this.position().closerThan(player.position(), 8.0); } + // Paper start + default Entity getEntity() { @@ -654,7 +652,7 @@ index e0fbacd574e0c83c2e1d164ded8e9ccf4af30480..7529751afa2932fd16bc4591189b0358 + // Paper end } diff --git a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java -index aa4181e59f88be04a3605352fa5ceb3e04149dd3..e4e827a57c2913c719282cc0d5da33586607677b 100644 +index 1c3763d892e4e2df23ccf7a9fdb126e59b36ab65..f33c4633094002a3dd0c54353b62f7b358628be3 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java @@ -17,6 +17,7 @@ public abstract class RandomizableContainerBlockEntity extends BaseContainerBloc @@ -717,7 +715,7 @@ index aa4181e59f88be04a3605352fa5ceb3e04149dd3..e4e827a57c2913c719282cc0d5da3358 + @Override public boolean isEmpty() { - this.unpackLootTable((Player)null); + this.unpackLootTable(null); diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBrushableBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBrushableBlock.java index 86076a9d2a3b1044c96518cbaeee66d60a8a22c6..c268513bc5719d80e1c3d73de53b85ec7f852fa9 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBrushableBlock.java diff --git a/patches/server/0094-Async-GameProfileCache-saving.patch b/patches/server/0094-Async-GameProfileCache-saving.patch index 702f554313..24ad3a2b3a 100644 --- a/patches/server/0094-Async-GameProfileCache-saving.patch +++ b/patches/server/0094-Async-GameProfileCache-saving.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Async GameProfileCache saving diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 2c500fed04982c502b3e6fb1687b38bfaaa37f69..fcaa31ccd6f6e6affaccf76403dbab26e6932571 100644 +index 20ee0fd8f5a808436fae60b64fc3e8966146ba71..b9c006bef0491c401ae3a447a3f67742a75cb74f 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -980,7 +980,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { @@ -23,10 +23,10 @@ index 3084343b724098de9791bb74ffb037a499c0c430..8da64429eaf083578c672cd34f52dd42 return true; } else { diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/EnumProperty.java b/src/main/java/net/minecraft/world/level/block/state/properties/EnumProperty.java -index 647e295c7761b95db6da28f6fd043ec963f27872..0a7a6c0e7635d0ada101074d4229df7edc6dd31b 100644 +index bc7890e8ccfb133992605b06b37114424ccb093d..cd7efe4a09e114ab68a90365a6f5363a5c4c17a2 100644 --- a/src/main/java/net/minecraft/world/level/block/state/properties/EnumProperty.java +++ b/src/main/java/net/minecraft/world/level/block/state/properties/EnumProperty.java -@@ -45,8 +45,7 @@ public class EnumProperty & StringRepresentable> extends Prope +@@ -44,8 +44,7 @@ public class EnumProperty & StringRepresentable> extends Prope return value.getSerializedName(); } @@ -37,7 +37,7 @@ index 647e295c7761b95db6da28f6fd043ec963f27872..0a7a6c0e7635d0ada101074d4229df7e return true; } else { diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java b/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java -index d6c1b1817ba79a652c4094f003a7d899d4939971..cbe6e4579cc55a427dd8f8fe403478faf6d35b8f 100644 +index 3c590d400032d8266de63aae301fedbd83d37a1d..3a850321a4bcc68058483b5fd53e829c425a68af 100644 --- a/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java +++ b/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java @@ -35,8 +35,7 @@ public class IntegerProperty extends Property { @@ -51,21 +51,14 @@ index d6c1b1817ba79a652c4094f003a7d899d4939971..cbe6e4579cc55a427dd8f8fe403478fa return true; } else { diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/Property.java b/src/main/java/net/minecraft/world/level/block/state/properties/Property.java -index d1f2e29623b15fdb99ba082fd757a54fd4713761..08c2e4ba9147fbea41e0fce26ad20586832a525b 100644 +index ce06c1702e9ff2e966d94a0d622264e16ded493c..bad6c58b0adc1ca630d3e943a86a2bc66dd94c9f 100644 --- a/src/main/java/net/minecraft/world/level/block/state/properties/Property.java +++ b/src/main/java/net/minecraft/world/level/block/state/properties/Property.java -@@ -70,14 +70,7 @@ public abstract class Property> { +@@ -70,7 +70,7 @@ public abstract class Property> { @Override public boolean equals(Object object) { -- if (this == object) { -- return true; -- } else if (!(object instanceof Property)) { -- return false; -- } else { -- Property property = (Property)object; -- return this.clazz.equals(property.clazz) && this.name.equals(property.name); -- } +- return this == object || object instanceof Property property && this.clazz.equals(property.clazz) && this.name.equals(property.name); + return this == object; // Paper - Perf: Optimize hashCode/equals } diff --git a/patches/server/0103-Configurable-packet-in-spam-threshold.patch b/patches/server/0103-Configurable-packet-in-spam-threshold.patch index 73f1819cfc..45836f3841 100644 --- a/patches/server/0103-Configurable-packet-in-spam-threshold.patch +++ b/patches/server/0103-Configurable-packet-in-spam-threshold.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Configurable packet in spam threshold diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index c1c1abd45cae5f1fe010e73199e4b228f919c6a6..f9581c2f53e7a73b942505be8f00ffc3ac1774a9 100644 +index 801e1727bd291f647c91e2c325810ead070f3752..b5471f86e4c9b5167ac96eb7a114cde0f6a35a9e 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1529,13 +1529,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl diff --git a/patches/server/0104-Configurable-flying-kick-messages.patch b/patches/server/0104-Configurable-flying-kick-messages.patch index 055290f358..e0b03a6592 100644 --- a/patches/server/0104-Configurable-flying-kick-messages.patch +++ b/patches/server/0104-Configurable-flying-kick-messages.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Configurable flying kick messages diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index f9581c2f53e7a73b942505be8f00ffc3ac1774a9..6fec49a0833300ff0e4ef0f22d21480dfac9a2c7 100644 +index b5471f86e4c9b5167ac96eb7a114cde0f6a35a9e..69e525776d57b2fe80d8bb9e94e981e553f329a3 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -338,7 +338,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl diff --git a/patches/server/0111-Prevent-Pathfinding-out-of-World-Border.patch b/patches/server/0111-Prevent-Pathfinding-out-of-World-Border.patch index f473b6a56e..6c97c14e17 100644 --- a/patches/server/0111-Prevent-Pathfinding-out-of-World-Border.patch +++ b/patches/server/0111-Prevent-Pathfinding-out-of-World-Border.patch @@ -13,10 +13,10 @@ by adding code to all overrides in: to return BLOCKED if it is outside the world border. diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java -index 85b3da93b6dd8e1a40d884db0721f30b9b237c69..c3b406e6302ae0ac1ef56253ab614ca201a7a1c8 100644 +index fa5088945adc5e41e34cc2dc21a1762d106254c8..25a9f1fd69fbafab5129740e26e9741e35885ce0 100644 --- a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java +++ b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java -@@ -159,7 +159,7 @@ public abstract class PathNavigation { +@@ -158,7 +158,7 @@ public abstract class PathNavigation { // Paper start - EntityPathfindEvent boolean copiedSet = false; for (BlockPos possibleTarget : positions) { diff --git a/patches/server/0112-Optimize-Level.hasChunkAt-BlockPosition-Z.patch b/patches/server/0112-Optimize-Level.hasChunkAt-BlockPosition-Z.patch index 16a0ca9ffb..5a64d1f8f3 100644 --- a/patches/server/0112-Optimize-Level.hasChunkAt-BlockPosition-Z.patch +++ b/patches/server/0112-Optimize-Level.hasChunkAt-BlockPosition-Z.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Optimize Level.hasChunkAt(BlockPosition)Z Reduce method invocations for World.isLoaded(BlockPosition)Z diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 610ce2574a61fcee00f5224b554b285079a75698..e4a2afc20efcfd7a6107dc56217ae8451dd5a7d6 100644 +index 1ecde4f1dff5bfa67c526a699061f1952da59fae..926e4f9760e07ab66405132de2e96306211e5b9c 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -348,6 +348,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable { diff --git a/patches/server/0114-Configurable-Cartographer-Treasure-Maps.patch b/patches/server/0114-Configurable-Cartographer-Treasure-Maps.patch index 61fc245ddd..7253601c50 100644 --- a/patches/server/0114-Configurable-Cartographer-Treasure-Maps.patch +++ b/patches/server/0114-Configurable-Cartographer-Treasure-Maps.patch @@ -9,10 +9,10 @@ Also allow turning off treasure maps all together as they can eat up Map ID's which are limited in quantity. diff --git a/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java b/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java -index 43fb44b8cd164b0815335a32f04879b301a54728..318b7c7cb2a88e8d4dc4456154431fe7bfe2e0dc 100644 +index 22dd4d2a53cc99bcc863f7ef75e2e7b711ceb2b6..9b9afc01c287528b911e13cabd95f41c0d822a48 100644 --- a/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java +++ b/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java -@@ -451,7 +451,8 @@ public class VillagerTrades { +@@ -1641,7 +1641,8 @@ public class VillagerTrades { return null; } else { ServerLevel serverLevel = (ServerLevel)entity.level(); @@ -23,14 +23,13 @@ index 43fb44b8cd164b0815335a32f04879b301a54728..318b7c7cb2a88e8d4dc4456154431fe7 ItemStack itemStack = MapItem.create(serverLevel, blockPos.getX(), blockPos.getZ(), (byte)2, true, true); MapItem.renderBiomePreviewMap(serverLevel, itemStack); diff --git a/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java b/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java -index dcc6da6641e78cd80bd148ba644475811a1fbf4d..76b6544e75e52f931bed5bd9b25eda41957beaf7 100644 +index 59fa50fb8614d1492e31362feccc100701b56b8e..0bf1291fa4abf7f17381a48651a846379cedb3e1 100644 --- a/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java +++ b/src/main/java/net/minecraft/world/level/storage/loot/functions/ExplorationMapFunction.java -@@ -75,7 +75,16 @@ public class ExplorationMapFunction extends LootItemConditionalFunction { +@@ -83,8 +83,17 @@ public class ExplorationMapFunction extends LootItemConditionalFunction { Vec3 vec3 = context.getParamOrNull(LootContextParams.ORIGIN); if (vec3 != null) { ServerLevel serverLevel = context.getLevel(); -- BlockPos blockPos = serverLevel.findNearestMapStructure(this.destination, BlockPos.containing(vec3), this.searchRadius, this.skipKnownStructures); + // Paper start - Configurable cartographer treasure maps + if (!serverLevel.paperConfig().environment.treasureMaps.enabled) { + /* @@ -39,8 +38,10 @@ index dcc6da6641e78cd80bd148ba644475811a1fbf4d..76b6544e75e52f931bed5bd9b25eda41 + */ + return stack; + } -+ BlockPos blockPos = serverLevel.findNearestMapStructure(this.destination, BlockPos.containing(vec3), this.searchRadius, !serverLevel.paperConfig().environment.treasureMaps.findAlreadyDiscoveredLootTable.or(!this.skipKnownStructures)); + // Paper end - Configurable cartographer treasure maps + BlockPos blockPos = serverLevel.findNearestMapStructure( +- this.destination, BlockPos.containing(vec3), this.searchRadius, this.skipKnownStructures ++ this.destination, BlockPos.containing(vec3), this.searchRadius, !serverLevel.paperConfig().environment.treasureMaps.findAlreadyDiscoveredLootTable.or(!this.skipKnownStructures) // Paper - Configurable cartographer treasure maps + ); if (blockPos != null) { ItemStack itemStack = MapItem.create(serverLevel, blockPos.getX(), blockPos.getZ(), this.zoom, true, true); - MapItem.renderBiomePreviewMap(serverLevel, itemStack); diff --git a/patches/server/0117-Properly-fix-item-duplication-bug.patch b/patches/server/0117-Properly-fix-item-duplication-bug.patch index 47c56686b2..0d3f7e5666 100644 --- a/patches/server/0117-Properly-fix-item-duplication-bug.patch +++ b/patches/server/0117-Properly-fix-item-duplication-bug.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Properly fix item duplication bug Credit to prplz for figuring out the real issue diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 429f3ed00c0c6d7c89138aa9a4b770e3e68b7ed7..f1f090b7d9ac21f6430756ddb02b734f7dda0c7c 100644 +index 50264a1da70f120f9adf1619dd72d834ba14e499..54f343a1979794781757b221514f70aa0f7a5dec 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -2451,7 +2451,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0118-Firework-API-s.patch b/patches/server/0118-Firework-API-s.patch index a137c1c66f..88b85d9e5f 100644 --- a/patches/server/0118-Firework-API-s.patch +++ b/patches/server/0118-Firework-API-s.patch @@ -7,14 +7,14 @@ Subject: [PATCH] Firework API's public net.minecraft.world.entity.projectile.FireworkRocketEntity attachedToEntity diff --git a/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java b/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java -index 9d637e005205a32fa5406ba47de7cd2b22ead9cf..5b3b59057b962438c6f4fc8a1507342865b3bc11 100644 +index 9d637e005205a32fa5406ba47de7cd2b22ead9cf..813c4a52c8ddd70e252125ebfd3654346c71f13c 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java +++ b/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java @@ -40,6 +40,7 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { public int lifetime; @Nullable public LivingEntity attachedToEntity; -+ public java.util.UUID spawningEntity; // Paper ++ @Nullable public java.util.UUID spawningEntity; // Paper public FireworkRocketEntity(EntityType type, Level world) { super(type, world); @@ -56,18 +56,18 @@ index ac7371882d15746e9353865635d0bb716f890c53..ba570f1c9654e1004e068a1efe2118f3 object = CrossbowItem.getArrow(world, shooter, crossbow, projectile); if (creative || simulated != 0.0F) { diff --git a/src/main/java/net/minecraft/world/item/FireworkRocketItem.java b/src/main/java/net/minecraft/world/item/FireworkRocketItem.java -index 5cafb6f0b507127665393741b372286da098d603..7c627d27300247db9122ab2081049345ef306073 100644 +index 2a5a55b60cc83649e6e768a144667e021f46e27e..0bfb2667914b8001d1808bdbcf7fda6f0ff781a9 100644 --- a/src/main/java/net/minecraft/world/item/FireworkRocketItem.java +++ b/src/main/java/net/minecraft/world/item/FireworkRocketItem.java -@@ -46,6 +46,7 @@ public class FireworkRocketItem extends Item { - Vec3 vec3 = context.getClickLocation(); - Direction direction = context.getClickedFace(); - FireworkRocketEntity fireworkRocketEntity = new FireworkRocketEntity(level, context.getPlayer(), vec3.x + (double)direction.getStepX() * 0.15D, vec3.y + (double)direction.getStepY() * 0.15D, vec3.z + (double)direction.getStepZ() * 0.15D, itemStack); +@@ -53,6 +53,7 @@ public class FireworkRocketItem extends Item { + vec3.z + direction.getStepZ() * 0.15, + itemStack + ); + fireworkRocketEntity.spawningEntity = context.getPlayer() == null ? null : context.getPlayer().getUUID(); // Paper level.addFreshEntity(fireworkRocketEntity); itemStack.shrink(1); } -@@ -59,6 +60,7 @@ public class FireworkRocketItem extends Item { +@@ -66,6 +67,7 @@ public class FireworkRocketItem extends Item { ItemStack itemStack = user.getItemInHand(hand); if (!world.isClientSide) { FireworkRocketEntity fireworkRocketEntity = new FireworkRocketEntity(world, itemStack, user); diff --git a/patches/server/0122-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch b/patches/server/0122-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch index 0294d6985b..698992e2b7 100644 --- a/patches/server/0122-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch +++ b/patches/server/0122-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch @@ -127,7 +127,7 @@ index 7ce46bd254e0f14b1bbafe37e0eb97a468a07083..00b46fd0b4a718756f8b21f203fd5679 @Override diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 5ba65d647903077b39d9475ef28bfa0c400edd7a..2c3439d12e40003032904ebdb480fa95dd2a9682 100644 +index eec88cb65aae7986e53cba336f6e0bf5ff3011b3..a49d20bab5c49721fb41e2429c7fb721ef3c2f98 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -1795,7 +1795,8 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0123-Cap-Entity-Collisions.patch b/patches/server/0123-Cap-Entity-Collisions.patch index 7faa5f0876..a84c864799 100644 --- a/patches/server/0123-Cap-Entity-Collisions.patch +++ b/patches/server/0123-Cap-Entity-Collisions.patch @@ -12,7 +12,7 @@ just as it does in Vanilla, but entity pushing logic will be capped. You can set this to 0 to disable collisions. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 3112eace3d9d3d7b21dfc267993cb9d84819dc11..c261971ab482abfa5a1ca51abd189eff16421534 100644 +index a6a97dca29c900278885b5ab1741229fcfaf7b36..6d31ced629fabef4de2ef9a26586cea0cffa155c 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -394,6 +394,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -24,7 +24,7 @@ index 3112eace3d9d3d7b21dfc267993cb9d84819dc11..c261971ab482abfa5a1ca51abd189eff @javax.annotation.Nullable private org.bukkit.util.Vector origin; diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 2c3439d12e40003032904ebdb480fa95dd2a9682..ded2c573533699133309d9ed5250e6a0ce97cc54 100644 +index a49d20bab5c49721fb41e2429c7fb721ef3c2f98..589fba7264d8041e6f766779fe8e3d5071398fed 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3369,10 +3369,12 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0125-Properly-handle-async-calls-to-restart-the-server.patch b/patches/server/0125-Properly-handle-async-calls-to-restart-the-server.patch index 0bacd60877..09c60eff3e 100644 --- a/patches/server/0125-Properly-handle-async-calls-to-restart-the-server.patch +++ b/patches/server/0125-Properly-handle-async-calls-to-restart-the-server.patch @@ -30,7 +30,7 @@ will have plugins and worlds saving to the disk has a high potential to result in corruption/dataloss. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index fcaa31ccd6f6e6affaccf76403dbab26e6932571..1d8e17f4b862e71cc5ef8c5eabfb80dc427aec51 100644 +index b9c006bef0491c401ae3a447a3f67742a75cb74f..48513e585ce02c301983adbe1224e95ff7f9a345 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -236,6 +236,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop diff --git a/build.gradle.kts b/build.gradle.kts -index 1219b12750edb855df0962d14d7f3c1859d78b2e..511dfff4870c197b6f69169cc0504ef05988bb9c 100644 +index 8332781de54d73cb5803828e98882a731daed81f..cadb6a2cae98a8df97c392bfbd5a1440bccd16f4 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -6,9 +6,30 @@ plugins { @@ -413,7 +413,7 @@ index 827579f59d34b61912a67b40624f0f41524185fd..f7d937c6a11e24afe767411428210f3c @Override public PluginCommand getPluginCommand(String name) { diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index adae906894144a1684a0dab15226649fd4bf6354..1bd54fbadc9b1b5207325c78298cc72f61455ac7 100644 +index db36453ff46afded45268b3701488e23305aa2eb..e5df5469f20ccffcbe9cd227df6f5c60e82206bf 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -13,7 +13,6 @@ import java.util.logging.Logger; diff --git a/patches/server/0133-Do-not-submit-profile-lookups-to-worldgen-threads.patch b/patches/server/0133-Do-not-submit-profile-lookups-to-worldgen-threads.patch index 144dfef087..5e3192ef74 100644 --- a/patches/server/0133-Do-not-submit-profile-lookups-to-worldgen-threads.patch +++ b/patches/server/0133-Do-not-submit-profile-lookups-to-worldgen-threads.patch @@ -10,10 +10,10 @@ out due to a sync load, as the worldgen threads will be stalling on profile lookups. diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java -index 114f4017c4133042178c57d424f10079163835dd..aa52b271bd556a29f774fde375b713d0d187521b 100644 +index 9a12feebbae4a9fdfd24214c2ffa61e717d6e358..1f1422a000eb9a0fb819f26d42b3f39ed683a8da 100644 --- a/src/main/java/net/minecraft/Util.java +++ b/src/main/java/net/minecraft/Util.java -@@ -89,6 +89,22 @@ public class Util { +@@ -91,6 +91,22 @@ public class Util { private static final ExecutorService BACKGROUND_EXECUTOR = makeExecutor("Main"); private static final ExecutorService IO_POOL = makeIoExecutor("IO-Worker-", false); private static final ExecutorService DOWNLOAD_POOL = makeIoExecutor("Download-", true); diff --git a/patches/server/0144-Fix-this-stupid-bullshit.patch b/patches/server/0144-Fix-this-stupid-bullshit.patch index f71529aaed..67c72e7d54 100644 --- a/patches/server/0144-Fix-this-stupid-bullshit.patch +++ b/patches/server/0144-Fix-this-stupid-bullshit.patch @@ -31,7 +31,7 @@ index 8ff786c366332588a2df053438f23cc9fb7e2b84..c887d34171f89c731d76c4ca92c70be2 Bootstrap.isBootstrapped = true; Instant instant = Instant.now(); diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 1bd54fbadc9b1b5207325c78298cc72f61455ac7..a7a376e91fca80dd96f5a3e8910eba9772c67bfe 100644 +index e5df5469f20ccffcbe9cd227df6f5c60e82206bf..d8a7287849407c4756d4ebe4b55c358970320ce3 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -258,10 +258,12 @@ public class Main { diff --git a/patches/server/0149-Handle-plugin-prefixes-using-Log4J-configuration.patch b/patches/server/0149-Handle-plugin-prefixes-using-Log4J-configuration.patch index 8dc571bba3..42bd840658 100644 --- a/patches/server/0149-Handle-plugin-prefixes-using-Log4J-configuration.patch +++ b/patches/server/0149-Handle-plugin-prefixes-using-Log4J-configuration.patch @@ -15,7 +15,7 @@ This may cause additional prefixes to be disabled for plugins bypassing the plugin logger. diff --git a/build.gradle.kts b/build.gradle.kts -index 7a3c96318f95fcd6cf6fd94415958382d1193ec6..38ded67b38bb5dc7c59eb610b81ac33d88d25dac 100644 +index cadb6a2cae98a8df97c392bfbd5a1440bccd16f4..ca6e0c77acbcf3b32eb8b5c0f86701f52dfeea0c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -25,7 +25,7 @@ dependencies { diff --git a/patches/server/0151-Add-PlayerJumpEvent.patch b/patches/server/0151-Add-PlayerJumpEvent.patch index e24d0d58ee..cbd161bc48 100644 --- a/patches/server/0151-Add-PlayerJumpEvent.patch +++ b/patches/server/0151-Add-PlayerJumpEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerJumpEvent diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 12cfc3ed36d6eebd477dfd9058b2852e0a0d98eb..3c4431123c39256fdf704111d350c1005e4d9ef9 100644 +index 00870f788b40fc0943ef54da1e84c6e357640a32..fa8db93541dc62dc61bccc53c1aaeb3666d80ee1 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -1218,7 +1218,34 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl diff --git a/patches/server/0156-Add-PlayerArmorChangeEvent.patch b/patches/server/0156-Add-PlayerArmorChangeEvent.patch index b880ce1c49..e93b77f565 100644 --- a/patches/server/0156-Add-PlayerArmorChangeEvent.patch +++ b/patches/server/0156-Add-PlayerArmorChangeEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerArmorChangeEvent diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index ded2c573533699133309d9ed5250e6a0ce97cc54..bbf3286cb69f931be528726e45784eec9f8e0af3 100644 +index 589fba7264d8041e6f766779fe8e3d5071398fed..96805bc64fd3593373ba9eecf29bd13d33d9e053 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3068,6 +3068,13 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0160-API-to-get-a-BlockState-without-a-snapshot.patch b/patches/server/0160-API-to-get-a-BlockState-without-a-snapshot.patch index 423d453874..5b11c72288 100644 --- a/patches/server/0160-API-to-get-a-BlockState-without-a-snapshot.patch +++ b/patches/server/0160-API-to-get-a-BlockState-without-a-snapshot.patch @@ -69,7 +69,7 @@ index a1c1a101aa424e74309f6f4c0a53a6a8db5df441..013298c424025cd88f15d61e50d196f7 public Biome getBiome() { return this.getWorld().getBiome(this.getX(), this.getY(), this.getZ()); diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java -index 22af1b41eec06d660dbe47c463014bcdd96fc5b6..f046f507a095e0cb8f839b9b4b06add3a671486b 100644 +index fa490e01d1358762eda7f41db532024fc4c7605a..e7fd9ebd47af277d6dbced0f17e954722c202776 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java @@ -17,15 +17,26 @@ public class CraftBlockEntityState extends CraftBlockStat diff --git a/patches/server/0161-AsyncTabCompleteEvent.patch b/patches/server/0161-AsyncTabCompleteEvent.patch index 665a68f81e..621c5319a5 100644 --- a/patches/server/0161-AsyncTabCompleteEvent.patch +++ b/patches/server/0161-AsyncTabCompleteEvent.patch @@ -16,7 +16,7 @@ Also adds isCommand and getLocation to the sync TabCompleteEvent Co-authored-by: Aikar diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 3c4431123c39256fdf704111d350c1005e4d9ef9..f60d754cb617df3c5ab8654eba66016c1cc04617 100644 +index fa8db93541dc62dc61bccc53c1aaeb3666d80ee1..5d4730b9ced378c1e77d7734f2f8aba6d09a19d0 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -688,21 +688,58 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl diff --git a/patches/server/0164-PlayerNaturallySpawnCreaturesEvent.patch b/patches/server/0164-PlayerNaturallySpawnCreaturesEvent.patch index 86df19fb45..b535464839 100644 --- a/patches/server/0164-PlayerNaturallySpawnCreaturesEvent.patch +++ b/patches/server/0164-PlayerNaturallySpawnCreaturesEvent.patch @@ -9,7 +9,7 @@ from triggering monster spawns on a server. Also a highly more effecient way to blanket block spawns in a world diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 7245b93a4935aece23567fda0474104686485395..de328a93abcf23d3ff265557a7d8bad5be56287c 100644 +index 97bb0fc7e890273f2f975f137ec1194a1a83fde7..2a0e81a3ec0774ad98e2d74ac7672c167e28f38e 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -1203,7 +1203,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -60,7 +60,7 @@ index e0ae7274da59ff043cd423d282ed8db0382561d4..369e4bf5ff52cb774f1acaf760b8bd27 boolean flag1 = this.level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) != 0L && this.level.getLevelData().getGameTime() % this.level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) == 0L; // CraftBukkit Iterator iterator1 = list.iterator(); diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index f1f090b7d9ac21f6430756ddb02b734f7dda0c7c..19cd69fc911bb9b95257b1fdc19645bbdfe05de3 100644 +index 54f343a1979794781757b221514f70aa0f7a5dec..98d229fb8f342775482f2ed199265bda3f043a96 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -265,6 +265,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0174-Implement-extended-PaperServerListPingEvent.patch b/patches/server/0174-Implement-extended-PaperServerListPingEvent.patch index 2c073bc562..919b4393df 100644 --- a/patches/server/0174-Implement-extended-PaperServerListPingEvent.patch +++ b/patches/server/0174-Implement-extended-PaperServerListPingEvent.patch @@ -181,7 +181,7 @@ index 0000000000000000000000000000000000000000..6b0bdc266109cdfb874f08bf74323603 + +} diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 6587cd9ea257d0f6f1308ea8ca4d0245178b2870..0f3589ae1c5577c612b93289fc42cdb977486b6b 100644 +index 22b9d4bebee30877225b08b46cec6084b12a9c5a..09bd8a6576647c612e9d7f807780b1e20478a534 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -3,6 +3,9 @@ package net.minecraft.server; diff --git a/patches/server/0181-Flag-to-disable-the-channel-limit.patch b/patches/server/0181-Flag-to-disable-the-channel-limit.patch index 4c3389e676..11af2999d9 100644 --- a/patches/server/0181-Flag-to-disable-the-channel-limit.patch +++ b/patches/server/0181-Flag-to-disable-the-channel-limit.patch @@ -9,7 +9,7 @@ e.g. servers which allow and support the usage of mod packs. provide an optional flag to disable this check, at your own risk. diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index f33aee99de2007701bd593917a63e05c7fa5e349..a77c15a9c351c9cd5e8b4832016ec6de30483ed6 100644 +index ac42d245f14c9b0565f64689b4646d84791b6a86..dbf67a52ae2e18589952b2d019b5258324ff3edc 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -196,6 +196,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0186-Block-Enderpearl-Travel-Exploit.patch b/patches/server/0186-Block-Enderpearl-Travel-Exploit.patch index ffdce6c524..969fd2b959 100644 --- a/patches/server/0186-Block-Enderpearl-Travel-Exploit.patch +++ b/patches/server/0186-Block-Enderpearl-Travel-Exploit.patch @@ -16,7 +16,7 @@ public net.minecraft.world.entity.projectile.Projectile cachedOwner public net.minecraft.world.entity.projectile.Projectile ownerUUID diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 5f0885c13116ad070dc076cca5a527b2a616c541..6cadfd678f1b2323a763ffd9220de7394620328b 100644 +index 76246fdacf70309918ce413f494bdb4d8683241d..d2266bc75f2c1b0b02405eea0711a7b53d1a9e7a 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -2114,6 +2114,12 @@ public class ServerLevel extends Level implements WorldGenLevel { diff --git a/patches/server/0196-Fix-CraftEntity-hashCode.patch b/patches/server/0196-Fix-CraftEntity-hashCode.patch index 9ff8123f58..1622a61ea9 100644 --- a/patches/server/0196-Fix-CraftEntity-hashCode.patch +++ b/patches/server/0196-Fix-CraftEntity-hashCode.patch @@ -21,7 +21,7 @@ check is essentially the same as this.getHandle() == other.getHandle() However, replaced it too to make it clearer of intent. diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index d715dcc9155ad9938bd4fbe0cde43079f614f203..34e4dd733a2e9ccc3c7f1b228825428100e583e9 100644 +index 4808c62d3d951b201061659c91d1001e4b9b49ef..6fddbcec673564ac531a852f631f6acc460accbd 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -500,14 +500,15 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { diff --git a/patches/server/0197-Configurable-LootPool-luck-formula.patch b/patches/server/0197-Configurable-LootPool-luck-formula.patch index 6df631b746..db6f8a2d2d 100644 --- a/patches/server/0197-Configurable-LootPool-luck-formula.patch +++ b/patches/server/0197-Configurable-LootPool-luck-formula.patch @@ -36,14 +36,14 @@ This change will result in some major changes to fishing formulas. I would love to see this change in Vanilla, so Mojang please pull :) diff --git a/src/main/java/net/minecraft/world/level/storage/loot/entries/LootPoolSingletonContainer.java b/src/main/java/net/minecraft/world/level/storage/loot/entries/LootPoolSingletonContainer.java -index 6d5a2806345ff86e143e16ecedc2f1e8d80f5b85..0cf437dd75b97b9ba39f5134ae2ae5f33b94f653 100644 +index 55c097609812e899beda2eafea58e163edd6b71f..4f73aae0342ddcefba19e14d5400c960c2acf70c 100644 --- a/src/main/java/net/minecraft/world/level/storage/loot/entries/LootPoolSingletonContainer.java +++ b/src/main/java/net/minecraft/world/level/storage/loot/entries/LootPoolSingletonContainer.java -@@ -122,9 +122,35 @@ public abstract class LootPoolSingletonContainer extends LootPoolEntryContainer +@@ -127,9 +127,35 @@ public abstract class LootPoolSingletonContainer extends LootPoolEntryContainer protected abstract class EntryBase implements LootPoolEntry { @Override public int getWeight(float luck) { -- return Math.max(Mth.floor((float)LootPoolSingletonContainer.this.weight + (float)LootPoolSingletonContainer.this.quality * luck), 0); +- return Math.max(Mth.floor(LootPoolSingletonContainer.this.weight + LootPoolSingletonContainer.this.quality * luck), 0); + // Paper start - Configurable LootPool luck formula + // SEE: https://luckformula.emc.gs for details and data + if (LootPoolSingletonContainer.this.lastLuck != null && LootPoolSingletonContainer.this.lastLuck == luck) { diff --git a/patches/server/0199-Make-shield-blocking-delay-configurable.patch b/patches/server/0199-Make-shield-blocking-delay-configurable.patch index ae7ebd4f8e..cd4b92ec72 100644 --- a/patches/server/0199-Make-shield-blocking-delay-configurable.patch +++ b/patches/server/0199-Make-shield-blocking-delay-configurable.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Make shield blocking delay configurable diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 4af3e59b9ad84aaf1a5dd8f1373b781233ba07d6..7810739098ee52efafbbd5355d4d16dadcb5ac35 100644 +index 96805bc64fd3593373ba9eecf29bd13d33d9e053..e3dfef027fb7f6aedd3e3411af6457671b5507a7 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3828,12 +3828,24 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0202-Add-EntityKnockbackByEntityEvent-and-EntityPushedByE.patch b/patches/server/0202-Add-EntityKnockbackByEntityEvent-and-EntityPushedByE.patch index d9acc8f055..30c6ae6beb 100644 --- a/patches/server/0202-Add-EntityKnockbackByEntityEvent-and-EntityPushedByE.patch +++ b/patches/server/0202-Add-EntityKnockbackByEntityEvent-and-EntityPushedByE.patch @@ -9,7 +9,7 @@ Co-authored-by: aerulion This event is called when an entity receives knockback by another entity. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index fe314015f8cbc44e29a8ec73ecca4eeadd1da39f..d2d1a3e3c8accbdfeecafa86f9cc9f16007c3930 100644 +index 0cc82ffdcebbdd92fa953e7c52a20911f46a503c..165cc45e2ae99e606533e5e5294e431ed5e3a2dd 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -1868,9 +1868,23 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -39,7 +39,7 @@ index fe314015f8cbc44e29a8ec73ecca4eeadd1da39f..d2d1a3e3c8accbdfeecafa86f9cc9f16 protected void markHurt() { diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 21bef887193c777ec1e311b3bf5c0213180ea4ca..83a56061ce23d3d6f7d8ad3201ce325106f8a4d0 100644 +index e3dfef027fb7f6aedd3e3411af6457671b5507a7..88af8a11dfc3b645c5a2b5fb629a73fc1e2b2f80 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -1569,7 +1569,7 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -85,29 +85,29 @@ index 21bef887193c777ec1e311b3bf5c0213180ea4ca..83a56061ce23d3d6f7d8ad3201ce3251 } } diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/RamTarget.java b/src/main/java/net/minecraft/world/entity/ai/behavior/RamTarget.java -index e319a46a21a94314c5d496820b1ac4879dcf56b9..fcc0a7789c79b956f097bc6d34e0c37e0b90a2db 100644 +index a93212d3cbf18a8cf392515fd466475264bba5ef..347986ef559ebcecdb67e2f5d31a31049acc48f5 100644 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/RamTarget.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/RamTarget.java -@@ -77,7 +77,7 @@ public class RamTarget extends Behavior { - float f = 0.25F * (float)(i - j); +@@ -83,7 +83,7 @@ public class RamTarget extends Behavior { + float f = 0.25F * (i - j); float g = Mth.clamp(entity.getSpeed() * 1.65F, 0.2F, 3.0F) + f; float h = livingEntity.isDamageSourceBlocked(world.damageSources().mobAttack(entity)) ? 0.5F : 1.0F; -- livingEntity.knockback((double)(h * g) * this.getKnockbackForce.applyAsDouble(entity), this.ramDirection.x(), this.ramDirection.z()); -+ livingEntity.knockback((double)(h * g) * this.getKnockbackForce.applyAsDouble(entity), this.ramDirection.x(), this.ramDirection.z(), entity, org.bukkit.event.entity.EntityKnockbackEvent.KnockbackCause.ENTITY_ATTACK); // Paper - Add EntityKnockbackByEntityEvent and EntityPushedByEntityAttackEvent +- livingEntity.knockback(h * g * this.getKnockbackForce.applyAsDouble(entity), this.ramDirection.x(), this.ramDirection.z()); ++ livingEntity.knockback(h * g * this.getKnockbackForce.applyAsDouble(entity), this.ramDirection.x(), this.ramDirection.z(), entity, org.bukkit.event.entity.EntityKnockbackEvent.KnockbackCause.ENTITY_ATTACK); // Paper - Add EntityKnockbackByEntityEvent and EntityPushedByEntityAttackEvent this.finishRam(world, entity); - world.playSound((Player)null, entity, this.getImpactSound.apply(entity), SoundSource.NEUTRAL, 1.0F, 1.0F); + world.playSound(null, entity, this.getImpactSound.apply(entity), SoundSource.NEUTRAL, 1.0F, 1.0F); } else if (this.hasRammedHornBreakingBlock(world, entity)) { diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/warden/SonicBoom.java b/src/main/java/net/minecraft/world/entity/ai/behavior/warden/SonicBoom.java -index 29cfd065f246bbd3d3c2a5bbd32c3f4813a02951..771d798fa3b367043129f41101c65f13f0b466fa 100644 +index ce329b00fa25e9defabead0e594d734b8ed6724e..fe9c5afadd9041ab32d9e03fe6dab2a2d00262f2 100644 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/warden/SonicBoom.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/warden/SonicBoom.java -@@ -68,7 +68,7 @@ public class SonicBoom extends Behavior { - target.hurt(world.damageSources().sonicBoom(entity), 10.0F); - double d = 0.5D * (1.0D - target.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE)); - double e = 2.5D * (1.0D - target.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE)); -- target.push(vec33.x() * e, vec33.y() * d, vec33.z() * e); -+ target.push(vec33.x() * e, vec33.y() * d, vec33.z() * e, entity); // Paper - Add EntityKnockbackByEntityEvent and EntityPushedByEntityAttackEvent - }); +@@ -81,7 +81,7 @@ public class SonicBoom extends Behavior { + target.hurt(world.damageSources().sonicBoom(entity), 10.0F); + double d = 0.5 * (1.0 - target.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE)); + double e = 2.5 * (1.0 - target.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE)); +- target.push(vec33.x() * e, vec33.y() * d, vec33.z() * e); ++ target.push(vec33.x() * e, vec33.y() * d, vec33.z() * e, entity); // Paper - Add EntityKnockbackByEntityEvent and EntityPushedByEntityAttackEvent + }); } } diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java @@ -166,13 +166,13 @@ index 041f1650b853138e4286fe83a08d79d276054ce7..aba20a4352d8983b01ab5d329187588f @Override diff --git a/src/main/java/net/minecraft/world/entity/monster/hoglin/HoglinBase.java b/src/main/java/net/minecraft/world/entity/monster/hoglin/HoglinBase.java -index 81003ce3f05c6be6f52a92b86a4721235f4ce12a..cae7e3e85c3b911f50f8a06badf695c3df2847e5 100644 +index 889dca53d7a113f0b70791c75885de1c66fecdff..06cb2a4a941ccdd7371f05f7c3c6951dc6c66b04 100644 --- a/src/main/java/net/minecraft/world/entity/monster/hoglin/HoglinBase.java +++ b/src/main/java/net/minecraft/world/entity/monster/hoglin/HoglinBase.java @@ -40,7 +40,7 @@ public interface HoglinBase { - double j = f * (double)(attacker.level().random.nextFloat() * 0.5F + 0.2F); - Vec3 vec3 = (new Vec3(g, 0.0D, h)).normalize().scale(j).yRot(i); - double k = f * (double)attacker.level().random.nextFloat() * 0.5D; + double j = f * (attacker.level().random.nextFloat() * 0.5F + 0.2F); + Vec3 vec3 = new Vec3(g, 0.0, h).normalize().scale(j).yRot(i); + double k = f * attacker.level().random.nextFloat() * 0.5; - target.push(vec3.x, k, vec3.z); + target.push(vec3.x, k, vec3.z, attacker); // Paper - Add EntityKnockbackByEntityEvent and EntityPushedByEntityAttackEvent target.hurtMarked = true; diff --git a/patches/server/0206-Add-config-to-disable-ender-dragon-legacy-check.patch b/patches/server/0206-Add-config-to-disable-ender-dragon-legacy-check.patch index 8a9728d94f..9b0dd03eba 100644 --- a/patches/server/0206-Add-config-to-disable-ender-dragon-legacy-check.patch +++ b/patches/server/0206-Add-config-to-disable-ender-dragon-legacy-check.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add config to disable ender dragon legacy check diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java -index 38c2aed0785b3b5bcceba572a1a6f5fb0224964d..cad7a1b28c9d7a3e67dbf0865cbf232ebd39a8d9 100644 +index 141df4dba676fd0a714d5d48d385ee71084a7990..1c716cf65d77e54ba8f90c8cf736e20c64f5df2e 100644 --- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java +++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java @@ -106,6 +106,10 @@ public class EndDragonFight { diff --git a/patches/server/0208-InventoryCloseEvent-Reason-API.patch b/patches/server/0208-InventoryCloseEvent-Reason-API.patch index 91a388c934..aa589afd1b 100644 --- a/patches/server/0208-InventoryCloseEvent-Reason-API.patch +++ b/patches/server/0208-InventoryCloseEvent-Reason-API.patch @@ -29,7 +29,7 @@ index 256b9c6cbf52c252f8174d0aa74e1270fb092ae9..113dce44ce086272fe7f20a2007efade } // Spigot End diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 19cd69fc911bb9b95257b1fdc19645bbdfe05de3..38a3b264ba72631c27203a178ac0bbdd36e10a10 100644 +index 98d229fb8f342775482f2ed199265bda3f043a96..0b039c43bd3bd46f31477fc75585038270242de2 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -648,7 +648,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0211-Use-AsyncAppender-to-keep-logging-IO-off-main-thread.patch b/patches/server/0211-Use-AsyncAppender-to-keep-logging-IO-off-main-thread.patch index 50b3a6608f..d999d8b2ce 100644 --- a/patches/server/0211-Use-AsyncAppender-to-keep-logging-IO-off-main-thread.patch +++ b/patches/server/0211-Use-AsyncAppender-to-keep-logging-IO-off-main-thread.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Use AsyncAppender to keep logging IO off main thread diff --git a/build.gradle.kts b/build.gradle.kts -index 38ded67b38bb5dc7c59eb610b81ac33d88d25dac..30edfbf16e7bed29b3261b51d9e4f3124beef026 100644 +index ca6e0c77acbcf3b32eb8b5c0f86701f52dfeea0c..470c55412e7a4f09235947adc72944b903d6543d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -36,6 +36,7 @@ dependencies { diff --git a/patches/server/0212-add-more-information-to-Entity.toString.patch b/patches/server/0212-add-more-information-to-Entity.toString.patch index 9b1f740570..beef9001e2 100644 --- a/patches/server/0212-add-more-information-to-Entity.toString.patch +++ b/patches/server/0212-add-more-information-to-Entity.toString.patch @@ -6,7 +6,7 @@ Subject: [PATCH] add more information to Entity.toString() UUID, ticks lived, valid, dead diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 17a8c7e42b31513a4586cd2d40b2d58911814f75..b718e5a1dd49dc855a1161106b53a1d6615e8b69 100644 +index 165cc45e2ae99e606533e5e5294e431ed5e3a2dd..36f0a43cc301840406eab260b162295fe760f8bb 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -3166,7 +3166,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0213-EnderDragon-Events.patch b/patches/server/0213-EnderDragon-Events.patch index c2dbb91e76..f2eba33113 100644 --- a/patches/server/0213-EnderDragon-Events.patch +++ b/patches/server/0213-EnderDragon-Events.patch @@ -23,10 +23,10 @@ index 3eaf64a6f66c6a844e30967e6b87432e559a59e7..5c5c71db73a2bfebbb33cebd6325a0f4 } diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java -index f54576f6450e24f574bfe7f4b8e2ad5d8c9f1ba3..561e9525c37952c6b2fb52811b3767eb1044773b 100644 +index e78ed9b2392e752718361cf7bf25c1dfc2911ce2..13f60a16f07c50a278b158d64180009020a4dca6 100644 --- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java +++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java -@@ -74,7 +74,9 @@ public class DragonStrafePlayerPhase extends AbstractDragonPhaseInstance { +@@ -76,7 +76,9 @@ public class DragonStrafePlayerPhase extends AbstractDragonPhaseInstance { DragonFireball dragonFireball = new DragonFireball(this.dragon.level(), this.dragon, r, s, t); dragonFireball.moveTo(o, p, q, 0.0F, 0.0F); @@ -35,7 +35,7 @@ index f54576f6450e24f574bfe7f4b8e2ad5d8c9f1ba3..561e9525c37952c6b2fb52811b3767eb + else dragonFireball.discard(null); // Paper - EnderDragon Events this.fireballCharge = 0; if (this.currentPath != null) { - while(!this.currentPath.isDone()) { + while (!this.currentPath.isDone()) { diff --git a/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java b/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java index a425659d89165610fdb1afa3095bf4ac867646ae..58723ea75f7db9bf3889b99139669b14a284a3a1 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java diff --git a/patches/server/0214-PlayerElytraBoostEvent.patch b/patches/server/0214-PlayerElytraBoostEvent.patch index 902f983c36..b9afdb2bf1 100644 --- a/patches/server/0214-PlayerElytraBoostEvent.patch +++ b/patches/server/0214-PlayerElytraBoostEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] PlayerElytraBoostEvent diff --git a/src/main/java/net/minecraft/world/item/FireworkRocketItem.java b/src/main/java/net/minecraft/world/item/FireworkRocketItem.java -index 7c627d27300247db9122ab2081049345ef306073..6e6c9477b70b0e1ab36bca9fa91806a283ebedd1 100644 +index 3749cfca8f007973d1a2206d8f2ba15283a550e1..eb655eb01e4841ca163666f21dae00f0632a11e5 100644 --- a/src/main/java/net/minecraft/world/item/FireworkRocketItem.java +++ b/src/main/java/net/minecraft/world/item/FireworkRocketItem.java -@@ -61,12 +61,19 @@ public class FireworkRocketItem extends Item { +@@ -68,12 +68,19 @@ public class FireworkRocketItem extends Item { if (!world.isClientSide) { FireworkRocketEntity fireworkRocketEntity = new FireworkRocketEntity(world, itemStack, user); fireworkRocketEntity.spawningEntity = user.getUUID(); // Paper diff --git a/patches/server/0215-PlayerLaunchProjectileEvent.patch b/patches/server/0215-PlayerLaunchProjectileEvent.patch index 5d9bed5608..6e2265c0d2 100644 --- a/patches/server/0215-PlayerLaunchProjectileEvent.patch +++ b/patches/server/0215-PlayerLaunchProjectileEvent.patch @@ -88,15 +88,24 @@ index c7d4745aed77b23562cde7c68b8870fa239428d4..8c8cf8705107c95d9a4eab28b5845ae1 return InteractionResultHolder.sidedSuccess(itemstack, world.isClientSide()); } diff --git a/src/main/java/net/minecraft/world/item/ExperienceBottleItem.java b/src/main/java/net/minecraft/world/item/ExperienceBottleItem.java -index 72dfb7b652f515bf9df201d524a851ab56706544..39fe6734c8dcd34c563e33e717937bbd91882e1e 100644 +index fe03ef2e400b246f7f3a9333506f22b63ae28690..ad147f392e7ef151d971d462431ab67d378cc920 100644 --- a/src/main/java/net/minecraft/world/item/ExperienceBottleItem.java +++ b/src/main/java/net/minecraft/world/item/ExperienceBottleItem.java -@@ -22,18 +22,37 @@ public class ExperienceBottleItem extends Item { +@@ -22,27 +22,46 @@ public class ExperienceBottleItem extends Item { @Override public InteractionResultHolder use(Level world, Player user, InteractionHand hand) { ItemStack itemStack = user.getItemInHand(hand); -- world.playSound((Player)null, user.getX(), user.getY(), user.getZ(), SoundEvents.EXPERIENCE_BOTTLE_THROW, SoundSource.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F)); -+ // world.playSound((Player)null, user.getX(), user.getY(), user.getZ(), SoundEvents.EXPERIENCE_BOTTLE_THROW, SoundSource.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F)); // Paper - PlayerLaunchProjectileEvent; moved down +- world.playSound( +- null, +- user.getX(), +- user.getY(), +- user.getZ(), +- SoundEvents.EXPERIENCE_BOTTLE_THROW, +- SoundSource.NEUTRAL, +- 0.5F, +- 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F) +- ); ++ // Paper - PlayerLaunchProjectileEvent; moved down if (!world.isClientSide) { ThrownExperienceBottle thrownExperienceBottle = new ThrownExperienceBottle(world, user); thrownExperienceBottle.setItem(itemStack); @@ -111,7 +120,16 @@ index 72dfb7b652f515bf9df201d524a851ab56706544..39fe6734c8dcd34c563e33e717937bbd + ((net.minecraft.server.level.ServerPlayer) user).getBukkitEntity().updateInventory(); + } + -+ world.playSound((Player) null, user.getX(), user.getY(), user.getZ(), SoundEvents.EXPERIENCE_BOTTLE_THROW, SoundSource.NEUTRAL, 0.5F, 0.4F / (net.minecraft.world.entity.Entity.SHARED_RANDOM.nextFloat() * 0.4F + 0.8F)); ++ world.playSound( ++ null, ++ user.getX(), ++ user.getY(), ++ user.getZ(), ++ SoundEvents.EXPERIENCE_BOTTLE_THROW, ++ SoundSource.NEUTRAL, ++ 0.5F, ++ 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F) ++ ); + user.awardStat(Stats.ITEM_USED.get(this)); + } else { + if (user instanceof net.minecraft.server.level.ServerPlayer) { @@ -132,12 +150,12 @@ index 72dfb7b652f515bf9df201d524a851ab56706544..39fe6734c8dcd34c563e33e717937bbd return InteractionResultHolder.sidedSuccess(itemStack, world.isClientSide()); } diff --git a/src/main/java/net/minecraft/world/item/FireworkRocketItem.java b/src/main/java/net/minecraft/world/item/FireworkRocketItem.java -index 6e6c9477b70b0e1ab36bca9fa91806a283ebedd1..0821c06a4c66edc8fcee09fc192335a588d2944b 100644 +index eb655eb01e4841ca163666f21dae00f0632a11e5..8a82b8bec014b70d672cfaae84510ed84fd2ea97 100644 --- a/src/main/java/net/minecraft/world/item/FireworkRocketItem.java +++ b/src/main/java/net/minecraft/world/item/FireworkRocketItem.java -@@ -47,8 +47,12 @@ public class FireworkRocketItem extends Item { - Direction direction = context.getClickedFace(); - FireworkRocketEntity fireworkRocketEntity = new FireworkRocketEntity(level, context.getPlayer(), vec3.x + (double)direction.getStepX() * 0.15D, vec3.y + (double)direction.getStepY() * 0.15D, vec3.z + (double)direction.getStepZ() * 0.15D, itemStack); +@@ -54,8 +54,12 @@ public class FireworkRocketItem extends Item { + itemStack + ); fireworkRocketEntity.spawningEntity = context.getPlayer() == null ? null : context.getPlayer().getUUID(); // Paper - level.addFreshEntity(fireworkRocketEntity); - itemStack.shrink(1); @@ -151,18 +169,26 @@ index 6e6c9477b70b0e1ab36bca9fa91806a283ebedd1..0821c06a4c66edc8fcee09fc192335a5 return InteractionResult.sidedSuccess(level.isClientSide); diff --git a/src/main/java/net/minecraft/world/item/LingeringPotionItem.java b/src/main/java/net/minecraft/world/item/LingeringPotionItem.java -index 04370590e6c8051ad17f937576b4cd88f6afb5d9..8526251e45899499bc4d9b6254fa1b190a3843d8 100644 +index a822d82b577be20b5c8aa9ba1a4a0d6e4a493354..fec53407acc9bb95ae91e02a44ebc0e8d51355cf 100644 --- a/src/main/java/net/minecraft/world/item/LingeringPotionItem.java +++ b/src/main/java/net/minecraft/world/item/LingeringPotionItem.java -@@ -23,7 +23,12 @@ public class LingeringPotionItem extends ThrowablePotionItem { +@@ -23,6 +23,10 @@ public class LingeringPotionItem extends ThrowablePotionItem { @Override public InteractionResultHolder use(Level world, Player user, InteractionHand hand) { + // Paper start - PlayerLaunchProjectileEvent + InteractionResultHolder wrapper = super.use(world, user, hand); + if (wrapper.getResult() != net.minecraft.world.InteractionResult.FAIL) { - world.playSound((Player)null, user.getX(), user.getY(), user.getZ(), SoundEvents.LINGERING_POTION_THROW, SoundSource.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F)); ++ // Paper end - PlayerLaunchProjectileEvent + world.playSound( + null, + user.getX(), +@@ -33,6 +37,9 @@ public class LingeringPotionItem extends ThrowablePotionItem { + 0.5F, + 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F) + ); - return super.use(world, user, hand); ++ // Paper start - PlayerLaunchProjectileEvent + } + return wrapper; + // Paper end - PlayerLaunchProjectileEvent @@ -212,18 +238,26 @@ index d60e57e84f7d66e1858ab50ac33777feedf1c54d..bc8186a5bc3a98b35fad570729dd4ba5 return InteractionResultHolder.sidedSuccess(itemstack, world.isClientSide()); } diff --git a/src/main/java/net/minecraft/world/item/SplashPotionItem.java b/src/main/java/net/minecraft/world/item/SplashPotionItem.java -index 317e20052bcac9118e1adeb619bedaacc6fcd690..3bd127780091c6bb9ec17c88f0cf57b0b8f37e11 100644 +index 935c34ba7eb14348becdd3ac0c29766abf7ca614..73bac60b3bf6d20d415a8250d0426251c0c3265b 100644 --- a/src/main/java/net/minecraft/world/item/SplashPotionItem.java +++ b/src/main/java/net/minecraft/world/item/SplashPotionItem.java -@@ -14,7 +14,12 @@ public class SplashPotionItem extends ThrowablePotionItem { +@@ -14,6 +14,10 @@ public class SplashPotionItem extends ThrowablePotionItem { @Override public InteractionResultHolder use(Level world, Player user, InteractionHand hand) { + // Paper start - PlayerLaunchProjectileEvent + InteractionResultHolder wrapper = super.use(world, user, hand); + if (wrapper.getResult() != net.minecraft.world.InteractionResult.FAIL) { - world.playSound((Player)null, user.getX(), user.getY(), user.getZ(), SoundEvents.SPLASH_POTION_THROW, SoundSource.PLAYERS, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F)); ++ // Paper end - PlayerLaunchProjectileEvent + world.playSound( + null, + user.getX(), +@@ -24,6 +28,9 @@ public class SplashPotionItem extends ThrowablePotionItem { + 0.5F, + 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F) + ); - return super.use(world, user, hand); ++ // Paper start - PlayerLaunchProjectileEvent + } + return wrapper; + // Paper end - PlayerLaunchProjectileEvent @@ -267,7 +301,7 @@ index 0673f62f25532955f3552b64f122e644d42027e4..f47f793c62a919fb65c081ddb82d597a return InteractionResultHolder.sidedSuccess(itemStack, world.isClientSide()); } diff --git a/src/main/java/net/minecraft/world/item/TridentItem.java b/src/main/java/net/minecraft/world/item/TridentItem.java -index 2ccbba4775d7550c5c7277aee9cab9ff7d665693..fa876ddf54780728e7f3ecfe02aa8a16b8ef6f8d 100644 +index f46d0015d707e6708b9e19cc8f20fad5d3bd590b..a792c7b7a6179aa88fc473b27ef0ca13bd91a395 100644 --- a/src/main/java/net/minecraft/world/item/TridentItem.java +++ b/src/main/java/net/minecraft/world/item/TridentItem.java @@ -83,21 +83,26 @@ public class TridentItem extends Item implements Vanishable { diff --git a/patches/server/0216-Improve-BlockPosition-inlining.patch b/patches/server/0216-Improve-BlockPosition-inlining.patch index b9b5c09af2..52f65f41ad 100644 --- a/patches/server/0216-Improve-BlockPosition-inlining.patch +++ b/patches/server/0216-Improve-BlockPosition-inlining.patch @@ -21,19 +21,16 @@ This is based upon conclusions drawn from inspecting the assenmbly generated byt They had 'callq' (invoke) instead of 'mov' (get from memory) instructions. diff --git a/src/main/java/net/minecraft/core/Vec3i.java b/src/main/java/net/minecraft/core/Vec3i.java -index 1b29c6872ebe54351f28c1f1f38b22561ba785ee..5256ff18d992250e04a6180e196c2d5d3f0928ca 100644 +index 64acf7d83d3419af603ad43172c35ed321a2d1c4..afb1e5ff7b1b6b42f81eaa7888a1ec3ded804ccb 100644 --- a/src/main/java/net/minecraft/core/Vec3i.java +++ b/src/main/java/net/minecraft/core/Vec3i.java -@@ -38,7 +38,7 @@ public class Vec3i implements Comparable { +@@ -37,12 +37,12 @@ public class Vec3i implements Comparable { } @Override - public boolean equals(Object object) { + public final boolean equals(Object object) { // Paper - Perf: Final for inline - if (this == object) { - return true; - } else if (!(object instanceof Vec3i)) { -@@ -56,7 +56,7 @@ public class Vec3i implements Comparable { + return this == object || object instanceof Vec3i vec3i && this.getX() == vec3i.getX() && this.getY() == vec3i.getY() && this.getZ() == vec3i.getZ(); } @Override @@ -42,7 +39,7 @@ index 1b29c6872ebe54351f28c1f1f38b22561ba785ee..5256ff18d992250e04a6180e196c2d5d return (this.getY() + this.getZ() * 31) * 31 + this.getX(); } -@@ -69,15 +69,15 @@ public class Vec3i implements Comparable { +@@ -55,15 +55,15 @@ public class Vec3i implements Comparable { } } diff --git a/patches/server/0220-SkeletonHorse-Additions.patch b/patches/server/0220-SkeletonHorse-Additions.patch index 15761af470..201b108f16 100644 --- a/patches/server/0220-SkeletonHorse-Additions.patch +++ b/patches/server/0220-SkeletonHorse-Additions.patch @@ -32,10 +32,10 @@ index 8f20239f3ef7ebe41fac8ee6e024c36dafec33c4..d00fb16ae3b94dfcb10fd1a7c1671595 this.horse.setTrap(false); diff --git a/src/main/java/net/minecraft/world/level/EntityGetter.java b/src/main/java/net/minecraft/world/level/EntityGetter.java -index 07e7851ca27ea0f8166be52b086a6504c0deea09..e7b6f97d8519a5797903664e5ba2a793e37a4bfc 100644 +index 72b3913d00d6f2ec01a716444debe065c48174f6..c35d5865b77203d0de6467d2793424837704e95a 100644 --- a/src/main/java/net/minecraft/world/level/EntityGetter.java +++ b/src/main/java/net/minecraft/world/level/EntityGetter.java -@@ -93,6 +93,28 @@ public interface EntityGetter { +@@ -97,6 +97,28 @@ public interface EntityGetter { return player; } diff --git a/patches/server/0225-Break-up-and-make-tab-spam-limits-configurable.patch b/patches/server/0225-Break-up-and-make-tab-spam-limits-configurable.patch index 48a5038a88..eef3036873 100644 --- a/patches/server/0225-Break-up-and-make-tab-spam-limits-configurable.patch +++ b/patches/server/0225-Break-up-and-make-tab-spam-limits-configurable.patch @@ -22,7 +22,7 @@ to take the burden of this into their own hand without having to rely on plugins doing unsafe things. diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 3d6355f50d04035f62fa9eddee076d0a157c89a6..acf350e18b9e4de77b43a01afe40a72ef040d92e 100644 +index 91cc18da4f0beca4cc4a9e13627b87931262efb6..a2eb93d47f659eb5b978358ee409bbf5f5d4d35a 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -256,6 +256,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl diff --git a/patches/server/0228-Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch b/patches/server/0228-Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch index 8ca9496478..18b6234816 100644 --- a/patches/server/0228-Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch +++ b/patches/server/0228-Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch @@ -43,7 +43,7 @@ index 113dce44ce086272fe7f20a2007efadee142ff85..0811a2e87192b46c39f54c26ce0e56fc // WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getKey(entity.getType())); // CraftBukkit return false; diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index b718e5a1dd49dc855a1161106b53a1d6615e8b69..31ff851cc15216fb5855f829f3fc22c1d26ece21 100644 +index 36f0a43cc301840406eab260b162295fe760f8bb..c46ad2013439f043145fb7fc67bbcd80728e3c16 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -242,6 +242,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -55,10 +55,10 @@ index b718e5a1dd49dc855a1161106b53a1d6615e8b69..31ff851cc15216fb5855f829f3fc22c1 if (this.bukkitEntity == null) { this.bukkitEntity = CraftEntity.getEntity(this.level.getCraftServer(), this); diff --git a/src/main/java/net/minecraft/world/level/entity/EntityLookup.java b/src/main/java/net/minecraft/world/level/entity/EntityLookup.java -index 21a2800db22f287b9c6a8290326fdf3b94ae94b1..2e561ac90a8c91ea13cfc18d09f8e0abbcff9385 100644 +index 38df704dca30ef08f4d0831dc1cc48c6d6f71a4d..ed6aea7a38ef6e80c300ff9b012dcdbc390ad2c7 100644 --- a/src/main/java/net/minecraft/world/level/entity/EntityLookup.java +++ b/src/main/java/net/minecraft/world/level/entity/EntityLookup.java -@@ -34,6 +34,14 @@ public class EntityLookup { +@@ -33,6 +33,14 @@ public class EntityLookup { UUID uUID = entity.getUUID(); if (this.byUuid.containsKey(uUID)) { LOGGER.warn("Duplicate entity UUID {}: {}", uUID, entity); diff --git a/patches/server/0229-Add-Early-Warning-Feature-to-WatchDog.patch b/patches/server/0229-Add-Early-Warning-Feature-to-WatchDog.patch index 4fee792554..76d44df2fe 100644 --- a/patches/server/0229-Add-Early-Warning-Feature-to-WatchDog.patch +++ b/patches/server/0229-Add-Early-Warning-Feature-to-WatchDog.patch @@ -9,7 +9,7 @@ thread dumps at an interval until the point of crash. This will help diagnose what was going on in that time before the crash. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 0f3589ae1c5577c612b93289fc42cdb977486b6b..0b704d5d39263b66f7846a9c4a116ac4d96383cf 100644 +index 09bd8a6576647c612e9d7f807780b1e20478a534..3e6008d27ed81453f6b4448f0334b8d343f66694 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -1092,6 +1092,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop implements WritableRegistry { +@@ -36,11 +36,11 @@ public class MappedRegistry implements WritableRegistry { private static final Logger LOGGER = LogUtils.getLogger(); final ResourceKey> key; private final ObjectList> byId = new ObjectArrayList<>(256); -- private final Reference2IntMap toId = Util.make(new Reference2IntOpenHashMap<>(), (map) -> { -+ private final Reference2IntMap toId = Util.make(new Reference2IntOpenHashMap<>(2048), (map) -> { // Paper - Perf: Use bigger expected size to reduce collisions - map.defaultReturnValue(-1); - }); +- private final Reference2IntMap toId = Util.make(new Reference2IntOpenHashMap<>(), map -> map.defaultReturnValue(-1)); - private final Map> byLocation = new HashMap<>(); - private final Map, Holder.Reference> byKey = new HashMap<>(); - private final Map> byValue = new IdentityHashMap<>(); - private final Map lifecycles = new IdentityHashMap<>(); ++ private final Reference2IntMap toId = Util.make(new Reference2IntOpenHashMap<>(2048), map -> map.defaultReturnValue(-1)); // Paper - Perf: Use bigger expected size to reduce collisions + private final Map> byLocation = new HashMap<>(2048); // Paper - Perf: Use bigger expected size to reduce collisions + private final Map, Holder.Reference> byKey = new HashMap<>(2048); // Paper - Perf: Use bigger expected size to reduce collisions + private final Map> byValue = new IdentityHashMap<>(2048); // Paper - Perf: Use bigger expected size to reduce collisions diff --git a/patches/server/0243-Add-ray-tracing-methods-to-LivingEntity.patch b/patches/server/0243-Add-ray-tracing-methods-to-LivingEntity.patch index 71ee314ddc..4279bf5ba5 100644 --- a/patches/server/0243-Add-ray-tracing-methods-to-LivingEntity.patch +++ b/patches/server/0243-Add-ray-tracing-methods-to-LivingEntity.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add ray tracing methods to LivingEntity diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 83a56061ce23d3d6f7d8ad3201ce325106f8a4d0..e8c4d42b1637752e69ea128fa7d0148bb5ffae06 100644 +index 88af8a11dfc3b645c5a2b5fb629a73fc1e2b2f80..c6c6fb195476e0d37b0007510044928ebe6e4572 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3849,6 +3849,19 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -29,7 +29,7 @@ index 83a56061ce23d3d6f7d8ad3201ce325106f8a4d0..e8c4d42b1637752e69ea128fa7d0148b public int getShieldBlockingDelay() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index be06dda82db09947f60a353b0d5504955738b6b6..eb74778c0bb6fe6b7c09209eb58195e7fedc54ac 100644 +index 0fe087cd6037b4dd694cc3c5c3eac8203ea6d519..8139ea88988e2e3551258b6686873753353ab9f8 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -201,6 +201,33 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { diff --git a/patches/server/0244-Expose-attack-cooldown-methods-for-Player.patch b/patches/server/0244-Expose-attack-cooldown-methods-for-Player.patch index 2b4d1222f5..2d2577636a 100644 --- a/patches/server/0244-Expose-attack-cooldown-methods-for-Player.patch +++ b/patches/server/0244-Expose-attack-cooldown-methods-for-Player.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Expose attack cooldown methods for Player diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index ddf089d73a05792d99a96bb449717d82755f5cd9..27d29187b5471fa9d1588b7e8e35539be8a861a0 100644 +index b4212f5a5b3b1e5476f7598be165ffb1defb5c21..65c56d29e04fd0853a8bfe9f943d27fe71849cc2 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -2897,6 +2897,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0245-Improve-death-events.patch b/patches/server/0245-Improve-death-events.patch index 50e37c3a69..245a5a43c7 100644 --- a/patches/server/0245-Improve-death-events.patch +++ b/patches/server/0245-Improve-death-events.patch @@ -19,7 +19,7 @@ public net.minecraft.world.entity.LivingEntity getDeathSound()Lnet/minecraft/sou public net.minecraft.world.entity.LivingEntity getSoundVolume()F diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 38a3b264ba72631c27203a178ac0bbdd36e10a10..80cedd5221d3c0dc475c631113e8782507067cb0 100644 +index 0b039c43bd3bd46f31477fc75585038270242de2..054057482d191d8e77bf4d179d51e32b5d9ca16e 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -248,6 +248,10 @@ public class ServerPlayer extends Player { @@ -80,7 +80,7 @@ index 38a3b264ba72631c27203a178ac0bbdd36e10a10..80cedd5221d3c0dc475c631113e87825 } } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index de01edaa23fb8493faf46c02abcb47989ac9a582..7dbfc8f0e3eb54e86fef6d9bc68e082ae8cd4422 100644 +index c6c6fb195476e0d37b0007510044928ebe6e4572..4b3d1c8452bd759db6fc8d3d9fcf98e2a8d25084 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -260,6 +260,7 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -319,30 +319,27 @@ index 6376908df89af1eff3a948ca1faef5d4925f0c3b..4ac32078cb074a78a2bb83307013b849 @Override diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractChestedHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractChestedHorse.java -index bb399f775a5530a01f59332848c8ab9b8eceb2b5..14edfe103e61024b569f33de0b6608f39e749319 100644 +index e9137ea77a44eb8ded24a70f3a2b388d77379fa7..2b38ab1080d3693597e466f5517abbda9f1709f2 100644 --- a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractChestedHorse.java +++ b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractChestedHorse.java -@@ -70,11 +70,19 @@ public abstract class AbstractChestedHorse extends AbstractHorse { +@@ -70,9 +70,17 @@ public abstract class AbstractChestedHorse extends AbstractHorse { this.spawnAtLocation(Blocks.CHEST); } -- this.setChest(false); -+ //this.setCarryingChest(false); // Paper - moved to post death logic - } - - } - ++ //this.setChest(false); // Paper - moved to post death logic ++ } ++ } ++ + // Paper start + protected void postDeathDropItems(org.bukkit.event.entity.EntityDeathEvent event) { + if (this.hasChest() && (event == null || !event.isCancelled())) { -+ this.setChest(false); -+ } -+ } + this.setChest(false); + } + } + // Paper end -+ + @Override public void addAdditionalSaveData(CompoundTag nbt) { - super.addAdditionalSaveData(nbt); diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java index 0634b88a5bbfb549d5ec5931e19f674fb9ca4cbe..11555d1b771f93234098a3bc6a6eaacddeeeb4f6 100644 --- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java diff --git a/patches/server/0247-Mob-Pathfinding-API.patch b/patches/server/0247-Mob-Pathfinding-API.patch index ec6e875e5d..d48ca68f9b 100644 --- a/patches/server/0247-Mob-Pathfinding-API.patch +++ b/patches/server/0247-Mob-Pathfinding-API.patch @@ -160,7 +160,7 @@ index 0000000000000000000000000000000000000000..064712e7b27a200b29c72076a82f4f56 + } +} diff --git a/src/main/java/net/minecraft/world/level/pathfinder/Path.java b/src/main/java/net/minecraft/world/level/pathfinder/Path.java -index 539dc45c3c7ffc60cf3fb47ae4df65e604e8627b..3049edb5a8b5967e5242a3896b23665888eb3472 100644 +index 339a74782ac4ac5e3cc765c3ee7b8c0c10c9d8c8..3e2b60eaeae6d6ee0d3b06182c6f7cb1eec82b8d 100644 --- a/src/main/java/net/minecraft/world/level/pathfinder/Path.java +++ b/src/main/java/net/minecraft/world/level/pathfinder/Path.java @@ -18,6 +18,7 @@ public class Path { diff --git a/patches/server/0249-Prevent-various-interactions-from-causing-chunk-load.patch b/patches/server/0249-Prevent-various-interactions-from-causing-chunk-load.patch index 5fad22ce92..0734fec4fb 100644 --- a/patches/server/0249-Prevent-various-interactions-from-causing-chunk-load.patch +++ b/patches/server/0249-Prevent-various-interactions-from-causing-chunk-load.patch @@ -64,7 +64,7 @@ index 13ba764d51f941c2b0d1d2af88ffd0c1fc3982c0..9637c26a3c381869f0a4dfe9189c0095 Vec3 vec3d1 = new Vec3((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D); BlockHitResult movingobjectpositionblock = world.clip(new ClipContext(vec3d, vec3d1, ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, this.enderman)); diff --git a/src/main/java/net/minecraft/world/item/CompassItem.java b/src/main/java/net/minecraft/world/item/CompassItem.java -index 5d3047a420efe59063e90bfc7b42392127e0ad7d..b3c67c954acf7e518d89d6af65a55d6f22dac059 100644 +index 0f74cdc825c66fac9f085f5d2aa408ba9844b253..a83fc0e62d8f48aaf60d21dca04678e954b6b3c2 100644 --- a/src/main/java/net/minecraft/world/item/CompassItem.java +++ b/src/main/java/net/minecraft/world/item/CompassItem.java @@ -77,7 +77,7 @@ public class CompassItem extends Item implements Vanishable { diff --git a/patches/server/0257-Add-LivingEntity-getTargetEntity.patch b/patches/server/0257-Add-LivingEntity-getTargetEntity.patch index 577dd4e729..796d844555 100644 --- a/patches/server/0257-Add-LivingEntity-getTargetEntity.patch +++ b/patches/server/0257-Add-LivingEntity-getTargetEntity.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add LivingEntity#getTargetEntity diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 39ff6dd7ee8e821f5693f6a6e01b713b25d30393..5a1dc8f196b274a822db4aa1fa48cd066f12da94 100644 +index 4b3d1c8452bd759db6fc8d3d9fcf98e2a8d25084..1a328de32b69b69814e11a5b6bc55bfccf408d6b 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -115,6 +115,7 @@ import net.minecraft.world.level.storage.loot.LootTable; @@ -56,7 +56,7 @@ index 39ff6dd7ee8e821f5693f6a6e01b713b25d30393..5a1dc8f196b274a822db4aa1fa48cd06 public int getShieldBlockingDelay() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index eb74778c0bb6fe6b7c09209eb58195e7fedc54ac..c9a487c1b85d46c1ce25147bd8a610a5631cdb5d 100644 +index 8139ea88988e2e3551258b6686873753353ab9f8..5def5bccd8fce86ce015567e65fefae329819c18 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -1,5 +1,6 @@ diff --git a/patches/server/0259-Catch-JsonParseException-in-entity-and-block-entity-.patch b/patches/server/0259-Catch-JsonParseException-in-entity-and-block-entity-.patch index 40b73f5045..99c5fe4d1e 100644 --- a/patches/server/0259-Catch-JsonParseException-in-entity-and-block-entity-.patch +++ b/patches/server/0259-Catch-JsonParseException-in-entity-and-block-entity-.patch @@ -89,15 +89,15 @@ index 25ec3ab534872500a2eb51cd44062e2754c404bb..a1097950766ad31393340b423ea3f98a this.lockKey = LockCode.fromTag(nbt); diff --git a/src/main/java/net/minecraft/world/level/block/entity/EnchantmentTableBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/EnchantmentTableBlockEntity.java -index 3a8bdb788b07b0a8cda3d4b872ede52ca9a005c4..65e1381bb2d10bd212463feb602c60f8fdb9ade1 100644 +index 00de0cc29775a219a763431fd4d54b2fa2585477..4d1a895f3749bdcb132de199e81a9d93330c0ee6 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/EnchantmentTableBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/EnchantmentTableBlockEntity.java -@@ -42,7 +42,7 @@ public class EnchantmentTableBlockEntity extends BlockEntity implements Nameable +@@ -41,7 +41,7 @@ public class EnchantmentTableBlockEntity extends BlockEntity implements Nameable public void load(CompoundTag nbt) { super.load(nbt); if (nbt.contains("CustomName", 8)) { - this.name = Component.Serializer.fromJson(nbt.getString("CustomName")); + this.name = io.papermc.paper.util.MCUtil.getBaseComponentFromNbt("CustomName", nbt); // Paper - Catch ParseException } - } + diff --git a/patches/server/0261-Call-player-spectator-target-events-and-improve-impl.patch b/patches/server/0261-Call-player-spectator-target-events-and-improve-impl.patch index 4dccbd3f63..192951a6e9 100644 --- a/patches/server/0261-Call-player-spectator-target-events-and-improve-impl.patch +++ b/patches/server/0261-Call-player-spectator-target-events-and-improve-impl.patch @@ -19,7 +19,7 @@ spectate the target entity. Co-authored-by: Spottedleaf diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 80cedd5221d3c0dc475c631113e8782507067cb0..3a991a6ef6a8c3150bdc557219424cf13f1dc0cc 100644 +index 054057482d191d8e77bf4d179d51e32b5d9ca16e..19c3eb566552f7994ae5e60dc869c94e08590fbb 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -2041,6 +2041,21 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0264-Add-option-to-prevent-players-from-moving-into-unloa.patch b/patches/server/0264-Add-option-to-prevent-players-from-moving-into-unloa.patch index 403e73e6ee..69b3eaf3cf 100644 --- a/patches/server/0264-Add-option-to-prevent-players-from-moving-into-unloa.patch +++ b/patches/server/0264-Add-option-to-prevent-players-from-moving-into-unloa.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Add option to prevent players from moving into unloaded diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index acf350e18b9e4de77b43a01afe40a72ef040d92e..c827a2b9a64bba61ffdc8ee5ee35460b332a8556 100644 +index a2eb93d47f659eb5b978358ee409bbf5f5d4d35a..0d9251ceb351b7d763420c49b0bf487907c42c55 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -474,9 +474,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl diff --git a/patches/server/0265-Reset-players-airTicks-on-respawn.patch b/patches/server/0265-Reset-players-airTicks-on-respawn.patch index d2e0da64ac..86f7de966c 100644 --- a/patches/server/0265-Reset-players-airTicks-on-respawn.patch +++ b/patches/server/0265-Reset-players-airTicks-on-respawn.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Reset players airTicks on respawn diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 3a991a6ef6a8c3150bdc557219424cf13f1dc0cc..0627d51d41d492e07b230e9c398158d656493848 100644 +index 19c3eb566552f7994ae5e60dc869c94e08590fbb..08c936288b5ac8738d7cff9fe95b1256ae32cd28 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -2516,6 +2516,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0267-Improve-Server-Thread-Pool-and-Thread-Priorities.patch b/patches/server/0267-Improve-Server-Thread-Pool-and-Thread-Priorities.patch index c37045a97f..e696041e24 100644 --- a/patches/server/0267-Improve-Server-Thread-Pool-and-Thread-Priorities.patch +++ b/patches/server/0267-Improve-Server-Thread-Pool-and-Thread-Priorities.patch @@ -38,10 +38,10 @@ index 0000000000000000000000000000000000000000..b60f59cf5cc8eb84a6055b7861857dec + } +} diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java -index aa52b271bd556a29f774fde375b713d0d187521b..765e4bc00a0526aab6e263dae7233f63f7f31498 100644 +index 1f1422a000eb9a0fb819f26d42b3f39ed683a8da..1bab7a03d433d3745cf9e244f5501dd3efedf583 100644 --- a/src/main/java/net/minecraft/Util.java +++ b/src/main/java/net/minecraft/Util.java -@@ -86,7 +86,7 @@ public class Util { +@@ -88,7 +88,7 @@ public class Util { private static final int DEFAULT_MAX_THREADS = 255; private static final int DEFAULT_SAFE_FILE_OPERATION_RETRIES = 10; private static final String MAX_THREADS_SYSTEM_PROPERTY = "max.bg.threads"; @@ -50,7 +50,7 @@ index aa52b271bd556a29f774fde375b713d0d187521b..765e4bc00a0526aab6e263dae7233f63 private static final ExecutorService IO_POOL = makeIoExecutor("IO-Worker-", false); private static final ExecutorService DOWNLOAD_POOL = makeIoExecutor("Download-", true); // Paper start - don't submit BLOCKING PROFILE LOOKUPS to the world gen thread -@@ -152,15 +152,27 @@ public class Util { +@@ -154,15 +154,27 @@ public class Util { return FILENAME_DATE_TIME_FORMATTER.format(ZonedDateTime.now()); } @@ -75,7 +75,7 @@ index aa52b271bd556a29f774fde375b713d0d187521b..765e4bc00a0526aab6e263dae7233f63 executorService = MoreExecutors.newDirectExecutorService(); } else { - AtomicInteger atomicInteger = new AtomicInteger(1); -- executorService = new ForkJoinPool(i, (pool) -> { +- executorService = new ForkJoinPool(i, pool -> { - ForkJoinWorkerThread forkJoinWorkerThread = new ForkJoinWorkerThread(pool) { + executorService = new java.util.concurrent.ThreadPoolExecutor(i, i,0L, TimeUnit.MILLISECONDS, new java.util.concurrent.LinkedBlockingQueue<>(), target -> new io.papermc.paper.util.ServerWorkerThread(target, s, priorityModifier)); + } @@ -83,7 +83,7 @@ index aa52b271bd556a29f774fde375b713d0d187521b..765e4bc00a0526aab6e263dae7233f63 @Override protected void onTermination(Throwable throwable) { if (throwable != null) { -@@ -176,6 +188,7 @@ public class Util { +@@ -178,6 +190,7 @@ public class Util { return forkJoinWorkerThread; }, Util::onThreadException, true); } @@ -92,7 +92,7 @@ index aa52b271bd556a29f774fde375b713d0d187521b..765e4bc00a0526aab6e263dae7233f63 return executorService; } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 0b704d5d39263b66f7846a9c4a116ac4d96383cf..114f40c63c617f4df9e6c9bf2d50707e289f2f20 100644 +index 3e6008d27ed81453f6b4448f0334b8d343f66694..3ccd1178f0db9301fe87afb8a0d996c0acfc1b16 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -312,6 +312,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop> { @@ -46,7 +46,7 @@ index 7070d093c80033b61a9c8495bc56153d986b6b03..61f05f34ca33837c643f2915e753ec39 throw new IllegalArgumentException("Packet too big (is " + k + ", should be less than 8388608): " + packet); } -@@ -54,10 +54,35 @@ public class PacketEncoder extends MessageToByteEncoder> { +@@ -54,9 +54,34 @@ public class PacketEncoder extends MessageToByteEncoder> { throw var13; } finally { @@ -58,7 +58,6 @@ index 7070d093c80033b61a9c8495bc56153d986b6b03..61f05f34ca33837c643f2915e753ec39 + // Paper end - Handle large packets disconnecting client ProtocolSwapHandler.swapProtocolIfNeeded(attribute, packet); } - } } } @@ -100,7 +99,7 @@ index 700418bb0c9fbed3f161611881b1e222248ca4eb..cc658a61065d5c0021a4b88fa58b4021 return false; } diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java -index 0e076173033278587df2b5dfbd01cc9005651eb5..dbd8b9b09b82c1b75e8be9dc7416d9f0863c8c87 100644 +index 6206d4d71dfe95b454b22f5b3055623638e145c0..6765175c98d52e5cbc191e88e0d545a05606dfd4 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java @@ -31,6 +31,16 @@ public class ClientboundContainerSetContentPacket implements Packet implements PlaceRecipe)recipe.value(), null)) { @@ -80,7 +81,7 @@ public class ServerPlaceRecipe implements PlaceRecipe implements PlaceRecipe implements PlaceRecipe inputs, int slot, int amount, int gridX, int gridY) { Slot slot2 = this.menu.getSlot(slot); @@ -181,13 +181,13 @@ index 4303f2b4e55191f8a53170435c6d1263782d1c8d..1534cbb5cb5da61fa7fa41bd503b0199 + } + // Paper end - Improve exact choice recipe ingredients if (!itemStack.isEmpty()) { - for(int i = 0; i < amount; ++i) { + for (int i = 0; i < amount; i++) { - this.moveItemToGrid(slot2, itemStack); + this.moveItemToGrid(slot2, itemStack, isExact); // Paper - Improve exact choice recipe ingredients } } - -@@ -130,8 +142,14 @@ public class ServerPlaceRecipe implements PlaceRecipe implements PlaceRecipe type; protected final CookingBookCategory category; protected final String group; -@@ -23,6 +23,7 @@ public abstract class AbstractCookingRecipe implements Recipe { +@@ -25,6 +25,7 @@ public abstract class AbstractCookingRecipe implements Recipe { this.result = result; this.experience = experience; this.cookingTime = cookingTime; diff --git a/patches/server/0287-Entity-getEntitySpawnReason.patch b/patches/server/0287-Entity-getEntitySpawnReason.patch index 1593a0a103..aee2a0bbb9 100644 --- a/patches/server/0287-Entity-getEntitySpawnReason.patch +++ b/patches/server/0287-Entity-getEntitySpawnReason.patch @@ -120,18 +120,18 @@ index cae8c508972d771ad96228ace8a7e6cbc34d5489..3184f73ce799cc5202d2129be736e2fe // CraftBukkit start if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, pos).isCancelled()) { diff --git a/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java -index faad948f089575e4988d989790cc1dd13f8a79cd..e143f42e71ac774d49b75e6d85591aa1189ee210 100644 +index 41fa4258fbdd2f887383b9d3def10466557c406c..d71a9fb54269f7c7e251e0e3bdd8b5a072af5201 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java -@@ -186,7 +186,7 @@ public class SculkShriekerBlockEntity extends BlockEntity implements GameEventLi - } +@@ -181,7 +181,7 @@ public class SculkShriekerBlockEntity extends BlockEntity implements GameEventLi private boolean trySummonWarden(ServerLevel world) { -- return this.warningLevel < 4 ? false : SpawnUtil.trySpawnMob(EntityType.WARDEN, MobSpawnType.TRIGGERED, world, this.getBlockPos(), 20, 5, 6, SpawnUtil.Strategy.ON_TOP_OF_COLLIDER).isPresent(); -+ return this.warningLevel < 4 ? false : SpawnUtil.trySpawnMob(EntityType.WARDEN, MobSpawnType.TRIGGERED, world, this.getBlockPos(), 20, 5, 6, SpawnUtil.Strategy.ON_TOP_OF_COLLIDER, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL, null).isPresent(); // Paper - Entity#getEntitySpawnReason + return this.warningLevel >= 4 +- && SpawnUtil.trySpawnMob(EntityType.WARDEN, MobSpawnType.TRIGGERED, world, this.getBlockPos(), 20, 5, 6, SpawnUtil.Strategy.ON_TOP_OF_COLLIDER) ++ && SpawnUtil.trySpawnMob(EntityType.WARDEN, MobSpawnType.TRIGGERED, world, this.getBlockPos(), 20, 5, 6, SpawnUtil.Strategy.ON_TOP_OF_COLLIDER, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL, null) // Paper - Entity#getEntitySpawnReason + .isPresent(); } - @Override diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java index 6fddbcec673564ac531a852f631f6acc460accbd..9ed122efb2b380bb2c1b50fdfe75bf3e679c9c6e 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java diff --git a/patches/server/0288-Fire-event-on-GS4-query.patch b/patches/server/0288-Fire-event-on-GS4-query.patch index 70ee09cecb..c43baca1e4 100644 --- a/patches/server/0288-Fire-event-on-GS4-query.patch +++ b/patches/server/0288-Fire-event-on-GS4-query.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fire event on GS4 query diff --git a/src/main/java/net/minecraft/server/rcon/thread/QueryThreadGs4.java b/src/main/java/net/minecraft/server/rcon/thread/QueryThreadGs4.java -index 88917d7a179739fc13c59831b15e7ddc711bed1b..1ef089dbf83de35d875c00efdf468c397be56978 100644 +index 7db3cc76543c3e020de799dc844c616e1c027849..41c0eeba9743d7ce141e4e58f96a761948ae33d7 100644 --- a/src/main/java/net/minecraft/server/rcon/thread/QueryThreadGs4.java +++ b/src/main/java/net/minecraft/server/rcon/thread/QueryThreadGs4.java @@ -106,13 +106,32 @@ public class QueryThreadGs4 extends GenericThread { @@ -45,7 +45,7 @@ index 88917d7a179739fc13c59831b15e7ddc711bed1b..1ef089dbf83de35d875c00efdf468c39 + networkDataOutputStream.writeString(queryResponse.getHostname()); + // Paper end this.sendTo(networkDataOutputStream.toByteArray(), packet); - LOGGER.debug("Status [{}]", (Object)socketAddress); + LOGGER.debug("Status [{}]", socketAddress); } @@ -147,31 +166,75 @@ public class QueryThreadGs4 extends GenericThread { this.rulesResponse.writeString("splitnum"); @@ -112,13 +112,13 @@ index 88917d7a179739fc13c59831b15e7ddc711bed1b..1ef089dbf83de35d875c00efdf468c39 - this.rulesResponse.writeString(this.worldName); + this.rulesResponse.writeString(queryResponse.getMap()); this.rulesResponse.writeString("numplayers"); -- this.rulesResponse.writeString("" + this.serverInterface.getPlayerCount()); +- this.rulesResponse.writeString(this.serverInterface.getPlayerCount() + ""); + this.rulesResponse.writeString(Integer.toString(queryResponse.getCurrentPlayers())); this.rulesResponse.writeString("maxplayers"); -- this.rulesResponse.writeString("" + this.maxPlayers); +- this.rulesResponse.writeString(this.maxPlayers + ""); + this.rulesResponse.writeString(Integer.toString(queryResponse.getMaxPlayers())); this.rulesResponse.writeString("hostport"); -- this.rulesResponse.writeString("" + this.serverPort); +- this.rulesResponse.writeString(this.serverPort + ""); + this.rulesResponse.writeString(Integer.toString(queryResponse.getPort())); this.rulesResponse.writeString("hostip"); - this.rulesResponse.writeString(this.hostIp); @@ -130,5 +130,5 @@ index 88917d7a179739fc13c59831b15e7ddc711bed1b..1ef089dbf83de35d875c00efdf468c39 - String[] strings = this.serverInterface.getPlayerNames(); + String[] strings = queryResponse.getPlayers().toArray(String[]::new); - for(String string : strings) { + for (String string : strings) { this.rulesResponse.writeString(string); diff --git a/patches/server/0291-Server-Tick-Events.patch b/patches/server/0291-Server-Tick-Events.patch index 51ca906ea2..354c364ca7 100644 --- a/patches/server/0291-Server-Tick-Events.patch +++ b/patches/server/0291-Server-Tick-Events.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Server Tick Events Fires event at start and end of a server tick diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 0edd0181d7379e648155231689f1715076edcd1e..ddbe9061b518711ed4bb2e30a90817293fd7fb7d 100644 +index fea2863dc00d9765b86ac4cf925ceaf0fbef7da3..21baf9139a652f21af81e775c4a0cfd3f2a81923 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -1357,6 +1357,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop extends CraftBlockStat diff --git a/patches/server/0304-offset-item-frame-ticking.patch b/patches/server/0304-offset-item-frame-ticking.patch index 58d95fb98a..cb15ef5dd8 100644 --- a/patches/server/0304-offset-item-frame-ticking.patch +++ b/patches/server/0304-offset-item-frame-ticking.patch @@ -5,7 +5,7 @@ Subject: [PATCH] offset item frame ticking diff --git a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java -index b3d05578f38af41f242f6634864ce1d2ecac14f8..2446d649225f96748e2fbb1a53a9e1902ac22aa1 100644 +index aaa579ba04445aa350a439610d460a2415320cfc..4dea85a8ab8ae16d02e35d226fd155891ce2319a 100644 --- a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java +++ b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java @@ -39,7 +39,7 @@ public abstract class HangingEntity extends Entity { diff --git a/patches/server/0305-Prevent-consuming-the-wrong-itemstack.patch b/patches/server/0305-Prevent-consuming-the-wrong-itemstack.patch index 9a56dc421d..397c7c692d 100644 --- a/patches/server/0305-Prevent-consuming-the-wrong-itemstack.patch +++ b/patches/server/0305-Prevent-consuming-the-wrong-itemstack.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Prevent consuming the wrong itemstack diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index f619171b3e436d7263d5229f7f9131954a0941f8..40ad459823268af0e57a348d241ac19bb576683a 100644 +index 4be7b136dd2b35b0637a1455985ab99bbd3af0a5..b4a817e047a78723d746740c88503441625ac8e7 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3730,9 +3730,14 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0308-Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch b/patches/server/0308-Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch index 983b04c068..82277a287f 100644 --- a/patches/server/0308-Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch +++ b/patches/server/0308-Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch @@ -5,16 +5,16 @@ Subject: [PATCH] Prevent sync chunk loads when villagers try to find beds diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/SleepInBed.java b/src/main/java/net/minecraft/world/entity/ai/behavior/SleepInBed.java -index 964fc8615d071d33c821f0c54ac1ebd4884df0cd..271e913a87a782dbf12686887f768d899bfb0fbf 100644 +index 6fe337e8d6db168ea181ed2597674f4829b03c47..e552ae6a7db765301a3d280dbf9348d9dc28b9c2 100644 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/SleepInBed.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/SleepInBed.java -@@ -43,7 +43,8 @@ public class SleepInBed extends Behavior { +@@ -42,7 +42,8 @@ public class SleepInBed extends Behavior { } } - BlockState blockState = world.getBlockState(globalPos.pos()); + BlockState blockState = world.getBlockStateIfLoaded(globalPos.pos()); // Paper - Prevent sync chunk loads when villagers try to find beds + if (blockState == null) { return false; } // Paper - Prevent sync chunk loads when villagers try to find beds - return globalPos.pos().closerToCenterThan(entity.position(), 2.0D) && blockState.is(BlockTags.BEDS) && !blockState.getValue(BedBlock.OCCUPIED); + return globalPos.pos().closerToCenterThan(entity.position(), 2.0) && blockState.is(BlockTags.BEDS) && !blockState.getValue(BedBlock.OCCUPIED); } } diff --git a/patches/server/0309-MC-145656-Fix-Follow-Range-Initial-Target.patch b/patches/server/0309-MC-145656-Fix-Follow-Range-Initial-Target.patch index 20a9321020..528cf153ea 100644 --- a/patches/server/0309-MC-145656-Fix-Follow-Range-Initial-Target.patch +++ b/patches/server/0309-MC-145656-Fix-Follow-Range-Initial-Target.patch @@ -17,19 +17,19 @@ index 0dad5be671f990d0edf0a155e2534b3812438902..175ba1184fc997f562f0834b172e17dc @Override diff --git a/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java b/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java -index f29823f2e8a54bd4e81e2940b5c505b152f23e88..fae0dbfb6ac09a0c152c0f74a72583f44316def7 100644 +index bc4b9a46056e83762e29bb04485ad7c754a20336..aecb0ad814586bfc5e56755ee14379a69388b38c 100644 --- a/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java +++ b/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java -@@ -76,7 +76,7 @@ public class TargetingConditions { +@@ -77,7 +77,7 @@ public class TargetingConditions { - if (this.range > 0.0D) { - double d = this.testInvisible ? targetEntity.getVisibilityPercent(baseEntity) : 1.0D; -- double e = Math.max(this.range * d, 2.0D); -+ double e = Math.max((this.useFollowRange ? this.getFollowRange(baseEntity) : this.range) * d, 2.0D); // Paper - Fix MC-145656 + if (this.range > 0.0) { + double d = this.testInvisible ? targetEntity.getVisibilityPercent(baseEntity) : 1.0; +- double e = Math.max(this.range * d, 2.0); ++ double e = Math.max((this.useFollowRange ? this.getFollowRange(baseEntity) : this.range) * d, 2.0); // Paper - Fix MC-145656 double f = baseEntity.distanceToSqr(targetEntity.getX(), targetEntity.getY(), targetEntity.getZ()); if (f > e * e) { return false; -@@ -94,4 +94,18 @@ public class TargetingConditions { +@@ -92,4 +92,18 @@ public class TargetingConditions { return true; } } diff --git a/patches/server/0311-PlayerDeathEvent-shouldDropExperience.patch b/patches/server/0311-PlayerDeathEvent-shouldDropExperience.patch index 8ce26f265a..c7a6d1afba 100644 --- a/patches/server/0311-PlayerDeathEvent-shouldDropExperience.patch +++ b/patches/server/0311-PlayerDeathEvent-shouldDropExperience.patch @@ -5,7 +5,7 @@ Subject: [PATCH] PlayerDeathEvent#shouldDropExperience diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 71372fad81d34bb0a4035d3a69d656db3b45d9ce..8678efd1b0ad2e6dbf49ed47d0dc959027762b40 100644 +index eb9668f94dbc36f3abc7d5c47c9b1b657aa94ced..79a0accd8230c76d792ed3f7558e8b3ea6d2f6d1 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -934,7 +934,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0313-Don-t-load-Chunks-from-Hoppers-and-other-things.patch b/patches/server/0313-Don-t-load-Chunks-from-Hoppers-and-other-things.patch index dcdab50579..3b189be4e4 100644 --- a/patches/server/0313-Don-t-load-Chunks-from-Hoppers-and-other-things.patch +++ b/patches/server/0313-Don-t-load-Chunks-from-Hoppers-and-other-things.patch @@ -13,10 +13,10 @@ This of course is undesirable, so just return the loaded side as "primary" and treat it as a single chest if the other sides are unloaded diff --git a/src/main/java/net/minecraft/world/level/block/DoubleBlockCombiner.java b/src/main/java/net/minecraft/world/level/block/DoubleBlockCombiner.java -index 0a40d9b7e394fa10d6bfb0057440e1b0e55d1fc4..c889d2e08b9e7c8ee374f0148e72bb3bc9a1d826 100644 +index 963092cd5a4e756ad6a471379a81d8996cc2b091..20c9921339ec6b5127fbadcedc19577f3906074d 100644 --- a/src/main/java/net/minecraft/world/level/block/DoubleBlockCombiner.java +++ b/src/main/java/net/minecraft/world/level/block/DoubleBlockCombiner.java -@@ -25,7 +25,12 @@ public class DoubleBlockCombiner { +@@ -34,7 +34,12 @@ public class DoubleBlockCombiner { return new DoubleBlockCombiner.NeighborCombineResult.Single<>(blockEntity); } else { BlockPos blockPos = pos.relative(directionMapper.apply(state)); @@ -29,4 +29,4 @@ index 0a40d9b7e394fa10d6bfb0057440e1b0e55d1fc4..c889d2e08b9e7c8ee374f0148e72bb3b + // Paper end - Don't load Chunks from Hoppers and other things if (blockState.is(state.getBlock())) { DoubleBlockCombiner.BlockType blockType2 = typeMapper.apply(blockState); - if (blockType2 != DoubleBlockCombiner.BlockType.SINGLE && blockType != blockType2 && blockState.getValue(directionProperty) == state.getValue(directionProperty)) { + if (blockType2 != DoubleBlockCombiner.BlockType.SINGLE diff --git a/patches/server/0314-Optimise-EntityGetter-getPlayerByUUID.patch b/patches/server/0314-Optimise-EntityGetter-getPlayerByUUID.patch index 3066fc8b68..01113bf72e 100644 --- a/patches/server/0314-Optimise-EntityGetter-getPlayerByUUID.patch +++ b/patches/server/0314-Optimise-EntityGetter-getPlayerByUUID.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Optimise EntityGetter#getPlayerByUUID Use the PlayerList map instead of iterating over all players diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 514b3af4f8ac04744ae44cad7c01086a3f821d5f..3f70bab49d58ec36f6153a7dae577d22c90d2918 100644 +index 20de3be232ccc7ec7bbc3c6aee9acf66fd396af1..54c0aa440cd8e7e1cedc6ef9ae963c68558b6080 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -324,6 +324,15 @@ public class ServerLevel extends Level implements WorldGenLevel { diff --git a/patches/server/0316-Optimize-call-to-getFluid-for-explosions.patch b/patches/server/0316-Optimize-call-to-getFluid-for-explosions.patch index 6afa3465ac..a63134d6ec 100644 --- a/patches/server/0316-Optimize-call-to-getFluid-for-explosions.patch +++ b/patches/server/0316-Optimize-call-to-getFluid-for-explosions.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Optimize call to getFluid for explosions diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java -index 00cfa26783ce0772c75166266ead258a415097bc..b03b4d366cae39081a7b70524e8615c986d76362 100644 +index ade10a9fd93f4c0f04cd56ce5e1da06af4a05060..b057a67a416928ae30bd407b3da982b73ae3be03 100644 --- a/src/main/java/net/minecraft/world/level/Explosion.java +++ b/src/main/java/net/minecraft/world/level/Explosion.java @@ -191,7 +191,7 @@ public class Explosion { diff --git a/patches/server/0320-Tracking-Range-Improvements.patch b/patches/server/0320-Tracking-Range-Improvements.patch index 6370a7e08a..2daaa84425 100644 --- a/patches/server/0320-Tracking-Range-Improvements.patch +++ b/patches/server/0320-Tracking-Range-Improvements.patch @@ -8,7 +8,7 @@ Sets tracking range of watermobs to animals instead of misc and simplifies code Also ignores Enderdragon, defaulting it to Mojang's setting diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 1b102f4c800dc6aa4e977c8ae8c9aada5d94e194..eff31fdd159dc7844bd3be3b769625a5704c2f17 100644 +index 8805fd57e7198aa9afaafe45fab13fd343e2a545..c69f1d970e1014f1be601e34bdd8b5fd749da339 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -1761,6 +1761,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider diff --git a/patches/server/0321-Fix-items-vanishing-through-end-portal.patch b/patches/server/0321-Fix-items-vanishing-through-end-portal.patch index 952b1672dc..b2763538f5 100644 --- a/patches/server/0321-Fix-items-vanishing-through-end-portal.patch +++ b/patches/server/0321-Fix-items-vanishing-through-end-portal.patch @@ -13,7 +13,7 @@ Quickly loading the exact world spawn chunk before searching the heightmap resolves the issue without having to load all spawn chunks. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 92521a46de31b13812d82a844ddc178df2b34919..8a8bdd3f77462b6aff97a2341d454b11c578f97f 100644 +index 257be4dd3f38c089dd970b9ac6f292b4f010a01c..98db75a013905ddd38ffd26d615ad8d02d8ddd22 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -3363,6 +3363,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0325-Add-debug-for-sync-chunk-loads.patch b/patches/server/0325-Add-debug-for-sync-chunk-loads.patch index b3e2d87143..57fda6ab95 100644 --- a/patches/server/0325-Add-debug-for-sync-chunk-loads.patch +++ b/patches/server/0325-Add-debug-for-sync-chunk-loads.patch @@ -312,7 +312,7 @@ index 326b67c15ee3df162bf4468729c49dd98b582f02..8a118a7b2878d3c99dadfa97e2ae58fd chunkproviderserver_b.managedBlock(completablefuture::isDone); this.level.timings.syncChunkLoad.stopTiming(); // Paper diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 3f70bab49d58ec36f6153a7dae577d22c90d2918..14958ce7c7cb1a55da6b6dd6c32a32c9346e866b 100644 +index 54c0aa440cd8e7e1cedc6ef9ae963c68558b6080..4d1d84383c11ef1e83edb50be62173533b7a641b 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -415,6 +415,13 @@ public class ServerLevel extends Level implements WorldGenLevel { diff --git a/patches/server/0328-Entity-Jump-API.patch b/patches/server/0328-Entity-Jump-API.patch index 5dcf9bf76f..d1a852319f 100644 --- a/patches/server/0328-Entity-Jump-API.patch +++ b/patches/server/0328-Entity-Jump-API.patch @@ -7,7 +7,7 @@ Subject: [PATCH] Entity Jump API public net.minecraft.world.entity.LivingEntity jumping diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 169a9aa06350dccf2624534754be3a22b2f42b33..c7b8c823ea1a1cafb98b4305febd52aa3652bc37 100644 +index b4a817e047a78723d746740c88503441625ac8e7..2a417145d9fe4d029cf3738f3320c0bcd3e025a9 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3304,8 +3304,10 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0329-Add-option-to-nerf-pigmen-from-nether-portals.patch b/patches/server/0329-Add-option-to-nerf-pigmen-from-nether-portals.patch index e1d5c928f0..d5d6d0d4ca 100644 --- a/patches/server/0329-Add-option-to-nerf-pigmen-from-nether-portals.patch +++ b/patches/server/0329-Add-option-to-nerf-pigmen-from-nether-portals.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add option to nerf pigmen from nether portals diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 8a8bdd3f77462b6aff97a2341d454b11c578f97f..c08b856e56996cf7ad1926d717effb9a1b98d8c6 100644 +index 98db75a013905ddd38ffd26d615ad8d02d8ddd22..537461e60366580bd18e3814113ef1f8b7009b39 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -397,6 +397,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0340-Pillager-patrol-spawn-settings-and-per-player-option.patch b/patches/server/0340-Pillager-patrol-spawn-settings-and-per-player-option.patch index bcdbf37892..4d9ffc8193 100644 --- a/patches/server/0340-Pillager-patrol-spawn-settings-and-per-player-option.patch +++ b/patches/server/0340-Pillager-patrol-spawn-settings-and-per-player-option.patch @@ -10,7 +10,7 @@ When not per player it will use the Vanilla mechanic of one delay per world and the world age for the start day. diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 8678efd1b0ad2e6dbf49ed47d0dc959027762b40..7649367da5ff97815b710f4902b793a0f6b0e6fa 100644 +index 79a0accd8230c76d792ed3f7558e8b3ea6d2f6d1..9f0d42256d1b41242bd08939f88583e2d337ede3 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -249,6 +249,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0341-Remote-Connections-shouldn-t-hold-up-shutdown.patch b/patches/server/0341-Remote-Connections-shouldn-t-hold-up-shutdown.patch index 6eb90f4536..6a31d5070a 100644 --- a/patches/server/0341-Remote-Connections-shouldn-t-hold-up-shutdown.patch +++ b/patches/server/0341-Remote-Connections-shouldn-t-hold-up-shutdown.patch @@ -24,10 +24,10 @@ index 78775feb965d6eb98a1ff655ae44b9f0399ef9aa..28fe088d97bd5fbfcc29dcc7d2a657d5 System.exit(0); // CraftBukkit diff --git a/src/main/java/net/minecraft/server/rcon/thread/RconThread.java b/src/main/java/net/minecraft/server/rcon/thread/RconThread.java -index 3bf60f640aa9fa4cabd2b3e5d3931e8467b9df24..8a493fa049dec741294098e3fee540a60f2accab 100644 +index 594fbb033b63b8c9fb8752b1fcc78f8e9f7a2a83..c12d7db2b048a327c0e8f398848cd3a9bce0ebce 100644 --- a/src/main/java/net/minecraft/server/rcon/thread/RconThread.java +++ b/src/main/java/net/minecraft/server/rcon/thread/RconThread.java -@@ -107,6 +107,14 @@ public class RconThread extends GenericThread { +@@ -104,6 +104,14 @@ public class RconThread extends GenericThread { this.clients.clear(); } @@ -41,4 +41,4 @@ index 3bf60f640aa9fa4cabd2b3e5d3931e8467b9df24..8a493fa049dec741294098e3fee540a6 + // Paper end - don't wait for remote connections private void closeSocket(ServerSocket socket) { - LOGGER.debug("closeSocket: {}", (Object)socket); + LOGGER.debug("closeSocket: {}", socket); diff --git a/patches/server/0343-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch b/patches/server/0343-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch index a0fdf0378d..c5cc3ce8c7 100644 --- a/patches/server/0343-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch +++ b/patches/server/0343-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch @@ -7,7 +7,7 @@ Suspected case would be around the technique used in .stopRiding Stack will identify any causer of this and warn instead of crashing. diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index eff31fdd159dc7844bd3be3b769625a5704c2f17..2c954f8a91b9f50ce69eda475b22d4159b87d277 100644 +index c69f1d970e1014f1be601e34bdd8b5fd749da339..2fba58fd5c9b17512eadacb899c59a04df5d415f 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -1452,6 +1452,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -25,7 +25,7 @@ index eff31fdd159dc7844bd3be3b769625a5704c2f17..2c954f8a91b9f50ce69eda475b22d415 EntityType entitytypes = entity.getType(); int i = entitytypes.clientTrackingRange() * 16; diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 14958ce7c7cb1a55da6b6dd6c32a32c9346e866b..d2da284aa7284c5205e656c48262061980893be6 100644 +index 4d1d84383c11ef1e83edb50be62173533b7a641b..9af1877321356348ad96b92ae8c5f4811bef50ac 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -2224,7 +2224,7 @@ public class ServerLevel extends Level implements WorldGenLevel { diff --git a/patches/server/0344-Don-t-tick-dead-players.patch b/patches/server/0344-Don-t-tick-dead-players.patch index 7338d09f93..ed79ba1216 100644 --- a/patches/server/0344-Don-t-tick-dead-players.patch +++ b/patches/server/0344-Don-t-tick-dead-players.patch @@ -7,7 +7,7 @@ Causes sync chunk loads and who knows what all else. This is safe because Spectators are skipped in unloaded chunks too in vanilla. diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 7649367da5ff97815b710f4902b793a0f6b0e6fa..e695b5ee0b9ce5dad81a7f894ef1e7fd868f11eb 100644 +index 9f0d42256d1b41242bd08939f88583e2d337ede3..ca75d22e90fd879d464733813939f877ec875905 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -684,7 +684,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0346-Don-t-move-existing-players-to-world-spawn.patch b/patches/server/0346-Don-t-move-existing-players-to-world-spawn.patch index f002120e54..58204fae45 100644 --- a/patches/server/0346-Don-t-move-existing-players-to-world-spawn.patch +++ b/patches/server/0346-Don-t-move-existing-players-to-world-spawn.patch @@ -13,7 +13,7 @@ By skipping this, we avoid potential for a large spike on server start. public net.minecraft.server.level.ServerPlayer fudgeSpawnLocation(Lnet/minecraft/server/level/ServerLevel;)V diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index e695b5ee0b9ce5dad81a7f894ef1e7fd868f11eb..b6698a65d778cea6b7dc9b8ebfceec2425c732b7 100644 +index ca75d22e90fd879d464733813939f877ec875905..04e54d2214d0ae0202490aceab54b8b10ef38229 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -337,7 +337,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0347-Optimize-Pathfinding.patch b/patches/server/0347-Optimize-Pathfinding.patch index 0bd6e09507..c4d6cafff0 100644 --- a/patches/server/0347-Optimize-Pathfinding.patch +++ b/patches/server/0347-Optimize-Pathfinding.patch @@ -7,10 +7,10 @@ Prevents pathfinding from spamming failures for things such as arrow attacks. diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java -index c3b406e6302ae0ac1ef56253ab614ca201a7a1c8..a04fb58c29b462e20ed0b702cef478e3985b7cd2 100644 +index 25a9f1fd69fbafab5129740e26e9741e35885ce0..e3a7eaf31ab19cc9f23a0c87649b74bb42976cb4 100644 --- a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java +++ b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java -@@ -193,9 +193,29 @@ public abstract class PathNavigation { +@@ -192,9 +192,29 @@ public abstract class PathNavigation { return this.moveTo(this.createPath(x, y, z, 1), speed); } diff --git a/patches/server/0349-Reduce-memory-footprint-of-CompoundTag.patch b/patches/server/0349-Reduce-memory-footprint-of-CompoundTag.patch index c714de8792..56beb848eb 100644 --- a/patches/server/0349-Reduce-memory-footprint-of-CompoundTag.patch +++ b/patches/server/0349-Reduce-memory-footprint-of-CompoundTag.patch @@ -8,10 +8,10 @@ is important because we clone chunk data after reading it for safety. So, reduce the impact of the clone on GC. diff --git a/src/main/java/net/minecraft/nbt/CompoundTag.java b/src/main/java/net/minecraft/nbt/CompoundTag.java -index c77a6bb6885ffaaa4d9e1aa9d4770d5e847a590b..2c760084cd1b84a1f2c4f6a6db8d396a1b3c5395 100644 +index 1e2f58f2f95c558ce28706c405050c4c5701dd40..c7945686a4ee50d7a9d5f1173aa90e456f68b410 100644 --- a/src/main/java/net/minecraft/nbt/CompoundTag.java +++ b/src/main/java/net/minecraft/nbt/CompoundTag.java -@@ -50,7 +50,7 @@ public class CompoundTag implements Tag { +@@ -49,7 +49,7 @@ public class CompoundTag implements Tag { private static CompoundTag loadCompound(DataInput input, NbtAccounter tracker) throws IOException { tracker.accountBytes(48L); @@ -19,8 +19,8 @@ index c77a6bb6885ffaaa4d9e1aa9d4770d5e847a590b..2c760084cd1b84a1f2c4f6a6db8d396a + it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap map = new it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<>(8, 0.8f); // Paper - Reduce memory footprint of CompoundTag byte b; - while((b = input.readByte()) != 0) { -@@ -171,7 +171,7 @@ public class CompoundTag implements Tag { + while ((b = input.readByte()) != 0) { +@@ -166,7 +166,7 @@ public class CompoundTag implements Tag { } public CompoundTag() { @@ -29,7 +29,7 @@ index c77a6bb6885ffaaa4d9e1aa9d4770d5e847a590b..2c760084cd1b84a1f2c4f6a6db8d396a } @Override -@@ -490,8 +490,16 @@ public class CompoundTag implements Tag { +@@ -477,8 +477,16 @@ public class CompoundTag implements Tag { @Override public CompoundTag copy() { diff --git a/patches/server/0350-Prevent-opening-inventories-when-frozen.patch b/patches/server/0350-Prevent-opening-inventories-when-frozen.patch index 2ea12128dc..f1f9ea6812 100644 --- a/patches/server/0350-Prevent-opening-inventories-when-frozen.patch +++ b/patches/server/0350-Prevent-opening-inventories-when-frozen.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Prevent opening inventories when frozen diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index b6698a65d778cea6b7dc9b8ebfceec2425c732b7..347747282c77f5d1dde907b99cc2c8029675dc34 100644 +index 04e54d2214d0ae0202490aceab54b8b10ef38229..3a856f28237246660665aef983e5e9fe2bac8c37 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -653,7 +653,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0351-Don-t-run-entity-collision-code-if-not-needed.patch b/patches/server/0351-Don-t-run-entity-collision-code-if-not-needed.patch index 5c6be151ec..4fb9ce321f 100644 --- a/patches/server/0351-Don-t-run-entity-collision-code-if-not-needed.patch +++ b/patches/server/0351-Don-t-run-entity-collision-code-if-not-needed.patch @@ -12,7 +12,7 @@ The entity's current team collision rule causes them to NEVER collide. Co-authored-by: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index f441d7a1188cecd91206d78b58457c330e4e8663..178d8e9795a6c451e0ff350d9412bc2e0ee686ae 100644 +index 2a417145d9fe4d029cf3738f3320c0bcd3e025a9..e8410acb2f4be966177a0ec62fc93b8fe2cc0af3 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3419,10 +3419,24 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0352-Implement-Player-Client-Options-API.patch b/patches/server/0352-Implement-Player-Client-Options-API.patch index 2a651ebbc3..adc09129e4 100644 --- a/patches/server/0352-Implement-Player-Client-Options-API.patch +++ b/patches/server/0352-Implement-Player-Client-Options-API.patch @@ -87,7 +87,7 @@ index 0000000000000000000000000000000000000000..b6f4400df3d8ec7e06a996de54f8cabb + } +} diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 347747282c77f5d1dde907b99cc2c8029675dc34..eb0a0a9faacf3c7d879b435b637a9c8203319aa6 100644 +index 3a856f28237246660665aef983e5e9fe2bac8c37..3d7a938f72424a4f30f75563393a953cf9f11933 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -338,7 +338,7 @@ public class ServerPlayer extends Player { @@ -136,7 +136,7 @@ index 347747282c77f5d1dde907b99cc2c8029675dc34..eb0a0a9faacf3c7d879b435b637a9c82 this.adventure$locale = java.util.Objects.requireNonNullElse(net.kyori.adventure.translation.Translator.parseLocale(this.language), java.util.Locale.US); // Paper this.requestedViewDistance = clientOptions.viewDistance(); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index c5ea6d424c8009c8afd791e58a75174291696d05..d6bddec130167af3d72555535045568ee941bb88 100644 +index 476b7bc14b4d2e7ed30c23b65dbc7aa0c6679b6b..5ba0fa6fda6d496f7540185e6dc58439cc1e04f1 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -573,6 +573,28 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0354-Fire-PlayerJoinEvent-when-Player-is-actually-ready.patch b/patches/server/0354-Fire-PlayerJoinEvent-when-Player-is-actually-ready.patch index be256ac7cb..79298e93c2 100644 --- a/patches/server/0354-Fire-PlayerJoinEvent-when-Player-is-actually-ready.patch +++ b/patches/server/0354-Fire-PlayerJoinEvent-when-Player-is-actually-ready.patch @@ -43,7 +43,7 @@ index 2fba58fd5c9b17512eadacb899c59a04df5d415f..4c1dd470ac561f61d7f49adf90d273b1 EntityType entitytypes = entity.getType(); int i = entitytypes.clientTrackingRange() * 16; diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index eb0a0a9faacf3c7d879b435b637a9c8203319aa6..e5653695a3fbcd260ce44ca37291406a1033a3fa 100644 +index 3d7a938f72424a4f30f75563393a953cf9f11933..b64b20312396638b8fd596bca3794863601d2bb4 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -267,6 +267,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0355-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch b/patches/server/0355-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch index 483de53840..74931d2851 100644 --- a/patches/server/0355-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch +++ b/patches/server/0355-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch @@ -87,7 +87,7 @@ index c5614cc12789fdfad3519434e115a50c12844b3b..d0e158235915e4efc8bda99d552d029c } // Paper end - Entity#getEntitySpawnReason diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index c08b856e56996cf7ad1926d717effb9a1b98d8c6..7619f6e772d2fab177a83b083bcce3d2ee1d9a95 100644 +index 537461e60366580bd18e3814113ef1f8b7009b39..5863d7118d9935735400cff4a09dd8546f67bac5 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -2289,27 +2289,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0356-Add-PlayerAttackEntityCooldownResetEvent.patch b/patches/server/0356-Add-PlayerAttackEntityCooldownResetEvent.patch index 35dea473a5..e8b17654bf 100644 --- a/patches/server/0356-Add-PlayerAttackEntityCooldownResetEvent.patch +++ b/patches/server/0356-Add-PlayerAttackEntityCooldownResetEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerAttackEntityCooldownResetEvent diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 178d8e9795a6c451e0ff350d9412bc2e0ee686ae..d53069d6b0be5a82f7b34a336439fdfd356e4a79 100644 +index e8410acb2f4be966177a0ec62fc93b8fe2cc0af3..1e5ffd48251c0727e662da4d9a59bc8c23eb95ff 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -2211,7 +2211,16 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0359-Fix-item-duplication-and-teleport-issues.patch b/patches/server/0359-Fix-item-duplication-and-teleport-issues.patch index fa8f837500..7e568e11ce 100644 --- a/patches/server/0359-Fix-item-duplication-and-teleport-issues.patch +++ b/patches/server/0359-Fix-item-duplication-and-teleport-issues.patch @@ -80,7 +80,7 @@ index 5863d7118d9935735400cff4a09dd8546f67bac5..23ee63119d55b40829c03a855ae0f8b2 public float getBlockExplosionResistance(Explosion explosion, BlockGetter world, BlockPos pos, BlockState blockState, FluidState fluidState, float max) { diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index b4b2cf6875c96ab213522814ab79bfeaa9848f3b..947ea9f79b0115207e42fa80fe5368ed8c0a1d1c 100644 +index 1e5ffd48251c0727e662da4d9a59bc8c23eb95ff..685c0028032b60c025f825c55e975b08c97d86f2 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -1714,9 +1714,9 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0361-Validate-PickItem-Packet-and-kick-for-invalid.patch b/patches/server/0361-Validate-PickItem-Packet-and-kick-for-invalid.patch index daa5857791..c1704d1690 100644 --- a/patches/server/0361-Validate-PickItem-Packet-and-kick-for-invalid.patch +++ b/patches/server/0361-Validate-PickItem-Packet-and-kick-for-invalid.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Validate PickItem Packet and kick for invalid diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 89da9267c4c1a884e5483c423ccc68ed1d79259b..83cd7c4157b49f2cc86a44f5040f33585ced4270 100644 +index f78f5be4a1d3e551649090b296881d8dafea1ab9..f0cacf20fbe7dbe11856d89f423c1c74a242853e 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -867,7 +867,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl diff --git a/patches/server/0363-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch b/patches/server/0363-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch index 7501e408f6..890d937ec1 100644 --- a/patches/server/0363-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch +++ b/patches/server/0363-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch @@ -17,7 +17,7 @@ keeping long lived large direct buffers in cache. Set system properly at server startup if not set already to help protect from this. diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index ee9bb75f2850bf421cc8ff02aca5b230538d6503..db6398c1822f6ad499feddd6a915984ef9917777 100644 +index f21bff10aa56b418b1c3c3f1a40b88c4e992c26d..44f49cc8b7800eebda426a1a04a311979e4516b9 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -26,6 +26,7 @@ public class Main { diff --git a/patches/server/0364-misc-debugging-dumps.patch b/patches/server/0364-misc-debugging-dumps.patch index 23c37105f1..37d8c2638d 100644 --- a/patches/server/0364-misc-debugging-dumps.patch +++ b/patches/server/0364-misc-debugging-dumps.patch @@ -42,7 +42,7 @@ index 40ff3090fb17fb0f01a9b52639fb783ea57ce6b6..d39743d9626eb01c942194387dafb110 StackTraceElement[] astacktraceelement = exception.getStackTrace(); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index e5ecca5ae9e37e4d4d6d2adfd5f487a869ab775d..390bc01c19d5fed7ed455ddf9823697469e0d7fe 100644 +index 1a7dffb3947dab0e334cd5873c69542f383aed61..f4e9929c956585a9305c2b40a995ec4fff08e7e4 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -904,6 +904,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop packet) { diff --git a/src/main/java/net/minecraft/network/PacketEncoder.java b/src/main/java/net/minecraft/network/PacketEncoder.java -index 61f05f34ca33837c643f2915e753ec3935a38314..85b8be8ffac0fb40e9cae0528271ed41473811c8 100644 +index 061eada043325142d33a0cec02e9e484d14a7fca..96d5448019d53ac3575e209c1c5c223a62a2638d 100644 --- a/src/main/java/net/minecraft/network/PacketEncoder.java +++ b/src/main/java/net/minecraft/network/PacketEncoder.java @@ -47,7 +47,14 @@ public class PacketEncoder extends MessageToByteEncoder> { diff --git a/patches/server/0367-Implement-Mob-Goal-API.patch b/patches/server/0367-Implement-Mob-Goal-API.patch index 13572c9b4d..6b2e0d999b 100644 --- a/patches/server/0367-Implement-Mob-Goal-API.patch +++ b/patches/server/0367-Implement-Mob-Goal-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Implement Mob Goal API diff --git a/build.gradle.kts b/build.gradle.kts -index e9cda97679ed18156baf009926d6f210093112bd..7cbfd129efcc2e971b75aaa272dee79a3b4d2d5c 100644 +index 2b3da4b69e89a6b98ec98820e55044fefdafc061..d16c0311142e44ec1048818221796c09ab7a90d8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -44,6 +44,7 @@ dependencies { diff --git a/patches/server/0368-Add-villager-reputation-API.patch b/patches/server/0368-Add-villager-reputation-API.patch index 04891189ff..5043e90bdc 100644 --- a/patches/server/0368-Add-villager-reputation-API.patch +++ b/patches/server/0368-Add-villager-reputation-API.patch @@ -9,10 +9,10 @@ public net.minecraft.world.entity.ai.gossip.GossipContainer$EntityGossips public net.minecraft.world.entity.ai.gossip.GossipContainer gossips diff --git a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java -index a28f359202e6502c6ea5e9c918ec0b3e9a3fca61..f1e717dc8320a00c0cc0ff53d97b74e7c1e109fe 100644 +index f06a5f0d9c5c877ddf963254d3124f5fe2d67282..aa32804bc9affe9a615d3ffaa513f6f09aab3f32 100644 --- a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java +++ b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java -@@ -231,6 +231,43 @@ public class GossipContainer { +@@ -216,6 +216,43 @@ public class GossipContainer { public void remove(GossipType gossipType) { this.entries.removeInt(gossipType); } diff --git a/patches/server/0371-Fix-PotionEffect-ignores-icon-flag.patch b/patches/server/0371-Fix-PotionEffect-ignores-icon-flag.patch index 208862b074..11cb193b27 100644 --- a/patches/server/0371-Fix-PotionEffect-ignores-icon-flag.patch +++ b/patches/server/0371-Fix-PotionEffect-ignores-icon-flag.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Fix PotionEffect ignores icon flag Co-authored-by: Tamion <70228790+notTamion@users.noreply.github.com> diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index e5cd09c9c27f23860fc31cb22377a54e5e60bd38..7dfc5966e6262ded29c60d7423f8a1e4a42ca948 100644 +index 29fa2231cc5d9c3ac36d508f14408d6077b6594c..d84503ab329ebeb4c74f10f9897661ee6799e3d3 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -484,7 +484,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { diff --git a/patches/server/0373-Wait-for-Async-Tasks-during-shutdown.patch b/patches/server/0373-Wait-for-Async-Tasks-during-shutdown.patch index bf00f6de7d..780d2a450b 100644 --- a/patches/server/0373-Wait-for-Async-Tasks-during-shutdown.patch +++ b/patches/server/0373-Wait-for-Async-Tasks-during-shutdown.patch @@ -10,7 +10,7 @@ Adds a 5 second grace period for any async tasks to finish and warns if any are still running after that delay just as reload does. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 390bc01c19d5fed7ed455ddf9823697469e0d7fe..f786bf10a42fa4e9f610416959c60c52729c277b 100644 +index f4e9929c956585a9305c2b40a995ec4fff08e7e4..af68110105a9a3ec0ebd31ea9733af8dfed1037b 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -931,6 +931,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoopwill throw an NPE. */ public UUID getUUID(String key) { @@ -46,10 +46,10 @@ index 2c760084cd1b84a1f2c4f6a6db8d396a1b3c5395..eea9866aecb7189455319d83561fcef3 return tag != null && tag.getType() == IntArrayTag.TYPE && ((IntArrayTag)tag).getAsIntArray().length == 4; } diff --git a/src/main/java/net/minecraft/nbt/NbtUtils.java b/src/main/java/net/minecraft/nbt/NbtUtils.java -index 4388f2a8b05f5ed2f0934c1693299a4c92072adc..ba0726157417cdde1c9bca93a9e37e68d9b2286d 100644 +index 3e395d575fab2348cd30a88511a194aba2d8e4ba..f3b11b08358fdd93464cd19b05047e10727a5799 100644 --- a/src/main/java/net/minecraft/nbt/NbtUtils.java +++ b/src/main/java/net/minecraft/nbt/NbtUtils.java -@@ -72,6 +72,14 @@ public final class NbtUtils { +@@ -65,6 +65,14 @@ public final class NbtUtils { @Nullable public static GameProfile readGameProfile(CompoundTag nbt) { UUID uUID = nbt.hasUUID("Id") ? nbt.getUUID("Id") : Util.NIL_UUID; diff --git a/patches/server/0401-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch b/patches/server/0401-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch index c744a5628c..4f39c3bd5a 100644 --- a/patches/server/0401-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch +++ b/patches/server/0401-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Don't check chunk for portal on world gen entity add diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 67ff37d395f83c1a0f5c8305375f703cbe4c0609..4aad2d99148a0d6ee06049f20de2aaa6218c1d39 100644 +index 685c0028032b60c025f825c55e975b08c97d86f2..b98f82b619a1932e6d820a2c42120efdc03fc839 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3531,7 +3531,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0405-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch b/patches/server/0405-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch index 40af6ad187..8c7dd5304b 100644 --- a/patches/server/0405-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch +++ b/patches/server/0405-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch @@ -29,10 +29,10 @@ index d46b7bff34b9b43e895f713d2e73071bc62de443..567ca2f09d7bf03ef1758459829a865e String s = (String) Optional.ofNullable((String) optionset.valueOf("world")).orElse(dedicatedserversettings.getProperties().levelName); LevelStorageSource convertable = LevelStorageSource.createDefault(file.toPath()); diff --git a/src/main/java/net/minecraft/server/Services.java b/src/main/java/net/minecraft/server/Services.java -index d200619b4aa820e273c26f2f6133589c727f8a0e..d89c624554ab08bd1b33a3f62b52aa57aaafb8b4 100644 +index 5928e5f1934b8e247ba516595018ed5c633d3b5d..33e3815a0c979609d4c7ab83ad91e87ac07a556d 100644 --- a/src/main/java/net/minecraft/server/Services.java +++ b/src/main/java/net/minecraft/server/Services.java -@@ -22,12 +22,12 @@ public record Services(MinecraftSessionService sessionService, ServicesKeySet se +@@ -24,12 +24,12 @@ public record Services( return java.util.Objects.requireNonNull(this.paperConfigurations); } // Paper end - add paper configuration files diff --git a/patches/server/0407-Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch b/patches/server/0407-Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch index f1039e4bf0..be48e82d6e 100644 --- a/patches/server/0407-Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch +++ b/patches/server/0407-Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch @@ -9,10 +9,10 @@ itself, so the criterion object stores no references - and thus needs no cleanup. diff --git a/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java b/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java -index 5450734060428426981e2c1f1025b1aa5aa4d271..805459ba815520165c86a537fbb1f3e04b85bfbd 100644 +index 9a387d5dc0925304d4163e3caa22206aaa68e3b7..f43053ba082f9772b6ec02828fa2d6f387c32d26 100644 --- a/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java +++ b/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java -@@ -15,22 +15,22 @@ import net.minecraft.server.level.ServerPlayer; +@@ -15,32 +15,32 @@ import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.level.storage.loot.LootContext; public abstract class SimpleCriterionTrigger implements CriterionTrigger { @@ -21,10 +21,8 @@ index 5450734060428426981e2c1f1025b1aa5aa4d271..805459ba815520165c86a537fbb1f3e0 @Override public final void addPlayerListener(PlayerAdvancements manager, CriterionTrigger.Listener conditions) { -- this.players.computeIfAbsent(manager, (managerx) -> { -+ manager.criterionData.computeIfAbsent(this, (managerx) -> { // Paper - fix AdvancementDataPlayer leak - return Sets.newHashSet(); - }).add(conditions); +- this.players.computeIfAbsent(manager, managerx -> Sets.newHashSet()).add(conditions); ++ manager.criterionData.computeIfAbsent(this, managerx -> Sets.newHashSet()).add(conditions); // Paper - fix AdvancementDataPlayer leak } @Override @@ -38,8 +36,7 @@ index 5450734060428426981e2c1f1025b1aa5aa4d271..805459ba815520165c86a537fbb1f3e0 + manager.criterionData.remove(this); // Paper - fix AdvancementDataPlayer leak } } - -@@ -38,12 +38,12 @@ public abstract class SimpleCriterionTrigger createPacket(int id, FriendlyByteBuf buf) { + if (id < 0 || id >= this.idToDeserializer.size()) return null; // Paper - Perf: Optimize exception handling Function> function = this.idToDeserializer.get(id); - return function != null ? function.apply(buf) : null; + return (Packet)(function != null ? function.apply(buf) : null); } diff --git a/src/main/java/net/minecraft/network/Varint21FrameDecoder.java b/src/main/java/net/minecraft/network/Varint21FrameDecoder.java -index 00c170a16a57f41f881c6b282cba474ce485b34c..137b9a088c82ce6813bf8a80468675bb4992ce53 100644 +index 421dd76816063d56ea80339b77531729edd6aa55..1523d69b7b332f0085f40310a94d406da6513edc 100644 --- a/src/main/java/net/minecraft/network/Varint21FrameDecoder.java +++ b/src/main/java/net/minecraft/network/Varint21FrameDecoder.java @@ -39,6 +39,12 @@ public class Varint21FrameDecoder extends ByteToMessageDecoder { diff --git a/patches/server/0409-Fix-some-rails-connecting-improperly.patch b/patches/server/0409-Fix-some-rails-connecting-improperly.patch index 85d4d5d18d..95fe65653d 100644 --- a/patches/server/0409-Fix-some-rails-connecting-improperly.patch +++ b/patches/server/0409-Fix-some-rails-connecting-improperly.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix some rails connecting improperly diff --git a/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java b/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java -index d8dd9f26fe4344541d0544e35bbc66c5d567a80b..6bd4e4d173f34e0234f4474e49ce2d897f85386f 100644 +index e9fbbca04105370226bf5a264ba6ea96e09c3f10..93398cf061a8609f0b77a5e7f8340870019b9824 100644 --- a/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java @@ -68,6 +68,7 @@ public abstract class BaseRailBlock extends Block implements SimpleWaterloggedBl @@ -29,7 +29,7 @@ index 41452abc7b761858ff2f3ff6a833b09c16fded4f..17242c24d73c9ffb1c976a45925f85d1 boolean flag1 = false; List list = this.getInteractingMinecartOfType(world, pos, AbstractMinecart.class, (entity) -> { diff --git a/src/main/java/net/minecraft/world/level/block/RailState.java b/src/main/java/net/minecraft/world/level/block/RailState.java -index 0cbfad97371b59de95963a09aa16f3dad7a37222..939665cbe4cce36cd64c299908a738a4d1c2140e 100644 +index 6caafa73b03ed55c95303e49735eaf3dfd34903a..aa7ebaccad8dc555d9e1dee300e75fcd968a3608 100644 --- a/src/main/java/net/minecraft/world/level/block/RailState.java +++ b/src/main/java/net/minecraft/world/level/block/RailState.java @@ -17,6 +17,12 @@ public class RailState { @@ -45,7 +45,7 @@ index 0cbfad97371b59de95963a09aa16f3dad7a37222..939665cbe4cce36cd64c299908a738a4 public RailState(Level world, BlockPos pos, BlockState state) { this.level = world; this.pos = pos; -@@ -143,6 +149,11 @@ public class RailState { +@@ -141,6 +147,11 @@ public class RailState { } private void connectTo(RailState placementHelper) { @@ -57,7 +57,7 @@ index 0cbfad97371b59de95963a09aa16f3dad7a37222..939665cbe4cce36cd64c299908a738a4 this.connections.add(placementHelper.pos); BlockPos blockPos = this.pos.north(); BlockPos blockPos2 = this.pos.south(); -@@ -333,10 +344,15 @@ public class RailState { +@@ -331,10 +342,15 @@ public class RailState { this.state = this.state.setValue(this.block.getShapeProperty(), railShape2); if (forceUpdate || this.level.getBlockState(this.pos) != this.state) { this.level.setBlock(this.pos, this.state, 3); @@ -67,14 +67,14 @@ index 0cbfad97371b59de95963a09aa16f3dad7a37222..939665cbe4cce36cd64c299908a738a4 + } + // Paper end - Fix some rails connecting improperly - for(int i = 0; i < this.connections.size(); ++i) { + for (int i = 0; i < this.connections.size(); i++) { RailState railState = this.getRail(this.connections.get(i)); - if (railState != null) { + if (railState != null && railState.isValid()) { // Paper - Fix some rails connecting improperly railState.removeSoftConnections(); if (railState.canConnectTo(this)) { railState.connectTo(this); -@@ -349,6 +365,6 @@ public class RailState { +@@ -347,6 +363,6 @@ public class RailState { } public BlockState getState() { diff --git a/patches/server/0411-Brand-support.patch b/patches/server/0411-Brand-support.patch index bccbce58fe..bc78c3b986 100644 --- a/patches/server/0411-Brand-support.patch +++ b/patches/server/0411-Brand-support.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Brand support diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 966b86a2b26a32aad2656d1f2beb6daf5b81b3b1..587cce4d3878bc5cba5f4f4e58eacce2f656e242 100644 +index 8729fb23a7d7700fbccba03d07382091134c6549..7c7e3d541733ea1784f8b90acbc8b1aecb6d7859 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -273,6 +273,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0424-Add-methods-to-get-translation-keys.patch b/patches/server/0424-Add-methods-to-get-translation-keys.patch index d602369647..26a527c94e 100644 --- a/patches/server/0424-Add-methods-to-get-translation-keys.patch +++ b/patches/server/0424-Add-methods-to-get-translation-keys.patch @@ -25,7 +25,7 @@ index f041b5d80bff9c022b007e04ef1558e9116acc6b..a586442422a2b2c06b785af0d261d3e1 // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java b/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java -index f0f7fb977edb7e7009716429f007e44fa36bfcda..7aa4035a4df1ddcc71065034eafd569ca59be810 100644 +index f24b4732db849893fd870b4b6a49f1c4b3eacdec..3feaaca5aaee12e48fa2e5f5d05329c9980b161e 100644 --- a/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java +++ b/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java @@ -152,6 +152,11 @@ public class CraftEnchantment extends Enchantment implements Handleable implements BehaviorControl +@@ -18,7 +18,7 @@ public class GateBehavior implements BehaviorControl private final Set> exitErasedMemories; private final GateBehavior.OrderPolicy orderPolicy; private final GateBehavior.RunningPolicy runningPolicy; @@ -18,9 +18,9 @@ index 419eadbe31b86b7192fd7a63268d547705e7c7ce..4b31a91a8d8a3b231e323692d0a0f7ae + private final ShufflingList> behaviors = new ShufflingList<>(false); // Paper - Fix Concurrency issue in ShufflingList during worldgen private Behavior.Status status = Behavior.Status.STOPPED; - public GateBehavior(Map, MemoryStatus> requiredMemoryState, Set> memoriesToForgetWhenStopped, GateBehavior.OrderPolicy order, GateBehavior.RunningPolicy runMode, List, Integer>> tasks) { + public GateBehavior( diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java b/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java -index 9fb20cd00568aeea25284ea0e80fe52cb1c3eede..9d01471da0571c92a60cd57ebd22a5f0b5648fb4 100644 +index 195eea55fabc7a9a665e0a8f04934a3aaf9f8b71..3fac11bf02652b5f51f30f99bdf516504467d0d2 100644 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/ShufflingList.java @@ -16,12 +16,25 @@ import net.minecraft.util.RandomSource; @@ -49,13 +49,11 @@ index 9fb20cd00568aeea25284ea0e80fe52cb1c3eede..9d01471da0571c92a60cd57ebd22a5f0 this.entries = Lists.newArrayList(list); } -@@ -37,11 +50,12 @@ public class ShufflingList implements Iterable { +@@ -35,9 +48,12 @@ public class ShufflingList implements Iterable { } public ShufflingList shuffle() { -- this.entries.forEach((entry) -> { -- entry.setRandom(this.random.nextFloat()); -- }); +- this.entries.forEach(entry -> entry.setRandom(this.random.nextFloat())); - this.entries.sort(Comparator.comparingDouble(ShufflingList.WeightedEntry::getRandWeight)); - return this; + // Paper start - Fix Concurrency issue in ShufflingList during worldgen diff --git a/patches/server/0440-Retain-block-place-order-when-capturing-blockstates.patch b/patches/server/0440-Retain-block-place-order-when-capturing-blockstates.patch index f568cd0d92..81ed0ec42c 100644 --- a/patches/server/0440-Retain-block-place-order-when-capturing-blockstates.patch +++ b/patches/server/0440-Retain-block-place-order-when-capturing-blockstates.patch @@ -10,7 +10,7 @@ In general, look at making this logic more robust (i.e properly handling cases where a captured entry is overriden) - but for now this will do. diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index cb6c6e8c8fe744350a117f38e474ce8f5dd0a43a..1bb7cc9462cab7fbd09b944662711ae5bc5cf950 100644 +index 6d5a0aa8f8cee0897a920c2abf18efc03cad2abb..40f1b4ba266f96629b989590c7c81cd7534e93da 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -154,7 +154,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { diff --git a/patches/server/0441-Reduce-blockpos-allocation-from-pathfinding.patch b/patches/server/0441-Reduce-blockpos-allocation-from-pathfinding.patch index 8d14eb1a05..0ead9a9fe2 100644 --- a/patches/server/0441-Reduce-blockpos-allocation-from-pathfinding.patch +++ b/patches/server/0441-Reduce-blockpos-allocation-from-pathfinding.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Reduce blockpos allocation from pathfinding diff --git a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java -index dbb6a7d950b1a6f58a845b4d399ead6eb6d4fe14..70c7c735fdd0c1b66243915622e47eab8a57e7cc 100644 +index b125b9903454891e22a15a0a794d67be67fdb083..1cd7f0f1c7d62552e6609997c83f3df8dae13316 100644 --- a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java +++ b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java -@@ -479,7 +479,7 @@ public class WalkNodeEvaluator extends NodeEvaluator { +@@ -483,7 +483,7 @@ public class WalkNodeEvaluator extends NodeEvaluator { return BlockPathTypes.DANGER_FIRE; } @@ -17,12 +17,12 @@ index dbb6a7d950b1a6f58a845b4d399ead6eb6d4fe14..70c7c735fdd0c1b66243915622e47eab return BlockPathTypes.WATER_BORDER; } -@@ -510,7 +510,7 @@ public class WalkNodeEvaluator extends NodeEvaluator { - } else if (blockState.is(Blocks.COCOA)) { - return BlockPathTypes.COCOA; - } else if (!blockState.is(Blocks.WITHER_ROSE) && !blockState.is(Blocks.POINTED_DRIPSTONE)) { -- FluidState fluidState = world.getFluidState(pos); -+ FluidState fluidState = blockState.getFluidState(); // Paper - Perf: Reduce blockpos allocation from pathfinding - if (fluidState.is(FluidTags.LAVA)) { - return BlockPathTypes.LAVA; - } else if (isBurningBlock(blockState)) { +@@ -516,7 +516,7 @@ public class WalkNodeEvaluator extends NodeEvaluator { + } else if (blockState.is(Blocks.COCOA)) { + return BlockPathTypes.COCOA; + } else if (!blockState.is(Blocks.WITHER_ROSE) && !blockState.is(Blocks.POINTED_DRIPSTONE)) { +- FluidState fluidState = world.getFluidState(pos); ++ FluidState fluidState = blockState.getFluidState(); // Paper - Perf: Reduce blockpos allocation from pathfinding + if (fluidState.is(FluidTags.LAVA)) { + return BlockPathTypes.LAVA; + } else if (isBurningBlock(blockState)) { diff --git a/patches/server/0448-Fix-client-lag-on-advancement-loading.patch b/patches/server/0448-Fix-client-lag-on-advancement-loading.patch index 4882b3fd23..18483eae32 100644 --- a/patches/server/0448-Fix-client-lag-on-advancement-loading.patch +++ b/patches/server/0448-Fix-client-lag-on-advancement-loading.patch @@ -15,7 +15,7 @@ manually reload the advancement data for all players, which normally takes place as a part of the datapack reloading. diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 2bc3d9c02256269845d140764b7b1b201e38b569..14d094d9af9b76277859901db908b8a36b24986b 100644 +index f4a7da134584a065a34b4f6a8eaebfcb81b6d735..f10457466cbaaba2d3aa49a64092847f635ce752 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -334,7 +334,13 @@ public final class CraftMagicNumbers implements UnsafeValues { diff --git a/patches/server/0451-Add-API-for-quit-reason.patch b/patches/server/0451-Add-API-for-quit-reason.patch index b506a95e94..a5ab74ddf4 100644 --- a/patches/server/0451-Add-API-for-quit-reason.patch +++ b/patches/server/0451-Add-API-for-quit-reason.patch @@ -25,7 +25,7 @@ index 1113380f6f142d2faf36191aae158c747bed5bb9..ddc84de84c8a503a01e40c42fe83558a Connection.LOGGER.debug("Failed to sent packet", throwable); if (this.getSending() == PacketFlow.CLIENTBOUND) { diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 587cce4d3878bc5cba5f4f4e58eacce2f656e242..6e62c5037a69468e7b4c8115a6623d48538de307 100644 +index 7c7e3d541733ea1784f8b90acbc8b1aecb6d7859..efe511fc6ab121263fe0c09763e09e0cf10a354a 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -274,6 +274,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0458-Significantly-improve-performance-of-the-end-generat.patch b/patches/server/0458-Significantly-improve-performance-of-the-end-generat.patch index dc7812a211..3ddbe5452e 100644 --- a/patches/server/0458-Significantly-improve-performance-of-the-end-generat.patch +++ b/patches/server/0458-Significantly-improve-performance-of-the-end-generat.patch @@ -12,11 +12,11 @@ Co-authored-by: Dylan Xaldin Co-authored-by: pop4959 diff --git a/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java b/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java -index fac92f37c32e0398ebc05d9a0378446fcabaef1a..01b60aaf484e1e327ca42d3573fd86d2abd749fa 100644 +index 2cf20ef14ad18346f942395546ad31f2d774f81a..ed8cfa36f41643b191714b2ae6176f58f93bd4b2 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java +++ b/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java -@@ -490,6 +490,16 @@ public final class DensityFunctions { - public static final KeyDispatchDataCodec CODEC = KeyDispatchDataCodec.of(MapCodec.unit(new DensityFunctions.EndIslandDensityFunction(0L))); +@@ -509,6 +509,16 @@ public final class DensityFunctions { + ); private static final float ISLAND_THRESHOLD = -0.9F; private final SimplexNoise islandNoise; + // Paper start - Perf: Optimize end generation @@ -32,16 +32,16 @@ index fac92f37c32e0398ebc05d9a0378446fcabaef1a..01b60aaf484e1e327ca42d3573fd86d2 public EndIslandDensityFunction(long seed) { RandomSource randomSource = new LegacyRandomSource(seed); -@@ -505,12 +515,26 @@ public final class DensityFunctions { +@@ -524,12 +534,26 @@ public final class DensityFunctions { float f = 100.0F - Mth.sqrt((long) x * (long) x + (long) z * (long) z) * 8.0F; // Paper - cast ints to long to avoid integer overflow f = Mth.clamp(f, -100.0F, 80.0F); + NoiseCache cache = noiseCache.get().computeIfAbsent(sampler, noiseKey -> new NoiseCache()); // Paper - Perf: Optimize end generation - for(int m = -12; m <= 12; ++m) { - for(int n = -12; n <= 12; ++n) { - long o = (long)(i + m); - long p = (long)(j + n); -- if (o * o + p * p > 4096L && sampler.getValue((double)o, (double)p) < (double)-0.9F) { + for (int m = -12; m <= 12; m++) { + for (int n = -12; n <= 12; n++) { + long o = i + m; + long p = j + n; +- if (o * o + p * p > 4096L && sampler.getValue(o, p) < -0.9F) { - float g = (Mth.abs((float)o) * 3439.0F + Mth.abs((float)p) * 147.0F) % 13.0F + 9.0F; + // Paper start - Perf: Optimize end generation by using a noise cache + long key = net.minecraft.world.level.ChunkPos.asLong((int) o, (int) p); @@ -50,14 +50,14 @@ index fac92f37c32e0398ebc05d9a0378446fcabaef1a..01b60aaf484e1e327ca42d3573fd86d2 + if (cache.keys[index] == key) { + g = cache.values[index]; + } else { -+ if (o * o + p * p > 4096L && sampler.getValue((double)o, (double)p) < (double)-0.9F) { -+ g = (Mth.abs((float) o) * 3439.0F + Mth.abs((float) p) * 147.0F) % 13.0F + 9.0F; ++ if (o * o + p * p > 4096L && sampler.getValue((double)o, (double)p) < -0.9F) { ++ g = (Mth.abs((float)o) * 3439.0F + Mth.abs((float)p) * 147.0F) % 13.0F + 9.0F; + } + cache.keys[index] = key; + cache.values[index] = g; + } + if (g != Float.MIN_VALUE) { + // Paper end - Perf: Optimize end generation - float h = (float)(k - m * 2); - float q = (float)(l - n * 2); + float h = k - m * 2; + float q = l - n * 2; float r = 100.0F - Mth.sqrt(h * h + q * q) * g; diff --git a/patches/server/0460-Climbing-should-not-bypass-cramming-gamerule.patch b/patches/server/0460-Climbing-should-not-bypass-cramming-gamerule.patch index 6d2f4c2108..290c73d192 100644 --- a/patches/server/0460-Climbing-should-not-bypass-cramming-gamerule.patch +++ b/patches/server/0460-Climbing-should-not-bypass-cramming-gamerule.patch @@ -44,7 +44,7 @@ index ee4495b67c46cf1282cdd6ad15b224b0b7b10bfb..e382a29b441b656f35bc24cb90f95cb4 } else if (entity.level().isClientSide && (!(entity1 instanceof Player) || !((Player) entity1).isLocalPlayer())) { return false; diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 4aad2d99148a0d6ee06049f20de2aaa6218c1d39..87fb0fe5579ba09534e379d34b134c868e838143 100644 +index b98f82b619a1932e6d820a2c42120efdc03fc839..ed32b3f1107210d56e5653b2d5eddcf1deb39dfc 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3447,7 +3447,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0462-Add-PlayerShearBlockEvent.patch b/patches/server/0462-Add-PlayerShearBlockEvent.patch index 140bb100a4..e8a864c69f 100644 --- a/patches/server/0462-Add-PlayerShearBlockEvent.patch +++ b/patches/server/0462-Add-PlayerShearBlockEvent.patch @@ -39,10 +39,10 @@ index 44e72176a0da08a77fa192ee31c0fcd53f0dc22d..27f1c1ac12251f1438ee8bf14f4afb5f entityhuman1.broadcastBreakEvent(hand); }); diff --git a/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java b/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java -index df11efd22682c2ed799dabf15d2cfa5973e8dca9..cc13b74fa37b5df6fe6f1423496b9fb03d71d083 100644 +index d9c4e0cf178b9a1eed230dc7b8cfbd8f3f49c7bb..c67ee44d49693bfcb92cbbf0ed44929bf0034f13 100644 --- a/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java +++ b/src/main/java/net/minecraft/world/level/block/PumpkinBlock.java -@@ -35,13 +35,24 @@ public class PumpkinBlock extends Block { +@@ -35,21 +35,30 @@ public class PumpkinBlock extends Block { ItemStack itemStack = player.getItemInHand(hand); if (itemStack.is(Items.SHEARS)) { if (!world.isClientSide) { @@ -55,16 +55,22 @@ index df11efd22682c2ed799dabf15d2cfa5973e8dca9..cc13b74fa37b5df6fe6f1423496b9fb0 + // Paper end - Add PlayerShearBlockEvent Direction direction = hit.getDirection(); Direction direction2 = direction.getAxis() == Direction.Axis.Y ? player.getDirection().getOpposite() : direction; - world.playSound((Player)null, pos, SoundEvents.PUMPKIN_CARVE, SoundSource.BLOCKS, 1.0F, 1.0F); + world.playSound(null, pos, SoundEvents.PUMPKIN_CARVE, SoundSource.BLOCKS, 1.0F, 1.0F); world.setBlock(pos, Blocks.CARVED_PUMPKIN.defaultBlockState().setValue(CarvedPumpkinBlock.FACING, direction2), 11); -- ItemEntity itemEntity = new ItemEntity(world, (double)pos.getX() + 0.5D + (double)direction2.getStepX() * 0.65D, (double)pos.getY() + 0.1D, (double)pos.getZ() + 0.5D + (double)direction2.getStepZ() * 0.65D, new ItemStack(Items.PUMPKIN_SEEDS, 4)); -+ // Paper start - Add PlayerShearBlockEvent -+ for (org.bukkit.inventory.ItemStack item : event.getDrops()) { -+ ItemEntity itemEntity = new ItemEntity(world, (double) pos.getX() + 0.5D + (double) direction2.getStepX() * 0.65D, (double) pos.getY() + 0.1D, (double) pos.getZ() + 0.5D + (double) direction2.getStepZ() * 0.65D, org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(item)); -+ // Paper end - Add PlayerShearBlockEvent - itemEntity.setDeltaMovement(0.05D * (double)direction2.getStepX() + world.random.nextDouble() * 0.02D, 0.05D, 0.05D * (double)direction2.getStepZ() + world.random.nextDouble() * 0.02D); ++ for (org.bukkit.inventory.ItemStack item : event.getDrops()) { // Paper - Add PlayerShearBlockEvent + ItemEntity itemEntity = new ItemEntity( + world, + pos.getX() + 0.5 + direction2.getStepX() * 0.65, + pos.getY() + 0.1, + pos.getZ() + 0.5 + direction2.getStepZ() * 0.65, +- new ItemStack(Items.PUMPKIN_SEEDS, 4) ++ org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(item) // Paper - Add PlayerShearBlockEvent + ); + itemEntity.setDeltaMovement( + 0.05 * direction2.getStepX() + world.random.nextDouble() * 0.02, 0.05, 0.05 * direction2.getStepZ() + world.random.nextDouble() * 0.02 + ); world.addFreshEntity(itemEntity); + } // Paper - Add PlayerShearBlockEvent - itemStack.hurtAndBreak(1, player, (playerx) -> { - playerx.broadcastBreakEvent(hand); - }); + itemStack.hurtAndBreak(1, player, playerx -> playerx.broadcastBreakEvent(hand)); + world.gameEvent(player, GameEvent.SHEAR, pos); + player.awardStat(Stats.ITEM_USED.get(Items.SHEARS)); diff --git a/patches/server/0465-Player-Chunk-Load-Unload-Events.patch b/patches/server/0465-Player-Chunk-Load-Unload-Events.patch index 241610bb61..638b4ea18b 100644 --- a/patches/server/0465-Player-Chunk-Load-Unload-Events.patch +++ b/patches/server/0465-Player-Chunk-Load-Unload-Events.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Player Chunk Load/Unload Events diff --git a/src/main/java/net/minecraft/server/network/PlayerChunkSender.java b/src/main/java/net/minecraft/server/network/PlayerChunkSender.java -index c509a1318bcef38fd4927e38b6ee9846853e2d15..13209267c26f46492a92e820889a9be0bd2287a0 100644 +index 8235d66bb1246f4bb3425d2127b5fe67e4e7eec6..b7778d5296d01870e37560d8f03d48e4a4dd62ae 100644 --- a/src/main/java/net/minecraft/server/network/PlayerChunkSender.java +++ b/src/main/java/net/minecraft/server/network/PlayerChunkSender.java -@@ -45,6 +45,11 @@ public class PlayerChunkSender { +@@ -44,6 +44,11 @@ public class PlayerChunkSender { public void dropChunk(ServerPlayer player, ChunkPos pos) { if (!this.pendingChunks.remove(pos.toLong()) && player.isAlive()) { player.connection.send(new ClientboundForgetLevelChunkPacket(pos)); @@ -18,12 +18,12 @@ index c509a1318bcef38fd4927e38b6ee9846853e2d15..13209267c26f46492a92e820889a9be0 + } + // Paper end - PlayerChunkUnloadEvent } - } -@@ -77,6 +82,11 @@ public class PlayerChunkSender { + +@@ -75,6 +80,11 @@ public class PlayerChunkSender { private static void sendChunk(ServerGamePacketListenerImpl handler, ServerLevel world, LevelChunk chunk) { - handler.send(new ClientboundLevelChunkWithLightPacket(chunk, world.getLightEngine(), (BitSet)null, (BitSet)null)); + handler.send(new ClientboundLevelChunkWithLightPacket(chunk, world.getLightEngine(), null, null)); + // Paper start - PlayerChunkLoadEvent + if (io.papermc.paper.event.packet.PlayerChunkLoadEvent.getHandlerList().getRegisteredListeners().length > 0) { + new io.papermc.paper.event.packet.PlayerChunkLoadEvent(new org.bukkit.craftbukkit.CraftChunk(chunk), handler.getPlayer().getBukkitEntity()).callEvent(); diff --git a/patches/server/0470-Add-TargetHitEvent.patch b/patches/server/0470-Add-TargetHitEvent.patch index f623f8091b..2afe7f45de 100644 --- a/patches/server/0470-Add-TargetHitEvent.patch +++ b/patches/server/0470-Add-TargetHitEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add TargetHitEvent diff --git a/src/main/java/net/minecraft/world/level/block/TargetBlock.java b/src/main/java/net/minecraft/world/level/block/TargetBlock.java -index 5ea231aadfafdfc6d08aae472827ff1e3d62f4eb..e885f8defd5fd5059c895ee7906664f9e4561de0 100644 +index 02f6d5b523c3d4185a68adb419b2710768ed249f..da473a8b34e39cecf63fab8f7c4f77d485e5753b 100644 --- a/src/main/java/net/minecraft/world/level/block/TargetBlock.java +++ b/src/main/java/net/minecraft/world/level/block/TargetBlock.java @@ -42,6 +42,10 @@ public class TargetBlock extends Block { @@ -16,10 +16,10 @@ index 5ea231aadfafdfc6d08aae472827ff1e3d62f4eb..e885f8defd5fd5059c895ee7906664f9 + } + private static void awardTargetHitCriteria(Projectile projectile, BlockHitResult hit, int i) { + // Paper end - Add TargetHitEvent - Entity entity = projectile.getOwner(); - if (entity instanceof ServerPlayer serverPlayer) { + if (projectile.getOwner() instanceof ServerPlayer serverPlayer) { serverPlayer.awardStat(Stats.TARGET_HIT); -@@ -53,6 +57,20 @@ public class TargetBlock extends Block { + CriteriaTriggers.TARGET_BLOCK_HIT.trigger(serverPlayer, projectile, hit.getLocation(), i); +@@ -51,6 +55,20 @@ public class TargetBlock extends Block { private static int updateRedstoneOutput(LevelAccessor world, BlockState state, BlockHitResult hitResult, Entity entity) { int i = getRedstoneStrength(hitResult, hitResult.getLocation()); int j = entity instanceof AbstractArrow ? 20 : 8; diff --git a/patches/server/0471-MC-4-Fix-item-position-desync.patch b/patches/server/0471-MC-4-Fix-item-position-desync.patch index 5b680e0dd0..597d2419e2 100644 --- a/patches/server/0471-MC-4-Fix-item-position-desync.patch +++ b/patches/server/0471-MC-4-Fix-item-position-desync.patch @@ -9,26 +9,26 @@ loss, which forces the server to lose the same precision as the client keeping them in sync. diff --git a/src/main/java/net/minecraft/network/protocol/game/VecDeltaCodec.java b/src/main/java/net/minecraft/network/protocol/game/VecDeltaCodec.java -index 05ac41e136da43284fb24a6b698ebd36318278fb..3c4ac79c094dc2fff7de94150a34b7bf814ac0de 100644 +index fb44116303ab1fed9d867087531c7601c015ddb9..a3d247c93ac1a2d872ff0e3841efc3d7b84fcbc1 100644 --- a/src/main/java/net/minecraft/network/protocol/game/VecDeltaCodec.java +++ b/src/main/java/net/minecraft/network/protocol/game/VecDeltaCodec.java @@ -9,12 +9,12 @@ public class VecDeltaCodec { @VisibleForTesting static long encode(double value) { -- return Math.round(value * 4096.0D); -+ return Math.round(value * 4096.0D); // Paper - Fix MC-4; diff on change +- return Math.round(value * 4096.0); ++ return Math.round(value * 4096.0); // Paper - Fix MC-4; diff on change } @VisibleForTesting static double decode(long value) { -- return (double)value / 4096.0D; -+ return (double)value / 4096.0D; // Paper - Fix MC-4; diff on change +- return value / 4096.0; ++ return value / 4096.0; // Paper - Fix MC-4; diff on change } public Vec3 decode(long x, long y, long z) { diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 82ccfd91dfd3cce35a35edf8f73ccdd1ddd1fd6a..18cf11ddcf51e8b6251fd6df97f85e0ed15900c4 100644 +index 82ccfd91dfd3cce35a35edf8f73ccdd1ddd1fd6a..c3ca11cc4abe85132b099af1cb27772dbf40bfe1 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -4186,6 +4186,16 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -39,9 +39,9 @@ index 82ccfd91dfd3cce35a35edf8f73ccdd1ddd1fd6a..18cf11ddcf51e8b6251fd6df97f85e0e + if (this instanceof ItemEntity) { + if (io.papermc.paper.configuration.GlobalConfiguration.get().misc.fixEntityPositionDesync) { + // encode/decode from ClientboundMoveEntityPacket -+ x = Mth.lfloor(x * 4096.0D) * (1 / 4096.0D); -+ y = Mth.lfloor(y * 4096.0D) * (1 / 4096.0D); -+ z = Mth.lfloor(z * 4096.0D) * (1 / 4096.0D); ++ x = Mth.lfloor(x * 4096.0) * (1 / 4096.0); ++ y = Mth.lfloor(y * 4096.0) * (1 / 4096.0); ++ z = Mth.lfloor(z * 4096.0) * (1 / 4096.0); + } + } + // Paper end - Fix MC-4 diff --git a/patches/server/0478-Add-PlayerFlowerPotManipulateEvent.patch b/patches/server/0478-Add-PlayerFlowerPotManipulateEvent.patch index bad384da72..ba8831c6f6 100644 --- a/patches/server/0478-Add-PlayerFlowerPotManipulateEvent.patch +++ b/patches/server/0478-Add-PlayerFlowerPotManipulateEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerFlowerPotManipulateEvent diff --git a/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java b/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java -index c450faf8c043665eab020141f3c27e3d9890cb86..fbe399fa2c27ba283e4a51f9a2559baf86fdff11 100644 +index cb77c7af329dd9fa8dc28ee3cfc475baa4b1392b..8e8fa6e0823258220b604ceef8e1f5ae15556b9a 100644 --- a/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java +++ b/src/main/java/net/minecraft/world/level/block/FlowerPotBlock.java @@ -66,6 +66,21 @@ public class FlowerPotBlock extends Block { diff --git a/patches/server/0484-Add-ServerResourcesReloadedEvent.patch b/patches/server/0484-Add-ServerResourcesReloadedEvent.patch index b01f7c1460..9d87b0e24f 100644 --- a/patches/server/0484-Add-ServerResourcesReloadedEvent.patch +++ b/patches/server/0484-Add-ServerResourcesReloadedEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add ServerResourcesReloadedEvent diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index c2892af4e98d6a436a43fea950726cc1ca60ebda..06b7816bafa3ac1093b796ca6e7bb3462df8bfec 100644 +index 99ae9628d96d6d3e42cd038eb4a0d01237cc6b1b..46cc2649ca482bd2bda37247717d8476dbb76a34 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -2036,7 +2036,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop diff --git a/src/main/java/net/minecraft/world/entity/monster/Vindicator.java b/src/main/java/net/minecraft/world/entity/monster/Vindicator.java -index 9fec5823d99d1ae8e41d9e21f7ddb8b8e94bf887..a6af5ac9d09834940d3dd4c80b16450b90484edb 100644 +index 89a05518e1b95f6edc1ac57f6ed9c3946b87b93e..0ee020848cdfd0c069f1e8d3a9516a339d82467c 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Vindicator.java +++ b/src/main/java/net/minecraft/world/entity/monster/Vindicator.java -@@ -197,7 +197,7 @@ public class Vindicator extends AbstractIllager { +@@ -196,7 +196,7 @@ public class Vindicator extends AbstractIllager { static class VindicatorBreakDoorGoal extends BreakDoorGoal { public VindicatorBreakDoorGoal(Mob mob) { diff --git a/patches/server/0496-Collision-option-for-requiring-a-player-participant.patch b/patches/server/0496-Collision-option-for-requiring-a-player-participant.patch index 176ae99bc8..27be6dda95 100644 --- a/patches/server/0496-Collision-option-for-requiring-a-player-participant.patch +++ b/patches/server/0496-Collision-option-for-requiring-a-player-participant.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Collision option for requiring a player participant diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 18cf11ddcf51e8b6251fd6df97f85e0ed15900c4..2d8c476eb9f329ee6827340b6cec26a84901c56a 100644 +index c3ca11cc4abe85132b099af1cb27772dbf40bfe1..5b0502cfcc3d9317941d7444750a49832e1a52a1 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -1848,6 +1848,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0506-Reset-shield-blocking-on-dimension-change.patch b/patches/server/0506-Reset-shield-blocking-on-dimension-change.patch index b59a53ac0f..e29d07bebd 100644 --- a/patches/server/0506-Reset-shield-blocking-on-dimension-change.patch +++ b/patches/server/0506-Reset-shield-blocking-on-dimension-change.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Reset shield blocking on dimension change diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 6e62c5037a69468e7b4c8115a6623d48538de307..8c65b05e66372cf3c92f823d72e94c18fe77622b 100644 +index efe511fc6ab121263fe0c09763e09e0cf10a354a..19baf0ecd04ae058fac709889db34bf27679ab5e 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1198,6 +1198,11 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0508-Add-EntityMoveEvent.patch b/patches/server/0508-Add-EntityMoveEvent.patch index 54dd0d6264..dd7d2720c2 100644 --- a/patches/server/0508-Add-EntityMoveEvent.patch +++ b/patches/server/0508-Add-EntityMoveEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add EntityMoveEvent diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 06b7816bafa3ac1093b796ca6e7bb3462df8bfec..3f061e1135bac08e6ea1530407ff2667904339a5 100644 +index 46cc2649ca482bd2bda37247717d8476dbb76a34..4416feb73fd800787db65f5841eb92b1b29cddb0 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -1526,6 +1526,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { - return new Direction[i]; - }); +@@ -48,6 +48,12 @@ public enum Direction implements StringRepresentable { + .sorted(Comparator.comparingInt(direction -> direction.data2d)) + .toArray(Direction[]::new); + + // Paper start - Perf: Inline shift direction fields + private final int adjX; + private final int adjY; + private final int adjZ; + // Paper end - Perf: Inline shift direction fields - ++ private Direction(int id, int idOpposite, int idHorizontal, String name, Direction.AxisDirection direction, Direction.Axis axis, Vec3i vector) { this.data3d = id; -@@ -61,6 +66,11 @@ public enum Direction implements StringRepresentable { + this.data2d = idHorizontal; +@@ -56,6 +62,11 @@ public enum Direction implements StringRepresentable { this.axis = axis; this.axisDirection = direction; this.normal = vector; @@ -34,7 +35,7 @@ index 3abec6de94f0ef1d788320e33653c598887f17ca..073c717bb676b9e99aada00c349fb7ee } public static Direction[] orderedByNearest(Entity entity) { -@@ -348,15 +358,15 @@ public enum Direction implements StringRepresentable { +@@ -219,15 +230,15 @@ public enum Direction implements StringRepresentable { } public int getStepX() { diff --git a/patches/server/0513-living-entity-allow-attribute-registration.patch b/patches/server/0513-living-entity-allow-attribute-registration.patch index b04ce69eb9..b05d18bed0 100644 --- a/patches/server/0513-living-entity-allow-attribute-registration.patch +++ b/patches/server/0513-living-entity-allow-attribute-registration.patch @@ -5,12 +5,12 @@ Subject: [PATCH] living entity allow attribute registration diff --git a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java -index d5dfb08f550f5644ff5164170d6c16a3b25a3748..897d7632ecfea40890433474870dd7a5e534d8ab 100644 +index 4228d28b2f697e7dc320525c1ad48a8a2aa0fdb4..b99a080ab27e24d8131fda931ca70d6d271bb01c 100644 --- a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java +++ b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java -@@ -152,4 +152,12 @@ public class AttributeMap { +@@ -138,4 +138,12 @@ public class AttributeMap { + }, () -> LOGGER.warn("Ignoring unknown attribute '{}'", string)); } - } + + // Paper - start - living entity allow attribute registration @@ -38,7 +38,7 @@ index ea48f1119a940056c37d1d203437bfbfdf13663b..8a678df56fcf30535957e111d81ad07b + // Paper end - living entity allow attribute registration } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 6ee15dee09d3e727df01564282ba5eb6450db51b..7b65a7d1efaf90d1a2b7a601f94be4d9ebe76a2b 100644 +index 4ac52885618bf062eb34672b8fc60331a9c8f76a..0a4df9971c66676dba90fb03c840e25a41103bc0 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -755,6 +755,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { diff --git a/patches/server/0517-Improve-ServerGUI.patch b/patches/server/0517-Improve-ServerGUI.patch index ea0b4bbc77..4826a41eff 100644 --- a/patches/server/0517-Improve-ServerGUI.patch +++ b/patches/server/0517-Improve-ServerGUI.patch @@ -58,10 +58,10 @@ index 2bbc57b4869caf690f53618d60359c5133ec62a8..c42a9949c4d37d45883867a54222a7ab public void windowClosing(WindowEvent windowevent) { if (!servergui.isClosing.getAndSet(true)) { diff --git a/src/main/java/net/minecraft/server/gui/StatsComponent.java b/src/main/java/net/minecraft/server/gui/StatsComponent.java -index 7938029cb7aa6f09f78fb1c648357c36edb68510..38fe7e5014332f45e41a3d5d91c28dd0acfdc3b0 100644 +index 6d77a48ce4241477cf66fbf562b542de01f420ce..a34dc23499a9d55cceb1f2b2907e4d34b0d67616 100644 --- a/src/main/java/net/minecraft/server/gui/StatsComponent.java +++ b/src/main/java/net/minecraft/server/gui/StatsComponent.java -@@ -36,8 +36,17 @@ public class StatsComponent extends JComponent { +@@ -34,8 +34,17 @@ public class StatsComponent extends JComponent { private void tick() { long l = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory(); @@ -73,13 +73,13 @@ index 7938029cb7aa6f09f78fb1c648357c36edb68510..38fe7e5014332f45e41a3d5d91c28dd0 + tpsAvg[g] = format( tps[g] ); + } this.msgs[0] = "Memory use: " + l / 1024L / 1024L + " mb (" + Runtime.getRuntime().freeMemory() * 100L / Runtime.getRuntime().maxMemory() + "% free)"; - this.msgs[1] = "Avg tick: " + DECIMAL_FORMAT.format((double)this.server.getAverageTickTimeNanos() / (double)TimeUtil.NANOSECONDS_PER_MILLISECOND) + " ms"; + this.msgs[1] = "Avg tick: " + DECIMAL_FORMAT.format((double)this.server.getAverageTickTimeNanos() / TimeUtil.NANOSECONDS_PER_MILLISECOND) + " ms"; + this.msgs[2] = "TPS from last 1m, 5m, 15m: " + String.join(", ", tpsAvg); + // Paper end - Improve ServerGUI - this.values[this.vp++ & 255] = (int)(l * 100L / Runtime.getRuntime().maxMemory()); + this.values[this.vp++ & 0xFF] = (int)(l * 100L / Runtime.getRuntime().maxMemory()); this.repaint(); } -@@ -67,4 +76,10 @@ public class StatsComponent extends JComponent { +@@ -64,4 +73,10 @@ public class StatsComponent extends JComponent { public void close() { this.timer.stop(); } diff --git a/patches/server/0518-fix-converting-txt-to-json-file.patch b/patches/server/0518-fix-converting-txt-to-json-file.patch index 5f13006cc4..cd8921cdba 100644 --- a/patches/server/0518-fix-converting-txt-to-json-file.patch +++ b/patches/server/0518-fix-converting-txt-to-json-file.patch @@ -5,7 +5,7 @@ Subject: [PATCH] fix converting txt to json file diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java b/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java -index a20d47f54f12dfc0a5f76dd969238e34c958b618..1c9cf5e1c4ee05724ffcdbd77a19bca1ab2be4d3 100644 +index 929f59bce01c8e6ed4b0b551744d42e131b8fc80..22c4f8dea99f92a1eb3da2baf0a15bf9d2ca0462 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java @@ -18,6 +18,11 @@ public class DedicatedPlayerList extends PlayerList { diff --git a/patches/server/0526-Add-fast-alternative-constructor-for-Rotations.patch b/patches/server/0526-Add-fast-alternative-constructor-for-Rotations.patch index 9b38f8f90d..7c07d6c0ee 100644 --- a/patches/server/0526-Add-fast-alternative-constructor-for-Rotations.patch +++ b/patches/server/0526-Add-fast-alternative-constructor-for-Rotations.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add fast alternative constructor for Rotations diff --git a/src/main/java/net/minecraft/core/Rotations.java b/src/main/java/net/minecraft/core/Rotations.java -index e4b4e78de933b93be87805501d9cbfec429cf68c..95ef904bebeaff3275f25c401ef13c68504f3514 100644 +index 63a6512437a3611f73573f9fc97d4f32fb8be861..d6f1002d0f5760383edd641165f6622f8d6672c2 100644 --- a/src/main/java/net/minecraft/core/Rotations.java +++ b/src/main/java/net/minecraft/core/Rotations.java @@ -19,6 +19,18 @@ public class Rotations { diff --git a/patches/server/0529-forced-whitelist-use-configurable-kick-message.patch b/patches/server/0529-forced-whitelist-use-configurable-kick-message.patch index 48f96930a9..97e28a74cf 100644 --- a/patches/server/0529-forced-whitelist-use-configurable-kick-message.patch +++ b/patches/server/0529-forced-whitelist-use-configurable-kick-message.patch @@ -5,7 +5,7 @@ Subject: [PATCH] forced whitelist: use configurable kick message diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 3f061e1135bac08e6ea1530407ff2667904339a5..773e4850956a7ffcd78cc241a598fd13bcfe1d20 100644 +index 4416feb73fd800787db65f5841eb92b1b29cddb0..c9545f96317fd6692889d82851d76084efa6a61d 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -2167,7 +2167,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop io.papermc.paper.adventure.PaperAdventure.asVanilla(event.cancelMessage()), false); } + // Paper end - Expand PlayerGameModeChangeEvent -+ ++i; ++ i++; } } diff --git a/src/main/java/net/minecraft/server/commands/GameModeCommand.java b/src/main/java/net/minecraft/server/commands/GameModeCommand.java -index aee8618e27b893b72931e925724dd683d2e6d2aa..f7c9127346261d83413ca03a1cdaa84975ae17d6 100644 +index 7f09119bc7d661e08a960dd2bd46006efe752d3e..d1da3600dc07107309b20ebe6e7c0c4da0e8de76 100644 --- a/src/main/java/net/minecraft/server/commands/GameModeCommand.java +++ b/src/main/java/net/minecraft/server/commands/GameModeCommand.java -@@ -48,9 +48,14 @@ public class GameModeCommand { +@@ -60,9 +60,14 @@ public class GameModeCommand { int i = 0; - for(ServerPlayer serverPlayer : targets) { + for (ServerPlayer serverPlayer : targets) { - if (serverPlayer.setGameMode(gameMode)) { + // Paper start - Expand PlayerGameModeChangeEvent + org.bukkit.event.player.PlayerGameModeChangeEvent event = serverPlayer.setGameMode(gameMode, org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.COMMAND, net.kyori.adventure.text.Component.empty()); + if (event != null && !event.isCancelled()) { logGamemodeChange(context.getSource(), serverPlayer, gameMode); - ++i; + i++; + } else if (event != null && event.cancelMessage() != null) { + context.getSource().sendSuccess(() -> io.papermc.paper.adventure.PaperAdventure.asVanilla(event.cancelMessage()), true); + // Paper end - Expand PlayerGameModeChangeEvent @@ -45,7 +45,7 @@ index aee8618e27b893b72931e925724dd683d2e6d2aa..f7c9127346261d83413ca03a1cdaa849 } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 8c65b05e66372cf3c92f823d72e94c18fe77622b..a09ef51e94a0bf9f51bf358e7cf77dd5d272aab2 100644 +index 19baf0ecd04ae058fac709889db34bf27679ab5e..28baa63b9b750a7f03da364d9c1fe691d3ce1706 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1940,8 +1940,16 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0564-Add-EntityInsideBlockEvent.patch b/patches/server/0564-Add-EntityInsideBlockEvent.patch index a63f8ecbfe..32ac5315b3 100644 --- a/patches/server/0564-Add-EntityInsideBlockEvent.patch +++ b/patches/server/0564-Add-EntityInsideBlockEvent.patch @@ -41,7 +41,7 @@ index 546dbe28edbba32ab2aede1260fbd2c9baa9fe1a..0d92bd6f1e4f3470a62f573add349022 if (state.getValue(BigDripleafBlock.TILT) == Tilt.NONE && BigDripleafBlock.canEntityTilt(pos, entity) && !world.hasNeighborSignal(pos)) { // CraftBukkit start - tilt dripleaf diff --git a/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java b/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java -index 240e01063b5d684020ed2d7d73fc60c64fd8cf2e..78d98a442ea3c14500ac6ae597ff2a5080b7ce15 100644 +index e4e80844ad447536c7f53bcbc721f73880414a76..addd8b3758254e4f4cd4e951cd065f83ad5dcdf8 100644 --- a/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java @@ -47,6 +47,7 @@ public class BubbleColumnBlock extends Block implements BucketPickup { @@ -125,10 +125,10 @@ index 07629f6106f384751c376d2a99ba2e8b905e49c6..9ee2fd0914ff7836517ca143d51db615 ResourceKey resourcekey = world.getTypeKey() == LevelStem.END ? Level.OVERWORLD : Level.END; // CraftBukkit - SPIGOT-6152: send back to main overworld in custom ends ServerLevel worldserver = ((ServerLevel) world).getServer().getLevel(resourcekey); diff --git a/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java b/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java -index d5c83f3b9d398b2a025e6729980b1b87b35f38a8..68978e1629381ada161225c53a236a54deae6481 100644 +index 166ed5bb0ecd66a70b970e1df77c27f2069d2808..6e283e8c3db31f03dd95c94887e647b8d82a3604 100644 --- a/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java +++ b/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java -@@ -78,6 +78,7 @@ public class FrogspawnBlock extends Block { +@@ -79,6 +79,7 @@ public class FrogspawnBlock extends Block { @Override public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { @@ -137,10 +137,10 @@ index d5c83f3b9d398b2a025e6729980b1b87b35f38a8..68978e1629381ada161225c53a236a54 this.destroyBlock(world, pos); } diff --git a/src/main/java/net/minecraft/world/level/block/HoneyBlock.java b/src/main/java/net/minecraft/world/level/block/HoneyBlock.java -index 8b84359316e559b94ae6a2d757bda2286d99a903..39e2fe8c5f5a2a4d4f3a7be3645923b5a1dca875 100644 +index 517bd00234892d53300d5a902fda4eed4b8bef66..409b4818840916a8ddbfc1ee87c8c22902939f38 100644 --- a/src/main/java/net/minecraft/world/level/block/HoneyBlock.java +++ b/src/main/java/net/minecraft/world/level/block/HoneyBlock.java -@@ -61,6 +61,7 @@ public class HoneyBlock extends HalfTransparentBlock { +@@ -60,6 +60,7 @@ public class HoneyBlock extends HalfTransparentBlock { @Override public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { @@ -149,7 +149,7 @@ index 8b84359316e559b94ae6a2d757bda2286d99a903..39e2fe8c5f5a2a4d4f3a7be3645923b5 this.maybeDoSlideAchievement(entity, pos); this.doSlideMovement(entity); diff --git a/src/main/java/net/minecraft/world/level/block/HopperBlock.java b/src/main/java/net/minecraft/world/level/block/HopperBlock.java -index 99a5821a55f2d2947722d64d60f4ee4ba5dfa74c..04e69d6066faf1c605aeeabe827dc20fc96a3568 100644 +index 004f37120e079465aef40830d3086a820d5752c3..4f86e3d2aec246ff0be258885128086e21457a70 100644 --- a/src/main/java/net/minecraft/world/level/block/HopperBlock.java +++ b/src/main/java/net/minecraft/world/level/block/HopperBlock.java @@ -200,6 +200,7 @@ public class HopperBlock extends BaseEntityBlock { @@ -161,7 +161,7 @@ index 99a5821a55f2d2947722d64d60f4ee4ba5dfa74c..04e69d6066faf1c605aeeabe827dc20f if (blockEntity instanceof HopperBlockEntity) { HopperBlockEntity.entityInside(world, pos, state, entity, (HopperBlockEntity)blockEntity); diff --git a/src/main/java/net/minecraft/world/level/block/LavaCauldronBlock.java b/src/main/java/net/minecraft/world/level/block/LavaCauldronBlock.java -index 7e926a4546f89da22080ef28c3858ac7b3cf80f1..29d4553df54236706c76fdec0bb14b5d9fb82ff2 100644 +index 1e6a51f7679af81a00d9f55a926baeed80ed24d3..25b3f2550a099e9938a82f2c0ff31da4e5f23614 100644 --- a/src/main/java/net/minecraft/world/level/block/LavaCauldronBlock.java +++ b/src/main/java/net/minecraft/world/level/block/LavaCauldronBlock.java @@ -32,6 +32,7 @@ public class LavaCauldronBlock extends AbstractCauldronBlock { @@ -197,10 +197,10 @@ index 2a8f97d97ae7f268da920b5e3b9719743fa9a8e0..1b5cc5d6aa0b4313da980ce175c54145 // CraftBukkit start - Entity in portal EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), pos.getX(), pos.getY(), pos.getZ())); diff --git a/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java b/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java -index f7154d56ad42e0dde497e0e585cc554d34865e3b..690abba9d27ab4061de4dd3676292b1859036868 100644 +index 15696602249465fa1d13eaec3b8b06574ec06f07..c9ed129db2cadd0a33d69993961f43088725c3cb 100644 --- a/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java +++ b/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java -@@ -94,6 +94,7 @@ public class PitcherCropBlock extends DoublePlantBlock implements BonemealableBl +@@ -98,6 +98,7 @@ public class PitcherCropBlock extends DoublePlantBlock implements BonemealableBl @Override public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { @@ -257,7 +257,7 @@ index d89a4c30599cedcb8ce17899631cb58c8a6a2195..61abbcfe97e3d3e3da5ee658672549d1 // CraftBukkit start if (!CraftEventFactory.callEntityChangeBlockEvent(entity, pos, Blocks.AIR.defaultBlockState())) { diff --git a/src/main/java/net/minecraft/world/level/block/WebBlock.java b/src/main/java/net/minecraft/world/level/block/WebBlock.java -index 7206dfa5bdfb94ff98bcdfc735367c22493e925e..4905de6446f07e2fff53a3c8580b64b96306c373 100644 +index 313ac5d2e2dbc9afcfcef8c97f85e56243825ab0..709d5002ad7a1004286bf2749c82e25d7f0d0133 100644 --- a/src/main/java/net/minecraft/world/level/block/WebBlock.java +++ b/src/main/java/net/minecraft/world/level/block/WebBlock.java @@ -22,6 +22,7 @@ public class WebBlock extends Block { @@ -265,7 +265,7 @@ index 7206dfa5bdfb94ff98bcdfc735367c22493e925e..4905de6446f07e2fff53a3c8580b64b9 @Override public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { + if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent - entity.makeStuckInBlock(state, new Vec3(0.25D, (double)0.05F, 0.25D)); + entity.makeStuckInBlock(state, new Vec3(0.25, 0.05F, 0.25)); } } diff --git a/src/main/java/net/minecraft/world/level/block/WitherRoseBlock.java b/src/main/java/net/minecraft/world/level/block/WitherRoseBlock.java diff --git a/patches/server/0569-Add-PlayerKickEvent-causes.patch b/patches/server/0569-Add-PlayerKickEvent-causes.patch index cba228a0e1..17147225c5 100644 --- a/patches/server/0569-Add-PlayerKickEvent-causes.patch +++ b/patches/server/0569-Add-PlayerKickEvent-causes.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add PlayerKickEvent causes diff --git a/src/main/java/net/minecraft/network/chat/SignedMessageChain.java b/src/main/java/net/minecraft/network/chat/SignedMessageChain.java -index 96814e626a95e4e3c2f4df1a0339d37bb02f2e61..ba12919c3f9aec34a9e64993b143ae92be5eb172 100644 +index e15d740275d265c460c1771cdad5556bcec9d798..0af9ed92824ccf30814eceb6a2c2e5c12661c991 100644 --- a/src/main/java/net/minecraft/network/chat/SignedMessageChain.java +++ b/src/main/java/net/minecraft/network/chat/SignedMessageChain.java -@@ -35,16 +35,16 @@ public class SignedMessageChain { +@@ -34,16 +34,16 @@ public class SignedMessageChain { return (signature, body) -> { SignedMessageLink signedMessageLink = this.advanceLink(); if (signedMessageLink == null) { @@ -22,14 +22,14 @@ index 96814e626a95e4e3c2f4df1a0339d37bb02f2e61..ba12919c3f9aec34a9e64993b143ae92 + throw new SignedMessageChain.DecodeException(Component.translatable("multiplayer.disconnect.out_of_order_chat"), true, org.bukkit.event.player.PlayerKickEvent.Cause.OUT_OF_ORDER_CHAT); // Paper - kick event causes } else { this.lastTimeStamp = body.timeStamp(); - PlayerChatMessage playerChatMessage = new PlayerChatMessage(signedMessageLink, signature, body, (Component)null, FilterMask.PASS_THROUGH); + PlayerChatMessage playerChatMessage = new PlayerChatMessage(signedMessageLink, signature, body, null, FilterMask.PASS_THROUGH); if (!playerChatMessage.verify(signatureValidator)) { - throw new SignedMessageChain.DecodeException(Component.translatable("multiplayer.disconnect.unsigned_chat"), true); + throw new SignedMessageChain.DecodeException(Component.translatable("multiplayer.disconnect.unsigned_chat"), true, org.bukkit.event.player.PlayerKickEvent.Cause.UNSIGNED_CHAT); // Paper - kick event causes } else { if (playerChatMessage.hasExpiredServer(Instant.now())) { - LOGGER.warn("Received expired chat: '{}'. Is the client/server system time unsynchronized?", (Object)body.content()); -@@ -68,10 +68,17 @@ public class SignedMessageChain { + LOGGER.warn("Received expired chat: '{}'. Is the client/server system time unsynchronized?", body.content()); +@@ -67,10 +67,17 @@ public class SignedMessageChain { public static class DecodeException extends ThrowingComponent { private final boolean shouldDisconnect; @@ -48,7 +48,7 @@ index 96814e626a95e4e3c2f4df1a0339d37bb02f2e61..ba12919c3f9aec34a9e64993b143ae92 public boolean shouldDisconnect() { diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 773e4850956a7ffcd78cc241a598fd13bcfe1d20..7ee46b9f98794d1fec0a8feea71fd495f9199dd0 100644 +index c9545f96317fd6692889d82851d76084efa6a61d..fdda28bd6aa3a2d3079a383157b82ff825cc992d 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -2167,7 +2167,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { - return Component.translatable("commands.kick.success", serverPlayer.getDisplayName(), reason); - }, true); + source.sendSuccess(() -> Component.translatable("commands.kick.success", serverPlayer.getDisplayName(), reason), true); + i++; + } diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java index 6bb846d3ee2fb54ab3ffa116607f2a83e538460e..a65a1466dab52fca75cda16a4b22fef03b6207a0 100644 --- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java @@ -461,7 +461,7 @@ index e913acef00c0a1a2f49779800b46997588b46253..dcb8de1c28b767068aa10f044bd8cf72 // CraftBukkit end diff --git a/src/main/java/net/minecraft/world/entity/player/ProfilePublicKey.java b/src/main/java/net/minecraft/world/entity/player/ProfilePublicKey.java -index 6724d0a1af13e97bc1d3bd94fd43fef742a0deab..20ba0a0c9eae28658888a77dd2170f629bbcb65b 100644 +index f472dea0bd4f834c0c8f0aa59ae7cdae082b14af..2fa51c3a70f43cd23b8f494fc643d66cecfda7d2 100644 --- a/src/main/java/net/minecraft/world/entity/player/ProfilePublicKey.java +++ b/src/main/java/net/minecraft/world/entity/player/ProfilePublicKey.java @@ -24,7 +24,7 @@ public record ProfilePublicKey(ProfilePublicKey.Data data) { @@ -473,7 +473,7 @@ index 6724d0a1af13e97bc1d3bd94fd43fef742a0deab..20ba0a0c9eae28658888a77dd2170f62 } else { return new ProfilePublicKey(publicKeyData); } -@@ -81,8 +81,16 @@ public record ProfilePublicKey(ProfilePublicKey.Data data) { +@@ -88,8 +88,16 @@ public record ProfilePublicKey(ProfilePublicKey.Data data) { } public static class ValidationException extends ThrowingComponent { diff --git a/patches/server/0572-Synchronize-PalettedContainer-instead-of-ThreadingDe.patch b/patches/server/0572-Synchronize-PalettedContainer-instead-of-ThreadingDe.patch index 12b8b851c3..2deed69271 100644 --- a/patches/server/0572-Synchronize-PalettedContainer-instead-of-ThreadingDe.patch +++ b/patches/server/0572-Synchronize-PalettedContainer-instead-of-ThreadingDe.patch @@ -14,10 +14,10 @@ contention situations. And this is extremely a low contention situation. diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java -index b8fb6d1d85e07f5165bfaf7d80807e069b595851..dd62e257e16974a6d556a7f5e2d113a2cbc08981 100644 +index 6b37d460a76156162743d77d192f34366b29e5f9..268752a0b939abcaa9c7a302d2642b0c0fa2d331 100644 --- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java +++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java -@@ -32,14 +32,14 @@ public class PalettedContainer implements PaletteResize, PalettedContainer +@@ -30,14 +30,14 @@ public class PalettedContainer implements PaletteResize, PalettedContainer public final IdMap registry; private volatile PalettedContainer.Data data; private final PalettedContainer.Strategy strategy; @@ -35,7 +35,7 @@ index b8fb6d1d85e07f5165bfaf7d80807e069b595851..dd62e257e16974a6d556a7f5e2d113a2 } public static Codec> codecRW(IdMap idList, Codec entryCodec, PalettedContainer.Strategy paletteProvider, T defaultValue) { -@@ -91,7 +91,7 @@ public class PalettedContainer implements PaletteResize, PalettedContainer +@@ -104,7 +104,7 @@ public class PalettedContainer implements PaletteResize, PalettedContainer } @Override @@ -44,7 +44,7 @@ index b8fb6d1d85e07f5165bfaf7d80807e069b595851..dd62e257e16974a6d556a7f5e2d113a2 PalettedContainer.Data data = this.data; PalettedContainer.Data data2 = this.createOrReuseData(data, newBits); data2.copyFrom(data.palette, data.storage); -@@ -116,7 +116,7 @@ public class PalettedContainer implements PaletteResize, PalettedContainer +@@ -129,7 +129,7 @@ public class PalettedContainer implements PaletteResize, PalettedContainer return this.getAndSet(this.strategy.getIndex(x, y, z), value); } @@ -53,8 +53,8 @@ index b8fb6d1d85e07f5165bfaf7d80807e069b595851..dd62e257e16974a6d556a7f5e2d113a2 int i = this.data.palette.idFor(value); int j = this.data.storage.getAndSet(index, i); return this.data.palette.valueFor(j); -@@ -133,7 +133,7 @@ public class PalettedContainer implements PaletteResize, PalettedContainer - +@@ -145,7 +145,7 @@ public class PalettedContainer implements PaletteResize, PalettedContainer + } } - private void set(int index, T value) { @@ -62,8 +62,8 @@ index b8fb6d1d85e07f5165bfaf7d80807e069b595851..dd62e257e16974a6d556a7f5e2d113a2 int i = this.data.palette.idFor(value); this.data.storage.set(index, i); } -@@ -158,7 +158,7 @@ public class PalettedContainer implements PaletteResize, PalettedContainer - }); +@@ -168,7 +168,7 @@ public class PalettedContainer implements PaletteResize, PalettedContainer + intSet.forEach(id -> action.accept(palette.valueFor(id))); } - public void read(FriendlyByteBuf buf) { @@ -71,7 +71,7 @@ index b8fb6d1d85e07f5165bfaf7d80807e069b595851..dd62e257e16974a6d556a7f5e2d113a2 this.acquire(); try { -@@ -174,7 +174,7 @@ public class PalettedContainer implements PaletteResize, PalettedContainer +@@ -183,7 +183,7 @@ public class PalettedContainer implements PaletteResize, PalettedContainer } @Override @@ -80,7 +80,7 @@ index b8fb6d1d85e07f5165bfaf7d80807e069b595851..dd62e257e16974a6d556a7f5e2d113a2 this.acquire(); try { -@@ -229,7 +229,7 @@ public class PalettedContainer implements PaletteResize, PalettedContainer +@@ -231,7 +231,7 @@ public class PalettedContainer implements PaletteResize, PalettedContainer } @Override diff --git a/patches/server/0575-Fix-invulnerable-end-crystals.patch b/patches/server/0575-Fix-invulnerable-end-crystals.patch index 75347e76f0..468e11151c 100644 --- a/patches/server/0575-Fix-invulnerable-end-crystals.patch +++ b/patches/server/0575-Fix-invulnerable-end-crystals.patch @@ -52,13 +52,13 @@ index e7e01effab5f727d9b84a0575d165127e3dfe4c9..036640d49a5e891e9a0f767abe33f1f5 } diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/SpikeFeature.java b/src/main/java/net/minecraft/world/level/levelgen/feature/SpikeFeature.java -index 4b685e185ebac8553f1f81d1a5a04be8166a6ca4..3b36caafde83c87c823277e2085ee82ae497b9be 100644 +index de93988e6116d63ae29add32ee02ccca631f1d9e..ad31fc599288e46a69814268cd10148a5edb375a 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/feature/SpikeFeature.java +++ b/src/main/java/net/minecraft/world/level/levelgen/feature/SpikeFeature.java -@@ -101,6 +101,7 @@ public class SpikeFeature extends Feature { +@@ -111,6 +111,7 @@ public class SpikeFeature extends Feature { endCrystal.setBeamTarget(config.getCrystalBeamTarget()); endCrystal.setInvulnerable(config.isCrystalInvulnerable()); - endCrystal.moveTo((double)spike.getCenterX() + 0.5D, (double)(spike.getHeight() + 1), (double)spike.getCenterZ() + 0.5D, random.nextFloat() * 360.0F, 0.0F); + endCrystal.moveTo(spike.getCenterX() + 0.5, spike.getHeight() + 1, spike.getCenterZ() + 0.5, random.nextFloat() * 360.0F, 0.0F); + endCrystal.generatedByDragonFight = true; // Paper - Fix invulnerable end crystals world.addFreshEntity(endCrystal); BlockPos blockPos2 = endCrystal.blockPosition(); diff --git a/patches/server/0577-Fix-dangerous-end-portal-logic.patch b/patches/server/0577-Fix-dangerous-end-portal-logic.patch index 1b1c9918ec..fc17215428 100644 --- a/patches/server/0577-Fix-dangerous-end-portal-logic.patch +++ b/patches/server/0577-Fix-dangerous-end-portal-logic.patch @@ -11,7 +11,7 @@ Move the tick logic into the post tick, where portaling was designed to happen in the first place. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 2d8c476eb9f329ee6827340b6cec26a84901c56a..e3647763bcede42f06250550985e149e39f2b0b8 100644 +index 5b0502cfcc3d9317941d7444750a49832e1a52a1..53e2ca6ddba4936a7387e07a2aae4c282a305222 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -421,6 +421,36 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0578-Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch b/patches/server/0578-Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch index 53a98e7fb8..efeca7582b 100644 --- a/patches/server/0578-Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch +++ b/patches/server/0578-Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch @@ -6,14 +6,13 @@ Subject: [PATCH] Optimize Biome Mob Lookups for Mob Spawning Uses an EnumMap as well as a Set paired List for O(1) contains calls. diff --git a/src/main/java/net/minecraft/world/level/biome/MobSpawnSettings.java b/src/main/java/net/minecraft/world/level/biome/MobSpawnSettings.java -index 4f4ef3349f512cc6e1588eb58de5b2558c0bd8b9..b10dfbaef9bde9d94c4971b47d77a1514e476f86 100644 +index c376a6cc04faf8d8545c99c0815682ea7cad98db..ffa24b71400f2041c9154817c6c767bc7dffb176 100644 --- a/src/main/java/net/minecraft/world/level/biome/MobSpawnSettings.java +++ b/src/main/java/net/minecraft/world/level/biome/MobSpawnSettings.java -@@ -61,11 +61,43 @@ public class MobSpawnSettings { +@@ -75,8 +75,40 @@ public class MobSpawnSettings { } public static class Builder { -- private final Map> spawners = Stream.of(MobCategory.values()).collect(ImmutableMap.toImmutableMap((mobCategory) -> { + // Paper start - Perf: keep track of data in a pair set to give O(1) contains calls - we have to hook removals incase plugins mess with it + public static class MobList extends java.util.ArrayList { + java.util.Set biomes = new java.util.HashSet<>(); @@ -45,12 +44,9 @@ index 4f4ef3349f512cc6e1588eb58de5b2558c0bd8b9..b10dfbaef9bde9d94c4971b47d77a151 + } + } + // use toImmutableEnumMap collector -+ private final Map> spawners = (Map) Stream.of(MobCategory.values()).collect(Maps.toImmutableEnumMap((mobCategory) -> { - return mobCategory; - }, (mobCategory) -> { -- return Lists.newArrayList(); -+ return new MobList(); // Use MobList instead of ArrayList - })); + private final Map> spawners = Stream.of(MobCategory.values()) +- .collect(ImmutableMap.toImmutableMap(mobCategory -> (MobCategory)mobCategory, mobCategory -> Lists.newArrayList())); ++ .collect(Maps.toImmutableEnumMap(mobCategory -> (MobCategory)mobCategory, mobCategory -> new MobList())); // Use MobList instead of ArrayList + // Paper end - Perf: keep track of data in a pair set to give O(1) contains calls private final Map, MobSpawnSettings.MobSpawnCost> mobSpawnCosts = Maps.newLinkedHashMap(); private float creatureGenerationProbability = 0.1F; diff --git a/patches/server/0580-Line-Of-Sight-Changes.patch b/patches/server/0580-Line-Of-Sight-Changes.patch index bb2535a35e..0e0c8ce179 100644 --- a/patches/server/0580-Line-Of-Sight-Changes.patch +++ b/patches/server/0580-Line-Of-Sight-Changes.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Line Of Sight Changes diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 7f2111586f5a4df8824be575d6215a564f1e294a..1da8e62b57d3b971aab00fd3b2b50f1ae4a8d162 100644 +index 687f379a811ba46cb3cddda33a62039b3b329cb3..60c9bae18f277a90b464a6f1f55d074ed9046aff 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3627,7 +3627,8 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -45,7 +45,7 @@ index b9262b681b51cb68024156b28d33624fddd17b26..af14244caba22e750ee7baba03bb7ce2 // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 5b9bb113db1202025c7ebb79f48b434ed8d9e3eb..aaacc38b0b2dd435ef5cb6a934cfcd6659c4ca15 100644 +index 646763f591e67e27c992663379fa3d4b322a3de3..e4a6cb02afdc6c0654ede24265d79092c998f828 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -628,6 +628,23 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { diff --git a/patches/server/0584-Fix-PlayerDropItemEvent-using-wrong-item.patch b/patches/server/0584-Fix-PlayerDropItemEvent-using-wrong-item.patch index e0ef67f1e5..4f374c8de3 100644 --- a/patches/server/0584-Fix-PlayerDropItemEvent-using-wrong-item.patch +++ b/patches/server/0584-Fix-PlayerDropItemEvent-using-wrong-item.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix PlayerDropItemEvent using wrong item diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index a09ef51e94a0bf9f51bf358e7cf77dd5d272aab2..d0369b9db86dc3436e6a016f138f2ffe91da6ed4 100644 +index 28baa63b9b750a7f03da364d9c1fe691d3ce1706..c917b271fb6325840bb791566e9dec607bdd819a 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -2342,7 +2342,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0585-Missing-Entity-API.patch b/patches/server/0585-Missing-Entity-API.patch index 2d5619dd11..15b6b347f6 100644 --- a/patches/server/0585-Missing-Entity-API.patch +++ b/patches/server/0585-Missing-Entity-API.patch @@ -113,7 +113,7 @@ index 0000000000000000000000000000000000000000..41bf71d116ffc5431586ce54abba7f8d + } +} diff --git a/src/main/java/net/minecraft/world/entity/animal/AbstractSchoolingFish.java b/src/main/java/net/minecraft/world/entity/animal/AbstractSchoolingFish.java -index 39ed3ca76d6b64ef3917280ec822721cc02afada..86b437836cb4b1f6e8ca9acd5f1f93b925cf9e51 100644 +index eef7d260dcb9a9c8ea6efef3216d33c08e3ea287..79c79f825e4c9b748d54962d06356ef425359101 100644 --- a/src/main/java/net/minecraft/world/entity/animal/AbstractSchoolingFish.java +++ b/src/main/java/net/minecraft/world/entity/animal/AbstractSchoolingFish.java @@ -52,6 +52,7 @@ public abstract class AbstractSchoolingFish extends AbstractFish { @@ -796,7 +796,7 @@ index 2cec61a1bb050c1ef81c5fc3d0afafe9ff29d459..97fa4e1e70203194bd939618b2fad926 + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 0a039d3ce686b7e47361c60f141943b621898707..e2a566c4f9402fe035c3363faff84e49956a536b 100644 +index e4a6cb02afdc6c0654ede24265d79092c998f828..a3b9b512c4962c5d38598a504e8f0010304abdc0 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -921,14 +921,29 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { diff --git a/patches/server/0588-Use-getChunkIfLoadedImmediately-in-places.patch b/patches/server/0588-Use-getChunkIfLoadedImmediately-in-places.patch index b45da09501..1778a6a85c 100644 --- a/patches/server/0588-Use-getChunkIfLoadedImmediately-in-places.patch +++ b/patches/server/0588-Use-getChunkIfLoadedImmediately-in-places.patch @@ -21,7 +21,7 @@ index 9e4453878246a22e320a6f8eb7aa08cb17438faf..60590ee30d2ff3b94c796bae2d7e9d9b @Override diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 1bb7cc9462cab7fbd09b944662711ae5bc5cf950..48e60e5ce01942fa5d30e043012e888989046cee 100644 +index 40f1b4ba266f96629b989590c7c81cd7534e93da..a1dbd23a5d8ea064f1b7909f3e285a4dadf34d88 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -182,6 +182,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable { diff --git a/patches/server/0591-Fix-kick-event-leave-message-not-being-sent.patch b/patches/server/0591-Fix-kick-event-leave-message-not-being-sent.patch index cbe89274cd..c3d3547870 100644 --- a/patches/server/0591-Fix-kick-event-leave-message-not-being-sent.patch +++ b/patches/server/0591-Fix-kick-event-leave-message-not-being-sent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix kick event leave message not being sent diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index d0369b9db86dc3436e6a016f138f2ffe91da6ed4..7fab0411fb7d322bf5f201e44b747d8a00638d5d 100644 +index c917b271fb6325840bb791566e9dec607bdd819a..5f69e743e2422bbcfd4678b550940960374ecabd 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -268,7 +268,6 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0592-Add-config-for-mobs-immune-to-default-effects.patch b/patches/server/0592-Add-config-for-mobs-immune-to-default-effects.patch index 756da20f44..10ce8bf043 100644 --- a/patches/server/0592-Add-config-for-mobs-immune-to-default-effects.patch +++ b/patches/server/0592-Add-config-for-mobs-immune-to-default-effects.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add config for mobs immune to default effects diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index f7244a0cbb06258d6e553ad35e1040e338cce4eb..a2edccc840f2ba76e236ea7441f3e4909b1a1898 100644 +index 60c9bae18f277a90b464a6f1f55d074ed9046aff..f01ace6a6e517ff3d3cd66e69e2594ae3d702072 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -1172,7 +1172,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0593-Don-t-apply-cramming-damage-to-players.patch b/patches/server/0593-Don-t-apply-cramming-damage-to-players.patch index 0882572dff..b0d6a1ad5d 100644 --- a/patches/server/0593-Don-t-apply-cramming-damage-to-players.patch +++ b/patches/server/0593-Don-t-apply-cramming-damage-to-players.patch @@ -11,7 +11,7 @@ It does not make a lot of sense to damage players if they get crammed, For those who really want it a config option is provided. diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 7fab0411fb7d322bf5f201e44b747d8a00638d5d..751216261df86402c23d3f0d73944ae51e849caa 100644 +index 5f69e743e2422bbcfd4678b550940960374ecabd..bb0a5e3cdfec18a71c30fde98d21affcd95a9885 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -95,6 +95,7 @@ import net.minecraft.util.Mth; diff --git a/patches/server/0594-Rate-options-and-timings-for-sensors-and-behaviors.patch b/patches/server/0594-Rate-options-and-timings-for-sensors-and-behaviors.patch index b90b81a68f..2862657b68 100644 --- a/patches/server/0594-Rate-options-and-timings-for-sensors-and-behaviors.patch +++ b/patches/server/0594-Rate-options-and-timings-for-sensors-and-behaviors.patch @@ -28,10 +28,10 @@ index 4bd813161a5d76a83cdbd0a9209b9ea9e60ffe1b..e2764186bd6b838ed5cd86c15597a08d * Get a named timer for the specified tile entity type to track type specific timings. * @param entity diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java b/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java -index 4ea437253539e3ee533ca9da77a337cbf4d1e807..1e71cde7cb7654f1c21ae5e27e2fad7b58f593eb 100644 +index db231b1353a1d5ca4fb217f5ebf8d7584706478d..0a2e894d8bd1268fcbd4460745304816be46beff 100644 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java -@@ -13,6 +13,10 @@ public abstract class Behavior implements BehaviorContro +@@ -14,6 +14,10 @@ public abstract class Behavior implements BehaviorContro private long endTimestamp; private final int minDuration; private final int maxDuration; @@ -42,7 +42,7 @@ index 4ea437253539e3ee533ca9da77a337cbf4d1e807..1e71cde7cb7654f1c21ae5e27e2fad7b public Behavior(Map, MemoryStatus> requiredMemoryState) { this(requiredMemoryState, 60); -@@ -26,6 +30,15 @@ public abstract class Behavior implements BehaviorContro +@@ -27,6 +31,15 @@ public abstract class Behavior implements BehaviorContro this.minDuration = minRunTime; this.maxDuration = maxRunTime; this.entryCondition = requiredMemoryState; @@ -58,7 +58,7 @@ index 4ea437253539e3ee533ca9da77a337cbf4d1e807..1e71cde7cb7654f1c21ae5e27e2fad7b } @Override -@@ -35,11 +48,19 @@ public abstract class Behavior implements BehaviorContro +@@ -36,11 +49,19 @@ public abstract class Behavior implements BehaviorContro @Override public final boolean tryStart(ServerLevel world, E entity, long time) { @@ -71,14 +71,14 @@ index 4ea437253539e3ee533ca9da77a337cbf4d1e807..1e71cde7cb7654f1c21ae5e27e2fad7b if (this.hasRequiredMemories(entity) && this.checkExtraStartConditions(world, entity)) { this.status = Behavior.Status.RUNNING; int i = this.minDuration + world.getRandom().nextInt(this.maxDuration + 1 - this.minDuration); - this.endTimestamp = time + (long)i; + this.endTimestamp = time + i; + this.timing.startTiming(); // Paper - behavior timings this.start(world, entity, time); + this.timing.stopTiming(); // Paper - behavior timings return true; } else { return false; -@@ -51,11 +72,13 @@ public abstract class Behavior implements BehaviorContro +@@ -52,11 +73,13 @@ public abstract class Behavior implements BehaviorContro @Override public final void tickOrStop(ServerLevel world, E entity, long time) { @@ -89,15 +89,15 @@ index 4ea437253539e3ee533ca9da77a337cbf4d1e807..1e71cde7cb7654f1c21ae5e27e2fad7b this.doStop(world, entity, time); } + this.timing.stopTiming(); // Paper - behavior timings - } + protected void tick(ServerLevel world, E entity, long time) { diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java -index 7970eebbd6935402223e6bba962bb8ba7d861dfd..fcdb9bde8e1605e30dde3e580491522d4b62cdc0 100644 +index eebe5d721a6cea42013f5293586865deb39fe9d2..de2dfaf3cb41bafd48fa4699096a0a7304cd3201 100644 --- a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java +++ b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java -@@ -19,8 +19,21 @@ public abstract class Sensor { - private static final TargetingConditions ATTACK_TARGET_CONDITIONS_IGNORE_INVISIBILITY_AND_LINE_OF_SIGHT = TargetingConditions.forCombat().range(16.0D).ignoreLineOfSight().ignoreInvisibilityTesting(); +@@ -26,8 +26,21 @@ public abstract class Sensor { + .ignoreInvisibilityTesting(); private final int scanRate; private long timeToTick; + // Paper start - configurable sensor tick rate and timings @@ -116,13 +116,13 @@ index 7970eebbd6935402223e6bba962bb8ba7d861dfd..fcdb9bde8e1605e30dde3e580491522d + this.timing = co.aikar.timings.MinecraftTimings.getSensorTimings(configKey, senseInterval); + // Paper end this.scanRate = senseInterval; - this.timeToTick = (long)RANDOM.nextInt(senseInterval); + this.timeToTick = RANDOM.nextInt(senseInterval); } -@@ -31,8 +44,12 @@ public abstract class Sensor { +@@ -38,8 +51,12 @@ public abstract class Sensor { public final void tick(ServerLevel world, E entity) { if (--this.timeToTick <= 0L) { -- this.timeToTick = (long)this.scanRate; +- this.timeToTick = this.scanRate; + // Paper start - configurable sensor tick rate and timings + this.timeToTick = java.util.Objects.requireNonNullElse(world.paperConfig().tickRates.sensor.get(entity.getType(), this.configKey), this.scanRate); + this.timing.startTiming(); @@ -130,5 +130,5 @@ index 7970eebbd6935402223e6bba962bb8ba7d861dfd..fcdb9bde8e1605e30dde3e580491522d this.doTick(world, entity); + this.timing.stopTiming(); // Paper - sensor timings } - } + diff --git a/patches/server/0595-Add-missing-forceDrop-toggles.patch b/patches/server/0595-Add-missing-forceDrop-toggles.patch index 273710ee36..7e8de16312 100644 --- a/patches/server/0595-Add-missing-forceDrop-toggles.patch +++ b/patches/server/0595-Add-missing-forceDrop-toggles.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add missing forceDrop toggles diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java b/src/main/java/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java -index 012586360a48369dad243dbb8892579a1dbcca90..edeb1899996e53d276d7481e8eddee65249a07d3 100644 +index b9c2b41d9c46c871bab44cfb1d454f4141f1627b..d975b349aa81327c6b6c23e83e9552159217f11e 100644 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java -@@ -87,7 +87,9 @@ public class WorkAtComposter extends WorkAtPoi { +@@ -86,7 +86,9 @@ public class WorkAtComposter extends WorkAtPoi { simpleContainer.removeItemType(Items.WHEAT, m); ItemStack itemStack = simpleContainer.addItem(new ItemStack(Items.BREAD, l)); if (!itemStack.isEmpty()) { @@ -16,8 +16,8 @@ index 012586360a48369dad243dbb8892579a1dbcca90..edeb1899996e53d276d7481e8eddee65 entity.spawnAtLocation(itemStack, 0.5F); + entity.forceDrops = false; // Paper - Add missing forceDrop toggles } - } + } diff --git a/src/main/java/net/minecraft/world/entity/animal/Panda.java b/src/main/java/net/minecraft/world/entity/animal/Panda.java index 4224e8e75613b6ec0228b2757cb98140d83bc2e2..4abd26c7baf8f198f13dd41a3146f9ece13a4164 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Panda.java diff --git a/patches/server/0596-Stinger-API.patch b/patches/server/0596-Stinger-API.patch index eadae86e37..7a81c96422 100644 --- a/patches/server/0596-Stinger-API.patch +++ b/patches/server/0596-Stinger-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Stinger API diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 9c69fe09b2cf1172fe0e16f6799cc67bc0ccd397..bc7e2d24dac52091a62ce488c7fc34133dfa2aa8 100644 +index a3b9b512c4962c5d38598a504e8f0010304abdc0..4461663659f351f844ed78adc8c1ffd0531a7878 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -354,6 +354,11 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { diff --git a/patches/server/0602-Add-PlayerSetSpawnEvent.patch b/patches/server/0602-Add-PlayerSetSpawnEvent.patch index aae9495179..59121d7ad0 100644 --- a/patches/server/0602-Add-PlayerSetSpawnEvent.patch +++ b/patches/server/0602-Add-PlayerSetSpawnEvent.patch @@ -49,7 +49,7 @@ index a2d0699e8427b2262a2396495111125eccafbb66..15db9368227dbc29d07d74e85bd126b3 } } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 751216261df86402c23d3f0d73944ae51e849caa..fb86824192f1fc850a55905757c65cafec1edb6a 100644 +index bb0a5e3cdfec18a71c30fde98d21affcd95a9885..3f4950e0c0525346a89c7402ea85edebc6b36698 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1307,7 +1307,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0604-Optimize-entity-tracker-passenger-checks.patch b/patches/server/0604-Optimize-entity-tracker-passenger-checks.patch index 0908da4471..e1857c2d2c 100644 --- a/patches/server/0604-Optimize-entity-tracker-passenger-checks.patch +++ b/patches/server/0604-Optimize-entity-tracker-passenger-checks.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Optimize entity tracker passenger checks diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java -index fb16216b54eea81fceaf3edafa69b554ad01c807..c21cea7975844e0a04daeb1fcffc26d55fc62025 100644 +index e324c41947b823bba04e3da157e5be7a74d9f099..36e87e8650bef90fab47c4156ce12315f45b2241 100644 --- a/src/main/java/net/minecraft/server/level/ServerEntity.java +++ b/src/main/java/net/minecraft/server/level/ServerEntity.java @@ -79,7 +79,7 @@ public class ServerEntity { diff --git a/patches/server/0607-Optimize-indirect-passenger-iteration.patch b/patches/server/0607-Optimize-indirect-passenger-iteration.patch index cdd80aa9b6..ba1f9b4848 100644 --- a/patches/server/0607-Optimize-indirect-passenger-iteration.patch +++ b/patches/server/0607-Optimize-indirect-passenger-iteration.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Optimize indirect passenger iteration diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index e3647763bcede42f06250550985e149e39f2b0b8..f93e74226e3306a59e17dce1e4f8e72d61d75d49 100644 +index 53e2ca6ddba4936a7387e07a2aae4c282a305222..04f901236a5b9ca59ba45a5bac69ba89fc767679 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -3842,20 +3842,34 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0608-Configurable-item-frame-map-cursor-update-interval.patch b/patches/server/0608-Configurable-item-frame-map-cursor-update-interval.patch index 382372348e..18c1f05373 100644 --- a/patches/server/0608-Configurable-item-frame-map-cursor-update-interval.patch +++ b/patches/server/0608-Configurable-item-frame-map-cursor-update-interval.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Configurable item frame map cursor update interval diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java -index c21cea7975844e0a04daeb1fcffc26d55fc62025..a83b4d9b61230ecf5f776269cab228cf49c5f546 100644 +index 36e87e8650bef90fab47c4156ce12315f45b2241..91563f903834c1a0636dc087f8c6376815165b6c 100644 --- a/src/main/java/net/minecraft/server/level/ServerEntity.java +++ b/src/main/java/net/minecraft/server/level/ServerEntity.java @@ -117,7 +117,7 @@ public class ServerEntity { diff --git a/patches/server/0611-Add-BlockBreakBlockEvent.patch b/patches/server/0611-Add-BlockBreakBlockEvent.patch index d621301d17..1d42076156 100644 --- a/patches/server/0611-Add-BlockBreakBlockEvent.patch +++ b/patches/server/0611-Add-BlockBreakBlockEvent.patch @@ -68,10 +68,10 @@ index 0aeb9faa1ce22359361741a591aa3d465d955970..a98ab20814cc29a25e9d29adfbb7e70d private static short getCacheKey(BlockPos from, BlockPos to) { diff --git a/src/main/java/net/minecraft/world/level/material/WaterFluid.java b/src/main/java/net/minecraft/world/level/material/WaterFluid.java -index 1897c0012800d5ba9d2fc386f3e2bf57c9d878bb..c5f9eda32f2cd172569c7b7d72f5dd3e41a34a70 100644 +index 855014986c201fdb5dffebf362951cd1edebd95d..001adec26a71a0f5e1dd77bf51a62bb25172d702 100644 --- a/src/main/java/net/minecraft/world/level/material/WaterFluid.java +++ b/src/main/java/net/minecraft/world/level/material/WaterFluid.java -@@ -64,6 +64,13 @@ public abstract class WaterFluid extends FlowingFluid { +@@ -74,6 +74,13 @@ public abstract class WaterFluid extends FlowingFluid { return world.getGameRules().getBoolean(GameRules.RULE_WATER_SOURCE_CONVERSION); } diff --git a/patches/server/0615-Add-back-EntityPortalExitEvent.patch b/patches/server/0615-Add-back-EntityPortalExitEvent.patch index 566d9576da..0f1992b626 100644 --- a/patches/server/0615-Add-back-EntityPortalExitEvent.patch +++ b/patches/server/0615-Add-back-EntityPortalExitEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add back EntityPortalExitEvent diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index f93e74226e3306a59e17dce1e4f8e72d61d75d49..7dbbf0884b70acb37c3400364736fa8f6b68c964 100644 +index 04f901236a5b9ca59ba45a5bac69ba89fc767679..11985b5c0e48178a7f995dfc35dd27a172261f1c 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -3291,6 +3291,28 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0619-Add-more-advancement-API.patch b/patches/server/0619-Add-more-advancement-API.patch index 98836b6fe4..c86f1459b7 100644 --- a/patches/server/0619-Add-more-advancement-API.patch +++ b/patches/server/0619-Add-more-advancement-API.patch @@ -84,17 +84,17 @@ index 0000000000000000000000000000000000000000..adac21ce6db3ff7a56dbcd6bffc02143 + } +} diff --git a/src/main/java/net/minecraft/advancements/DisplayInfo.java b/src/main/java/net/minecraft/advancements/DisplayInfo.java -index d357deb8a9e1d4043f5fb3302b957b20ffc0cc32..54298a80bd86ae8c2bdbfc69d381173aea2f1410 100644 +index 3751b43469e92b8a3d70ec3d5413bc1571147e6e..8057d42f2484bca8e5555e3010c27b898c4245b5 100644 --- a/src/main/java/net/minecraft/advancements/DisplayInfo.java +++ b/src/main/java/net/minecraft/advancements/DisplayInfo.java -@@ -24,6 +24,7 @@ public class DisplayInfo { +@@ -34,6 +34,7 @@ public class DisplayInfo { private final boolean hidden; private float x; private float y; + public final io.papermc.paper.advancement.AdvancementDisplay paper = new io.papermc.paper.advancement.PaperAdvancementDisplay(this); // Paper - Add more advancement API - public DisplayInfo(ItemStack icon, Component title, Component description, Optional background, AdvancementType frame, boolean showToast, boolean announceToChat, boolean hidden) { - this.title = title; + public DisplayInfo( + ItemStack icon, diff --git a/src/main/java/org/bukkit/craftbukkit/advancement/CraftAdvancement.java b/src/main/java/org/bukkit/craftbukkit/advancement/CraftAdvancement.java index 52baf818579a6841b77ff80e42f4f1b9f635ea08..8dfaca2efa0b0bdc97b75aaa83158a2e46361e4e 100644 --- a/src/main/java/org/bukkit/craftbukkit/advancement/CraftAdvancement.java diff --git a/patches/server/0622-Fix-issues-with-mob-conversion.patch b/patches/server/0622-Fix-issues-with-mob-conversion.patch index 657dd4ec5d..af0f87afee 100644 --- a/patches/server/0622-Fix-issues-with-mob-conversion.patch +++ b/patches/server/0622-Fix-issues-with-mob-conversion.patch @@ -26,10 +26,10 @@ index e88af2dcc0f7fc5190654e2640f67d706e6c8c81..92974452d8f63fde8524cfac305ee2ef } diff --git a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java -index 7bcd5498c734873b74bee503992ec4806ae61df7..01a2016ac82807d28ffe407b7dbb74bdbcde503e 100644 +index 2025599c337759d8856e15b606cde604d6c64a88..050ffa4a23feba29fdf4c6a175cdff4e5009027d 100644 --- a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java +++ b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java -@@ -241,6 +241,11 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { +@@ -271,6 +271,11 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { if (zoglin != null) { zoglin.addEffect(new MobEffectInstance(MobEffects.CONFUSION, 200, 0)); } @@ -38,9 +38,9 @@ index 7bcd5498c734873b74bee503992ec4806ae61df7..01a2016ac82807d28ffe407b7dbb74bd + this.timeInOverworld = 0; + } + // Paper end - Fix issues with mob conversion - } + @Override diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java b/src/main/java/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java index 22c8d6233be5e4f7fb4f03176e83dbee02256b1f..c575a86ca5c1bbdd6d2faf6e4a609af8ba03cab6 100644 --- a/src/main/java/net/minecraft/world/entity/monster/piglin/AbstractPiglin.java diff --git a/patches/server/0626-Add-Raw-Byte-Entity-Serialization.patch b/patches/server/0626-Add-Raw-Byte-Entity-Serialization.patch index 55d631cdee..2418a2e08d 100644 --- a/patches/server/0626-Add-Raw-Byte-Entity-Serialization.patch +++ b/patches/server/0626-Add-Raw-Byte-Entity-Serialization.patch @@ -7,7 +7,7 @@ Subject: [PATCH] Add Raw Byte Entity Serialization public net.minecraft.world.entity.Entity setLevel(Lnet/minecraft/world/level/Level;)V diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 7dbbf0884b70acb37c3400364736fa8f6b68c964..5dce3d38ecd7b7639f02f3e1e92f3723f4a42c39 100644 +index 11985b5c0e48178a7f995dfc35dd27a172261f1c..b9f61d08adf83bbaed522c2258db116492cb24c5 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -2078,6 +2078,15 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0628-Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch b/patches/server/0628-Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch index e55fef3b36..abcdf89c61 100644 --- a/patches/server/0628-Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch +++ b/patches/server/0628-Do-not-run-close-logic-for-inventories-on-chunk-unlo.patch @@ -28,7 +28,7 @@ index 14b3edc05a04f5049f994df5be68e4f01e8cf1ef..10eb5c342930d2efd7d919f286fe8fa6 } // Spigot End diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index fb86824192f1fc850a55905757c65cafec1edb6a..48edd0bf7a6f24aaf582a96ee7cb4c29c9e3598a 100644 +index 3f4950e0c0525346a89c7402ea85edebc6b36698..5f43cd7f6cc1e14771c3df6ec1f074e670ec6206 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1581,6 +1581,18 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0630-Improve-and-expand-AsyncCatcher.patch b/patches/server/0630-Improve-and-expand-AsyncCatcher.patch index e296e8ff56..b87817eeb4 100644 --- a/patches/server/0630-Improve-and-expand-AsyncCatcher.patch +++ b/patches/server/0630-Improve-and-expand-AsyncCatcher.patch @@ -29,7 +29,7 @@ index 2941445ea453e2fb88ea8de38c24bf755b93936a..666c6cb6f600973e1d84839aed715606 if (player.isRemoved()) { LOGGER.info("Attempt to teleport removed player {} restricted", player.getScoreboardName()); diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 144090912223494cf163a445d7bce868be12d6af..4d8f9c8f375282968e70278da655b6e36ab96a87 100644 +index f01ace6a6e517ff3d3cd66e69e2594ae3d702072..31eb77e4e5f07b120708edeca497ef2eef1fcf13 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -1126,7 +1126,7 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -202,7 +202,7 @@ index 6d74a3a43aee0f7ba4c109bd2443c5fcd950fa54..0b1d918452deee4c75bc61cb6a620f69 ClientboundSoundEntityPacket packet = new ClientboundSoundEntityPacket(Holder.direct(SoundEvent.createVariableRangeEvent(new ResourceLocation(sound))), net.minecraft.sounds.SoundSource.valueOf(category.name()), craftEntity.getHandle(), volume, pitch, seed); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index bc7e2d24dac52091a62ce488c7fc34133dfa2aa8..6af7796c9505b43b2c4dfe869214b0f56dc71244 100644 +index 4461663659f351f844ed78adc8c1ffd0531a7878..5a760234a4604cec289705f1439f03c821bb0aab 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -517,6 +517,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { diff --git a/patches/server/0632-Sanitize-ResourceLocation-error-logging.patch b/patches/server/0632-Sanitize-ResourceLocation-error-logging.patch index 1359f8648a..3c467a8134 100644 --- a/patches/server/0632-Sanitize-ResourceLocation-error-logging.patch +++ b/patches/server/0632-Sanitize-ResourceLocation-error-logging.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Sanitize ResourceLocation error logging diff --git a/src/main/java/net/minecraft/resources/ResourceLocation.java b/src/main/java/net/minecraft/resources/ResourceLocation.java -index d3300e43523429fdd0e61c5aa9aed2e6bc78e07e..5f9dcab27a07969c93555ad0892683c62cbebc8c 100644 +index aed74e471126a8a66046a181973158d7d288d3f0..3908f88959e43d2f485d5f239257e6564dbda6cd 100644 --- a/src/main/java/net/minecraft/resources/ResourceLocation.java +++ b/src/main/java/net/minecraft/resources/ResourceLocation.java -@@ -211,7 +211,7 @@ public class ResourceLocation implements Comparable { +@@ -207,7 +207,7 @@ public class ResourceLocation implements Comparable { private static String assertValidNamespace(String namespace, String path) { if (!isValidNamespace(namespace)) { @@ -17,7 +17,7 @@ index d3300e43523429fdd0e61c5aa9aed2e6bc78e07e..5f9dcab27a07969c93555ad0892683c6 } else { return namespace; } -@@ -232,7 +232,7 @@ public class ResourceLocation implements Comparable { +@@ -233,7 +233,7 @@ public class ResourceLocation implements Comparable { private static String assertValidPath(String namespace, String path) { if (!isValidPath(path)) { diff --git a/patches/server/0633-Manually-inline-methods-in-BlockPosition.patch b/patches/server/0633-Manually-inline-methods-in-BlockPosition.patch index e97ce21f71..870042962d 100644 --- a/patches/server/0633-Manually-inline-methods-in-BlockPosition.patch +++ b/patches/server/0633-Manually-inline-methods-in-BlockPosition.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Manually inline methods in BlockPosition diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java -index 3b3d81886d50ee6510ff366e11817a578c645089..541cef99113af865b995af2cfb7a1e4724dd8878 100644 +index 4bc994bacdf1fbb7689d799d21a50b7903bf9e59..d80e3f5f53b9d28dea574cff5c65dfa3f8148f88 100644 --- a/src/main/java/net/minecraft/core/BlockPos.java +++ b/src/main/java/net/minecraft/core/BlockPos.java -@@ -516,9 +516,9 @@ public class BlockPos extends Vec3i { +@@ -536,9 +536,9 @@ public class BlockPos extends Vec3i { } public BlockPos.MutableBlockPos set(int x, int y, int z) { @@ -21,7 +21,7 @@ index 3b3d81886d50ee6510ff366e11817a578c645089..541cef99113af865b995af2cfb7a1e47 return this; } -@@ -581,19 +581,19 @@ public class BlockPos extends Vec3i { +@@ -603,19 +603,19 @@ public class BlockPos extends Vec3i { @Override public BlockPos.MutableBlockPos setX(int i) { @@ -45,12 +45,12 @@ index 3b3d81886d50ee6510ff366e11817a578c645089..541cef99113af865b995af2cfb7a1e47 } diff --git a/src/main/java/net/minecraft/core/Vec3i.java b/src/main/java/net/minecraft/core/Vec3i.java -index 5256ff18d992250e04a6180e196c2d5d3f0928ca..369b54b96c682717ef93d05312714b4d30efaceb 100644 +index afb1e5ff7b1b6b42f81eaa7888a1ec3ded804ccb..21387401c7958414fa6f3fd530488481d92a6eca 100644 --- a/src/main/java/net/minecraft/core/Vec3i.java +++ b/src/main/java/net/minecraft/core/Vec3i.java -@@ -19,9 +19,9 @@ public class Vec3i implements Comparable { - return IntStream.of(vec.getX(), vec.getY(), vec.getZ()); - }); +@@ -17,9 +17,9 @@ public class Vec3i implements Comparable { + vec -> IntStream.of(vec.getX(), vec.getY(), vec.getZ()) + ); public static final Vec3i ZERO = new Vec3i(0, 0, 0); - private int x; - private int y; @@ -60,4 +60,4 @@ index 5256ff18d992250e04a6180e196c2d5d3f0928ca..369b54b96c682717ef93d05312714b4d + protected int z; // Paper - Perf: Manually inline methods in BlockPosition; protected public static Codec offsetCodec(int maxAbsValue) { - return ExtraCodecs.validate(CODEC, (vec) -> { + return ExtraCodecs.validate( diff --git a/patches/server/0635-Make-sure-inlined-getChunkAt-has-inlined-logic-for-l.patch b/patches/server/0635-Make-sure-inlined-getChunkAt-has-inlined-logic-for-l.patch index 3834fdb183..aea03ebfb8 100644 --- a/patches/server/0635-Make-sure-inlined-getChunkAt-has-inlined-logic-for-l.patch +++ b/patches/server/0635-Make-sure-inlined-getChunkAt-has-inlined-logic-for-l.patch @@ -10,7 +10,7 @@ chunks did get inlined, but the standard CPS.getChunkAt method was not inlined. diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 48e60e5ce01942fa5d30e043012e888989046cee..275c02d480cdf25ba0e735f4a43015ec0af238b3 100644 +index a1dbd23a5d8ea064f1b7909f3e285a4dadf34d88..1ed82afbc3aaa826f8067c65fdfc3ffce36a2ce5 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -358,6 +358,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable { diff --git a/patches/server/0647-Ensure-valid-vehicle-status.patch b/patches/server/0647-Ensure-valid-vehicle-status.patch index 24e12fde1c..35c8b1e952 100644 --- a/patches/server/0647-Ensure-valid-vehicle-status.patch +++ b/patches/server/0647-Ensure-valid-vehicle-status.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Ensure valid vehicle status diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 48edd0bf7a6f24aaf582a96ee7cb4c29c9e3598a..be8c6c48287b73693ead9ae22071f2b4af7eed32 100644 +index 5f43cd7f6cc1e14771c3df6ec1f074e670ec6206..b5a3587a9074a1a2fcc2252d2db8b184b6ab6793 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -527,7 +527,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0649-Fix-CocaoDecorator-causing-a-crash-when-trying-to-ge.patch b/patches/server/0649-Fix-CocaoDecorator-causing-a-crash-when-trying-to-ge.patch index b766f53247..db1f49cd0a 100644 --- a/patches/server/0649-Fix-CocaoDecorator-causing-a-crash-when-trying-to-ge.patch +++ b/patches/server/0649-Fix-CocaoDecorator-causing-a-crash-when-trying-to-ge.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Fix CocaoDecorator causing a crash when trying to generate diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/treedecorators/CocoaDecorator.java b/src/main/java/net/minecraft/world/level/levelgen/feature/treedecorators/CocoaDecorator.java -index 42b4b306ee89a9e422d234bdaa9b43b118f8bd0a..f0085174a8f6e05f30c583b1211a7be43128e540 100644 +index 05a874404daec8d7194e0d5bc8d17f76d3cc94ef..961a772eecb759c8c2a2e1461988fdb3f06dd1b0 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/feature/treedecorators/CocoaDecorator.java +++ b/src/main/java/net/minecraft/world/level/levelgen/feature/treedecorators/CocoaDecorator.java -@@ -25,6 +25,7 @@ public class CocoaDecorator extends TreeDecorator { +@@ -26,6 +26,7 @@ public class CocoaDecorator extends TreeDecorator { @Override public void place(TreeDecorator.Context generator) { diff --git a/patches/server/0653-Update-head-rotation-in-missing-places.patch b/patches/server/0653-Update-head-rotation-in-missing-places.patch index 5fdcb1a6cb..abf2879a6e 100644 --- a/patches/server/0653-Update-head-rotation-in-missing-places.patch +++ b/patches/server/0653-Update-head-rotation-in-missing-places.patch @@ -8,7 +8,7 @@ This is because bukkit uses a separate head rotation field for yaw. This issue only applies to players. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 5dce3d38ecd7b7639f02f3e1e92f3723f4a42c39..ec23aa4f86fed6890273d06b8cfb4000daf3c515 100644 +index b9f61d08adf83bbaed522c2258db116492cb24c5..685cd5c719a0bf8d3e41aa95b0e84effe1241948 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -1790,6 +1790,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0654-prevent-unintended-light-block-manipulation.patch b/patches/server/0654-prevent-unintended-light-block-manipulation.patch index 90c181a20a..9371202698 100644 --- a/patches/server/0654-prevent-unintended-light-block-manipulation.patch +++ b/patches/server/0654-prevent-unintended-light-block-manipulation.patch @@ -5,10 +5,10 @@ Subject: [PATCH] prevent unintended light block manipulation diff --git a/src/main/java/net/minecraft/world/level/block/LightBlock.java b/src/main/java/net/minecraft/world/level/block/LightBlock.java -index a0fadee4be7c263ceaf1f4a987169b0f50308072..a847b79da488c9d6059c9da941a50de8b1bfc24f 100644 +index 0fe3186b4edbbc93f5794d23dffe58c063be8d67..95d36c3a74d0b71662864f27c54cf52ba41d384c 100644 --- a/src/main/java/net/minecraft/world/level/block/LightBlock.java +++ b/src/main/java/net/minecraft/world/level/block/LightBlock.java -@@ -54,6 +54,7 @@ public class LightBlock extends Block implements SimpleWaterloggedBlock { +@@ -52,6 +52,7 @@ public class LightBlock extends Block implements SimpleWaterloggedBlock { @Override public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) { if (!world.isClientSide && player.canUseGameMasterBlocks()) { diff --git a/patches/server/0660-don-t-attempt-to-teleport-dead-entities.patch b/patches/server/0660-don-t-attempt-to-teleport-dead-entities.patch index 96f8ca01bb..46478011d3 100644 --- a/patches/server/0660-don-t-attempt-to-teleport-dead-entities.patch +++ b/patches/server/0660-don-t-attempt-to-teleport-dead-entities.patch @@ -5,7 +5,7 @@ Subject: [PATCH] don't attempt to teleport dead entities diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index ec23aa4f86fed6890273d06b8cfb4000daf3c515..a89cd343bee7ea919c3ba5789e37b05e6a1cf334 100644 +index 685cd5c719a0bf8d3e41aa95b0e84effe1241948..a9c1561ae9ec5a3db7a0602314c9a935ddf3fdfd 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -718,7 +718,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0661-Prevent-excessive-velocity-through-repeated-crits.patch b/patches/server/0661-Prevent-excessive-velocity-through-repeated-crits.patch index e77b1154c2..f3ea39fcf2 100644 --- a/patches/server/0661-Prevent-excessive-velocity-through-repeated-crits.patch +++ b/patches/server/0661-Prevent-excessive-velocity-through-repeated-crits.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Prevent excessive velocity through repeated crits diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 18804ea960f8423d172d9119c0739226a18d4d56..d4abce0b715d5eda99505fa0e29eeab20b538fd9 100644 +index 31eb77e4e5f07b120708edeca497ef2eef1fcf13..ed6fd20ff608e764d6b0f517f6c9c85c533f1646 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -2697,13 +2697,26 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0662-Remove-client-side-code-using-deprecated-for-removal.patch b/patches/server/0662-Remove-client-side-code-using-deprecated-for-removal.patch index 2ed18ebaeb..b7a4fc1608 100644 --- a/patches/server/0662-Remove-client-side-code-using-deprecated-for-removal.patch +++ b/patches/server/0662-Remove-client-side-code-using-deprecated-for-removal.patch @@ -7,24 +7,23 @@ Subject: [PATCH] Remove client-side code using deprecated for removal Fixes warnings on build diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java -index 765e4bc00a0526aab6e263dae7233f63f7f31498..edf937591abf62416bd692e40b7b7a6badbe877d 100644 +index 722734ce612fb790ddc80488a795a85ebcd4a842..72e734af483dc03e1ae947b2ab3b6fa7df38ce62 100644 --- a/src/main/java/net/minecraft/Util.java +++ b/src/main/java/net/minecraft/Util.java -@@ -951,17 +951,7 @@ public class Util { +@@ -935,16 +935,7 @@ public class Util { } public void openUrl(URL url) { - try { -- Process process = AccessController.doPrivileged((PrivilegedExceptionAction)(() -> { -- return Runtime.getRuntime().exec(this.getOpenUrlArguments(url)); -- })); +- Process process = AccessController.doPrivileged( +- (PrivilegedExceptionAction)(() -> Runtime.getRuntime().exec(this.getOpenUrlArguments(url))) +- ); - process.getInputStream().close(); - process.getErrorStream().close(); - process.getOutputStream().close(); - } catch (IOException | PrivilegedActionException var3) { - Util.LOGGER.error("Couldn't open url '{}'", url, var3); - } -- + throw new IllegalStateException("This method is not useful on dedicated servers."); // Paper - Fix warnings on build by removing client-only code } diff --git a/patches/server/0664-Prevent-sending-oversized-item-data-in-equipment-and.patch b/patches/server/0664-Prevent-sending-oversized-item-data-in-equipment-and.patch index 66da8d4997..cd57452be8 100644 --- a/patches/server/0664-Prevent-sending-oversized-item-data-in-equipment-and.patch +++ b/patches/server/0664-Prevent-sending-oversized-item-data-in-equipment-and.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Prevent sending oversized item data in equipment and metadata diff --git a/src/main/java/net/minecraft/network/syncher/EntityDataSerializers.java b/src/main/java/net/minecraft/network/syncher/EntityDataSerializers.java -index f9e15908143f4453c2a5817b412e8a13554553f0..06498788c169133bd563c5a87192b71802c4d4df 100644 +index 3ee4c01e4505241e575b8b2e96338ba27b793a2b..d70f77e4d5ca59c9f802ecb354fa8d53d1e10134 100644 --- a/src/main/java/net/minecraft/network/syncher/EntityDataSerializers.java +++ b/src/main/java/net/minecraft/network/syncher/EntityDataSerializers.java -@@ -42,7 +42,7 @@ public class EntityDataSerializers { +@@ -44,7 +44,7 @@ public class EntityDataSerializers { public static final EntityDataSerializer ITEM_STACK = new EntityDataSerializer() { @Override public void write(FriendlyByteBuf buf, ItemStack value) { @@ -18,7 +18,7 @@ index f9e15908143f4453c2a5817b412e8a13554553f0..06498788c169133bd563c5a87192b718 @Override diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java -index a83b4d9b61230ecf5f776269cab228cf49c5f546..86f6e5bad325dd3d817b643388b196121624b8c7 100644 +index 91563f903834c1a0636dc087f8c6376815165b6c..a51564e8dce3c125ed5f05cc23548a05c1e79a95 100644 --- a/src/main/java/net/minecraft/server/level/ServerEntity.java +++ b/src/main/java/net/minecraft/server/level/ServerEntity.java @@ -335,7 +335,10 @@ public class ServerEntity { @@ -34,7 +34,7 @@ index a83b4d9b61230ecf5f776269cab228cf49c5f546..86f6e5bad325dd3d817b643388b19612 } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index d4abce0b715d5eda99505fa0e29eeab20b538fd9..ccbafac8e5930571928e87f1c83f9f481fcfe8c4 100644 +index ed6fd20ff608e764d6b0f517f6c9c85c533f1646..8025e351fb3e24aa67b31eca74be1bc368592851 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3208,7 +3208,10 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0665-Hide-unnecessary-itemmeta-from-clients.patch b/patches/server/0665-Hide-unnecessary-itemmeta-from-clients.patch index 6224365ef1..97005e3398 100644 --- a/patches/server/0665-Hide-unnecessary-itemmeta-from-clients.patch +++ b/patches/server/0665-Hide-unnecessary-itemmeta-from-clients.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Hide unnecessary itemmeta from clients diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java -index 86f6e5bad325dd3d817b643388b196121624b8c7..062225ac8b5fbc44290352d78b215640691f3c23 100644 +index a51564e8dce3c125ed5f05cc23548a05c1e79a95..d2c2075fb0378fd7ec148281d37d886c77a78ce8 100644 --- a/src/main/java/net/minecraft/server/level/ServerEntity.java +++ b/src/main/java/net/minecraft/server/level/ServerEntity.java @@ -337,7 +337,7 @@ public class ServerEntity { @@ -33,7 +33,7 @@ index ace2cab310aa7d89e1b76bf5fdc9fd64f56b6cc7..cf173a2315f3a97a89dc2aabe81be285 } } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index ccbafac8e5930571928e87f1c83f9f481fcfe8c4..9af308ef5e55df9ce08b25e358e48d1c6f67d663 100644 +index 8025e351fb3e24aa67b31eca74be1bc368592851..e44a45ced6f7cd7db44388bb2e85c722b6b5ca8a 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3210,7 +3210,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0666-Fix-Spigot-growth-modifiers.patch b/patches/server/0666-Fix-Spigot-growth-modifiers.patch index 92cddad5f1..6463677b83 100644 --- a/patches/server/0666-Fix-Spigot-growth-modifiers.patch +++ b/patches/server/0666-Fix-Spigot-growth-modifiers.patch @@ -13,7 +13,7 @@ Co-authored-by: Noah van der Aa Co-authored-by: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> diff --git a/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java b/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java -index 95f897b9ef73c880aff1cfe35fe490683badfd44..1ec8c2d24ec8468d20f322d67143b9454ff266eb 100644 +index 724d77b014a738ad32a1708bd31c0f1a5d76fd57..bdd9f38dcb16b74c5916b75713dbe5082b32497d 100644 --- a/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java +++ b/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java @@ -51,9 +51,18 @@ public class CaveVinesBlock extends GrowingPlantHeadBlock implements Bonemealabl @@ -76,10 +76,10 @@ index b74e61064926a7c7fb03286651ea52c150f86107..30300ef3ec839dfa944c992ab50db4d3 return (BlockState) state.cycle(GrowingPlantHeadBlock.AGE); } diff --git a/src/main/java/net/minecraft/world/level/block/MangrovePropaguleBlock.java b/src/main/java/net/minecraft/world/level/block/MangrovePropaguleBlock.java -index 3c0b0732cdea6c98c58c9639be3a6971575df85b..d5257272ac8b0cf36e9f92e32a4a4ae6782f770c 100644 +index 83cc52de8cbb538f8ff2dbce0594f44b8d404b8e..d3827a6759c99d945767498d37a6dbb6b70b6d0d 100644 --- a/src/main/java/net/minecraft/world/level/block/MangrovePropaguleBlock.java +++ b/src/main/java/net/minecraft/world/level/block/MangrovePropaguleBlock.java -@@ -100,7 +100,7 @@ public class MangrovePropaguleBlock extends SaplingBlock implements SimpleWaterl +@@ -114,7 +114,7 @@ public class MangrovePropaguleBlock extends SaplingBlock implements SimpleWaterl @Override public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { if (!isHanging(state)) { @@ -87,12 +87,12 @@ index 3c0b0732cdea6c98c58c9639be3a6971575df85b..d5257272ac8b0cf36e9f92e32a4a4ae6 + if (random.nextFloat() < (world.spigotConfig.saplingModifier / (100.0F * 7))) { // Paper - Fix Spigot growth modifiers this.advanceTree(world, pos, state, random); } - + } else { diff --git a/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java b/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java -index 690abba9d27ab4061de4dd3676292b1859036868..591f32f7c0a7a9c843933d17dad8a34b672f49ac 100644 +index c9ed129db2cadd0a33d69993961f43088725c3cb..d06e3892cf42723f8e3f621b5497c5348fa1a715 100644 --- a/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java +++ b/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java -@@ -119,7 +119,7 @@ public class PitcherCropBlock extends DoublePlantBlock implements BonemealableBl +@@ -123,7 +123,7 @@ public class PitcherCropBlock extends DoublePlantBlock implements BonemealableBl @Override public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { float f = CropBlock.getGrowthSpeed(this, world, pos); diff --git a/patches/server/0669-Optimize-HashMapPalette.patch b/patches/server/0669-Optimize-HashMapPalette.patch index a8cf001da1..d50159b901 100644 --- a/patches/server/0669-Optimize-HashMapPalette.patch +++ b/patches/server/0669-Optimize-HashMapPalette.patch @@ -24,7 +24,7 @@ to corrupted data. This is also something that Anti-Xray is currently relying on. diff --git a/src/main/java/net/minecraft/world/level/chunk/HashMapPalette.java b/src/main/java/net/minecraft/world/level/chunk/HashMapPalette.java -index 26e093243c70313b777483d9555fb1557443c9b8..92c360f02ef6be77c6c8eee3226947468194ec23 100644 +index f80cde264393f3606bc0c54ba2fd6a467f4bcb5a..c5e1040c239874dcf20b79472bf690ee7f0a9e5f 100644 --- a/src/main/java/net/minecraft/world/level/chunk/HashMapPalette.java +++ b/src/main/java/net/minecraft/world/level/chunk/HashMapPalette.java @@ -20,7 +20,7 @@ public class HashMapPalette implements Palette { diff --git a/patches/server/0674-Forward-CraftEntity-in-teleport-command.patch b/patches/server/0674-Forward-CraftEntity-in-teleport-command.patch index 18a8c45967..d78da2d8e7 100644 --- a/patches/server/0674-Forward-CraftEntity-in-teleport-command.patch +++ b/patches/server/0674-Forward-CraftEntity-in-teleport-command.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Forward CraftEntity in teleport command diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index a89cd343bee7ea919c3ba5789e37b05e6a1cf334..6c8478c9ad154b25e11085ac47552b5855b5e9d1 100644 +index a9c1561ae9ec5a3db7a0602314c9a935ddf3fdfd..a14ac8aef9aec14a3ca31a61d66f03fec0841927 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -3263,6 +3263,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0678-Configurable-max-block-light-for-monster-spawning.patch b/patches/server/0678-Configurable-max-block-light-for-monster-spawning.patch index deae03d87c..421d176050 100644 --- a/patches/server/0678-Configurable-max-block-light-for-monster-spawning.patch +++ b/patches/server/0678-Configurable-max-block-light-for-monster-spawning.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Configurable max block light for monster spawning diff --git a/src/main/java/net/minecraft/world/entity/monster/Monster.java b/src/main/java/net/minecraft/world/entity/monster/Monster.java -index 036d79baf372f4900681fee366bcd91c99474e5f..fbca4d6bc84e8be359b989ef089469838f896910 100644 +index 4701bf9ee203f2f15b0b68e84bbfa2c489b66631..759839e912c54598b257ad738481364940f88a18 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Monster.java +++ b/src/main/java/net/minecraft/world/entity/monster/Monster.java -@@ -93,7 +93,7 @@ public abstract class Monster extends PathfinderMob implements Enemy { +@@ -92,7 +92,7 @@ public abstract class Monster extends PathfinderMob implements Enemy { return false; } else { DimensionType dimensionType = world.dimensionType(); diff --git a/patches/server/0680-Load-effect-amplifiers-greater-than-127-correctly.patch b/patches/server/0680-Load-effect-amplifiers-greater-than-127-correctly.patch index 3e88533e6f..d1a35c86e5 100644 --- a/patches/server/0680-Load-effect-amplifiers-greater-than-127-correctly.patch +++ b/patches/server/0680-Load-effect-amplifiers-greater-than-127-correctly.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Load effect amplifiers greater than 127 correctly MOJIRA: MC-118857 diff --git a/src/main/java/net/minecraft/world/effect/MobEffectInstance.java b/src/main/java/net/minecraft/world/effect/MobEffectInstance.java -index 758a9ddd3489be9502cd4e7f31b709c49ce9e009..bf304db1f9506d3e83d16cd632b9155c39346634 100644 +index 83f1d79147630084b24be20602571f36fc62a1b3..5c9a0c91ae53b575d325a294c702668d30252fcf 100644 --- a/src/main/java/net/minecraft/world/effect/MobEffectInstance.java +++ b/src/main/java/net/minecraft/world/effect/MobEffectInstance.java -@@ -293,7 +293,7 @@ public class MobEffectInstance implements Comparable { +@@ -298,7 +298,7 @@ public class MobEffectInstance implements Comparable { } private static MobEffectInstance loadSpecifiedEffect(MobEffect type, CompoundTag nbt) { diff --git a/patches/server/0685-Make-water-animal-spawn-height-configurable.patch b/patches/server/0685-Make-water-animal-spawn-height-configurable.patch index e523ed36f4..3741f45097 100644 --- a/patches/server/0685-Make-water-animal-spawn-height-configurable.patch +++ b/patches/server/0685-Make-water-animal-spawn-height-configurable.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Make water animal spawn height configurable diff --git a/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java b/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java -index 27624b080e025d943b9c99627568f7dd66165548..9b897cf53f4bb5d366e6ac88dbed93c59d8fe541 100644 +index 7ef707f0098f2663ebc0ef0f5b35897c9d33c1cf..75884a9e69a28404752c1a2cf854335bb78cac01 100644 --- a/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java +++ b/src/main/java/net/minecraft/world/entity/animal/WaterAnimal.java -@@ -73,6 +73,10 @@ public abstract class WaterAnimal extends PathfinderMob { - public static boolean checkSurfaceWaterAnimalSpawnRules(EntityType type, LevelAccessor world, MobSpawnType reason, BlockPos pos, RandomSource random) { +@@ -74,6 +74,10 @@ public abstract class WaterAnimal extends PathfinderMob { + ) { int i = world.getSeaLevel(); int j = i - 13; + // Paper start - Make water animal spawn height configurable diff --git a/patches/server/0689-Multiple-Entries-with-Scoreboards.patch b/patches/server/0689-Multiple-Entries-with-Scoreboards.patch index 9bfd7660c6..a0934c6d89 100644 --- a/patches/server/0689-Multiple-Entries-with-Scoreboards.patch +++ b/patches/server/0689-Multiple-Entries-with-Scoreboards.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Multiple Entries with Scoreboards diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java -index cf31771648549ab6d7e4e38b30409ca48a976bea..e70decbcf87c2a57bfa34ad7be7120d546ff8e35 100644 +index e9d03ebfbd02a46b0ba274be107e099cc24b59e3..c52b91f5a001924e7a15f246004b6dd294fa0aae 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundSetPlayerTeamPacket.java -@@ -42,6 +42,12 @@ public class ClientboundSetPlayerTeamPacket implements Packet type(); @@ -198,7 +197,7 @@ index 65dcb14241baadb2c9f8f16919d7b562198ad9c3..02e58161a0f5915084230831ee03050d + worldgenRandom.setLargeFeatureWithSalt(seed, chunkX, chunkZ, saltOverride); + } + // Paper end - Add missing structure set seed configs - return worldgenRandom.nextDouble() < (double)frequency; + return worldgenRandom.nextDouble() < frequency; } - private static boolean legacyArbitrarySaltProbabilityReducer(long seed, int salt, int chunkX, int chunkZ, float frequency) { @@ -214,7 +213,7 @@ index 65dcb14241baadb2c9f8f16919d7b562198ad9c3..02e58161a0f5915084230831ee03050d int i = chunkX >> 4; int j = chunkZ >> 4; WorldgenRandom worldgenRandom = new WorldgenRandom(new LegacyRandomSource(0L)); -@@ -118,7 +138,7 @@ public abstract class StructurePlacement { +@@ -139,7 +159,7 @@ public abstract class StructurePlacement { @FunctionalInterface public interface FrequencyReducer { @@ -223,7 +222,7 @@ index 65dcb14241baadb2c9f8f16919d7b562198ad9c3..02e58161a0f5915084230831ee03050d } public static enum FrequencyReductionMethod implements StringRepresentable { -@@ -136,8 +156,8 @@ public abstract class StructurePlacement { +@@ -159,8 +179,8 @@ public abstract class StructurePlacement { this.reducer = generationPredicate; } diff --git a/patches/server/0704-Execute-chunk-tasks-fairly-for-worlds-while-waiting-.patch b/patches/server/0704-Execute-chunk-tasks-fairly-for-worlds-while-waiting-.patch index 06c9d9f99a..24d1f7815d 100644 --- a/patches/server/0704-Execute-chunk-tasks-fairly-for-worlds-while-waiting-.patch +++ b/patches/server/0704-Execute-chunk-tasks-fairly-for-worlds-while-waiting-.patch @@ -9,7 +9,7 @@ This might result in chunks loading far slower in the nether, for example. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index d19f2ca702ffa32c616ec821219079e2b784a460..1c1d111eba7b625bd36b95fbec83d8c5f8272b97 100644 +index 82ee16f8efb5d32bf648d416010de557e2b90865..186bbc60f6e283aeb00e339c98c034e2268f160d 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -1296,6 +1296,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop type, BlockPos pos, BlockState state) { super(type, pos, state); -@@ -48,9 +49,17 @@ public class SculkSensorBlockEntity extends BlockEntity implements GameEventList - this.vibrationData = listener; - }); +@@ -48,8 +49,16 @@ public class SculkSensorBlockEntity extends BlockEntity implements GameEventList + .resultOrPartial(LOGGER::error) + .ifPresent(listener -> this.vibrationData = listener); } + // Paper start - Configurable sculk sensor listener range + if (nbt.contains(PAPER_LISTENER_RANGE_NBT_KEY)) { @@ -54,7 +54,6 @@ index a6c226da995eecc323d69a3eff1f8d202410e069..1e699b12e58fe985f41b96882988483f + this.rangeOverride = null; + } + // Paper end - Configurable sculk sensor listener range - } + protected static final String PAPER_LISTENER_RANGE_NBT_KEY = "Paper.ListenerRange"; // Paper - Configurable sculk sensor listener range @@ -62,9 +61,9 @@ index a6c226da995eecc323d69a3eff1f8d202410e069..1e699b12e58fe985f41b96882988483f protected void saveAdditional(CompoundTag nbt) { super.saveAdditional(nbt); @@ -58,7 +67,13 @@ public class SculkSensorBlockEntity extends BlockEntity implements GameEventList - VibrationSystem.Data.CODEC.encodeStart(NbtOps.INSTANCE, this.vibrationData).resultOrPartial(LOGGER::error).ifPresent((listenerNbt) -> { - nbt.put("listener", listenerNbt); - }); + .encodeStart(NbtOps.INSTANCE, this.vibrationData) + .resultOrPartial(LOGGER::error) + .ifPresent(listenerNbt -> nbt.put("listener", listenerNbt)); + this.saveRangeOverride(nbt); // Paper - Configurable sculk sensor listener range + } + // Paper start - Configurable sculk sensor listener range diff --git a/patches/server/0708-Option-to-have-default-CustomSpawners-in-custom-worl.patch b/patches/server/0708-Option-to-have-default-CustomSpawners-in-custom-worl.patch index 903a710120..060a7d91fb 100644 --- a/patches/server/0708-Option-to-have-default-CustomSpawners-in-custom-worl.patch +++ b/patches/server/0708-Option-to-have-default-CustomSpawners-in-custom-worl.patch @@ -10,7 +10,7 @@ just looking at the LevelStem key, look at the DimensionType key which is one level below that. Defaults to off to keep vanilla behavior. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 1c1d111eba7b625bd36b95fbec83d8c5f8272b97..239b1616ddd4cb64a0565d0f8f3bef7bbaaf23c9 100644 +index 186bbc60f6e283aeb00e339c98c034e2268f160d..5b4e4459aa0bcdcf422f4191ebda7b42892d24e4 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -617,7 +617,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop> CONTAINER_MIXES = Lists.newArrayList(); + private static final it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap CUSTOM_MIXES = new it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap<>(); // Paper - Custom Potion Mixes private static final List ALLOWED_CONTAINERS = Lists.newArrayList(); - private static final Predicate ALLOWED_CONTAINER = (stack) -> { - for(Ingredient ingredient : ALLOWED_CONTAINERS) { + private static final Predicate ALLOWED_CONTAINER = stack -> { + for (Ingredient ingredient : ALLOWED_CONTAINERS) { @@ -26,7 +27,7 @@ public class PotionBrewing { }; @@ -86,10 +86,10 @@ index 25e909b90293855321b8f05ab3488bad8c064853..0bba74bd22d66881fc6851797d29c144 + return true; + } + // Paper end - Custom Potion Mixes - if (!ALLOWED_CONTAINER.test(input)) { - return false; - } else { -@@ -93,6 +99,13 @@ public class PotionBrewing { + return ALLOWED_CONTAINER.test(input) && (hasContainerMix(input, ingredient) || hasPotionMix(input, ingredient)); + } + +@@ -89,6 +95,13 @@ public class PotionBrewing { public static ItemStack mix(ItemStack ingredient, ItemStack input) { if (!input.isEmpty()) { @@ -103,7 +103,7 @@ index 25e909b90293855321b8f05ab3488bad8c064853..0bba74bd22d66881fc6851797d29c144 Potion potion = PotionUtils.getPotion(input); Item item = input.getItem(); -@@ -112,6 +125,54 @@ public class PotionBrewing { +@@ -108,6 +121,54 @@ public class PotionBrewing { return input; } diff --git a/patches/server/0717-Fix-swamp-hut-cat-generation-deadlock.patch b/patches/server/0717-Fix-swamp-hut-cat-generation-deadlock.patch index bac78b77ff..8a176245ca 100644 --- a/patches/server/0717-Fix-swamp-hut-cat-generation-deadlock.patch +++ b/patches/server/0717-Fix-swamp-hut-cat-generation-deadlock.patch @@ -23,10 +23,10 @@ index 534630b0161c8d869e49e7a59572193550be0671..7dfd2b17e82a80683af28779d0bd8f64 this.setPersistenceRequired(); } diff --git a/src/main/java/net/minecraft/world/level/StructureManager.java b/src/main/java/net/minecraft/world/level/StructureManager.java -index b33a015b834873f279bf33a64974ef440a37df79..b59581b92aed0bc1b09008c695b0b112c3e65743 100644 +index 09e0c6b6bddcba2f4a59838ac63cda3188f71e41..07eb481380e8fd4e492f36342ba633579c1b624e 100644 --- a/src/main/java/net/minecraft/world/level/StructureManager.java +++ b/src/main/java/net/minecraft/world/level/StructureManager.java -@@ -44,7 +44,12 @@ public class StructureManager { +@@ -46,7 +46,12 @@ public class StructureManager { } public List startsForStructure(ChunkPos pos, Predicate predicate) { @@ -37,10 +37,10 @@ index b33a015b834873f279bf33a64974ef440a37df79..b59581b92aed0bc1b09008c695b0b112 + public List startsForStructure(ChunkPos pos, Predicate predicate, @Nullable ServerLevelAccessor levelAccessor) { + Map map = (levelAccessor == null ? this.level : levelAccessor).getChunk(pos.x, pos.z, ChunkStatus.STRUCTURE_REFERENCES).getAllReferences(); + // Paper end - Fix swamp hut cat generation deadlock - ImmutableList.Builder builder = ImmutableList.builder(); + Builder builder = ImmutableList.builder(); - for(Map.Entry entry : map.entrySet()) { -@@ -108,13 +113,18 @@ public class StructureManager { + for (Entry entry : map.entrySet()) { +@@ -111,10 +116,15 @@ public class StructureManager { } public StructureStart getStructureWithPieceAt(BlockPos pos, TagKey structureTag) { @@ -51,12 +51,9 @@ index b33a015b834873f279bf33a64974ef440a37df79..b59581b92aed0bc1b09008c695b0b112 + // Paper end - Fix swamp hut cat generation deadlock Registry registry = this.registryAccess().registryOrThrow(Registries.STRUCTURE); - for(StructureStart structureStart : this.startsForStructure(new ChunkPos(pos), (structure) -> { - return registry.getHolder(registry.getId(structure)).map((reference) -> { - return reference.is(structureTag); - }).orElse(false); -- })) { -+ }, levelAccessor)) { // Paper - Fix swamp hut cat generation deadlock + for (StructureStart structureStart : this.startsForStructure( +- new ChunkPos(pos), structure -> registry.getHolder(registry.getId(structure)).map(reference -> reference.is(structureTag)).orElse(false) ++ new ChunkPos(pos), structure -> registry.getHolder(registry.getId(structure)).map(reference -> reference.is(structureTag)).orElse(false), levelAccessor // Paper - Fix swamp hut cat generation deadlock + )) { if (this.structureHasPieceAt(pos, structureStart)) { return structureStart; - } diff --git a/patches/server/0724-Add-TameableDeathMessageEvent.patch b/patches/server/0724-Add-TameableDeathMessageEvent.patch index 58ea5cd5d1..a3f8770f2a 100644 --- a/patches/server/0724-Add-TameableDeathMessageEvent.patch +++ b/patches/server/0724-Add-TameableDeathMessageEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add TameableDeathMessageEvent diff --git a/src/main/java/net/minecraft/world/entity/TamableAnimal.java b/src/main/java/net/minecraft/world/entity/TamableAnimal.java -index 8f085654f3b9c540346fe4e56c71d572da7a897c..4d893c445af2b6dc74d5ad731b69eb5a488817b4 100644 +index ae474216d54317a9d102cb6832225074c94c8e4b..01b91388577b6013d7bd5c9112a03f818fee1f9c 100644 --- a/src/main/java/net/minecraft/world/entity/TamableAnimal.java +++ b/src/main/java/net/minecraft/world/entity/TamableAnimal.java -@@ -197,7 +197,12 @@ public abstract class TamableAnimal extends Animal implements OwnableEntity { +@@ -195,7 +195,12 @@ public abstract class TamableAnimal extends Animal implements OwnableEntity { @Override public void die(DamageSource damageSource) { if (!this.level().isClientSide && this.level().getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES) && this.getOwner() instanceof ServerPlayer) { diff --git a/patches/server/0726-fix-player-loottables-running-when-mob-loot-gamerule.patch b/patches/server/0726-fix-player-loottables-running-when-mob-loot-gamerule.patch index 185fdf4437..5fc7657405 100644 --- a/patches/server/0726-fix-player-loottables-running-when-mob-loot-gamerule.patch +++ b/patches/server/0726-fix-player-loottables-running-when-mob-loot-gamerule.patch @@ -5,7 +5,7 @@ Subject: [PATCH] fix player loottables running when mob loot gamerule is false diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index be8c6c48287b73693ead9ae22071f2b4af7eed32..0db3f5b06b6c93882761450ea77ba4ee09869c61 100644 +index b5a3587a9074a1a2fcc2252d2db8b184b6ab6793..3f8f0e88339d847c44120b7657161bf43402db74 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -875,12 +875,14 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0727-Ensure-entity-passenger-world-matches-ridden-entity.patch b/patches/server/0727-Ensure-entity-passenger-world-matches-ridden-entity.patch index a841c24fcd..2c800da975 100644 --- a/patches/server/0727-Ensure-entity-passenger-world-matches-ridden-entity.patch +++ b/patches/server/0727-Ensure-entity-passenger-world-matches-ridden-entity.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Ensure entity passenger world matches ridden entity Bad plugins doing this would cause some obvious problems... diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 7e6ea850078179f7c63b597a788ef105802a0260..2476b3fa3ecd976c6f6fb27dc3ad815bbab0165f 100644 +index d391114787e4f7491241b6abc45dcf3f2a7f9fb5..f08908238cc9680310a2b37089b051bf6fdf5ee3 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -2580,7 +2580,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0729-Allow-changing-the-EnderDragon-podium.patch b/patches/server/0729-Allow-changing-the-EnderDragon-podium.patch index fc8eed08e4..086fe76ad0 100644 --- a/patches/server/0729-Allow-changing-the-EnderDragon-podium.patch +++ b/patches/server/0729-Allow-changing-the-EnderDragon-podium.patch @@ -58,68 +58,68 @@ index 6d01175ea2092bc5f5ebb7aa066450bfec2443a1..61e4f8be9f5927b65ae03da98250d3cd f1 = Math.max((float) Math.sqrt(blockposition.distToCenterSqr(this.position())) / 4.0F, 1.0F); float f3 = 6.0F / f1; diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonDeathPhase.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonDeathPhase.java -index f4028b6890fd094360a33403728588380111204d..d6ec0583dbaca95eb6a6444923cc1311a9753825 100644 +index 060e2da81c7e55a43412c47e857f91fefd88495b..8e5249e96ffb80b933616913f764e704b670a8b8 100644 --- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonDeathPhase.java +++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonDeathPhase.java -@@ -32,7 +32,7 @@ public class DragonDeathPhase extends AbstractDragonPhaseInstance { - public void doServerTick() { - ++this.time; +@@ -35,7 +35,7 @@ public class DragonDeathPhase extends AbstractDragonPhaseInstance { if (this.targetLocation == null) { -- BlockPos blockPos = this.dragon.level().getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.getLocation(this.dragon.getFightOrigin())); -+ BlockPos blockPos = this.dragon.level().getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, this.dragon.getPodium()); // Paper - Allow changing the EnderDragon podium + BlockPos blockPos = this.dragon + .level() +- .getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.getLocation(this.dragon.getFightOrigin())); ++ .getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, this.dragon.getPodium()); // Paper - Allow changing the EnderDragon podium this.targetLocation = Vec3.atBottomCenterOf(blockPos); } diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonHoldingPatternPhase.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonHoldingPatternPhase.java -index 00228e49c07eeed13b726192d5f9b8f2fc55bb75..bd7be8a5a24f1328dde28ae4a66823c12110fa02 100644 +index 90684c6bfa4025aae0abf098f44e0557c62a0760..422bf66055391b0bb58e3a68156744df8bbfecdb 100644 --- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonHoldingPatternPhase.java +++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonHoldingPatternPhase.java @@ -54,7 +54,7 @@ public class DragonHoldingPatternPhase extends AbstractDragonPhaseInstance { - - private void findNewTarget() { if (this.currentPath != null && this.currentPath.isDone()) { -- BlockPos blockPos = this.dragon.level().getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, new BlockPos(EndPodiumFeature.getLocation(this.dragon.getFightOrigin()))); -+ BlockPos blockPos = this.dragon.level().getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, this.dragon.getPodium()); // Paper - Allow changing the EnderDragon podium + BlockPos blockPos = this.dragon + .level() +- .getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, new BlockPos(EndPodiumFeature.getLocation(this.dragon.getFightOrigin()))); ++ .getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, new BlockPos(this.dragon.getPodium())); // Paper - Allow changing the EnderDragon podium int i = this.dragon.getDragonFight() == null ? 0 : this.dragon.getDragonFight().getCrystalsAlive(); if (this.dragon.getRandom().nextInt(i + 3) == 0) { this.dragon.getPhaseManager().setPhase(EnderDragonPhase.LANDING_APPROACH); diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonLandingApproachPhase.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonLandingApproachPhase.java -index 80647b1f5192e6f2b660a31413db1fa45fb92f2c..e161bfb06beeada4987272d01a0f140069b37951 100644 +index fd36333fc21696e0ec7760cb4702dd7ac5a1a0fb..0832f7103e9b94c65c7856e942c15f8bcdb2ad7f 100644 --- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonLandingApproachPhase.java +++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonLandingApproachPhase.java -@@ -52,7 +52,7 @@ public class DragonLandingApproachPhase extends AbstractDragonPhaseInstance { - private void findNewTarget() { - if (this.currentPath == null || this.currentPath.isDone()) { +@@ -53,7 +53,7 @@ public class DragonLandingApproachPhase extends AbstractDragonPhaseInstance { int i = this.dragon.findClosestNode(); -- BlockPos blockPos = this.dragon.level().getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, EndPodiumFeature.getLocation(this.dragon.getFightOrigin())); -+ BlockPos blockPos = this.dragon.level().getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, this.dragon.getPodium()); // Paper - Allow changing the EnderDragon podium - Player player = this.dragon.level().getNearestPlayer(NEAR_EGG_TARGETING, this.dragon, (double)blockPos.getX(), (double)blockPos.getY(), (double)blockPos.getZ()); + BlockPos blockPos = this.dragon + .level() +- .getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, EndPodiumFeature.getLocation(this.dragon.getFightOrigin())); ++ .getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, this.dragon.getPodium()); // Paper - Allow changing the EnderDragon podium + Player player = this.dragon.level().getNearestPlayer(NEAR_EGG_TARGETING, this.dragon, blockPos.getX(), blockPos.getY(), blockPos.getZ()); int j; if (player != null) { diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonLandingPhase.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonLandingPhase.java -index 48ebc2ab8ebbdc2292af10b955384bf7d722ade2..24db7fafd31277eb1b82eac4a97b2f979c1d3816 100644 +index d913147d692e7e58bec4fac44c7e93a1822e8f65..3b960060f152d0352c2f8cdc1c71543cd7fa0dbd 100644 --- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonLandingPhase.java +++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonLandingPhase.java -@@ -39,7 +39,7 @@ public class DragonLandingPhase extends AbstractDragonPhaseInstance { - @Override +@@ -41,7 +41,7 @@ public class DragonLandingPhase extends AbstractDragonPhaseInstance { public void doServerTick() { if (this.targetLocation == null) { -- this.targetLocation = Vec3.atBottomCenterOf(this.dragon.level().getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, EndPodiumFeature.getLocation(this.dragon.getFightOrigin()))); -+ this.targetLocation = Vec3.atBottomCenterOf(this.dragon.level().getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, this.dragon.getPodium())); // Paper - Allow changing the EnderDragon podium + this.targetLocation = Vec3.atBottomCenterOf( +- this.dragon.level().getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, EndPodiumFeature.getLocation(this.dragon.getFightOrigin())) ++ this.dragon.level().getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, this.dragon.getPodium()) // Paper - Allow changing the EnderDragon podium + ); } - if (this.targetLocation.distanceToSqr(this.dragon.getX(), this.dragon.getY(), this.dragon.getZ()) < 1.0D) { diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonTakeoffPhase.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonTakeoffPhase.java -index 1290090f855840bf64bf3a7ba93e3cb036630dcc..792ff77090fa582a7ffcb7b8c394badfa7586126 100644 +index b4789d22590d094d76e68e60c022366cba0b7bf6..2e0af7c7f7a98a19f7736c5c9dc7c313c3ca4406 100644 --- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonTakeoffPhase.java +++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonTakeoffPhase.java -@@ -24,7 +24,7 @@ public class DragonTakeoffPhase extends AbstractDragonPhaseInstance { - @Override - public void doServerTick() { +@@ -25,7 +25,7 @@ public class DragonTakeoffPhase extends AbstractDragonPhaseInstance { if (!this.firstTick && this.currentPath != null) { -- BlockPos blockPos = this.dragon.level().getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, EndPodiumFeature.getLocation(this.dragon.getFightOrigin())); -+ BlockPos blockPos = this.dragon.level().getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, this.dragon.getPodium()); // Paper - Allow changing the EnderDragon podium - if (!blockPos.closerToCenterThan(this.dragon.position(), 10.0D)) { + BlockPos blockPos = this.dragon + .level() +- .getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, EndPodiumFeature.getLocation(this.dragon.getFightOrigin())); ++ .getHeightmapPos(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, this.dragon.getPodium()); // Paper - Allow changing the EnderDragon podium + if (!blockPos.closerToCenterThan(this.dragon.position(), 10.0)) { this.dragon.getPhaseManager().setPhase(EnderDragonPhase.HOLDING_PATTERN); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragon.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderDragon.java diff --git a/patches/server/0735-Fix-CME-in-CraftPersistentDataTypeRegistry.patch b/patches/server/0735-Fix-CME-in-CraftPersistentDataTypeRegistry.patch index feadff040a..ed8adb4503 100644 --- a/patches/server/0735-Fix-CME-in-CraftPersistentDataTypeRegistry.patch +++ b/patches/server/0735-Fix-CME-in-CraftPersistentDataTypeRegistry.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix CME in CraftPersistentDataTypeRegistry diff --git a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataTypeRegistry.java b/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataTypeRegistry.java -index f83fbad4b579726ba5f759de3aa752caaf0aa79c..e0ef6964934ca0b280eded00b38220e3c3a0f035 100644 +index 71dc4a2285ddc86e7aa65ba1a211997ffa8fcce4..20c53aac0aef180ee12de919a8000e4b4bc619ff 100644 --- a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataTypeRegistry.java +++ b/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataTypeRegistry.java @@ -121,7 +121,7 @@ public final class CraftPersistentDataTypeRegistry { diff --git a/patches/server/0740-Add-PlayerStopUsingItemEvent.patch b/patches/server/0740-Add-PlayerStopUsingItemEvent.patch index fad59d6983..c78c171d1e 100644 --- a/patches/server/0740-Add-PlayerStopUsingItemEvent.patch +++ b/patches/server/0740-Add-PlayerStopUsingItemEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerStopUsingItemEvent diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 511e8e789932df77999689659d1efbe311339e40..79fd521d5c4a8d6acd2b4f946dfdcc7b4e641b75 100644 +index 5de5ca787905d9e0133e5f75280748526c568203..2b7325d3bcea2175ec22a45101f5bbaf29c2231a 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -4045,6 +4045,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0743-Add-support-for-Proxy-Protocol.patch b/patches/server/0743-Add-support-for-Proxy-Protocol.patch index ef41da5d60..1c60d69833 100644 --- a/patches/server/0743-Add-support-for-Proxy-Protocol.patch +++ b/patches/server/0743-Add-support-for-Proxy-Protocol.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add support for Proxy Protocol diff --git a/build.gradle.kts b/build.gradle.kts -index 7cbfd129efcc2e971b75aaa272dee79a3b4d2d5c..5d35409137aff0eab242a0d4eb235e10cb7fe236 100644 +index d16c0311142e44ec1048818221796c09ab7a90d8..f9056ee057a22a11288405cd42cd0ba4c9d120c3 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -30,6 +30,7 @@ dependencies { diff --git a/patches/server/0747-Sanitize-sent-BlockEntity-NBT.patch b/patches/server/0747-Sanitize-sent-BlockEntity-NBT.patch index f607c4b19b..72cdd70ba1 100644 --- a/patches/server/0747-Sanitize-sent-BlockEntity-NBT.patch +++ b/patches/server/0747-Sanitize-sent-BlockEntity-NBT.patch @@ -18,10 +18,10 @@ index d79284a790569141c2ac8178d6ecc20b17cdd0d3..3944852921335c78a04a9dc301882ab5 public static ClientboundBlockEntityDataPacket create(BlockEntity blockEntity) { diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java -index f47eeb70661661610ef1a96dd9da67785825c126..89e3163b0301f8414c9400a6e00cdd85841fe2e8 100644 +index a44a82d2d5ed4d675dc1a184d5b6b935fda575dd..03b6aa2e3bd871ae59e761866b53a10f72b3cdac 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java -@@ -152,6 +152,7 @@ public class ClientboundLevelChunkPacketData { +@@ -145,6 +145,7 @@ public class ClientboundLevelChunkPacketData { CompoundTag compoundTag = blockEntity.getUpdateTag(); BlockPos blockPos = blockEntity.getBlockPos(); int i = SectionPos.sectionRelative(blockPos.getX()) << 4 | SectionPos.sectionRelative(blockPos.getZ()); diff --git a/patches/server/0748-Disable-component-selector-resolving-in-books-by-def.patch b/patches/server/0748-Disable-component-selector-resolving-in-books-by-def.patch index 33fd8e47d0..97082feba7 100644 --- a/patches/server/0748-Disable-component-selector-resolving-in-books-by-def.patch +++ b/patches/server/0748-Disable-component-selector-resolving-in-books-by-def.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Disable component selector resolving in books by default diff --git a/src/main/java/net/minecraft/world/item/WrittenBookItem.java b/src/main/java/net/minecraft/world/item/WrittenBookItem.java -index a324df312d9bb87d9e0962f8028d900933e70c07..258a636a59203c4e5415a89002c6a607338f9514 100644 +index 81bb0abea7ebd2705f84fae31e4a3d2de92d7d18..793ab8acd7445984cff2628e3f001661dc20c8e5 100644 --- a/src/main/java/net/minecraft/world/item/WrittenBookItem.java +++ b/src/main/java/net/minecraft/world/item/WrittenBookItem.java -@@ -111,7 +111,7 @@ public class WrittenBookItem extends Item { +@@ -112,7 +112,7 @@ public class WrittenBookItem extends Item { public static boolean resolveBookComponents(ItemStack book, @Nullable CommandSourceStack commandSource, @Nullable Player player) { CompoundTag compoundTag = book.getTag(); diff --git a/patches/server/0749-Prevent-entity-loading-causing-async-lookups.patch b/patches/server/0749-Prevent-entity-loading-causing-async-lookups.patch index 17a6ab001e..d02ab57220 100644 --- a/patches/server/0749-Prevent-entity-loading-causing-async-lookups.patch +++ b/patches/server/0749-Prevent-entity-loading-causing-async-lookups.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Prevent entity loading causing async lookups diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 2476b3fa3ecd976c6f6fb27dc3ad815bbab0165f..455cfdc2ce0960347605e149b88afab5ad8a3b05 100644 +index f08908238cc9680310a2b37089b051bf6fdf5ee3..936ce33bffd93ed7210b6659c27c476e1db348bb 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -727,6 +727,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0750-Throw-exception-on-world-create-while-being-ticked.patch b/patches/server/0750-Throw-exception-on-world-create-while-being-ticked.patch index 34fcf49e25..b8f3f47e4d 100644 --- a/patches/server/0750-Throw-exception-on-world-create-while-being-ticked.patch +++ b/patches/server/0750-Throw-exception-on-world-create-while-being-ticked.patch @@ -7,7 +7,7 @@ There are no plans to support creating worlds while worlds are being ticked themselvess. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 8080eee9babe02660724eee756700a4d5e69014f..ab1f4e62b2ffed99b47ae23cae172f20ed586b27 100644 +index 03fd35ee321c80ca674cea9eb366cffcc95bc893..c2326a72a038526c850b7820faa59618eba6eb88 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -307,6 +307,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { -- return Math.min(150, (anger == null ? 0 : anger) + amount); -+ return Math.min(150, (anger == null ? 0 : anger) + amount); // Paper - diff on change (Warden#increaseAngerAt WardenAngerChangeEvent) - }); +- int i = this.angerBySuspect.computeInt(entity, (suspect, anger) -> Math.min(150, (anger == null ? 0 : anger) + amount)); ++ int i = this.angerBySuspect.computeInt(entity, (suspect, anger) -> Math.min(150, (anger == null ? 0 : anger) + amount)); // Paper - diff on change (Warden#increaseAngerAt WardenAngerChangeEvent) if (bl) { int j = this.angerByUuid.removeInt(entity.getUUID()); + i += j; diff --git a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java index b5185fcb635fbf5e5ed9d6cc9cc517cb46ada5aa..937f81a859953498abe73bea560c86e6560e1c33 100644 --- a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java diff --git a/patches/server/0753-Add-option-for-strict-advancement-dimension-checks.patch b/patches/server/0753-Add-option-for-strict-advancement-dimension-checks.patch index 3dd4e6d490..7d0540d1db 100644 --- a/patches/server/0753-Add-option-for-strict-advancement-dimension-checks.patch +++ b/patches/server/0753-Add-option-for-strict-advancement-dimension-checks.patch @@ -11,10 +11,10 @@ distance trigger. This adds a config option to ignore that and use the exact dimension key of the worlds involved. diff --git a/src/main/java/net/minecraft/advancements/critereon/LocationPredicate.java b/src/main/java/net/minecraft/advancements/critereon/LocationPredicate.java -index 5f9cb2c7a2874e423087d04d3360af0364692b5c..428e0afef2cac9f2a19d8cfe8f2504ddd8e50887 100644 +index 079e3af44a964321d360b979f64f572057235ab8..8f2c00cd70bc99855f23f3db58567233a1fda84e 100644 --- a/src/main/java/net/minecraft/advancements/critereon/LocationPredicate.java +++ b/src/main/java/net/minecraft/advancements/critereon/LocationPredicate.java -@@ -25,7 +25,7 @@ public record LocationPredicate(Optional po +@@ -62,7 +62,7 @@ public record LocationPredicate( public boolean matches(ServerLevel world, double x, double y, double z) { if (this.position.isPresent() && !this.position.get().matches(x, y, z)) { return false; @@ -24,7 +24,7 @@ index 5f9cb2c7a2874e423087d04d3360af0364692b5c..428e0afef2cac9f2a19d8cfe8f2504dd } else { BlockPos blockPos = BlockPos.containing(x, y, z); diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 0db3f5b06b6c93882761450ea77ba4ee09869c61..bc95420dcf5d23d028e5df6595899a8712550be8 100644 +index 3f8f0e88339d847c44120b7657161bf43402db74..c99a672dd2d2e4972e9d4025e10e8863d0af1e6a 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1272,6 +1272,12 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0760-Do-not-sync-load-chunk-for-dynamic-game-event-listen.patch b/patches/server/0760-Do-not-sync-load-chunk-for-dynamic-game-event-listen.patch index 8b8d15552f..b5557f95ef 100644 --- a/patches/server/0760-Do-not-sync-load-chunk-for-dynamic-game-event-listen.patch +++ b/patches/server/0760-Do-not-sync-load-chunk-for-dynamic-game-event-listen.patch @@ -15,10 +15,10 @@ to account for the case where the chunk is _not_ currently loaded and then later loaded. diff --git a/src/main/java/net/minecraft/world/level/gameevent/DynamicGameEventListener.java b/src/main/java/net/minecraft/world/level/gameevent/DynamicGameEventListener.java -index e64435c1dfbaf182d2292a1123701033f817ec38..47647d3db7ce36226a817df640a0b25574fb9b02 100644 +index 53eeb59257e3e943cbe7dc113674135077f0c20d..fc316f6c6db1d39bb24daa1d272e5128c71320dd 100644 --- a/src/main/java/net/minecraft/world/level/gameevent/DynamicGameEventListener.java +++ b/src/main/java/net/minecraft/world/level/gameevent/DynamicGameEventListener.java -@@ -48,7 +48,7 @@ public class DynamicGameEventListener { +@@ -41,7 +41,7 @@ public class DynamicGameEventListener { private static void ifChunkExists(LevelReader world, @Nullable SectionPos sectionPos, Consumer dispatcherConsumer) { if (sectionPos != null) { diff --git a/patches/server/0761-Add-various-missing-EntityDropItemEvent-calls.patch b/patches/server/0761-Add-various-missing-EntityDropItemEvent-calls.patch index a4e7c5b7d4..d3b144009b 100644 --- a/patches/server/0761-Add-various-missing-EntityDropItemEvent-calls.patch +++ b/patches/server/0761-Add-various-missing-EntityDropItemEvent-calls.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add various missing EntityDropItemEvent calls diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 455cfdc2ce0960347605e149b88afab5ad8a3b05..007e5fc95dd5cb3973f45fd6a435cc102d133728 100644 +index 936ce33bffd93ed7210b6659c27c476e1db348bb..319bb4d94f8221e20557c0e0805c581447e2ee57 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -2491,6 +2491,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0765-Add-EntityPortalReadyEvent.patch b/patches/server/0765-Add-EntityPortalReadyEvent.patch index 41d4a4e570..99fe9a8280 100644 --- a/patches/server/0765-Add-EntityPortalReadyEvent.patch +++ b/patches/server/0765-Add-EntityPortalReadyEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add EntityPortalReadyEvent diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 007e5fc95dd5cb3973f45fd6a435cc102d133728..06fbea11c20db3a1585b969b1578073821c5b316 100644 +index 319bb4d94f8221e20557c0e0805c581447e2ee57..8b44dc6cfddf77bdfe3684d1cdb15bb9125c4137 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -2832,6 +2832,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0770-Add-and-fix-missing-BlockFadeEvents.patch b/patches/server/0770-Add-and-fix-missing-BlockFadeEvents.patch index 2813257f0f..d164ac2642 100644 --- a/patches/server/0770-Add-and-fix-missing-BlockFadeEvents.patch +++ b/patches/server/0770-Add-and-fix-missing-BlockFadeEvents.patch @@ -10,7 +10,7 @@ potentially waterlogged block states fading. Co-authored-by: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com diff --git a/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java b/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java -index 68978e1629381ada161225c53a236a54deae6481..4a1f2d326c4ece9da717a50b802af86fd9338a0b 100644 +index 6e283e8c3db31f03dd95c94887e647b8d82a3604..1a842694c076d71b14733904c2052183d86d1f5d 100644 --- a/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java +++ b/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java @@ -92,6 +92,11 @@ public class FrogspawnBlock extends Block { @@ -23,7 +23,7 @@ index 68978e1629381ada161225c53a236a54deae6481..4a1f2d326c4ece9da717a50b802af86f + } + // Paper end - Call BlockFadeEvent this.destroyBlock(world, pos); - world.playSound((Player)null, pos, SoundEvents.FROGSPAWN_HATCH, SoundSource.BLOCKS, 1.0F, 1.0F); + world.playSound(null, pos, SoundEvents.FROGSPAWN_HATCH, SoundSource.BLOCKS, 1.0F, 1.0F); this.spawnTadpoles(world, pos, random); diff --git a/src/main/java/net/minecraft/world/level/block/ScaffoldingBlock.java b/src/main/java/net/minecraft/world/level/block/ScaffoldingBlock.java index f660e58badfcc2a90e6dd618428a21bf5ad34969..13ee09f93ec325e416a2b29e3608e870e7f06aed 100644 @@ -39,10 +39,10 @@ index f660e58badfcc2a90e6dd618428a21bf5ad34969..13ee09f93ec325e416a2b29e3608e870 FallingBlockEntity.fall(world, pos, iblockdata1); } else { diff --git a/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java b/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java -index 615ee22b4948d6a4869dc8b2111f48056969dd79..8782b05575e4a8d5e5c667c43808442b81c13f6b 100644 +index 41bc7180d7657d43215fcb283afe1a9ccdd54e9d..1ff0e5c120418c3e5f92326580af7254fb4c699f 100644 --- a/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java +++ b/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java -@@ -61,12 +61,26 @@ public class SnifferEggBlock extends Block { +@@ -60,12 +60,26 @@ public class SnifferEggBlock extends Block { return this.getHatchLevel(state) == 2; } @@ -57,15 +57,15 @@ index 615ee22b4948d6a4869dc8b2111f48056969dd79..8782b05575e4a8d5e5c667c43808442b @Override public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { if (!this.isReadyToHatch(state)) { - world.playSound((Player)null, pos, SoundEvents.SNIFFER_EGG_CRACK, SoundSource.BLOCKS, 0.7F, 0.9F + random.nextFloat() * 0.2F); + world.playSound(null, pos, SoundEvents.SNIFFER_EGG_CRACK, SoundSource.BLOCKS, 0.7F, 0.9F + random.nextFloat() * 0.2F); world.setBlock(pos, state.setValue(HATCH, Integer.valueOf(this.getHatchLevel(state) + 1)), 2); } else { + // Paper start - Call BlockFadeEvent + if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world, pos, state.getFluidState().createLegacyBlock()).isCancelled()) { -+ rescheduleTick(world, pos); ++ this.rescheduleTick(world, pos); + return; + } + // Paper end - Call BlockFadeEvent - world.playSound((Player)null, pos, SoundEvents.SNIFFER_EGG_HATCH, SoundSource.BLOCKS, 0.7F, 0.9F + random.nextFloat() * 0.2F); + world.playSound(null, pos, SoundEvents.SNIFFER_EGG_HATCH, SoundSource.BLOCKS, 0.7F, 0.9F + random.nextFloat() * 0.2F); world.destroyBlock(pos, false); Sniffer sniffer = EntityType.SNIFFER.create(world); diff --git a/patches/server/0776-Fix-plugin-loggers-on-server-shutdown.patch b/patches/server/0776-Fix-plugin-loggers-on-server-shutdown.patch index 4f2b23f29b..a4e678729b 100644 --- a/patches/server/0776-Fix-plugin-loggers-on-server-shutdown.patch +++ b/patches/server/0776-Fix-plugin-loggers-on-server-shutdown.patch @@ -37,7 +37,7 @@ index 0000000000000000000000000000000000000000..c1d3bac79bb8b4796c013ff4472f75dc + } +} diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index ab1f4e62b2ffed99b47ae23cae172f20ed586b27..97dbe5a44d2791c6dee830654c3935f4ac54aad4 100644 +index c2326a72a038526c850b7820faa59618eba6eb88..bfee202e1dc8ea875b9d2b4e8c3b0be3f6d94b26 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -1223,6 +1223,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 79fd521d5c4a8d6acd2b4f946dfdcc7b4e641b75..5fd17014c95e04d50d30e79d6e331a06b238b613 100644 +index 2b7325d3bcea2175ec22a45101f5bbaf29c2231a..09a26622db4bb4b504f735454e2b031f4840b092 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3076,37 +3076,15 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0778-Fire-EntityChangeBlockEvent-in-more-places.patch b/patches/server/0778-Fire-EntityChangeBlockEvent-in-more-places.patch index ce2102d524..87d13244aa 100644 --- a/patches/server/0778-Fire-EntityChangeBlockEvent-in-more-places.patch +++ b/patches/server/0778-Fire-EntityChangeBlockEvent-in-more-places.patch @@ -80,10 +80,10 @@ index a298f511c8a7eb208a0dd63b24ec050848a31476..41a3ca4edf4fa662f2af13efd7b78b56 }); world.levelEvent(3002, blockposition1, -1); diff --git a/src/main/java/net/minecraft/world/item/AxeItem.java b/src/main/java/net/minecraft/world/item/AxeItem.java -index db507638a97b5a33df712c54daff35b21922c0dd..2e75fd06e9e379eb95ebfe55086ffc327706ab2f 100644 +index 596f4c6b69e5a9bd9eeebee60cf49128264727ae..4f8689e8cbc8b6b9f44168126b95cc864a383c9e 100644 --- a/src/main/java/net/minecraft/world/item/AxeItem.java +++ b/src/main/java/net/minecraft/world/item/AxeItem.java -@@ -38,6 +38,11 @@ public class AxeItem extends DiggerItem { +@@ -60,6 +60,11 @@ public class AxeItem extends DiggerItem { return InteractionResult.PASS; } else { ItemStack itemStack = context.getItemInHand(); @@ -112,11 +112,11 @@ index 1977e702f6af39ebf100c1f2f2edc2d1c4d003b0..cfcd1778b5ae66395400221879dde357 Block.pushEntitiesUp(iblockdata, iblockdata1, world, blockposition); world.setBlock(blockposition, iblockdata1, 2); diff --git a/src/main/java/net/minecraft/world/item/HoneycombItem.java b/src/main/java/net/minecraft/world/item/HoneycombItem.java -index 78bdf7c0a058e84cafcd831c6d6f5123c0f168b0..e0cae3b6848af74fefc37a1e3183c501155c4710 100644 +index decabf6fccaca3d1bfeba679ac71677d33315f5e..14d37bf64af719eae3ea154ea7f952cc27712b57 100644 --- a/src/main/java/net/minecraft/world/item/HoneycombItem.java +++ b/src/main/java/net/minecraft/world/item/HoneycombItem.java -@@ -39,6 +39,14 @@ public class HoneycombItem extends Item implements SignApplicator { - return getWaxed(blockState).map((state) -> { +@@ -74,6 +74,14 @@ public class HoneycombItem extends Item implements SignApplicator { + return getWaxed(blockState).map(state -> { Player player = context.getPlayer(); ItemStack itemStack = context.getItemInHand(); + // Paper start - EntityChangeBlockEvent @@ -148,10 +148,10 @@ index 5c62741e3a3854a7f674bfec49758f837f3bb9a0..b93ed2896ebeb8ec75eb3cfb717a740c entityhuman.setItemInHand(context.getHand(), ItemUtils.createFilledResult(itemstack, entityhuman, new ItemStack(Items.GLASS_BOTTLE))); entityhuman.awardStat(Stats.ITEM_USED.get(itemstack.getItem())); diff --git a/src/main/java/net/minecraft/world/item/ShovelItem.java b/src/main/java/net/minecraft/world/item/ShovelItem.java -index 32995cb5efdad0bc34ecacacb78cccd21220ba8d..21212462e6b415e96536a27b2c009d1562f18946 100644 +index 6118bee65c1fe65482db2cd8d1e0e3c2dad4c8f3..9aba0211f37501bbd19b583d22fa83eae32390d9 100644 --- a/src/main/java/net/minecraft/world/item/ShovelItem.java +++ b/src/main/java/net/minecraft/world/item/ShovelItem.java -@@ -36,20 +36,29 @@ public class ShovelItem extends DiggerItem { +@@ -45,20 +45,29 @@ public class ShovelItem extends DiggerItem { Player player = context.getPlayer(); BlockState blockState2 = FLATTENABLES.get(blockState.getBlock()); BlockState blockState3 = null; @@ -163,7 +163,7 @@ index 32995cb5efdad0bc34ecacacb78cccd21220ba8d..21212462e6b415e96536a27b2c009d15 } else if (blockState.getBlock() instanceof CampfireBlock && blockState.getValue(CampfireBlock.LIT)) { + afterAction = () -> { // Paper if (!level.isClientSide()) { - level.levelEvent((Player)null, 1009, blockPos, 0); + level.levelEvent(null, 1009, blockPos, 0); } CampfireBlock.dowse(context.getPlayer(), level, blockPos, blockState); diff --git a/patches/server/0780-Missing-effect-cause.patch b/patches/server/0780-Missing-effect-cause.patch index 6710474f4b..3fcbc0382f 100644 --- a/patches/server/0780-Missing-effect-cause.patch +++ b/patches/server/0780-Missing-effect-cause.patch @@ -18,7 +18,7 @@ index af5db5da4e5b2fd90a5cf0ca3c92e87ba82d4779..b21e180641d17438997a80e5bcb0ec79 @Override diff --git a/src/main/java/net/minecraft/world/item/HoneyBottleItem.java b/src/main/java/net/minecraft/world/item/HoneyBottleItem.java -index c8e783014a6a09d59e85715a7fbf2a5f65201e77..92266e56200815aa88ebf91bc1ff1a440788275d 100644 +index 5d27598d62c1ddfc84bac64228275749ec01cba5..f0061dab24ee5ee94c151483a553db2590108581 100644 --- a/src/main/java/net/minecraft/world/item/HoneyBottleItem.java +++ b/src/main/java/net/minecraft/world/item/HoneyBottleItem.java @@ -28,7 +28,7 @@ public class HoneyBottleItem extends Item { @@ -31,15 +31,15 @@ index c8e783014a6a09d59e85715a7fbf2a5f65201e77..92266e56200815aa88ebf91bc1ff1a44 if (stack.isEmpty()) { diff --git a/src/main/java/net/minecraft/world/item/SuspiciousStewItem.java b/src/main/java/net/minecraft/world/item/SuspiciousStewItem.java -index 8a7ab376a260bd70a799ce182a03450b3916f733..06ef78580de95bfa0e86f307997664e7b3addaea 100644 +index 6322eddcf097572f24216eefdb9b6b5dedf5edbe..4cc05188a4408e076b6babc91dd24f772f0c7d70 100644 --- a/src/main/java/net/minecraft/world/item/SuspiciousStewItem.java +++ b/src/main/java/net/minecraft/world/item/SuspiciousStewItem.java -@@ -66,7 +66,7 @@ public class SuspiciousStewItem extends Item { +@@ -58,7 +58,7 @@ public class SuspiciousStewItem extends Item { + @Override public ItemStack finishUsingItem(ItemStack stack, Level world, LivingEntity user) { ItemStack itemStack = super.finishUsingItem(stack, world, user); - listPotionEffects(itemStack, (effect) -> { -- user.addEffect(effect.createEffectInstance()); -+ user.addEffect(effect.createEffectInstance(), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.FOOD); // Paper - Add missing effect cause - }); +- listPotionEffects(itemStack, effect -> user.addEffect(effect.createEffectInstance())); ++ listPotionEffects(itemStack, effect -> user.addEffect(effect.createEffectInstance(), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.FOOD)); // Paper - Add missing effect cause return user instanceof Player && ((Player)user).getAbilities().instabuild ? itemStack : new ItemStack(Items.BOWL); } + } diff --git a/patches/server/0782-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch b/patches/server/0782-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch index 00601e4c1f..6adc2a884c 100644 --- a/patches/server/0782-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch +++ b/patches/server/0782-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add a consumer parameter to ProjectileSource#launchProjectile diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 6af7796c9505b43b2c4dfe869214b0f56dc71244..2ef22ba88fa65ecddb88f7fceef598f2e7e55e03 100644 +index 5a760234a4604cec289705f1439f03c821bb0aab..9ae20d759965bc9b88b52c15372155ad10bcc199 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -562,8 +562,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { diff --git a/patches/server/0783-Call-BlockPhysicsEvent-more-often.patch b/patches/server/0783-Call-BlockPhysicsEvent-more-often.patch index 3fda4c8065..1839fbe711 100644 --- a/patches/server/0783-Call-BlockPhysicsEvent-more-often.patch +++ b/patches/server/0783-Call-BlockPhysicsEvent-more-often.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Call BlockPhysicsEvent more often diff --git a/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java b/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java -index 7d54abc2553f4b319df4d533a0b689c1807b6102..87db9febbbf53702be0e1e89a95db99e823713e5 100644 +index 457a963ee6ebd3cf5c3831f6660e3850335af49f..106af2b2c7ff72c7549975aef75cdcff8d9a7d97 100644 --- a/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java +++ b/src/main/java/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java @@ -119,7 +119,20 @@ public class CollectingNeighborUpdater implements NeighborUpdater { @@ -28,5 +28,5 @@ index 7d54abc2553f4b319df4d533a0b689c1807b6102..87db9febbbf53702be0e1e89a95db99e + } + // Paper end - Call BlockPhysicsEvent if (this.idx < NeighborUpdater.UPDATE_ORDER.length && NeighborUpdater.UPDATE_ORDER[this.idx] == this.skipDirection) { - ++this.idx; + this.idx++; } diff --git a/patches/server/0786-fix-Jigsaw-block-kicking-user.patch b/patches/server/0786-fix-Jigsaw-block-kicking-user.patch index 3c04241bd6..2e5fd7e357 100644 --- a/patches/server/0786-fix-Jigsaw-block-kicking-user.patch +++ b/patches/server/0786-fix-Jigsaw-block-kicking-user.patch @@ -5,10 +5,10 @@ Subject: [PATCH] fix Jigsaw block kicking user diff --git a/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java -index 72d89e8999825b43a36ed9ee8f4545bde3927690..e2e31d6383c7de4f2eede46987d51978a5692639 100644 +index f39a35f7c6ee61d5d7375e9792957f27e507cf0c..447b0359922011fe12b1bb9628d23a47c9d7dc89 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/JigsawBlockEntity.java -@@ -133,7 +133,12 @@ public class JigsawBlockEntity extends BlockEntity { +@@ -136,7 +136,12 @@ public class JigsawBlockEntity extends BlockEntity { public void generate(ServerLevel world, int maxDepth, boolean keepJigsaws) { BlockPos blockPos = this.getBlockPos().relative(this.getBlockState().getValue(JigsawBlock.ORIENTATION).front()); Registry registry = world.registryAccess().registryOrThrow(Registries.TEMPLATE_POOL); @@ -23,10 +23,10 @@ index 72d89e8999825b43a36ed9ee8f4545bde3927690..e2e31d6383c7de4f2eede46987d51978 } diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/pools/StructureTemplatePool.java b/src/main/java/net/minecraft/world/level/levelgen/structure/pools/StructureTemplatePool.java -index 2c5165835dede1abc07ff508c820f0fe1a1027d0..194864460a5508b6b60f445d6c7923c2ae14a15b 100644 +index c8e41cd51bddfafb3675352ea9ec39188ee91a80..488ddcc22dfb08baedc080326b1531151826a702 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/structure/pools/StructureTemplatePool.java +++ b/src/main/java/net/minecraft/world/level/levelgen/structure/pools/StructureTemplatePool.java -@@ -85,7 +85,13 @@ public class StructureTemplatePool { +@@ -98,7 +98,13 @@ public class StructureTemplatePool { } public StructurePoolElement getRandomTemplate(RandomSource random) { diff --git a/patches/server/0789-Fix-a-bunch-of-vanilla-bugs.patch b/patches/server/0789-Fix-a-bunch-of-vanilla-bugs.patch index 80d7e8f072..4b96d454ab 100644 --- a/patches/server/0789-Fix-a-bunch-of-vanilla-bugs.patch +++ b/patches/server/0789-Fix-a-bunch-of-vanilla-bugs.patch @@ -87,31 +87,31 @@ index 829c72333664da0c06ce04af93ea39bb90ce0b67..b4f7e3ae855cbf48925f0db916501adf this.setSuccess(true); return stack; diff --git a/src/main/java/net/minecraft/server/commands/DeOpCommands.java b/src/main/java/net/minecraft/server/commands/DeOpCommands.java -index 40490d10649e92cf622849f1bb87538102b130c7..797efca662dcc0fe7f4cf0b4b7baa235ea044f1f 100644 +index 0283f26151488d715dc823a0008c9a37ef6740fb..d98447e58233745665f0833196226077d972cc2a 100644 --- a/src/main/java/net/minecraft/server/commands/DeOpCommands.java +++ b/src/main/java/net/minecraft/server/commands/DeOpCommands.java -@@ -34,7 +34,7 @@ public class DeOpCommands { +@@ -35,7 +35,7 @@ public class DeOpCommands { + if (playerList.isOp(gameProfile)) { playerList.deop(gameProfile); - ++i; - source.sendSuccess(() -> { -- return Component.translatable("commands.deop.success", targets.iterator().next().getName()); -+ return Component.translatable("commands.deop.success", gameProfile.getName()); // Paper - fixes MC-253721 - }, true); + i++; +- source.sendSuccess(() -> Component.translatable("commands.deop.success", targets.iterator().next().getName()), true); ++ source.sendSuccess(() -> Component.translatable("commands.deop.success", gameProfile.getName()), true); // Paper - fixes MC-253721 } } + diff --git a/src/main/java/net/minecraft/server/commands/OpCommand.java b/src/main/java/net/minecraft/server/commands/OpCommand.java -index 6cd6d69a20e95e344fc18ab67dc300824537a59b..2e2a7c2cf3081187da817479a9da3eb10f662a6d 100644 +index 6854ca4d4fec2b4fa541c3fabf63787665572609..e7b444a10b244828827b3c66c53465206ea8e0ec 100644 --- a/src/main/java/net/minecraft/server/commands/OpCommand.java +++ b/src/main/java/net/minecraft/server/commands/OpCommand.java -@@ -39,7 +39,7 @@ public class OpCommand { +@@ -46,7 +46,7 @@ public class OpCommand { + if (!playerList.isOp(gameProfile)) { playerList.op(gameProfile); - ++i; - source.sendSuccess(() -> { -- return Component.translatable("commands.op.success", targets.iterator().next().getName()); -+ return Component.translatable("commands.op.success", gameProfile.getName()); // Paper - fixes MC-253721 - }, true); + i++; +- source.sendSuccess(() -> Component.translatable("commands.op.success", targets.iterator().next().getName()), true); ++ source.sendSuccess(() -> Component.translatable("commands.op.success", gameProfile.getName()), true); // Paper - fixes MC-253721 } } + diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java index f2d3dc066b00b685715eb5104234945c41a15f92..43c8f6a0615f392cc560b2259b116cc9d5fba4e7 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -139,7 +139,7 @@ index 57f54e3399f9d2d7fecdae62858d20e50caf7afd..b804941c76582871813ba813b9eef242 if (!list.isEmpty()) { diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index bc95420dcf5d23d028e5df6595899a8712550be8..84792f21cbb727bdb8f72b3574b39c4dad631612 100644 +index c99a672dd2d2e4972e9d4025e10e8863d0af1e6a..d831fb1f66dc38b6c9d3592944f94cc5eeaac864 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -419,14 +419,14 @@ public class ServerPlayer extends Player { @@ -206,12 +206,12 @@ index effe4c4fb37fe13aece70cdef4966047d4719af9..7152674d3f3fb98198585cb5ece2bb88 default SoundEvent getSaddleSoundEvent() { return SoundEvents.HORSE_SADDLE; diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/BegGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/BegGoal.java -index 9a46007245399481fb6e749d95e9e4791e799250..2afca5652541c9166278f8f2590ddb81003ae579 100644 +index 95ec11bfd4df6c53d6a4828f55c621cd08b0e666..f1b28965f6fe785e6e3a24fdb6db6676701338b9 100644 --- a/src/main/java/net/minecraft/world/entity/ai/goal/BegGoal.java +++ b/src/main/java/net/minecraft/world/entity/ai/goal/BegGoal.java -@@ -65,7 +65,7 @@ public class BegGoal extends Goal { +@@ -62,7 +62,7 @@ public class BegGoal extends Goal { private boolean playerHoldingInteresting(Player player) { - for(InteractionHand interactionHand : InteractionHand.values()) { + for (InteractionHand interactionHand : InteractionHand.values()) { ItemStack itemStack = player.getItemInHand(interactionHand); - if (this.wolf.isTame() && itemStack.is(Items.BONE)) { + if (!this.wolf.isTame() && itemStack.is(Items.BONE)) { // Paper - Fix MC-84789 @@ -264,11 +264,11 @@ index 11cc26954b4e97114b59df35a4f9b75a09132e20..0a3f7dcc0e205a85dbaa6dee1fc9ae2c @Override diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/SwellGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/SwellGoal.java -index 19540fd4a7f992888fadb6501d0c8a5a7e71fcf6..e241ae250f4f04a17ef2c583d00b065a4ca56a4c 100644 +index ef71b3ef4444c05b4211de87e1c8ec52cbe3e72a..137ec75ee803789deb7b1ca93dd9369c9af362b9 100644 --- a/src/main/java/net/minecraft/world/entity/ai/goal/SwellGoal.java +++ b/src/main/java/net/minecraft/world/entity/ai/goal/SwellGoal.java @@ -21,6 +21,13 @@ public class SwellGoal extends Goal { - return this.creeper.getSwellDir() > 0 || livingEntity != null && this.creeper.distanceToSqr(livingEntity) < 9.0D; + return this.creeper.getSwellDir() > 0 || livingEntity != null && this.creeper.distanceToSqr(livingEntity) < 9.0; } + // Paper start - Fix MC-179072 @@ -336,15 +336,15 @@ index ab85050a64d4897aff11d0780d8cb26660918ac7..bfb9694087821de206fafe867f207e07 this.getFramedMapId().ifPresent((i) -> { MapItemSavedData worldmap = MapItem.getSavedData(i, this.level()); diff --git a/src/main/java/net/minecraft/world/entity/npc/CatSpawner.java b/src/main/java/net/minecraft/world/entity/npc/CatSpawner.java -index f174094febfdfdc309f1b50877be60bae8a98156..5f407535298a31a34cfe114dd863fd6a9b977707 100644 +index c718cee92522a0d3c0e30eafd09fa8178c7e6e4a..5d1610eddcaf0cf65c726a5438b42e53bab85332 100644 --- a/src/main/java/net/minecraft/world/entity/npc/CatSpawner.java +++ b/src/main/java/net/minecraft/world/entity/npc/CatSpawner.java -@@ -87,8 +87,8 @@ public class CatSpawner implements CustomSpawner { +@@ -83,8 +83,8 @@ public class CatSpawner implements CustomSpawner { if (cat == null) { return 0; } else { + cat.moveTo(pos, 0.0F, 0.0F); // Paper - move up - Fix MC-147659 - cat.finalizeSpawn(world, world.getCurrentDifficultyAt(pos), MobSpawnType.NATURAL, (SpawnGroupData)null, (CompoundTag)null); + cat.finalizeSpawn(world, world.getCurrentDifficultyAt(pos), MobSpawnType.NATURAL, null, null); - cat.moveTo(pos, 0.0F, 0.0F); world.addFreshEntityWithPassengers(cat); return 1; @@ -388,11 +388,11 @@ index b670c0cb3886c99d38a91b5c13aa2cefaae702cf..9599a5f96601030bf7f7cbd3392861d6 // Paper start - Add PlayerChangeBeaconEffectEvent io.papermc.paper.event.player.PlayerChangeBeaconEffectEvent event = new io.papermc.paper.event.player.PlayerChangeBeaconEffectEvent((org.bukkit.entity.Player) this.player.player.getBukkitEntity(), convert(primary), convert(secondary), this.access.getLocation().getBlock()); diff --git a/src/main/java/net/minecraft/world/item/BundleItem.java b/src/main/java/net/minecraft/world/item/BundleItem.java -index 10b0720ce7eed58fa3cd8c8051efa6225f7d73e1..ac0bc87f60c4e1562d1301522183e449558d42f8 100644 +index 1e538c691d867a96a57fec9350b4f663d01f8e93..c4c966c555407b7146053187e2ed16cfb99a2dc9 100644 --- a/src/main/java/net/minecraft/world/item/BundleItem.java +++ b/src/main/java/net/minecraft/world/item/BundleItem.java -@@ -52,7 +52,7 @@ public class BundleItem extends Item { - }); +@@ -49,7 +49,7 @@ public class BundleItem extends Item { + removeOne(stack).ifPresent(removedStack -> add(stack, slot.safeInsert(removedStack))); } else if (itemStack.getItem().canFitInsideContainerItems()) { int i = (64 - getContentWeight(stack)) / getWeight(itemStack); - int j = add(stack, slot.safeTake(itemStack.getCount(), i, player)); @@ -400,7 +400,7 @@ index 10b0720ce7eed58fa3cd8c8051efa6225f7d73e1..ac0bc87f60c4e1562d1301522183e449 if (j > 0) { this.playInsertSound(player); } -@@ -121,7 +121,7 @@ public class BundleItem extends Item { +@@ -120,7 +120,7 @@ public class BundleItem extends Item { int i = getContentWeight(bundle); int j = getWeight(stack); int k = Math.min(stack.getCount(), (64 - i) / j); @@ -410,20 +410,20 @@ index 10b0720ce7eed58fa3cd8c8051efa6225f7d73e1..ac0bc87f60c4e1562d1301522183e449 } else { ListTag listTag = compoundTag.getList("Items", 10); diff --git a/src/main/java/net/minecraft/world/item/SaddleItem.java b/src/main/java/net/minecraft/world/item/SaddleItem.java -index ca6a2b9840c9ade87ec8effab01d4f184fe876b7..43129ecefcc8beccbcf2978f262b1ce8cf49ca43 100644 +index a569b404ece21fa9571e73947334f5aa57a8080c..51d350add4ca1756cb9e364e066bbee7949ffb8c 100644 --- a/src/main/java/net/minecraft/world/item/SaddleItem.java +++ b/src/main/java/net/minecraft/world/item/SaddleItem.java -@@ -18,7 +18,7 @@ public class SaddleItem extends Item { - if (entity instanceof Saddleable saddleable) { - if (entity.isAlive() && !saddleable.isSaddled() && saddleable.isSaddleable()) { - if (!user.level().isClientSide) { -- saddleable.equipSaddle(SoundSource.NEUTRAL); -+ saddleable.equipSaddle(SoundSource.NEUTRAL, stack.copyWithCount(1)); // Paper - Fix saddles losing nbt data - MC-191591 - entity.level().gameEvent(entity, GameEvent.EQUIP, entity.position()); - stack.shrink(1); - } +@@ -17,7 +17,7 @@ public class SaddleItem extends Item { + public InteractionResult interactLivingEntity(ItemStack stack, Player user, LivingEntity entity, InteractionHand hand) { + if (entity instanceof Saddleable saddleable && entity.isAlive() && !saddleable.isSaddled() && saddleable.isSaddleable()) { + if (!user.level().isClientSide) { +- saddleable.equipSaddle(SoundSource.NEUTRAL); ++ saddleable.equipSaddle(SoundSource.NEUTRAL, stack.copyWithCount(1)); // Paper - Fix saddles losing nbt data - MC-191591 + entity.level().gameEvent(entity, GameEvent.EQUIP, entity.position()); + stack.shrink(1); + } diff --git a/src/main/java/net/minecraft/world/level/block/AzaleaBlock.java b/src/main/java/net/minecraft/world/level/block/AzaleaBlock.java -index 6e45582f8ea7dd2a46f58369c5581764538bff0d..3ecc92439fc85d224ff52f41c5e34079e042a5e6 100644 +index 655956f3c50d6a78b0cbfaa23d6a62cd776c1e52..85484d061090d989de8246df81f8e9e5f8906072 100644 --- a/src/main/java/net/minecraft/world/level/block/AzaleaBlock.java +++ b/src/main/java/net/minecraft/world/level/block/AzaleaBlock.java @@ -51,4 +51,11 @@ public class AzaleaBlock extends BushBlock implements BonemealableBlock { diff --git a/patches/server/0794-Add-PlayerInventorySlotChangeEvent.patch b/patches/server/0794-Add-PlayerInventorySlotChangeEvent.patch index 7c9e04e6e8..14f1948d31 100644 --- a/patches/server/0794-Add-PlayerInventorySlotChangeEvent.patch +++ b/patches/server/0794-Add-PlayerInventorySlotChangeEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerInventorySlotChangeEvent diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 84792f21cbb727bdb8f72b3574b39c4dad631612..ecdeaa3f5a793895c3a4584ae7e4594b21087167 100644 +index d831fb1f66dc38b6c9d3592944f94cc5eeaac864..2a1722db668b141705ce47389cd24d0a247e373d 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -330,6 +330,25 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0800-Add-EntityToggleSitEvent.patch b/patches/server/0800-Add-EntityToggleSitEvent.patch index e149e09cf1..2f61a7420e 100644 --- a/patches/server/0800-Add-EntityToggleSitEvent.patch +++ b/patches/server/0800-Add-EntityToggleSitEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add EntityToggleSitEvent diff --git a/src/main/java/net/minecraft/world/entity/TamableAnimal.java b/src/main/java/net/minecraft/world/entity/TamableAnimal.java -index 4d893c445af2b6dc74d5ad731b69eb5a488817b4..e4550d3ac8d93e0dd9a54e41fbbbef2ef9d4f55e 100644 +index 01b91388577b6013d7bd5c9112a03f818fee1f9c..cf5cd0e49c4966e7b636a8ad4dec7a12806c6a4d 100644 --- a/src/main/java/net/minecraft/world/entity/TamableAnimal.java +++ b/src/main/java/net/minecraft/world/entity/TamableAnimal.java -@@ -67,7 +67,7 @@ public abstract class TamableAnimal extends Animal implements OwnableEntity { +@@ -69,7 +69,7 @@ public abstract class TamableAnimal extends Animal implements OwnableEntity { } this.orderedToSit = nbt.getBoolean("Sitting"); diff --git a/patches/server/0806-Fix-EntityCombustEvent-cancellation-cant-fully-preve.patch b/patches/server/0806-Fix-EntityCombustEvent-cancellation-cant-fully-preve.patch index 9908d15463..e1712bed3b 100644 --- a/patches/server/0806-Fix-EntityCombustEvent-cancellation-cant-fully-preve.patch +++ b/patches/server/0806-Fix-EntityCombustEvent-cancellation-cant-fully-preve.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Fix EntityCombustEvent cancellation cant fully prevent diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 06fbea11c20db3a1585b969b1578073821c5b316..3778d900c272a815e67f79c6d2827be2bbe8195f 100644 +index 8b44dc6cfddf77bdfe3684d1cdb15bb9125c4137..640d7f248e3696b73ef8d7668358a78037081320 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -3111,6 +3111,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0813-check-global-player-list-where-appropriate.patch b/patches/server/0813-check-global-player-list-where-appropriate.patch index 9905886fc6..bf8f80fdbd 100644 --- a/patches/server/0813-check-global-player-list-where-appropriate.patch +++ b/patches/server/0813-check-global-player-list-where-appropriate.patch @@ -24,7 +24,7 @@ index b5eda9931a82a667c25ca1a49980b01b042dc0cc..5f1a4a35d2179b7ff5a95390f82d65ca + // Paper end - check global player list where appropriate } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 5fd17014c95e04d50d30e79d6e331a06b238b613..4959d8fd8f84f99f289b898fd604d8a9808d62a4 100644 +index 09a26622db4bb4b504f735454e2b031f4840b092..b19b5b8678ce2fb912b703382ae79f5755e025e7 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3698,7 +3698,7 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -50,10 +50,10 @@ index d4ac3e566b47cfc8688bcc2ab08385b6de4693f8..7de9d012e7416eaa0189b513a0972c84 if (entityhuman instanceof ServerPlayer) { CriteriaTriggers.CURED_ZOMBIE_VILLAGER.trigger((ServerPlayer) entityhuman, this, entityvillager); diff --git a/src/main/java/net/minecraft/world/level/EntityGetter.java b/src/main/java/net/minecraft/world/level/EntityGetter.java -index e7b6f97d8519a5797903664e5ba2a793e37a4bfc..57d4d2014f33a2f069d6c5aaa8e87e36b63a7177 100644 +index d465fb01af4c8610f83ecb9c68b83127cf7e95ae..bd20bea7f76a7307f1698fb2dfef37125032d166 100644 --- a/src/main/java/net/minecraft/world/level/EntityGetter.java +++ b/src/main/java/net/minecraft/world/level/EntityGetter.java -@@ -231,4 +231,11 @@ public interface EntityGetter { +@@ -237,4 +237,11 @@ public interface EntityGetter { return null; } @@ -66,10 +66,10 @@ index e7b6f97d8519a5797903664e5ba2a793e37a4bfc..57d4d2014f33a2f069d6c5aaa8e87e36 + // Paper end - check global player list where appropriate } diff --git a/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java -index e143f42e71ac774d49b75e6d85591aa1189ee210..c27b97e9f097c824de7c785b4cc9e0a503259b08 100644 +index d71a9fb54269f7c7e251e0e3bdd8b5a072af5201..a2ab5291605a3a3c4fda067c23da7d9aafe1cc38 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java -@@ -100,6 +100,13 @@ public class SculkShriekerBlockEntity extends BlockEntity implements GameEventLi +@@ -97,6 +97,13 @@ public class SculkShriekerBlockEntity extends BlockEntity implements GameEventLi @Nullable public static ServerPlayer tryGetPlayer(@Nullable Entity entity) { @@ -80,6 +80,6 @@ index e143f42e71ac774d49b75e6d85591aa1189ee210..c27b97e9f097c824de7c785b4cc9e0a5 + @Nullable + private static ServerPlayer tryGetPlayer0(@Nullable Entity entity) { + // Paper end - check global player list where appropriate - if (entity instanceof ServerPlayer serverPlayer) { - return serverPlayer; + if (entity instanceof ServerPlayer) { + return (ServerPlayer)entity; } else { diff --git a/patches/server/0816-Friction-API.patch b/patches/server/0816-Friction-API.patch index 7da72213c7..691571962d 100644 --- a/patches/server/0816-Friction-API.patch +++ b/patches/server/0816-Friction-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Friction API diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 0708502b46ec55d533c7d890b892a57779678854..834607dde3841105b3524b43f59380296924862a 100644 +index b19b5b8678ce2fb912b703382ae79f5755e025e7..084d988ec3dcdae54a10309d34d335ca4f37b7b0 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -262,6 +262,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0819-Sync-offhand-slot-in-menus.patch b/patches/server/0819-Sync-offhand-slot-in-menus.patch index 19c9999a04..5b34f7caeb 100644 --- a/patches/server/0819-Sync-offhand-slot-in-menus.patch +++ b/patches/server/0819-Sync-offhand-slot-in-menus.patch @@ -8,7 +8,7 @@ offhand slot isn't sent. This is not correct because you *can* put stuff into th by pressing the offhand swap item diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index ecdeaa3f5a793895c3a4584ae7e4594b21087167..d4930c40f03c5f331847bf52736c563a688d7daf 100644 +index 2a1722db668b141705ce47389cd24d0a247e373d..406794c439900a0d86fd4fe67d05a98bde625aec 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -299,6 +299,13 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0820-Player-Entity-Tracking-Events.patch b/patches/server/0820-Player-Entity-Tracking-Events.patch index bcba3dec8b..7ec91ddd19 100644 --- a/patches/server/0820-Player-Entity-Tracking-Events.patch +++ b/patches/server/0820-Player-Entity-Tracking-Events.patch @@ -21,7 +21,7 @@ index 43c8f6a0615f392cc560b2259b116cc9d5fba4e7..ca24463405f138deb882f319bf84696f } else if (this.seenBy.remove(player.connection)) { this.serverEntity.removePairing(player); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 3778d900c272a815e67f79c6d2827be2bbe8195f..cce640b055932e2fe26800107ad699743324ee4f 100644 +index 640d7f248e3696b73ef8d7668358a78037081320..96a1f1460daba1507659a8ed34b608ded7084c0f 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -3837,7 +3837,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0822-Fixes-and-additions-to-the-SpawnReason-API.patch b/patches/server/0822-Fixes-and-additions-to-the-SpawnReason-API.patch index 56f1ab09f3..cf7adab315 100644 --- a/patches/server/0822-Fixes-and-additions-to-the-SpawnReason-API.patch +++ b/patches/server/0822-Fixes-and-additions-to-the-SpawnReason-API.patch @@ -34,28 +34,28 @@ index 58723ea75f7db9bf3889b99139669b14a284a3a1..6bf11d526b82403e9a5443ac77645cf2 this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause } diff --git a/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java b/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java -index 4a1f2d326c4ece9da717a50b802af86fd9338a0b..94618709e742ebe1a7893d418124e309eaab6c5f 100644 +index cbd49f8e870e903bafc3dd55c3ae7f4cc3703b15..e248444632a8f917b0eb2426aa59ae2c0ecaa925 100644 --- a/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java +++ b/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java @@ -117,7 +117,7 @@ public class FrogspawnBlock extends Block { int k = random.nextInt(1, 361); - tadpole.moveTo(d, (double)pos.getY() - 0.5D, e, (float)k, 0.0F); + tadpole.moveTo(d, pos.getY() - 0.5, e, k, 0.0F); tadpole.setPersistenceRequired(); - world.addFreshEntity(tadpole); + world.addFreshEntity(tadpole, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.EGG); // Paper - use correct spawn reason } } - + } diff --git a/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java b/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java -index 8782b05575e4a8d5e5c667c43808442b81c13f6b..6d073e82daf41e35b63703ab9bce8c576862eb3e 100644 +index 1ff0e5c120418c3e5f92326580af7254fb4c699f..9766a919f85abfd52497ecd6d2e2002d3de8051d 100644 --- a/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java +++ b/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java -@@ -88,7 +88,7 @@ public class SnifferEggBlock extends Block { +@@ -87,7 +87,7 @@ public class SnifferEggBlock extends Block { Vec3 vec3 = pos.getCenter(); sniffer.setBaby(true); sniffer.moveTo(vec3.x(), vec3.y(), vec3.z(), Mth.wrapDegrees(world.random.nextFloat() * 360.0F), 0.0F); - world.addFreshEntity(sniffer); + world.addFreshEntity(sniffer, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.EGG); // Paper - use correct spawn reason } - } + } diff --git a/patches/server/0824-Improve-inlining-for-some-hot-BlockBehavior-and-Flui.patch b/patches/server/0824-Improve-inlining-for-some-hot-BlockBehavior-and-Flui.patch index 0394a26686..8b39f81526 100644 --- a/patches/server/0824-Improve-inlining-for-some-hot-BlockBehavior-and-Flui.patch +++ b/patches/server/0824-Improve-inlining-for-some-hot-BlockBehavior-and-Flui.patch @@ -52,7 +52,7 @@ index c7b6377aafd32f67eb8ba4dedd7cce5841b2d58d..e57e3a26b0fb856e1ab693df5783fe8b } diff --git a/src/main/java/net/minecraft/world/level/material/FluidState.java b/src/main/java/net/minecraft/world/level/material/FluidState.java -index ea2a04e5298832177fac93568656ac45784d5eb6..c5d1e4e293d15831f9b550b9964dc190763956b6 100644 +index 3e8619f536a5cc4b8c9c10cf8454e38abdb7b721..f20398eab05797d1b23b71cf74076d6382022657 100644 --- a/src/main/java/net/minecraft/world/level/material/FluidState.java +++ b/src/main/java/net/minecraft/world/level/material/FluidState.java @@ -25,9 +25,11 @@ public final class FluidState extends StateHolder { diff --git a/patches/server/0827-Add-Sneaking-API-for-Entities.patch b/patches/server/0827-Add-Sneaking-API-for-Entities.patch index 3c82fcadf9..7ab8bbe768 100644 --- a/patches/server/0827-Add-Sneaking-API-for-Entities.patch +++ b/patches/server/0827-Add-Sneaking-API-for-Entities.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add Sneaking API for Entities diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 254df37281a358cc0ac99b46f34daf2fd9774d5a..b4ed7612a019a3d4d473dfbfed2067ea437fee06 100644 +index f6d6b2c7aefc39a6e6e2b0e61fd9afb334bee764..4dfbcaba4615bd761c1eb9d5994168c7202fc571 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -872,6 +872,18 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { diff --git a/patches/server/0828-Improve-logging-and-errors.patch b/patches/server/0828-Improve-logging-and-errors.patch index fe00d91a4b..d5774cbd4f 100644 --- a/patches/server/0828-Improve-logging-and-errors.patch +++ b/patches/server/0828-Improve-logging-and-errors.patch @@ -65,12 +65,12 @@ index b8f1549d1ea98a105577927a735bab331aff3840..45a68beff0c97ead5e9f1201b5fb9ef8 } diff --git a/src/main/java/net/minecraft/server/packs/PathPackResources.java b/src/main/java/net/minecraft/server/packs/PathPackResources.java -index 89aa86a49eda563c82ccedc99641e699f8e578b0..3edd14ce90edf98798b89921ad18547809de5d2c 100644 +index 87928500f40ceeaad6669de194d2c80089051e60..8d554e7bb1291ac24a958a92458f993344e3be3b 100644 --- a/src/main/java/net/minecraft/server/packs/PathPackResources.java +++ b/src/main/java/net/minecraft/server/packs/PathPackResources.java -@@ -108,6 +108,12 @@ public class PathPackResources extends AbstractPackResources { +@@ -102,6 +102,12 @@ public class PathPackResources extends AbstractPackResources { try (DirectoryStream directoryStream = Files.newDirectoryStream(path)) { - for(Path path2 : directoryStream) { + for (Path path2 : directoryStream) { String string = path2.getFileName().toString(); + // Paper start - Improve logging and errors + if (!Files.isDirectory(path2)) { diff --git a/patches/server/0829-Improve-PortalEvents.patch b/patches/server/0829-Improve-PortalEvents.patch index 5ba3f4895a..eb9278ff7b 100644 --- a/patches/server/0829-Improve-PortalEvents.patch +++ b/patches/server/0829-Improve-PortalEvents.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Improve PortalEvents diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index cce640b055932e2fe26800107ad699743324ee4f..66266651194cca02bf3814594e6f43b77741808c 100644 +index 96a1f1460daba1507659a8ed34b608ded7084c0f..99035a91f04cc838e30b860d480ef710e1dbe2ea 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -3495,7 +3495,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0835-Expose-pre-collision-moving-velocity-to-VehicleBlock.patch b/patches/server/0835-Expose-pre-collision-moving-velocity-to-VehicleBlock.patch index b9fa911513..1cb4410623 100644 --- a/patches/server/0835-Expose-pre-collision-moving-velocity-to-VehicleBlock.patch +++ b/patches/server/0835-Expose-pre-collision-moving-velocity-to-VehicleBlock.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Expose pre-collision moving velocity to diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 66266651194cca02bf3814594e6f43b77741808c..cf2d4d56dfebeae2baa0712683102b163bdaa9ce 100644 +index 99035a91f04cc838e30b860d480ef710e1dbe2ea..9eecdc0a6fb111fb36e4e8e8666d056563e48cda 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -957,6 +957,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0838-Correctly-shrink-items-during-EntityResurrectEvent.patch b/patches/server/0838-Correctly-shrink-items-during-EntityResurrectEvent.patch index 6aeabf242c..54b162da71 100644 --- a/patches/server/0838-Correctly-shrink-items-during-EntityResurrectEvent.patch +++ b/patches/server/0838-Correctly-shrink-items-during-EntityResurrectEvent.patch @@ -22,7 +22,7 @@ This patch corrects this behaviour by only shrinking the item if a totem of undying was found and the event was called uncancelled. diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 8e6cb47ce314d4c493047fa1804b2da8c9797fac..d9f9a184e22bc02fbfd1ab029abf48af654c9935 100644 +index 084d988ec3dcdae54a10309d34d335ca4f37b7b0..c022ec61fa6a84f4e68f4df0a0f07ba8bb368302 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -1618,7 +1618,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0843-Fix-MC-157464-Prevent-sleeping-villagers-moving-towa.patch b/patches/server/0843-Fix-MC-157464-Prevent-sleeping-villagers-moving-towa.patch index efaf1a6e90..8bd2fa8c91 100644 --- a/patches/server/0843-Fix-MC-157464-Prevent-sleeping-villagers-moving-towa.patch +++ b/patches/server/0843-Fix-MC-157464-Prevent-sleeping-villagers-moving-towa.patch @@ -10,15 +10,15 @@ https://bugs.mojang.com/browse/MC-157464 https://github.com/PaperMC/Paper/issues/8569 diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/VillagerGoalPackages.java b/src/main/java/net/minecraft/world/entity/ai/behavior/VillagerGoalPackages.java -index 9400556aca4cd06ad311975d74a9e7eb2ccd9c73..cd7a90ec1073b2b452ca70decefe6a594445003b 100644 +index 28b255b425d2ac4d13b85a7fce67406ea3b6fdae..458cfece2c0ce94f0017aa94ed6f1a356861ec31 100644 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/VillagerGoalPackages.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/VillagerGoalPackages.java -@@ -22,7 +22,7 @@ public class VillagerGoalPackages { - private static final float STROLL_SPEED_MODIFIER = 0.4F; - - public static ImmutableList>> getCorePackage(VillagerProfession profession, float speed) { -- return ImmutableList.of(Pair.of(0, new Swim(0.8F)), Pair.of(0, InteractWithDoor.create()), Pair.of(0, new LookAtTargetSink(45, 90)), Pair.of(0, new VillagerPanicTrigger()), Pair.of(0, WakeUp.create()), Pair.of(0, ReactToBell.create()), Pair.of(0, SetRaidStatus.create()), Pair.of(0, ValidateNearbyPoi.create(profession.heldJobSite(), MemoryModuleType.JOB_SITE)), Pair.of(0, ValidateNearbyPoi.create(profession.acquirableJobSite(), MemoryModuleType.POTENTIAL_JOB_SITE)), Pair.of(1, new MoveToTargetSink()), Pair.of(2, PoiCompetitorScan.create()), Pair.of(3, new LookAndFollowTradingPlayerSink(speed)), Pair.of(5, GoToWantedItem.create(speed, false, 4)), Pair.of(6, AcquirePoi.create(profession.acquirableJobSite(), MemoryModuleType.JOB_SITE, MemoryModuleType.POTENTIAL_JOB_SITE, true, Optional.empty())), Pair.of(7, new GoToPotentialJobSite(speed)), Pair.of(8, YieldJobSite.create(speed)), Pair.of(10, AcquirePoi.create((poiType) -> { -+ return ImmutableList.of(Pair.of(0, new Swim(0.8F)), Pair.of(0, InteractWithDoor.create()), Pair.of(0, new LookAtTargetSink(45, 90)), Pair.of(0, new VillagerPanicTrigger()), Pair.of(0, WakeUp.create()), Pair.of(0, ReactToBell.create()), Pair.of(0, SetRaidStatus.create()), Pair.of(0, ValidateNearbyPoi.create(profession.heldJobSite(), MemoryModuleType.JOB_SITE)), Pair.of(0, ValidateNearbyPoi.create(profession.acquirableJobSite(), MemoryModuleType.POTENTIAL_JOB_SITE)), Pair.of(1, new MoveToTargetSink()), Pair.of(2, PoiCompetitorScan.create()), Pair.of(3, new LookAndFollowTradingPlayerSink(speed)), Pair.of(5, GoToWantedItem.create(villager -> !villager.isSleeping(), speed, false, 4)), Pair.of(6, AcquirePoi.create(profession.acquirableJobSite(), MemoryModuleType.JOB_SITE, MemoryModuleType.POTENTIAL_JOB_SITE, true, Optional.empty())), Pair.of(7, new GoToPotentialJobSite(speed)), Pair.of(8, YieldJobSite.create(speed)), Pair.of(10, AcquirePoi.create((poiType) -> { // Paper - Fix MC-157464 - return poiType.is(PoiTypes.HOME); - }, MemoryModuleType.HOME, false, Optional.of((byte)14))), Pair.of(10, AcquirePoi.create((poiType) -> { - return poiType.is(PoiTypes.MEETING); +@@ -35,7 +35,7 @@ public class VillagerGoalPackages { + Pair.of(1, new MoveToTargetSink()), + Pair.of(2, PoiCompetitorScan.create()), + Pair.of(3, new LookAndFollowTradingPlayerSink(speed)), +- Pair.of(5, GoToWantedItem.create(speed, false, 4)), ++ Pair.of(5, GoToWantedItem.create(villager -> !villager.isSleeping(), speed, false, 4)), // Paper - Fix MC-157464 + Pair.of( + 6, AcquirePoi.create(profession.acquirableJobSite(), MemoryModuleType.JOB_SITE, MemoryModuleType.POTENTIAL_JOB_SITE, true, Optional.empty()) + ), diff --git a/patches/server/0844-Add-EntityFertilizeEggEvent.patch b/patches/server/0844-Add-EntityFertilizeEggEvent.patch index 1cd60bd301..975cf31634 100644 --- a/patches/server/0844-Add-EntityFertilizeEggEvent.patch +++ b/patches/server/0844-Add-EntityFertilizeEggEvent.patch @@ -29,19 +29,19 @@ index cfc0cee09dfd522409bb5853fc96528bd0137475..6a98f66b7701e8af389ca9a1e9eb230a } diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java -index 90e4e0ec0c7b0ece23c4b53f5f12b1f24e1c18ad..295769d039f2a1e4f48912a60f9dbe267d8992c1 100644 +index 70bbc325e3a1f7f334a6d1024097800efa6bec03..a03fb7aa9f4528f4885db88eaf480202d5f54750 100644 --- a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java +++ b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java -@@ -239,7 +239,12 @@ public class Frog extends Animal implements VariantHolder { +@@ -263,7 +263,12 @@ public class Frog extends Animal implements VariantHolder { @Override public void spawnChildFromBreeding(ServerLevel world, Animal other) { -- this.finalizeSpawnChildFromBreeding(world, other, (AgeableMob)null); +- this.finalizeSpawnChildFromBreeding(world, other, null); + // Paper start - Add EntityFertilizeEggEvent event + final io.papermc.paper.event.entity.EntityFertilizeEggEvent result = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityFertilizeEggEvent(this, other); + if (result.isCancelled()) return; + -+ this.finalizeSpawnChildFromBreeding(world, other, (AgeableMob)null, result.getExperience()); // Paper - use craftbukkit call that takes experience amount ++ this.finalizeSpawnChildFromBreeding(world, other, null, result.getExperience()); // Paper - use craftbukkit call that takes experience amount + // Paper end - Add EntityFertilizeEggEvent event this.getBrain().setMemory(MemoryModuleType.IS_PREGNANT, Unit.INSTANCE); } diff --git a/patches/server/0848-Fix-advancement-triggers-for-entity-damage.patch b/patches/server/0848-Fix-advancement-triggers-for-entity-damage.patch index be0a156199..e5b6bd4878 100644 --- a/patches/server/0848-Fix-advancement-triggers-for-entity-damage.patch +++ b/patches/server/0848-Fix-advancement-triggers-for-entity-damage.patch @@ -23,7 +23,7 @@ index f054d67a637b204de604fadc0d321f5c9816d808..fc5f1e1b445f0a55a35a31d58a90920a return !this.getResponse(); diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index bd8d1e90ea6d2f6d3b625f6d264c12cb3ea009e8..e2564a07e0aa4bf2fcd9a749e9fc188dd0633675 100644 +index c022ec61fa6a84f4e68f4df0a0f07ba8bb368302..09a48779046484c2f3628d1499659e247c736fce 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -2322,7 +2322,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0849-Fix-text-display-error-on-spawn.patch b/patches/server/0849-Fix-text-display-error-on-spawn.patch index 7074ea7170..5ee377452f 100644 --- a/patches/server/0849-Fix-text-display-error-on-spawn.patch +++ b/patches/server/0849-Fix-text-display-error-on-spawn.patch @@ -5,15 +5,15 @@ Subject: [PATCH] Fix text display error on spawn diff --git a/src/main/java/net/minecraft/world/entity/Display.java b/src/main/java/net/minecraft/world/entity/Display.java -index dcbaa06f807ba3c1b64c96b3c2dd84d46d6be751..2ecd3ed5b36475125c6f63af2612011fc8fba8a5 100644 +index 4a9aad128c884d659f42f5d6b35e2d7147c4bc17..bba45aa7ba4fa578344ec2b9dfa552097770a59f 100644 --- a/src/main/java/net/minecraft/world/entity/Display.java +++ b/src/main/java/net/minecraft/world/entity/Display.java -@@ -864,7 +864,7 @@ public abstract class Display extends Entity { - byte b = loadFlag((byte)0, nbt, "shadow", (byte)1); - b = loadFlag(b, nbt, "see_through", (byte)2); +@@ -899,7 +899,7 @@ public abstract class Display extends Entity { b = loadFlag(b, nbt, "default_background", (byte)4); -- Optional optional = Display.TextDisplay.Align.CODEC.decode(NbtOps.INSTANCE, nbt.get("alignment")).resultOrPartial(Util.prefix("Display entity", Display.LOGGER::error)).map(Pair::getFirst); -+ Optional optional = Display.TextDisplay.Align.CODEC.decode(NbtOps.INSTANCE, nbt.get("alignment")).result().map(Pair::getFirst); // Paper - Hide text display error on spawn + Optional optional = Display.TextDisplay.Align.CODEC + .decode(NbtOps.INSTANCE, nbt.get("alignment")) +- .resultOrPartial(Util.prefix("Display entity", Display.LOGGER::error)) ++ .result() // Paper - Hide text display error on spawn + .map(Pair::getFirst); if (optional.isPresent()) { - byte var10000; - switch ((Display.TextDisplay.Align)optional.get()) { + b = switch ((Display.TextDisplay.Align)optional.get()) { diff --git a/patches/server/0856-Prevent-causing-expired-keys-from-impacting-new-join.patch b/patches/server/0856-Prevent-causing-expired-keys-from-impacting-new-join.patch index 3649dc015b..c23be58240 100644 --- a/patches/server/0856-Prevent-causing-expired-keys-from-impacting-new-join.patch +++ b/patches/server/0856-Prevent-causing-expired-keys-from-impacting-new-join.patch @@ -5,24 +5,26 @@ Subject: [PATCH] Prevent causing expired keys from impacting new joins diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundPlayerInfoUpdatePacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundPlayerInfoUpdatePacket.java -index 0e54e8faa48751a651b953bec72543a94edf74bc..d43106eb89b14667e85cd6e8fa047d64f2e8ec87 100644 +index e4f0949b6538734ff25daf68a428262481feeb81..754a2a5e958a04b3f8bf216b6022f547aa1cd36f 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundPlayerInfoUpdatePacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundPlayerInfoUpdatePacket.java -@@ -96,7 +96,13 @@ public class ClientboundPlayerInfoUpdatePacket implements Packet { - serialized.chatSession = buf.readNullable(RemoteChatSession.Data::read); - }, (buf, entry) -> { -- buf.writeNullable(entry.chatSession, RemoteChatSession.Data::write); -+ // Paper start - Prevent causing expired keys from impacting new joins -+ RemoteChatSession.Data chatSession = entry.chatSession; -+ if (chatSession != null && chatSession.profilePublicKey().hasExpired()) { -+ chatSession = null; -+ } -+ buf.writeNullable(chatSession, RemoteChatSession.Data::write); -+ // Paper end - Prevent causing expired keys from impacting new joins +@@ -101,7 +101,15 @@ public class ClientboundPlayerInfoUpdatePacket implements Packet { - serialized.gameMode = GameType.byId(buf.readVarInt()); + INITIALIZE_CHAT( + (serialized, buf) -> serialized.chatSession = buf.readNullable(RemoteChatSession.Data::read), +- (buf, entry) -> buf.writeNullable(entry.chatSession, RemoteChatSession.Data::write) ++ // Paper start - Prevent causing expired keys from impacting new joins ++ (buf, entry) -> { ++ RemoteChatSession.Data chatSession = entry.chatSession; ++ if (chatSession != null && chatSession.profilePublicKey().hasExpired()) { ++ chatSession = null; ++ } ++ buf.writeNullable(chatSession, RemoteChatSession.Data::write); ++ } ++ // Paper end - Prevent causing expired keys from impacting new joins + ), + UPDATE_GAME_MODE((serialized, buf) -> serialized.gameMode = GameType.byId(buf.readVarInt()), (buf, entry) -> buf.writeVarInt(entry.gameMode().getId())), + UPDATE_LISTED((serialized, buf) -> serialized.listed = buf.readBoolean(), (buf, entry) -> buf.writeBoolean(entry.listed())), diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java index c9dab47fe3db73b31b40e071d37f1be63401c19d..69118af2a873f23f6543676db39263bfeb81b4f1 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/patches/server/0863-Avoid-Lazy-Initialization-for-Enum-Fields.patch b/patches/server/0863-Avoid-Lazy-Initialization-for-Enum-Fields.patch index 346c3fd86c..112f2214ae 100644 --- a/patches/server/0863-Avoid-Lazy-Initialization-for-Enum-Fields.patch +++ b/patches/server/0863-Avoid-Lazy-Initialization-for-Enum-Fields.patch @@ -7,18 +7,18 @@ This patch is meant to get rid of any instances of lazy initialization that Mine This has the possibility to create race condition issues, and generally don't make sense to be lazily done anyways. diff --git a/src/main/java/com/mojang/math/OctahedralGroup.java b/src/main/java/com/mojang/math/OctahedralGroup.java -index a5a889d40228a0d6c7259caf8cb2554588d9aaf9..5009192046e5e083d14cef3f448b98b978dd54bf 100644 +index 8af12b383bb80d1c0a12e1151030ab6e21c27e79..d2efe5e4f767f8316bc3915573bd1efcbcf20968 100644 --- a/src/main/java/com/mojang/math/OctahedralGroup.java +++ b/src/main/java/com/mojang/math/OctahedralGroup.java -@@ -111,6 +111,7 @@ public enum OctahedralGroup implements StringRepresentable { +@@ -110,6 +110,7 @@ public enum OctahedralGroup implements StringRepresentable { this.permutation = axisTransformation; - this.transformation = (new Matrix3f()).scaling(flipX ? -1.0F : 1.0F, flipY ? -1.0F : 1.0F, flipZ ? -1.0F : 1.0F); + this.transformation = new Matrix3f().scaling(flipX ? -1.0F : 1.0F, flipY ? -1.0F : 1.0F, flipZ ? -1.0F : 1.0F); this.transformation.mul(axisTransformation.transformation()); + this.initializeRotationDirections(); // Paper - Avoid Lazy Initialization for Enum Fields } private BooleanList packInversions() { -@@ -139,7 +140,7 @@ public enum OctahedralGroup implements StringRepresentable { +@@ -138,7 +139,7 @@ public enum OctahedralGroup implements StringRepresentable { return this.name; } @@ -27,7 +27,7 @@ index a5a889d40228a0d6c7259caf8cb2554588d9aaf9..5009192046e5e083d14cef3f448b98b9 if (this.rotatedDirections == null) { this.rotatedDirections = Maps.newEnumMap(Direction.class); Direction.Axis[] axiss = Direction.Axis.values(); -@@ -154,6 +155,10 @@ public enum OctahedralGroup implements StringRepresentable { +@@ -153,6 +154,10 @@ public enum OctahedralGroup implements StringRepresentable { } } diff --git a/patches/server/0865-Fix-concurrenct-access-to-lookups-field-in-RegistryO.patch b/patches/server/0865-Fix-concurrenct-access-to-lookups-field-in-RegistryO.patch index 01fcd2b852..54ad4f456c 100644 --- a/patches/server/0865-Fix-concurrenct-access-to-lookups-field-in-RegistryO.patch +++ b/patches/server/0865-Fix-concurrenct-access-to-lookups-field-in-RegistryO.patch @@ -11,12 +11,12 @@ more than one Netty IO thread. Fixes https://github.com/PaperMC/Folia/issues/11 diff --git a/src/main/java/net/minecraft/resources/RegistryOps.java b/src/main/java/net/minecraft/resources/RegistryOps.java -index 7709eeac907c4895a264cec0a3d453aa8b194c18..c7cfc3ca58f9439142fe5828117f6d576d7df10e 100644 +index 3dc8333a5c17926679c79d5294a0e72199801c34..fafecd2f5aefd5e6fdc2b0c3674378f03f4dc4f2 100644 --- a/src/main/java/net/minecraft/resources/RegistryOps.java +++ b/src/main/java/net/minecraft/resources/RegistryOps.java -@@ -19,11 +19,14 @@ public class RegistryOps extends DelegatingOps { +@@ -19,7 +19,10 @@ public class RegistryOps extends DelegatingOps { - private static RegistryOps.RegistryInfoLookup memoizeLookup(final RegistryOps.RegistryInfoLookup registryInfoGetter) { + private static RegistryOps.RegistryInfoLookup memoizeLookup(RegistryOps.RegistryInfoLookup registryInfoGetter) { return new RegistryOps.RegistryInfoLookup() { - private final Map>, Optional>> lookups = new HashMap<>(); + // The concurrent access occurs on the Netty IO threads when serializing packets. @@ -26,8 +26,3 @@ index 7709eeac907c4895a264cec0a3d453aa8b194c18..c7cfc3ca58f9439142fe5828117f6d57 @Override public Optional> lookup(ResourceKey> registryRef) { -- return this.lookups.computeIfAbsent(registryRef, registryInfoGetter::lookup); -+ return (Optional>)this.lookups.computeIfAbsent(registryRef, registryInfoGetter::lookup); // Paper - fix concurrent access to lookups field - } - }; - } diff --git a/patches/server/0867-Refresh-ProjectileSource-for-projectiles.patch b/patches/server/0867-Refresh-ProjectileSource-for-projectiles.patch index 1dabec492f..2041ea7689 100644 --- a/patches/server/0867-Refresh-ProjectileSource-for-projectiles.patch +++ b/patches/server/0867-Refresh-ProjectileSource-for-projectiles.patch @@ -14,7 +14,7 @@ clearing the owner. Co-authored-by: Warrior <50800980+Warriorrrr@users.noreply.github.com> diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index cf2d4d56dfebeae2baa0712683102b163bdaa9ce..0479dbdf0da7a06735ee08d068ead5fa12fc9860 100644 +index 9eecdc0a6fb111fb36e4e8e8666d056563e48cda..ee9ab1abbed298138e48c659481e03c01ac5940a 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -384,6 +384,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0871-Call-BlockGrowEvent-for-missing-blocks.patch b/patches/server/0871-Call-BlockGrowEvent-for-missing-blocks.patch index 9054b42b6b..4938d57d18 100644 --- a/patches/server/0871-Call-BlockGrowEvent-for-missing-blocks.patch +++ b/patches/server/0871-Call-BlockGrowEvent-for-missing-blocks.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Call BlockGrowEvent for missing blocks Call the event for pitcher crops and sniffer egg diff --git a/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java b/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java -index 591f32f7c0a7a9c843933d17dad8a34b672f49ac..d20c009baf69d083bf8a14000028991b6518cd50 100644 +index d06e3892cf42723f8e3f621b5497c5348fa1a715..5f1ec3f69295760b7b8097916c82cbf9ddd49700 100644 --- a/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java +++ b/src/main/java/net/minecraft/world/level/block/PitcherCropBlock.java -@@ -130,7 +130,7 @@ public class PitcherCropBlock extends DoublePlantBlock implements BonemealableBl +@@ -133,7 +133,7 @@ public class PitcherCropBlock extends DoublePlantBlock implements BonemealableBl int i = Math.min(state.getValue(AGE) + amount, 4); if (this.canGrow(world, pos, state, i)) { BlockState blockState = state.setValue(AGE, Integer.valueOf(i)); @@ -19,20 +19,20 @@ index 591f32f7c0a7a9c843933d17dad8a34b672f49ac..d20c009baf69d083bf8a14000028991b world.setBlock(pos.above(), blockState.setValue(HALF, DoubleBlockHalf.UPPER), 3); } diff --git a/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java b/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java -index 6d073e82daf41e35b63703ab9bce8c576862eb3e..7be4e32a4409b539839a480ef83750ed4b5359a6 100644 +index 9766a919f85abfd52497ecd6d2e2002d3de8051d..4f1ff12df44756b63e3c3f9fc43e7ea485df6f57 100644 --- a/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java +++ b/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java -@@ -72,8 +72,13 @@ public class SnifferEggBlock extends Block { +@@ -71,8 +71,13 @@ public class SnifferEggBlock extends Block { @Override public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { if (!this.isReadyToHatch(state)) { + // Paper start + if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, pos, state.setValue(HATCH, Integer.valueOf(this.getHatchLevel(state) + 1)), 2)) { -+ rescheduleTick(world, pos); ++ this.rescheduleTick(world, pos); + return; + } + // Paper end - world.playSound((Player)null, pos, SoundEvents.SNIFFER_EGG_CRACK, SoundSource.BLOCKS, 0.7F, 0.9F + random.nextFloat() * 0.2F); + world.playSound(null, pos, SoundEvents.SNIFFER_EGG_CRACK, SoundSource.BLOCKS, 0.7F, 0.9F + random.nextFloat() * 0.2F); - world.setBlock(pos, state.setValue(HATCH, Integer.valueOf(this.getHatchLevel(state) + 1)), 2); } else { // Paper start - Call BlockFadeEvent diff --git a/patches/server/0875-Add-method-to-remove-all-active-potion-effects.patch b/patches/server/0875-Add-method-to-remove-all-active-potion-effects.patch index 8f0290e924..1461dfa249 100644 --- a/patches/server/0875-Add-method-to-remove-all-active-potion-effects.patch +++ b/patches/server/0875-Add-method-to-remove-all-active-potion-effects.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add method to remove all active potion effects diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 909e4b139d5e372946b08bbb12665a49f3a09054..4031bf7fa35cfb480fbe6f0558a455f0c6985e39 100644 +index ab1e1a56f3811d4446a6b0a7461c0bddd8015228..c4a166a0c226c6083c25c58145d9631d4296e615 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -556,6 +556,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { diff --git a/patches/server/0876-Fix-incorrect-crafting-result-amount-for-fireworks.patch b/patches/server/0876-Fix-incorrect-crafting-result-amount-for-fireworks.patch index cfcf15909a..6436cefd47 100644 --- a/patches/server/0876-Fix-incorrect-crafting-result-amount-for-fireworks.patch +++ b/patches/server/0876-Fix-incorrect-crafting-result-amount-for-fireworks.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Fix incorrect crafting result amount for fireworks Although vanilla does not specifically call this method anywhere, this fixes a bug where the result using the Bukkit API returns the wrong amount. diff --git a/src/main/java/net/minecraft/world/item/crafting/FireworkRocketRecipe.java b/src/main/java/net/minecraft/world/item/crafting/FireworkRocketRecipe.java -index af7e7a63eacad2367453924806ffb002c33db951..25405c8eb76e428e689b3afad2c00529f687f550 100644 +index 54da7997123b4159a29baedf402608b7db7cb745..a86507569b759f8ef85f3fc32324677c37f65d28 100644 --- a/src/main/java/net/minecraft/world/item/crafting/FireworkRocketRecipe.java +++ b/src/main/java/net/minecraft/world/item/crafting/FireworkRocketRecipe.java -@@ -81,7 +81,7 @@ public class FireworkRocketRecipe extends CustomRecipe { +@@ -80,7 +80,7 @@ public class FireworkRocketRecipe extends CustomRecipe { @Override public ItemStack getResultItem(RegistryAccess registryManager) { diff --git a/patches/server/0880-Add-option-to-disable-block-updates.patch b/patches/server/0880-Add-option-to-disable-block-updates.patch index 5550b0c010..817a831971 100644 --- a/patches/server/0880-Add-option-to-disable-block-updates.patch +++ b/patches/server/0880-Add-option-to-disable-block-updates.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add option to disable block updates diff --git a/src/main/java/net/minecraft/world/level/block/ChorusPlantBlock.java b/src/main/java/net/minecraft/world/level/block/ChorusPlantBlock.java -index a0f63f17eb4e4bcf986f0573dc13be5c11c37f15..d811ed3623446000d3aa0be59c573f7c759bf55a 100644 +index ad801476cc25d51e4145a41b9c8100382f1f49bb..1ba7a6a14f7fbfdd279cb8c2bebf5ea6c98dbf1f 100644 --- a/src/main/java/net/minecraft/world/level/block/ChorusPlantBlock.java +++ b/src/main/java/net/minecraft/world/level/block/ChorusPlantBlock.java -@@ -29,6 +29,7 @@ public class ChorusPlantBlock extends PipeBlock { +@@ -38,6 +38,7 @@ public class ChorusPlantBlock extends PipeBlock { @Override public BlockState getStateForPlacement(BlockPlaceContext ctx) { @@ -16,7 +16,7 @@ index a0f63f17eb4e4bcf986f0573dc13be5c11c37f15..d811ed3623446000d3aa0be59c573f7c return getStateWithConnections(ctx.getLevel(), ctx.getClickedPos(), this.defaultBlockState()); } -@@ -45,6 +46,7 @@ public class ChorusPlantBlock extends PipeBlock { +@@ -59,6 +60,7 @@ public class ChorusPlantBlock extends PipeBlock { @Override public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { @@ -24,7 +24,7 @@ index a0f63f17eb4e4bcf986f0573dc13be5c11c37f15..d811ed3623446000d3aa0be59c573f7c if (!state.canSurvive(world, pos)) { world.scheduleTick(pos, this, 1); return super.updateShape(state, direction, neighborState, world, pos, neighborPos); -@@ -56,6 +58,7 @@ public class ChorusPlantBlock extends PipeBlock { +@@ -70,6 +72,7 @@ public class ChorusPlantBlock extends PipeBlock { @Override public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { @@ -32,7 +32,7 @@ index a0f63f17eb4e4bcf986f0573dc13be5c11c37f15..d811ed3623446000d3aa0be59c573f7c if (!state.canSurvive(world, pos)) { world.destroyBlock(pos, true); } -@@ -64,6 +67,7 @@ public class ChorusPlantBlock extends PipeBlock { +@@ -77,6 +80,7 @@ public class ChorusPlantBlock extends PipeBlock { @Override public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) { @@ -41,37 +41,41 @@ index a0f63f17eb4e4bcf986f0573dc13be5c11c37f15..d811ed3623446000d3aa0be59c573f7c boolean bl = !world.getBlockState(pos.above()).isAir() && !blockState.isAir(); diff --git a/src/main/java/net/minecraft/world/level/block/HugeMushroomBlock.java b/src/main/java/net/minecraft/world/level/block/HugeMushroomBlock.java -index 4fe30b867d7fc39c53307496458b3e438d4f2397..e049e702f58053431bf3e438ea37850c86ae3b7b 100644 +index 322cd656b82611ca8048c3e35cb66551bdea87d6..f70898bddec0b53f92ab88b862e2d865d82d558d 100644 --- a/src/main/java/net/minecraft/world/level/block/HugeMushroomBlock.java +++ b/src/main/java/net/minecraft/world/level/block/HugeMushroomBlock.java -@@ -34,6 +34,7 @@ public class HugeMushroomBlock extends Block { +@@ -43,6 +43,7 @@ public class HugeMushroomBlock extends Block { @Override public BlockState getStateForPlacement(BlockPlaceContext ctx) { + if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableMushroomBlockUpdates) return this.defaultBlockState(); // Paper - add option to disable block updates BlockGetter blockGetter = ctx.getLevel(); BlockPos blockPos = ctx.getClickedPos(); - return this.defaultBlockState().setValue(DOWN, Boolean.valueOf(!blockGetter.getBlockState(blockPos.below()).is(this))).setValue(UP, Boolean.valueOf(!blockGetter.getBlockState(blockPos.above()).is(this))).setValue(NORTH, Boolean.valueOf(!blockGetter.getBlockState(blockPos.north()).is(this))).setValue(EAST, Boolean.valueOf(!blockGetter.getBlockState(blockPos.east()).is(this))).setValue(SOUTH, Boolean.valueOf(!blockGetter.getBlockState(blockPos.south()).is(this))).setValue(WEST, Boolean.valueOf(!blockGetter.getBlockState(blockPos.west()).is(this))); -@@ -41,16 +42,19 @@ public class HugeMushroomBlock extends Block { + return this.defaultBlockState() +@@ -56,6 +57,7 @@ public class HugeMushroomBlock extends Block { @Override public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) { + if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableMushroomBlockUpdates) return state; // Paper - add option to disable block updates - return neighborState.is(this) ? state.setValue(PROPERTY_BY_DIRECTION.get(direction), Boolean.valueOf(false)) : super.updateShape(state, direction, neighborState, world, pos, neighborPos); - } + return neighborState.is(this) + ? state.setValue(PROPERTY_BY_DIRECTION.get(direction), Boolean.valueOf(false)) + : super.updateShape(state, direction, neighborState, world, pos, neighborPos); +@@ -63,6 +65,7 @@ public class HugeMushroomBlock extends Block { @Override public BlockState rotate(BlockState state, Rotation rotation) { + if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableMushroomBlockUpdates) return state; // Paper - add option to disable block updates - return state.setValue(PROPERTY_BY_DIRECTION.get(rotation.rotate(Direction.NORTH)), state.getValue(NORTH)).setValue(PROPERTY_BY_DIRECTION.get(rotation.rotate(Direction.SOUTH)), state.getValue(SOUTH)).setValue(PROPERTY_BY_DIRECTION.get(rotation.rotate(Direction.EAST)), state.getValue(EAST)).setValue(PROPERTY_BY_DIRECTION.get(rotation.rotate(Direction.WEST)), state.getValue(WEST)).setValue(PROPERTY_BY_DIRECTION.get(rotation.rotate(Direction.UP)), state.getValue(UP)).setValue(PROPERTY_BY_DIRECTION.get(rotation.rotate(Direction.DOWN)), state.getValue(DOWN)); - } + return state.setValue(PROPERTY_BY_DIRECTION.get(rotation.rotate(Direction.NORTH)), state.getValue(NORTH)) + .setValue(PROPERTY_BY_DIRECTION.get(rotation.rotate(Direction.SOUTH)), state.getValue(SOUTH)) + .setValue(PROPERTY_BY_DIRECTION.get(rotation.rotate(Direction.EAST)), state.getValue(EAST)) +@@ -73,6 +76,7 @@ public class HugeMushroomBlock extends Block { @Override public BlockState mirror(BlockState state, Mirror mirror) { + if (io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableMushroomBlockUpdates) return state; // Paper - add option to disable block updates - return state.setValue(PROPERTY_BY_DIRECTION.get(mirror.mirror(Direction.NORTH)), state.getValue(NORTH)).setValue(PROPERTY_BY_DIRECTION.get(mirror.mirror(Direction.SOUTH)), state.getValue(SOUTH)).setValue(PROPERTY_BY_DIRECTION.get(mirror.mirror(Direction.EAST)), state.getValue(EAST)).setValue(PROPERTY_BY_DIRECTION.get(mirror.mirror(Direction.WEST)), state.getValue(WEST)).setValue(PROPERTY_BY_DIRECTION.get(mirror.mirror(Direction.UP)), state.getValue(UP)).setValue(PROPERTY_BY_DIRECTION.get(mirror.mirror(Direction.DOWN)), state.getValue(DOWN)); - } - + return state.setValue(PROPERTY_BY_DIRECTION.get(mirror.mirror(Direction.NORTH)), state.getValue(NORTH)) + .setValue(PROPERTY_BY_DIRECTION.get(mirror.mirror(Direction.SOUTH)), state.getValue(SOUTH)) + .setValue(PROPERTY_BY_DIRECTION.get(mirror.mirror(Direction.EAST)), state.getValue(EAST)) diff --git a/src/main/java/net/minecraft/world/level/block/NoteBlock.java b/src/main/java/net/minecraft/world/level/block/NoteBlock.java index 92a24cf02f15f3ab893eb9a793770d9819e4f600..a541dc3a6e373b30fff0abf5305e77854c190f10 100644 --- a/src/main/java/net/minecraft/world/level/block/NoteBlock.java diff --git a/patches/server/0882-Don-t-load-chunks-for-supporting-block-checks.patch b/patches/server/0882-Don-t-load-chunks-for-supporting-block-checks.patch index 925e5e90ff..2e07b71256 100644 --- a/patches/server/0882-Don-t-load-chunks-for-supporting-block-checks.patch +++ b/patches/server/0882-Don-t-load-chunks-for-supporting-block-checks.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Don't load chunks for supporting block checks diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 0479dbdf0da7a06735ee08d068ead5fa12fc9860..927c298c1922fdd1016ffc72d2ca196adaccd377 100644 +index ee9ab1abbed298138e48c659481e03c01ac5940a..fe768bd70c08719f11e28e793fe90a908f22c4ad 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -1200,7 +1200,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/0888-Determine-lava-and-water-fluid-explosion-resistance-.patch b/patches/server/0888-Determine-lava-and-water-fluid-explosion-resistance-.patch index bea2e1c86f..65d07cad42 100644 --- a/patches/server/0888-Determine-lava-and-water-fluid-explosion-resistance-.patch +++ b/patches/server/0888-Determine-lava-and-water-fluid-explosion-resistance-.patch @@ -22,10 +22,10 @@ index 72f8b72c6436ca3b8eaeb39c7d3efe2c1462ae1d..3bb4a9a1a6249e8ba2de237f801210e7 @Override diff --git a/src/main/java/net/minecraft/world/level/material/WaterFluid.java b/src/main/java/net/minecraft/world/level/material/WaterFluid.java -index c5f9eda32f2cd172569c7b7d72f5dd3e41a34a70..cde93efaecd42b9081405638af3ba91cb5e184c9 100644 +index 001adec26a71a0f5e1dd77bf51a62bb25172d702..ba34aea9db5c3af56f3c7e84424ec91988a2370e 100644 --- a/src/main/java/net/minecraft/world/level/material/WaterFluid.java +++ b/src/main/java/net/minecraft/world/level/material/WaterFluid.java -@@ -109,7 +109,7 @@ public abstract class WaterFluid extends FlowingFluid { +@@ -119,7 +119,7 @@ public abstract class WaterFluid extends FlowingFluid { @Override protected float getExplosionResistance() { diff --git a/patches/server/0893-Add-whitelist-events.patch b/patches/server/0893-Add-whitelist-events.patch index 44cddb390d..96884032fb 100644 --- a/patches/server/0893-Add-whitelist-events.patch +++ b/patches/server/0893-Add-whitelist-events.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add whitelist events diff --git a/src/main/java/net/minecraft/server/players/UserWhiteList.java b/src/main/java/net/minecraft/server/players/UserWhiteList.java -index a6c70decad1a496595944a5dd2aeeb387757fef3..37635f58cd78ff50991dde413470004400259c89 100644 +index 3226a3b69453fb5e13003e941ccbc2d941e047b0..aaa3d5769e0e184e19d01109a76a65be634f830d 100644 --- a/src/main/java/net/minecraft/server/players/UserWhiteList.java +++ b/src/main/java/net/minecraft/server/players/UserWhiteList.java -@@ -30,4 +30,23 @@ public class UserWhiteList extends StoredUserList { + this.neighborBlockTicks.forEach(tick -> { Block block = tick.type() == Blocks.AIR ? level.getBlockState(tick.pos()).getBlock() : tick.type(); diff --git a/patches/server/0914-Add-Listing-API-for-Player.patch b/patches/server/0914-Add-Listing-API-for-Player.patch index 05e8427ee0..18d73fa178 100644 --- a/patches/server/0914-Add-Listing-API-for-Player.patch +++ b/patches/server/0914-Add-Listing-API-for-Player.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add Listing API for Player diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundPlayerInfoUpdatePacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundPlayerInfoUpdatePacket.java -index d43106eb89b14667e85cd6e8fa047d64f2e8ec87..56eddd28429cf42c02d88b8bf79f8b616fa45289 100644 +index 754a2a5e958a04b3f8bf216b6022f547aa1cd36f..d41fe931daf03c40ca1d7b9159001d0122d72f0c 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundPlayerInfoUpdatePacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundPlayerInfoUpdatePacket.java -@@ -29,12 +29,46 @@ public class ClientboundPlayerInfoUpdatePacket implements Packet players) { - EnumSet enumSet = EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, ClientboundPlayerInfoUpdatePacket.Action.INITIALIZE_CHAT, ClientboundPlayerInfoUpdatePacket.Action.UPDATE_GAME_MODE, ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LISTED, ClientboundPlayerInfoUpdatePacket.Action.UPDATE_LATENCY, ClientboundPlayerInfoUpdatePacket.Action.UPDATE_DISPLAY_NAME); + EnumSet enumSet = EnumSet.of( +@@ -42,6 +53,29 @@ public class ClientboundPlayerInfoUpdatePacket implements Packet { -@@ -144,8 +178,16 @@ public class ClientboundPlayerInfoUpdatePacket implements Packet { +@@ -146,16 +180,24 @@ public class ClientboundPlayerInfoUpdatePacket implements Packet { - return stream; - })); +@@ -26,6 +26,17 @@ public class RegionFileVersion { + ) + ); + public static final RegionFileVersion VERSION_NONE = register(new RegionFileVersion(3, stream -> stream, stream -> stream)); + + // Paper start - Configurable region compression format + public static RegionFileVersion getCompressionFormat() { diff --git a/patches/server/0918-Expand-Pose-API.patch b/patches/server/0918-Expand-Pose-API.patch index 33bb7d2bc7..8704e4d4d2 100644 --- a/patches/server/0918-Expand-Pose-API.patch +++ b/patches/server/0918-Expand-Pose-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Expand Pose API diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index ecd7deadbddeb9571b2b8975214e4167c8333ce0..4db254f76bc2fb9867441016b3ac4f45f19d3bea 100644 +index 3ae2f450ac43c3752f779eeb40ec7761590f9e51..ad3cdb1a3ab07c48bf6b2662b93ddad5974db1a6 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -419,6 +419,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -25,7 +25,7 @@ index ecd7deadbddeb9571b2b8975214e4167c8333ce0..4db254f76bc2fb9867441016b3ac4f45 if (pose == this.getPose()) { return; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index d91d56175e91fb06138901bad56c1c2544b3d20e..a81c8a9d76c1d9fdee19132a9a40ffc2ab4d107e 100644 +index cbcfb0bc3a85b60e13014245f256e5c356b4b79b..6fcc7949351c5741908a0150498b811f57961899 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -897,6 +897,20 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { diff --git a/patches/server/0927-Add-titleOverride-to-InventoryOpenEvent.patch b/patches/server/0927-Add-titleOverride-to-InventoryOpenEvent.patch index 98a9e5449f..76cb094c35 100644 --- a/patches/server/0927-Add-titleOverride-to-InventoryOpenEvent.patch +++ b/patches/server/0927-Add-titleOverride-to-InventoryOpenEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add titleOverride to InventoryOpenEvent diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index d4930c40f03c5f331847bf52736c563a688d7daf..7272dc058c575efee5ac2643ce41b7d12e346e89 100644 +index 406794c439900a0d86fd4fe67d05a98bde625aec..2bb82dcffd8fdc25d658ec36a34f959b25217396 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -1523,12 +1523,17 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0928-Configure-sniffer-egg-hatch-time.patch b/patches/server/0928-Configure-sniffer-egg-hatch-time.patch index b42c26e59c..702bef1759 100644 --- a/patches/server/0928-Configure-sniffer-egg-hatch-time.patch +++ b/patches/server/0928-Configure-sniffer-egg-hatch-time.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Configure sniffer egg hatch time diff --git a/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java b/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java -index 7be4e32a4409b539839a480ef83750ed4b5359a6..03da13d1fdf22b425addf0b1b7a82803f6a35b60 100644 +index 4f1ff12df44756b63e3c3f9fc43e7ea485df6f57..e225595bbf044ff126797f44b233221c358ef641 100644 --- a/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java +++ b/src/main/java/net/minecraft/world/level/block/SnifferEggBlock.java -@@ -63,7 +63,7 @@ public class SnifferEggBlock extends Block { +@@ -62,7 +62,7 @@ public class SnifferEggBlock extends Block { // Paper start - Call BlockFadeEvent private void rescheduleTick(ServerLevel world, BlockPos pos) { @@ -17,7 +17,7 @@ index 7be4e32a4409b539839a480ef83750ed4b5359a6..03da13d1fdf22b425addf0b1b7a82803 world.scheduleTick(pos, this, (baseDelay / 3) + world.random.nextInt(RANDOM_HATCH_OFFSET_TICKS)); // reschedule to avoid being stuck here and behave like the other calls (see #onPlace) } -@@ -106,7 +106,7 @@ public class SnifferEggBlock extends Block { +@@ -104,7 +104,7 @@ public class SnifferEggBlock extends Block { world.levelEvent(3009, pos, 0); } diff --git a/patches/server/0930-Skip-POI-finding-if-stuck-in-vehicle.patch b/patches/server/0930-Skip-POI-finding-if-stuck-in-vehicle.patch index e0235836a4..0741c28cb0 100644 --- a/patches/server/0930-Skip-POI-finding-if-stuck-in-vehicle.patch +++ b/patches/server/0930-Skip-POI-finding-if-stuck-in-vehicle.patch @@ -19,14 +19,14 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java b/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java -index 9fd6cf0c98cbf6300ef23d4aab32a6110aeba665..a0799baca3ae05ef1ff818abfe6a53d28fd99246 100644 +index 4acbdaeab6bbbe3875d1e9323bf2f7a4d56f840e..0e2141bbbf9839a90a78cd04bb70d5f94614248e 100644 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java -@@ -47,6 +47,7 @@ public class AcquirePoi { - return false; - } else { - mutableLong.setValue(time + 20L + (long)world.getRandom().nextInt(20)); -+ if (entity.getNavigation().isStuck()) mutableLong.add(200); // Paper - Perf: Wait an additional 10s to check again if they're stuck - PoiManager poiManager = world.getPoiManager(); - long2ObjectMap.long2ObjectEntrySet().removeIf((entry) -> { - return !entry.getValue().isStillValid(time); +@@ -57,6 +57,7 @@ public class AcquirePoi { + return false; + } else { + mutableLong.setValue(time + 20L + world.getRandom().nextInt(20)); ++ if (entity.getNavigation().isStuck()) mutableLong.add(200); // Paper - Perf: Wait an additional 10s to check again if they're stuck + PoiManager poiManager = world.getPoiManager(); + long2ObjectMap.long2ObjectEntrySet().removeIf(entry -> !entry.getValue().isStillValid(time)); + Predicate predicate2 = pos -> { diff --git a/patches/server/0939-Fix-race-condition-on-UpgradeData.BlockFixers-class-.patch b/patches/server/0939-Fix-race-condition-on-UpgradeData.BlockFixers-class-.patch index e2c7a15a63..e547ae2524 100644 --- a/patches/server/0939-Fix-race-condition-on-UpgradeData.BlockFixers-class-.patch +++ b/patches/server/0939-Fix-race-condition-on-UpgradeData.BlockFixers-class-.patch @@ -14,14 +14,14 @@ field by calling any method on the class, and for convenience we use values(). diff --git a/src/main/java/net/minecraft/world/level/chunk/UpgradeData.java b/src/main/java/net/minecraft/world/level/chunk/UpgradeData.java -index a5b90222cfad5b282f3f2db4dd5d1b201761fb72..4a2c233898c00e09a7e1b75d3a9a82b572b849d6 100644 +index 25c1abaeb916781f810d580a4d388d4d3adad75a..932c9ba8d9ef82746cac0c40292a8e41ffb4ea33 100644 --- a/src/main/java/net/minecraft/world/level/chunk/UpgradeData.java +++ b/src/main/java/net/minecraft/world/level/chunk/UpgradeData.java -@@ -139,6 +139,7 @@ public class UpgradeData { +@@ -140,6 +140,7 @@ public class UpgradeData { Fluid fluid = tick.type() == Fluids.EMPTY ? level.getFluidState(tick.pos()).getType() : tick.type(); level.scheduleTick(tick.pos(), fluid, tick.delay(), tick.priority()); }); + UpgradeData.BlockFixers.values(); // Paper - force the class init so that we don't access CHUNKY_FIXERS before all BlockFixers are initialised - CHUNKY_FIXERS.forEach((logic) -> { - logic.processChunk(level); - }); + CHUNKY_FIXERS.forEach(logic -> logic.processChunk(level)); + } + diff --git a/patches/server/0950-Optimize-VarInts.patch b/patches/server/0950-Optimize-VarInts.patch index 19e7fc574a..b96957d432 100644 --- a/patches/server/0950-Optimize-VarInts.patch +++ b/patches/server/0950-Optimize-VarInts.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Optimize VarInts https://github.com/PaperMC/Paper/pull/6957#issuecomment-985250854 diff --git a/src/main/java/net/minecraft/network/VarInt.java b/src/main/java/net/minecraft/network/VarInt.java -index 18d5a22ad3ef4cb279475531dbc2c65e07c69929..3f362eb42587b333e27b9cf25588a9cfcb8a56e7 100644 +index 49a8ddc269d53458cfbd639b7de838c2e5765748..74ed47659d3e615c2dae7da98d5a8cf1559625bf 100644 --- a/src/main/java/net/minecraft/network/VarInt.java +++ b/src/main/java/net/minecraft/network/VarInt.java @@ -9,6 +9,18 @@ public class VarInt { @@ -24,8 +24,8 @@ index 18d5a22ad3ef4cb279475531dbc2c65e07c69929..3f362eb42587b333e27b9cf25588a9cf + VARINT_EXACT_BYTE_LENGTHS[32] = 1; // Special case for the number 0. + } + public static int getByteSizeOld(int i) { -+ //Paper end - Optimize VarInts - for(int j = 1; j < 5; ++j) { ++ // Paper end - Optimize VarInts + for (int j = 1; j < 5; j++) { if ((i & -1 << j * 7) == 0) { return j; @@ -39,6 +51,21 @@ public class VarInt { @@ -47,6 +47,6 @@ index 18d5a22ad3ef4cb279475531dbc2c65e07c69929..3f362eb42587b333e27b9cf25588a9cf + } + public static ByteBuf writeOld(ByteBuf buf, int i) { + // Paper end - Optimize VarInts - while((i & -128) != 0) { + while ((i & -128) != 0) { buf.writeByte(i & 127 | 128); i >>>= 7; diff --git a/patches/server/0953-Broadcast-take-item-packets-with-collector-as-source.patch b/patches/server/0953-Broadcast-take-item-packets-with-collector-as-source.patch index 393709e2e0..762ec4c8fd 100644 --- a/patches/server/0953-Broadcast-take-item-packets-with-collector-as-source.patch +++ b/patches/server/0953-Broadcast-take-item-packets-with-collector-as-source.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Broadcast take item packets with collector as source This fixes players (which can't view the collector) seeing item pickups with themselves as the target. diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index e2564a07e0aa4bf2fcd9a749e9fc188dd0633675..8567cdfc42ea2388dd44ed1de83bebca433abe12 100644 +index 09a48779046484c2f3628d1499659e247c736fce..6b591f8b484be20418e8a6ca09aba84cda398a3d 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3724,7 +3724,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0960-Fix-missing-event-call-for-entity-teleport-API.patch b/patches/server/0960-Fix-missing-event-call-for-entity-teleport-API.patch index 7da83443f1..77319ed2b1 100644 --- a/patches/server/0960-Fix-missing-event-call-for-entity-teleport-API.patch +++ b/patches/server/0960-Fix-missing-event-call-for-entity-teleport-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix missing event call for entity teleport API diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index a81c8a9d76c1d9fdee19132a9a40ffc2ab4d107e..38c14e06bcada9678b64c6eacf351de10232ee56 100644 +index 6fcc7949351c5741908a0150498b811f57961899..76193067a21ff962cf2634b36d0ddf3eff8f85d7 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -256,6 +256,17 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { diff --git a/patches/server/0961-Lazily-create-LootContext-for-criterions.patch b/patches/server/0961-Lazily-create-LootContext-for-criterions.patch index 293dfbd694..f0786c2018 100644 --- a/patches/server/0961-Lazily-create-LootContext-for-criterions.patch +++ b/patches/server/0961-Lazily-create-LootContext-for-criterions.patch @@ -8,10 +8,10 @@ For each player on each tick, enter block triggers are invoked, and these create To avoid this, we now lazily create the LootContext if the criterion passes the predicate AND if any of the listener triggers require a loot context instance diff --git a/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java b/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java -index 805459ba815520165c86a537fbb1f3e04b85bfbd..a327973e37b5b8d4e15683ef24548482ac3dc3d5 100644 +index 795d1f3e6065baee4cadf71ae0eeabfa5522199b..557de599b3496105b572bebb86313e3441947bae 100644 --- a/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java +++ b/src/main/java/net/minecraft/advancements/critereon/SimpleCriterionTrigger.java -@@ -45,14 +45,14 @@ public abstract class SimpleCriterionTrigger> set = (Set) playerAdvancements.criterionData.get(this); // Paper - fix AdvancementDataPlayer leak if (set != null && !set.isEmpty()) { @@ -19,7 +19,7 @@ index 805459ba815520165c86a537fbb1f3e04b85bfbd..a327973e37b5b8d4e15683ef24548482 + LootContext lootContext = null; // EntityPredicate.createContext(player, player); // Paper - Perf: lazily create LootContext for criterions List> list = null; - for(CriterionTrigger.Listener listener : set) { + for (CriterionTrigger.Listener listener : set) { T simpleInstance = listener.trigger(); if (predicate.test(simpleInstance)) { Optional optional = simpleInstance.player(); diff --git a/patches/server/0962-Don-t-fire-sync-events-during-worldgen.patch b/patches/server/0962-Don-t-fire-sync-events-during-worldgen.patch index 1b53c1ac5c..086273d9ca 100644 --- a/patches/server/0962-Don-t-fire-sync-events-during-worldgen.patch +++ b/patches/server/0962-Don-t-fire-sync-events-during-worldgen.patch @@ -31,7 +31,7 @@ index 8235dace0f4a1090dfbd403db34231ccafe5f30e..9816913ad729fd39c173364b92e5db06 if (entity.valid) { MinecraftServer.LOGGER.error("Attempted Double World add on {}", entity, new Throwable()); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 4db254f76bc2fb9867441016b3ac4f45f19d3bea..4125802dda07d79dd0e1f7e7dc3c0ee85fa0383c 100644 +index ad3cdb1a3ab07c48bf6b2662b93ddad5974db1a6..2848be4604e08d0d651d16e960cda9a4d0234d41 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -637,7 +637,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -68,7 +68,7 @@ index 656c68b37bc25d6b77f295f9efe0a81dd20b69c1..8ba573bb4099ee5b27b61f333e72d794 }, () -> { EntityType.LOGGER.warn("Skipping Entity with id {}", nbt.getString("id")); diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 8567cdfc42ea2388dd44ed1de83bebca433abe12..d36e1d6f7bba220f7e6b0d8d23aff26275d9f33e 100644 +index 6b591f8b484be20418e8a6ca09aba84cda398a3d..a648cc01f2cdfac46fd2e760705cf85e534e926f 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -1142,6 +1142,11 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0965-Restore-vanilla-entity-drops-behavior.patch b/patches/server/0965-Restore-vanilla-entity-drops-behavior.patch index 625d431fff..531ac1d639 100644 --- a/patches/server/0965-Restore-vanilla-entity-drops-behavior.patch +++ b/patches/server/0965-Restore-vanilla-entity-drops-behavior.patch @@ -9,7 +9,7 @@ on dropping the item instead of generalizing it for all dropped items like CB does. diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 7272dc058c575efee5ac2643ce41b7d12e346e89..ae5a2136a0e266d4c35190f5d33552994c842786 100644 +index 2bb82dcffd8fdc25d658ec36a34f959b25217396..bd6c60ebfc76d19313bf01048268f8ce7e6603c5 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -891,22 +891,20 @@ public class ServerPlayer extends Player { @@ -50,7 +50,7 @@ index 7272dc058c575efee5ac2643ce41b7d12e346e89..ae5a2136a0e266d4c35190f5d3355299 if (entityitem == null) { return null; diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 4125802dda07d79dd0e1f7e7dc3c0ee85fa0383c..7c99742e01e894bcc7d89a8588b2f128cf9b765d 100644 +index 2848be4604e08d0d651d16e960cda9a4d0234d41..5275e7a34f86830d43edcab3a0e94f8d8e9cfae5 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -2496,6 +2496,25 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -104,7 +104,7 @@ index 4125802dda07d79dd0e1f7e7dc3c0ee85fa0383c..7c99742e01e894bcc7d89a8588b2f128 return this.spawnAtLocation(entityitem); } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index d36e1d6f7bba220f7e6b0d8d23aff26275d9f33e..c43927781c579f7237cd795e71e18e5a11074c7b 100644 +index a648cc01f2cdfac46fd2e760705cf85e534e926f..d396201655fde7ff35cf2a342fa458e5ea3f80a8 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -255,7 +255,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0968-Improve-Registry.patch b/patches/server/0968-Improve-Registry.patch index 740baefc42..aed822acfc 100644 --- a/patches/server/0968-Improve-Registry.patch +++ b/patches/server/0968-Improve-Registry.patch @@ -37,7 +37,7 @@ index b12b99253543445475b73a1d3d7c6364856b49e8..4fc02698a9312496e7f9bce1c64f3173 + // Paper end - improve Registry } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimMaterial.java b/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimMaterial.java -index 49752459ad67db3182c6d6d30ab91f2a420847a8..b1e87b52753242c7210cb250e4e272d016317c26 100644 +index 147950b8a1c853e1b52fdb29b26e839c2dd7bd01..8a20186618de8de8dd941a12aeb7d4f3b7e70c18 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimMaterial.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/trim/CraftTrimMaterial.java @@ -35,6 +35,7 @@ public class CraftTrimMaterial implements TrimMaterial, Handleable { +@@ -33,6 +33,13 @@ public class ResourceLocation implements Comparable { private final String path; protected ResourceLocation(String namespace, String path, @Nullable ResourceLocation.Dummy extraData) { @@ -53,7 +53,7 @@ index 8ba573bb4099ee5b27b61f333e72d794c48d5f29..69bdf3f2ee731e59e8d454816a9ca72c @Nullable diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 693ea3891f18f071cdd79f9162f1521472b3ed24..7f5457522835b073246054e66699fe73f7005b25 100644 +index bb52d084637c97d9cc1ebaeec28358a0ddb3952b..40e21effc948b02874a6ed1d1c340c4dc87579d6 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -879,12 +879,13 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -98,10 +98,10 @@ index c30f19162e33dbe8f018b7dc66210681b6027389..e8faca6e443239968f0111519f9e5cd0 this.setShotFromCrossbow(nbt.getBoolean("ShotFromCrossbow")); diff --git a/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java b/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java -index 7529751afa2932fd16bc4591189b0358268a7b14..e2e1c7a017e82dc7299e5cd1783818e4f0319c0b 100644 +index f4ad1eea5bced6997edbc3a5ed1360b12b70f68f..648eefb973a4e5e543818c417a6ee39f283ea361 100644 --- a/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/ContainerEntity.java -@@ -67,7 +67,7 @@ public interface ContainerEntity extends Container, MenuProvider { +@@ -66,7 +66,7 @@ public interface ContainerEntity extends Container, MenuProvider { default void readChestVehicleSaveData(CompoundTag nbt) { this.clearItemStacks(); if (nbt.contains("LootTable", 8)) { @@ -109,7 +109,7 @@ index 7529751afa2932fd16bc4591189b0358268a7b14..e2e1c7a017e82dc7299e5cd1783818e4 + this.setLootTable(ResourceLocation.tryParse(nbt.getString("LootTable"))); // Paper - Validate ResourceLocation this.setLootTableSeed(nbt.getLong("LootTableSeed")); } - + ContainerHelper.loadAllItems(nbt, this.getItemStacks()); // Paper - always load the items, table may still remain diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java index d04fc84eef11adb5ea64077f48794b6ed7fb3ada..89d06253b00604114e543ebbe12a9993ae95dc41 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java diff --git a/patches/server/0977-Reduce-allocation-of-Vec3D-by-entity-tracker.patch b/patches/server/0977-Reduce-allocation-of-Vec3D-by-entity-tracker.patch index d6756e53cf..b1345b9284 100644 --- a/patches/server/0977-Reduce-allocation-of-Vec3D-by-entity-tracker.patch +++ b/patches/server/0977-Reduce-allocation-of-Vec3D-by-entity-tracker.patch @@ -5,13 +5,13 @@ Subject: [PATCH] Reduce allocation of Vec3D by entity tracker diff --git a/src/main/java/net/minecraft/network/protocol/game/VecDeltaCodec.java b/src/main/java/net/minecraft/network/protocol/game/VecDeltaCodec.java -index 3c4ac79c094dc2fff7de94150a34b7bf814ac0de..38b56923a642afc1cb411480ba03cc784ed7cd24 100644 +index baacaa8fcefdee3c7eeebae1d3a365553e2dbac6..0d079f33c5cbc063081d5722c0823e332b448ea2 100644 --- a/src/main/java/net/minecraft/network/protocol/game/VecDeltaCodec.java +++ b/src/main/java/net/minecraft/network/protocol/game/VecDeltaCodec.java @@ -5,7 +5,7 @@ import org.jetbrains.annotations.VisibleForTesting; public class VecDeltaCodec { - private static final double TRUNCATION_STEPS = 4096.0D; + private static final double TRUNCATION_STEPS = 4096.0; - private Vec3 base = Vec3.ZERO; + public Vec3 base = Vec3.ZERO; // Paper diff --git a/patches/server/0978-Rewrite-dataconverter-system.patch b/patches/server/0978-Rewrite-dataconverter-system.patch index 2919728f24..971d840785 100644 --- a/patches/server/0978-Rewrite-dataconverter-system.patch +++ b/patches/server/0978-Rewrite-dataconverter-system.patch @@ -24837,7 +24837,7 @@ index 6743dca44e6552ad39aca757a24f3c4df400d83d..eebaf98bc0fa4696af59b2a79563beb7 NbtUtils.addCurrentDataVersion(nbttagcompound); } diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java -index d80580574a9e5d1c850270d93807f3a66a9c76f8..98b3909b536f11eda9c481ffd74066ad0cdb0ebc 100644 +index 01e54bd6c8157bc5c20375180a29c62599d72a3b..0eaecd48f763d60e3bfe684fae1700c2ced78cc2 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java @@ -115,7 +115,7 @@ public class EntityStorage implements EntityPersistentStorage { @@ -24850,10 +24850,10 @@ index d80580574a9e5d1c850270d93807f3a66a9c76f8..98b3909b536f11eda9c481ffd74066ad @Override diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java -index 28e0f782c24afb3d8d2296bd0d3493a32ef66961..56f0e217276b01aed2f20a71f6849826285fc15b 100644 +index 8609030e7a2fb6362bb482f6a41fe81263101c44..809da7fec1e1288a7a7bf1ee46c5b7bdd12bca01 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java -@@ -142,7 +142,14 @@ public class SectionStorage implements AutoCloseable { +@@ -148,7 +148,14 @@ public class SectionStorage implements AutoCloseable { int j = getVersion(dynamic); int k = SharedConstants.getCurrentVersion().getDataVersion().getVersion(); boolean bl = j != k; @@ -24868,12 +24868,12 @@ index 28e0f782c24afb3d8d2296bd0d3493a32ef66961..56f0e217276b01aed2f20a71f6849826 + // Paper end - route to new converter system OptionalDynamic optionalDynamic = dynamic2.get("Sections"); - for(int l = this.levelHeightAccessor.getMinSection(); l < this.levelHeightAccessor.getMaxSection(); ++l) { + for (int l = this.levelHeightAccessor.getMinSection(); l < this.levelHeightAccessor.getMaxSection(); l++) { diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java b/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java -index 15a9736a870055d639d03063c7cf67fd769fff36..1ca00340aaa201dd34e5c350d23ef53e126a0ca6 100644 +index a63eaec77251a7f6660d17d7210c639b71751c45..769a8c5788e6a01666b9b5ac24b02c632c6c9e48 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java +++ b/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java -@@ -115,7 +115,7 @@ public class StructureCheck { +@@ -139,7 +139,7 @@ public class StructureCheck { CompoundTag compoundTag2; try { @@ -24883,10 +24883,10 @@ index 15a9736a870055d639d03063c7cf67fd769fff36..1ca00340aaa201dd34e5c350d23ef53e LOGGER.warn("Failed to partially datafix chunk {}", pos, var12); return StructureCheckResult.CHUNK_LOAD_NEEDED; diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplateManager.java b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplateManager.java -index e534dac9d69147174f6b9e8ce7f27fde536351ce..270fd52ec733c89bd91155c8222936fafbcf94d6 100644 +index 7a350e2542da8055e94da4653399b6f3e07a0c7b..bd97c2407b02c2d6ef345c0cd421340703457e72 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplateManager.java +++ b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplateManager.java -@@ -236,7 +236,7 @@ public class StructureTemplateManager { +@@ -229,7 +229,7 @@ public class StructureTemplateManager { public StructureTemplate readStructure(CompoundTag nbt) { StructureTemplate structureTemplate = new StructureTemplate(); int i = NbtUtils.getDataVersion(nbt, 500); diff --git a/patches/server/0979-Starlight.patch b/patches/server/0979-Starlight.patch index f7c01379eb..598933220f 100644 --- a/patches/server/0979-Starlight.patch +++ b/patches/server/0979-Starlight.patch @@ -4518,7 +4518,7 @@ index 4e1618462840a1378dbe6492696c97544815edf2..8e8e3896040241bba8fd15f4d6d04656 while (objectiterator.hasNext()) { diff --git a/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java b/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java -index 785ca2c63fe47936ac4c0223dffd8971a295a37c..97662f8c8c125cb964d46b9095509a0da9796dba 100644 +index 1dfae40ec19c4df0a97359941cf2c948cd1c9cb2..3229bb8dfb9f39e5fa1c8d91cb58057764cd4abb 100644 --- a/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java +++ b/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java @@ -23,6 +23,17 @@ import net.minecraft.world.level.chunk.LightChunkGetter; @@ -4539,7 +4539,7 @@ index 785ca2c63fe47936ac4c0223dffd8971a295a37c..97662f8c8c125cb964d46b9095509a0d public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCloseable { public static final int DEFAULT_BATCH_SIZE = 1000; private static final Logger LOGGER = LogUtils.getLogger(); -@@ -33,13 +44,161 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl +@@ -33,6 +44,12 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl private final int taskPerBatch = 1000; private final AtomicBoolean scheduled = new AtomicBoolean(); @@ -4549,7 +4549,13 @@ index 785ca2c63fe47936ac4c0223dffd8971a295a37c..97662f8c8c125cb964d46b9095509a0d + public final boolean hasSkyLight; + // Paper end - replace light engine impl + - public ThreadedLevelLightEngine(LightChunkGetter chunkProvider, ChunkMap chunkStorage, boolean hasBlockLight, ProcessorMailbox processor, ProcessorHandle> executor) { + public ThreadedLevelLightEngine( + LightChunkGetter chunkProvider, + ChunkMap chunkStorage, +@@ -40,11 +57,153 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl + ProcessorMailbox processor, + ProcessorHandle> executor + ) { - super(chunkProvider, true, hasBlockLight); + super(chunkProvider, false, false); // Paper - destroy vanilla light engine state this.chunkMap = chunkStorage; @@ -4675,8 +4681,8 @@ index 785ca2c63fe47936ac4c0223dffd8971a295a37c..97662f8c8c125cb964d46b9095509a0d + LOGGER.error("Failed to remove ticket level for post chunk task " + new ChunkPos(chunkX, chunkZ), thr); + } + }); - } - ++ } ++ + @Override + public boolean hasLightWork() { + // route to new light engine @@ -4696,22 +4702,22 @@ index 785ca2c63fe47936ac4c0223dffd8971a295a37c..97662f8c8c125cb964d46b9095509a0d + if (sky == 15) return 15; + final int block = this.theLightEngine.getBlockReader().getLightValue(pos); + return Math.max(sky, block); -+ } + } + // Paper end - replace light engine imp -+ + @Override public void close() { - } -@@ -51,15 +210,16 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl +@@ -57,16 +216,16 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl @Override public void checkBlock(BlockPos pos) { - BlockPos blockPos = pos.immutable(); -- this.addTask(SectionPos.blockToSectionCoord(pos.getX()), SectionPos.blockToSectionCoord(pos.getZ()), ThreadedLevelLightEngine.TaskType.PRE_UPDATE, Util.name(() -> { -- super.checkBlock(blockPos); -- }, () -> { -- return "checkBlock " + blockPos; -- })); +- this.addTask( +- SectionPos.blockToSectionCoord(pos.getX()), +- SectionPos.blockToSectionCoord(pos.getZ()), +- ThreadedLevelLightEngine.TaskType.PRE_UPDATE, +- Util.name(() -> super.checkBlock(blockPos), () -> "checkBlock " + blockPos) +- ); + // Paper start - replace light engine impl + final BlockPos posCopy = pos.immutable(); + this.queueTaskForSection(posCopy.getX() >> 4, posCopy.getY() >> 4, posCopy.getZ() >> 4, () -> { @@ -4722,20 +4728,20 @@ index 785ca2c63fe47936ac4c0223dffd8971a295a37c..97662f8c8c125cb964d46b9095509a0d protected void updateChunkStatus(ChunkPos pos) { + if (true) return; // Paper - replace light engine impl - this.addTask(pos.x, pos.z, () -> { - return 0; - }, ThreadedLevelLightEngine.TaskType.PRE_UPDATE, Util.name(() -> { -@@ -82,17 +242,16 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl + this.addTask(pos.x, pos.z, () -> 0, ThreadedLevelLightEngine.TaskType.PRE_UPDATE, Util.name(() -> { + super.retainData(pos, false); + super.setLightEnabled(pos, false); +@@ -84,17 +243,16 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl @Override public void updateSectionStatus(SectionPos pos, boolean notReady) { -- this.addTask(pos.x(), pos.z(), () -> { -- return 0; -- }, ThreadedLevelLightEngine.TaskType.PRE_UPDATE, Util.name(() -> { -- super.updateSectionStatus(pos, notReady); -- }, () -> { -- return "updateSectionStatus " + pos + " " + notReady; -- })); +- this.addTask( +- pos.x(), +- pos.z(), +- () -> 0, +- ThreadedLevelLightEngine.TaskType.PRE_UPDATE, +- Util.name(() -> super.updateSectionStatus(pos, notReady), () -> "updateSectionStatus " + pos + " " + notReady) +- ); + // Paper start - replace light engine impl + this.queueTaskForSection(pos.getX(), pos.getY(), pos.getZ(), () -> { + return this.theLightEngine.sectionChange(pos, notReady); @@ -4746,34 +4752,33 @@ index 785ca2c63fe47936ac4c0223dffd8971a295a37c..97662f8c8c125cb964d46b9095509a0d @Override public void propagateLightSources(ChunkPos chunkPos) { + if (true) return; // Paper - replace light engine impl - this.addTask(chunkPos.x, chunkPos.z, ThreadedLevelLightEngine.TaskType.PRE_UPDATE, Util.name(() -> { - super.propagateLightSources(chunkPos); - }, () -> { -@@ -102,6 +261,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl + this.addTask( + chunkPos.x, + chunkPos.z, +@@ -105,6 +263,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl @Override public void setLightEnabled(ChunkPos pos, boolean retainData) { + if (true) return; // Paper - replace light engine impl - this.addTask(pos.x, pos.z, ThreadedLevelLightEngine.TaskType.PRE_UPDATE, Util.name(() -> { - super.setLightEnabled(pos, retainData); - }, () -> { -@@ -111,6 +271,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl + this.addTask( + pos.x, + pos.z, +@@ -115,6 +274,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl @Override public void queueSectionData(LightLayer lightType, SectionPos pos, @Nullable DataLayer nibbles) { + if (true) return; // Paper - replace light engine impl - this.addTask(pos.x(), pos.z(), () -> { - return 0; - }, ThreadedLevelLightEngine.TaskType.PRE_UPDATE, Util.name(() -> { -@@ -136,6 +297,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl + this.addTask( + pos.x(), + pos.z(), +@@ -139,12 +299,14 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl @Override public void retainData(ChunkPos pos, boolean retainData) { + if (true) return; // Paper - replace light engine impl - this.addTask(pos.x, pos.z, () -> { - return 0; - }, ThreadedLevelLightEngine.TaskType.PRE_UPDATE, Util.name(() -> { -@@ -146,6 +308,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl + this.addTask( + pos.x, pos.z, () -> 0, ThreadedLevelLightEngine.TaskType.PRE_UPDATE, Util.name(() -> super.retainData(pos, retainData), () -> "retainData " + pos) + ); } public CompletableFuture initializeLight(ChunkAccess chunk, boolean bl) { @@ -4781,7 +4786,7 @@ index 785ca2c63fe47936ac4c0223dffd8971a295a37c..97662f8c8c125cb964d46b9095509a0d ChunkPos chunkPos = chunk.getPos(); this.addTask(chunkPos.x, chunkPos.z, ThreadedLevelLightEngine.TaskType.PRE_UPDATE, Util.name(() -> { LevelChunkSection[] levelChunkSections = chunk.getSections(); -@@ -171,6 +334,37 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl +@@ -165,6 +327,37 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl } public CompletableFuture lightChunk(ChunkAccess chunk, boolean excludeBlocks) { @@ -4819,7 +4824,7 @@ index 785ca2c63fe47936ac4c0223dffd8971a295a37c..97662f8c8c125cb964d46b9095509a0d ChunkPos chunkPos = chunk.getPos(); chunk.setLightCorrect(false); this.addTask(chunkPos.x, chunkPos.z, ThreadedLevelLightEngine.TaskType.PRE_UPDATE, Util.name(() -> { -@@ -191,7 +385,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl +@@ -180,7 +373,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl } public void tryScheduleUpdate() { @@ -4828,14 +4833,14 @@ index 785ca2c63fe47936ac4c0223dffd8971a295a37c..97662f8c8c125cb964d46b9095509a0d this.taskMailbox.tell(() -> { this.runUpdate(); this.scheduled.set(false); -@@ -213,7 +407,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl +@@ -201,7 +394,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl } objectListIterator.back(j); - super.runLightUpdates(); + this.theLightEngine.propagateChanges(); // Paper - rewrite light engine - for(int var5 = 0; objectListIterator.hasNext() && var5 < i; ++var5) { + for (int var5 = 0; objectListIterator.hasNext() && var5 < i; var5++) { Pair pair2 = objectListIterator.next(); diff --git a/src/main/java/net/minecraft/server/level/TicketType.java b/src/main/java/net/minecraft/server/level/TicketType.java index 0d536d72ac918fbd403397ff369d10143ee9c204..6051e5f272838ef23276a90e21c2fc821ca155d1 100644 @@ -5081,10 +5086,10 @@ index 2ee1658532cb00d7bcd1d11e03f19d21ca7f2a9e..ac754827172a4de600d0a57a7d118534 public BlockState getBlockState(BlockPos pos) { return Blocks.VOID_AIR.defaultBlockState(); diff --git a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java -index 6bb508105641b5729572736c5c3f9bd6711e309a..60e760b42dd6471a229dfd45490dcf8c51979d35 100644 +index 6d1f924f7a1efe87f1a79f07ac4b4fbaae92f586..030fafe3b0bcad9e95251f5824ac2ef58640c705 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java -@@ -39,6 +39,48 @@ public class ImposterProtoChunk extends ProtoChunk { +@@ -45,6 +45,48 @@ public class ImposterProtoChunk extends ProtoChunk { this.allowWrites = propagateToWrapped; } @@ -5169,10 +5174,10 @@ index af757309cb46af6df07872f7596b66df6d6f18d7..73e682bb3ef3b2e450ec8c594b5365c7 this.level.getChunkSource().getLightEngine().checkBlock(blockposition); gameprofilerfiller.pop(); diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java -index dd62e257e16974a6d556a7f5e2d113a2cbc08981..dfae0918079425df92d958b04275be8ae60d4b60 100644 +index 268752a0b939abcaa9c7a302d2642b0c0fa2d331..2d7c6f00d399c7607e653078d77103a54509d03b 100644 --- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java +++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java -@@ -143,7 +143,7 @@ public class PalettedContainer implements PaletteResize, PalettedContainer +@@ -155,7 +155,7 @@ public class PalettedContainer implements PaletteResize, PalettedContainer return this.get(this.strategy.getIndex(x, y, z)); } @@ -5182,10 +5187,10 @@ index dd62e257e16974a6d556a7f5e2d113a2cbc08981..dfae0918079425df92d958b04275be8a return data.palette.valueFor(data.storage.get(index)); } diff --git a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java -index 38ec21faaa16df5485a81a581506700a5ab0a440..7da1ed9640211b0e064162dcdb0000538e7b30f3 100644 +index 03e5e5c5ea003ba52b9f3ee405cd77e22ea387c8..1036ff2ac8ba0967a36eb7977ed49500a05a33e6 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java -@@ -130,7 +130,7 @@ public class ProtoChunk extends ChunkAccess { +@@ -141,7 +141,7 @@ public class ProtoChunk extends ChunkAccess { } if (LightEngine.hasDifferentLightProperties(this, pos, blockState, state)) { diff --git a/patches/server/0980-Rewrite-chunk-system.patch b/patches/server/0980-Rewrite-chunk-system.patch index 19cbac85d0..a36c4f9797 100644 --- a/patches/server/0980-Rewrite-chunk-system.patch +++ b/patches/server/0980-Rewrite-chunk-system.patch @@ -18856,7 +18856,7 @@ index 9816913ad729fd39c173364b92e5db06a733bc55..a3881964bad0cab8f480eda634216d73 return crashreportsystemdetails; } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index ae5a2136a0e266d4c35190f5d33552994c842786..5657f1ecbadda96a79978f918393c0c9a58dca83 100644 +index bd6c60ebfc76d19313bf01048268f8ce7e6603c5..18356db5d998dccb9e645a9ee0bebc5cbbfa5f7a 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -276,6 +276,50 @@ public class ServerPlayer extends Player { @@ -18911,7 +18911,7 @@ index ae5a2136a0e266d4c35190f5d33552994c842786..5657f1ecbadda96a79978f918393c0c9 super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile); this.chatVisibility = ChatVisiblity.FULL; diff --git a/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java b/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java -index 97662f8c8c125cb964d46b9095509a0da9796dba..f382d138959b34bfc3a114bc9d96e056cccbfc89 100644 +index 3229bb8dfb9f39e5fa1c8d91cb58057764cd4abb..17b624294fc0cab2976e3804e6c9a24b91a0e3aa 100644 --- a/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java +++ b/src/main/java/net/minecraft/server/level/ThreadedLevelLightEngine.java @@ -37,15 +37,12 @@ import net.minecraft.world.level.chunk.ChunkStatus; @@ -18933,8 +18933,8 @@ index 97662f8c8c125cb964d46b9095509a0da9796dba..f382d138959b34bfc3a114bc9d96e056 public final boolean hasBlockLight; public final boolean hasSkyLight; // Paper end - replace light engine impl -@@ -53,8 +50,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl - public ThreadedLevelLightEngine(LightChunkGetter chunkProvider, ChunkMap chunkStorage, boolean hasBlockLight, ProcessorMailbox processor, ProcessorHandle> executor) { +@@ -59,8 +56,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl + ) { super(chunkProvider, false, false); // Paper - destroy vanilla light engine state this.chunkMap = chunkStorage; - this.sorterMailbox = executor; @@ -18943,7 +18943,7 @@ index 97662f8c8c125cb964d46b9095509a0da9796dba..f382d138959b34bfc3a114bc9d96e056 // Paper start - replace light engine impl this.hasBlockLight = true; this.hasSkyLight = hasBlockLight; // Nice variable name. -@@ -98,7 +94,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl +@@ -104,7 +100,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl ++totalChunks; } @@ -18952,7 +18952,7 @@ index 97662f8c8c125cb964d46b9095509a0da9796dba..f382d138959b34bfc3a114bc9d96e056 this.theLightEngine.relightChunks(chunks, (ChunkPos chunkPos) -> { chunkLightCallback.accept(chunkPos); ((java.util.concurrent.Executor)((ServerLevel)this.theLightEngine.getWorld()).getChunkSource().mainThreadProcessor).execute(() -> { -@@ -115,7 +111,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl +@@ -121,7 +117,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl private final Long2IntOpenHashMap chunksBeingWorkedOn = new Long2IntOpenHashMap(); private void queueTaskForSection(final int chunkX, final int chunkY, final int chunkZ, @@ -18961,7 +18961,7 @@ index 97662f8c8c125cb964d46b9095509a0da9796dba..f382d138959b34bfc3a114bc9d96e056 final ServerLevel world = (ServerLevel)this.theLightEngine.getWorld(); final ChunkAccess center = this.theLightEngine.getAnyChunkNow(chunkX, chunkZ); -@@ -142,7 +138,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl +@@ -148,7 +144,7 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl final long key = CoordinateUtils.getChunkKey(chunkX, chunkZ); @@ -18970,7 +18970,7 @@ index 97662f8c8c125cb964d46b9095509a0da9796dba..f382d138959b34bfc3a114bc9d96e056 if (updateFuture == null) { // not scheduled -@@ -282,17 +278,11 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl +@@ -285,16 +281,11 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl } private void addTask(int x, int z, ThreadedLevelLightEngine.TaskType stage, Runnable task) { @@ -18984,13 +18984,12 @@ index 97662f8c8c125cb964d46b9095509a0da9796dba..f382d138959b34bfc3a114bc9d96e056 - if (this.lightTasks.size() >= 1000) { - this.runUpdate(); - } -- - }, ChunkPos.asLong(x, z), completedLevelSupplier)); + throw new UnsupportedOperationException(); // Paper - rewrite chunk system } @Override -@@ -334,90 +324,15 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl +@@ -327,83 +318,15 @@ public class ThreadedLevelLightEngine extends LevelLightEngine implements AutoCl } public CompletableFuture lightChunk(ChunkAccess chunk, boolean excludeBlocks) { @@ -19031,17 +19030,12 @@ index 97662f8c8c125cb964d46b9095509a0da9796dba..f382d138959b34bfc3a114bc9d96e056 - if (!excludeBlocks) { - super.propagateLightSources(chunkPos); - } -- -- }, () -> { -- return "lightChunk " + chunkPos + " " + excludeBlocks; -- })); +- }, () -> "lightChunk " + chunkPos + " " + excludeBlocks)); - return CompletableFuture.supplyAsync(() -> { - chunk.setLightCorrect(true); - this.chunkMap.releaseLightTicket(chunkPos); - return chunk; -- }, (task) -> { -- this.addTask(chunkPos.x, chunkPos.z, ThreadedLevelLightEngine.TaskType.POST_UPDATE, task); -- }); +- }, task -> this.addTask(chunkPos.x, chunkPos.z, ThreadedLevelLightEngine.TaskType.POST_UPDATE, task)); + throw new UnsupportedOperationException(); // Paper - rewrite chunk system } @@ -19052,7 +19046,6 @@ index 97662f8c8c125cb964d46b9095509a0da9796dba..f382d138959b34bfc3a114bc9d96e056 - this.scheduled.set(false); - }); - } -- + // Paper - rewrite chunk system } @@ -19061,7 +19054,7 @@ index 97662f8c8c125cb964d46b9095509a0da9796dba..f382d138959b34bfc3a114bc9d96e056 - ObjectListIterator> objectListIterator = this.lightTasks.iterator(); - - int j; -- for(j = 0; objectListIterator.hasNext() && j < i; ++j) { +- for (j = 0; objectListIterator.hasNext() && j < i; j++) { - Pair pair = objectListIterator.next(); - if (pair.getFirst() == ThreadedLevelLightEngine.TaskType.PRE_UPDATE) { - pair.getSecond().run(); @@ -19071,7 +19064,7 @@ index 97662f8c8c125cb964d46b9095509a0da9796dba..f382d138959b34bfc3a114bc9d96e056 - objectListIterator.back(j); - this.theLightEngine.propagateChanges(); // Paper - rewrite light engine - -- for(int var5 = 0; objectListIterator.hasNext() && var5 < i; ++var5) { +- for (int var5 = 0; objectListIterator.hasNext() && var5 < i; var5++) { - Pair pair2 = objectListIterator.next(); - if (pair2.getFirst() == ThreadedLevelLightEngine.TaskType.POST_UPDATE) { - pair2.getSecond().run(); @@ -19079,13 +19072,12 @@ index 97662f8c8c125cb964d46b9095509a0da9796dba..f382d138959b34bfc3a114bc9d96e056 - - objectListIterator.remove(); - } -- + throw new UnsupportedOperationException(); // Paper - rewrite chunk system } public CompletableFuture waitForPendingTasks(int x, int z) { diff --git a/src/main/java/net/minecraft/server/level/Ticket.java b/src/main/java/net/minecraft/server/level/Ticket.java -index b346fa94b23d81da7da073f71dd12e672e0f079c..0edb97617f0c0da8dda901a26891b33c324715c7 100644 +index eba83b085435150e5954fd5d41dda9ce1d0601ad..e97329f867de2acbdd666925ba5d2aafa7a90574 100644 --- a/src/main/java/net/minecraft/server/level/Ticket.java +++ b/src/main/java/net/minecraft/server/level/Ticket.java @@ -6,9 +6,12 @@ public final class Ticket implements Comparable> { @@ -19103,7 +19095,7 @@ index b346fa94b23d81da7da073f71dd12e672e0f079c..0edb97617f0c0da8dda901a26891b33c this.type = type; this.ticketLevel = level; this.key = argument; -@@ -44,7 +47,7 @@ public final class Ticket implements Comparable> { +@@ -41,7 +44,7 @@ public final class Ticket implements Comparable> { @Override public String toString() { @@ -19112,7 +19104,7 @@ index b346fa94b23d81da7da073f71dd12e672e0f079c..0edb97617f0c0da8dda901a26891b33c } public TicketType getType() { -@@ -56,11 +59,10 @@ public final class Ticket implements Comparable> { +@@ -53,11 +56,10 @@ public final class Ticket implements Comparable> { } protected void setCreatedTick(long tickCreated) { @@ -19181,10 +19173,10 @@ index c3e7bd8865cc8990fc59f1ff0dfc1697cbb5ca49..5ece375eaf6bcc61864997a389bb5e24 + // Paper end } diff --git a/src/main/java/net/minecraft/server/network/PlayerChunkSender.java b/src/main/java/net/minecraft/server/network/PlayerChunkSender.java -index 13209267c26f46492a92e820889a9be0bd2287a0..f3b96a921e7d085b51da62fa5493384a7ded1f9d 100644 +index bf4bf32e926c7baf152a6c5912e2cd33598bdf9e..61c5402538b8dcace7bcc623f41940daaf7246ec 100644 --- a/src/main/java/net/minecraft/server/network/PlayerChunkSender.java +++ b/src/main/java/net/minecraft/server/network/PlayerChunkSender.java -@@ -44,17 +44,23 @@ public class PlayerChunkSender { +@@ -43,16 +43,23 @@ public class PlayerChunkSender { public void dropChunk(ServerPlayer player, ChunkPos pos) { if (!this.pendingChunks.remove(pos.toLong()) && player.isAlive()) { @@ -19201,7 +19193,6 @@ index 13209267c26f46492a92e820889a9be0bd2287a0..f3b96a921e7d085b51da62fa5493384a } // Paper end - PlayerChunkUnloadEvent - } -- } + // Paper end - rewrite player chunk loader @@ -19210,23 +19201,23 @@ index 13209267c26f46492a92e820889a9be0bd2287a0..f3b96a921e7d085b51da62fa5493384a if (this.unacknowledgedBatches < this.maxUnacknowledgedBatches) { float f = Math.max(1.0F, this.desiredChunksPerTick); this.batchQuota = Math.min(this.batchQuota + this.desiredChunksPerTick, f); -@@ -80,7 +86,8 @@ public class PlayerChunkSender { +@@ -78,7 +85,8 @@ public class PlayerChunkSender { } } - private static void sendChunk(ServerGamePacketListenerImpl handler, ServerLevel world, LevelChunk chunk) { + public static void sendChunk(ServerGamePacketListenerImpl handler, ServerLevel world, LevelChunk chunk) { // Paper - rewrite chunk loader - public + handler.player.serverLevel().chunkSource.chunkMap.getVisibleChunkIfPresent(chunk.getPos().toLong()).addPlayer(handler.player); - handler.send(new ClientboundLevelChunkWithLightPacket(chunk, world.getLightEngine(), (BitSet)null, (BitSet)null)); + handler.send(new ClientboundLevelChunkWithLightPacket(chunk, world.getLightEngine(), null, null)); // Paper start - PlayerChunkLoadEvent if (io.papermc.paper.event.packet.PlayerChunkLoadEvent.getHandlerList().getRegisteredListeners().length > 0) { -@@ -110,6 +117,7 @@ public class PlayerChunkSender { +@@ -118,6 +126,7 @@ public class PlayerChunkSender { } public void onChunkBatchReceivedByClient(float desiredBatchSize) { + if (true) return; // Paper - rewrite player chunk loader - --this.unacknowledgedBatches; - this.desiredChunksPerTick = Double.isNaN((double)desiredBatchSize) ? 0.01F : Mth.clamp(desiredBatchSize, 0.01F, 64.0F); + this.unacknowledgedBatches--; + this.desiredChunksPerTick = Double.isNaN(desiredBatchSize) ? 0.01F : Mth.clamp(desiredBatchSize, 0.01F, 64.0F); if (this.unacknowledgedBatches == 0) { diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java index d38fe02af4cc35ed5b22acec41bedb76151f8af5..4a569bf782bfdd870f32fe0ab5c3b8b86a07f218 100644 @@ -19271,7 +19262,7 @@ index d38fe02af4cc35ed5b22acec41bedb76151f8af5..4a569bf782bfdd870f32fe0ab5c3b8b8 while (iterator.hasNext()) { diff --git a/src/main/java/net/minecraft/util/SortedArraySet.java b/src/main/java/net/minecraft/util/SortedArraySet.java -index ca788f0dcec4a117b410fe8348969e056b138b1e..a6ac76707da39cf86113003b1f326433fdc86c86 100644 +index 3db68cf055c16c05d47c794596ddaa069275457e..7cf6880627c08556be62e08a536f4cd1eccfa7f1 100644 --- a/src/main/java/net/minecraft/util/SortedArraySet.java +++ b/src/main/java/net/minecraft/util/SortedArraySet.java @@ -14,6 +14,14 @@ public class SortedArraySet extends AbstractSet { @@ -19380,7 +19371,7 @@ index 640db9f71608310a64e09f1e3e677c01e6ccd98a..f2a7cb6ebed7a4b4019a09af2a025f62 if (flag1) { ++this.converted; diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 7c99742e01e894bcc7d89a8588b2f128cf9b765d..3f620c4b8415f09a8d4664481b2d41d421ee836e 100644 +index 5275e7a34f86830d43edcab3a0e94f8d8e9cfae5..b108f779abe3d9798c0bcbc983f41d48b33aa153 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -480,6 +480,58 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -19516,7 +19507,7 @@ index 7c99742e01e894bcc7d89a8588b2f128cf9b765d..3f620c4b8415f09a8d4664481b2d41d4 @Override diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java -index b18b896c624d5cadc02b1db9d011d82124d61d54..6f2c7baea0d1ac7813c7b85e1f5558573745762c 100644 +index c64794d02a861f0880b6877550a87752fdf26407..55e45feeaae7ec00805ef108939e50916f6e3148 100644 --- a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java +++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java @@ -38,12 +38,28 @@ import net.minecraft.world.level.chunk.storage.SectionStorage; @@ -19551,7 +19542,7 @@ index b18b896c624d5cadc02b1db9d011d82124d61d54..6f2c7baea0d1ac7813c7b85e1f555857 } public void add(BlockPos pos, Holder type) { -@@ -180,8 +196,8 @@ public class PoiManager extends SectionStorage { +@@ -177,8 +193,8 @@ public class PoiManager extends SectionStorage { } public int sectionsToVillage(SectionPos pos) { @@ -19562,7 +19553,7 @@ index b18b896c624d5cadc02b1db9d011d82124d61d54..6f2c7baea0d1ac7813c7b85e1f555857 } boolean isVillageCenter(long pos) { -@@ -195,21 +211,118 @@ public class PoiManager extends SectionStorage { +@@ -192,21 +208,118 @@ public class PoiManager extends SectionStorage { @Override public void tick(BooleanSupplier shouldKeepTicking) { @@ -19607,8 +19598,8 @@ index b18b896c624d5cadc02b1db9d011d82124d61d54..6f2c7baea0d1ac7813c7b85e1f555857 + io.papermc.paper.chunk.system.poi.PoiChunk ret = manager.getPoiChunkIfLoaded(chunkX, chunkZ, true); + + return ret == null ? Optional.empty() : ret.getSectionForVanilla(chunkY); -+ } -+ + } + + @Override + public Optional getOrLoad(long pos) { + int chunkX = io.papermc.paper.util.CoordinateUtils.getChunkSectionX(pos); @@ -19670,8 +19661,8 @@ index b18b896c624d5cadc02b1db9d011d82124d61d54..6f2c7baea0d1ac7813c7b85e1f555857 + this.onSectionLoad(SectionPos.asLong(chunkX, sectionY, chunkZ)); + } + } - } - ++ } ++ + public void checkConsistency(net.minecraft.world.level.chunk.ChunkAccess chunk) { + int chunkX = chunk.getPos().x; + int chunkZ = chunk.getPos().z; @@ -19685,18 +19676,18 @@ index b18b896c624d5cadc02b1db9d011d82124d61d54..6f2c7baea0d1ac7813c7b85e1f555857 + // Paper end - rewrite chunk system + public void checkConsistencyWithBlocks(SectionPos sectionPos, LevelChunkSection chunkSection) { - Util.ifElse(this.getOrLoad(sectionPos.asLong()), (poiSet) -> { - poiSet.refresh((populator) -> { -@@ -248,7 +361,7 @@ public class PoiManager extends SectionStorage { - }).map((pair) -> { - return pair.getFirst().chunk(); - }).filter((chunkPos) -> { -- return this.loadedChunks.add(chunkPos.toLong()); -+ return true; // Paper - rewrite chunk system - }).forEach((chunkPos) -> { - world.getChunk(chunkPos.x, chunkPos.z, ChunkStatus.EMPTY); - }); -@@ -264,7 +377,7 @@ public class PoiManager extends SectionStorage { + Util.ifElse(this.getOrLoad(sectionPos.asLong()), poiSet -> poiSet.refresh(populator -> { + if (mayHavePoi(chunkSection)) { +@@ -241,7 +354,7 @@ public class PoiManager extends SectionStorage { + .map(sectionPos -> Pair.of(sectionPos, this.getOrLoad(sectionPos.asLong()))) + .filter(pair -> !pair.getSecond().map(PoiSection::isValid).orElse(false)) + .map(pair -> pair.getFirst().chunk()) +- .filter(chunkPos -> this.loadedChunks.add(chunkPos.toLong())) ++ // Paper - rewrite chunk system + .forEach(chunkPos -> world.getChunk(chunkPos.x, chunkPos.z, ChunkStatus.EMPTY)); + } + +@@ -255,7 +368,7 @@ public class PoiManager extends SectionStorage { @Override protected int getLevelFromSource(long id) { @@ -19705,7 +19696,7 @@ index b18b896c624d5cadc02b1db9d011d82124d61d54..6f2c7baea0d1ac7813c7b85e1f555857 } @Override -@@ -287,6 +400,35 @@ public class PoiManager extends SectionStorage { +@@ -277,6 +390,35 @@ public class PoiManager extends SectionStorage { } } @@ -19742,7 +19733,7 @@ index b18b896c624d5cadc02b1db9d011d82124d61d54..6f2c7baea0d1ac7813c7b85e1f555857 HAS_SPACE(PoiRecord::hasSpace), IS_OCCUPIED(PoiRecord::isOccupied), diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java -index 795a02941d7cecb58ec45b5e79c8d510ff21163a..3fc17817906876e83f040f908b8b1ba6cfa37b8b 100644 +index beb0ff150fdd8ca6c44139ccb2d0eb77a4431e0c..f7d69dd83aad8e0ec1497441c61188bcf230865f 100644 --- a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java +++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java @@ -29,6 +29,7 @@ public class PoiSection { @@ -19752,7 +19743,7 @@ index 795a02941d7cecb58ec45b5e79c8d510ff21163a..3fc17817906876e83f040f908b8b1ba6 + public final Optional noAllocateOptional = Optional.of(this); // Paper - rewrite chunk system public static Codec codec(Runnable updateListener) { - return RecordCodecBuilder.create((instance) -> { + return RecordCodecBuilder.create( @@ -46,6 +47,12 @@ public class PoiSection { this(updateListener, true, ImmutableList.of()); } @@ -19767,10 +19758,10 @@ index 795a02941d7cecb58ec45b5e79c8d510ff21163a..3fc17817906876e83f040f908b8b1ba6 this.setDirty = updateListener; this.isValid = valid; diff --git a/src/main/java/net/minecraft/world/level/EntityGetter.java b/src/main/java/net/minecraft/world/level/EntityGetter.java -index 57d4d2014f33a2f069d6c5aaa8e87e36b63a7177..cc888bbcd6a50124fa553bc4a8ffd1e8885d3856 100644 +index bd20bea7f76a7307f1698fb2dfef37125032d166..9a28912f52824acdc80a62243b136e6f365bf567 100644 --- a/src/main/java/net/minecraft/world/level/EntityGetter.java +++ b/src/main/java/net/minecraft/world/level/EntityGetter.java -@@ -18,6 +18,18 @@ import net.minecraft.world.phys.shapes.Shapes; +@@ -19,6 +19,18 @@ import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; public interface EntityGetter { @@ -19940,7 +19931,7 @@ index cedde2235227eb5820beefb98549994e1cca1198..9c743c980697a14d7348554fb77f242d + // Paper end } diff --git a/src/main/java/net/minecraft/world/level/LevelReader.java b/src/main/java/net/minecraft/world/level/LevelReader.java -index cc0d20e9f851268fe8403ac516f426ec1d008150..12eaafdbd324fa36b3f46c3b644bc8117a4123ad 100644 +index fa73462650dd29296b737435574755a613832b77..84e5d879c2de08fa95f12de8cea2c6d4da8ec76d 100644 --- a/src/main/java/net/minecraft/world/level/LevelReader.java +++ b/src/main/java/net/minecraft/world/level/LevelReader.java @@ -26,6 +26,15 @@ public interface LevelReader extends BlockAndTintGetter, CollisionGetter, Signal @@ -20526,10 +20517,10 @@ index eebaf98bc0fa4696af59b2a79563beb73501a554..645a1773237f2002c233ec1f3ff6f0ca } } diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java -index 98b3909b536f11eda9c481ffd74066ad0cdb0ebc..0ec0be22f7292d57c40da6f1f4575bdebf8dbd09 100644 +index 3b842297774472af5999438e883c1cd262f3c286..e8f8e1f2128df81705a88cee4b9a7760fb123750 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java -@@ -30,43 +30,31 @@ public class EntityStorage implements EntityPersistentStorage { +@@ -30,45 +30,31 @@ public class EntityStorage implements EntityPersistentStorage { private static final String ENTITIES_TAG = "Entities"; private static final String POSITION_TAG = "Position"; public final ServerLevel level; @@ -20550,43 +20541,45 @@ index 98b3909b536f11eda9c481ffd74066ad0cdb0ebc..0ec0be22f7292d57c40da6f1f4575bde @Override public CompletableFuture> loadEntities(ChunkPos pos) { -- return this.emptyChunks.contains(pos.toLong()) ? CompletableFuture.completedFuture(emptyChunk(pos)) : this.worker.loadAsync(pos).thenApplyAsync((nbt) -> { -- if (nbt.isEmpty()) { -- this.emptyChunks.add(pos.toLong()); -- return emptyChunk(pos); -- } else { -- try { -- ChunkPos chunkPos2 = readChunkPos(nbt.get()); -- if (!Objects.equals(pos, chunkPos2)) { -- LOGGER.error("Chunk file at {} is in the wrong location. (Expected {}, got {})", pos, pos, chunkPos2); +- return this.emptyChunks.contains(pos.toLong()) +- ? CompletableFuture.completedFuture(emptyChunk(pos)) +- : this.worker.loadAsync(pos).thenApplyAsync(nbt -> { +- if (nbt.isEmpty()) { +- this.emptyChunks.add(pos.toLong()); +- return emptyChunk(pos); +- } else { +- try { +- ChunkPos chunkPos2 = readChunkPos(nbt.get()); +- if (!Objects.equals(pos, chunkPos2)) { +- LOGGER.error("Chunk file at {} is in the wrong location. (Expected {}, got {})", pos, pos, chunkPos2); +- } +- } catch (Exception var6) { +- LOGGER.warn("Failed to parse chunk {} position info", pos, var6); - } -- } catch (Exception var6) { -- LOGGER.warn("Failed to parse chunk {} position info", pos, var6); -- } - -- CompoundTag compoundTag = this.upgradeChunkTag(nbt.get()); -- ListTag listTag = compoundTag.getList("Entities", 10); -- List list = EntityType.loadEntitiesRecursive(listTag, this.level).collect(ImmutableList.toImmutableList()); -- return new ChunkEntities<>(pos, list); -- } -- }, this.entityDeserializerQueue::tell); +- CompoundTag compoundTag = this.upgradeChunkTag(nbt.get()); +- ListTag listTag = compoundTag.getList("Entities", 10); +- List list = EntityType.loadEntitiesRecursive(listTag, this.level).collect(ImmutableList.toImmutableList()); +- return new ChunkEntities<>(pos, list); +- } +- }, this.entityDeserializerQueue::tell); + throw new UnsupportedOperationException(); // Paper - rewrite chunk system - copy out read logic into readEntities -+ } -+ + } + +- private static ChunkPos readChunkPos(CompoundTag chunkNbt) { + // Paper start - rewrite chunk system + public static List readEntities(ServerLevel level, CompoundTag compoundTag) { + ListTag listTag = compoundTag.getList("Entities", 10); + List list = EntityType.loadEntitiesRecursive(listTag, level).collect(ImmutableList.toImmutableList()); + return list; - } ++ } + // Paper end - rewrite chunk system - -- private static ChunkPos readChunkPos(CompoundTag chunkNbt) { ++ + public static ChunkPos readChunkPos(CompoundTag chunkNbt) { // Paper - public int[] is = chunkNbt.getIntArray("Position"); return new ChunkPos(is[0], is[1]); } -@@ -81,45 +69,75 @@ public class EntityStorage implements EntityPersistentStorage { +@@ -83,43 +69,74 @@ public class EntityStorage implements EntityPersistentStorage { @Override public void storeEntities(ChunkEntities dataList) { @@ -20598,23 +20591,21 @@ index 98b3909b536f11eda9c481ffd74066ad0cdb0ebc..0ec0be22f7292d57c40da6f1f4575bde ChunkPos chunkPos = dataList.getPos(); if (dataList.isEmpty()) { if (this.emptyChunks.add(chunkPos.toLong())) { -- this.worker.store(chunkPos, (CompoundTag)null); +- this.worker.store(chunkPos, null); + // Paper - rewrite chunk system } - } else { - ListTag listTag = new ListTag(); -- dataList.getEntities().forEach((entity) -> { -- CompoundTag compoundTag = new CompoundTag(); -- if (entity.save(compoundTag)) { -- listTag.add(compoundTag); +- dataList.getEntities().forEach(entity -> { +- CompoundTag compoundTagx = new CompoundTag(); +- if (entity.save(compoundTagx)) { +- listTag.add(compoundTagx); - } -- - }); - CompoundTag compoundTag = NbtUtils.addCurrentDataVersion(new CompoundTag()); - compoundTag.put("Entities", listTag); - writeChunkPos(compoundTag, chunkPos); -- this.worker.store(chunkPos, compoundTag).exceptionally((ex) -> { +- this.worker.store(chunkPos, compoundTag).exceptionally(ex -> { - LOGGER.error("Failed to store chunk {}", chunkPos, ex); - return null; - }); @@ -20899,10 +20890,10 @@ index fa086a19f038b929f356292b2f657929765f7b6f..f1ecc3832da094400ed9d45bfc60af10 while (objectiterator.hasNext()) { diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java -index 56f0e217276b01aed2f20a71f6849826285fc15b..54db563d80bbabd87a2be6f5ead92b482ac07b10 100644 +index 809da7fec1e1288a7a7bf1ee46c5b7bdd12bca01..bc6043a21227ce8c9c3879bc9c93c3803f79857b 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java -@@ -34,27 +34,28 @@ import net.minecraft.world.level.ChunkPos; +@@ -34,17 +34,17 @@ import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.LevelHeightAccessor; import org.slf4j.Logger; @@ -20922,7 +20913,11 @@ index 56f0e217276b01aed2f20a71f6849826285fc15b..54db563d80bbabd87a2be6f5ead92b48 + public final RegistryAccess registryAccess; // Paper - rewrite chunk system protected final LevelHeightAccessor levelHeightAccessor; - public SectionStorage(Path path, Function> codecFactory, Function factory, DataFixer dataFixer, DataFixTypes dataFixTypes, boolean dsync, RegistryAccess dynamicRegistryManager, LevelHeightAccessor world) { + public SectionStorage( +@@ -57,13 +57,14 @@ public class SectionStorage implements AutoCloseable { + RegistryAccess dynamicRegistryManager, + LevelHeightAccessor world + ) { + super(path, dsync); // Paper - remove mojang I/O thread this.codec = codecFactory; this.factory = factory; @@ -20935,18 +20930,18 @@ index 56f0e217276b01aed2f20a71f6849826285fc15b..54db563d80bbabd87a2be6f5ead92b48 } protected void tick(BooleanSupplier shouldKeepTicking) { -@@ -116,23 +117,21 @@ public class SectionStorage implements AutoCloseable { +@@ -122,23 +123,21 @@ public class SectionStorage implements AutoCloseable { } private void readColumn(ChunkPos pos) { - Optional optional = this.tryRead(pos).join(); - RegistryOps registryOps = RegistryOps.create(NbtOps.INSTANCE, this.registryAccess); -- this.readColumn(pos, registryOps, optional.orElse((CompoundTag)null)); +- this.readColumn(pos, registryOps, optional.orElse(null)); + throw new IllegalStateException("Only chunk system can load in state, offending class:" + this.getClass().getName()); // Paper - rewrite chunk system } private CompletableFuture> tryRead(ChunkPos pos) { -- return this.worker.loadAsync(pos).exceptionally((throwable) -> { +- return this.worker.loadAsync(pos).exceptionally(throwable -> { - if (throwable instanceof IOException iOException) { - LOGGER.error("Error reading chunk {} data from disk", pos, iOException); - return Optional.empty(); @@ -20966,18 +20961,18 @@ index 56f0e217276b01aed2f20a71f6849826285fc15b..54db563d80bbabd87a2be6f5ead92b48 private void readColumn(ChunkPos pos, DynamicOps ops, @Nullable T data) { + if (true) throw new IllegalStateException("Only chunk system can load in state, offending class:" + this.getClass().getName()); // Paper - rewrite chunk system if (data == null) { - for(int i = this.levelHeightAccessor.getMinSection(); i < this.levelHeightAccessor.getMaxSection(); ++i) { + for (int i = this.levelHeightAccessor.getMinSection(); i < this.levelHeightAccessor.getMaxSection(); i++) { this.storage.put(getKey(pos, i), Optional.empty()); -@@ -177,7 +176,7 @@ public class SectionStorage implements AutoCloseable { +@@ -179,7 +178,7 @@ public class SectionStorage implements AutoCloseable { Dynamic dynamic = this.writeColumn(pos, registryOps); Tag tag = dynamic.getValue(); if (tag instanceof CompoundTag) { - this.worker.store(pos, (CompoundTag)tag); + try { this.write(pos, (CompoundTag)tag); } catch (IOException ioexception) { SectionStorage.LOGGER.error("Error writing data to disk", ioexception); } // Paper - nuke IOWorker } else { - LOGGER.error("Expected compound tag, got {}", (Object)tag); + LOGGER.error("Expected compound tag, got {}", tag); } -@@ -222,7 +221,7 @@ public class SectionStorage implements AutoCloseable { +@@ -229,7 +228,7 @@ public class SectionStorage implements AutoCloseable { } private static int getVersion(Dynamic dynamic) { @@ -20986,7 +20981,7 @@ index 56f0e217276b01aed2f20a71f6849826285fc15b..54db563d80bbabd87a2be6f5ead92b48 } public void flush(ChunkPos pos) { -@@ -240,6 +239,9 @@ public class SectionStorage implements AutoCloseable { +@@ -246,6 +245,9 @@ public class SectionStorage implements AutoCloseable { @Override public void close() throws IOException { @@ -20998,10 +20993,10 @@ index 56f0e217276b01aed2f20a71f6849826285fc15b..54db563d80bbabd87a2be6f5ead92b48 + // Paper - rewrite chunk system } diff --git a/src/main/java/net/minecraft/world/level/entity/EntityTickList.java b/src/main/java/net/minecraft/world/level/entity/EntityTickList.java -index 2830d32bba3dc85847e3a5d9b4d98f822e34b606..4cdfc433df67afcd455422e9baf56f167dd712ae 100644 +index 74a285b8b018a9c94ccea519f1ce8b9e2ef3cb64..83a39f900551e39d5af6f17a339a386ddee4feef 100644 --- a/src/main/java/net/minecraft/world/level/entity/EntityTickList.java +++ b/src/main/java/net/minecraft/world/level/entity/EntityTickList.java -@@ -8,54 +8,42 @@ import javax.annotation.Nullable; +@@ -9,52 +9,41 @@ import javax.annotation.Nullable; import net.minecraft.world.entity.Entity; public class EntityTickList { @@ -21015,7 +21010,7 @@ index 2830d32bba3dc85847e3a5d9b4d98f822e34b606..4cdfc433df67afcd455422e9baf56f16 - if (this.iterated == this.active) { - this.passive.clear(); - -- for(Int2ObjectMap.Entry entry : Int2ObjectMaps.fastIterable(this.active)) { +- for (Entry entry : Int2ObjectMaps.fastIterable(this.active)) { - this.passive.put(entry.getIntKey(), entry.getValue()); - } - @@ -21024,7 +21019,6 @@ index 2830d32bba3dc85847e3a5d9b4d98f822e34b606..4cdfc433df67afcd455422e9baf56f16 - this.passive = int2ObjectMap; - } + // Paper - replace with better logic, do not delay removals - } public void add(Entity entity) { @@ -21053,7 +21047,7 @@ index 2830d32bba3dc85847e3a5d9b4d98f822e34b606..4cdfc433df67afcd455422e9baf56f16 - this.iterated = this.active; - - try { -- for(Entity entity : this.active.values()) { +- for (Entity entity : this.active.values()) { - action.accept(entity); - } - } finally { @@ -21067,7 +21061,6 @@ index 2830d32bba3dc85847e3a5d9b4d98f822e34b606..4cdfc433df67afcd455422e9baf56f16 + while (iterator.hasNext()) { + action.accept(iterator.next()); } -- + } finally { + iterator.finishedIterating(); } @@ -21097,10 +21090,10 @@ index 54308f1decc3982f30bf8b7a8a9d8865bfdbb9fd..902156477bdfc9917105f1229f760c26 while (iterator.hasNext()) { diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java b/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java -index 1ca00340aaa201dd34e5c350d23ef53e126a0ca6..16356d7f388561300e794a52f3f263b8e7d9b880 100644 +index 769a8c5788e6a01666b9b5ac24b02c632c6c9e48..09867812600b24b3b7d05b58f98582650d313fc8 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java +++ b/src/main/java/net/minecraft/world/level/levelgen/structure/StructureCheck.java -@@ -50,8 +50,101 @@ public class StructureCheck { +@@ -49,8 +49,101 @@ public class StructureCheck { private final BiomeSource biomeSource; private final long seed; private final DataFixer fixerUpper; @@ -21202,9 +21195,9 @@ index 1ca00340aaa201dd34e5c350d23ef53e126a0ca6..16356d7f388561300e794a52f3f263b8 + } + // Paper end - rewrite chunk system - synchronise this class - public StructureCheck(ChunkScanAccess chunkIoWorker, RegistryAccess registryManager, StructureTemplateManager structureTemplateManager, ResourceKey worldKey, ChunkGenerator chunkGenerator, RandomState noiseConfig, LevelHeightAccessor world, BiomeSource biomeSource, long seed, DataFixer dataFixer) { // Paper - fix missing CB diff - this.storageAccess = chunkIoWorker; -@@ -70,7 +163,7 @@ public class StructureCheck { + public StructureCheck( + ChunkScanAccess chunkIoWorker, +@@ -80,7 +173,7 @@ public class StructureCheck { public StructureCheckResult checkStart(ChunkPos pos, Structure type, boolean skipReferencedStructures) { long l = pos.toLong(); @@ -21213,27 +21206,25 @@ index 1ca00340aaa201dd34e5c350d23ef53e126a0ca6..16356d7f388561300e794a52f3f263b8 if (object2IntMap != null) { return this.checkStructureInfo(object2IntMap, type, skipReferencedStructures); } else { -@@ -78,9 +171,9 @@ public class StructureCheck { +@@ -88,9 +181,9 @@ public class StructureCheck { if (structureCheckResult != null) { return structureCheckResult; } else { -- boolean bl = this.featureChecks.computeIfAbsent(type, (structure2) -> { -- return new Long2BooleanOpenHashMap(); -- }).computeIfAbsent(l, (chunkPos) -> { -+ boolean bl = this.featureChecksSafe.computeIfAbsent(type, (structure2) -> { // Paper - rewrite chunk system - synchronise this class -+ return new SynchronisedLong2BooleanMap(PER_FEATURE_CHECK_LIMIT); // Paper - rewrite chunk system - synchronise this class -+ }).getOrCompute(l, (chunkPos) -> { // Paper - rewrite chunk system - synchronise this class - return this.canCreateStructure(pos, type); - }); +- boolean bl = this.featureChecks +- .computeIfAbsent(type, structure2 -> new Long2BooleanOpenHashMap()) +- .computeIfAbsent(l, chunkPos -> this.canCreateStructure(pos, type)); ++ boolean bl = this.featureChecksSafe // Paper - rewrite chunk system - synchronise this class ++ .computeIfAbsent(type, structure2 -> new SynchronisedLong2BooleanMap(PER_FEATURE_CHECK_LIMIT)) // Paper - rewrite chunk system - synchronise this class ++ .getOrCompute(l, chunkPos -> this.canCreateStructure(pos, type)); // Paper - rewrite chunk system - synchronise this class return !bl ? StructureCheckResult.START_NOT_PRESENT : StructureCheckResult.CHUNK_LOAD_NEEDED; -@@ -193,17 +286,26 @@ public class StructureCheck { + } + } +@@ -216,15 +309,26 @@ public class StructureCheck { } private void storeFullResults(long pos, Object2IntMap referencesByStructure) { - this.loadedChunks.put(pos, deduplicateEmptyMap(referencesByStructure)); -- this.featureChecks.values().forEach((generationPossibilityByChunkPos) -> { -- generationPossibilityByChunkPos.remove(pos); -- }); +- this.featureChecks.values().forEach(generationPossibilityByChunkPos -> generationPossibilityByChunkPos.remove(pos)); + // Paper start - rewrite chunk system - synchronise this class + this.loadedChunksSafe.put(pos, deduplicateEmptyMap(referencesByStructure)); + // once we insert into loadedChunks, we don't really need to be very careful about removing everything @@ -21257,13 +21248,13 @@ index 1ca00340aaa201dd34e5c350d23ef53e126a0ca6..16356d7f388561300e794a52f3f263b8 } + // Paper end - rewrite chunk system - synchronise this class - referencesByStructure.computeInt(structure, (feature, references) -> { - return references == null ? 1 : references + 1; + referencesByStructure.computeInt(structure, (feature, references) -> references == null ? 1 : references + 1); + return referencesByStructure; diff --git a/src/main/java/net/minecraft/world/ticks/LevelChunkTicks.java b/src/main/java/net/minecraft/world/ticks/LevelChunkTicks.java -index 9f6c2e5b5d9e8d714a47c770e255d06c0ef7c190..ac807277a6b26d140ea9873d17c7aa4fb5fe37b2 100644 +index da086494de9668d28305ccd23d32e9cfe45d0880..e7b3f9ceff72b255d443026b4e51291823bfd582 100644 --- a/src/main/java/net/minecraft/world/ticks/LevelChunkTicks.java +++ b/src/main/java/net/minecraft/world/ticks/LevelChunkTicks.java -@@ -25,6 +25,19 @@ public class LevelChunkTicks implements SerializableTickContainer, TickCon +@@ -26,6 +26,19 @@ public class LevelChunkTicks implements SerializableTickContainer, TickCon @Nullable private BiConsumer, ScheduledTick> onTickAdded; @@ -21298,9 +21289,9 @@ index 9f6c2e5b5d9e8d714a47c770e255d06c0ef7c190..ac807277a6b26d140ea9873d17c7aa4f + this.dirty = true; // Paper - add dirty flag this.scheduleUnchecked(orderedTick); } - -@@ -83,7 +98,7 @@ public class LevelChunkTicks implements SerializableTickContainer, TickCon - while(iterator.hasNext()) { + } +@@ -81,7 +96,7 @@ public class LevelChunkTicks implements SerializableTickContainer, TickCon + while (iterator.hasNext()) { ScheduledTick scheduledTick = iterator.next(); if (predicate.test(scheduledTick)) { - iterator.remove(); @@ -21308,15 +21299,15 @@ index 9f6c2e5b5d9e8d714a47c770e255d06c0ef7c190..ac807277a6b26d140ea9873d17c7aa4f this.ticksPerPosition.remove(scheduledTick); } } -@@ -101,6 +116,7 @@ public class LevelChunkTicks implements SerializableTickContainer, TickCon +@@ -98,6 +113,7 @@ public class LevelChunkTicks implements SerializableTickContainer, TickCon @Override public ListTag save(long l, Function function) { + this.lastSaved = l; // Paper - add dirty system to level ticks ListTag listTag = new ListTag(); if (this.pendingTicks != null) { - for(SavedTick savedTick : this.pendingTicks) { -@@ -117,6 +133,11 @@ public class LevelChunkTicks implements SerializableTickContainer, TickCon + for (SavedTick savedTick : this.pendingTicks) { +@@ -114,6 +130,11 @@ public class LevelChunkTicks implements SerializableTickContainer, TickCon public void unpack(long time) { if (this.pendingTicks != null) { @@ -21327,7 +21318,7 @@ index 9f6c2e5b5d9e8d714a47c770e255d06c0ef7c190..ac807277a6b26d140ea9873d17c7aa4f + // Paper end - add dirty system to level chunk ticks int i = -this.pendingTicks.size(); - for(SavedTick savedTick : this.pendingTicks) { + for (SavedTick savedTick : this.pendingTicks) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java index 260ca4a9c170567b27488466f802c91212997f91..e47b00912fc76e9639f9c51d96e6d39da3c963e3 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java diff --git a/patches/server/0981-incremental-chunk-and-player-saving.patch b/patches/server/0981-incremental-chunk-and-player-saving.patch index 7f2209d3c1..ee962a9466 100644 --- a/patches/server/0981-incremental-chunk-and-player-saving.patch +++ b/patches/server/0981-incremental-chunk-and-player-saving.patch @@ -118,7 +118,7 @@ index a3881964bad0cab8f480eda634216d73dfbf7bb0..b6407dd3e5b87782503988f898bbf054 // Paper start - rewrite chunk system - add close param this.save(progressListener, flush, savingDisabled, false); diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 5657f1ecbadda96a79978f918393c0c9a58dca83..910c5087406837033e580ec2a23f5d30d807b723 100644 +index 18356db5d998dccb9e645a9ee0bebc5cbbfa5f7a..4a62c2937460dca9d938c40da47529e106503cad 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -191,6 +191,7 @@ import org.bukkit.inventory.MainHand; diff --git a/patches/server/0982-Optimize-isInWorldBounds-and-getBlockState-for-inlin.patch b/patches/server/0982-Optimize-isInWorldBounds-and-getBlockState-for-inlin.patch index d1ad0bf59f..bb73216915 100644 --- a/patches/server/0982-Optimize-isInWorldBounds-and-getBlockState-for-inlin.patch +++ b/patches/server/0982-Optimize-isInWorldBounds-and-getBlockState-for-inlin.patch @@ -12,11 +12,11 @@ Replace all calls to the new place to the unnecessary forward. Optimize getType and getBlockData to manually inline and optimize the calls diff --git a/src/main/java/net/minecraft/core/Vec3i.java b/src/main/java/net/minecraft/core/Vec3i.java -index 369b54b96c682717ef93d05312714b4d30efaceb..beadef19ee136c27601f0d116a86967344c2e403 100644 +index 21387401c7958414fa6f3fd530488481d92a6eca..17bb8fb0353a818d946a0831781918781314c0ce 100644 --- a/src/main/java/net/minecraft/core/Vec3i.java +++ b/src/main/java/net/minecraft/core/Vec3i.java -@@ -31,6 +31,12 @@ public class Vec3i implements Comparable { - }); +@@ -30,6 +30,12 @@ public class Vec3i implements Comparable { + ); } + // Paper start @@ -54,10 +54,10 @@ index 3e5addb60ae8f466dad09edb3ae1fc88fe2681e9..5e8d2e4245757a0889645ea79ee68afb public abstract BlockState setBlockState(BlockPos pos, BlockState state, boolean moved); diff --git a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java -index 60e760b42dd6471a229dfd45490dcf8c51979d35..4a3ac7dedf5cb1e76f16ec4f18e82afc717d0ced 100644 +index 030fafe3b0bcad9e95251f5824ac2ef58640c705..b4e05ce176dfc6a2e66b294ed461c32020adf203 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/ImposterProtoChunk.java -@@ -91,6 +91,12 @@ public class ImposterProtoChunk extends ProtoChunk { +@@ -97,6 +97,12 @@ public class ImposterProtoChunk extends ProtoChunk { public BlockState getBlockState(BlockPos pos) { return this.wrapped.getBlockState(pos); } @@ -71,10 +71,10 @@ index 60e760b42dd6471a229dfd45490dcf8c51979d35..4a3ac7dedf5cb1e76f16ec4f18e82afc @Override public FluidState getFluidState(BlockPos pos) { diff --git a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java -index 7da1ed9640211b0e064162dcdb0000538e7b30f3..7aa585875dad5296526bb5d67fc5ea0f8875e452 100644 +index 1036ff2ac8ba0967a36eb7977ed49500a05a33e6..a1f6274c9b1ab02ee55f1ae6011fc2dbb6e4824f 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java -@@ -86,14 +86,18 @@ public class ProtoChunk extends ChunkAccess { +@@ -95,14 +95,18 @@ public class ProtoChunk extends ChunkAccess { @Override public BlockState getBlockState(BlockPos pos) { diff --git a/patches/server/0984-Strip-raytracing-for-EntityLiving-hasLineOfSight.patch b/patches/server/0984-Strip-raytracing-for-EntityLiving-hasLineOfSight.patch index 9b7e64077b..46e1b7e745 100644 --- a/patches/server/0984-Strip-raytracing-for-EntityLiving-hasLineOfSight.patch +++ b/patches/server/0984-Strip-raytracing-for-EntityLiving-hasLineOfSight.patch @@ -26,7 +26,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 7f5457522835b073246054e66699fe73f7005b25..3f3498e0a24ad8b890173ce71cd63c1fffb561df 100644 +index 40e21effc948b02874a6ed1d1c340c4dc87579d6..aa261d3ad04bc3a19b3200214214650d9a9ac2af 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3746,7 +3746,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0988-Flat-bedrock-generator-settings.patch b/patches/server/0988-Flat-bedrock-generator-settings.patch index 7e54f34f22..d1bbbdf7ef 100644 --- a/patches/server/0988-Flat-bedrock-generator-settings.patch +++ b/patches/server/0988-Flat-bedrock-generator-settings.patch @@ -168,16 +168,17 @@ index b99283c31193e2110f6e3f39c23dbfc2442bab2b..a34e53249668d917c9d77c6837b91360 + // Paper end - Flat bedrock generator settings } diff --git a/src/main/java/net/minecraft/world/level/levelgen/carver/CarvingContext.java b/src/main/java/net/minecraft/world/level/levelgen/carver/CarvingContext.java -index a745458ea3581ea91a68c863e3fd0a0292d73a61..6fcb84e4d2cd310bd1e04f4cf7b9bc2bbbf4fdad 100644 +index 390bcf9c302effd9db42d7a0e65b5433cc2eadd6..b9e919d31e442f49300744395af3cf9431e86c57 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/carver/CarvingContext.java +++ b/src/main/java/net/minecraft/world/level/levelgen/carver/CarvingContext.java -@@ -21,8 +21,8 @@ public class CarvingContext extends WorldGenerationContext { - private final RandomState randomState; - private final SurfaceRules.RuleSource surfaceRule; - -- public CarvingContext(NoiseBasedChunkGenerator noiseChunkGenerator, RegistryAccess registryManager, LevelHeightAccessor heightLimitView, NoiseChunk chunkNoiseSampler, RandomState noiseConfig, SurfaceRules.RuleSource materialRule) { +@@ -27,9 +27,9 @@ public class CarvingContext extends WorldGenerationContext { + LevelHeightAccessor heightLimitView, + NoiseChunk chunkNoiseSampler, + RandomState noiseConfig, +- SurfaceRules.RuleSource materialRule ++ SurfaceRules.RuleSource materialRule, @javax.annotation.Nullable net.minecraft.world.level.Level level // Paper - Flat bedrock generator settings + ) { - super(noiseChunkGenerator, heightLimitView); -+ public CarvingContext(NoiseBasedChunkGenerator noiseChunkGenerator, RegistryAccess registryManager, LevelHeightAccessor heightLimitView, NoiseChunk chunkNoiseSampler, RandomState noiseConfig, SurfaceRules.RuleSource materialRule, @javax.annotation.Nullable net.minecraft.world.level.Level level) { // Paper - Flat bedrock generator settings + super(noiseChunkGenerator, heightLimitView, level); // Paper - Flat bedrock generator settings this.registryAccess = registryManager; this.noiseChunk = chunkNoiseSampler; diff --git a/patches/server/0989-Entity-Activation-Range-2.0.patch b/patches/server/0989-Entity-Activation-Range-2.0.patch index c26295b371..b0eff05afa 100644 --- a/patches/server/0989-Entity-Activation-Range-2.0.patch +++ b/patches/server/0989-Entity-Activation-Range-2.0.patch @@ -111,7 +111,7 @@ index bd8c96e914b156284bdbb960f168e63e1f122920..abb4c32e8b35de332fa517523e8c598e } else { passenger.stopRiding(); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 3f620c4b8415f09a8d4664481b2d41d421ee836e..132ab49c02b83c37e1a64fc19f9bdfc04f52f2ed 100644 +index b108f779abe3d9798c0bcbc983f41d48b33aa153..a66fe080ee73171090abec48352ad0bd457a2a6f 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -412,6 +412,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -183,10 +183,10 @@ index d6393210cfee53685f83c8491bea8b9c13b01eea..3d95257d2203fe40bb1fab58ad2a1f9e public float getWalkTargetValue(BlockPos pos) { return this.getWalkTargetValue(pos, this.level()); diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java -index 07c1ca01c38d5d7d0a95ad5004b5df9f4a222935..e5995d0db5dcfba59a873ff439601894fdacd556 100644 +index 9be9a6a59666297e05a9fc19d9345ae7d5f3bf40..040d62effc651d14d3557f8ff582cb078b74ae1e 100644 --- a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java +++ b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java -@@ -33,6 +33,7 @@ public class GoalSelector { +@@ -34,6 +34,7 @@ public class GoalSelector { private final EnumSet disabledFlags = EnumSet.noneOf(Goal.Flag.class); private int tickCount; private int newGoalRate = 3; @@ -194,8 +194,8 @@ index 07c1ca01c38d5d7d0a95ad5004b5df9f4a222935..e5995d0db5dcfba59a873ff439601894 public GoalSelector(Supplier profiler) { this.profiler = profiler; -@@ -49,6 +50,20 @@ public class GoalSelector { - }); +@@ -48,6 +49,20 @@ public class GoalSelector { + this.availableGoals.removeIf(goal -> predicate.test(goal.getGoal())); } + // Paper start @@ -213,10 +213,10 @@ index 07c1ca01c38d5d7d0a95ad5004b5df9f4a222935..e5995d0db5dcfba59a873ff439601894 + } + // Paper end public void removeGoal(Goal goal) { - this.availableGoals.stream().filter((wrappedGoal) -> { - return wrappedGoal.getGoal() == goal; + this.availableGoals.stream().filter(wrappedGoal -> wrappedGoal.getGoal() == goal).filter(WrappedGoal::isRunning).forEach(WrappedGoal::stop); + this.availableGoals.removeIf(wrappedGoal -> wrappedGoal.getGoal() == goal); diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java -index 9fc374c17f6b3ee4ab3c582d05e96321b772f2d6..07519c817cc6de04a98198c43a0c2b02ba3141eb 100644 +index 7b276b37433f054513e3eff88362424686eddebc..de7c3654b5d134e380c0d7e8800beb6c10d8a22a 100644 --- a/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java +++ b/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java @@ -23,6 +23,14 @@ public abstract class MoveToBlockGoal extends Goal { @@ -234,7 +234,7 @@ index 9fc374c17f6b3ee4ab3c582d05e96321b772f2d6..07519c817cc6de04a98198c43a0c2b02 public MoveToBlockGoal(PathfinderMob mob, double speed, int range, int maxYDifference) { this.mob = mob; -@@ -114,6 +122,7 @@ public abstract class MoveToBlockGoal extends Goal { +@@ -113,6 +121,7 @@ public abstract class MoveToBlockGoal extends Goal { mutableBlockPos.setWithOffset(blockPos, m, k - 1, n); if (this.mob.isWithinRestriction(mutableBlockPos) && this.isValidTarget(this.mob.level(), mutableBlockPos)) { this.blockPos = mutableBlockPos; @@ -302,7 +302,7 @@ index fa2569fecefb3e3af3264928a3c7a347710deedf..24044795d8e0f1fb15a4f2f5401f4489 super.customServerAiStep(); } diff --git a/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java b/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java -index b149e8bcac034bb3fc118a9adcb0de45e18ed5e9..fc35cfc9d045f3e5b6a50af1d0ba83b6e322091f 100644 +index eaafb57c14ead01ffd2650fdec9ca75406201e41..761142374f793a1cd4228936b21a68d7a0458894 100644 --- a/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java @@ -52,6 +52,7 @@ public class MinecartHopper extends AbstractMinecartContainer implements Hopper @@ -310,23 +310,24 @@ index b149e8bcac034bb3fc118a9adcb0de45e18ed5e9..fc35cfc9d045f3e5b6a50af1d0ba83b6 this.setEnabled(bl); } + this.immunize(); // Paper - } -@@ -89,10 +90,12 @@ public class MinecartHopper extends AbstractMinecartContainer implements Hopper + public boolean isEnabled() { +@@ -87,11 +88,13 @@ public class MinecartHopper extends AbstractMinecartContainer implements Hopper public boolean suckInItems() { if (HopperBlockEntity.suckInItems(this.level(), this)) { + this.immunize(); // Paper return true; } else { - for(ItemEntity itemEntity : this.level().getEntitiesOfClass(ItemEntity.class, this.getBoundingBox().inflate(0.25D, 0.0D, 0.25D), EntitySelector.ENTITY_STILL_ALIVE)) { + for (ItemEntity itemEntity : this.level() + .getEntitiesOfClass(ItemEntity.class, this.getBoundingBox().inflate(0.25, 0.0, 0.25), EntitySelector.ENTITY_STILL_ALIVE)) { if (HopperBlockEntity.addItem(this, itemEntity)) { + this.immunize(); // Paper return true; } } -@@ -122,4 +125,11 @@ public class MinecartHopper extends AbstractMinecartContainer implements Hopper +@@ -121,4 +124,11 @@ public class MinecartHopper extends AbstractMinecartContainer implements Hopper public AbstractContainerMenu createMenu(int syncId, Inventory playerInventory) { return new HopperMenu(syncId, playerInventory, this); } @@ -356,10 +357,10 @@ index 5c209e323a5559480231c6d99357ba8b89edb027..4bedd5801cc8ce14387f02dfb361a00a public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot // Paper start - add paper world config diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java -index b1061db1d9b3bfde61d5016e10556c4320095827..c71690dbc3dc52803945f1608f0ee3ba94146354 100644 +index 7415011211925e962dcd1a3fdfde2c9bb6ec8335..5c59550db0ed7a6c1cf654fd5b251c3ba1e762fb 100644 --- a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java -@@ -143,6 +143,10 @@ public class PistonMovingBlockEntity extends BlockEntity { +@@ -147,6 +147,10 @@ public class PistonMovingBlockEntity extends BlockEntity { } entity.setDeltaMovement(e, g, h); diff --git a/patches/server/0990-Optional-per-player-mob-spawns.patch b/patches/server/0990-Optional-per-player-mob-spawns.patch index b80d633556..dc4d88d053 100644 --- a/patches/server/0990-Optional-per-player-mob-spawns.patch +++ b/patches/server/0990-Optional-per-player-mob-spawns.patch @@ -64,7 +64,7 @@ index 20cdfd2bbd5dc71fd37ccedaf3a8d06b45553c9b..059ab637adf1be576fa1fff36a91b6c5 this.lastSpawnState = spawnercreature_d; diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 910c5087406837033e580ec2a23f5d30d807b723..651aceca9030e1f6060af9fc9f8d349dc0451728 100644 +index 4a62c2937460dca9d938c40da47529e106503cad..7fb2c0f2576142423cd0e50b811ce4f55795e43d 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -256,6 +256,10 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0991-Anti-Xray.patch b/patches/server/0991-Anti-Xray.patch index 584b0a7774..0e19dabd18 100644 --- a/patches/server/0991-Anti-Xray.patch +++ b/patches/server/0991-Anti-Xray.patch @@ -1001,23 +1001,23 @@ index 0000000000000000000000000000000000000000..80a2dfb266ae1221680a7b24fee2f7e2 + } +} diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundChunksBiomesPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundChunksBiomesPacket.java -index 6cff1a98dc7cf33947ec760dbc3d3d0ec5db5f6c..51f647de153255c919b1440338cf1b3e2d6b5dbf 100644 +index 921bd11bd8d266c2dd5c78a44f4714a48417eb3e..99e6d6e97e2869d574ea04b7eccbd6c0f827b19b 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundChunksBiomesPacket.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundChunksBiomesPacket.java -@@ -63,8 +63,10 @@ public record ClientboundChunksBiomesPacket(List entry : chunk.getHeightmaps()) { + for (Entry entry : chunk.getHeightmaps()) { @@ -35,7 +38,14 @@ public class ClientboundLevelChunkPacketData { } @@ -1047,8 +1047,8 @@ index 89e3163b0301f8414c9400a6e00cdd85841fe2e8..74b5cec09d953a247bc5aba3c4232a4c + // Paper end this.blockEntitiesData = Lists.newArrayList(); - for(Map.Entry entry2 : chunk.getBlockEntities().entrySet()) { -@@ -85,9 +95,15 @@ public class ClientboundLevelChunkPacketData { + for (Entry entry2 : chunk.getBlockEntities().entrySet()) { +@@ -82,9 +92,15 @@ public class ClientboundLevelChunkPacketData { return byteBuf; } @@ -1058,14 +1058,14 @@ index 89e3163b0301f8414c9400a6e00cdd85841fe2e8..74b5cec09d953a247bc5aba3c4232a4c + public static void extractChunkData(FriendlyByteBuf buf, LevelChunk chunk, com.destroystokyo.paper.antixray.ChunkPacketInfo chunkPacketInfo) { + int chunkSectionIndex = 0; + - for(LevelChunkSection levelChunkSection : chunk.getSections()) { + for (LevelChunkSection levelChunkSection : chunk.getSections()) { - levelChunkSection.write(buf); + levelChunkSection.write(buf, chunkPacketInfo, chunkSectionIndex); + chunkSectionIndex++; + // Paper end } - } + diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java index 26e46d751c8f8162c2bafe2fc109fc91dc4b7c0f..6412dff5ed0505f62dd5b71ab9606257858a7317 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java @@ -1139,17 +1139,17 @@ index 5063eb6d4a24600262c32d2c9eb5fb5bf8fa354e..692a01b52a71e26887ee42cbd5fd64b0 public void destroyAndAck(BlockPos pos, int sequence, String reason) { diff --git a/src/main/java/net/minecraft/server/network/PlayerChunkSender.java b/src/main/java/net/minecraft/server/network/PlayerChunkSender.java -index f3b96a921e7d085b51da62fa5493384a7ded1f9d..12f2bf95d3ea3d29f6b4b9ec38a92f7102daa4a1 100644 +index 9baae5af750b46ededbd660d15934da71befde72..8a360bf585041af8cd74dbb38d3c888c998289c5 100644 --- a/src/main/java/net/minecraft/server/network/PlayerChunkSender.java +++ b/src/main/java/net/minecraft/server/network/PlayerChunkSender.java -@@ -88,7 +88,10 @@ public class PlayerChunkSender { +@@ -87,7 +87,10 @@ public class PlayerChunkSender { public static void sendChunk(ServerGamePacketListenerImpl handler, ServerLevel world, LevelChunk chunk) { // Paper - rewrite chunk loader - public handler.player.serverLevel().chunkSource.chunkMap.getVisibleChunkIfPresent(chunk.getPos().toLong()).addPlayer(handler.player); -- handler.send(new ClientboundLevelChunkWithLightPacket(chunk, world.getLightEngine(), (BitSet)null, (BitSet)null)); +- handler.send(new ClientboundLevelChunkWithLightPacket(chunk, world.getLightEngine(), null, null)); + // Paper start - Anti-Xray + final boolean shouldModify = world.chunkPacketBlockController.shouldModify(handler.player, chunk); -+ handler.send(new ClientboundLevelChunkWithLightPacket(chunk, world.getLightEngine(), (BitSet)null, (BitSet)null, shouldModify)); ++ handler.send(new ClientboundLevelChunkWithLightPacket(chunk, world.getLightEngine(), null, null, shouldModify)); + // Paper end - Anti-Xray // Paper start - PlayerChunkLoadEvent if (io.papermc.paper.event.packet.PlayerChunkLoadEvent.getHandlerList().getRegisteredListeners().length > 0) { @@ -1280,18 +1280,18 @@ index b606e33f8b64eaba28c008cc353d88aa45549e31..8852263cb6faec1b68326145aa30e5cd public int getSerializedSize() { diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java -index dfae0918079425df92d958b04275be8ae60d4b60..0f930f8355ea99d1cb1a8d27edc1c224588f852f 100644 +index 2d7c6f00d399c7607e653078d77103a54509d03b..d473637a705c1f11079fff08e334545779a99a84 100644 --- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java +++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java -@@ -30,6 +30,7 @@ public class PalettedContainer implements PaletteResize, PalettedContainer - return 0; - }; +@@ -28,6 +28,7 @@ public class PalettedContainer implements PaletteResize, PalettedContainer + private static final int MIN_PALETTE_BITS = 0; + private final PaletteResize dummyPaletteResize = (newSize, added) -> 0; public final IdMap registry; + private final T @org.jetbrains.annotations.Nullable [] presetValues; // Paper - Anti-Xray - Add preset values private volatile PalettedContainer.Data data; private final PalettedContainer.Strategy strategy; // private final ThreadingDetector threadingDetector = new ThreadingDetector("PalettedContainer"); // Paper - unused -@@ -42,14 +43,19 @@ public class PalettedContainer implements PaletteResize, PalettedContainer +@@ -40,14 +41,19 @@ public class PalettedContainer implements PaletteResize, PalettedContainer // this.threadingDetector.checkAndUnlock(); // Paper - disable this } @@ -1308,20 +1308,26 @@ index dfae0918079425df92d958b04275be8ae60d4b60..0f930f8355ea99d1cb1a8d27edc1c224 } public static Codec> codecRO(IdMap idList, Codec entryCodec, PalettedContainer.Strategy paletteProvider, T defaultValue) { - PalettedContainerRO.Unpacker> unpacker = (idListx, paletteProviderx, serialized) -> { -- return unpack(idListx, paletteProviderx, serialized).map((result) -> { -+ return unpack(idListx, paletteProviderx, serialized, defaultValue, null).map((result) -> { // Paper - Anti-Xray - Add preset values - return result; - }); - }; -@@ -66,19 +72,52 @@ public class PalettedContainer implements PaletteResize, PalettedContainer - }); + PalettedContainerRO.Unpacker> unpacker = (idListx, paletteProviderx, serialized) -> unpack( +- idListx, paletteProviderx, serialized ++ idListx, paletteProviderx, serialized, defaultValue, null // Paper - Anti-Xray - Add preset values + ) + .map(result -> (PalettedContainerRO)result); + return codec(idList, entryCodec, paletteProvider, defaultValue, unpacker); +@@ -71,25 +77,58 @@ public class PalettedContainer implements PaletteResize, PalettedContainer + ); } -- public PalettedContainer(IdMap idList, PalettedContainer.Strategy paletteProvider, PalettedContainer.Configuration dataProvider, BitStorage storage, List paletteEntries) { + // Paper start - Anti-Xray - Add preset values + @Deprecated @io.papermc.paper.annotation.DoNotUse public PalettedContainer(IdMap idList, PalettedContainer.Strategy paletteProvider, PalettedContainer.Configuration dataProvider, BitStorage storage, List paletteEntries) { this(idList, paletteProvider, dataProvider, storage, paletteEntries, null, null); } -+ public PalettedContainer(IdMap idList, PalettedContainer.Strategy paletteProvider, PalettedContainer.Configuration dataProvider, BitStorage storage, List paletteEntries, T defaultValue, T @org.jetbrains.annotations.Nullable [] presetValues) { + public PalettedContainer( + IdMap idList, + PalettedContainer.Strategy paletteProvider, + PalettedContainer.Configuration dataProvider, + BitStorage storage, +- List paletteEntries ++ List paletteEntries, T defaultValue, T @org.jetbrains.annotations.Nullable [] presetValues + ) { + this.presetValues = presetValues; this.registry = idList; this.strategy = paletteProvider; @@ -1369,8 +1375,8 @@ index dfae0918079425df92d958b04275be8ae60d4b60..0f930f8355ea99d1cb1a8d27edc1c224 + // Paper end this.strategy = paletteProvider; this.registry = idList; - this.data = this.createOrReuseData((PalettedContainer.Data)null, 0); -@@ -93,11 +132,33 @@ public class PalettedContainer implements PaletteResize, PalettedContainer + this.data = this.createOrReuseData(null, 0); +@@ -106,11 +145,33 @@ public class PalettedContainer implements PaletteResize, PalettedContainer @Override public synchronized int onResize(int newBits, T object) { // Paper - synchronize PalettedContainer.Data data = this.data; @@ -1405,7 +1411,7 @@ index dfae0918079425df92d958b04275be8ae60d4b60..0f930f8355ea99d1cb1a8d27edc1c224 public T getAndSet(int x, int y, int z, T value) { this.acquire(); -@@ -167,25 +228,34 @@ public class PalettedContainer implements PaletteResize, PalettedContainer +@@ -177,24 +238,33 @@ public class PalettedContainer implements PaletteResize, PalettedContainer data.palette.read(buf); buf.readLongArray(data.storage.getRaw()); this.data = data; @@ -1413,7 +1419,6 @@ index dfae0918079425df92d958b04275be8ae60d4b60..0f930f8355ea99d1cb1a8d27edc1c224 } finally { this.release(); } - } + // Paper start - Anti-Xray; Add chunk packet info @@ -1435,15 +1440,15 @@ index dfae0918079425df92d958b04275be8ae60d4b60..0f930f8355ea99d1cb1a8d27edc1c224 } finally { this.release(); } - } -- private static DataResult> unpack(IdMap idList, PalettedContainer.Strategy paletteProvider, PalettedContainerRO.PackedData serialized) { -+ private static DataResult> unpack(IdMap idList, PalettedContainer.Strategy paletteProvider, PalettedContainerRO.PackedData serialized, T defaultValue, T @org.jetbrains.annotations.Nullable [] presetValues) { // Paper - Anti-Xray - Add preset values + private static DataResult> unpack( +- IdMap idList, PalettedContainer.Strategy paletteProvider, PalettedContainerRO.PackedData serialized ++ IdMap idList, PalettedContainer.Strategy paletteProvider, PalettedContainerRO.PackedData serialized, T defaultValue, T @org.jetbrains.annotations.Nullable [] presetValues // Paper - Anti-Xray - Add preset values + ) { List list = serialized.paletteEntries(); int i = paletteProvider.size(); - int j = paletteProvider.calculateBitsForSerialization(idList, list.size()); -@@ -225,7 +295,7 @@ public class PalettedContainer implements PaletteResize, PalettedContainer +@@ -227,7 +297,7 @@ public class PalettedContainer implements PaletteResize, PalettedContainer } } @@ -1452,7 +1457,7 @@ index dfae0918079425df92d958b04275be8ae60d4b60..0f930f8355ea99d1cb1a8d27edc1c224 } @Override -@@ -285,12 +355,12 @@ public class PalettedContainer implements PaletteResize, PalettedContainer +@@ -284,12 +354,12 @@ public class PalettedContainer implements PaletteResize, PalettedContainer } public PalettedContainer copy() { @@ -1467,7 +1472,7 @@ index dfae0918079425df92d958b04275be8ae60d4b60..0f930f8355ea99d1cb1a8d27edc1c224 } @Override -@@ -334,9 +404,18 @@ public class PalettedContainer implements PaletteResize, PalettedContainer +@@ -328,9 +398,18 @@ public class PalettedContainer implements PaletteResize, PalettedContainer return 1 + this.palette.getSerializedSize() + VarInt.getByteSize(this.storage.getRaw().length) + this.storage.getRaw().length * 8; } diff --git a/patches/server/0992-Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch b/patches/server/0992-Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch index c9e2fc6398..05c9814be3 100644 --- a/patches/server/0992-Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch +++ b/patches/server/0992-Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch @@ -60,7 +60,7 @@ index 059ab637adf1be576fa1fff36a91b6c5f1b5f035..5afbb5b307cc67d86dd916dc8f7521d5 spawnercreature_d = NaturalSpawner.createState(naturalSpawnChunkCount, this.level.getAllEntities(), this::getFullChunk, null, true); } else { diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 651aceca9030e1f6060af9fc9f8d349dc0451728..acc9858e0cf10cb2aae0554037096411a208bd05 100644 +index 7fb2c0f2576142423cd0e50b811ce4f55795e43d..acc1751324f040accc4fc18914ed281e572358eb 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -260,6 +260,7 @@ public class ServerPlayer extends Player { diff --git a/patches/server/0993-Optimize-Collision-to-not-load-chunks.patch b/patches/server/0993-Optimize-Collision-to-not-load-chunks.patch index b992c3fadf..cfa7f3d55e 100644 --- a/patches/server/0993-Optimize-Collision-to-not-load-chunks.patch +++ b/patches/server/0993-Optimize-Collision-to-not-load-chunks.patch @@ -26,7 +26,7 @@ index 461c27292af06a5150de8ec263d0c8527e8c5278..37245ff682837e7e8c9647f4afe30f0d // CraftBukkit end entityplayer1.setPos(entityplayer1.getX(), entityplayer1.getY() + 1.0D, entityplayer1.getZ()); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 703b32362cf6a23dfe9326aa4e0ee74511e0d2cb..8531304667a85436fd557d319fe36a37b3661ae5 100644 +index a66fe080ee73171090abec48352ad0bd457a2a6f..d4c8f2cb1e3adf45863226ae9ad31968bc3445c9 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -242,6 +242,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -38,61 +38,59 @@ index 703b32362cf6a23dfe9326aa4e0ee74511e0d2cb..8531304667a85436fd557d319fe36a37 public @org.jetbrains.annotations.Nullable net.minecraft.server.level.ChunkMap.TrackedEntity tracker; // Paper diff --git a/src/main/java/net/minecraft/world/level/BlockCollisions.java b/src/main/java/net/minecraft/world/level/BlockCollisions.java -index f2c423154ed6a00882a46d93b69ed4f6ba73782c..a3eaf80b020c3bbc0306c5d17659ee661dfd275b 100644 +index cd342fa776b5d84e52aa1660c19be9ab45eaad2d..f6cc3d550df8481086acdcb62f44a1051ae79f80 100644 --- a/src/main/java/net/minecraft/world/level/BlockCollisions.java +++ b/src/main/java/net/minecraft/world/level/BlockCollisions.java -@@ -65,22 +65,41 @@ public class BlockCollisions extends AbstractIterator { +@@ -66,18 +66,37 @@ public class BlockCollisions extends AbstractIterator { + @Override protected T computeNext() { - while(true) { - if (this.cursor.advance()) { -- int i = this.cursor.nextX(); -- int j = this.cursor.nextY(); -- int k = this.cursor.nextZ(); -+ int i = this.cursor.nextX(); final int x = i; // Paper -+ int j = this.cursor.nextY(); final int y = j; // Paper -+ int k = this.cursor.nextZ(); final int z = k; // Paper - int l = this.cursor.getNextType(); - if (l == 3) { - continue; - } -+ // Paper start - ensure we don't load chunks -+ final @Nullable Entity source = this.context instanceof net.minecraft.world.phys.shapes.EntityCollisionContext entityContext ? entityContext.getEntity() : null; -+ boolean far = source != null && io.papermc.paper.util.MCUtil.distanceSq(source.getX(), y, source.getZ(), x, y, z) > 14; -+ this.pos.set(x, y, z); - + while (this.cursor.advance()) { +- int i = this.cursor.nextX(); +- int j = this.cursor.nextY(); +- int k = this.cursor.nextZ(); ++ int i = this.cursor.nextX(); final int x = i; // Paper - OBFHELPER ++ int j = this.cursor.nextY(); final int y = j; // Paper - OBFHELPER ++ int k = this.cursor.nextZ(); final int z = k; // Paper - OBFHELPER + int l = this.cursor.getNextType(); + if (l != 3) { - BlockGetter blockGetter = this.getChunk(i, k); -- if (blockGetter == null) { -+ BlockState blockState; -+ if (this.collisionGetter instanceof net.minecraft.server.level.WorldGenRegion) { -+ BlockGetter blockGetter = this.getChunk(x, z); -+ if (blockGetter == null) { -+ continue; +- if (blockGetter != null) { +- this.pos.set(i, j, k); +- BlockState blockState = blockGetter.getBlockState(this.pos); +- if ((!this.onlySuffocatingBlocks || blockState.isSuffocating(blockGetter, this.pos)) +- && (l != 1 || blockState.hasLargeCollisionShape()) +- && (l != 2 || blockState.is(Blocks.MOVING_PISTON))) { ++ // Paper start - ensure we don't load chunks ++ // BlockGetter blockGetter = this.getChunk(i, k); ++ if (true) { ++ final @Nullable Entity source = this.context instanceof net.minecraft.world.phys.shapes.EntityCollisionContext entityContext ? entityContext.getEntity() : null; ++ boolean far = source != null && io.papermc.paper.util.MCUtil.distanceSq(source.getX(), y, source.getZ(), x, y, z) > 14; ++ this.pos.set(x, y, z); ++ BlockState blockState; ++ if (this.collisionGetter instanceof net.minecraft.server.level.WorldGenRegion) { ++ BlockGetter blockGetter = this.getChunk(x, z); ++ if (blockGetter == null) { ++ continue; ++ } ++ blockState = blockGetter.getBlockState(this.pos); ++ } else if ((!far && source instanceof net.minecraft.server.level.ServerPlayer) || (source != null && source.collisionLoadChunks)) { ++ blockState = this.collisionGetter.getBlockState(this.pos); ++ } else { ++ blockState = this.collisionGetter.getBlockStateIfLoaded(this.pos); + } -+ blockState = blockGetter.getBlockState(this.pos); -+ } else if ((!far && source instanceof net.minecraft.server.level.ServerPlayer) || (source != null && source.collisionLoadChunks)) { -+ blockState = this.collisionGetter.getBlockState(this.pos); -+ } else { -+ blockState = this.collisionGetter.getBlockStateIfLoaded(this.pos); -+ } -+ -+ if (blockState == null) { -+ if (!(source instanceof net.minecraft.server.level.ServerPlayer) || source.level().paperConfig().chunks.preventMovingIntoUnloadedChunks) { -+ return this.resultProvider.apply(new BlockPos.MutableBlockPos(x, y, z), Shapes.create(far ? source.getBoundingBox() : new AABB(new BlockPos(x, y, z)))); ++ if (blockState == null) { ++ if (!(source instanceof net.minecraft.server.level.ServerPlayer) || source.level().paperConfig().chunks.preventMovingIntoUnloadedChunks) { ++ return this.resultProvider.apply(new BlockPos.MutableBlockPos(x, y, z), Shapes.create(far ? source.getBoundingBox() : new AABB(new BlockPos(x, y, z)))); ++ } ++ continue; + } -+ // Paper end - continue; - } - -- this.pos.set(i, j, k); -- BlockState blockState = blockGetter.getBlockState(this.pos); -- if (this.onlySuffocatingBlocks && !blockState.isSuffocating(blockGetter, this.pos) || l == 1 && !blockState.hasLargeCollisionShape() || l == 2 && !blockState.is(Blocks.MOVING_PISTON)) { -+ // Paper - moved up -+ if (/*this.onlySuffocatingBlocks && (!blockState.isSuffocating(blockGetter, this.pos)) ||*/ l == 1 && !blockState.hasLargeCollisionShape() || l == 2 && !blockState.is(Blocks.MOVING_PISTON)) { // Paper - onlySuffocatingBlocks is only true on the client, so we don't care about it here - continue; - } - ++ if (/*(!this.onlySuffocatingBlocks || blockState.isSuffocating(blockGetter, this.pos)) &&*/ (l != 1 || blockState.hasLargeCollisionShape()) && (l != 2 || blockState.is(Blocks.MOVING_PISTON))) { // Paper - onlySuffocatingBlocks is only true on the client, so we don't care about it here ++ // Paper end + VoxelShape voxelShape = blockState.getCollisionShape(this.collisionGetter, this.pos, this.context); + if (voxelShape == Shapes.block()) { + if (this.box.intersects(i, j, k, i + 1.0, j + 1.0, k + 1.0)) { diff --git a/src/main/java/net/minecraft/world/level/CollisionGetter.java b/src/main/java/net/minecraft/world/level/CollisionGetter.java -index 140d10807a3a6806578cd203ba58383590c2f2c0..c476e37df8a75d77f5093b2a449e04f25ef2c2dd 100644 +index ea9a5e643d7ccce4e4d20644901c22cf63c6d890..69754fbebb51f7f804c97a749fd65ce15ae22f1b 100644 --- a/src/main/java/net/minecraft/world/level/CollisionGetter.java +++ b/src/main/java/net/minecraft/world/level/CollisionGetter.java @@ -44,11 +44,13 @@ public interface CollisionGetter extends BlockGetter { @@ -100,7 +98,7 @@ index 140d10807a3a6806578cd203ba58383590c2f2c0..c476e37df8a75d77f5093b2a449e04f2 default boolean noCollision(@Nullable Entity entity, AABB box) { + try { if (entity != null) entity.collisionLoadChunks = true; // Paper - for(VoxelShape voxelShape : this.getBlockCollisions(entity, box)) { + for (VoxelShape voxelShape : this.getBlockCollisions(entity, box)) { if (!voxelShape.isEmpty()) { return false; } diff --git a/patches/server/0994-Optimize-GoalSelector-Goal.Flag-Set-operations.patch b/patches/server/0994-Optimize-GoalSelector-Goal.Flag-Set-operations.patch index 8e879a28af..dcbd7aff42 100644 --- a/patches/server/0994-Optimize-GoalSelector-Goal.Flag-Set-operations.patch +++ b/patches/server/0994-Optimize-GoalSelector-Goal.Flag-Set-operations.patch @@ -58,10 +58,10 @@ index 16f9a98b8a939e5ca7e2dc04f87134a7ed66736b..dd423302b1baa64ef86ded87a2965934 protected int adjustedTickDelay(int ticks) { diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java -index e5995d0db5dcfba59a873ff439601894fdacd556..676f5485a4ca9252e911213dcda8d51776b637b6 100644 +index 040d62effc651d14d3557f8ff582cb078b74ae1e..38af5c7280366fd6ec077f3d914ea5f3ee77451a 100644 --- a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java +++ b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java -@@ -30,10 +30,12 @@ public class GoalSelector { +@@ -31,10 +31,12 @@ public class GoalSelector { private final Map lockedFlags = new EnumMap<>(Goal.Flag.class); private final Set availableGoals = Sets.newLinkedHashSet(); private final Supplier profiler; @@ -75,20 +75,16 @@ index e5995d0db5dcfba59a873ff439601894fdacd556..676f5485a4ca9252e911213dcda8d517 public GoalSelector(Supplier profiler) { this.profiler = profiler; -@@ -65,26 +67,32 @@ public class GoalSelector { +@@ -64,22 +66,32 @@ public class GoalSelector { } // Paper end public void removeGoal(Goal goal) { -- this.availableGoals.stream().filter((wrappedGoal) -> { -- return wrappedGoal.getGoal() == goal; -- }).filter(WrappedGoal::isRunning).forEach(WrappedGoal::stop); -- this.availableGoals.removeIf((wrappedGoal) -> { -- return wrappedGoal.getGoal() == goal; -- }); +- this.availableGoals.stream().filter(wrappedGoal -> wrappedGoal.getGoal() == goal).filter(WrappedGoal::isRunning).forEach(WrappedGoal::stop); +- this.availableGoals.removeIf(wrappedGoal -> wrappedGoal.getGoal() == goal); - } - - private static boolean goalContainsAnyFlags(WrappedGoal goal, EnumSet controls) { -- for(Goal.Flag flag : goal.getFlags()) { +- for (Goal.Flag flag : goal.getFlags()) { - if (controls.contains(flag)) { - return true; + // Paper start - remove streams from pathfindergoalselector @@ -111,7 +107,7 @@ index e5995d0db5dcfba59a873ff439601894fdacd556..676f5485a4ca9252e911213dcda8d517 } private static boolean goalCanBeReplacedForAllFlags(WrappedGoal goal, Map goalsByControl) { -- for(Goal.Flag flag : goal.getFlags()) { +- for (Goal.Flag flag : goal.getFlags()) { + // Paper start + long flagIterator = goal.getFlags().getBackingSet(); + int wrappedGoalSize = goal.getFlags().size(); @@ -122,21 +118,24 @@ index e5995d0db5dcfba59a873ff439601894fdacd556..676f5485a4ca9252e911213dcda8d517 if (!goalsByControl.getOrDefault(flag, NO_GOAL).canBeReplacedBy(goal)) { return false; } -@@ -98,7 +106,7 @@ public class GoalSelector { +@@ -93,7 +105,7 @@ public class GoalSelector { profilerFiller.push("goalCleanup"); - for(WrappedGoal wrappedGoal : this.availableGoals) { + for (WrappedGoal wrappedGoal : this.availableGoals) { - if (wrappedGoal.isRunning() && (goalContainsAnyFlags(wrappedGoal, this.disabledFlags) || !wrappedGoal.canContinueToUse())) { -+ if (wrappedGoal.isRunning() && (goalContainsAnyFlags(wrappedGoal, this.goalTypes) || !wrappedGoal.canContinueToUse())) { ++ if (wrappedGoal.isRunning() && (goalContainsAnyFlags(wrappedGoal, this.goalTypes) || !wrappedGoal.canContinueToUse())) { // Paper - Perf: optimize goal types by removing streams wrappedGoal.stop(); } } -@@ -116,8 +124,14 @@ public class GoalSelector { +@@ -111,11 +123,14 @@ public class GoalSelector { profilerFiller.push("goalUpdate"); - for(WrappedGoal wrappedGoal2 : this.availableGoals) { -- if (!wrappedGoal2.isRunning() && !goalContainsAnyFlags(wrappedGoal2, this.disabledFlags) && goalCanBeReplacedForAllFlags(wrappedGoal2, this.lockedFlags) && wrappedGoal2.canUse()) { -- for(Goal.Flag flag : wrappedGoal2.getFlags()) { + for (WrappedGoal wrappedGoal2 : this.availableGoals) { +- if (!wrappedGoal2.isRunning() +- && !goalContainsAnyFlags(wrappedGoal2, this.disabledFlags) +- && goalCanBeReplacedForAllFlags(wrappedGoal2, this.lockedFlags) +- && wrappedGoal2.canUse()) { +- for (Goal.Flag flag : wrappedGoal2.getFlags()) { + // Paper start + if (!wrappedGoal2.isRunning() && !goalContainsAnyFlags(wrappedGoal2, this.goalTypes) && goalCanBeReplacedForAllFlags(wrappedGoal2, this.lockedFlags) && wrappedGoal2.canUse()) { + long flagIterator = wrappedGoal2.getFlags().getBackingSet(); @@ -148,7 +147,7 @@ index e5995d0db5dcfba59a873ff439601894fdacd556..676f5485a4ca9252e911213dcda8d517 WrappedGoal wrappedGoal3 = this.lockedFlags.getOrDefault(flag, NO_GOAL); wrappedGoal3.stop(); this.lockedFlags.put(flag, wrappedGoal2); -@@ -157,11 +171,11 @@ public class GoalSelector { +@@ -155,11 +170,11 @@ public class GoalSelector { } public void disableControlFlag(Goal.Flag control) { @@ -163,7 +162,7 @@ index e5995d0db5dcfba59a873ff439601894fdacd556..676f5485a4ca9252e911213dcda8d517 public void setControlFlag(Goal.Flag control, boolean enabled) { diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/WrappedGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/WrappedGoal.java -index 6665ce5f48316e626907e6937d5ef1bc398a7ebd..51deb4455cac055ffa455e4f34aa30858d2fb448 100644 +index b02d3deb550830245c8945ef17d3073ea930fdda..65ccdbaa5230c02d44a5959bca0f6fc30237a6fd 100644 --- a/src/main/java/net/minecraft/world/entity/ai/goal/WrappedGoal.java +++ b/src/main/java/net/minecraft/world/entity/ai/goal/WrappedGoal.java @@ -69,8 +69,10 @@ public class WrappedGoal extends Goal { diff --git a/patches/server/0995-Entity-load-save-limit-per-chunk.patch b/patches/server/0995-Entity-load-save-limit-per-chunk.patch index 69f16dddbf..85299c2e1e 100644 --- a/patches/server/0995-Entity-load-save-limit-per-chunk.patch +++ b/patches/server/0995-Entity-load-save-limit-per-chunk.patch @@ -34,10 +34,10 @@ index 69bdf3f2ee731e59e8d454816a9ca72cb49c0fe0..09e8445a3f8c6b3ebc852a75a9a25b41 return entity; }); diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java -index 0ec0be22f7292d57c40da6f1f4575bdebf8dbd09..23dc37ff1f92951817864963bf93220d5aae91bb 100644 +index e8f8e1f2128df81705a88cee4b9a7760fb123750..995fbfa225efe40274c20608b9b30b8afa847698 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/EntityStorage.java -@@ -110,7 +110,18 @@ public class EntityStorage implements EntityPersistentStorage { +@@ -109,7 +109,18 @@ public class EntityStorage implements EntityPersistentStorage { } ListTag listTag = new ListTag(); diff --git a/patches/server/0997-Improved-Watchdog-Support.patch b/patches/server/0997-Improved-Watchdog-Support.patch index 3df0b44629..720936ff38 100644 --- a/patches/server/0997-Improved-Watchdog-Support.patch +++ b/patches/server/0997-Improved-Watchdog-Support.patch @@ -279,17 +279,17 @@ index 37245ff682837e7e8c9647f4afe30f0dd87cb384..594cb6ce4bfa6c42212000a1ed983ea9 // Paper start - Configurable player collision; Remove from collideRule team if needed diff --git a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java b/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java -index f5829ae484d93b547a5437b85a9621346384a11b..83701fbfaa56a232593ee8f11a3afb8941238bfa 100644 +index 03e8707258e9b73cf12a4750270ab7573bb1c812..d0dbe7e3c7c9c2727d5de456808765b2666108e4 100644 --- a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java +++ b/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java -@@ -152,6 +152,7 @@ public abstract class BlockableEventLoop implements Profiler +@@ -148,6 +148,7 @@ public abstract class BlockableEventLoop implements Profiler try { task.run(); } catch (Exception var3) { + if (var3.getCause() instanceof ThreadDeath) throw var3; // Paper LOGGER.error(LogUtils.FATAL_MARKER, "Error executing task on {}", this.name(), var3); } - + } diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java index 16e0b4bcc903e6decbdf66ac4fb3d0dc261dbded..983dad7ecc58033ecb6f523f7aef24de122417e8 100644 --- a/src/main/java/net/minecraft/world/level/Level.java diff --git a/patches/server/0998-Optimize-Voxel-Shape-Merging.patch b/patches/server/0998-Optimize-Voxel-Shape-Merging.patch index 2c47963e34..8bd2fe2682 100644 --- a/patches/server/0998-Optimize-Voxel-Shape-Merging.patch +++ b/patches/server/0998-Optimize-Voxel-Shape-Merging.patch @@ -30,7 +30,7 @@ Additionally, this lets us avoid even allocating new objects for this too, furth reducing memory usage. diff --git a/src/main/java/net/minecraft/world/phys/shapes/IndirectMerger.java b/src/main/java/net/minecraft/world/phys/shapes/IndirectMerger.java -index 0d9c15120148409967027dead617e80769939697..2214a3198c712deaac0f3d3478c85352185761d4 100644 +index e164c524aef4fa81fe96ac43454eecff1c38b9c1..9cfbbc61fcfc678f0988d6d45c7994d128051744 100644 --- a/src/main/java/net/minecraft/world/phys/shapes/IndirectMerger.java +++ b/src/main/java/net/minecraft/world/phys/shapes/IndirectMerger.java @@ -10,12 +10,33 @@ public class IndirectMerger implements IndexMerger { @@ -68,10 +68,10 @@ index 0d9c15120148409967027dead617e80769939697..2214a3198c712deaac0f3d3478c85352 this.firstIndices = new int[k]; this.secondIndices = new int[k]; diff --git a/src/main/java/net/minecraft/world/phys/shapes/Shapes.java b/src/main/java/net/minecraft/world/phys/shapes/Shapes.java -index 2d273be8145bbd86ffdf33358629da7fc08b4d4c..9176735c08a75854209f24113b0e78332249dc4d 100644 +index 1fbde2861b31726b8163e1b46aec91b7283a2c29..1a014f19f3c5425cc79a82c546066ab701fab1f8 100644 --- a/src/main/java/net/minecraft/world/phys/shapes/Shapes.java +++ b/src/main/java/net/minecraft/world/phys/shapes/Shapes.java -@@ -247,9 +247,21 @@ public final class Shapes { +@@ -286,9 +286,21 @@ public final class Shapes { } @VisibleForTesting @@ -93,12 +93,12 @@ index 2d273be8145bbd86ffdf33358629da7fc08b4d4c..9176735c08a75854209f24113b0e7833 + // Paper note - Rewrite below as optimized order if instead of nasty ternary if (first instanceof CubePointRange && second instanceof CubePointRange) { long l = lcm(i, j); - if ((long)size * l <= 256L) { -@@ -257,13 +269,22 @@ public final class Shapes { + if (size * l <= 256L) { +@@ -296,15 +308,22 @@ public final class Shapes { } } -- if (first.getDouble(i) < second.getDouble(0) - 1.0E-7D) { +- if (first.getDouble(i) < second.getDouble(0) - 1.0E-7) { + // Paper start - Identical happens more often than Disjoint + if (i == j && Objects.equals(first, second)) { + if (first instanceof IdenticalMerger) { @@ -107,12 +107,14 @@ index 2d273be8145bbd86ffdf33358629da7fc08b4d4c..9176735c08a75854209f24113b0e7833 + return (IndexMerger) second; + } + return new IdenticalMerger(first); -+ } else if (first.getDouble(i) < second.getDouble(0) - 1.0E-7D) { ++ } else if (first.getDouble(i) < second.getDouble(0) - 1.0E-7) { return new NonOverlappingMerger(first, second, false); - } else if (second.getDouble(j) < first.getDouble(0) - 1.0E-7D) { + } else if (second.getDouble(j) < first.getDouble(0) - 1.0E-7) { return new NonOverlappingMerger(second, first, true); } else { -- return (IndexMerger)(i == j && Objects.equals(first, second) ? new IdenticalMerger(first) : new IndirectMerger(first, second, includeFirst, includeSecond)); +- return (IndexMerger)(i == j && Objects.equals(first, second) +- ? new IdenticalMerger(first) +- : new IndirectMerger(first, second, includeFirst, includeSecond)); + return new IndirectMerger(first, second, includeFirst, includeSecond); } + // Paper end diff --git a/patches/server/0999-Write-SavedData-IO-async.patch b/patches/server/0999-Write-SavedData-IO-async.patch index a61e63bdcc..fc9b211347 100644 --- a/patches/server/0999-Write-SavedData-IO-async.patch +++ b/patches/server/0999-Write-SavedData-IO-async.patch @@ -139,7 +139,7 @@ index 697df9a9f050c0130246ce2b08a859965bddf184..0655a26a58b3df19d81b18abf6b8ab81 public static record Factory(Supplier constructor, Function deserializer, DataFixTypes type) { diff --git a/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java b/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java -index d051e8c1db6b5c42b8df0be54d9d48ba0e7b0077..1c16f43872d9cf9b087f247e9aaa04e7abe3d4ae 100644 +index de44680d9bc34c6ce22e12c3008019c8c6803437..b89bd2d046e99d0c4848579a5ab4385453358b89 100644 --- a/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java +++ b/src/main/java/net/minecraft/world/level/storage/DimensionDataStorage.java @@ -20,15 +20,18 @@ import net.minecraft.util.datafix.DataFixTypes; @@ -186,5 +186,5 @@ index d051e8c1db6b5c42b8df0be54d9d48ba0e7b0077..1c16f43872d9cf9b087f247e9aaa04e7 + } + // Paper end - Write SavedData IO async } - }); + } diff --git a/patches/server/1001-Use-distance-map-to-optimise-entity-tracker.patch b/patches/server/1001-Use-distance-map-to-optimise-entity-tracker.patch index 986378b88f..8cf1aa5a19 100644 --- a/patches/server/1001-Use-distance-map-to-optimise-entity-tracker.patch +++ b/patches/server/1001-Use-distance-map-to-optimise-entity-tracker.patch @@ -236,7 +236,7 @@ index ac1a4ff5f83e53fa2983ff6e834775e51fba715e..284f9548d62f9230c668bb1adb8cb808 return object instanceof ChunkMap.TrackedEntity ? ((ChunkMap.TrackedEntity) object).entity.getId() == this.entity.getId() : false; } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 8531304667a85436fd557d319fe36a37b3661ae5..f220e9ba35b07b690df93b1d733e9c666c772de9 100644 +index 5cc7043d2783d38f9d3a28d0cb62f8834e971e1e..eb269e90c62544d6e56ac8e6e81d0e5d4bc1f7e9 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -56,6 +56,7 @@ import net.minecraft.network.syncher.EntityDataSerializers; diff --git a/patches/server/1002-Optimize-Bit-Operations-by-inlining.patch b/patches/server/1002-Optimize-Bit-Operations-by-inlining.patch index 269787b9ed..d32c7563e3 100644 --- a/patches/server/1002-Optimize-Bit-Operations-by-inlining.patch +++ b/patches/server/1002-Optimize-Bit-Operations-by-inlining.patch @@ -7,11 +7,11 @@ Inline bit operations and reduce instruction count to make these hot operations faster diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java -index 541cef99113af865b995af2cfb7a1e4724dd8878..e17fa30966dea2836fb791becd032fc7d5cc2611 100644 +index aa27b96cf64ddbbc630e2c313ebff7636438aee0..70f9e737b3b9f80395afc3542aafe4a0c774c722 100644 --- a/src/main/java/net/minecraft/core/BlockPos.java +++ b/src/main/java/net/minecraft/core/BlockPos.java -@@ -37,15 +37,16 @@ public class BlockPos extends Vec3i { - }).stable(); +@@ -36,15 +36,16 @@ public class BlockPos extends Vec3i { + .stable(); private static final Logger LOGGER = LogUtils.getLogger(); public static final BlockPos ZERO = new BlockPos(0, 0, 0); - private static final int PACKED_X_LENGTH = 1 + Mth.log2(Mth.smallestEncompassingPowerOfTwo(30000000)); @@ -36,7 +36,7 @@ index 541cef99113af865b995af2cfb7a1e4724dd8878..e17fa30966dea2836fb791becd032fc7 public BlockPos(int x, int y, int z) { super(x, y, z); -@@ -55,28 +56,29 @@ public class BlockPos extends Vec3i { +@@ -54,28 +55,29 @@ public class BlockPos extends Vec3i { this(pos.getX(), pos.getY(), pos.getZ()); } @@ -71,20 +71,20 @@ index 541cef99113af865b995af2cfb7a1e4724dd8878..e17fa30966dea2836fb791becd032fc7 } public static BlockPos containing(double x, double y, double z) { -@@ -92,10 +94,7 @@ public class BlockPos extends Vec3i { +@@ -91,10 +93,7 @@ public class BlockPos extends Vec3i { } public static long asLong(int x, int y, int z) { - long l = 0L; -- l |= ((long)x & PACKED_X_MASK) << X_OFFSET; -- l |= ((long)y & PACKED_Y_MASK) << 0; -- return l | ((long)z & PACKED_Z_MASK) << Z_OFFSET; +- l |= (x & PACKED_X_MASK) << X_OFFSET; +- l |= (y & PACKED_Y_MASK) << 0; +- return l | (z & PACKED_Z_MASK) << Z_OFFSET; + return (((long) x & (long) 67108863) << 38) | (((long) y & (long) 4095)) | (((long) z & (long) 67108863) << 12); // Paper - inline constants and simplify } public static long getFlatIndex(long y) { diff --git a/src/main/java/net/minecraft/core/SectionPos.java b/src/main/java/net/minecraft/core/SectionPos.java -index eb97928380384b8c33cf142dd9a5db65951c94c6..392c3681c08d9e3d99cbabaf72d22c1d1518998d 100644 +index 469e6156704418b6b8f573baee8289726a7a6587..02500dba0c6645add80a73bc837a90331a864652 100644 --- a/src/main/java/net/minecraft/core/SectionPos.java +++ b/src/main/java/net/minecraft/core/SectionPos.java @@ -38,7 +38,7 @@ public class SectionPos extends Vec3i { @@ -180,9 +180,9 @@ index eb97928380384b8c33cf142dd9a5db65951c94c6..392c3681c08d9e3d99cbabaf72d22c1d + public static long asLong(int x, int y, int z) { - long l = 0L; -- l |= ((long)x & 4194303L) << 42; -- l |= ((long)y & 1048575L) << 0; -- return l | ((long)z & 4194303L) << 20; +- l |= (x & 4194303L) << 42; +- l |= (y & 1048575L) << 0; +- return l | (z & 4194303L) << 20; + return (((long) x & 4194303L) << 42) | (((long) y & 1048575L)) | (((long) z & 4194303L) << 20); // Paper - Simplify to reduce instruction count } @@ -210,4 +210,4 @@ index eb97928380384b8c33cf142dd9a5db65951c94c6..392c3681c08d9e3d99cbabaf72d22c1d + return betweenClosedStream(center.x - radius, 0, center.z - radius, center.x + radius, 15, center.z + radius); // Paper - simplify/inline } - public static Stream betweenClosedStream(final int minX, final int minY, final int minZ, final int maxX, final int maxY, final int maxZ) { + public static Stream betweenClosedStream(int minX, int minY, int minZ, int maxX, int maxY, int maxZ) { diff --git a/patches/server/1003-Remove-streams-from-hot-code.patch b/patches/server/1003-Remove-streams-from-hot-code.patch index 75a38173c7..8e8133d2b2 100644 --- a/patches/server/1003-Remove-streams-from-hot-code.patch +++ b/patches/server/1003-Remove-streams-from-hot-code.patch @@ -7,10 +7,10 @@ Co-authored-by: Bjarne Koll Co-authored-by: Spottedleaf diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java b/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java -index 4b31a91a8d8a3b231e323692d0a0f7ae04dc7e89..79e7a7adf9f9d8b9fee7ae3bb3bebab86fa7fd72 100644 +index 5ca112631cce775c609950d3540059f54033fd3e..5e13c5d7534397b902889b8dde9037da114b1039 100644 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/GateBehavior.java -@@ -52,7 +52,7 @@ public class GateBehavior implements BehaviorControl +@@ -57,7 +57,7 @@ public class GateBehavior implements BehaviorControl if (this.hasRequiredMemories(entity)) { this.status = Behavior.Status.RUNNING; this.orderPolicy.apply(this.behaviors); @@ -19,15 +19,11 @@ index 4b31a91a8d8a3b231e323692d0a0f7ae04dc7e89..79e7a7adf9f9d8b9fee7ae3bb3bebab8 return true; } else { return false; -@@ -61,11 +61,13 @@ public class GateBehavior implements BehaviorControl +@@ -66,7 +66,13 @@ public class GateBehavior implements BehaviorControl @Override public final void tickOrStop(ServerLevel world, E entity, long time) { -- this.behaviors.stream().filter((task) -> { -- return task.getStatus() == Behavior.Status.RUNNING; -- }).forEach((task) -> { -- task.tickOrStop(world, entity, time); -- }); +- this.behaviors.stream().filter(task -> task.getStatus() == Behavior.Status.RUNNING).forEach(task -> task.tickOrStop(world, entity, time)); + // Paper start - Perf: Remove streams from hot code + for (final BehaviorControl task : this.behaviors) { + if (task.getStatus() == Behavior.Status.RUNNING) { @@ -35,18 +31,14 @@ index 4b31a91a8d8a3b231e323692d0a0f7ae04dc7e89..79e7a7adf9f9d8b9fee7ae3bb3bebab8 + } + } + // Paper end - Perf: Remove streams from hot code - if (this.behaviors.stream().noneMatch((task) -> { - return task.getStatus() == Behavior.Status.RUNNING; - })) { -@@ -77,12 +79,16 @@ public class GateBehavior implements BehaviorControl + if (this.behaviors.stream().noneMatch(task -> task.getStatus() == Behavior.Status.RUNNING)) { + this.doStop(world, entity, time); + } +@@ -75,8 +81,16 @@ public class GateBehavior implements BehaviorControl @Override public final void doStop(ServerLevel world, E entity, long time) { this.status = Behavior.Status.STOPPED; -- this.behaviors.stream().filter((task) -> { -- return task.getStatus() == Behavior.Status.RUNNING; -- }).forEach((task) -> { -- task.doStop(world, entity, time); -- }); +- this.behaviors.stream().filter(task -> task.getStatus() == Behavior.Status.RUNNING).forEach(task -> task.doStop(world, entity, time)); - this.exitErasedMemories.forEach(entity.getBrain()::eraseMemory); + // Paper start - Perf: Remove streams from hot code + for (final BehaviorControl task : this.behaviors) { @@ -61,18 +53,14 @@ index 4b31a91a8d8a3b231e323692d0a0f7ae04dc7e89..79e7a7adf9f9d8b9fee7ae3bb3bebab8 } @Override -@@ -116,26 +122,30 @@ public class GateBehavior implements BehaviorControl +@@ -111,18 +125,30 @@ public class GateBehavior implements BehaviorControl public static enum RunningPolicy { RUN_ONE { + // Paper start - Perf: Remove streams from hot code @Override - public void apply(Stream> tasks, ServerLevel world, E entity, long time) { -- tasks.filter((task) -> { -- return task.getStatus() == Behavior.Status.STOPPED; -- }).filter((task) -> { -- return task.tryStart(world, entity, time); -- }).findFirst(); +- tasks.filter(task -> task.getStatus() == Behavior.Status.STOPPED).filter(task -> task.tryStart(world, entity, time)).findFirst(); + public void apply(ShufflingList> tasks, ServerLevel world, E entity, long time) { + for (final BehaviorControl task : tasks) { + if (task.getStatus() == Behavior.Status.STOPPED && task.tryStart(world, entity, time)) { @@ -86,11 +74,7 @@ index 4b31a91a8d8a3b231e323692d0a0f7ae04dc7e89..79e7a7adf9f9d8b9fee7ae3bb3bebab8 + // Paper start - Perf: Remove streams from hot code @Override - public void apply(Stream> tasks, ServerLevel world, E entity, long time) { -- tasks.filter((task) -> { -- return task.getStatus() == Behavior.Status.STOPPED; -- }).forEach((task) -> { -- task.tryStart(world, entity, time); -- }); +- tasks.filter(task -> task.getStatus() == Behavior.Status.STOPPED).forEach(task -> task.tryStart(world, entity, time)); + public void apply(ShufflingList> tasks, ServerLevel world, E entity, long time) { + for (final BehaviorControl task : tasks) { + if (task.getStatus() == Behavior.Status.STOPPED) { @@ -106,11 +90,11 @@ index 4b31a91a8d8a3b231e323692d0a0f7ae04dc7e89..79e7a7adf9f9d8b9fee7ae3bb3bebab8 } } diff --git a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java -index f1e717dc8320a00c0cc0ff53d97b74e7c1e109fe..2240fc6d5ba9530fcd62d6b560c17a275d4f164a 100644 +index aa32804bc9affe9a615d3ffaa513f6f09aab3f32..c7f012674361a323c1efeca4660cd3f46d308ee1 100644 --- a/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java +++ b/src/main/java/net/minecraft/world/entity/ai/gossip/GossipContainer.java -@@ -61,8 +61,22 @@ public class GossipContainer { - }); +@@ -59,8 +59,22 @@ public class GossipContainer { + return this.gossips.entrySet().stream().flatMap(entry -> entry.getValue().unpack(entry.getKey())); } + // Paper start - Perf: Remove streams from hot code @@ -133,24 +117,25 @@ index f1e717dc8320a00c0cc0ff53d97b74e7c1e109fe..2240fc6d5ba9530fcd62d6b560c17a27 if (list.isEmpty()) { return Collections.emptyList(); } else { -@@ -156,7 +170,7 @@ public class GossipContainer { - } +@@ -145,7 +159,7 @@ public class GossipContainer { public T store(DynamicOps ops) { -- return GossipContainer.GossipEntry.LIST_CODEC.encodeStart(ops, this.unpack().toList()).resultOrPartial((error) -> { -+ return GossipContainer.GossipEntry.LIST_CODEC.encodeStart(ops, this.decompress()).resultOrPartial((error) -> { // Paper - Perf: Remove streams from hot code - LOGGER.warn("Failed to serialize gossips: {}", (Object)error); - }).orElseGet(ops::emptyList); + return GossipContainer.GossipEntry.LIST_CODEC +- .encodeStart(ops, this.unpack().toList()) ++ .encodeStart(ops, this.decompress()) // Paper - Perf: Remove streams from hot code + .resultOrPartial(error -> LOGGER.warn("Failed to serialize gossips: {}", error)) + .orElseGet(ops::emptyList); } -@@ -184,11 +198,23 @@ public class GossipContainer { +@@ -172,12 +186,23 @@ public class GossipContainer { final Object2IntMap entries = new Object2IntOpenHashMap<>(); public int weightedValue(Predicate gossipTypeFilter) { -- return this.entries.object2IntEntrySet().stream().filter((entry) -> { -- return gossipTypeFilter.test(entry.getKey()); -- }).mapToInt((entry) -> { -- return entry.getIntValue() * (entry.getKey()).weight; -- }).sum(); +- return this.entries +- .object2IntEntrySet() +- .stream() +- .filter(entry -> gossipTypeFilter.test(entry.getKey())) +- .mapToInt(entry -> entry.getIntValue() * entry.getKey().weight) +- .sum(); + // Paper start - Perf: Remove streams from hot code + int weight = 0; + for (Object2IntMap.Entry entry : entries.object2IntEntrySet()) { @@ -172,22 +157,21 @@ index f1e717dc8320a00c0cc0ff53d97b74e7c1e109fe..2240fc6d5ba9530fcd62d6b560c17a27 public Stream unpack(UUID target) { diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestItemSensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestItemSensor.java -index a41c3365db8e9999b686f5bf4bd888458cee43a5..18e2fd705fe0db7cb9e3afe1ce7c8dcfaf93b1a5 100644 +index 28fd073ddad358e087e8c78985a97cad21be81b7..a5bd308d1b3ea5db185c06a287167d1d8894a987 100644 --- a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestItemSensor.java +++ b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestItemSensor.java -@@ -25,14 +25,18 @@ public class NearestItemSensor extends Sensor { +@@ -24,13 +24,17 @@ public class NearestItemSensor extends Sensor { + @Override protected void doTick(ServerLevel world, Mob entity) { Brain brain = entity.getBrain(); - List list = world.getEntitiesOfClass(ItemEntity.class, entity.getBoundingBox().inflate(32.0D, 16.0D, 32.0D), (itemEntity) -> { -- return true; -+ return itemEntity.closerThan(entity, MAX_DISTANCE_TO_WANTED_ITEM) && entity.wantsToPickUp(itemEntity.getItem()); // Paper - Perf: Move predicate into getEntities - }); +- List list = world.getEntitiesOfClass(ItemEntity.class, entity.getBoundingBox().inflate(32.0, 16.0, 32.0), itemEntity -> true); ++ List list = world.getEntitiesOfClass(ItemEntity.class, entity.getBoundingBox().inflate(32.0, 16.0, 32.0), itemEntity -> itemEntity.closerThan(entity, MAX_DISTANCE_TO_WANTED_ITEM) && entity.wantsToPickUp(itemEntity.getItem())); // Paper - Perf: Move predicate into getEntities list.sort(Comparator.comparingDouble(entity::distanceToSqr)); -- Optional optional = list.stream().filter((itemEntity) -> { -- return entity.wantsToPickUp(itemEntity.getItem()); -- }).filter((itemEntity) -> { -- return itemEntity.closerThan(entity, 32.0D); -- }).filter(entity::hasLineOfSight).findFirst(); +- Optional optional = list.stream() +- .filter(itemEntity -> entity.wantsToPickUp(itemEntity.getItem())) +- .filter(itemEntity -> itemEntity.closerThan(entity, 32.0)) +- .filter(entity::hasLineOfSight) +- .findFirst(); - brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_WANTED_ITEM, optional); + // Paper start - Perf: remove streams from hot code + ItemEntity nearest = null; @@ -202,42 +186,29 @@ index a41c3365db8e9999b686f5bf4bd888458cee43a5..18e2fd705fe0db7cb9e3afe1ce7c8dcf } } diff --git a/src/main/java/net/minecraft/world/level/levelgen/Beardifier.java b/src/main/java/net/minecraft/world/level/levelgen/Beardifier.java -index bb8d8edb47621665872a5e8fc01512ba40c1b913..dcb62d768d234f60af77ffb589ac2011afcfae4b 100644 +index 14d3f57fa796776e372cfe722471cdf8d4166b44..7cd8e444cd33a0995eda56e3be931780c3f501d9 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/Beardifier.java +++ b/src/main/java/net/minecraft/world/level/levelgen/Beardifier.java -@@ -36,9 +36,10 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker { +@@ -35,9 +35,10 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker { int j = pos.getMinBlockZ(); ObjectList objectList = new ObjectArrayList<>(10); ObjectList objectList2 = new ObjectArrayList<>(32); -- world.startsForStructure(pos, (structure) -> { +- world.startsForStructure(pos, structure -> structure.terrainAdaptation() != TerrainAdjustment.NONE) +- .forEach( +- start -> { + // Paper start - Perf: Remove streams from hot code + for (net.minecraft.world.level.levelgen.structure.StructureStart start : world.startsForStructure(pos, (structure) -> { - return structure.terrainAdaptation() != TerrainAdjustment.NONE; -- }).forEach((start) -> { ++ return structure.terrainAdaptation() != TerrainAdjustment.NONE; + })) { // Paper end - Perf: Remove streams from hot code - TerrainAdjustment terrainAdjustment = start.getStructure().terrainAdaptation(); + TerrainAdjustment terrainAdjustment = start.getStructure().terrainAdaptation(); - for(StructurePiece structurePiece : start.getPieces()) { -@@ -51,9 +52,11 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker { - } - - for(JigsawJunction jigsawJunction : poolElementStructurePiece.getJunctions()) { -- int i = jigsawJunction.getSourceX(); -- int j = jigsawJunction.getSourceZ(); -- if (i > i - 12 && j > j - 12 && i < i + 15 + 12 && j < j + 15 + 12) { -+ // Paper start - decompile fix -+ int i2 = jigsawJunction.getSourceX(); -+ int j2 = jigsawJunction.getSourceZ(); -+ if (i2 > i - 12 && j2 > j - 12 && i2 < i + 15 + 12 && j2 < j + 15 + 12) { -+ // Paper end - decompile fix - objectList2.add(jigsawJunction); + for (StructurePiece structurePiece : start.getPieces()) { +@@ -65,8 +66,7 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker { } } -@@ -63,7 +66,7 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker { - } - } - -- }); + } +- } +- ); + } // Paper - Perf: Remove streams from hot code return new Beardifier(objectList.iterator(), objectList2.iterator()); } diff --git a/patches/server/1005-Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch b/patches/server/1005-Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch index f0c0562d70..8ed7b79355 100644 --- a/patches/server/1005-Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch +++ b/patches/server/1005-Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch @@ -16,16 +16,15 @@ This lets us get faster foreach iteration, as well as avoids map lookups on the values when needed. diff --git a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java -index 8519383a9abd45434c1e9888e77548941a80c79c..8aa4ac3a6affbe888d6084a27b668c58dfda6c79 100644 +index 3e27c9a74c38f11a436df8cd413f9f5f16fd8c3e..c4d6b145d54aaf415dd4b08811c024255092e1b8 100644 --- a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java +++ b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java -@@ -38,9 +38,12 @@ public class PathFinder { +@@ -38,8 +38,12 @@ public class PathFinder { if (node == null) { return null; } else { -- Map map = positions.stream().collect(Collectors.toMap((pos) -> { -- return this.nodeEvaluator.getGoal((double)pos.getX(), (double)pos.getY(), (double)pos.getZ()); -- }, Function.identity())); +- Map map = positions.stream() +- .collect(Collectors.toMap(pos -> this.nodeEvaluator.getGoal(pos.getX(), pos.getY(), pos.getZ()), Function.identity())); + // Paper start - Perf: remove streams and optimize collection + List> map = Lists.newArrayList(); + for (BlockPos pos : positions) { @@ -35,7 +34,7 @@ index 8519383a9abd45434c1e9888e77548941a80c79c..8aa4ac3a6affbe888d6084a27b668c58 Path path = this.findPath(world.getProfiler(), node, map, followRange, distance, rangeMultiplier); this.nodeEvaluator.done(); return path; -@@ -48,18 +51,19 @@ public class PathFinder { +@@ -47,18 +51,19 @@ public class PathFinder { } @Nullable @@ -57,19 +56,19 @@ index 8519383a9abd45434c1e9888e77548941a80c79c..8aa4ac3a6affbe888d6084a27b668c58 int i = 0; - Set set3 = Sets.newHashSetWithExpectedSize(set.size()); + List> entryList = Lists.newArrayListWithExpectedSize(positions.size()); // Paper - optimize collection - int j = (int)((float)this.maxVisitedNodes * rangeMultiplier); + int j = (int)(this.maxVisitedNodes * rangeMultiplier); - while(!this.openSet.isEmpty()) { -@@ -71,14 +75,18 @@ public class PathFinder { + while (!this.openSet.isEmpty()) { +@@ -69,14 +74,18 @@ public class PathFinder { Node node = this.openSet.pop(); node.closed = true; -- for(Target target : set) { +- for (Target target : set) { + // Paper start - optimize collection -+ for(int i1 = 0; i1 < positions.size(); i1++) { ++ for (int i1 = 0; i1 < positions.size(); i1++) { + final Map.Entry entry = positions.get(i1); + Target target = entry.getKey(); - if (node.distanceManhattan(target) <= (float)distance) { + if (node.distanceManhattan(target) <= distance) { target.setReached(); - set3.add(target); + entryList.add(entry); @@ -82,7 +81,7 @@ index 8519383a9abd45434c1e9888e77548941a80c79c..8aa4ac3a6affbe888d6084a27b668c58 break; } -@@ -93,7 +101,7 @@ public class PathFinder { +@@ -91,7 +100,7 @@ public class PathFinder { if (node2.walkedDistance < followRange && (!node2.inOpenSet() || g < node2.g)) { node2.cameFrom = node; node2.g = g; @@ -91,15 +90,15 @@ index 8519383a9abd45434c1e9888e77548941a80c79c..8aa4ac3a6affbe888d6084a27b668c58 if (node2.inOpenSet()) { this.openSet.changeCost(node2, node2.g + node2.h); } else { -@@ -105,23 +113,32 @@ public class PathFinder { +@@ -103,23 +112,32 @@ public class PathFinder { } } -- Optional optional = !set3.isEmpty() ? set3.stream().map((node) -> { -- return this.reconstructPath(node.getBestNode(), positions.get(node), true); -- }).min(Comparator.comparingInt(Path::getNodeCount)) : set.stream().map((target) -> { -- return this.reconstructPath(target.getBestNode(), positions.get(target), false); -- }).min(Comparator.comparingDouble(Path::getDistToTarget).thenComparingInt(Path::getNodeCount)); +- Optional optional = !set3.isEmpty() +- ? set3.stream().map(node -> this.reconstructPath(node.getBestNode(), positions.get(node), true)).min(Comparator.comparingInt(Path::getNodeCount)) +- : set.stream() +- .map(targetx -> this.reconstructPath(targetx.getBestNode(), positions.get(targetx), false)) +- .min(Comparator.comparingDouble(Path::getDistToTarget).thenComparingInt(Path::getNodeCount)); + // Paper start - Perf: remove streams and optimize collection + Path best = null; + boolean entryListIsEmpty = entryList.isEmpty(); @@ -124,7 +123,7 @@ index 8519383a9abd45434c1e9888e77548941a80c79c..8aa4ac3a6affbe888d6084a27b668c58 + private float getBestH(Node node, List> targets) { // Paper - Perf: remove streams and optimize collection; Set -> List> float f = Float.MAX_VALUE; -- for(Target target : targets) { +- for (Target target : targets) { + // Paper start - Perf: remove streams and optimize collection + for (int i = 0, targetsSize = targets.size(); i < targetsSize; i++) { + final Target target = targets.get(i).getKey(); diff --git a/patches/server/1006-Add-PlayerTradeEvent-and-PlayerPurchaseEvent.patch b/patches/server/1006-Add-PlayerTradeEvent-and-PlayerPurchaseEvent.patch index 14c24b80b2..de82ef89da 100644 --- a/patches/server/1006-Add-PlayerTradeEvent-and-PlayerPurchaseEvent.patch +++ b/patches/server/1006-Add-PlayerTradeEvent-and-PlayerPurchaseEvent.patch @@ -168,7 +168,7 @@ index 743a2adc465be5477d204185967265389d7102de..9c17c14de888ef3fbf4139cbad3889ec return itemstack; diff --git a/src/main/java/net/minecraft/world/inventory/MerchantResultSlot.java b/src/main/java/net/minecraft/world/inventory/MerchantResultSlot.java -index e49bbb803399ef696665c5844a18b55a551654f6..23c1ba476869c9846a63138a8a11154bfd9379a2 100644 +index 26227033613a641a9d5a6f29356b19e54753b3f1..c2376538215604210d08acd33e8e5fdc8a35c7d3 100644 --- a/src/main/java/net/minecraft/world/inventory/MerchantResultSlot.java +++ b/src/main/java/net/minecraft/world/inventory/MerchantResultSlot.java @@ -47,13 +47,32 @@ public class MerchantResultSlot extends Slot { diff --git a/patches/server/1007-Improve-boat-collision-performance.patch b/patches/server/1007-Improve-boat-collision-performance.patch index f0c60b4a39..d32dfc35cc 100644 --- a/patches/server/1007-Improve-boat-collision-performance.patch +++ b/patches/server/1007-Improve-boat-collision-performance.patch @@ -5,19 +5,19 @@ Subject: [PATCH] Improve boat collision performance diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java -index edf937591abf62416bd692e40b7b7a6badbe877d..b40864e41e1506884fdefefbf3cf4833a8f706c3 100644 +index 72e734af483dc03e1ae947b2ab3b6fa7df38ce62..01a12f4d6f3c2f09bffc78692443b9fd391db45a 100644 --- a/src/main/java/net/minecraft/Util.java +++ b/src/main/java/net/minecraft/Util.java -@@ -121,6 +121,7 @@ public class Util { - }).findFirst().orElseThrow(() -> { - return new IllegalStateException("No jar file system provider found"); - }); +@@ -123,6 +123,7 @@ public class Util { + .filter(fileSystemProvider -> fileSystemProvider.getScheme().equalsIgnoreCase("jar")) + .findFirst() + .orElseThrow(() -> new IllegalStateException("No jar file system provider found")); + public static final double COLLISION_EPSILON = 1.0E-7; // Paper - Improve boat collision performance - private static Consumer thePauser = (message) -> { + private static Consumer thePauser = message -> { }; diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 3f3498e0a24ad8b890173ce71cd63c1fffb561df..e35dd853bbffbf1771543d2a59878879cd09fb9c 100644 +index aa261d3ad04bc3a19b3200214214650d9a9ac2af..a9d549d1f35928b7e9220e1e2e4ac30f3199ba2d 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -1446,7 +1446,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/1008-Optimise-general-POI-access.patch b/patches/server/1008-Optimise-general-POI-access.patch index 9be40e9753..715dea7d5c 100644 --- a/patches/server/1008-Optimise-general-POI-access.patch +++ b/patches/server/1008-Optimise-general-POI-access.patch @@ -841,33 +841,38 @@ index 0000000000000000000000000000000000000000..69be1761b3b5ba7b496c1c10a4db897e + } +} diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java b/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java -index a0799baca3ae05ef1ff818abfe6a53d28fd99246..abcc3ef59475ac170fd10b4dd4a4f3371faf17e0 100644 +index e8aa27547e3fa1a42720889c7038d4fb0273e7b5..e1b6fe9ecda25f86431baf414f1bfd3a26a8b2bd 100644 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java -@@ -63,7 +63,11 @@ public class AcquirePoi { - return true; - } - }; -- Set, BlockPos>> set = poiManager.findAllClosestFirstWithType(poiPredicate, predicate2, entity.blockPosition(), 48, PoiManager.Occupancy.HAS_SPACE).limit(5L).collect(Collectors.toSet()); -+ // Paper start - optimise POI access -+ java.util.List, BlockPos>> poiposes = new java.util.ArrayList<>(); -+ io.papermc.paper.util.PoiAccess.findNearestPoiPositions(poiManager, poiPredicate, predicate2, entity.blockPosition(), 48, 48*48, PoiManager.Occupancy.HAS_SPACE, false, 5, poiposes); -+ Set, BlockPos>> set = new java.util.HashSet<>(poiposes); -+ // Paper end - optimise POI access - Path path = findPathToPois(entity, set); - if (path != null && path.canReach()) { - BlockPos blockPos = path.getTarget(); +@@ -71,11 +71,11 @@ public class AcquirePoi { + return true; + } + }; +- Set, BlockPos>> set = poiManager.findAllClosestFirstWithType( +- poiPredicate, predicate2, entity.blockPosition(), 48, PoiManager.Occupancy.HAS_SPACE +- ) +- .limit(5L) +- .collect(Collectors.toSet()); ++ // Paper start - optimise POI access ++ java.util.List, BlockPos>> poiposes = new java.util.ArrayList<>(); ++ io.papermc.paper.util.PoiAccess.findNearestPoiPositions(poiManager, poiPredicate, predicate2, entity.blockPosition(), 48, 48*48, PoiManager.Occupancy.HAS_SPACE, false, 5, poiposes); ++ Set, BlockPos>> set = new java.util.HashSet<>(poiposes); ++ // Paper end - optimise POI access + Path path = findPathToPois(entity, set); + if (path != null && path.canReach()) { + BlockPos blockPos = path.getTarget(); diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java -index 33fbf72b440e0d164ecd4fb0fdec72e2394d0a1e..8db20db72cd51046213625fac46c35854c59ec5d 100644 +index d5a549f08b98c80a5cf0eef02cb8a389c32dfecb..92731b6b593289e9f583c9b705b219e81fcd8e73 100644 --- a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java +++ b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestBedSensor.java -@@ -53,10 +53,12 @@ public class NearestBedSensor extends Sensor { +@@ -53,11 +53,12 @@ public class NearestBedSensor extends Sensor { return true; } }; -- Set, BlockPos>> set = poiManager.findAllWithType((holder) -> { -- return holder.is(PoiTypes.HOME); -- }, predicate, entity.blockPosition(), 48, PoiManager.Occupancy.ANY).collect(Collectors.toSet()); +- Set, BlockPos>> set = poiManager.findAllWithType( +- holder -> holder.is(PoiTypes.HOME), predicate, entity.blockPosition(), 48, PoiManager.Occupancy.ANY +- ) +- .collect(Collectors.toSet()); - Path path = AcquirePoi.findPathToPois(entity, set); + // Paper start - optimise POI access + java.util.List, BlockPos>> poiposes = new java.util.ArrayList<>(); @@ -879,13 +884,13 @@ index 33fbf72b440e0d164ecd4fb0fdec72e2394d0a1e..8db20db72cd51046213625fac46c3585 BlockPos blockPos = path.getTarget(); Optional> optional = poiManager.getType(blockPos); diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java -index 6f2c7baea0d1ac7813c7b85e1f5558573745762c..12a7aaeaa8b4b788b620b1985591c3b93253ccd5 100644 +index c07cc1bf3b98525d72924edee4233364fd8174d0..61a06706f1468a8d4cceb9fb2aae61cf56bd991d 100644 --- a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java +++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiManager.java -@@ -127,43 +127,62 @@ public class PoiManager extends SectionStorage { - } - - public Optional find(Predicate> typePredicate, Predicate posPredicate, BlockPos pos, int radius, PoiManager.Occupancy occupationStatus) { +@@ -124,36 +124,45 @@ public class PoiManager extends SectionStorage { + public Optional find( + Predicate> typePredicate, Predicate posPredicate, BlockPos pos, int radius, PoiManager.Occupancy occupationStatus + ) { - return this.findAll(typePredicate, posPredicate, pos, radius, occupationStatus).findFirst(); + // Paper start - re-route to faster logic + BlockPos ret = io.papermc.paper.util.PoiAccess.findAnyPoiPosition(this, typePredicate, posPredicate, pos, radius, occupationStatus, false); @@ -894,21 +899,21 @@ index 6f2c7baea0d1ac7813c7b85e1f5558573745762c..12a7aaeaa8b4b788b620b1985591c3b9 } public Optional findClosest(Predicate> typePredicate, BlockPos pos, int radius, PoiManager.Occupancy occupationStatus) { -- return this.getInRange(typePredicate, pos, radius, occupationStatus).map(PoiRecord::getPos).min(Comparator.comparingDouble((blockPos2) -> { -- return blockPos2.distSqr(pos); -- })); +- return this.getInRange(typePredicate, pos, radius, occupationStatus) +- .map(PoiRecord::getPos) +- .min(Comparator.comparingDouble(blockPos2 -> blockPos2.distSqr(pos))); + // Paper start - re-route to faster logic + BlockPos ret = io.papermc.paper.util.PoiAccess.findClosestPoiDataPosition(this, typePredicate, null, pos, radius, radius * radius, occupationStatus, false); + return Optional.ofNullable(ret); + // Paper end - re-route to faster logic } - public Optional, BlockPos>> findClosestWithType(Predicate> typePredicate, BlockPos pos, int radius, PoiManager.Occupancy occupationStatus) { -- return this.getInRange(typePredicate, pos, radius, occupationStatus).min(Comparator.comparingDouble((poi) -> { -- return poi.getPos().distSqr(pos); -- })).map((poi) -> { -- return Pair.of(poi.getPoiType(), poi.getPos()); -- }); + public Optional, BlockPos>> findClosestWithType( + Predicate> typePredicate, BlockPos pos, int radius, PoiManager.Occupancy occupationStatus + ) { +- return this.getInRange(typePredicate, pos, radius, occupationStatus) +- .min(Comparator.comparingDouble(poi -> poi.getPos().distSqr(pos))) +- .map(poi -> Pair.of(poi.getPoiType(), poi.getPos())); + // Paper start - re-route to faster logic + return Optional.ofNullable(io.papermc.paper.util.PoiAccess.findClosestPoiDataTypeAndPosition( + this, typePredicate, null, pos, radius, radius * radius, occupationStatus, false @@ -916,10 +921,13 @@ index 6f2c7baea0d1ac7813c7b85e1f5558573745762c..12a7aaeaa8b4b788b620b1985591c3b9 + // Paper end - re-route to faster logic } - public Optional findClosest(Predicate> typePredicate, Predicate posPredicate, BlockPos pos, int radius, PoiManager.Occupancy occupationStatus) { -- return this.getInRange(typePredicate, pos, radius, occupationStatus).map(PoiRecord::getPos).filter(posPredicate).min(Comparator.comparingDouble((blockPos2) -> { -- return blockPos2.distSqr(pos); -- })); + public Optional findClosest( + Predicate> typePredicate, Predicate posPredicate, BlockPos pos, int radius, PoiManager.Occupancy occupationStatus + ) { +- return this.getInRange(typePredicate, pos, radius, occupationStatus) +- .map(PoiRecord::getPos) +- .filter(posPredicate) +- .min(Comparator.comparingDouble(blockPos2 -> blockPos2.distSqr(pos))); + // Paper start - re-route to faster logic + BlockPos ret = io.papermc.paper.util.PoiAccess.findClosestPoiDataPosition(this, typePredicate, posPredicate, pos, radius, radius * radius, occupationStatus, false); + return Optional.ofNullable(ret); @@ -927,25 +935,24 @@ index 6f2c7baea0d1ac7813c7b85e1f5558573745762c..12a7aaeaa8b4b788b620b1985591c3b9 } public Optional take(Predicate> typePredicate, BiPredicate, BlockPos> biPredicate, BlockPos pos, int radius) { -- return this.getInRange(typePredicate, pos, radius, PoiManager.Occupancy.HAS_SPACE).filter((poi) -> { -- return biPredicate.test(poi.getPoiType(), poi.getPos()); -- }).findFirst().map((poi) -> { +- return this.getInRange(typePredicate, pos, radius, PoiManager.Occupancy.HAS_SPACE) +- .filter(poi -> biPredicate.test(poi.getPoiType(), poi.getPos())) +- .findFirst() + // Paper start - re-route to faster logic + final @javax.annotation.Nullable PoiRecord closest = io.papermc.paper.util.PoiAccess.findClosestPoiDataRecord( + this, typePredicate, biPredicate, pos, radius, radius * radius, Occupancy.HAS_SPACE, false + ); -+ return Optional.ofNullable(closest).map(poi -> { ++ return Optional.ofNullable(closest) + // Paper end - re-route to faster logic - poi.acquireTicket(); - return poi.getPos(); - }); - } - - public Optional getRandom(Predicate> typePredicate, Predicate positionPredicate, PoiManager.Occupancy occupationStatus, BlockPos pos, int radius, RandomSource random) { + .map(poi -> { + poi.acquireTicket(); + return poi.getPos(); +@@ -168,8 +177,21 @@ public class PoiManager extends SectionStorage { + int radius, + RandomSource random + ) { - List list = Util.toShuffledList(this.getInRange(typePredicate, pos, radius, occupationStatus), random); -- return list.stream().filter((poi) -> { -- return positionPredicate.test(poi.getPos()); -- }).findFirst().map(PoiRecord::getPos); +- return list.stream().filter(poi -> positionPredicate.test(poi.getPos())).findFirst().map(PoiRecord::getPos); + // Paper start - re-route to faster logic + List list = new java.util.ArrayList<>(); + io.papermc.paper.util.PoiAccess.findAnyPoiRecords( @@ -965,7 +972,7 @@ index 6f2c7baea0d1ac7813c7b85e1f5558573745762c..12a7aaeaa8b4b788b620b1985591c3b9 public boolean release(BlockPos pos) { diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java -index 3fc17817906876e83f040f908b8b1ba6cfa37b8b..9f138bc471b5c2a4fa813ff943dbe34018b8df74 100644 +index f7d69dd83aad8e0ec1497441c61188bcf230865f..94404922304cfe23ea5fe8524387bc9b675cbc78 100644 --- a/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java +++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/PoiSection.java @@ -26,7 +26,7 @@ import org.slf4j.Logger; @@ -978,10 +985,10 @@ index 3fc17817906876e83f040f908b8b1ba6cfa37b8b..9f138bc471b5c2a4fa813ff943dbe340 private boolean isValid; public final Optional noAllocateOptional = Optional.of(this); // Paper - rewrite chunk system diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java -index 54db563d80bbabd87a2be6f5ead92b482ac07b10..4aac1979cf57300825a999c876fcf24d3170e68e 100644 +index bc6043a21227ce8c9c3879bc9c93c3803f79857b..4ac5024936987c15f927e3148af4bfa57228ad1e 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/SectionStorage.java -@@ -71,11 +71,11 @@ public class SectionStorage extends RegionFileStorage implements AutoCloseabl +@@ -79,11 +79,11 @@ public class SectionStorage extends RegionFileStorage implements AutoCloseabl } @Nullable diff --git a/patches/server/1009-Custom-table-implementation-for-blockstate-state-loo.patch b/patches/server/1009-Custom-table-implementation-for-blockstate-state-loo.patch index 52bdb3212c..9c4e3867d5 100644 --- a/patches/server/1009-Custom-table-implementation-for-blockstate-state-loo.patch +++ b/patches/server/1009-Custom-table-implementation-for-blockstate-state-loo.patch @@ -173,10 +173,10 @@ index 0000000000000000000000000000000000000000..57d0cd3ad6f972e986c72a57f1a6e360 + } +} diff --git a/src/main/java/net/minecraft/world/level/block/state/StateHolder.java b/src/main/java/net/minecraft/world/level/block/state/StateHolder.java -index 89ba12d44865ecddebabbc39c769af4cd8c82702..5f285d190186a2ff5a61d05070593e1d633dd79a 100644 +index 4ce9906e1f2b79df7c08d644684281ee59aa0c91..2630f54d499abbe52798f97c8ea14a8d0bd75e99 100644 --- a/src/main/java/net/minecraft/world/level/block/state/StateHolder.java +++ b/src/main/java/net/minecraft/world/level/block/state/StateHolder.java -@@ -39,11 +39,13 @@ public abstract class StateHolder { +@@ -40,11 +40,13 @@ public abstract class StateHolder { private final ImmutableMap, Comparable> values; private Table, Comparable, S> neighbours; protected final MapCodec propertiesCodec; @@ -190,7 +190,7 @@ index 89ba12d44865ecddebabbc39c769af4cd8c82702..5f285d190186a2ff5a61d05070593e1d } public > S cycle(Property property) { -@@ -84,11 +86,11 @@ public abstract class StateHolder { +@@ -85,11 +87,11 @@ public abstract class StateHolder { } public > boolean hasProperty(Property property) { @@ -204,7 +204,7 @@ index 89ba12d44865ecddebabbc39c769af4cd8c82702..5f285d190186a2ff5a61d05070593e1d if (comparable == null) { throw new IllegalArgumentException("Cannot get property " + property + " as it does not exist in " + this.owner); } else { -@@ -97,24 +99,18 @@ public abstract class StateHolder { +@@ -98,24 +100,18 @@ public abstract class StateHolder { } public > Optional getOptionalValue(Property property) { @@ -236,7 +236,7 @@ index 89ba12d44865ecddebabbc39c769af4cd8c82702..5f285d190186a2ff5a61d05070593e1d } public , V extends T> S trySetValue(Property property, V value) { -@@ -147,7 +143,7 @@ public abstract class StateHolder { +@@ -148,7 +144,7 @@ public abstract class StateHolder { } } @@ -246,7 +246,7 @@ index 89ba12d44865ecddebabbc39c769af4cd8c82702..5f285d190186a2ff5a61d05070593e1d } diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/BooleanProperty.java b/src/main/java/net/minecraft/world/level/block/state/properties/BooleanProperty.java -index 8da64429eaf083578c672cd34f52dd42389ff396..bdd7d9c80eda872496272e46d8772634e44e622a 100644 +index b63116b333b6e06494091a82588acfb639bddb71..ff5fd91257c4554c523682009efe1db83f53fd5b 100644 --- a/src/main/java/net/minecraft/world/level/block/state/properties/BooleanProperty.java +++ b/src/main/java/net/minecraft/world/level/block/state/properties/BooleanProperty.java @@ -7,6 +7,13 @@ import java.util.Optional; @@ -264,7 +264,7 @@ index 8da64429eaf083578c672cd34f52dd42389ff396..bdd7d9c80eda872496272e46d8772634 super(name, Boolean.class); } diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/EnumProperty.java b/src/main/java/net/minecraft/world/level/block/state/properties/EnumProperty.java -index 0a7a6c0e7635d0ada101074d4229df7edc6dd31b..e658d0b1a025192b48090e865b082ac4d99088d4 100644 +index 3097298fe356df98967cf4bdeaaede69dfe8a441..498c5abe0a9d024d77029719c621c1c8485791f3 100644 --- a/src/main/java/net/minecraft/world/level/block/state/properties/EnumProperty.java +++ b/src/main/java/net/minecraft/world/level/block/state/properties/EnumProperty.java @@ -15,6 +15,15 @@ public class EnumProperty & StringRepresentable> extends Prope @@ -283,23 +283,23 @@ index 0a7a6c0e7635d0ada101074d4229df7edc6dd31b..e658d0b1a025192b48090e865b082ac4 protected EnumProperty(String name, Class type, Collection values) { super(name, type); this.values = ImmutableSet.copyOf(values); -@@ -28,6 +37,14 @@ public class EnumProperty & StringRepresentable> extends Prope +@@ -27,6 +36,14 @@ public class EnumProperty & StringRepresentable> extends Prope + this.names.put(string, enum_); } - -+ // Paper start - optimise iblockdata state lookup ++ // Paper start - optimise BlockState lookup + int id = 0; + this.idLookupTable = new int[type.getEnumConstants().length]; + java.util.Arrays.fill(this.idLookupTable, -1); + for (final T value : this.getPossibleValues()) { + this.idLookupTable[value.ordinal()] = id++; + } -+ // Paper end - optimise iblockdata state lookup ++ // Paper end - optimise BlockState lookup } @Override diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java b/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java -index cbe6e4579cc55a427dd8f8fe403478faf6d35b8f..765b1092d50608d479bbbe09c457999790ecf42c 100644 +index 3a850321a4bcc68058483b5fd53e829c425a68af..977504f2641d0133a572b0d5de85d058609343bb 100644 --- a/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java +++ b/src/main/java/net/minecraft/world/level/block/state/properties/IntegerProperty.java @@ -11,6 +11,16 @@ public class IntegerProperty extends Property { @@ -320,11 +320,11 @@ index cbe6e4579cc55a427dd8f8fe403478faf6d35b8f..765b1092d50608d479bbbe09c4579997 super(name, Integer.class); if (min < 0) { diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/Property.java b/src/main/java/net/minecraft/world/level/block/state/properties/Property.java -index 08c2e4ba9147fbea41e0fce26ad20586832a525b..1d8c3f2e57aa9b0830cf7cfb6354fcf636e9c74b 100644 +index 9055f15af0cae55effa6942913a9d7edf3857e07..b9493e3762410aca8e683c32b5aef187c0bee082 100644 --- a/src/main/java/net/minecraft/world/level/block/state/properties/Property.java +++ b/src/main/java/net/minecraft/world/level/block/state/properties/Property.java @@ -24,6 +24,17 @@ public abstract class Property> { - }, this::getName); + ); private final Codec> valueCodec = this.codec.xmap(this::value, Property.Value::value); + // Paper start - optimise iblockdata state lookup diff --git a/patches/server/1011-Optimise-random-block-ticking.patch b/patches/server/1011-Optimise-random-block-ticking.patch index c8b294330a..7bda9d54c9 100644 --- a/patches/server/1011-Optimise-random-block-ticking.patch +++ b/patches/server/1011-Optimise-random-block-ticking.patch @@ -258,10 +258,10 @@ index 68648c5a5e3ff079f832092af0f2f801c42d1ede..8bafd5fd7499ba4a04bf706cfd1e1560 + // Paper end } diff --git a/src/main/java/net/minecraft/util/SimpleBitStorage.java b/src/main/java/net/minecraft/util/SimpleBitStorage.java -index acd820b19aff4e093536cc47002a899498b3fd6b..453c1d7e01970fd817d27f59c3b00ffc70e8ca0c 100644 +index 236ce41328758cb173a239133073944adb484dd1..abef177f074706f13ae6acbcfe036fcaecf00cd6 100644 --- a/src/main/java/net/minecraft/util/SimpleBitStorage.java +++ b/src/main/java/net/minecraft/util/SimpleBitStorage.java -@@ -124,6 +124,28 @@ public class SimpleBitStorage implements BitStorage { +@@ -315,6 +315,28 @@ public class SimpleBitStorage implements BitStorage { return this.bits; } @@ -291,7 +291,7 @@ index acd820b19aff4e093536cc47002a899498b3fd6b..453c1d7e01970fd817d27f59c3b00ffc public void getAll(IntConsumer action) { int i = 0; diff --git a/src/main/java/net/minecraft/util/ZeroBitStorage.java b/src/main/java/net/minecraft/util/ZeroBitStorage.java -index b7a3f15dc1ed9e9322a86921052984c7cbd3262a..f8de91393564b3691c17339ac9196cc0fc1cf748 100644 +index 50040c497a819cd1229042ab3cb057d34a32cacc..01f5b946fabbe34f31110e75973dab9f39897346 100644 --- a/src/main/java/net/minecraft/util/ZeroBitStorage.java +++ b/src/main/java/net/minecraft/util/ZeroBitStorage.java @@ -46,6 +46,15 @@ public class ZeroBitStorage implements BitStorage { @@ -309,7 +309,7 @@ index b7a3f15dc1ed9e9322a86921052984c7cbd3262a..f8de91393564b3691c17339ac9196cc0 + @Override public void getAll(IntConsumer action) { - for(int i = 0; i < this.size; ++i) { + for (int i = 0; i < this.size; i++) { diff --git a/src/main/java/net/minecraft/world/entity/animal/Turtle.java b/src/main/java/net/minecraft/world/entity/animal/Turtle.java index 6a98f66b7701e8af389ca9a1e9eb230a6100c838..dbdb6c432448b151fa4421f14235f8bad23dc720 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Turtle.java @@ -436,10 +436,10 @@ index 8852263cb6faec1b68326145aa30e5cd36d066e7..eb05c01e85825cbd5b7cf43bc6d261db public PalettedContainer getStates() { diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java -index 0f930f8355ea99d1cb1a8d27edc1c224588f852f..983799520ce052d98c9231f4f7925492d4f7d5c9 100644 +index d473637a705c1f11079fff08e334545779a99a84..adfbdca12fbdee2602feb0158674166d5256e49e 100644 --- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java +++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java -@@ -386,6 +386,14 @@ public class PalettedContainer implements PaletteResize, PalettedContainer +@@ -381,6 +381,14 @@ public class PalettedContainer implements PaletteResize, PalettedContainer } } diff --git a/patches/server/1012-Attempt-to-recalculate-regionfile-header-if-it-is-co.patch b/patches/server/1012-Attempt-to-recalculate-regionfile-header-if-it-is-co.patch index b294b05766..e0ffe43767 100644 --- a/patches/server/1012-Attempt-to-recalculate-regionfile-header-if-it-is-co.patch +++ b/patches/server/1012-Attempt-to-recalculate-regionfile-header-if-it-is-co.patch @@ -55,7 +55,7 @@ index 645a1773237f2002c233ec1f3ff6f0ca46ca4024..d16d7c2fed89fb1347df7ddd95856e7f public boolean isOldChunkAround(ChunkPos chunkPos, int checkRadius) { diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionBitmap.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionBitmap.java -index c8298a597818227de33a4afce4698ec0666cf758..6762b0f71ea9e369bb77103b7f1938983cb77a44 100644 +index a23dc2f8f4475de1ee35bf18a7a8a53233ccac12..226af44fd469053451a0403a95ffb446face9530 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionBitmap.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionBitmap.java @@ -9,6 +9,27 @@ import java.util.BitSet; @@ -763,7 +763,7 @@ index 42d37bee3a459adcd46408596ccf93abbcff51fe..fe312b1aef579cb4bf81bdd967cf72ff } diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileVersion.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileVersion.java -index 374ff77f15e339500714580673ae8077482ba247..6210a202d27788b1304e749b5bc2d9e2b88f5a63 100644 +index 581912e1315a4a8b46042a27df54826fa63e9c75..7baa12b53588d39fe1e6f130992dca591f246c83 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileVersion.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileVersion.java @@ -14,7 +14,7 @@ import javax.annotation.Nullable; @@ -772,6 +772,6 @@ index 374ff77f15e339500714580673ae8077482ba247..6210a202d27788b1304e749b5bc2d9e2 public class RegionFileVersion { - private static final Int2ObjectMap VERSIONS = new Int2ObjectOpenHashMap<>(); + public static final Int2ObjectMap VERSIONS = new Int2ObjectOpenHashMap<>(); // Paper - private -> public - public static final RegionFileVersion VERSION_GZIP = register(new RegionFileVersion(1, (stream) -> { - return new FastBufferedInputStream(new GZIPInputStream(stream)); - }, (stream) -> { + public static final RegionFileVersion VERSION_GZIP = register( + new RegionFileVersion( + 1, stream -> new FastBufferedInputStream(new GZIPInputStream(stream)), stream -> new BufferedOutputStream(new GZIPOutputStream(stream)) diff --git a/patches/server/1013-Use-Velocity-compression-and-cipher-natives.patch b/patches/server/1013-Use-Velocity-compression-and-cipher-natives.patch index 396697ea84..a9cc979072 100644 --- a/patches/server/1013-Use-Velocity-compression-and-cipher-natives.patch +++ b/patches/server/1013-Use-Velocity-compression-and-cipher-natives.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Use Velocity compression and cipher natives diff --git a/build.gradle.kts b/build.gradle.kts -index 5d35409137aff0eab242a0d4eb235e10cb7fe236..9c323b4ad76ee8a6386bca52d56615fd98e6d3cb 100644 +index f9056ee057a22a11288405cd42cd0ba4c9d120c3..bcfe59b6efb628ee1e7f9d60667360d4d885fb6a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -40,6 +40,11 @@ dependencies { @@ -102,7 +102,7 @@ index 0f3d502a9680006bcdcd7d272240a2e5c3b46790..ffa1c48585fbbc1d30826d435043527f + // Paper end - Use Velocity cipher } diff --git a/src/main/java/net/minecraft/network/CompressionDecoder.java b/src/main/java/net/minecraft/network/CompressionDecoder.java -index 2758c257cb4e2b0497bd9243c635f8fe3dbc414c..2763052eb2d5b8eb432022ab00a417976f4b2927 100644 +index 5927c928b27f64bd3973e95d5867b59f67476d41..76aeebe60ac321ed604661a0ec969bb25210643f 100644 --- a/src/main/java/net/minecraft/network/CompressionDecoder.java +++ b/src/main/java/net/minecraft/network/CompressionDecoder.java @@ -13,13 +13,20 @@ public class CompressionDecoder extends ByteToMessageDecoder { @@ -171,16 +171,18 @@ index 2758c257cb4e2b0497bd9243c635f8fe3dbc414c..2763052eb2d5b8eb432022ab00a41797 ByteBuffer byteBuffer; if (buf.nioBufferCount() > 0) { diff --git a/src/main/java/net/minecraft/network/CompressionEncoder.java b/src/main/java/net/minecraft/network/CompressionEncoder.java -index 859af8c845bae9781a62fa4acae56c6e2d449e10..f67f59f287d9a5cdd685b6b56ed1daf3f091e099 100644 +index 11a466558c77b43969b8e4be3a3470f84c7fcb1a..ae6e8ab9c1afa31d808f1fce2654a8b95bee6c31 100644 --- a/src/main/java/net/minecraft/network/CompressionEncoder.java +++ b/src/main/java/net/minecraft/network/CompressionEncoder.java -@@ -6,21 +6,36 @@ import io.netty.handler.codec.MessageToByteEncoder; +@@ -6,21 +6,37 @@ import io.netty.handler.codec.MessageToByteEncoder; import java.util.zip.Deflater; public class CompressionEncoder extends MessageToByteEncoder { - private final byte[] encodeBuf = new byte[8192]; -+ private final byte[] encodeBuf; // Paper - Use Velocity cipher ++ @javax.annotation.Nullable private final byte[] encodeBuf; // Paper - Use Velocity cipher ++ @javax.annotation.Nullable // Paper - Use Velocity cipher private final Deflater deflater; ++ @javax.annotation.Nullable // Paper - Use Velocity cipher + private final com.velocitypowered.natives.compression.VelocityCompressor compressor; // Paper - Use Velocity cipher private int threshold; @@ -188,7 +190,7 @@ index 859af8c845bae9781a62fa4acae56c6e2d449e10..f67f59f287d9a5cdd685b6b56ed1daf3 public CompressionEncoder(int compressionThreshold) { + this(null, compressionThreshold); + } -+ public CompressionEncoder(com.velocitypowered.natives.compression.VelocityCompressor compressor, int compressionThreshold) { ++ public CompressionEncoder(@javax.annotation.Nullable com.velocitypowered.natives.compression.VelocityCompressor compressor, int compressionThreshold) { this.threshold = compressionThreshold; - this.deflater = new Deflater(); + if (compressor == null) { @@ -209,15 +211,15 @@ index 859af8c845bae9781a62fa4acae56c6e2d449e10..f67f59f287d9a5cdd685b6b56ed1daf3 VarInt.write(byteBuf2, 0); byteBuf2.writeBytes(byteBuf); } else { -+ // Paper start - Use Velocity cipher -+ if (this.deflater != null) { ++ if (this.deflater != null) { // Paper - Use Velocity cipher byte[] bs = new byte[i]; byteBuf.readBytes(bs); VarInt.write(byteBuf2, bs.length); -@@ -33,10 +48,48 @@ public class CompressionEncoder extends MessageToByteEncoder { +@@ -33,6 +49,43 @@ public class CompressionEncoder extends MessageToByteEncoder { } this.deflater.reset(); ++ // Paper start - Use Velocity cipher + return; + } + @@ -228,12 +230,9 @@ index 859af8c845bae9781a62fa4acae56c6e2d449e10..f67f59f287d9a5cdd685b6b56ed1daf3 + } finally { + compatibleIn.release(); + } -+ // Paper end - Use Velocity cipher - } - - } - -+ // Paper start - Use Velocity cipher ++ } ++ } ++ + @Override + protected ByteBuf allocateBuffer(ChannelHandlerContext ctx, ByteBuf msg, boolean preferDirect) throws Exception{ + if (this.compressor != null) { @@ -256,13 +255,10 @@ index 859af8c845bae9781a62fa4acae56c6e2d449e10..f67f59f287d9a5cdd685b6b56ed1daf3 + public void handlerRemoved(ChannelHandlerContext ctx) throws Exception { + if (this.compressor != null) { + this.compressor.close(); -+ } -+ } -+ // Paper end - Use Velocity cipher -+ - public int getThreshold() { - return this.threshold; ++ // Paper end - Use Velocity cipher + } } + diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java index 7f2aa5e17fe675f3404d67b1794d2ca68b188eb9..fff375fd50fa1a804636a92ded1ae55cff42977d 100644 --- a/src/main/java/net/minecraft/network/Connection.java diff --git a/patches/server/1014-Detail-more-information-in-watchdog-dumps.patch b/patches/server/1014-Detail-more-information-in-watchdog-dumps.patch index e69bd162ef..2dce8a04c2 100644 --- a/patches/server/1014-Detail-more-information-in-watchdog-dumps.patch +++ b/patches/server/1014-Detail-more-information-in-watchdog-dumps.patch @@ -122,7 +122,7 @@ index 9d18da228c6709e7665ba8babb6ee6d0b36b5dc5..af9f58328c09dddb2875f79128f906b8 private void tickPassenger(Entity vehicle, Entity passenger) { diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index f220e9ba35b07b690df93b1d733e9c666c772de9..c1a8de736ee39e4e177399bc51aedfd135a8100d 100644 +index eb269e90c62544d6e56ac8e6e81d0e5d4bc1f7e9..865c5ee8a8a14ef1a7d71dcab3e324932d065d5f 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -1063,8 +1063,43 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S diff --git a/patches/server/1015-Collision-optimisations.patch b/patches/server/1015-Collision-optimisations.patch index 176352b0ab..c61dd8d1f1 100644 --- a/patches/server/1015-Collision-optimisations.patch +++ b/patches/server/1015-Collision-optimisations.patch @@ -2153,10 +2153,10 @@ index 0000000000000000000000000000000000000000..1f42bdfdb052056e62a939ab0d1944f8 + +} diff --git a/src/main/java/net/minecraft/core/Direction.java b/src/main/java/net/minecraft/core/Direction.java -index 073c717bb676b9e99aada00c349fb7eee91df1e7..2a9fc1f1dfc0c5894c1e74dad5a79ae9b02ac74f 100644 +index 0f32bad1f4e5f4e9abb54d6dc2c06dd2b7176b8e..f0fe2acadac0f57eb06b6aee1940e2c4985e4ca1 100644 --- a/src/main/java/net/minecraft/core/Direction.java +++ b/src/main/java/net/minecraft/core/Direction.java -@@ -57,6 +57,21 @@ public enum Direction implements StringRepresentable { +@@ -53,6 +53,21 @@ public enum Direction implements StringRepresentable { private final int adjY; private final int adjZ; // Paper end - Perf: Inline shift direction fields @@ -2179,7 +2179,7 @@ index 073c717bb676b9e99aada00c349fb7eee91df1e7..2a9fc1f1dfc0c5894c1e74dad5a79ae9 private Direction(int id, int idOpposite, int idHorizontal, String name, Direction.AxisDirection direction, Direction.Axis axis, Vec3i vector) { this.data3d = id; diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index acc9858e0cf10cb2aae0554037096411a208bd05..c99d2f2d64b73179e4e27b63030e26a07953041b 100644 +index acc1751324f040accc4fc18914ed281e572358eb..17a6d43685f35a6978c2d941876a1f8a9a2c8b42 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -496,7 +496,7 @@ public class ServerPlayer extends Player { @@ -2214,7 +2214,7 @@ index 594cb6ce4bfa6c42212000a1ed983ea95ee2c4bf..97b0119ac71284b3a223c089bec26d87 entityplayer1.setPos(entityplayer1.getX(), entityplayer1.getY() + 1.0D, entityplayer1.getZ()); } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index c1a8de736ee39e4e177399bc51aedfd135a8100d..6de971aca46caad091271d125a079a1b7a5f163d 100644 +index 9a01eff5a93c68edd45f98e9a6f8d24656650fb6..7992375dc55492aeb6defb204b28dd267be4a6e7 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -1250,9 +1250,44 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S @@ -2466,18 +2466,18 @@ index ffa4f34d964fbcc53e2dfe11677832db21a6eb93..7618364e5373fe17cfe45a5a4ee9ab25 } diff --git a/src/main/java/net/minecraft/world/level/BlockCollisions.java b/src/main/java/net/minecraft/world/level/BlockCollisions.java -index a3eaf80b020c3bbc0306c5d17659ee661dfd275b..1b6f72932fbdd567a1534bcf15e8a610b00f974d 100644 +index f6cc3d550df8481086acdcb62f44a1051ae79f80..012733f1808e96aecc3b2fd081e355905d1b0766 100644 --- a/src/main/java/net/minecraft/world/level/BlockCollisions.java +++ b/src/main/java/net/minecraft/world/level/BlockCollisions.java -@@ -105,7 +105,7 @@ public class BlockCollisions extends AbstractIterator { - - VoxelShape voxelShape = blockState.getCollisionShape(this.collisionGetter, this.pos, this.context); - if (voxelShape == Shapes.block()) { -- if (!this.box.intersects((double)i, (double)j, (double)k, (double)i + 1.0D, (double)j + 1.0D, (double)k + 1.0D)) { -+ if (!io.papermc.paper.util.CollisionUtil.voxelShapeIntersect(this.box, (double)i, (double)j, (double)k, (double)i + 1.0D, (double)j + 1.0D, (double)k + 1.0D)) { // Paper - keep vanilla behavior for voxelshape intersection - See comment in CollisionUtil - continue; - } - +@@ -99,7 +99,7 @@ public class BlockCollisions extends AbstractIterator { + // Paper end + VoxelShape voxelShape = blockState.getCollisionShape(this.collisionGetter, this.pos, this.context); + if (voxelShape == Shapes.block()) { +- if (this.box.intersects(i, j, k, i + 1.0, j + 1.0, k + 1.0)) { ++ if (io.papermc.paper.util.CollisionUtil.voxelShapeIntersect(this.box, i, j, k, i + 1.0, j + 1.0, k + 1.0)) { // Paper - keep vanilla behavior for voxelshape intersection - See comment in CollisionUtil + return this.resultProvider.apply(this.pos, voxelShape.move(i, j, k)); + } + } else { diff --git a/src/main/java/net/minecraft/world/level/ClipContext.java b/src/main/java/net/minecraft/world/level/ClipContext.java index 86a4f30c8784c602436ecf1c78efb0bdca4b7089..b0bea28e9261767c60d30fb0e76f4f3af8a5634e 100644 --- a/src/main/java/net/minecraft/world/level/ClipContext.java @@ -2494,7 +2494,7 @@ index 86a4f30c8784c602436ecf1c78efb0bdca4b7089..b0bea28e9261767c60d30fb0e76f4f3a public ClipContext(Vec3 start, Vec3 end, ClipContext.Block shapeType, ClipContext.Fluid fluidHandling, Entity entity) { diff --git a/src/main/java/net/minecraft/world/level/CollisionGetter.java b/src/main/java/net/minecraft/world/level/CollisionGetter.java -index c476e37df8a75d77f5093b2a449e04f25ef2c2dd..5d66aadae51db1ae760812849bfc8740b82af9a9 100644 +index 69754fbebb51f7f804c97a749fd65ce15ae22f1b..160b4c8f40b7b1bc53a8c23b801c5248c13e9a40 100644 --- a/src/main/java/net/minecraft/world/level/CollisionGetter.java +++ b/src/main/java/net/minecraft/world/level/CollisionGetter.java @@ -35,6 +35,12 @@ public interface CollisionGetter extends BlockGetter { @@ -2508,13 +2508,13 @@ index c476e37df8a75d77f5093b2a449e04f25ef2c2dd..5d66aadae51db1ae760812849bfc8740 + // Paper end - optimise collisions + default boolean noCollision(AABB box) { - return this.noCollision((Entity)null, box); + return this.noCollision(null, box); } diff --git a/src/main/java/net/minecraft/world/level/EntityGetter.java b/src/main/java/net/minecraft/world/level/EntityGetter.java -index cc888bbcd6a50124fa553bc4a8ffd1e8885d3856..f42dd9602805e9d538506ee4e3eac7e2811a3da6 100644 +index 9a28912f52824acdc80a62243b136e6f365bf567..21843501355a0c0c8d594e3e5312e97861c9a777 100644 --- a/src/main/java/net/minecraft/world/level/EntityGetter.java +++ b/src/main/java/net/minecraft/world/level/EntityGetter.java -@@ -45,17 +45,36 @@ public interface EntityGetter { +@@ -46,20 +46,36 @@ public interface EntityGetter { } default boolean isUnobstructed(@Nullable Entity except, VoxelShape shape) { @@ -2522,8 +2522,11 @@ index cc888bbcd6a50124fa553bc4a8ffd1e8885d3856..f42dd9602805e9d538506ee4e3eac7e2 if (shape.isEmpty()) { - return true; - } else { -- for(Entity entity : this.getEntities(except, shape.bounds())) { -- if (!entity.isRemoved() && entity.blocksBuilding && (except == null || !entity.isPassengerOfSameVehicle(except)) && Shapes.joinIsNotEmpty(shape, Shapes.create(entity.getBoundingBox()), BooleanOp.AND)) { +- for (Entity entity : this.getEntities(except, shape.bounds())) { +- if (!entity.isRemoved() +- && entity.blocksBuilding +- && (except == null || !entity.isPassengerOfSameVehicle(except)) +- && Shapes.joinIsNotEmpty(shape, Shapes.create(entity.getBoundingBox()), BooleanOp.AND)) { - return false; + return false; + } @@ -2557,11 +2560,11 @@ index cc888bbcd6a50124fa553bc4a8ffd1e8885d3856..f42dd9602805e9d538506ee4e3eac7e2 } default List getEntitiesOfClass(Class entityClass, AABB box) { -@@ -63,23 +82,41 @@ public interface EntityGetter { +@@ -67,23 +83,41 @@ public interface EntityGetter { } default List getEntityCollisions(@Nullable Entity entity, AABB box) { -- if (box.getSize() < 1.0E-7D) { +- if (box.getSize() < 1.0E-7) { - return List.of(); + // Paper start - optimise collisions + // first behavior change is to correctly check for empty AABB @@ -2580,21 +2583,21 @@ index cc888bbcd6a50124fa553bc4a8ffd1e8885d3856..f42dd9602805e9d538506ee4e3eac7e2 + entities = this.getEntities(entity, box, null); } else { - Predicate predicate = entity == null ? EntitySelector.CAN_BE_COLLIDED_WITH : EntitySelector.NO_SPECTATORS.and(entity::canCollideWith); -- List list = this.getEntities(entity, box.inflate(1.0E-7D), predicate); +- List list = this.getEntities(entity, box.inflate(1.0E-7), predicate); - if (list.isEmpty()) { - return List.of(); - } else { -- ImmutableList.Builder builder = ImmutableList.builderWithExpectedSize(list.size()); +- Builder builder = ImmutableList.builderWithExpectedSize(list.size()); - -- for(Entity entity2 : list) { +- for (Entity entity2 : list) { - builder.add(Shapes.create(entity2.getBoundingBox())); - } + entities = this.getHardCollidingEntities(entity, box, null); + } ++ ++ final List ret = new java.util.ArrayList<>(Math.min(25, entities.size())); - return builder.build(); -+ final List ret = new java.util.ArrayList<>(Math.min(25, entities.size())); -+ + for (int i = 0, len = entities.size(); i < len; ++i) { + final Entity otherEntity = entities.get(i); + @@ -3215,7 +3218,7 @@ index a98ab20814cc29a25e9d29adfbb7e70d46768df2..6d8ff6c06af5545634f255ed17dc1e48 if (!state.getBlock().hasDynamicShape() && !fromState.getBlock().hasDynamicShape()) { diff --git a/src/main/java/net/minecraft/world/phys/AABB.java b/src/main/java/net/minecraft/world/phys/AABB.java -index b8443953de15066f32f629c0dd7e24bad750f558..67d595f75e0c3bffdb27b85b25ccd1f0bf1427d5 100644 +index 1b7f1babf732ab95940ac67437a0b22ee078f19d..ba29de4a759644acdfce9c2e3672f20b200b7b50 100644 --- a/src/main/java/net/minecraft/world/phys/AABB.java +++ b/src/main/java/net/minecraft/world/phys/AABB.java @@ -25,6 +25,17 @@ public class AABB { @@ -3234,23 +3237,23 @@ index b8443953de15066f32f629c0dd7e24bad750f558..67d595f75e0c3bffdb27b85b25ccd1f0 + // Paper end + public AABB(BlockPos pos) { - this((double)pos.getX(), (double)pos.getY(), (double)pos.getZ(), (double)(pos.getX() + 1), (double)(pos.getY() + 1), (double)(pos.getZ() + 1)); + this(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1); } -@@ -305,7 +316,7 @@ public class AABB { +@@ -314,7 +325,7 @@ public class AABB { } @Nullable -- private static Direction getDirection(AABB box, Vec3 intersectingVector, double[] traceDistanceResult, @Nullable Direction approachDirection, double deltaX, double deltaY, double deltaZ) { -+ public static Direction getDirection(AABB box, Vec3 intersectingVector, double[] traceDistanceResult, @Nullable Direction approachDirection, double deltaX, double deltaY, double deltaZ) { // Paper - optimise collisions - public - if (deltaX > 1.0E-7D) { - approachDirection = clipPoint(traceDistanceResult, approachDirection, deltaX, deltaY, deltaZ, box.minX, box.minY, box.maxY, box.minZ, box.maxZ, Direction.WEST, intersectingVector.x, intersectingVector.y, intersectingVector.z); - } else if (deltaX < -1.0E-7D) { +- private static Direction getDirection( ++ public static Direction getDirection( // Paper - optimise collisions - public + AABB box, Vec3 intersectingVector, double[] traceDistanceResult, @Nullable Direction approachDirection, double deltaX, double deltaY, double deltaZ + ) { + if (deltaX > 1.0E-7) { diff --git a/src/main/java/net/minecraft/world/phys/shapes/ArrayVoxelShape.java b/src/main/java/net/minecraft/world/phys/shapes/ArrayVoxelShape.java -index 9d627b8e6bf3140b894d38b9a720896e2d776369..a232b9396a41c11579a4d691b05717b16473513e 100644 +index fc7f986812bdf74e0aea3bd09a1d53ba6def697f..0583d40a235aaecd9d6081486bbfb7355709a5ac 100644 --- a/src/main/java/net/minecraft/world/phys/shapes/ArrayVoxelShape.java +++ b/src/main/java/net/minecraft/world/phys/shapes/ArrayVoxelShape.java -@@ -15,7 +15,7 @@ public class ArrayVoxelShape extends VoxelShape { - this(shape, (DoubleList)DoubleArrayList.wrap(Arrays.copyOf(xPoints, shape.getXSize() + 1)), (DoubleList)DoubleArrayList.wrap(Arrays.copyOf(yPoints, shape.getYSize() + 1)), (DoubleList)DoubleArrayList.wrap(Arrays.copyOf(zPoints, shape.getZSize() + 1))); +@@ -20,7 +20,7 @@ public class ArrayVoxelShape extends VoxelShape { + ); } - ArrayVoxelShape(DiscreteVoxelShape shape, DoubleList xPoints, DoubleList yPoints, DoubleList zPoints) { @@ -3258,22 +3261,22 @@ index 9d627b8e6bf3140b894d38b9a720896e2d776369..a232b9396a41c11579a4d691b05717b1 super(shape); int i = shape.getXSize() + 1; int j = shape.getYSize() + 1; -@@ -27,6 +27,7 @@ public class ArrayVoxelShape extends VoxelShape { - } else { - throw (IllegalArgumentException)Util.pauseInIde(new IllegalArgumentException("Lengths of point arrays must be consistent with the size of the VoxelShape.")); +@@ -34,6 +34,7 @@ public class ArrayVoxelShape extends VoxelShape { + new IllegalArgumentException("Lengths of point arrays must be consistent with the size of the VoxelShape.") + ); } + this.initCache(); // Paper - optimise collisions } @Override -@@ -42,4 +43,5 @@ public class ArrayVoxelShape extends VoxelShape { +@@ -49,4 +50,5 @@ public class ArrayVoxelShape extends VoxelShape { throw new IllegalArgumentException(); } } + } diff --git a/src/main/java/net/minecraft/world/phys/shapes/BitSetDiscreteVoxelShape.java b/src/main/java/net/minecraft/world/phys/shapes/BitSetDiscreteVoxelShape.java -index c25f409d63a50c5de1434db1d6b298935f106221..6f532d9aa613ecb0f5695b108ec6d7ed3598ca82 100644 +index 31b570517c1047e8e1cd5280baf80977af2b6121..d8b80632f6186641ee2ddaef9eba7ba998b09136 100644 --- a/src/main/java/net/minecraft/world/phys/shapes/BitSetDiscreteVoxelShape.java +++ b/src/main/java/net/minecraft/world/phys/shapes/BitSetDiscreteVoxelShape.java @@ -4,13 +4,13 @@ import java.util.BitSet; @@ -3297,7 +3300,7 @@ index c25f409d63a50c5de1434db1d6b298935f106221..6f532d9aa613ecb0f5695b108ec6d7ed public BitSetDiscreteVoxelShape(int sizeX, int sizeY, int sizeZ) { super(sizeX, sizeY, sizeZ); -@@ -150,46 +150,106 @@ public final class BitSetDiscreteVoxelShape extends DiscreteVoxelShape { +@@ -151,45 +151,106 @@ public final class BitSetDiscreteVoxelShape extends DiscreteVoxelShape { } protected static void forAllBoxes(DiscreteVoxelShape voxelSet, DiscreteVoxelShape.IntLineConsumer callback, boolean coalesce) { @@ -3305,11 +3308,22 @@ index c25f409d63a50c5de1434db1d6b298935f106221..6f532d9aa613ecb0f5695b108ec6d7ed + // Paper start - optimise collisions + // called with the shape of a VoxelShape, so we can expect the cache to exist + final io.papermc.paper.util.collisions.CachedShapeData cache = voxelSet.getOrCreateCachedShapeData(); -+ + +- for (int i = 0; i < bitSetDiscreteVoxelShape.ySize; i++) { +- for (int j = 0; j < bitSetDiscreteVoxelShape.xSize; j++) { +- int k = -1; + final int sizeX = cache.sizeX(); + final int sizeY = cache.sizeY(); + final int sizeZ = cache.sizeZ(); -+ + +- for (int l = 0; l <= bitSetDiscreteVoxelShape.zSize; l++) { +- if (bitSetDiscreteVoxelShape.isFullWide(j, i, l)) { +- if (coalesce) { +- if (k == -1) { +- k = l; +- } +- } else { +- callback.consume(j, i, l, j + 1, i + 1, l + 1); + int indexX; + int indexY = 0; + int indexZ; @@ -3339,21 +3353,10 @@ index c25f409d63a50c5de1434db1d6b298935f106221..6f532d9aa613ecb0f5695b108ec6d7ed + } else { + // same notes about loop order as the above + // this branch is actually important to optimise, as it affects uncached toAabbs() (which affects optimize()) - -- for(int i = 0; i < bitSetDiscreteVoxelShape.ySize; ++i) { -- for(int j = 0; j < bitSetDiscreteVoxelShape.xSize; ++j) { -- int k = -1; ++ + // only clone when we may write to it + bitset = bitset.clone(); - -- for(int l = 0; l <= bitSetDiscreteVoxelShape.zSize; ++l) { -- if (bitSetDiscreteVoxelShape.isFullWide(j, i, l)) { -- if (coalesce) { -- if (k == -1) { -- k = l; -- } -- } else { -- callback.consume(j, i, l, j + 1, i + 1, l + 1); ++ + for (int y = 0; y < sizeY; ++y, indexY += incY) { + indexX = indexY; + for (int x = 0; x < sizeX; ++x, indexX += incX) { @@ -3368,17 +3371,17 @@ index c25f409d63a50c5de1434db1d6b298935f106221..6f532d9aa613ecb0f5695b108ec6d7ed - int n = i; - bitSetDiscreteVoxelShape.clearZStrip(k, l, j, i); - -- while(bitSetDiscreteVoxelShape.isZStripFull(k, l, m + 1, i)) { +- while (bitSetDiscreteVoxelShape.isZStripFull(k, l, m + 1, i)) { - bitSetDiscreteVoxelShape.clearZStrip(k, l, m + 1, i); -- ++m; +- m++; + + int lastSetZ = io.papermc.paper.util.collisions.FlatBitsetUtil.firstClear(bitset, firstSetZ, endIndex); + if (lastSetZ == -1) { + lastSetZ = endIndex; } -- while(bitSetDiscreteVoxelShape.isXZRectangleFull(j, m + 1, k, l, n + 1)) { -- for(int o = j; o <= m; ++o) { +- while (bitSetDiscreteVoxelShape.isXZRectangleFull(j, m + 1, k, l, n + 1)) { +- for (int o = j; o <= m; o++) { - bitSetDiscreteVoxelShape.clearZStrip(k, l, o, n + 1); + io.papermc.paper.util.collisions.FlatBitsetUtil.clearRange(bitset, firstSetZ, lastSetZ); + @@ -3408,7 +3411,7 @@ index c25f409d63a50c5de1434db1d6b298935f106221..6f532d9aa613ecb0f5695b108ec6d7ed + } } -- ++n; +- n++; + ++endY; + + // passed, so we can clear it @@ -3426,13 +3429,12 @@ index c25f409d63a50c5de1434db1d6b298935f106221..6f532d9aa613ecb0f5695b108ec6d7ed } } } -- + // Paper end - optimise collisions } private boolean isZStripFull(int z1, int z2, int x, int y) { diff --git a/src/main/java/net/minecraft/world/phys/shapes/CubeVoxelShape.java b/src/main/java/net/minecraft/world/phys/shapes/CubeVoxelShape.java -index 68e89dbd79171627046e89699057964e44c40e7d..110405e6e70d980d3e09f04d79562b32a7413071 100644 +index e00c3419ff523a57dc4346720827854641fa21ad..fc751564e02306006cffd90ef29acb27cc77cd0b 100644 --- a/src/main/java/net/minecraft/world/phys/shapes/CubeVoxelShape.java +++ b/src/main/java/net/minecraft/world/phys/shapes/CubeVoxelShape.java @@ -7,6 +7,7 @@ import net.minecraft.util.Mth; @@ -3444,7 +3446,7 @@ index 68e89dbd79171627046e89699057964e44c40e7d..110405e6e70d980d3e09f04d79562b32 @Override diff --git a/src/main/java/net/minecraft/world/phys/shapes/DiscreteVoxelShape.java b/src/main/java/net/minecraft/world/phys/shapes/DiscreteVoxelShape.java -index b27ed92b2a87d4c20c1aa300202adfab896c99ea..d0a4547f95ee24283af77cfa130979d05915292f 100644 +index 87a8f12dc3d47fb093115030e0222f065f1dcb1c..44b62f1f6685084c0cff02bd31eb5a7c2ef9eead 100644 --- a/src/main/java/net/minecraft/world/phys/shapes/DiscreteVoxelShape.java +++ b/src/main/java/net/minecraft/world/phys/shapes/DiscreteVoxelShape.java @@ -9,6 +9,71 @@ public abstract class DiscreteVoxelShape { @@ -3535,12 +3537,12 @@ index 7ec02a7849437a18860aa0df7d9ddd71b2447d4c..5e45e49ab09344cb95736f4124b1c6e0 public OffsetDoubleList(DoubleList oldList, double offset) { this.delegate = oldList; diff --git a/src/main/java/net/minecraft/world/phys/shapes/Shapes.java b/src/main/java/net/minecraft/world/phys/shapes/Shapes.java -index 9176735c08a75854209f24113b0e78332249dc4d..17785f7c709073a01928e8e6a57702f8357900f4 100644 +index 1a014f19f3c5425cc79a82c546066ab701fab1f8..9ac39c6d6289c86954ccb8a2e2afba8d96aa1950 100644 --- a/src/main/java/net/minecraft/world/phys/shapes/Shapes.java +++ b/src/main/java/net/minecraft/world/phys/shapes/Shapes.java -@@ -16,13 +16,43 @@ public final class Shapes { - public static final double EPSILON = 1.0E-7D; - public static final double BIG_EPSILON = 1.0E-6D; +@@ -16,9 +16,15 @@ public final class Shapes { + public static final double EPSILON = 1.0E-7; + public static final double BIG_EPSILON = 1.0E-6; private static final VoxelShape BLOCK = Util.make(() -> { - DiscreteVoxelShape discreteVoxelShape = new BitSetDiscreteVoxelShape(1, 1, 1); - discreteVoxelShape.fill(0, 0, 0); @@ -3555,8 +3557,11 @@ index 9176735c08a75854209f24113b0e78332249dc4d..17785f7c709073a01928e8e6a57702f8 + ); + // Paper end - optimise collisions - force arrayvoxelshape }); - public static final VoxelShape INFINITY = box(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY); - private static final VoxelShape EMPTY = new ArrayVoxelShape(new BitSetDiscreteVoxelShape(0, 0, 0), (DoubleList)(new DoubleArrayList(new double[]{0.0D})), (DoubleList)(new DoubleArrayList(new double[]{0.0D})), (DoubleList)(new DoubleArrayList(new double[]{0.0D}))); + public static final VoxelShape INFINITY = box( + Double.NEGATIVE_INFINITY, +@@ -35,6 +41,30 @@ public final class Shapes { + new DoubleArrayList(new double[]{0.0}) + ); + // Paper start - optimise collisions - force arrayvoxelshape + private static final DoubleArrayList[] PARTS_BY_BITS = new DoubleArrayList[] { @@ -3585,16 +3590,22 @@ index 9176735c08a75854209f24113b0e78332249dc4d..17785f7c709073a01928e8e6a57702f8 public static VoxelShape empty() { return EMPTY; } -@@ -41,22 +71,39 @@ public final class Shapes { +@@ -53,35 +83,39 @@ public final class Shapes { public static VoxelShape create(double minX, double minY, double minZ, double maxX, double maxY, double maxZ) { - if (!(maxX - minX < 1.0E-7D) && !(maxY - minY < 1.0E-7D) && !(maxZ - minZ < 1.0E-7D)) { + if (!(maxX - minX < 1.0E-7) && !(maxY - minY < 1.0E-7) && !(maxZ - minZ < 1.0E-7)) { - int i = findBits(minX, maxX); - int j = findBits(minY, maxY); - int k = findBits(minZ, maxZ); -- if (i >= 0 && j >= 0 && k >= 0) { -- if (i == 0 && j == 0 && k == 0) { -- return block(); +- if (i < 0 || j < 0 || k < 0) { +- return new ArrayVoxelShape( +- BLOCK.shape, +- DoubleArrayList.wrap(new double[]{minX, maxX}), +- DoubleArrayList.wrap(new double[]{minY, maxY}), +- DoubleArrayList.wrap(new double[]{minZ, maxZ}) +- ); +- } else if (i == 0 && j == 0 && k == 0) { +- return block(); + // Paper start - optimise collisions + // force ArrayVoxelShape in every case + final int bitsX = findBits(minX, maxX); @@ -3603,12 +3614,7 @@ index 9176735c08a75854209f24113b0e78332249dc4d..17785f7c709073a01928e8e6a57702f8 + if (bitsX >= 0 && bitsY >= 0 && bitsZ >= 0) { + if (bitsX == 0 && bitsY == 0 && bitsZ == 0) { + return BLOCK; - } else { -- int l = 1 << i; -- int m = 1 << j; -- int n = 1 << k; -- BitSetDiscreteVoxelShape bitSetDiscreteVoxelShape = BitSetDiscreteVoxelShape.withFilledBounds(l, m, n, (int)Math.round(minX * (double)l), (int)Math.round(minY * (double)m), (int)Math.round(minZ * (double)n), (int)Math.round(maxX * (double)l), (int)Math.round(maxY * (double)m), (int)Math.round(maxZ * (double)n)); -- return new CubeVoxelShape(bitSetDiscreteVoxelShape); ++ } else { + final int sizeX = 1 << bitsX; + final int sizeY = 1 << bitsY; + final int sizeZ = 1 << bitsZ; @@ -3623,21 +3629,34 @@ index 9176735c08a75854209f24113b0e78332249dc4d..17785f7c709073a01928e8e6a57702f8 + PARTS_BY_BITS[bitsY], + PARTS_BY_BITS[bitsZ] + ); - } ++ } } else { -- return new ArrayVoxelShape(BLOCK.shape, (DoubleList)DoubleArrayList.wrap(new double[]{minX, maxX}), (DoubleList)DoubleArrayList.wrap(new double[]{minY, maxY}), (DoubleList)DoubleArrayList.wrap(new double[]{minZ, maxZ})); +- int l = 1 << i; +- int m = 1 << j; +- int n = 1 << k; +- BitSetDiscreteVoxelShape bitSetDiscreteVoxelShape = BitSetDiscreteVoxelShape.withFilledBounds( +- l, +- m, +- n, +- (int)Math.round(minX * l), +- (int)Math.round(minY * m), +- (int)Math.round(minZ * n), +- (int)Math.round(maxX * l), +- (int)Math.round(maxY * m), +- (int)Math.round(maxZ * n) + return new ArrayVoxelShape( + BLOCK.shape, + minX == 0.0 && maxX == 1.0 ? io.papermc.paper.util.CollisionUtil.ZERO_ONE : DoubleArrayList.wrap(new double[] { minX, maxX }), + minY == 0.0 && maxY == 1.0 ? io.papermc.paper.util.CollisionUtil.ZERO_ONE : DoubleArrayList.wrap(new double[] { minY, maxY }), + minZ == 0.0 && maxZ == 1.0 ? io.papermc.paper.util.CollisionUtil.ZERO_ONE : DoubleArrayList.wrap(new double[] { minZ, maxZ }) -+ ); + ); +- return new CubeVoxelShape(bitSetDiscreteVoxelShape); } + // Paper end - optimise collisions } else { return empty(); } -@@ -95,67 +142,53 @@ public final class Shapes { +@@ -120,79 +154,53 @@ public final class Shapes { } public static VoxelShape or(VoxelShape first, VoxelShape... others) { @@ -3699,9 +3718,17 @@ index 9176735c08a75854209f24113b0e78332249dc4d..17785f7c709073a01928e8e6a57702f8 - } else { - IndexMerger indexMerger = createIndexMerger(1, one.getCoords(Direction.Axis.X), two.getCoords(Direction.Axis.X), bl, bl2); - IndexMerger indexMerger2 = createIndexMerger(indexMerger.size() - 1, one.getCoords(Direction.Axis.Y), two.getCoords(Direction.Axis.Y), bl, bl2); -- IndexMerger indexMerger3 = createIndexMerger((indexMerger.size() - 1) * (indexMerger2.size() - 1), one.getCoords(Direction.Axis.Z), two.getCoords(Direction.Axis.Z), bl, bl2); -- BitSetDiscreteVoxelShape bitSetDiscreteVoxelShape = BitSetDiscreteVoxelShape.join(one.shape, two.shape, indexMerger, indexMerger2, indexMerger3, function); -- return (VoxelShape)(indexMerger instanceof DiscreteCubeMerger && indexMerger2 instanceof DiscreteCubeMerger && indexMerger3 instanceof DiscreteCubeMerger ? new CubeVoxelShape(bitSetDiscreteVoxelShape) : new ArrayVoxelShape(bitSetDiscreteVoxelShape, indexMerger.getList(), indexMerger2.getList(), indexMerger3.getList())); +- IndexMerger indexMerger3 = createIndexMerger( +- (indexMerger.size() - 1) * (indexMerger2.size() - 1), one.getCoords(Direction.Axis.Z), two.getCoords(Direction.Axis.Z), bl, bl2 +- ); +- BitSetDiscreteVoxelShape bitSetDiscreteVoxelShape = BitSetDiscreteVoxelShape.join( +- one.shape, two.shape, indexMerger, indexMerger2, indexMerger3, function +- ); +- return (VoxelShape)(indexMerger instanceof DiscreteCubeMerger +- && indexMerger2 instanceof DiscreteCubeMerger +- && indexMerger3 instanceof DiscreteCubeMerger +- ? new CubeVoxelShape(bitSetDiscreteVoxelShape) +- : new ArrayVoxelShape(bitSetDiscreteVoxelShape, indexMerger.getList(), indexMerger2.getList(), indexMerger3.getList())); - } - } + return io.papermc.paper.util.CollisionUtil.joinUnoptimized(one, two, function); // Paper - optimise collisions @@ -3720,19 +3747,23 @@ index 9176735c08a75854209f24113b0e78332249dc4d..17785f7c709073a01928e8e6a57702f8 - boolean bl3 = predicate.apply(true, false); - boolean bl4 = predicate.apply(false, true); - -- for(Direction.Axis axis : AxisCycle.AXIS_VALUES) { -- if (shape1.max(axis) < shape2.min(axis) - 1.0E-7D) { +- for (Direction.Axis axis : AxisCycle.AXIS_VALUES) { +- if (shape1.max(axis) < shape2.min(axis) - 1.0E-7) { - return bl3 || bl4; - } - -- if (shape2.max(axis) < shape1.min(axis) - 1.0E-7D) { +- if (shape2.max(axis) < shape1.min(axis) - 1.0E-7) { - return bl3 || bl4; - } - } - - IndexMerger indexMerger = createIndexMerger(1, shape1.getCoords(Direction.Axis.X), shape2.getCoords(Direction.Axis.X), bl3, bl4); -- IndexMerger indexMerger2 = createIndexMerger(indexMerger.size() - 1, shape1.getCoords(Direction.Axis.Y), shape2.getCoords(Direction.Axis.Y), bl3, bl4); -- IndexMerger indexMerger3 = createIndexMerger((indexMerger.size() - 1) * (indexMerger2.size() - 1), shape1.getCoords(Direction.Axis.Z), shape2.getCoords(Direction.Axis.Z), bl3, bl4); +- IndexMerger indexMerger2 = createIndexMerger( +- indexMerger.size() - 1, shape1.getCoords(Direction.Axis.Y), shape2.getCoords(Direction.Axis.Y), bl3, bl4 +- ); +- IndexMerger indexMerger3 = createIndexMerger( +- (indexMerger.size() - 1) * (indexMerger2.size() - 1), shape1.getCoords(Direction.Axis.Z), shape2.getCoords(Direction.Axis.Z), bl3, bl4 +- ); - return joinIsNotEmpty(indexMerger, indexMerger2, indexMerger3, shape1.shape, shape2.shape, predicate); - } - } else { @@ -3742,8 +3773,8 @@ index 9176735c08a75854209f24113b0e78332249dc4d..17785f7c709073a01928e8e6a57702f8 + return io.papermc.paper.util.CollisionUtil.isJoinNonEmpty(shape1, shape2, predicate); // Paper - optimise collisions } - private static boolean joinIsNotEmpty(IndexMerger mergedX, IndexMerger mergedY, IndexMerger mergedZ, DiscreteVoxelShape shape1, DiscreteVoxelShape shape2, BooleanOp predicate) { -@@ -181,69 +214,119 @@ public final class Shapes { + private static boolean joinIsNotEmpty( +@@ -220,69 +228,119 @@ public final class Shapes { } public static boolean blockOccudes(VoxelShape shape, VoxelShape neighbor, Direction direction) { @@ -3758,6 +3789,13 @@ index 9176735c08a75854209f24113b0e78332249dc4d..17785f7c709073a01928e8e6a57702f8 + } + + if (shape.isEmpty() | neighbor.isEmpty()) { ++ return false; ++ } ++ ++ // we optimise getOpposite, so we can use it ++ // secondly, use our cache to retrieve sliced shape ++ final VoxelShape newFirst = shape.getFaceShapeClamped(direction); ++ if (newFirst.isEmpty()) { return false; - } else { - Direction.Axis axis = direction.getAxis(); @@ -3765,15 +3803,10 @@ index 9176735c08a75854209f24113b0e78332249dc4d..17785f7c709073a01928e8e6a57702f8 - VoxelShape voxelShape = axisDirection == Direction.AxisDirection.POSITIVE ? shape : neighbor; - VoxelShape voxelShape2 = axisDirection == Direction.AxisDirection.POSITIVE ? neighbor : shape; - BooleanOp booleanOp = axisDirection == Direction.AxisDirection.POSITIVE ? BooleanOp.ONLY_FIRST : BooleanOp.ONLY_SECOND; -- return DoubleMath.fuzzyEquals(voxelShape.max(axis), 1.0D, 1.0E-7D) && DoubleMath.fuzzyEquals(voxelShape2.min(axis), 0.0D, 1.0E-7D) && !joinIsNotEmpty(new SliceShape(voxelShape, axis, voxelShape.shape.getSize(axis) - 1), new SliceShape(voxelShape2, axis, 0), booleanOp); +- return DoubleMath.fuzzyEquals(voxelShape.max(axis), 1.0, 1.0E-7) +- && DoubleMath.fuzzyEquals(voxelShape2.min(axis), 0.0, 1.0E-7) +- && !joinIsNotEmpty(new SliceShape(voxelShape, axis, voxelShape.shape.getSize(axis) - 1), new SliceShape(voxelShape2, axis, 0), booleanOp); } -+ -+ // we optimise getOpposite, so we can use it -+ // secondly, use our cache to retrieve sliced shape -+ final VoxelShape newFirst = shape.getFaceShapeClamped(direction); -+ if (newFirst.isEmpty()) { -+ return false; -+ } + final VoxelShape newSecond = neighbor.getFaceShapeClamped(direction.getOpposite()); + if (newSecond.isEmpty()) { + return false; @@ -3791,10 +3824,10 @@ index 9176735c08a75854209f24113b0e78332249dc4d..17785f7c709073a01928e8e6a57702f8 - boolean bl; - int i; - if (direction.getAxisDirection() == Direction.AxisDirection.POSITIVE) { -- bl = DoubleMath.fuzzyEquals(shape.max(axis), 1.0D, 1.0E-7D); +- bl = DoubleMath.fuzzyEquals(shape.max(axis), 1.0, 1.0E-7); - i = shape.shape.getSize(axis) - 1; - } else { -- bl = DoubleMath.fuzzyEquals(shape.min(axis), 0.0D, 1.0E-7D); +- bl = DoubleMath.fuzzyEquals(shape.min(axis), 0.0, 1.0E-7); - i = 0; - } + return shape.getFaceShapeClamped(direction); // Paper - optimise collisions @@ -3828,7 +3861,7 @@ index 9176735c08a75854209f24113b0e78332249dc4d..17785f7c709073a01928e8e6a57702f8 - Direction.AxisDirection axisDirection = direction.getAxisDirection(); - VoxelShape voxelShape = axisDirection == Direction.AxisDirection.POSITIVE ? one : two; - VoxelShape voxelShape2 = axisDirection == Direction.AxisDirection.POSITIVE ? two : one; -- if (!DoubleMath.fuzzyEquals(voxelShape.max(axis), 1.0D, 1.0E-7D)) { +- if (!DoubleMath.fuzzyEquals(voxelShape.max(axis), 1.0, 1.0E-7)) { - voxelShape = empty(); - } + // Paper start - optimise collisions @@ -3837,14 +3870,18 @@ index 9176735c08a75854209f24113b0e78332249dc4d..17785f7c709073a01928e8e6a57702f8 + return true; + } -- if (!DoubleMath.fuzzyEquals(voxelShape2.min(axis), 0.0D, 1.0E-7D)) { +- if (!DoubleMath.fuzzyEquals(voxelShape2.min(axis), 0.0, 1.0E-7)) { - voxelShape2 = empty(); - } + if (one.isEmpty() & two.isEmpty()) { + return false; + } -- return !joinIsNotEmpty(block(), joinUnoptimized(new SliceShape(voxelShape, axis, voxelShape.shape.getSize(axis) - 1), new SliceShape(voxelShape2, axis, 0), BooleanOp.OR), BooleanOp.ONLY_FIRST); +- return !joinIsNotEmpty( +- block(), +- joinUnoptimized(new SliceShape(voxelShape, axis, voxelShape.shape.getSize(axis) - 1), new SliceShape(voxelShape2, axis, 0), BooleanOp.OR), +- BooleanOp.ONLY_FIRST +- ); - } else { + // we optimise getOpposite, so we can use it + // secondly, use our cache to retrieve sliced shape @@ -3876,17 +3913,13 @@ index 9176735c08a75854209f24113b0e78332249dc4d..17785f7c709073a01928e8e6a57702f8 } public static boolean faceShapeOccludes(VoxelShape one, VoxelShape two) { -- if (one != block() && two != block()) { -- if (one.isEmpty() && two.isEmpty()) { -- return false; -- } else { -- return !joinIsNotEmpty(block(), joinUnoptimized(one, two, BooleanOp.OR), BooleanOp.ONLY_FIRST); -- } -- } else { +- return one == block() +- || two == block() +- || (!one.isEmpty() || !two.isEmpty()) && !joinIsNotEmpty(block(), joinUnoptimized(one, two, BooleanOp.OR), BooleanOp.ONLY_FIRST); + // Paper start - optimise collisions + if (one.occludesFullBlockIfCached() || two.occludesFullBlockIfCached()) { - return true; - } ++ return true; ++ } + + final boolean s1Empty = one.isEmpty(); + final boolean s2Empty = two.isEmpty(); @@ -3908,7 +3941,7 @@ index 9176735c08a75854209f24113b0e78332249dc4d..17785f7c709073a01928e8e6a57702f8 @VisibleForTesting diff --git a/src/main/java/net/minecraft/world/phys/shapes/SliceShape.java b/src/main/java/net/minecraft/world/phys/shapes/SliceShape.java -index cf469f9daa81da8bc330c9cac7e813db87f9f9af..d9256710e815a5cb55409a80d59df2029b98c0d7 100644 +index 53aa193f33a1a15376a59b8d6dd8cbc6cbec168b..a745ff8d115e1d0da6138e4f06726e0737bb1600 100644 --- a/src/main/java/net/minecraft/world/phys/shapes/SliceShape.java +++ b/src/main/java/net/minecraft/world/phys/shapes/SliceShape.java @@ -12,6 +12,7 @@ public class SliceShape extends VoxelShape { @@ -3920,10 +3953,10 @@ index cf469f9daa81da8bc330c9cac7e813db87f9f9af..d9256710e815a5cb55409a80d59df202 private static DiscreteVoxelShape makeSlice(DiscreteVoxelShape voxelSet, Direction.Axis axis, int sliceWidth) { diff --git a/src/main/java/net/minecraft/world/phys/shapes/VoxelShape.java b/src/main/java/net/minecraft/world/phys/shapes/VoxelShape.java -index 15e2dfa9a17b4f19768c0cde0ad8031f0122cd33..6bd6385ad82481a099f3556ed2dbd3744888fc34 100644 +index c88218ead06bec470b79f641651086dc121c42cc..e6b17f32f2b6930739a98c6139442383c1847add 100644 --- a/src/main/java/net/minecraft/world/phys/shapes/VoxelShape.java +++ b/src/main/java/net/minecraft/world/phys/shapes/VoxelShape.java -@@ -16,30 +16,438 @@ import net.minecraft.world.phys.BlockHitResult; +@@ -16,37 +16,438 @@ import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.Vec3; public abstract class VoxelShape { @@ -3937,7 +3970,7 @@ index 15e2dfa9a17b4f19768c0cde0ad8031f0122cd33..6bd6385ad82481a099f3556ed2dbd374 + private double offsetX; + private double offsetY; + private double offsetZ; -+ private AABB singleAABBRepresentation; ++ @Nullable private AABB singleAABBRepresentation; + private double[] rootCoordinatesX; + private double[] rootCoordinatesY; + private double[] rootCoordinatesZ; @@ -4335,15 +4368,22 @@ index 15e2dfa9a17b4f19768c0cde0ad8031f0122cd33..6bd6385ad82481a099f3556ed2dbd374 - if (this.isEmpty()) { - throw (UnsupportedOperationException)Util.pauseInIde(new UnsupportedOperationException("No bounds for empty shape.")); - } else { -- return new AABB(this.min(Direction.Axis.X), this.min(Direction.Axis.Y), this.min(Direction.Axis.Z), this.max(Direction.Axis.X), this.max(Direction.Axis.Y), this.max(Direction.Axis.Z)); +- return new AABB( +- this.min(Direction.Axis.X), +- this.min(Direction.Axis.Y), +- this.min(Direction.Axis.Z), +- this.max(Direction.Axis.X), +- this.max(Direction.Axis.Y), +- this.max(Direction.Axis.Z) +- ); + // Paper start - optimise collisions + if (this.isEmpty) { + throw Util.pauseInIde(new UnsupportedOperationException("No bounds for empty shape.")); - } ++ } + AABB cached = this.cachedBounds; + if (cached != null) { + return cached; -+ } + } + + final io.papermc.paper.util.collisions.CachedShapeData shapeData = this.cachedShapeData; + @@ -4372,32 +4412,38 @@ index 15e2dfa9a17b4f19768c0cde0ad8031f0122cd33..6bd6385ad82481a099f3556ed2dbd374 } public VoxelShape singleEncompassing() { -@@ -53,19 +461,106 @@ public abstract class VoxelShape { +@@ -69,28 +470,106 @@ public abstract class VoxelShape { protected abstract DoubleList getCoords(Direction.Axis axis); public boolean isEmpty() { - return this.shape.isEmpty(); + return this.isEmpty; // Paper - optimise collisions - } - ++ } ++ + // Paper start - optimise collisions + private static DoubleList offsetList(final DoubleList src, final double by) { + if (src instanceof OffsetDoubleList offsetDoubleList) { + return new OffsetDoubleList(offsetDoubleList.delegate, by + offsetDoubleList.offset); + } + return new OffsetDoubleList(src, by); -+ } + } + // Paper end - optimise collisions -+ + public VoxelShape move(double x, double y, double z) { -- return (VoxelShape)(this.isEmpty() ? Shapes.empty() : new ArrayVoxelShape(this.shape, (DoubleList)(new OffsetDoubleList(this.getCoords(Direction.Axis.X), x)), (DoubleList)(new OffsetDoubleList(this.getCoords(Direction.Axis.Y), y)), (DoubleList)(new OffsetDoubleList(this.getCoords(Direction.Axis.Z), z)))); +- return (VoxelShape)(this.isEmpty() +- ? Shapes.empty() +- : new ArrayVoxelShape( + // Paper start - optimise collisions + if (this.isEmpty) { + return Shapes.empty(); + } + + final ArrayVoxelShape ret = new ArrayVoxelShape( -+ this.shape, + this.shape, +- new OffsetDoubleList(this.getCoords(Direction.Axis.X), x), +- new OffsetDoubleList(this.getCoords(Direction.Axis.Y), y), +- new OffsetDoubleList(this.getCoords(Direction.Axis.Z), z) +- )); + offsetList(this.getCoords(Direction.Axis.X), x), + offsetList(this.getCoords(Direction.Axis.Y), y), + offsetList(this.getCoords(Direction.Axis.Z), z) @@ -4414,9 +4460,11 @@ index 15e2dfa9a17b4f19768c0cde0ad8031f0122cd33..6bd6385ad82481a099f3556ed2dbd374 public VoxelShape optimize() { - VoxelShape[] voxelShapes = new VoxelShape[]{Shapes.empty()}; -- this.forAllBoxes((minX, minY, minZ, maxX, maxY, maxZ) -> { -- voxelShapes[0] = Shapes.joinUnoptimized(voxelShapes[0], Shapes.box(minX, minY, minZ, maxX, maxY, maxZ), BooleanOp.OR); -- }); +- this.forAllBoxes( +- (minX, minY, minZ, maxX, maxY, maxZ) -> voxelShapes[0] = Shapes.joinUnoptimized( +- voxelShapes[0], Shapes.box(minX, minY, minZ, maxX, maxY, maxZ), BooleanOp.OR +- ) +- ); - return voxelShapes[0]; + // Paper start - optimise collisions + // Optimise merge strategy to increase the number of simple joins, and additionally forward the toAabbs cache @@ -4486,8 +4534,8 @@ index 15e2dfa9a17b4f19768c0cde0ad8031f0122cd33..6bd6385ad82481a099f3556ed2dbd374 } public void forAllEdges(Shapes.DoubleLineConsumer consumer) { -@@ -83,12 +578,43 @@ public abstract class VoxelShape { - }, true); +@@ -126,10 +605,43 @@ public abstract class VoxelShape { + ); } + // Paper start - optimise collisions @@ -4510,9 +4558,7 @@ index 15e2dfa9a17b4f19768c0cde0ad8031f0122cd33..6bd6385ad82481a099f3556ed2dbd374 + public List toAabbs() { - List list = Lists.newArrayList(); -- this.forAllBoxes((x1, y1, z1, x2, y2, z2) -> { -- list.add(new AABB(x1, y1, z1, x2, y2, z2)); -- }); +- this.forAllBoxes((x1, y1, z1, x2, y2, z2) -> list.add(new AABB(x1, y1, z1, x2, y2, z2))); - return list; + // Paper start - optimise collisions + io.papermc.paper.util.collisions.CachedToAABBs cachedToAABBs = this.cachedToAABBs; @@ -4535,8 +4581,8 @@ index 15e2dfa9a17b4f19768c0cde0ad8031f0122cd33..6bd6385ad82481a099f3556ed2dbd374 } public double min(Direction.Axis axis, double from, double to) { -@@ -115,37 +641,85 @@ public abstract class VoxelShape { - }) - 1; +@@ -154,43 +666,85 @@ public abstract class VoxelShape { + return Mth.binarySearch(0, this.shape.getSize(axis) + 1, i -> coord < this.get(axis, i)) - 1; } + // Paper start - optimise collisions @@ -4568,11 +4614,18 @@ index 15e2dfa9a17b4f19768c0cde0ad8031f0122cd33..6bd6385ad82481a099f3556ed2dbd374 return null; - } else { - Vec3 vec3 = end.subtract(start); -- if (vec3.lengthSqr() < 1.0E-7D) { +- if (vec3.lengthSqr() < 1.0E-7) { - return null; - } else { -- Vec3 vec32 = start.add(vec3.scale(0.001D)); -- return this.shape.isFullWide(this.findIndex(Direction.Axis.X, vec32.x - (double)pos.getX()), this.findIndex(Direction.Axis.Y, vec32.y - (double)pos.getY()), this.findIndex(Direction.Axis.Z, vec32.z - (double)pos.getZ())) ? new BlockHitResult(vec32, Direction.getNearest(vec3.x, vec3.y, vec3.z).getOpposite(), pos, true) : AABB.clip(this.toAabbs(), start, end, pos); +- Vec3 vec32 = start.add(vec3.scale(0.001)); +- return this.shape +- .isFullWide( +- this.findIndex(Direction.Axis.X, vec32.x - pos.getX()), +- this.findIndex(Direction.Axis.Y, vec32.y - pos.getY()), +- this.findIndex(Direction.Axis.Z, vec32.z - pos.getZ()) +- ) +- ? new BlockHitResult(vec32, Direction.getNearest(vec3.x, vec3.y, vec3.z).getOpposite(), pos, true) +- : AABB.clip(this.toAabbs(), start, end, pos); + } + + final Vec3 directionOpposite = end.subtract(start); @@ -4615,10 +4668,10 @@ index 15e2dfa9a17b4f19768c0cde0ad8031f0122cd33..6bd6385ad82481a099f3556ed2dbd374 - if (vec3s[0] == null || target.distanceToSqr(d, e, f) < target.distanceToSqr(vec3s[0])) { - vec3s[0] = new Vec3(d, e, f); - } -+ } - - }); - return Optional.of(vec3s[0]); + } ++ + Vec3 ret = null; + double retDistance = Double.MAX_VALUE; + @@ -4634,14 +4687,14 @@ index 15e2dfa9a17b4f19768c0cde0ad8031f0122cd33..6bd6385ad82481a099f3556ed2dbd374 + ret = new Vec3(x, y, z); + retDistance = dist; + } - } ++ } + + return Optional.ofNullable(ret); + // Paper end - optimise collisions } public VoxelShape getFaceShape(Direction facing) { -@@ -180,7 +754,28 @@ public abstract class VoxelShape { +@@ -227,7 +781,28 @@ public abstract class VoxelShape { } public double collide(Direction.Axis axis, AABB box, double maxDist) { diff --git a/patches/server/1018-Fix-entity-type-tags-suggestions-in-selectors.patch b/patches/server/1018-Fix-entity-type-tags-suggestions-in-selectors.patch index 83872a3693..854bb2d342 100644 --- a/patches/server/1018-Fix-entity-type-tags-suggestions-in-selectors.patch +++ b/patches/server/1018-Fix-entity-type-tags-suggestions-in-selectors.patch @@ -118,13 +118,13 @@ index 3d897ec6920eff6176ddac9f0442a997b9ef14fd..abaf1ea340c69c8bee80e64567b44b5c this.level = MinMaxBounds.Ints.ANY; this.rotX = WrappedMinMaxBounds.ANY; diff --git a/src/main/java/net/minecraft/commands/arguments/selector/options/EntitySelectorOptions.java b/src/main/java/net/minecraft/commands/arguments/selector/options/EntitySelectorOptions.java -index 7863833c9a761a2b9364ff572ec909ec5a4538c3..36e26929306c04af7a44012fd7fc9902027e9ea2 100644 +index 0ed0679af07445f0ba241c791f15dcc2b6731b12..01ec7813cd7abe94cb87927c4c2324c8be6c3a56 100644 --- a/src/main/java/net/minecraft/commands/arguments/selector/options/EntitySelectorOptions.java +++ b/src/main/java/net/minecraft/commands/arguments/selector/options/EntitySelectorOptions.java -@@ -69,6 +69,19 @@ public class EntitySelectorOptions { - public static final DynamicCommandExceptionType ERROR_ENTITY_TYPE_INVALID = new DynamicCommandExceptionType((entity) -> { - return Component.translatableEscape("argument.entity.options.type.invalid", entity); - }); +@@ -75,6 +75,19 @@ public class EntitySelectorOptions { + public static final DynamicCommandExceptionType ERROR_ENTITY_TYPE_INVALID = new DynamicCommandExceptionType( + entity -> Component.translatableEscape("argument.entity.options.type.invalid", entity) + ); + // Paper start - tell clients to ask server for suggestions for EntityArguments + public static final DynamicCommandExceptionType ERROR_ENTITY_TAG_INVALID = new DynamicCommandExceptionType((object) -> { + return io.papermc.paper.adventure.PaperAdventure @@ -141,16 +141,16 @@ index 7863833c9a761a2b9364ff572ec909ec5a4538c3..36e26929306c04af7a44012fd7fc9902 private static void register(String id, EntitySelectorOptions.Modifier handler, Predicate condition, Component description) { OPTIONS.put(id, new EntitySelectorOptions.Option(handler, condition, description)); -@@ -316,6 +329,12 @@ public class EntitySelectorOptions { +@@ -296,6 +309,12 @@ public class EntitySelectorOptions { - if (reader.isTag()) { - TagKey> tagKey = TagKey.create(Registries.ENTITY_TYPE, ResourceLocation.read(reader.getReader())); -+ // Paper start - tell clients to ask server for suggestions for EntityArguments; throw error if invalid entity tag (only on suggestions to keep cmd success behavior) -+ if (reader.parsingEntityArgumentSuggestions && io.papermc.paper.configuration.GlobalConfiguration.get().commands.fixTargetSelectorTagCompletion && net.minecraft.core.registries.BuiltInRegistries.ENTITY_TYPE.getTag(tagKey).isEmpty()) { -+ reader.getReader().setCursor(i); -+ throw ERROR_ENTITY_TAG_INVALID.createWithContext(reader.getReader(), tagKey); -+ } -+ // Paper end - tell clients to ask server for suggestions for EntityArguments - reader.addPredicate((entity) -> { - return entity.getType().is(tagKey) != bl; - }); + if (reader.isTag()) { + TagKey> tagKey = TagKey.create(Registries.ENTITY_TYPE, ResourceLocation.read(reader.getReader())); ++ // Paper start - tell clients to ask server for suggestions for EntityArguments; throw error if invalid entity tag (only on suggestions to keep cmd success behavior) ++ if (reader.parsingEntityArgumentSuggestions && io.papermc.paper.configuration.GlobalConfiguration.get().commands.fixTargetSelectorTagCompletion && net.minecraft.core.registries.BuiltInRegistries.ENTITY_TYPE.getTag(tagKey).isEmpty()) { ++ reader.getReader().setCursor(i); ++ throw ERROR_ENTITY_TAG_INVALID.createWithContext(reader.getReader(), tagKey); ++ } ++ // Paper end - tell clients to ask server for suggestions for EntityArguments + reader.addPredicate(entity -> entity.getType().is(tagKey) != bl); + } else { + ResourceLocation resourceLocation = ResourceLocation.read(reader.getReader()); diff --git a/patches/server/1021-Properly-resend-entities.patch b/patches/server/1021-Properly-resend-entities.patch index 5966fb39a6..113d66e3b4 100644 --- a/patches/server/1021-Properly-resend-entities.patch +++ b/patches/server/1021-Properly-resend-entities.patch @@ -150,7 +150,7 @@ index 97b0119ac71284b3a223c089bec26d87a01d3b25..1e5f709115007ff19901c0a6c3cf884d this.sendLevelInfo(player, worldserver1); diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index e35dd853bbffbf1771543d2a59878879cd09fb9c..22458154f36ebabb22368773f4e7f6d681c24960 100644 +index a9d549d1f35928b7e9220e1e2e4ac30f3199ba2d..28b4e9ebc35058c3e094c1f8bd87130e288cea33 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3844,6 +3844,11 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -180,7 +180,7 @@ index a1bfd700cd4c39e4bb1b9c140b54b7c82cd8b32c..205b52e486123aa23a1469de896ab1ec } entity.playSound(((Bucketable) entity).getPickupSound(), 1.0F, 1.0F); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 38c14e06bcada9678b64c6eacf351de10232ee56..7cd7912cecbbbe2c32bfd9b85181115c6d316eb8 100644 +index 76193067a21ff962cf2634b36d0ddf3eff8f85d7..e8e4489bcd64fde1b3226bdc7a7cc612508bda3f 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -1000,7 +1000,11 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { diff --git a/patches/server/1022-Optimize-Hoppers.patch b/patches/server/1022-Optimize-Hoppers.patch index 4502d0525f..fc971c77c0 100644 --- a/patches/server/1022-Optimize-Hoppers.patch +++ b/patches/server/1022-Optimize-Hoppers.patch @@ -723,13 +723,13 @@ index e3b6f2bf93710ea695b0c25c0b6968a8f24f0829..cdb739df2a285032d25d84f4464f202a @Override diff --git a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java -index e4e827a57c2913c719282cc0d5da33586607677b..f52ccd4f3e062af3c7cc6eaea5b074a3bbd21690 100644 +index f33c4633094002a3dd0c54353b62f7b358628be3..dfd1246b735fe64c5beae83567a013861eb00822 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java @@ -93,12 +93,19 @@ public abstract class RandomizableContainerBlockEntity extends BaseContainerBloc @Override public boolean isEmpty() { - this.unpackLootTable((Player)null); + this.unpackLootTable(null); - return this.getItems().stream().allMatch(ItemStack::isEmpty); + // Paper start - Perf: Optimize Hoppers + for (final ItemStack itemStack : this.getItems()) { @@ -743,8 +743,8 @@ index e4e827a57c2913c719282cc0d5da33586607677b..f52ccd4f3e062af3c7cc6eaea5b074a3 @Override public ItemStack getItem(int slot) { -- this.unpackLootTable((Player)null); -+ if (slot == 0) this.unpackLootTable((Player) null); // Paper - Perf: Optimize Hoppers +- this.unpackLootTable(null); ++ if (slot == 0) this.unpackLootTable(null); // Paper - Perf: Optimize Hoppers return this.getItems().get(slot); } diff --git a/patches/server/1023-Improve-performance-of-mass-crafts.patch b/patches/server/1023-Improve-performance-of-mass-crafts.patch index 640d0204e2..3f69ae35b9 100644 --- a/patches/server/1023-Improve-performance-of-mass-crafts.patch +++ b/patches/server/1023-Improve-performance-of-mass-crafts.patch @@ -34,17 +34,17 @@ index 7a0c1a55a211035bbca7b97293e94b04ae308bae..c3800bdd5096cb06e085e28f6bf0f655 if (optional.isPresent()) { RecipeHolder recipeholder = (RecipeHolder) optional.get(); diff --git a/src/main/java/net/minecraft/world/inventory/ResultSlot.java b/src/main/java/net/minecraft/world/inventory/ResultSlot.java -index 7b2ac37e8bd305919f04ded043e50f13b3fe4253..245731757f2593c736916ac6ee59e2c91d179934 100644 +index 113460eff5121788fce44d6569ec07deb9701b20..accf752e7615f775483830f81bd0df30e40d3c7f 100644 --- a/src/main/java/net/minecraft/world/inventory/ResultSlot.java +++ b/src/main/java/net/minecraft/world/inventory/ResultSlot.java -@@ -59,7 +59,7 @@ public class ResultSlot extends Slot { +@@ -58,7 +58,7 @@ public class ResultSlot extends Slot { @Override public void onTake(Player player, ItemStack stack) { this.checkTakeAchievements(stack); - NonNullList nonNullList = player.level().getRecipeManager().getRemainingItemsFor(RecipeType.CRAFTING, this.craftSlots, player.level()); + NonNullList nonNullList = player.level().getRecipeManager().getRemainingItemsFor(RecipeType.CRAFTING, this.craftSlots, player.level(), this.craftSlots.getCurrentRecipe() != null ? this.craftSlots.getCurrentRecipe().id() : null); // Paper - Perf: Improve mass crafting; check last recipe used first - for(int i = 0; i < nonNullList.size(); ++i) { + for (int i = 0; i < nonNullList.size(); i++) { ItemStack itemStack = this.craftSlots.getItem(i); diff --git a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java index a0ab3c55826af292d1cdac05648139b4d31f1376..d87124f5356180a37e581febc6141fdc5f1395a7 100644 diff --git a/patches/server/1024-Actually-optimise-explosions.patch b/patches/server/1024-Actually-optimise-explosions.patch index bcb01ef768..629e23722c 100644 --- a/patches/server/1024-Actually-optimise-explosions.patch +++ b/patches/server/1024-Actually-optimise-explosions.patch @@ -497,10 +497,10 @@ index 093c814d6835f20b1208236db96bb40b4611936c..b678da2cbb93cea7971bc3c4d324cfca } diff --git a/src/main/java/net/minecraft/world/level/ExplosionDamageCalculator.java b/src/main/java/net/minecraft/world/level/ExplosionDamageCalculator.java -index 24dba1eb6f5dc71e5d1ce2d150930eaefc83f811..f529f5d0f28533ec89f3ee712e59745991d068ee 100644 +index 92e06e14fd76fa34b871657c3410a4527cd30e09..da25fee7dd436fbe9f5566311f254ec7a99835d2 100644 --- a/src/main/java/net/minecraft/world/level/ExplosionDamageCalculator.java +++ b/src/main/java/net/minecraft/world/level/ExplosionDamageCalculator.java -@@ -20,11 +20,17 @@ public class ExplosionDamageCalculator { +@@ -22,11 +22,17 @@ public class ExplosionDamageCalculator { return true; } @@ -513,9 +513,9 @@ index 24dba1eb6f5dc71e5d1ce2d150930eaefc83f811..f529f5d0f28533ec89f3ee712e597459 + // Paper end - actually optimise explosions float f = explosion.radius() * 2.0F; Vec3 vec3 = explosion.center(); - double d = Math.sqrt(entity.distanceToSqr(vec3)) / (double)f; -- double e = (1.0D - d) * (double)Explosion.getSeenPercent(vec3, entity); -+ double e = (1.0D - d) * seenPercent; // Paper - actually optimise explosions - return (float)((e * e + e) / 2.0D * 7.0D * (double)f + 1.0D); + double d = Math.sqrt(entity.distanceToSqr(vec3)) / f; +- double e = (1.0 - d) * Explosion.getSeenPercent(vec3, entity); ++ double e = (1.0 - d) * seenPercent; // Paper - actually optimise explosions + return (float)((e * e + e) / 2.0 * 7.0 * f + 1.0); } } diff --git a/patches/server/1025-Optimise-chunk-tick-iteration.patch b/patches/server/1025-Optimise-chunk-tick-iteration.patch index 73a6088d00..da9130527c 100644 --- a/patches/server/1025-Optimise-chunk-tick-iteration.patch +++ b/patches/server/1025-Optimise-chunk-tick-iteration.patch @@ -365,7 +365,7 @@ index 2b33a3d8fdb86024acb2a3ee9d0a4a7dd4989c98..366c0c9b45a819f7f94ebe3e49b8ab7f gameprofilerfiller.pop(); } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index c99d2f2d64b73179e4e27b63030e26a07953041b..58591bf2f63b9c5e97d9ce4188dff3366968a178 100644 +index 17a6d43685f35a6978c2d941876a1f8a9a2c8b42..b3781efbd3edcf102fe1bda5d6149915dc1127c6 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -325,6 +325,9 @@ public class ServerPlayer extends Player { diff --git a/patches/server/1026-Lag-compensation-ticks.patch b/patches/server/1026-Lag-compensation-ticks.patch index 6a0a25899e..ffb279c55f 100644 --- a/patches/server/1026-Lag-compensation-ticks.patch +++ b/patches/server/1026-Lag-compensation-ticks.patch @@ -63,7 +63,7 @@ index ef3048a4748113538a0ee0af5b526b2cd51d5c29..a7b217ddbcbf92513bd38101fdfca207 if (this.hasDelayedDestroy) { diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 22458154f36ebabb22368773f4e7f6d681c24960..3c8740c421d756477306fc9af933bead8842f5e1 100644 +index 28b4e9ebc35058c3e094c1f8bd87130e288cea33..e9bb7feb591032904516d1b9374f486d8a7d066c 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3849,6 +3849,10 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/1027-Optimise-nearby-player-retrieval.patch b/patches/server/1027-Optimise-nearby-player-retrieval.patch index c73abc51ad..06b8d42fec 100644 --- a/patches/server/1027-Optimise-nearby-player-retrieval.patch +++ b/patches/server/1027-Optimise-nearby-player-retrieval.patch @@ -128,16 +128,19 @@ index 8a5abc320137d045acba0c87cef9f2912d78b6fb..6907d1be36fbdf0856c0e11983218d2f // Add env and gen to constructor, IWorldDataServer -> WorldDataServer public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List list, boolean flag1, @Nullable RandomSequences randomsequences, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) { diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java -index ed1b95ec694b0fe8b647964b18b8c33707fc0b47..65cd42ce9f553e0aa5bf248bdbf902f9d1f55460 100644 +index 2e887e426dcd79e2dda401f127d0e01ca537e80e..65cd42ce9f553e0aa5bf248bdbf902f9d1f55460 100644 --- a/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java +++ b/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java -@@ -21,18 +21,50 @@ public class PlayerSensor extends Sensor { +@@ -21,17 +21,50 @@ public class PlayerSensor extends Sensor { @Override protected void doTick(ServerLevel world, LivingEntity entity) { -- List list = world.players().stream().filter(EntitySelector.NO_SPECTATORS).filter((player) -> { -- return entity.closerThan(player, 16.0D); -- }).sorted(Comparator.comparingDouble(entity::distanceToSqr)).collect(Collectors.toList()); +- List list = world.players() +- .stream() +- .filter(EntitySelector.NO_SPECTATORS) +- .filter(player -> entity.closerThan(player, 16.0)) +- .sorted(Comparator.comparingDouble(entity::distanceToSqr)) +- .collect(Collectors.toList()); + // Paper start - Perf: optimise nearby player retrieval & remove streams from hot code + io.papermc.paper.util.player.NearbyPlayers nearbyPlayers = world.chunkSource.chunkMap.getNearbyPlayers(); + net.minecraft.world.phys.Vec3 entityPos = entity.position(); @@ -164,13 +167,9 @@ index ed1b95ec694b0fe8b647964b18b8c33707fc0b47..65cd42ce9f553e0aa5bf248bdbf902f9 + players.sort(Comparator.comparingDouble(entity::distanceToSqr)); Brain brain = entity.getBrain(); - brain.setMemory(MemoryModuleType.NEAREST_PLAYERS, list); -- List list2 = list.stream().filter((player) -> { -- return isEntityTargetable(entity, player); -- }).collect(Collectors.toList()); +- List list2 = list.stream().filter(player -> isEntityTargetable(entity, player)).collect(Collectors.toList()); - brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_PLAYER, list2.isEmpty() ? null : list2.get(0)); -- Optional optional = list2.stream().filter((player) -> { -- return isEntityAttackable(entity, player); -- }).findFirst(); +- Optional optional = list2.stream().filter(player -> isEntityAttackable(entity, player)).findFirst(); - brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_ATTACKABLE_PLAYER, optional); + + brain.setMemory(MemoryModuleType.NEAREST_PLAYERS, players); @@ -195,34 +194,34 @@ index ed1b95ec694b0fe8b647964b18b8c33707fc0b47..65cd42ce9f553e0aa5bf248bdbf902f9 } } diff --git a/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java b/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java -index fae0dbfb6ac09a0c152c0f74a72583f44316def7..c8a80c1b2fedff22e8a877d466062375ffb2f0d7 100644 +index aecb0ad814586bfc5e56755ee14379a69388b38c..d2f0c3b26d4beedb49d86e0242d843590d469d02 100644 --- a/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java +++ b/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java @@ -10,7 +10,7 @@ public class TargetingConditions { public static final TargetingConditions DEFAULT = forCombat(); - private static final double MIN_VISIBILITY_DISTANCE_FOR_INVISIBLE_TARGET = 2.0D; + private static final double MIN_VISIBILITY_DISTANCE_FOR_INVISIBLE_TARGET = 2.0; private final boolean isCombat; -- private double range = -1.0D; -+ public double range = -1.0D; // Paper - public +- private double range = -1.0; ++ public double range = -1.0; // Paper - public private boolean checkLineOfSight = true; private boolean testInvisible = true; @Nullable diff --git a/src/main/java/net/minecraft/world/level/EntityGetter.java b/src/main/java/net/minecraft/world/level/EntityGetter.java -index f42dd9602805e9d538506ee4e3eac7e2811a3da6..ed84c87a3f76bc0254c1abb189e6b8b808823465 100644 +index 21843501355a0c0c8d594e3e5312e97861c9a777..ea0aee88c7d901034427db201c1b2430f8a1d522 100644 --- a/src/main/java/net/minecraft/world/level/EntityGetter.java +++ b/src/main/java/net/minecraft/world/level/EntityGetter.java -@@ -230,9 +230,13 @@ public interface EntityGetter { +@@ -233,9 +233,13 @@ public interface EntityGetter { T livingEntity = null; - for(T livingEntity2 : entityList) { + for (T livingEntity2 : entityList) { + // Paper start - optimise nearby player retrieval; move up + // don't check entities outside closest range + double e = livingEntity2.distanceToSqr(x, y, z); -+ if (d == -1.0D || e < d) { ++ if (d == -1.0 || e < d) { + // Paper end - move up if (targetPredicate.test(entity, livingEntity2)) { - double e = livingEntity2.distanceToSqr(x, y, z); -- if (d == -1.0D || e < d) { +- if (d == -1.0 || e < d) { + // Paper - optimise nearby player retrieval; move up d = e; livingEntity = livingEntity2; diff --git a/patches/server/1029-Handle-Oversized-block-entities-in-chunks.patch b/patches/server/1029-Handle-Oversized-block-entities-in-chunks.patch index 1bdb933b52..3705e1d295 100644 --- a/patches/server/1029-Handle-Oversized-block-entities-in-chunks.patch +++ b/patches/server/1029-Handle-Oversized-block-entities-in-chunks.patch @@ -9,7 +9,7 @@ creating too large of a packet to sed. Co-authored-by: Spottedleaf diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java -index 74b5cec09d953a247bc5aba3c4232a4c28ea1046..998deae645b4497c3285bfba3260c636439f9ecf 100644 +index 9c51c4d12bac588002f530f484ee89b094269349..761a8d4fb47f9bffdf9ca76fbae1003e8ae46a02 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java +++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java @@ -24,6 +24,14 @@ public class ClientboundLevelChunkPacketData { @@ -33,7 +33,7 @@ index 74b5cec09d953a247bc5aba3c4232a4c28ea1046..998deae645b4497c3285bfba3260c636 this.blockEntitiesData = Lists.newArrayList(); + int totalTileEntities = 0; // Paper - Handle oversized block entities in chunks - for(Map.Entry entry2 : chunk.getBlockEntities().entrySet()) { + for (Entry entry2 : chunk.getBlockEntities().entrySet()) { + // Paper start - Handle oversized block entities in chunks + if (++totalTileEntities > TE_LIMIT) { + var packet = entry2.getValue().getUpdatePacket(); @@ -45,7 +45,7 @@ index 74b5cec09d953a247bc5aba3c4232a4c28ea1046..998deae645b4497c3285bfba3260c636 + // Paper end - Handle oversized block entities in chunks this.blockEntitiesData.add(ClientboundLevelChunkPacketData.BlockEntityInfo.create(entry2.getValue())); } - + } diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java index 6412dff5ed0505f62dd5b71ab9606257858a7317..fc230d835f9aa526a4b179d36d921f0fec348aa8 100644 --- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkWithLightPacket.java diff --git a/patches/server/1034-Improve-tag-parser-handling.patch b/patches/server/1034-Improve-tag-parser-handling.patch index e2c46e261e..30bd53f874 100644 --- a/patches/server/1034-Improve-tag-parser-handling.patch +++ b/patches/server/1034-Improve-tag-parser-handling.patch @@ -54,7 +54,7 @@ index 0000000000000000000000000000000000000000..a375ad4ba9db990b24a2b9ff366fcba6 + } +} diff --git a/src/main/java/net/minecraft/nbt/TagParser.java b/src/main/java/net/minecraft/nbt/TagParser.java -index 5bec54239a2b185284c10d58854e5a13e33daae5..ef970428fe9fe36c242ce6588bb6843eb6179d59 100644 +index ebe0efe488357ae895aaf752e9bc008b96db156f..c77860a141064aea6a0b510bb44d35fea90aee42 100644 --- a/src/main/java/net/minecraft/nbt/TagParser.java +++ b/src/main/java/net/minecraft/nbt/TagParser.java @@ -48,6 +48,7 @@ public class TagParser { @@ -64,8 +64,8 @@ index 5bec54239a2b185284c10d58854e5a13e33daae5..ef970428fe9fe36c242ce6588bb6843e + private int depth; // Paper public static CompoundTag parseTag(String string) throws CommandSyntaxException { - return (new TagParser(new StringReader(string))).readSingleStruct(); -@@ -156,6 +157,7 @@ public class TagParser { + return new TagParser(new StringReader(string)).readSingleStruct(); +@@ -158,6 +159,7 @@ public class TagParser { public CompoundTag readStruct() throws CommandSyntaxException { this.expect('{'); @@ -73,7 +73,7 @@ index 5bec54239a2b185284c10d58854e5a13e33daae5..ef970428fe9fe36c242ce6588bb6843e CompoundTag compoundTag = new CompoundTag(); this.reader.skipWhitespace(); -@@ -179,6 +181,7 @@ public class TagParser { +@@ -181,6 +183,7 @@ public class TagParser { } this.expect('}'); @@ -81,7 +81,7 @@ index 5bec54239a2b185284c10d58854e5a13e33daae5..ef970428fe9fe36c242ce6588bb6843e return compoundTag; } -@@ -188,6 +191,7 @@ public class TagParser { +@@ -190,6 +193,7 @@ public class TagParser { if (!this.reader.canRead()) { throw ERROR_EXPECTED_VALUE.createWithContext(this.reader); } else { @@ -89,7 +89,7 @@ index 5bec54239a2b185284c10d58854e5a13e33daae5..ef970428fe9fe36c242ce6588bb6843e ListTag listTag = new ListTag(); TagType tagType = null; -@@ -213,6 +217,7 @@ public class TagParser { +@@ -215,6 +219,7 @@ public class TagParser { } this.expect(']'); @@ -97,22 +97,7 @@ index 5bec54239a2b185284c10d58854e5a13e33daae5..ef970428fe9fe36c242ce6588bb6843e return listTag; } } -@@ -251,11 +256,11 @@ public class TagParser { - } - - if (typeReader == ByteTag.TYPE) { -- list.add((T)((NumericTag)tag).getAsByte()); -+ list.add((T)((NumericTag)tag).getAsNumber()); // Paper - decompile fix - } else if (typeReader == LongTag.TYPE) { -- list.add((T)((NumericTag)tag).getAsLong()); -+ list.add((T)((NumericTag)tag).getAsNumber()); // Paper - decompile fix - } else { -- list.add((T)((NumericTag)tag).getAsInt()); -+ list.add((T)((NumericTag)tag).getAsNumber()); // Paper - decompile fix - } - - if (this.hasElementSeparator()) { -@@ -286,4 +291,11 @@ public class TagParser { +@@ -287,4 +292,11 @@ public class TagParser { this.reader.skipWhitespace(); this.reader.expect(c); } @@ -125,10 +110,10 @@ index 5bec54239a2b185284c10d58854e5a13e33daae5..ef970428fe9fe36c242ce6588bb6843e + } } diff --git a/src/main/java/net/minecraft/network/chat/contents/TranslatableContents.java b/src/main/java/net/minecraft/network/chat/contents/TranslatableContents.java -index d45e39bc009281c298f3dfae113dc87f2b3b1fbd..981d34dd4cfbc0932b147688751b98552c8beea8 100644 +index 65debad7aa7ffb1b0b19f89713ff394e8c9d245e..18e53db59082bae94922edc4baa812aa6f089576 100644 --- a/src/main/java/net/minecraft/network/chat/contents/TranslatableContents.java +++ b/src/main/java/net/minecraft/network/chat/contents/TranslatableContents.java -@@ -197,6 +197,15 @@ public class TranslatableContents implements ComponentContents { +@@ -181,6 +181,15 @@ public class TranslatableContents implements ComponentContents { @Override public Optional visit(FormattedText.ContentConsumer visitor) { @@ -143,8 +128,8 @@ index d45e39bc009281c298f3dfae113dc87f2b3b1fbd..981d34dd4cfbc0932b147688751b9855 + // Paper end - Count visited parts this.decompose(); - for(FormattedText formattedText : this.decomposedParts) { -@@ -208,6 +217,25 @@ public class TranslatableContents implements ComponentContents { + for (FormattedText formattedText : this.decomposedParts) { +@@ -192,6 +201,25 @@ public class TranslatableContents implements ComponentContents { return Optional.empty(); } diff --git a/patches/server/1050-Add-onboarding-message-for-initial-server-start.patch b/patches/server/1050-Add-onboarding-message-for-initial-server-start.patch index 953a8aa931..7769ecafe8 100644 --- a/patches/server/1050-Add-onboarding-message-for-initial-server-start.patch +++ b/patches/server/1050-Add-onboarding-message-for-initial-server-start.patch @@ -17,7 +17,7 @@ index c01b4393439838976965823298f12e4762e72eff..218bf89fd7583d6db9f64754c4db8fcc node = loader.load(); this.verifyGlobalConfigVersion(node); diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java -index b53b6cc4463675096b061b3b65f14a4695c742e2..f2e30d8743a97c0541808dc5c03300c0d881b843 100644 +index d00fc39b19c02895553f40bf5f62daa1dd50d59c..0cc2307636279915c1f8529e62174cc696e185ee 100644 --- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java +++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java @@ -25,6 +25,7 @@ public class GlobalConfiguration extends ConfigurationPart { diff --git a/patches/server/1051-Fix-DamageSource-API.patch b/patches/server/1051-Fix-DamageSource-API.patch index 5e216b66e0..7d2ad02099 100644 --- a/patches/server/1051-Fix-DamageSource-API.patch +++ b/patches/server/1051-Fix-DamageSource-API.patch @@ -44,7 +44,7 @@ index 1561b85a45f52a8162f43553f8485bfe084b8f1f..b26e4d58ea1898a5e4b31c3d6ab33f38 } diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 6de971aca46caad091271d125a079a1b7a5f163d..b2eff51f1ad1e702525ef298807ea7d2083f6218 100644 +index 8c2c877a26af90dae6d083e12a51384755c7a1de..6407496ccd993839e4fda1858e2daa6e735511a8 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -3462,7 +3462,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S