From 69ee95fa421d1db27694392d83ebbf399dd148bd Mon Sep 17 00:00:00 2001 From: Daniel Ennis Date: Mon, 24 Aug 2020 22:22:08 -0400 Subject: [PATCH] 1.16.2 Release (#4123) PaperMC believes that 1.16.2 is now ready for general release as we fixed the main issue plagueing the 1.16.x release, the MapLike data conversion issues. Until now, it was not safe for a server to convert a world to 1.16.2 without data conversion issues around villages and potentially other things. If you did, those MapLike errors meant something went wrong. This is now resolved. Big thanks to all those that helped, notably @BillyGalbreath and @Proximyst who did large parts of the update process with me. Please as always, backup your worlds and test before updating to 1.16.2! If you update to 1.16.2, there is no going back to an older build than this. --------------------------------- Co-authored-by: William Blake Galbreath Co-authored-by: Mariell Hoversholm Co-authored-by: krolik-exe <69214078+krolik-exe@users.noreply.github.com> Co-authored-by: BillyGalbreath Co-authored-by: stonar96 Co-authored-by: Shane Freeder Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Co-authored-by: Riley Park Co-authored-by: Aurora <21148213+aurorasmiles@users.noreply.github.com> Co-authored-by: Nassim Jahnke Co-authored-by: commandblockguy Co-authored-by: DigitalRegent Co-authored-by: ishland --- .../behavior-bug---plugin-incompatibility.md | 7 +- .github/ISSUE_TEMPLATE/feature_request.md | 2 + .github/ISSUE_TEMPLATE/performance-problem.md | 7 +- .../server-crash---stacktrace.md | 7 +- .travis.yml | 4 +- Paper-MojangAPI/pom.xml | 2 +- SHIT_TO_CHECK.md | 3 +- ...support.patch => 0220-Brand-support.patch} | 0 ...to-control-if-armour-stands-can-move.patch | 7 +- Spigot-API-Patches/Add-Material-Tags.patch | 2 +- Spigot-API-Patches/Add-Mob-Goal-API.patch | 1 + .../Add-item-slot-convenience-methods.patch | 74 ++++ ...d-method-to-open-already-placed-sign.patch | 5 +- Spigot-API-Patches/Add-moon-phase-API.patch | 65 ++++ Spigot-API-Patches/Add-more-Zombie-API.patch | 2 +- .../Add-setMaxPlayers-API.patch | 48 +++ .../Expand-ArmorStand-API.patch | 8 - .../Make-plugins-list-alphabetical.patch | 25 +- Spigot-API-Patches/POM-changes.patch | 2 +- ...dition-on-name-for-AttributeModifier.patch | 24 -- .../0563-Brand-support.patch | 19 + ...to-control-if-armour-stands-can-move.patch | 9 +- .../Add-EntityZapEvent.patch | 4 +- .../Add-LivingEntity-getTargetEntity.patch | 4 +- ...-MinecraftKey-Information-to-Objects.patch | 2 +- .../Add-More-Creeper-API.patch | 4 +- .../Add-PhantomPreSpawnEvent.patch | 2 +- .../Add-PlayerConnectionCloseEvent.patch | 4 +- .../Add-ProjectileCollideEvent.patch | 4 +- ...Add-Raw-Byte-ItemStack-Serialization.patch | 8 +- Spigot-Server-Patches/Add-TNTPrimeEvent.patch | 6 +- ...implement-PlayerRecipeBookClickEvent.patch | 4 +- ...dd-configurable-portal-search-radius.patch | 44 +-- .../Add-effect-to-block-break-naturally.patch | 2 +- .../Add-entity-liquid-API.patch | 14 +- .../Add-exception-reporting-event.patch | 30 +- .../Add-hand-to-bucket-events.patch | 6 +- ...d-method-to-open-already-placed-sign.patch | 8 +- .../Add-moon-phase-API.patch | 22 ++ .../Add-more-Witch-API.patch | 85 +++-- .../Add-more-Zombie-API.patch | 33 +- ...to-allow-iron-golems-to-spawn-in-air.patch | 6 +- ...n-to-nerf-pigmen-from-nether-portals.patch | 2 +- ...ntom-creative-and-insomniac-controls.patch | 2 +- .../Add-setMaxPlayers-API.patch | 37 ++ .../Add-sun-related-API.patch | 6 +- .../Add-tick-times-API-and-mspt-command.patch | 4 +- .../Add-villager-reputation-API.patch | 4 +- .../Allow-Saving-of-Oversized-Chunks.patch | 30 +- ...llow-delegation-to-vanilla-chunk-gen.patch | 2 +- ...Allow-disabling-armour-stand-ticking.patch | 25 +- ...d-mobs-to-jump-and-take-water-damage.patch | 10 +- Spigot-Server-Patches/Anti-Xray.patch | 60 +++- .../Asynchronous-chunk-IO-and-loading.patch | 14 +- ...blocking-on-Network-Manager-creation.patch | 13 +- .../Basic-PlayerProfile-API.patch | 37 +- .../Cache-user-authenticator-threads.patch | 8 +- ...eptions-from-dispenser-entity-spawns.patch | 2 +- ...owned-for-Villager-Aggression-Config.patch | 4 +- .../Chunk-debug-command.patch | 8 +- .../ChunkMapDistance-CME.patch | 9 + .../Configurable-Bed-Search-Radius.patch | 159 --------- ...figurable-Cartographer-Treasure-Maps.patch | 6 +- ...le-Keep-Spawn-Loaded-range-per-world.patch | 8 +- .../Configurable-RCON-IP-address.patch | 20 +- ...figurable-baby-zombie-movement-speed.patch | 2 +- ...-chance-of-villager-zombie-infection.patch | 14 +- .../Configurable-end-credits.patch | 18 +- .../Configurable-fishing-time-ranges.patch | 10 +- ...nfigurable-top-of-nether-void-damage.patch | 19 +- .../Custom-replacement-for-eaten-items.patch | 9 +- .../Disable-explosion-knockback.patch | 2 +- Spigot-Server-Patches/Disable-thunder.patch | 4 +- ...if-we-have-a-custom-Bukkit-generator.patch | 12 +- ...low-bees-to-load-chunks-for-beehives.patch | 2 +- .../Do-not-load-chunks-for-Pathfinding.patch | 4 +- ...ge-the-Entity-Random-seed-for-squids.patch | 2 +- ...ConvertSigns-boolean-every-sign-save.patch | 2 +- .../Don-t-let-fishinghooks-use-portals.patch | 16 +- ...e-profiles-that-have-no-UUID-and-no-.patch | 12 +- ...ull-chunk-sections-for-block-updates.patch | 18 + ...move-existing-players-to-world-spawn.patch | 8 +- .../Don-t-require-FACING-data.patch | 35 ++ .../Duplicate-UUID-Resolve-Option.patch | 9 +- .../EnderDragon-Events.patch | 2 +- .../Enderman.teleportRandomly.patch | 4 +- .../EndermanEscapeEvent.patch | 22 +- ...sure-Entity-AABB-s-are-never-invalid.patch | 95 +---- ...re-Entity-is-never-double-registered.patch | 2 +- ...der-respects-game-and-entity-rules-f.patch | 4 +- .../Ensure-safe-gateway-teleport.patch | 9 +- .../Entity-Activation-Range-2.0.patch | 71 ++-- Spigot-Server-Patches/Entity-Jump-API.patch | 4 +- .../Entity-fromMobSpawner.patch | 10 +- .../Entity-getEntitySpawnReason.patch | 12 +- .../EntityPathfindEvent.patch | 2 +- .../EntityTransformedEvent.patch | 66 ---- ...PI-for-Reason-Source-Triggering-play.patch | 16 +- ...e-attack-cooldown-methods-for-Player.patch | 6 +- Spigot-Server-Patches/Fix-MC-124320.patch | 50 --- .../Fix-MC-187716-Use-configured-height.patch | 45 +++ Spigot-Server-Patches/Fix-MC-197271.patch | 51 +++ ...her-Boss-Bar-doesn-t-update-until-in.patch | 22 ++ ...ld-Difficulty-Remembering-Difficulty.patch | 2 +- Spigot-Server-Patches/Fix-SPIGOT-5989.patch | 4 +- ...geEvent-not-firing-for-all-use-cases.patch | 46 +++ .../Fix-SpongeAbsortEvent-handling.patch | 11 +- .../Fix-World-isChunkGenerated-calls.patch | 8 +- .../Fix-enderdragon-exp-dupe.patch | 4 +- ...turn-for-WorldServer-addAllEntitiesS.patch | 23 ++ .../Fix-items-not-falling-correctly.patch | 6 +- ...x-items-vanishing-through-end-portal.patch | 10 +- ...m-duplication-issues-and-teleport-is.patch | 12 +- ...ston-physics-inconsistency-MC-188840.patch | 12 +- ...dDebugInfo-not-initialized-on-client.patch | 2 +- .../Fix-sign-edit-memory-leak.patch | 2 +- ...Fix-some-rails-connecting-improperly.patch | 10 +- ...-sneak-when-changing-worlds-MC-10657.patch | 10 +- .../Fix-this-stupid-bullshit.patch | 2 +- .../Further-improve-server-tick-loop.patch | 2 +- .../Generator-Settings.patch | 10 +- ...le-Oversized-Tile-Entities-in-chunks.patch | 8 +- Spigot-Server-Patches/Here-s-Johnny.patch | 4 +- .../Hook-into-CB-plugin-rewrites.patch | 2 +- ...k-Priority-Urgency-System-for-Chunks.patch | 32 +- ...plement-EntityKnockbackByEntityEvent.patch | 14 +- ...lement-EntityTeleportEndGatewayEvent.patch | 5 +- .../Implement-Expanded-ArmorStand-API.patch | 8 +- .../Implement-Mob-Goal-API.patch | 3 + .../Implement-Player-Client-Options-API.patch | 24 +- .../Implement-PlayerLocaleChangeEvent.patch | 13 +- ...lement-alternative-item-despawn-rate.patch | 2 +- .../Import-fastutil-classes.patch | 27 ++ ...argetLivingEntityEvent-for-1.16-mobs.patch | 2 +- ...-Legacy-Component-serialization-size.patch | 4 +- .../Improve-death-events.patch | 43 ++- .../Improved-Watchdog-Support.patch | 6 +- .../Increase-Light-Queue-Size.patch | 2 +- .../Lag-compensate-eating.patch | 35 +- ...ivingEntity-Hand-Raised-Item-Use-API.patch | 12 +- .../LivingEntity-setKiller.patch | 4 +- ...Load-Chunks-for-Login-Asynchronously.patch | 10 +- ...-API-Replenishable-Lootables-Feature.patch | 4 +- ...5656-Fix-Follow-Range-Initial-Target.patch | 6 +- .../MC-197883-Bandaid-decode-issue.patch | 28 ++ Spigot-Server-Patches/MC-Dev-fixes.patch | 332 +++++++++--------- Spigot-Server-Patches/MC-Utils.patch | 113 +++--- ...e-shield-blocking-delay-configurable.patch | 4 +- ...asks-Speed-up-processing-of-chunk-lo.patch | 2 +- .../Mob-Pathfinding-API.patch | 15 +- ...ove-range-check-for-block-placing-up.patch | 2 +- ...No-Tick-view-distance-implementation.patch | 14 +- ...awns-should-honor-nametags-and-leash.patch | 2 +- ...timise-IEntityAccess-getPlayerByUUID.patch | 4 +- ...imise-TickListServer-by-rewriting-it.patch | 8 +- ...imise-entity-hard-collision-checking.patch | 228 ------------ .../Optimise-random-block-ticking.patch | 20 +- .../Optimise-removeQueue.patch | 2 +- ...e-Biome-Mob-Lookups-for-Mob-Spawning.patch | 145 ++++---- .../Optimize-Bit-Operations-by-inlining.patch | 4 +- ...ptimize-BlockPosition-helper-methods.patch | 3 +- .../Optimize-Captured-TileEntity-Lookup.patch | 2 +- Spigot-Server-Patches/Optimize-Hoppers.patch | 2 +- .../Optimize-Light-Engine.patch | 20 +- ...-Manager-and-add-advanced-packet-sup.patch | 26 +- ...ze-NibbleArray-to-use-pooled-buffers.patch | 2 +- ...hunkMap-memory-use-for-visibleChunks.patch | 4 +- .../Optimize-RegistryID.c.patch | 2 +- .../Optimize-RegistryMaterials.patch | 64 ++-- .../Optimize-TileEntity-Ticking.patch | 31 +- .../Optimize-UserCache-Thread-Safe.patch | 88 +++-- ...mize-call-to-getFluid-for-explosions.patch | 2 +- ...-isOutsideRange-to-use-distance-maps.patch | 2 +- ...Location-getType-and-getBlockData-fo.patch | 23 +- ...t-armor-stands-from-doing-entity-loo.patch | 4 +- .../Optional-TNT-doesn-t-move-in-water.patch | 2 +- Spigot-Server-Patches/POM-Changes.patch | 6 +- .../Paper-config-files.patch | 4 +- .../Player-affects-spawning-API.patch | 18 +- .../Player.setPlayerProfile-API.patch | 39 +- ...layerDeathEvent-shouldDropExperience.patch | 2 +- .../PlayerPickupExperienceEvent.patch | 6 +- .../PreCreatureSpawnEvent.patch | 68 ++-- .../PreSpawnerSpawnEvent.patch | 20 +- ...Prevent-Enderman-from-loading-chunks.patch | 2 +- .../Prevent-Fire-from-loading-chunks.patch | 2 +- ...revent-Saving-Bad-entities-to-chunks.patch | 2 +- ...revent-consuming-the-wrong-itemstack.patch | 8 +- ...-headless-pistons-from-being-created.patch | 57 +++ ...wning-from-loading-generating-chunks.patch | 8 +- ...-desync-in-playerconnection-causing-.patch | 2 +- .../ProfileWhitelistVerifyEvent.patch | 2 +- ...and-End-Portal-Frames-from-being-des.patch | 9 +- ...nilla-entity-warnings-for-duplicates.patch | 5 +- ...e-memory-footprint-of-NBTTagCompound.patch | 16 +- Spigot-Server-Patches/Reduce-sync-loads.patch | 2 +- ...ove-armour-stand-double-add-to-world.patch | 28 ++ .../Remove-some-streams-from-structures.patch | 18 +- ...from-classes-related-villager-gossip.patch | 12 +- ...Remove-unused-World-Tile-Entity-List.patch | 4 +- .../Reset-players-airTicks-on-respawn.patch | 4 +- ...imer-when-spawner-event-is-cancelled.patch | 22 +- ...-teleport-command-to-valid-locations.patch | 2 +- ...dEffects-only-to-players-who-can-see.patch | 31 +- ...st-tick-at-start-of-drowning-process.patch | 6 +- ...ient-crashes-server-lists-and-Mojang.patch | 2 +- .../SkeletonHorse-Additions.patch | 22 +- .../Slime-Pathfinder-Events.patch | 30 +- ...-Vanilla-Command-permission-checking.patch | 5 +- Spigot-Server-Patches/Timings-v2.patch | 38 +- Spigot-Server-Patches/Turtle-API.patch | 58 +-- ...ed-flag-on-cancel-of-Explosion-Event.patch | 2 +- .../Use-a-Shared-Random-for-Entities.patch | 4 +- ...tance-map-to-optimise-entity-tracker.patch | 2 +- ...etChunkIfLoadedImmediately-in-places.patch | 6 +- .../Vanished-players-don-t-have-rights.patch | 14 +- .../Vex-getSummoner-API.patch | 4 +- .../Villager-Restocks-API.patch | 16 +- .../WitchReadyPotionEvent.patch | 2 +- ...ound-for-Client-Lag-Spikes-MC-162253.patch | 2 +- ...vehicle-tracking-issue-on-disconnect.patch | 2 +- ...entity-dismount-during-teleportation.patch | 12 +- ...ement-optional-per-player-mob-spawns.patch | 26 +- .../incremental-chunk-saving.patch | 14 +- ...assanger-entities-once-from-spawners.patch | 19 - ...-possibility-for-getServer-singleton.patch | 4 +- paper | 12 + scripts/checkoutpr.sh | 30 +- scripts/importmcdev.sh | 1 + scripts/requireDeps.sh | 28 ++ work/BuildData | 2 +- work/Bukkit | 2 +- work/CraftBukkit | 2 +- work/Spigot | 2 +- 234 files changed, 2154 insertions(+), 2036 deletions(-) rename Spigot-API-Patches/{0219-Brand-support.patch => 0220-Brand-support.patch} (100%) create mode 100644 Spigot-API-Patches/Add-moon-phase-API.patch create mode 100644 Spigot-API-Patches/Add-setMaxPlayers-API.patch delete mode 100644 Spigot-API-Patches/Remove-Precondition-on-name-for-AttributeModifier.patch create mode 100644 Spigot-Server-Patches/0563-Brand-support.patch create mode 100644 Spigot-Server-Patches/Add-moon-phase-API.patch create mode 100644 Spigot-Server-Patches/Add-setMaxPlayers-API.patch delete mode 100644 Spigot-Server-Patches/Configurable-Bed-Search-Radius.patch create mode 100644 Spigot-Server-Patches/Don-t-mark-null-chunk-sections-for-block-updates.patch create mode 100644 Spigot-Server-Patches/Don-t-require-FACING-data.patch delete mode 100644 Spigot-Server-Patches/EntityTransformedEvent.patch delete mode 100644 Spigot-Server-Patches/Fix-MC-124320.patch create mode 100644 Spigot-Server-Patches/Fix-MC-187716-Use-configured-height.patch create mode 100644 Spigot-Server-Patches/Fix-MC-197271.patch create mode 100644 Spigot-Server-Patches/Fix-MC-99259-Wither-Boss-Bar-doesn-t-update-until-in.patch create mode 100644 Spigot-Server-Patches/Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch create mode 100644 Spigot-Server-Patches/Fix-incorrect-return-for-WorldServer-addAllEntitiesS.patch create mode 100644 Spigot-Server-Patches/Import-fastutil-classes.patch create mode 100644 Spigot-Server-Patches/MC-197883-Bandaid-decode-issue.patch delete mode 100644 Spigot-Server-Patches/Optimise-entity-hard-collision-checking.patch create mode 100644 Spigot-Server-Patches/Prevent-headless-pistons-from-being-created.patch create mode 100644 Spigot-Server-Patches/Remove-armour-stand-double-add-to-world.patch delete mode 100644 Spigot-Server-Patches/only-add-passanger-entities-once-from-spawners.patch create mode 100755 scripts/requireDeps.sh diff --git a/.github/ISSUE_TEMPLATE/behavior-bug---plugin-incompatibility.md b/.github/ISSUE_TEMPLATE/behavior-bug---plugin-incompatibility.md index 72ab6a7961..8e504d24c1 100644 --- a/.github/ISSUE_TEMPLATE/behavior-bug---plugin-incompatibility.md +++ b/.github/ISSUE_TEMPLATE/behavior-bug---plugin-incompatibility.md @@ -4,6 +4,9 @@ about: Server Bug or Plugin Incompatibility --- + + + ### What behaviour is expected: ___What you expected to see___ @@ -16,8 +19,8 @@ ___This may include a build schematic, a video, or detailed instructions to help ### Plugin list: ___A list of your plugins___ -### Paper build number: -___This can be found by running `/version` on your server. `latest` is not a proper version number; we require the output of `/version` so we can properly track down the issue.___ +### Paper version: +___Paste the output of running `/version` on your server WITH the Minecraft version. `latest` is not a version; we require the output of `/version` so we can properly track down the issue.___ ### Anything else: ___Anything else you think may help us resolve the problem___ diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 066b2d920a..4d73ef7953 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -4,6 +4,8 @@ about: Suggest an idea for this project --- + + **Is your feature request related to a problem? Please describe.** A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] diff --git a/.github/ISSUE_TEMPLATE/performance-problem.md b/.github/ISSUE_TEMPLATE/performance-problem.md index 8b50dae939..15f324b995 100644 --- a/.github/ISSUE_TEMPLATE/performance-problem.md +++ b/.github/ISSUE_TEMPLATE/performance-problem.md @@ -4,6 +4,9 @@ about: Report performance problems or areas of concern --- + + + ### Timings or Profile link: ___We ask that all timings/profiles are a link, not a screenshot. Screenshots inhibit our ability to figure out the real cause of the issue.___ @@ -20,5 +23,5 @@ ___Gist/pastebin/hastebin links___ ___The more information we receive, the quicker and more effective we can be at finding the solution to the issue.___ -### Paper build number: -___This can be found by running `/version` on your server. `latest` is not a proper version number; we require the output of `/version` so we can properly track down the issue.___ +### Paper version: +___Paste the output of running `/version` on your server WITH the Minecraft version. `latest` is not a version; we require the output of `/version` so we can properly track down the issue.___ diff --git a/.github/ISSUE_TEMPLATE/server-crash---stacktrace.md b/.github/ISSUE_TEMPLATE/server-crash---stacktrace.md index 52a2e23a5b..ce43c364a7 100644 --- a/.github/ISSUE_TEMPLATE/server-crash---stacktrace.md +++ b/.github/ISSUE_TEMPLATE/server-crash---stacktrace.md @@ -4,6 +4,9 @@ about: Report server crashes and/or scary stacktraces --- + + + ### Link/paste of stack trace You can also simply just use code formatting in markdown! @@ -18,5 +21,5 @@ ___A list of your plugins___ ### Actions to reproduce (if known): ___This may include a build schematic, a video, or detailed instructions to help reconstruct the issue___ -### Paper build number: -___This can be found by running `/version` on your server. `latest` is not a proper version number; we require the output of `/version` so we can properly track down the issue.___ +### Paper version: +___Paste the output of running `/version` on your server WITH the Minecraft version. `latest` is not a version; we require the output of `/version` so we can properly track down the issue.___ diff --git a/.travis.yml b/.travis.yml index d6fd711072..66e0062c66 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: java -sudo: required -dist: trusty +dist: focal +os: linux jdk: - oraclejdk8 - openjdk11 diff --git a/Paper-MojangAPI/pom.xml b/Paper-MojangAPI/pom.xml index 4c7c62c787..03a17db372 100644 --- a/Paper-MojangAPI/pom.xml +++ b/Paper-MojangAPI/pom.xml @@ -10,7 +10,7 @@ com.destroystokyo.paper paper-mojangapi - 1.16.1-R0.1-SNAPSHOT + 1.16.2-R0.1-SNAPSHOT jar Paper-MojangAPI diff --git a/SHIT_TO_CHECK.md b/SHIT_TO_CHECK.md index d6eeb9a774..4d45751d17 100644 --- a/SHIT_TO_CHECK.md +++ b/SHIT_TO_CHECK.md @@ -5,4 +5,5 @@ * Make sure the flat bedrock setting doesn't do anything stupid * Check DataBits foreach * lighting is bork (load chunk, fly away, come back, everything or parts are black) -* chunk generation seems slow with a lot of it happening \ No newline at end of file +* chunk generation seems slow with a lot of it happening +* Fix IDE Debug JVM Flag for new versions of minecraft diff --git a/Spigot-API-Patches/0219-Brand-support.patch b/Spigot-API-Patches/0220-Brand-support.patch similarity index 100% rename from Spigot-API-Patches/0219-Brand-support.patch rename to Spigot-API-Patches/0220-Brand-support.patch diff --git a/Spigot-API-Patches/Add-API-methods-to-control-if-armour-stands-can-move.patch b/Spigot-API-Patches/Add-API-methods-to-control-if-armour-stands-can-move.patch index ff37525d21..87734f2f91 100644 --- a/Spigot-API-Patches/Add-API-methods-to-control-if-armour-stands-can-move.patch +++ b/Spigot-API-Patches/Add-API-methods-to-control-if-armour-stands-can-move.patch @@ -9,10 +9,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/entity/ArmorStand.java +++ b/src/main/java/org/bukkit/entity/ArmorStand.java @@ -0,0 +0,0 @@ public interface ArmorStand extends LivingEntity { - * @param marker whether this is a marker - */ - void setMarker(boolean marker); -+ + */ + ADDING; + } + // Paper start + /** + * Tests if this armor stand can move. diff --git a/Spigot-API-Patches/Add-Material-Tags.patch b/Spigot-API-Patches/Add-Material-Tags.patch index 35bff2b47d..82c406174a 100644 --- a/Spigot-API-Patches/Add-Material-Tags.patch +++ b/Spigot-API-Patches/Add-Material-Tags.patch @@ -518,7 +518,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + */ + public static final MaterialSetTag SPAWN_EGGS = new MaterialSetTag(keyFor("spawn_eggs")) + .endsWith("_SPAWN_EGG") -+ .ensureSize("SPAWN_EGGS", 63); ++ .ensureSize("SPAWN_EGGS", 64); + + /** + * Covers all colors of stained glass. diff --git a/Spigot-API-Patches/Add-Mob-Goal-API.patch b/Spigot-API-Patches/Add-Mob-Goal-API.patch index 76fc3d5e28..d7212f3286 100644 --- a/Spigot-API-Patches/Add-Mob-Goal-API.patch +++ b/Spigot-API-Patches/Add-Mob-Goal-API.patch @@ -356,6 +356,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + GoalKey SLIME_RANDOM_JUMP = GoalKey.of(Slime.class, NamespacedKey.minecraft("slime_random_jump")); + GoalKey SPIDER_MELEE_ATTACK = GoalKey.of(Spider.class, NamespacedKey.minecraft("spider_melee_attack")); + GoalKey SPIDER_NEAREST_ATTACKABLE_TARGET = GoalKey.of(Spider.class, NamespacedKey.minecraft("spider_nearest_attackable_target")); ++ GoalKey STRIDER_GO_TO_LAVA = GoalKey.of(Strider.class, NamespacedKey.minecraft("strider_go_to_lava")); + GoalKey SQUID = GoalKey.of(Squid.class, NamespacedKey.minecraft("squid")); + GoalKey SQUID_FLEE = GoalKey.of(Squid.class, NamespacedKey.minecraft("squid_flee")); + GoalKey TURTLE_BREED = GoalKey.of(Turtle.class, NamespacedKey.minecraft("turtle_breed")); diff --git a/Spigot-API-Patches/Add-item-slot-convenience-methods.patch b/Spigot-API-Patches/Add-item-slot-convenience-methods.patch index ef9b23cf95..cd7c308bee 100644 --- a/Spigot-API-Patches/Add-item-slot-convenience-methods.patch +++ b/Spigot-API-Patches/Add-item-slot-convenience-methods.patch @@ -177,6 +177,80 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Paper end } +diff --git a/src/main/java/org/bukkit/inventory/SmithingInventory.java b/src/main/java/org/bukkit/inventory/SmithingInventory.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/inventory/SmithingInventory.java ++++ b/src/main/java/org/bukkit/inventory/SmithingInventory.java +@@ -0,0 +0,0 @@ + package org.bukkit.inventory; + ++import org.jetbrains.annotations.Nullable; // Paper ++ + /** + * Interface to the inventory of a Smithing table. + */ +-public interface SmithingInventory extends Inventory { } ++public interface SmithingInventory extends Inventory { ++ ++ // Paper start ++ /** ++ * Gets the input equipment (first slot). ++ * ++ * @return input equipment item ++ */ ++ @Nullable ++ default ItemStack getInputEquipment() { ++ return getItem(0); ++ } ++ ++ /** ++ * Sets the input equipment (first slot). ++ * ++ * @param itemStack item to set ++ */ ++ default void setInputEquipment(@Nullable ItemStack itemStack) { ++ setItem(0, itemStack); ++ } ++ ++ /** ++ * Gets the input mineral (second slot). ++ * ++ * @return input mineral item ++ */ ++ @Nullable ++ default ItemStack getInputMineral() { ++ return getItem(1); ++ } ++ ++ /** ++ * Sets the input mineral (second slot). ++ * ++ * @param itemStack item to set ++ */ ++ default void setInputMineral(@Nullable ItemStack itemStack) { ++ setItem(1, itemStack); ++ } ++ ++ /** ++ * Gets the result item. ++ * ++ * @return result ++ */ ++ @Nullable ++ default ItemStack getResult() { ++ return getItem(2); ++ } ++ ++ /** ++ * Sets the result item. ++ * ++ * @param itemStack item to set ++ */ ++ default void setResult(@Nullable ItemStack itemStack) { ++ setItem(2, itemStack); ++ } ++ // Paper end ++} diff --git a/src/main/java/org/bukkit/inventory/StonecutterInventory.java b/src/main/java/org/bukkit/inventory/StonecutterInventory.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/inventory/StonecutterInventory.java diff --git a/Spigot-API-Patches/Add-method-to-open-already-placed-sign.patch b/Spigot-API-Patches/Add-method-to-open-already-placed-sign.patch index 60beec2e6e..40f0ce2b34 100644 --- a/Spigot-API-Patches/Add-method-to-open-already-placed-sign.patch +++ b/Spigot-API-Patches/Add-method-to-open-already-placed-sign.patch @@ -12,7 +12,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 */ @Deprecated public void setShoulderEntityRight(@Nullable Entity entity); -+ + // Paper start - Add method to open already placed sign + /** + * Opens an editor window for the specified sign @@ -21,4 +20,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + */ + void openSign(@NotNull org.bukkit.block.Sign sign); + // Paper end - } + + /** + * Make the entity drop the item in their hand. diff --git a/Spigot-API-Patches/Add-moon-phase-API.patch b/Spigot-API-Patches/Add-moon-phase-API.patch new file mode 100644 index 0000000000..b49930cf04 --- /dev/null +++ b/Spigot-API-Patches/Add-moon-phase-API.patch @@ -0,0 +1,65 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BillyGalbreath +Date: Sun, 23 Aug 2020 16:32:03 +0200 +Subject: [PATCH] Add moon phase API + + +diff --git a/src/main/java/io/papermc/paper/world/MoonPhase.java b/src/main/java/io/papermc/paper/world/MoonPhase.java +new file mode 100644 +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/world/MoonPhase.java +@@ -0,0 +0,0 @@ ++package io.papermc.paper.world; ++ ++import org.jetbrains.annotations.NotNull; ++ ++import java.util.HashMap; ++import java.util.Map; ++ ++public enum MoonPhase { ++ FULL_MOON(0L), ++ WANING_GIBBOUS(1L), ++ LAST_QUARTER(2L), ++ WANING_CRESCENT(3L), ++ NEW_MOON(4L), ++ WAXING_CRESCENT(5L), ++ FIRST_QUARTER(6L), ++ WAXING_GIBBOUS(7L); ++ ++ private final long day; ++ ++ MoonPhase(long day) { ++ this.day = day; ++ } ++ ++ private static final Map BY_DAY = new HashMap<>(); ++ ++ static { ++ for (MoonPhase phase : values()) { ++ BY_DAY.put(phase.day, phase); ++ } ++ } ++ ++ @NotNull ++ public static MoonPhase getPhase(long day) { ++ return BY_DAY.get(day % 8L); ++ } ++} +diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/World.java ++++ b/src/main/java/org/bukkit/World.java +@@ -0,0 +0,0 @@ public interface World extends PluginMessageRecipient, Metadatable { + * @return The amount of Players in this world + */ + int getPlayerCount(); ++ ++ /** ++ * @return the current moon phase at the current time in the world ++ */ ++ @NotNull ++ io.papermc.paper.world.MoonPhase getMoonPhase(); + // Paper end + + /** diff --git a/Spigot-API-Patches/Add-more-Zombie-API.patch b/Spigot-API-Patches/Add-more-Zombie-API.patch index e1760159a6..805f9554fc 100644 --- a/Spigot-API-Patches/Add-more-Zombie-API.patch +++ b/Spigot-API-Patches/Add-more-Zombie-API.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/org/bukkit/entity/Zombie.java b/src/main/java/org/buk index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/Zombie.java +++ b/src/main/java/org/bukkit/entity/Zombie.java -@@ -0,0 +0,0 @@ public interface Zombie extends Monster { +@@ -0,0 +0,0 @@ public interface Zombie extends Monster, Ageable { * @param time new conversion time */ void setConversionTime(int time); diff --git a/Spigot-API-Patches/Add-setMaxPlayers-API.patch b/Spigot-API-Patches/Add-setMaxPlayers-API.patch new file mode 100644 index 0000000000..5544f22500 --- /dev/null +++ b/Spigot-API-Patches/Add-setMaxPlayers-API.patch @@ -0,0 +1,48 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Mariell Hoversholm +Date: Sat, 22 Aug 2020 23:59:25 +0200 +Subject: [PATCH] Add #setMaxPlayers API + + +diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/Bukkit.java ++++ b/src/main/java/org/bukkit/Bukkit.java +@@ -0,0 +0,0 @@ public final class Bukkit { + return server.getMaxPlayers(); + } + ++ // Paper start ++ /** ++ * Set the maximum amount of players which can login to this server. ++ * ++ * @param maxPlayers the amount of players this server allows ++ */ ++ public static void setMaxPlayers(int maxPlayers) { ++ server.setMaxPlayers(maxPlayers); ++ } ++ // Paper end ++ + /** + * Get the game port that the server runs on. + * +diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/Server.java ++++ b/src/main/java/org/bukkit/Server.java +@@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient { + */ + public int getMaxPlayers(); + ++ // Paper start ++ /** ++ * Set the maximum amount of players which can login to this server. ++ * ++ * @param maxPlayers the amount of players this server allows ++ */ ++ public void setMaxPlayers(int maxPlayers); ++ // Paper end ++ + /** + * Get the game port that the server runs on. + * diff --git a/Spigot-API-Patches/Expand-ArmorStand-API.patch b/Spigot-API-Patches/Expand-ArmorStand-API.patch index 08915ac801..2b7cb53f3b 100644 --- a/Spigot-API-Patches/Expand-ArmorStand-API.patch +++ b/Spigot-API-Patches/Expand-ArmorStand-API.patch @@ -11,14 +11,6 @@ diff --git a/src/main/java/org/bukkit/entity/ArmorStand.java b/src/main/java/org index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/ArmorStand.java +++ b/src/main/java/org/bukkit/entity/ArmorStand.java -@@ -0,0 +0,0 @@ - package org.bukkit.entity; - - import org.bukkit.inventory.EntityEquipment; -+import org.bukkit.inventory.EquipmentSlot; - import org.bukkit.inventory.ItemStack; - import org.bukkit.util.EulerAngle; - import org.jetbrains.annotations.NotNull; @@ -0,0 +0,0 @@ public interface ArmorStand extends LivingEntity { * Returns the item the armor stand is currently holding. * diff --git a/Spigot-API-Patches/Make-plugins-list-alphabetical.patch b/Spigot-API-Patches/Make-plugins-list-alphabetical.patch index 401da7cf91..9c773aa032 100644 --- a/Spigot-API-Patches/Make-plugins-list-alphabetical.patch +++ b/Spigot-API-Patches/Make-plugins-list-alphabetical.patch @@ -56,26 +56,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return "(" + plugins.size() + "): " + pluginList.toString(); + // Paper end } - - // Spigot start - @NotNull - private BaseComponent[] getPluginListSpigot() { -- Plugin[] plugins = Bukkit.getPluginManager().getPlugins(); -- ComponentBuilder pluginList = new ComponentBuilder("Plugins (" + plugins.length + "): "); -+ // Paper start -+ TreeMap plugins = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); -+ for (Plugin plugin : Bukkit.getPluginManager().getPlugins()) { -+ plugins.put(plugin.getDescription().getName(), plugin); -+ } -+ ComponentBuilder pluginList = new ComponentBuilder("Plugins (" + plugins.size() + "): "); -+ // Paper end - - int index = 0; -- for (Plugin plugin : plugins) { -+ // Paper start -+ for (Map.Entry entry : plugins.entrySet()) { -+ Plugin plugin = entry.getValue(); -+ // Paper end - if (index++ > 0) { - pluginList.append(", ", FormatRetention.NONE).color(net.md_5.bungee.api.ChatColor.WHITE); - } ++ + } diff --git a/Spigot-API-Patches/POM-changes.patch b/Spigot-API-Patches/POM-changes.patch index ca290017ed..49f97fad5f 100644 --- a/Spigot-API-Patches/POM-changes.patch +++ b/Spigot-API-Patches/POM-changes.patch @@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - spigot-api + com.destroystokyo.paper + paper-api - 1.16.1-R0.1-SNAPSHOT + 1.16.2-R0.1-SNAPSHOT jar - Spigot-API diff --git a/Spigot-API-Patches/Remove-Precondition-on-name-for-AttributeModifier.patch b/Spigot-API-Patches/Remove-Precondition-on-name-for-AttributeModifier.patch deleted file mode 100644 index 3d9614c5c5..0000000000 --- a/Spigot-API-Patches/Remove-Precondition-on-name-for-AttributeModifier.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sat, 22 Sep 2018 18:41:01 -0400 -Subject: [PATCH] Remove Precondition on name for AttributeModifier - -Vanilla allows empty names - -diff --git a/src/main/java/org/bukkit/attribute/AttributeModifier.java b/src/main/java/org/bukkit/attribute/AttributeModifier.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/attribute/AttributeModifier.java -+++ b/src/main/java/org/bukkit/attribute/AttributeModifier.java -@@ -0,0 +0,0 @@ public class AttributeModifier implements ConfigurationSerializable { - - public AttributeModifier(@NotNull UUID uuid, @NotNull String name, double amount, @NotNull Operation operation, @Nullable EquipmentSlot slot) { - Validate.notNull(uuid, "UUID cannot be null"); -- Validate.notEmpty(name, "Name cannot be empty"); -+ //Validate.notEmpty(name, "Name cannot be empty"); // Paper - Validate.notNull(operation, "Operation cannot be null"); - this.uuid = uuid; -- this.name = name; -+ this.name = name != null ? name : ""; // Paper - this.amount = amount; - this.operation = operation; - this.slot = slot; diff --git a/Spigot-Server-Patches/0563-Brand-support.patch b/Spigot-Server-Patches/0563-Brand-support.patch new file mode 100644 index 0000000000..c1789d2900 --- /dev/null +++ b/Spigot-Server-Patches/0563-Brand-support.patch @@ -0,0 +1,19 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: DigitalRegent +Date: Sat, 11 Apr 2020 13:10:58 +0200 +Subject: [PATCH] Brand support + + +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + // Paper start - brand support + @Override + public String getClientBrandName() { +- return getHandle().playerConnection.getClientBrandName(); ++ return getHandle().playerConnection != null ? getHandle().playerConnection.getClientBrandName() : null; + } + // Paper end + diff --git a/Spigot-Server-Patches/Add-API-methods-to-control-if-armour-stands-can-move.patch b/Spigot-Server-Patches/Add-API-methods-to-control-if-armour-stands-can-move.patch index 32820d3025..e500ed615f 100644 --- a/Spigot-Server-Patches/Add-API-methods-to-control-if-armour-stands-can-move.patch +++ b/Spigot-Server-Patches/Add-API-methods-to-control-if-armour-stands-can-move.patch @@ -17,8 +17,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public EntityArmorStand(EntityTypes entitytypes, World world) { super(entitytypes, world); @@ -0,0 +0,0 @@ public class EntityArmorStand extends EntityLiving { - - return this.getEntityType().l().a(f); + private EntitySize s(boolean flag) { + return flag ? EntityArmorStand.bp : (this.isBaby() ? EntityArmorStand.bq : this.getEntityType().l()); } + + // Paper start @@ -35,10 +35,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java @@ -0,0 +0,0 @@ public class CraftArmorStand extends CraftLivingEntity implements ArmorStand { - public void setMarker(boolean marker) { - getHandle().setMarker(marker); + public boolean hasEquipmentLock(EquipmentSlot equipmentSlot, LockType lockType) { + return (getHandle().bv & (1 << CraftEquipmentSlot.getNMS(equipmentSlot).c() + lockType.ordinal() * 8)) != 0; } -+ + // Paper start + @Override + public boolean canMove() { diff --git a/Spigot-Server-Patches/Add-EntityZapEvent.patch b/Spigot-Server-Patches/Add-EntityZapEvent.patch index ba5de3cfb8..df1fbe895a 100644 --- a/Spigot-Server-Patches/Add-EntityZapEvent.patch +++ b/Spigot-Server-Patches/Add-EntityZapEvent.patch @@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/EntityVillager.java @@ -0,0 +0,0 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation EntityVillager.LOGGER.info("Villager {} was struck by lightning {}.", this, entitylightning); - EntityWitch entitywitch = (EntityWitch) EntityTypes.WITCH.a(this.world); + EntityWitch entitywitch = (EntityWitch) EntityTypes.WITCH.a((World) worldserver); + // Paper start + if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityZapEvent(this, entitylightning, entitywitch).isCancelled()) { @@ -35,7 +35,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end + entitywitch.setPositionRotation(this.locX(), this.locY(), this.locZ(), this.yaw, this.pitch); - entitywitch.prepare(this.world, this.world.getDamageScaler(entitywitch.getChunkCoordinates()), EnumMobSpawn.CONVERSION, (GroupDataEntity) null, (NBTTagCompound) null); + entitywitch.prepare(worldserver, worldserver.getDamageScaler(entitywitch.getChunkCoordinates()), EnumMobSpawn.CONVERSION, (GroupDataEntity) null, (NBTTagCompound) null); entitywitch.setNoAI(this.isNoAI()); diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 diff --git a/Spigot-Server-Patches/Add-LivingEntity-getTargetEntity.patch b/Spigot-Server-Patches/Add-LivingEntity-getTargetEntity.patch index 5654137fe9..ef4d59a631 100644 --- a/Spigot-Server-Patches/Add-LivingEntity-getTargetEntity.patch +++ b/Spigot-Server-Patches/Add-LivingEntity-getTargetEntity.patch @@ -61,8 +61,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return this.getPassengers().size() < 1; } -+ public final float getCollisionBorderSize() { return bc(); } // Paper - OBFHELPER - public float bc() { ++ public final float getCollisionBorderSize() { return bf(); } // Paper - OBFHELPER + public float bf() { return 0.0F; } diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java diff --git a/Spigot-Server-Patches/Add-MinecraftKey-Information-to-Objects.patch b/Spigot-Server-Patches/Add-MinecraftKey-Information-to-Objects.patch index f2be10dba4..0841ad5f74 100644 --- a/Spigot-Server-Patches/Add-MinecraftKey-Information-to-Objects.patch +++ b/Spigot-Server-Patches/Add-MinecraftKey-Information-to-Objects.patch @@ -74,7 +74,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public boolean isPersistable() { return a(); } // Paper - OBFHELPER public boolean a() { - return this.bh; + return this.bi; } diff --git a/src/main/java/net/minecraft/server/KeyedObject.java b/src/main/java/net/minecraft/server/KeyedObject.java new file mode 100644 diff --git a/Spigot-Server-Patches/Add-More-Creeper-API.patch b/Spigot-Server-Patches/Add-More-Creeper-API.patch index b715d9b89e..b68db0927a 100644 --- a/Spigot-Server-Patches/Add-More-Creeper-API.patch +++ b/Spigot-Server-Patches/Add-More-Creeper-API.patch @@ -11,12 +11,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class EntityCreeper extends EntityMonster { private static final DataWatcherObject POWERED = DataWatcher.a(EntityCreeper.class, DataWatcherRegistry.i); private static final DataWatcherObject d = DataWatcher.a(EntityCreeper.class, DataWatcherRegistry.i); private static final DataWatcherObject isIgnitedDW = d; // Paper OBFHELPER - private int bv; + private int bo; - private int fuseTicks; + public int fuseTicks; // Paper - public public int maxFuseTicks = 30; public int explosionRadius = 3; - private int bz; + private int bs; @@ -0,0 +0,0 @@ public class EntityCreeper extends EntityMonster { } diff --git a/Spigot-Server-Patches/Add-PhantomPreSpawnEvent.patch b/Spigot-Server-Patches/Add-PhantomPreSpawnEvent.patch index c936637787..5613cecd38 100644 --- a/Spigot-Server-Patches/Add-PhantomPreSpawnEvent.patch +++ b/Spigot-Server-Patches/Add-PhantomPreSpawnEvent.patch @@ -69,7 +69,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + entityphantom.spawningEntity = entityhuman.uniqueID; // Paper entityphantom.setPositionRotation(blockposition1, 0.0F, 0.0F); groupdataentity = entityphantom.prepare(worldserver, difficultydamagescaler, EnumMobSpawn.NATURAL, groupdataentity, (NBTTagCompound) null); - worldserver.addEntity(entityphantom, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL); // CraftBukkit + worldserver.addAllEntities(entityphantom, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL); // CraftBukkit diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java diff --git a/Spigot-Server-Patches/Add-PlayerConnectionCloseEvent.patch b/Spigot-Server-Patches/Add-PlayerConnectionCloseEvent.patch index a06a43a143..4e23de4004 100644 --- a/Spigot-Server-Patches/Add-PlayerConnectionCloseEvent.patch +++ b/Spigot-Server-Patches/Add-PlayerConnectionCloseEvent.patch @@ -54,11 +54,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java @@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler> { - this.i().a(new ChatMessage("multiplayer.disconnect.generic")); + this.j().a(new ChatMessage("multiplayer.disconnect.generic")); } this.packetQueue.clear(); // Free up packet queue. + // Paper start - Add PlayerConnectionCloseEvent -+ final PacketListener packetListener = this.i(); ++ final PacketListener packetListener = this.j(); + if (packetListener instanceof PlayerConnection) { + /* Player was logged in */ + final PlayerConnection playerConnection = (PlayerConnection) packetListener; diff --git a/Spigot-Server-Patches/Add-ProjectileCollideEvent.patch b/Spigot-Server-Patches/Add-ProjectileCollideEvent.patch index 46d33f3603..133ef02941 100644 --- a/Spigot-Server-Patches/Add-ProjectileCollideEvent.patch +++ b/Spigot-Server-Patches/Add-ProjectileCollideEvent.patch @@ -32,7 +32,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/EntityFireball.java @@ -0,0 +0,0 @@ public abstract class EntityFireball extends IProjectile { - MovingObjectPosition movingobjectposition = ProjectileHelper.a(this, this::a, RayTrace.BlockCollisionOption.COLLIDER); + MovingObjectPosition movingobjectposition = ProjectileHelper.a((Entity) this, this::a); - if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) { + // Paper start - Call ProjectileCollideEvent @@ -69,7 +69,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } // Paper } - Vec3D vec3d = this.getMot(); + this.checkBlockCollisions(); diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java diff --git a/Spigot-Server-Patches/Add-Raw-Byte-ItemStack-Serialization.patch b/Spigot-Server-Patches/Add-Raw-Byte-ItemStack-Serialization.patch index e32dfeeadd..1dc6c01345 100644 --- a/Spigot-Server-Patches/Add-Raw-Byte-ItemStack-Serialization.patch +++ b/Spigot-Server-Patches/Add-Raw-Byte-ItemStack-Serialization.patch @@ -33,16 +33,16 @@ diff --git a/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java b/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java +++ b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java -@@ -0,0 +0,0 @@ import io.netty.buffer.ByteBufInputStream; // Paper - - public class NBTCompressedStreamTools { +@@ -0,0 +0,0 @@ public class NBTCompressedStreamTools { + return nbttagcompound; + } + public static NBTTagCompound readNBT(InputStream inputstream) throws IOException { return a(inputstream); } // Paper - OBFHELPER public static NBTTagCompound a(InputStream inputstream) throws IOException { DataInputStream datainputstream = new DataInputStream(new BufferedInputStream(new GZIPInputStream(inputstream))); Throwable throwable = null; @@ -0,0 +0,0 @@ public class NBTCompressedStreamTools { - return nbttagcompound; + } + public static void writeNBT(NBTTagCompound nbttagcompound, OutputStream outputstream) throws IOException { a(nbttagcompound, outputstream); } // Paper - OBFHELPER diff --git a/Spigot-Server-Patches/Add-TNTPrimeEvent.patch b/Spigot-Server-Patches/Add-TNTPrimeEvent.patch index 0340916701..e6afe9af80 100644 --- a/Spigot-Server-Patches/Add-TNTPrimeEvent.patch +++ b/Spigot-Server-Patches/Add-TNTPrimeEvent.patch @@ -9,13 +9,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/BlockFire.java +++ b/src/main/java/net/minecraft/server/BlockFire.java @@ -0,0 +0,0 @@ package net.minecraft.server; - + import com.google.common.collect.ImmutableMap; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; +import com.destroystokyo.paper.event.block.TNTPrimeEvent; // Paper - TNTPrimeEvent import java.util.Map; import java.util.Random; - + import java.util.function.Function; @@ -0,0 +0,0 @@ public class BlockFire extends BlockFireAbstract { world.setTypeAndData(blockposition, this.a(world, blockposition, l), 3); @@ -128,7 +128,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public class EntityEnderDragon extends EntityInsentient implements IMonster { @@ -0,0 +0,0 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster { }); - craftBlock.getNMS().dropNaturally(world, blockposition, ItemStack.b); + craftBlock.getNMS().dropNaturally((WorldServer) world, blockposition, ItemStack.b); } + // Paper start - TNTPrimeEvent + org.bukkit.block.Block tntBlock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); diff --git a/Spigot-Server-Patches/Add-and-implement-PlayerRecipeBookClickEvent.patch b/Spigot-Server-Patches/Add-and-implement-PlayerRecipeBookClickEvent.patch index fc799cb21b..773b9d10da 100644 --- a/Spigot-Server-Patches/Add-and-implement-PlayerRecipeBookClickEvent.patch +++ b/Spigot-Server-Patches/Add-and-implement-PlayerRecipeBookClickEvent.patch @@ -12,14 +12,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 PlayerConnectionUtils.ensureMainThread(packetplayinautorecipe, this, this.player.getWorldServer()); this.player.resetIdleTimer(); if (!this.player.isSpectator() && this.player.activeContainer.windowId == packetplayinautorecipe.b() && this.player.activeContainer.c(this.player) && this.player.activeContainer instanceof ContainerRecipeBook) { -- this.minecraftServer.getCraftingManager().a(packetplayinautorecipe.c()).ifPresent((irecipe) -> { +- this.minecraftServer.getCraftingManager().getRecipe(packetplayinautorecipe.c()).ifPresent((irecipe) -> { - ((ContainerRecipeBook) this.player.activeContainer).a(packetplayinautorecipe.d(), irecipe, this.player); - }); + // Paper start - fire event for clicking recipes in the recipe book + com.destroystokyo.paper.event.player.PlayerRecipeBookClickEvent event = new com.destroystokyo.paper.event.player.PlayerRecipeBookClickEvent( + player.getBukkitEntity(), org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(packetplayinautorecipe.c()), packetplayinautorecipe.d()); + if (event.callEvent()) { -+ this.minecraftServer.getCraftingManager().a(org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(event.getRecipe())).ifPresent((irecipe) -> { ++ this.minecraftServer.getCraftingManager().getRecipe(org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(event.getRecipe())).ifPresent((irecipe) -> { + ((ContainerRecipeBook) this.player.activeContainer).a(event.isMakeAll(), irecipe, this.player); + }); + } diff --git a/Spigot-Server-Patches/Add-configurable-portal-search-radius.patch b/Spigot-Server-Patches/Add-configurable-portal-search-radius.patch index 0763d4b3ec..b902ca656d 100644 --- a/Spigot-Server-Patches/Add-configurable-portal-search-radius.patch +++ b/Spigot-Server-Patches/Add-configurable-portal-search-radius.patch @@ -25,11 +25,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - - blockposition = new BlockPosition(d0, this.locY(), d1); + double d4 = DimensionManager.a(this.world.getDimensionManager(), worldserver.getDimensionManager()); + BlockPosition blockposition = new BlockPosition(MathHelper.a(this.locX() * d4, d0, d2), this.locY(), MathHelper.a(this.locZ() * d4, d1, d3)); // CraftBukkit start -- EntityPortalEvent event = CraftEventFactory.callEntityPortalEvent(this, worldserver, blockposition, 128); -+ EntityPortalEvent event = CraftEventFactory.callEntityPortalEvent(this, worldserver, blockposition, worldserver.paperConfig.portalSearchRadius); // Paper - use portal search radius +- CraftPortalEvent event = callPortalEvent(this, worldserver, blockposition, PlayerTeleportEvent.TeleportCause.NETHER_PORTAL, flag2 ? 16 : 128, 16); ++ CraftPortalEvent event = callPortalEvent(this, worldserver, blockposition, PlayerTeleportEvent.TeleportCause.NETHER_PORTAL, worldserver.paperConfig.portalSearchRadius, worldserver.paperConfig.portalCreateRadius); // Paper start - configurable portal radius if (event == null) { return null; } @@ -38,34 +38,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - // CraftBukkit start - Location enter = this.getBukkitEntity().getLocation(); - Location exit = (worldserver == null) ? null : new Location(worldserver.getWorld(), d0, d1, d2, f1, f); -- PlayerPortalEvent event = new PlayerPortalEvent(this.getBukkitEntity(), enter, exit, cause, 128, true, resourcekey == DimensionManager.THE_END ? 0 : 16); -+ com.destroystokyo.paper.PaperWorldConfig config = worldserver != null ? worldserver.paperConfig : worldserver1.paperConfig; // Paper - portal radius -+ PlayerPortalEvent event = new PlayerPortalEvent(this.getBukkitEntity(), enter, exit, cause, config.portalSearchRadius, true, resourcekey == DimensionManager.THE_END ? 0 : config.portalCreateRadius); // Paper - portal radius - Bukkit.getServer().getPluginManager().callEvent(event); - if (event.isCancelled() || event.getTo() == null) { - return null; + protected CraftPortalEvent callPortalEvent(Entity entity, WorldServer exitWorldServer, BlockPosition exitPosition, TeleportCause cause, int searchRadius, int creationRadius) { + Location enter = this.getBukkitEntity().getLocation(); + Location exit = new Location(exitWorldServer.getWorld(), exitPosition.getX(), exitPosition.getY(), exitPosition.getZ(), yaw, pitch); +- PlayerPortalEvent event = new PlayerPortalEvent(this.getBukkitEntity(), enter, exit, cause, 128, true, creationRadius); ++ PlayerPortalEvent event = new PlayerPortalEvent(this.getBukkitEntity(), enter, exit, cause, searchRadius, true, creationRadius); // Paper - use searchRadius + Bukkit.getServer().getPluginManager().callEvent(event); + if (event.isCancelled() || event.getTo() == null || event.getTo().getWorld() == null) { + return null; diff --git a/src/main/java/net/minecraft/server/PortalTravelAgent.java b/src/main/java/net/minecraft/server/PortalTravelAgent.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/PortalTravelAgent.java +++ b/src/main/java/net/minecraft/server/PortalTravelAgent.java @@ -0,0 +0,0 @@ public class PortalTravelAgent { - @Nullable - public ShapeDetector.Shape a(BlockPosition blockposition, Vec3D vec3d, EnumDirection enumdirection, double d0, double d1, boolean flag) { // PAIL: rename to findPortal, d0 = portal offset x, d1 = portal offset z, flag = instanceof EntityHuman + + public Optional findPortal(BlockPosition blockposition, boolean flag) { // CraftBukkit start -- return findPortal(blockposition, vec3d, enumdirection, d0, d1, flag, 128); -+ return findPortal(blockposition, vec3d, enumdirection, d0, d1, flag, world.paperConfig.portalSearchRadius); // Paper +- return findPortal(blockposition, flag ? 16 : 128); // Search Radius ++ return findPortal(blockposition, flag ? world.paperConfig.portalCreateRadius : world.paperConfig.portalSearchRadius); // Paper - search Radius } - @Nullable -@@ -0,0 +0,0 @@ public class PortalTravelAgent { - // CraftBukkit end - VillagePlace villageplace = this.world.x(); - -- villageplace.a(this.world, blockposition, 128); -+ villageplace.a(this.world, blockposition, searchRadius); // Paper - This impacts the # of chunks searched for entries - List list = (List) villageplace.b((villageplacetype) -> { - return villageplacetype == VillagePlaceType.v; - }, blockposition, searchRadius, VillagePlace.Occupancy.ANY).collect(Collectors.toList()); // CraftBukkit - searchRadius + public Optional findPortal(BlockPosition blockposition, int i) { diff --git a/Spigot-Server-Patches/Add-effect-to-block-break-naturally.patch b/Spigot-Server-Patches/Add-effect-to-block-break-naturally.patch index 7fbb466ce8..f7979377ce 100644 --- a/Spigot-Server-Patches/Add-effect-to-block-break-naturally.patch +++ b/Spigot-Server-Patches/Add-effect-to-block-break-naturally.patch @@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 net.minecraft.server.Block block = iblockdata.getBlock(); @@ -0,0 +0,0 @@ public class CraftBlock implements Block { // Modelled off EntityHuman#hasBlock - if (block != Blocks.AIR && (item == null || !iblockdata.isAlwaysDestroyable() || nmsItem.canDestroySpecialBlock(iblockdata))) { + if (block != Blocks.AIR && (item == null || !iblockdata.isRequiresSpecialTool() || nmsItem.canDestroySpecialBlock(iblockdata))) { net.minecraft.server.Block.dropItems(iblockdata, world.getMinecraftWorld(), position, world.getTileEntity(position), null, nmsItem); + if (triggerEffect) world.triggerEffect(org.bukkit.Effect.STEP_SOUND.getId(), position, net.minecraft.server.Block.getCombinedId(block.getBlockData())); // Paper result = true; diff --git a/Spigot-Server-Patches/Add-entity-liquid-API.patch b/Spigot-Server-Patches/Add-entity-liquid-API.patch index 2d81e3d85e..1381dd4ed1 100644 --- a/Spigot-Server-Patches/Add-entity-liquid-API.patch +++ b/Spigot-Server-Patches/Add-entity-liquid-API.patch @@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public boolean isInRain() { // Paper - private -> public BlockPosition blockposition = this.getChunkCoordinates(); - return this.world.isRainingAt(blockposition) || this.world.isRainingAt(blockposition.a(0.0D, (double) this.size.height, 0.0D)); + return this.world.isRainingAt(blockposition) || this.world.isRainingAt(new BlockPosition((double) blockposition.getX(), this.getBoundingBox().maxY, (double) blockposition.getZ())); } + public final boolean isInBubbleColumn() { return k(); } // Paper - OBFHELPER @@ -27,17 +27,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return this.isInWater() || this.isInRain() || this.k(); } -+ public final boolean isInWaterOrBubbleColumn() { return aD(); } // Paper - OBFHELPER - public boolean aD() { ++ public final boolean isInWaterOrBubbleColumn() { return aG(); } // Paper - OBFHELPER + public boolean aG() { return this.isInWater() || this.k(); } @@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - this.inLava = true; + return this.O == tag; } -+ public final boolean isInLava() { return aN(); } // Paper - OBFHELPER - public boolean aN() { - return this.inLava; ++ public final boolean isInLava() { return aP(); } // Paper - OBFHELPER + public boolean aP() { + return !this.justCreated && this.M.getDouble(TagsFluid.LAVA) > 0.0D; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 diff --git a/Spigot-Server-Patches/Add-exception-reporting-event.patch b/Spigot-Server-Patches/Add-exception-reporting-event.patch index f0f892dad9..c4b810cfaf 100644 --- a/Spigot-Server-Patches/Add-exception-reporting-event.patch +++ b/Spigot-Server-Patches/Add-exception-reporting-event.patch @@ -79,20 +79,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // CraftBukkit end } } -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -0,0 +0,0 @@ import java.util.function.Consumer; - import java.util.function.Function; - import java.util.function.Supplier; - import javax.annotation.Nullable; -+import com.destroystokyo.paper.exception.ServerInternalException; -+import org.apache.logging.log4j.LogManager; -+import org.apache.logging.log4j.Logger; - - public class ChunkProviderServer extends IChunkProvider { - diff --git a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java @@ -173,7 +159,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } @@ -0,0 +0,0 @@ public final class SpawnerCreature { - entity = biomebase_biomemeta.c.a(generatoraccess.getMinecraftWorld()); + entity = biomesettingsmobs_c.c.a((World) worldaccess.getMinecraftWorld()); } catch (Exception exception) { SpawnerCreature.LOGGER.warn("Failed to create mob", exception); + ServerInternalException.reportInternalException(exception); // Paper @@ -191,11 +177,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + import java.util.Iterator; import javax.annotation.Nullable; - + import org.apache.logging.log4j.LogManager; @@ -0,0 +0,0 @@ public class VillageSiege implements MobSpawner { entityzombie.prepare(worldserver, worldserver.getDamageScaler(entityzombie.getChunkCoordinates()), EnumMobSpawn.EVENT, (GroupDataEntity) null, (NBTTagCompound) null); } catch (Exception exception) { - exception.printStackTrace(); + VillageSiege.LOGGER.warn("Failed to create zombie for village siege at {}", vec3d, exception); + ServerInternalException.reportInternalException(exception); // Paper return; } @@ -245,13 +231,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/WorldPersistentData.java +++ b/src/main/java/net/minecraft/server/WorldPersistentData.java @@ -0,0 +0,0 @@ public class WorldPersistentData { - nbttagcompound = GameProfileSerializer.a(this.c, DataFixTypes.SAVED_DATA, nbttagcompound1, j, i); - } catch (Throwable throwable4) { - throwable = throwable4; + } + } catch (Throwable throwable6) { + throwable = throwable6; + com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(throwable); // Paper - throw throwable4; + throw throwable6; } finally { - if (pushbackinputstream != null) { + if (fileinputstream != null) { diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java diff --git a/Spigot-Server-Patches/Add-hand-to-bucket-events.patch b/Spigot-Server-Patches/Add-hand-to-bucket-events.patch index 728d248a3d..46a269939b 100644 --- a/Spigot-Server-Patches/Add-hand-to-bucket-events.patch +++ b/Spigot-Server-Patches/Add-hand-to-bucket-events.patch @@ -99,7 +99,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { - this.getMinecraftServer().getPlayerList().sendAll(new PacketPlayOutSpawnPosition(blockposition)); + this.getMinecraftServer().getPlayerList().sendAll(new PacketPlayOutSpawnPosition(blockposition, f)); } - public BlockPosition getSpawn() { @@ -123,8 +123,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + //} + // Paper end - public LongSet getForceLoadedChunks() { - ForcedChunk forcedchunk = (ForcedChunk) this.getWorldPersistentData().b(ForcedChunk::new, "chunks"); + public float v() { + return this.worldData.d(); diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java diff --git a/Spigot-Server-Patches/Add-method-to-open-already-placed-sign.patch b/Spigot-Server-Patches/Add-method-to-open-already-placed-sign.patch index 236008949c..70cb6abed7 100644 --- a/Spigot-Server-Patches/Add-method-to-open-already-placed-sign.patch +++ b/Spigot-Server-Patches/Add-method-to-open-already-placed-sign.patch @@ -9,10 +9,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java @@ -0,0 +0,0 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { - entity.remove(); } } -+ + + // Paper start - Add method to open already placed sign + @Override + public void openSign(org.bukkit.block.Sign sign) { @@ -21,8 +20,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + net.minecraft.server.TileEntitySign teSign = craftSign.getTileEntity(); + // Make sign editable temporarily, will be set back to false in PlayerConnection later + teSign.isEditable = true; -+ + getHandle().openSign(teSign); + } + // Paper end - } + @Override + public boolean dropItem(boolean dropAll) { + return getHandle().dropItem(dropAll); diff --git a/Spigot-Server-Patches/Add-moon-phase-API.patch b/Spigot-Server-Patches/Add-moon-phase-API.patch new file mode 100644 index 0000000000..3ff89190eb --- /dev/null +++ b/Spigot-Server-Patches/Add-moon-phase-API.patch @@ -0,0 +1,22 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BillyGalbreath +Date: Sun, 23 Aug 2020 16:32:11 +0200 +Subject: [PATCH] Add moon phase API + + +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +@@ -0,0 +0,0 @@ public class CraftWorld implements World { + public int getPlayerCount() { + return world.players.size(); + } ++ ++ @Override ++ public io.papermc.paper.world.MoonPhase getMoonPhase() { ++ return io.papermc.paper.world.MoonPhase.getPhase(getFullTime() / 24000L); ++ } + // Paper end + + private static final Random rand = new Random(); diff --git a/Spigot-Server-Patches/Add-more-Witch-API.patch b/Spigot-Server-Patches/Add-more-Witch-API.patch index 44ef5dc6a1..3adb90d808 100644 --- a/Spigot-Server-Patches/Add-more-Witch-API.patch +++ b/Spigot-Server-Patches/Add-more-Witch-API.patch @@ -20,17 +20,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import java.util.Iterator; import java.util.List; import java.util.UUID; -@@ -0,0 +0,0 @@ import java.util.function.Predicate; - public class EntityWitch extends EntityRaider implements IRangedEntity { - +@@ -0,0 +0,0 @@ public class EntityWitch extends EntityRaider implements IRangedEntity { private static final UUID b = UUID.fromString("5CD17E52-A79A-43D3-A529-90FDE04B181E"); -- private static final AttributeModifier bv = new AttributeModifier(EntityWitch.b, "Drinking speed penalty", -0.25D, AttributeModifier.Operation.ADDITION); -+ private static final AttributeModifier bv = new AttributeModifier(EntityWitch.b, "Drinking speed penalty", -0.25D, AttributeModifier.Operation.ADDITION); private static final AttributeModifier DRINKING_SPEED = bv; // Paper - OBFHELPER - private static final DataWatcherObject bw = DataWatcher.a(EntityWitch.class, DataWatcherRegistry.i); -- private int bx; -+ private int bx; public int getPotionUseTimeLeft() { return bx; } public void setPotionUseTimeLeft(int timeLeft) { bx = timeLeft; } // Paper - OBFHELPER - private PathfinderGoalNearestHealableRaider by; - private PathfinderGoalNearestAttackableTargetWitch bz; + private static final AttributeModifier bo = new AttributeModifier(EntityWitch.b, "Drinking speed penalty", -0.25D, AttributeModifier.Operation.ADDITION); + private static final DataWatcherObject bp = DataWatcher.a(EntityWitch.class, DataWatcherRegistry.i); +- private int bq; ++ private int bq; public int getPotionUseTimeLeft() { return bq; } public void setPotionUseTimeLeft(int timeLeft) { bq = timeLeft; } // Paper - OBFHELPER + private PathfinderGoalNearestHealableRaider br; + private PathfinderGoalNearestAttackableTargetWitch bs; @@ -0,0 +0,0 @@ public class EntityWitch extends EntityRaider implements IRangedEntity { return SoundEffects.ENTITY_WITCH_DEATH; @@ -38,48 +35,47 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public void setDrinkingPotion(boolean drinkingPotion) { v(drinkingPotion); } // Paper - OBFHELPER public void v(boolean flag) { - this.getDataWatcher().set(EntityWitch.bw, flag); + this.getDataWatcher().set(EntityWitch.bp, flag); } + public boolean isDrinkingPotion() { return m(); } // Paper - OBFHELPER public boolean m() { - return (Boolean) this.getDataWatcher().get(EntityWitch.bw); + return (Boolean) this.getDataWatcher().get(EntityWitch.bp); } @@ -0,0 +0,0 @@ public class EntityWitch extends EntityRaider implements IRangedEntity { } if (potionregistry != null) { - // Paper start -- ItemStack potion = PotionUtil.a(new ItemStack(Items.POTION), potionregistry); + ItemStack potion = PotionUtil.a(new ItemStack(Items.POTION), potionregistry); - org.bukkit.inventory.ItemStack bukkitStack = com.destroystokyo.paper.event.entity.WitchReadyPotionEvent.process((org.bukkit.entity.Witch) this.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(potion)); - this.setSlot(EnumItemSlot.MAINHAND, org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(bukkitStack)); -- // Paper end -- this.bx = this.getItemInMainHand().k(); ++ // Paper start - logic moved into setDrinkingPotion, copy exact impl into the method and then comment out ++ this.setDrinkingPotion(potion); ++// org.bukkit.inventory.ItemStack bukkitStack = com.destroystokyo.paper.event.entity.WitchReadyPotionEvent.process((org.bukkit.entity.Witch) this.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(potion)); ++// this.setSlot(EnumItemSlot.MAINHAND, org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(bukkitStack)); ++// // Paper end ++// this.bq = this.getItemInMainHand().k(); ++// this.v(true); ++// if (!this.isSilent()) { ++// this.world.playSound((EntityHuman) null, this.locX(), this.locY(), this.locZ(), SoundEffects.ENTITY_WITCH_DRINK, this.getSoundCategory(), 1.0F, 0.8F + this.random.nextFloat() * 0.4F); ++// } ++// ++// AttributeModifiable attributemodifiable = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED); ++// ++// attributemodifiable.removeModifier(EntityWitch.bo); ++// attributemodifiable.b(EntityWitch.bo); + // Paper end +- this.bq = this.getItemInMainHand().k(); - this.v(true); - if (!this.isSilent()) { - this.world.playSound((EntityHuman) null, this.locX(), this.locY(), this.locZ(), SoundEffects.ENTITY_WITCH_DRINK, this.getSoundCategory(), 1.0F, 0.8F + this.random.nextFloat() * 0.4F); - } -- + - AttributeModifiable attributemodifiable = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED); - -- attributemodifiable.removeModifier(EntityWitch.bv); -- attributemodifiable.b(EntityWitch.bv); -+ //// Paper start -+ //ItemStack potion = PotionUtil.a(new ItemStack(Items.POTION), potionregistry); -+ //org.bukkit.inventory.ItemStack bukkitStack = com.destroystokyo.paper.event.entity.WitchReadyPotionEvent.process((org.bukkit.entity.Witch) this.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(potion)); -+ //this.setSlot(EnumItemSlot.MAINHAND, org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(bukkitStack)); -+ //// Paper end -+ //this.bx = this.getItemInMainHand().k(); -+ //this.v(true); -+ //if (!this.isSilent()) { -+ // this.world.playSound((EntityHuman) null, this.locX(), this.locY(), this.locZ(), SoundEffects.ENTITY_WITCH_DRINK, this.getSoundCategory(), 1.0F, 0.8F + this.random.nextFloat() * 0.4F); -+ //} -+ // -+ //AttributeModifiable attributemodifiable = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED); -+ // -+ //attributemodifiable.removeModifier(EntityWitch.bv); -+ //attributemodifiable.b(EntityWitch.bv); -+ this.setDrinkingPotion(PotionUtil.addPotionToItemStack(new ItemStack(Items.POTION), potionregistry)); +- attributemodifiable.removeModifier(EntityWitch.bo); +- attributemodifiable.b(EntityWitch.bo); } } @@ -89,20 +85,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start - moved to its own method + public void setDrinkingPotion(ItemStack potion) { -+ setSlot(EnumItemSlot.MAINHAND, CraftItemStack.asNMSCopy(WitchReadyPotionEvent.process((Witch) getBukkitEntity(), CraftItemStack.asCraftMirror(potion)))); -+ setPotionUseTimeLeft(getItemInMainHand().getItemUseMaxDuration()); -+ setDrinkingPotion(true); ++ org.bukkit.inventory.ItemStack bukkitStack = com.destroystokyo.paper.event.entity.WitchReadyPotionEvent.process((org.bukkit.entity.Witch) this.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(potion)); ++ this.setSlot(EnumItemSlot.MAINHAND, org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(bukkitStack)); ++ // Paper end ++ this.bq = this.getItemInMainHand().k(); ++ this.v(true); + if (!this.isSilent()) { + this.world.playSound((EntityHuman) null, this.locX(), this.locY(), this.locZ(), SoundEffects.ENTITY_WITCH_DRINK, this.getSoundCategory(), 1.0F, 0.8F + this.random.nextFloat() * 0.4F); + } ++ + AttributeModifiable attributemodifiable = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED); -+ attributemodifiable.removeModifier(EntityWitch.bv); -+ attributemodifiable.b(EntityWitch.bv); ++ ++ attributemodifiable.removeModifier(EntityWitch.bo); ++ attributemodifiable.b(EntityWitch.bo); + } + // Paper end + @Override - public SoundEffect eM() { + public SoundEffect eL() { return SoundEffects.ENTITY_WITCH_CELEBRATE; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 @@ -124,11 +124,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import org.bukkit.inventory.ItemStack; +// Paper end --public class CraftWitch extends CraftRaider implements Witch, CraftRangedEntity { // Paper -+public class CraftWitch extends CraftRaider implements Witch, CraftRangedEntity { + public class CraftWitch extends CraftRaider implements Witch, CraftRangedEntity { // Paper public CraftWitch(CraftServer server, EntityWitch entity) { - super(server, entity); - } @@ -0,0 +0,0 @@ public class CraftWitch extends CraftRaider implements Witch, CraftRangedEntity< public EntityType getType() { return EntityType.WITCH; diff --git a/Spigot-Server-Patches/Add-more-Zombie-API.patch b/Spigot-Server-Patches/Add-more-Zombie-API.patch index c9676b3ae5..24d5e42f6c 100644 --- a/Spigot-Server-Patches/Add-more-Zombie-API.patch +++ b/Spigot-Server-Patches/Add-more-Zombie-API.patch @@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/EntityZombie.java +++ b/src/main/java/net/minecraft/server/EntityZombie.java @@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster { - private int bA; + private int bt; public int drownedConversionTime; private int lastTick = MinecraftServer.currentTick; // CraftBukkit - add field + private boolean shouldBurnInDay = true; // Paper @@ -17,7 +17,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public EntityZombie(EntityTypes entitytypes, World world) { super(entitytypes, world); @@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster { - this.getDataWatcher().set(EntityZombie.DROWN_CONVERTING, true); + super.movementTick(); } + // Paper start @@ -26,18 +26,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.getDataWatcher().set(EntityZombie.DROWN_CONVERTING, false); + } + // Paper end -+ - protected void eQ() { - this.c(EntityTypes.DROWNED); - if (!this.isSilent()) { + public void startDrownedConversion(int i) { + this.lastTick = MinecraftServer.currentTick; // CraftBukkit + this.drownedConversionTime = i; @@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster { } -+ public boolean shouldBurnInDay() { return U_(); } // Paper - OBFHELPER - protected boolean U_() { -- return true; -+ return shouldBurnInDay; ++ public boolean shouldBurnInDay() { return T_(); } // Paper - OBFHELPER + protected boolean T_() { + return true; } + // Paper start @@ -48,10 +46,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @Override public boolean damageEntity(DamageSource damagesource, float f) { - if (super.damageEntity(damagesource, f)) { + if (!super.damageEntity(damagesource, f)) { @@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster { - nbttagcompound.setBoolean("CanBreakDoors", this.eV()); - nbttagcompound.setInt("InWaterTime", this.isInWater() ? this.bA : -1); + nbttagcompound.setBoolean("CanBreakDoors", this.eU()); + nbttagcompound.setInt("InWaterTime", this.isInWater() ? this.bt : -1); nbttagcompound.setInt("DrownedConversionTime", this.isDrownConverting() ? this.drownedConversionTime : -1); + nbttagcompound.setBoolean("Paper.ShouldBurnInDay", shouldBurnInDay); // Paper } @@ -75,10 +73,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java @@ -0,0 +0,0 @@ public class CraftZombie extends CraftMonster implements Zombie { - getHandle().startDrownedConversion(time); - } + @Override + public void setAgeLock(boolean b) { } -+ + // Paper start + @Override + public boolean isDrowning() { @@ -115,4 +112,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + getHandle().setShouldBurnInDay(shouldBurnInDay); + } + // Paper end - } + + @Override + public boolean getAgeLock() { diff --git a/Spigot-Server-Patches/Add-option-to-allow-iron-golems-to-spawn-in-air.patch b/Spigot-Server-Patches/Add-option-to-allow-iron-golems-to-spawn-in-air.patch index c03f830711..4a23c8998f 100644 --- a/Spigot-Server-Patches/Add-option-to-allow-iron-golems-to-spawn-in-air.patch +++ b/Spigot-Server-Patches/Add-option-to-allow-iron-golems-to-spawn-in-air.patch @@ -17,9 +17,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + ironGolemsCanSpawnInAir = getBoolean("iron-golems-can-spawn-in-air", ironGolemsCanSpawnInAir); + } + - public int bedSearchRadius = 1; - private void bedSearchRadius() { - bedSearchRadius = getInt("bed-search-radius", 1); + public boolean armorStandEntityLookups = true; + private void armorStandEntityLookups() { + armorStandEntityLookups = getBoolean("armor-stands-do-collision-entity-lookups", true); diff --git a/src/main/java/net/minecraft/server/EntityIronGolem.java b/src/main/java/net/minecraft/server/EntityIronGolem.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityIronGolem.java diff --git a/Spigot-Server-Patches/Add-option-to-nerf-pigmen-from-nether-portals.patch b/Spigot-Server-Patches/Add-option-to-nerf-pigmen-from-nether-portals.patch index f41a39e283..988537d5ec 100644 --- a/Spigot-Server-Patches/Add-option-to-nerf-pigmen-from-nether-portals.patch +++ b/Spigot-Server-Patches/Add-option-to-nerf-pigmen-from-nether-portals.patch @@ -25,7 +25,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class BlockPortal extends Block { if (entity != null) { - entity.portalCooldown = entity.getDefaultPortalCooldown(); + entity.resetPortalCooldown(); + entity.fromNetherPortal = true; // Paper + if (worldserver.paperConfig.nerfNetherPortalPigmen) ((EntityInsentient) entity).aware = false; // Paper } diff --git a/Spigot-Server-Patches/Add-phantom-creative-and-insomniac-controls.patch b/Spigot-Server-Patches/Add-phantom-creative-and-insomniac-controls.patch index 1d2990ac34..acd8ba9011 100644 --- a/Spigot-Server-Patches/Add-phantom-creative-and-insomniac-controls.patch +++ b/Spigot-Server-Patches/Add-phantom-creative-and-insomniac-controls.patch @@ -56,4 +56,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (!entityhuman.isSpectator() && (!worldserver.paperConfig.phantomIgnoreCreative || !entityhuman.isCreative())) { // Paper BlockPosition blockposition = entityhuman.getChunkCoordinates(); - if (!worldserver.getDimensionManager().hasSkyLight() || blockposition.getY() >= worldserver.getSeaLevel() && worldserver.f(blockposition)) { + if (!worldserver.getDimensionManager().hasSkyLight() || blockposition.getY() >= worldserver.getSeaLevel() && worldserver.e(blockposition)) { diff --git a/Spigot-Server-Patches/Add-setMaxPlayers-API.patch b/Spigot-Server-Patches/Add-setMaxPlayers-API.patch new file mode 100644 index 0000000000..5fee1e632e --- /dev/null +++ b/Spigot-Server-Patches/Add-setMaxPlayers-API.patch @@ -0,0 +1,37 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Mariell Hoversholm +Date: Sat, 22 Aug 2020 23:59:30 +0200 +Subject: [PATCH] Add #setMaxPlayers API + + +diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/PlayerList.java ++++ b/src/main/java/net/minecraft/server/PlayerList.java +@@ -0,0 +0,0 @@ public abstract class PlayerList { + public final WorldNBTStorage playerFileData; + private boolean hasWhitelist; + private final IRegistryCustom.Dimension s; +- protected final int maxPlayers; ++ protected int maxPlayers; public final void setMaxPlayers(int maxPlayers) { this.maxPlayers = maxPlayers; } // Paper - remove final and add setter + private int viewDistance; + private EnumGamemode u; + private boolean v; +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +@@ -0,0 +0,0 @@ public final class CraftServer implements Server { + return playerList.getMaxPlayers(); + } + ++ // Paper start ++ @Override ++ public void setMaxPlayers(int maxPlayers) { ++ this.playerList.setMaxPlayers(maxPlayers); ++ } ++ // Paper end ++ + // NOTE: These are dependent on the corresponding call in MinecraftServer + // so if that changes this will need to as well + @Override diff --git a/Spigot-Server-Patches/Add-sun-related-API.patch b/Spigot-Server-Patches/Add-sun-related-API.patch index 7ff0ea595c..a6dedad9f1 100644 --- a/Spigot-Server-Patches/Add-sun-related-API.patch +++ b/Spigot-Server-Patches/Add-sun-related-API.patch @@ -12,10 +12,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } -+ public boolean isInDaylight() { return this.eH(); } // Paper - OBFHELPER - protected boolean eH() { ++ public boolean isInDaylight() { return this.eG(); } // Paper - OBFHELPER + protected boolean eG() { if (this.world.isDay() && !this.world.isClientSide) { - float f = this.aO(); + float f = this.aQ(); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/Spigot-Server-Patches/Add-tick-times-API-and-mspt-command.patch b/Spigot-Server-Patches/Add-tick-times-API-and-mspt-command.patch index b070d28109..b3a2f69298 100644 --- a/Spigot-Server-Patches/Add-tick-times-API-and-mspt-command.patch +++ b/Spigot-Server-Patches/Add-tick-times-API-and-mspt-command.patch @@ -116,8 +116,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.methodProfiler.exit(); org.spigotmc.WatchdogThread.tick(); // Spigot @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant entitytypes, World world) { super(entitytypes, world); -@@ -0,0 +0,0 @@ public class EntityArmorStand extends EntityLiving { - this.rightArmPose = EntityArmorStand.bt; - this.leftLegPose = EntityArmorStand.bu; - this.rightLegPose = EntityArmorStand.bv; + if (world != null) this.canTick = world.paperConfig.armorStandTick; // Paper - armour stand ticking - this.G = 0.0F; - } - + this.handItems = NonNullList.a(2, ItemStack.b); + this.armorItems = NonNullList.a(4, ItemStack.b); + this.headPose = EntityArmorStand.bj; @@ -0,0 +0,0 @@ public class EntityArmorStand extends EntityLiving { this.armorItems.set(enumitemslot.b(), itemstack); } @@ -129,18 +125,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } public void setLeftLegPose(Vector3f vector3f) { ++ this.noTickPoseDirty = true; // Paper - Allow updates when not ticking this.leftLegPose = vector3f; this.datawatcher.set(EntityArmorStand.g, vector3f); -+ this.noTickPoseDirty = true; // Paper - Allow updates when not ticking ++ } public void setRightLegPose(Vector3f vector3f) { - this.rightLegPose = vector3f; - this.datawatcher.set(EntityArmorStand.bo, vector3f); + this.noTickPoseDirty = true; // Paper - Allow updates when not ticking + this.rightLegPose = vector3f; + this.datawatcher.set(EntityArmorStand.bh, vector3f); } - - public Vector3f r() { diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java @@ -149,9 +144,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } -+ public void updateEntityEquipment() { q(); }; // Paper - private void q() { - Map map = this.r(); ++ public final void updateEntityEquipment() { p(); }; // Paper - OBFHELPER + private void p() { + Map map = this.q(); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 diff --git a/Spigot-Server-Patches/Allow-nerfed-mobs-to-jump-and-take-water-damage.patch b/Spigot-Server-Patches/Allow-nerfed-mobs-to-jump-and-take-water-damage.patch index cb53ca32ab..e2f4b37a42 100644 --- a/Spigot-Server-Patches/Allow-nerfed-mobs-to-jump-and-take-water-damage.patch +++ b/Spigot-Server-Patches/Allow-nerfed-mobs-to-jump-and-take-water-damage.patch @@ -38,8 +38,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return this.isInWater() || this.isInRain(); } -+ public final boolean isInWaterOrRainOrBubble() { return aC(); } // Paper - OBFHELPER - public boolean aC() { ++ public final boolean isInWaterOrRainOrBubble() { return aF(); } // Paper - OBFHELPER + public boolean aF() { return this.isInWater() || this.isInRain() || this.k(); } diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java @@ -53,7 +53,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @Nullable public PathfinderGoalFloat goalFloat; // Paper public PathfinderGoalSelector targetSelector; private EntityLiving goalTarget; - private final EntitySenses bv; + private final EntitySenses bo; @@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving { @Override protected final void doTick() { @@ -71,7 +71,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Paper end this.world.getMethodProfiler().enter("sensing"); - this.bv.a(); + this.bo.a(); this.world.getMethodProfiler().exit(); diff --git a/src/main/java/net/minecraft/server/PathfinderGoalFloat.java b/src/main/java/net/minecraft/server/PathfinderGoalFloat.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 @@ -89,7 +89,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public final boolean validConditions() { return this.a(); } // Paper - OBFHELPER @Override public boolean a() { - return this.a.isInWater() && this.a.b((Tag) TagsFluid.WATER) > this.a.cw() || this.a.aN(); + return this.a.isInWater() && this.a.b((Tag) TagsFluid.WATER) > this.a.cw() || this.a.aP(); } + public void update() { this.e(); } // Paper - OBFHELPER diff --git a/Spigot-Server-Patches/Anti-Xray.patch b/Spigot-Server-Patches/Anti-Xray.patch index 87a08d0381..a905b7c393 100644 --- a/Spigot-Server-Patches/Anti-Xray.patch +++ b/Spigot-Server-Patches/Anti-Xray.patch @@ -135,7 +135,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + private final ChunkSection[] emptyNearbyChunkSections = {Chunk.EMPTY_CHUNK_SECTION, Chunk.EMPTY_CHUNK_SECTION, Chunk.EMPTY_CHUNK_SECTION, Chunk.EMPTY_CHUNK_SECTION}; + private final int maxBlockYUpdatePosition; + -+ public ChunkPacketBlockControllerAntiXray(PaperWorldConfig paperWorldConfig, Executor executor) { ++ public ChunkPacketBlockControllerAntiXray(World world, Executor executor) { ++ PaperWorldConfig paperWorldConfig = world.paperConfig; + engineMode = paperWorldConfig.engineMode; + maxChunkSectionIndex = paperWorldConfig.maxChunkSectionIndex; + updateRadius = paperWorldConfig.updateRadius; @@ -185,12 +186,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + for (String id : toObfuscate) { + Block block = IRegistry.BLOCK.getOptional(new MinecraftKey(id)).orElse(null); + -+ if (block != null) { ++ // Don't obfuscate air because air causes unnecessary block updates and causes block updates to fail in the void ++ if (block != null && !block.getBlockData().isAir()) { + obfuscateGlobal[ChunkSection.GLOBAL_PALETTE.getOrCreateIdFor(block.getBlockData())] = true; + } + } + -+ ChunkEmpty emptyChunk = new ChunkEmpty(null, new ChunkCoordIntPair(0, 0)); ++ ChunkEmpty emptyChunk = new ChunkEmpty(world, new ChunkCoordIntPair(0, 0)); + BlockPosition zeroPos = new BlockPosition(0, 0, 0); + + for (int i = 0; i < solidGlobal.length; i++) { @@ -1000,6 +1002,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.sections[j >> 4] = chunksection; } +diff --git a/src/main/java/net/minecraft/server/ChunkEmpty.java b/src/main/java/net/minecraft/server/ChunkEmpty.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/ChunkEmpty.java ++++ b/src/main/java/net/minecraft/server/ChunkEmpty.java +@@ -0,0 +0,0 @@ public class ChunkEmpty extends Chunk { + }); + + public ChunkEmpty(World world, ChunkCoordIntPair chunkcoordintpair) { +- super(world, chunkcoordintpair, new BiomeStorage(world.r().b(IRegistry.ay), ChunkEmpty.b)); ++ super(world, chunkcoordintpair, new BiomeStorage(MinecraftServer.getServer().getCustomRegistry().b(IRegistry.ay), ChunkEmpty.b)); // Paper - world isnt ready yet for anti xray use here, use server singleton for registry + } + + // Paper start diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java @@ -1036,7 +1051,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public class ChunkSection { @@ -0,0 +0,0 @@ public class ChunkSection { private short e; - final DataPaletteBlock blockIds; + final DataPaletteBlock blockIds; // Paper - package-private - public ChunkSection(int i) { - this(i, (short) 0, (short) 0, (short) 0); @@ -1200,6 +1215,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 int j = along.length * 64 / 4096; if (this.h == this.b) { +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant { + private List g; private boolean h; - private boolean i; - public PacketPlayOutMapChunk() {} + // Paper start - Async-Anti-Xray - Set the ready flag to true @@ -1222,13 +1249,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.ready = true; + } + // Paper end - ++ // Paper start private final java.util.List extraPackets = new java.util.ArrayList<>(); + private static final int TE_LIMIT = Integer.getInteger("Paper.excessiveTELimit", 750); @@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet { } // Paper end - public PacketPlayOutMapChunk(Chunk chunk, int i, boolean flag) { + public PacketPlayOutMapChunk(Chunk chunk, int i) { + ChunkPacketInfo chunkPacketInfo = chunk.world.chunkPacketBlockController.getChunkPacketInfo(this, chunk, i); // Paper - Anti-Xray - Add chunk packet info ChunkCoordIntPair chunkcoordintpair = chunk.getPos(); @@ -1237,12 +1265,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } this.f = new byte[this.a(chunk, i)]; -- this.c = this.a(new PacketDataSerializer(this.k()), chunk, i); +- this.c = this.a(new PacketDataSerializer(this.j()), chunk, i); + // Paper start - Anti-Xray - Add chunk packet info + if (chunkPacketInfo != null) { + chunkPacketInfo.setData(this.getData()); + } -+ this.c = this.writeChunk(new PacketDataSerializer(this.k()), chunk, i, chunkPacketInfo); ++ this.c = this.writeChunk(new PacketDataSerializer(this.j()), chunk, i, chunkPacketInfo); + // Paper end this.g = Lists.newArrayList(); iterator = chunk.getTileEntities().entrySet().iterator(); @@ -1393,14 +1421,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public final co.aikar.timings.WorldTimingsHandler timings; // Paper public static BlockPosition lastPhysicsProblem; // Spigot @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - return (CraftServer) Bukkit.getServer(); + return typeKey; } -- protected World(WorldDataMutable worlddatamutable, ResourceKey resourcekey, ResourceKey resourcekey1, DimensionManager dimensionmanager, Supplier supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env) { -+ protected World(WorldDataMutable worlddatamutable, ResourceKey resourcekey, ResourceKey resourcekey1, DimensionManager dimensionmanager, Supplier supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env, java.util.concurrent.Executor executor) { +- protected World(WorldDataMutable worlddatamutable, ResourceKey resourcekey, final DimensionManager dimensionmanager, Supplier supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env) { ++ protected World(WorldDataMutable worlddatamutable, ResourceKey resourcekey, final DimensionManager dimensionmanager, Supplier supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env, java.util.concurrent.Executor executor) { // Paper this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((WorldDataServer) worlddatamutable).getName()); // Spigot this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig((((WorldDataServer)worlddatamutable).getName()), this.spigotConfig); // Paper -+ this.chunkPacketBlockController = this.paperConfig.antiXray ? new ChunkPacketBlockControllerAntiXray(this.paperConfig, executor) : ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray ++ this.chunkPacketBlockController = this.paperConfig.antiXray ? new ChunkPacketBlockControllerAntiXray(this, executor) : ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray this.generator = gen; this.world = new CraftWorld((WorldServer) this, gen, env); this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit @@ -1419,9 +1447,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { // Add env and gen to constructor, WorldData -> WorldDataServer - public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey resourcekey, ResourceKey resourcekey1, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { -- super(iworlddataserver, resourcekey, resourcekey1, dimensionmanager, minecraftserver::getMethodProfiler, false, flag, i, gen, env); -+ super(iworlddataserver, resourcekey, resourcekey1, dimensionmanager, minecraftserver::getMethodProfiler, false, flag, i, gen, env, executor); // Paper pass executor + public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey resourcekey, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { +- super(iworlddataserver, resourcekey, dimensionmanager, minecraftserver::getMethodProfiler, false, flag, i, gen, env); ++ super(iworlddataserver, resourcekey, dimensionmanager, minecraftserver::getMethodProfiler, false, flag, i, gen, env, executor); // Paper pass executor this.pvpMode = minecraftserver.getPVP(); convertable = convertable_conversionsession; uuid = WorldUUID.getUUID(convertable_conversionsession.folder.toFile()); diff --git a/Spigot-Server-Patches/Asynchronous-chunk-IO-and-loading.patch b/Spigot-Server-Patches/Asynchronous-chunk-IO-and-loading.patch index b8457cb5c4..869df43206 100644 --- a/Spigot-Server-Patches/Asynchronous-chunk-IO-and-loading.patch +++ b/Spigot-Server-Patches/Asynchronous-chunk-IO-and-loading.patch @@ -2954,7 +2954,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant WorldDataServer - public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey resourcekey, ResourceKey resourcekey1, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { - super(iworlddataserver, resourcekey, resourcekey1, dimensionmanager, minecraftserver::getMethodProfiler, false, flag, i, gen, env, executor); // Paper pass executor + public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey resourcekey, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { + super(iworlddataserver, resourcekey, dimensionmanager, minecraftserver::getMethodProfiler, false, flag, i, gen, env, executor); // Paper pass executor @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { this.dragonBattle = null; } @@ -4018,9 +4018,9 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/jav index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -0,0 +0,0 @@ import net.minecraft.server.GroupDataEntity; - import net.minecraft.server.IBlockData; +@@ -0,0 +0,0 @@ import net.minecraft.server.IBlockData; import net.minecraft.server.IChunkAccess; + import net.minecraft.server.IRegistry; import net.minecraft.server.MinecraftKey; +import net.minecraft.server.MinecraftServer; import net.minecraft.server.MovingObjectPosition; diff --git a/Spigot-Server-Patches/Avoid-blocking-on-Network-Manager-creation.patch b/Spigot-Server-Patches/Avoid-blocking-on-Network-Manager-creation.patch index b1ff6c6492..dbc7a40619 100644 --- a/Spigot-Server-Patches/Avoid-blocking-on-Network-Manager-creation.patch +++ b/Spigot-Server-Patches/Avoid-blocking-on-Network-Manager-creation.patch @@ -26,13 +26,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public ServerConnection(MinecraftServer minecraftserver) { this.e = minecraftserver; @@ -0,0 +0,0 @@ public class ServerConnection { - channel.pipeline().addLast("timeout", new ReadTimeoutHandler(30)).addLast("legacy_query", new LegacyPingHandler(ServerConnection.this)).addLast("splitter", new PacketSplitter()).addLast("decoder", new PacketDecoder(EnumProtocolDirection.SERVERBOUND)).addLast("prepender", new PacketPrepender()).addLast("encoder", new PacketEncoder(EnumProtocolDirection.CLIENTBOUND)); - NetworkManager networkmanager = new NetworkManager(EnumProtocolDirection.SERVERBOUND); + int j = ServerConnection.this.e.k(); + Object object = j > 0 ? new NetworkManagerServer(j) : new NetworkManager(EnumProtocolDirection.SERVERBOUND); -- ServerConnection.this.connectedChannels.add(networkmanager); -+ pending.add(networkmanager); // Paper - channel.pipeline().addLast("packet_handler", networkmanager); - networkmanager.setPacketListener(new HandshakeListener(ServerConnection.this.e, networkmanager)); +- ServerConnection.this.connectedChannels.add((NetworkManager) object); // CraftBukkit - decompile error ++ //ServerConnection.this.connectedChannels.add((NetworkManager) object); // CraftBukkit - decompile error ++ pending.add((NetworkManager) object); // Paper + channel.pipeline().addLast("packet_handler", (ChannelHandler) object); + ((NetworkManager) object).setPacketListener(new HandshakeListener(ServerConnection.this.e, (NetworkManager) object)); } @@ -0,0 +0,0 @@ public class ServerConnection { diff --git a/Spigot-Server-Patches/Basic-PlayerProfile-API.patch b/Spigot-Server-Patches/Basic-PlayerProfile-API.patch index 43ef06d0b6..a757107725 100644 --- a/Spigot-Server-Patches/Basic-PlayerProfile-API.patch +++ b/Spigot-Server-Patches/Basic-PlayerProfile-API.patch @@ -433,6 +433,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import com.destroystokyo.paper.profile.CraftPlayerProfile; +import com.destroystokyo.paper.profile.PlayerProfile; import com.google.common.util.concurrent.ThreadFactoryBuilder; + import it.unimi.dsi.fastutil.objects.ObjectRBTreeSet; import org.apache.commons.lang.exception.ExceptionUtils; +import com.mojang.authlib.GameProfile; import org.bukkit.Location; @@ -468,23 +469,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/UserCache.java @@ -0,0 +0,0 @@ public class UserCache { - public static final SimpleDateFormat a = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z"); - private static boolean c; -- private final Map d = new java.util.concurrent.ConcurrentHashMap<>(); // Paper -+ private final Map d = new java.util.concurrent.ConcurrentHashMap<>();private final Map nameCache = d; // Paper - OBFHELPER // Paper - private final Map e = new java.util.concurrent.ConcurrentHashMap<>(); // Paper - private final Deque f = new java.util.concurrent.LinkedBlockingDeque(); // CraftBukkit - private final GameProfileRepository g; + private static final Logger LOGGER = LogManager.getLogger(); + private static boolean b; +- private final Map c = Maps.newConcurrentMap(); ++ private final Map c = Maps.newConcurrentMap();private final Map nameCache = c; // Paper - OBFHELPER // Paper + private final Map d = Maps.newConcurrentMap(); + private final GameProfileRepository e; + private final Gson f = (new GsonBuilder()).create(); @@ -0,0 +0,0 @@ public class UserCache { - return UserCache.c; + return UserCache.b; } + public void saveProfile(GameProfile gameprofile) { a(gameprofile); } // Paper - OBFHELPER - public void a(GameProfile gameprofile) { - this.a(gameprofile, (Date) null); - } + public synchronized void a(GameProfile gameprofile) { // Paper - synchronize + Calendar calendar = Calendar.getInstance(); + @@ -0,0 +0,0 @@ public class UserCache { - return usercache_usercacheentry == null ? null : usercache_usercacheentry.a(); + return gameprofile; } + // Paper start @@ -496,16 +497,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @Nullable public GameProfile getProfile(UUID uuid) { - UserCache.UserCacheEntry usercache_usercacheentry = (UserCache.UserCacheEntry) this.e.get(uuid); + UserCache.UserCacheEntry usercache_usercacheentry = (UserCache.UserCacheEntry) this.d.get(uuid); @@ -0,0 +0,0 @@ public class UserCache { - class UserCacheEntry { + static class UserCacheEntry { -- private final GameProfile b; -+ private final GameProfile b;public GameProfile getProfile() { return b; } // Paper - OBFHELPER - private final Date c; +- private final GameProfile a; ++ private final GameProfile a;public GameProfile getProfile() { return a; } // Paper - OBFHELPER + private final Date b; + private volatile long c; - private UserCacheEntry(GameProfile gameprofile, Date date) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/Spigot-Server-Patches/Cache-user-authenticator-threads.patch b/Spigot-Server-Patches/Cache-user-authenticator-threads.patch index e5c349a4f2..02db3c60e0 100644 --- a/Spigot-Server-Patches/Cache-user-authenticator-threads.patch +++ b/Spigot-Server-Patches/Cache-user-authenticator-threads.patch @@ -17,7 +17,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import java.util.Deque; // Paper import java.util.Iterator; import java.util.List; - import java.util.OptionalInt; + import java.util.Optional; @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public PlayerConnection playerConnection; public final MinecraftServer server; @@ -58,11 +58,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start - Optimize remove queue - vanilla copies player objects, but CB doesn't. This method currently only + // Applies to the same player, so we need to not duplicate our removal queue. The rest of this method does "resetting" + // type logic so it does need to be called, maybe? This is silly. -+ //this.removeQueue.addAll(entityplayer.removeQueue); ++ // this.removeQueue.addAll(entityplayer.removeQueue); + if (this.removeQueue != entityplayer.removeQueue) { + this.removeQueue.addAll(entityplayer.removeQueue); + } + // Paper end - this.ck = entityplayer.ck; - this.cp = entityplayer.cp; + this.cd = entityplayer.cd; + this.ci = entityplayer.ci; this.setShoulderEntityLeft(entityplayer.getShoulderEntityLeft()); diff --git a/Spigot-Server-Patches/Catch-exceptions-from-dispenser-entity-spawns.patch b/Spigot-Server-Patches/Catch-exceptions-from-dispenser-entity-spawns.patch index ef9737b84b..9ff195872f 100644 --- a/Spigot-Server-Patches/Catch-exceptions-from-dispenser-entity-spawns.patch +++ b/Spigot-Server-Patches/Catch-exceptions-from-dispenser-entity-spawns.patch @@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 entitytypes.spawnCreature(isourceblock.getWorld(), itemstack, (EntityHuman) null, isourceblock.getBlockPosition().shift(enumdirection), EnumMobSpawn.DISPENSER, enumdirection != EnumDirection.UP, false); + // Paper start + } catch (Exception ex){ -+ MinecraftServer.LOGGER.warn("An exception occurred dispensing entity at {}[{}]", world.getWorld().getName(), isourceblock.getBlockPosition(), ex); ++ MinecraftServer.LOGGER.warn("An exception occurred dispensing entity at {}[{}]", worldserver.getWorld().getName(), isourceblock.getBlockPosition(), ex); + } + // Paper end + diff --git a/Spigot-Server-Patches/Check-Drowned-for-Villager-Aggression-Config.patch b/Spigot-Server-Patches/Check-Drowned-for-Villager-Aggression-Config.patch index 266dd029d2..7ad8a6e3fb 100644 --- a/Spigot-Server-Patches/Check-Drowned-for-Villager-Aggression-Config.patch +++ b/Spigot-Server-Patches/Check-Drowned-for-Villager-Aggression-Config.patch @@ -11,9 +11,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class EntityDrowned extends EntityZombie implements IRangedEntity { this.goalSelector.a(7, new PathfinderGoalRandomStroll(this, 1.0D)); this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[]{EntityDrowned.class})).a(EntityPigZombie.class)); - this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, 10, true, false, this::j)); + this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, 10, true, false, this::i)); - this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityVillagerAbstract.class, false)); + if ( world.spigotConfig.zombieAggressiveTowardsVillager ) this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityVillagerAbstract.class, false)); // Paper this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityIronGolem.class, true)); - this.targetSelector.a(5, new PathfinderGoalNearestAttackableTarget<>(this, EntityTurtle.class, 10, true, false, EntityTurtle.bv)); + this.targetSelector.a(5, new PathfinderGoalNearestAttackableTarget<>(this, EntityTurtle.class, 10, true, false, EntityTurtle.bo)); } diff --git a/Spigot-Server-Patches/Chunk-debug-command.patch b/Spigot-Server-Patches/Chunk-debug-command.patch index f188ecbbf2..e34f2dc066 100644 --- a/Spigot-Server-Patches/Chunk-debug-command.patch +++ b/Spigot-Server-Patches/Chunk-debug-command.patch @@ -201,9 +201,9 @@ diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MCUtil.java +++ b/src/main/java/net/minecraft/server/MCUtil.java -@@ -0,0 +0,0 @@ import com.destroystokyo.paper.profile.CraftPlayerProfile; - import com.destroystokyo.paper.profile.PlayerProfile; +@@ -0,0 +0,0 @@ import com.destroystokyo.paper.profile.PlayerProfile; import com.google.common.util.concurrent.ThreadFactoryBuilder; + import it.unimi.dsi.fastutil.objects.ObjectRBTreeSet; import org.apache.commons.lang.exception.ExceptionUtils; +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; @@ -408,8 +408,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private int n; - private final ChunkCoordIntPair location; + final ChunkCoordIntPair location; // Paper - private -> package - private final short[] dirtyBlocks; - private int dirtyCount; + private boolean p; + private final ShortSet[] dirtyBlocks; private int r; diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 diff --git a/Spigot-Server-Patches/ChunkMapDistance-CME.patch b/Spigot-Server-Patches/ChunkMapDistance-CME.patch index 6360b000c5..a13ae349ae 100644 --- a/Spigot-Server-Patches/ChunkMapDistance-CME.patch +++ b/Spigot-Server-Patches/ChunkMapDistance-CME.patch @@ -60,6 +60,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return true; } else { if (!this.l.isEmpty()) { +@@ -0,0 +0,0 @@ public abstract class ChunkMapDistance { + ObjectIterator objectiterator = this.a.long2ByteEntrySet().iterator(); + + while (objectiterator.hasNext()) { +- it.unimi.dsi.fastutil.longs.Long2ByteMap.Entry it_unimi_dsi_fastutil_longs_long2bytemap_entry = (it.unimi.dsi.fastutil.longs.Long2ByteMap.Entry) objectiterator.next(); ++ Long2ByteMap.Entry it_unimi_dsi_fastutil_longs_long2bytemap_entry = (Long2ByteMap.Entry) objectiterator.next(); // Paper - decompile fix + byte b0 = it_unimi_dsi_fastutil_longs_long2bytemap_entry.getByteValue(); + long j = it_unimi_dsi_fastutil_longs_long2bytemap_entry.getLongKey(); + diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/PlayerChunk.java diff --git a/Spigot-Server-Patches/Configurable-Bed-Search-Radius.patch b/Spigot-Server-Patches/Configurable-Bed-Search-Radius.patch deleted file mode 100644 index 103cea0352..0000000000 --- a/Spigot-Server-Patches/Configurable-Bed-Search-Radius.patch +++ /dev/null @@ -1,159 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Wed, 4 Jul 2018 15:22:06 -0400 -Subject: [PATCH] Configurable Bed Search Radius - -Allows you to increase how far to check for a safe place to respawn -a player near their bed, allowing a better chance to respawn the -player at their bed should it of became obstructed. - -Defaults to vanilla 1. - -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -0,0 +0,0 @@ public class PaperWorldConfig { - private void scanForLegacyEnderDragon() { - scanForLegacyEnderDragon = getBoolean("game-mechanics.scan-for-legacy-ender-dragon", true); - } -+ -+ public int bedSearchRadius = 1; -+ private void bedSearchRadius() { -+ bedSearchRadius = getInt("bed-search-radius", 1); -+ if (bedSearchRadius < 1) { -+ bedSearchRadius = 1; -+ } -+ if (bedSearchRadius > 1) { -+ log("Bed Search Radius: " + bedSearchRadius); -+ } -+ } - } -diff --git a/src/main/java/net/minecraft/server/BlockBed.java b/src/main/java/net/minecraft/server/BlockBed.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockBed.java -+++ b/src/main/java/net/minecraft/server/BlockBed.java -@@ -0,0 +0,0 @@ public class BlockBed extends BlockFacingHorizontal implements ITileEntity { - - public static Optional a(EntityTypes entitytypes, IWorldReader iworldreader, BlockPosition blockposition, int i) { - EnumDirection enumdirection = (EnumDirection) iworldreader.getType(blockposition).get(BlockBed.FACING); -+ // Paper start - configurable bed search radius -+ if (entitytypes == EntityTypes.PLAYER) return findSafePosition(entitytypes, (World) iworldreader, enumdirection, blockposition); - int j = blockposition.getX(); - int k = blockposition.getY(); - int l = blockposition.getZ(); -@@ -0,0 +0,0 @@ public class BlockBed extends BlockFacingHorizontal implements ITileEntity { - return Optional.empty(); - } - -- public static Optional a(EntityTypes entitytypes, IWorldReader iworldreader, BlockPosition blockposition) { -+ private static Optional findSafePosition(EntityTypes entitytypes, World world, EnumDirection updirection, BlockPosition blockposition){ -+ int radius = world.paperConfig.bedSearchRadius; -+ double angle = Math.PI / 2; -+ int tmpX = (int)(updirection.getAdjacentX() * Math.cos(angle) - updirection.getAdjacentZ() * Math.sin(angle)); -+ int tmpZ = (int)(updirection.getAdjacentX() * Math.sin(angle) + updirection.getAdjacentZ() * Math.cos(angle)); -+ -+ EnumDirection rightDirection = EnumDirection.a(tmpX, 0, tmpZ); -+ EnumDirection downDirection = updirection.opposite(); -+ EnumDirection leftDirection = rightDirection.opposite(); -+ -+ EnumDirection[] corePositionOutDirection = new EnumDirection[6]; -+ corePositionOutDirection[0] = updirection; -+ corePositionOutDirection[1] = leftDirection; -+ corePositionOutDirection[2] = leftDirection; -+ corePositionOutDirection[3] = downDirection; -+ corePositionOutDirection[4] = rightDirection; -+ corePositionOutDirection[5] = rightDirection; -+ -+ BlockPosition[] corePosition = new BlockPosition[6]; -+ corePosition[0] = blockposition.add(updirection.getAdjacentX(), 0, updirection.getAdjacentZ()); -+ corePosition[1] = blockposition.add(leftDirection.getAdjacentX(), 0, leftDirection.getAdjacentZ()); -+ corePosition[2] = corePosition[1].add(downDirection.getAdjacentX(), 0, downDirection.getAdjacentZ()); -+ corePosition[3] = blockposition.add(2 * downDirection.getAdjacentX(), 0, 2 * downDirection.getAdjacentZ()); -+ corePosition[5] = blockposition.add(rightDirection.getAdjacentX(), 0, rightDirection.getAdjacentZ()); -+ corePosition[4] = corePosition[5].add(downDirection.getAdjacentX(), 0, downDirection.getAdjacentZ()); -+ -+ BlockPosition[] tmpPosition = new BlockPosition[8]; -+ EnumDirection[] tmpPositionDirection = new EnumDirection[8]; -+ tmpPositionDirection[0] = rightDirection; -+ tmpPositionDirection[1] = leftDirection; -+ tmpPositionDirection[2] = updirection; -+ tmpPositionDirection[3] = downDirection; -+ tmpPositionDirection[4] = leftDirection; -+ tmpPositionDirection[5] = rightDirection; -+ tmpPositionDirection[6] = downDirection; -+ tmpPositionDirection[7] = updirection; -+ -+ BlockPosition pos; -+ Optional vector; -+ for (int r = 1; r <= radius; r++) { -+ int h = 0; -+ while (h <= 1) { -+ int numIterated = 0; -+ for (int index = (int)(Math.random() * corePosition.length); numIterated < corePosition.length; index = (index+1) % corePosition.length) { -+ numIterated++; -+ -+ pos = corePosition[index].add(0, h, 0); -+ vector = isSafeRespawn(entitytypes, world, pos, 0); -+ if (vector.isPresent()) { -+ return vector; -+ } -+ } -+ tmpPosition[0] = corePosition[0].add(0, h, 0); -+ tmpPosition[1] = corePosition[0].add(0, h, 0); -+ tmpPosition[2] = corePosition[1].add(0, h, 0); -+ tmpPosition[3] = corePosition[2].add(0, h, 0); -+ tmpPosition[4] = corePosition[3].add(0, h, 0); -+ tmpPosition[5] = corePosition[3].add(0, h, 0); -+ tmpPosition[6] = corePosition[4].add(0, h, 0); -+ tmpPosition[7] = corePosition[5].add(0, h, 0); -+ for (int rr = 1; rr <= r; rr++){ -+ numIterated = 0; -+ for (int index = (int)(Math.random() * tmpPosition.length); numIterated < tmpPosition.length; index = (index+1) % tmpPosition.length) { -+ numIterated++; -+ tmpPosition[index] = tmpPosition[index].add(tmpPositionDirection[index].getAdjacentX(), 0, tmpPositionDirection[index].getAdjacentZ()); -+ pos = tmpPosition[index]; -+ -+ vector = isSafeRespawn(entitytypes, world, pos, 0); -+ if (vector.isPresent()) { -+ return vector; -+ } -+ } -+ } -+ switch (h) { -+ case 0: -+ h = -1; -+ break; -+ case -1: -+ h = -2; -+ break; -+ case -2: -+ h = Integer.MAX_VALUE; -+ break; -+ } -+ } -+ for (int index = 0; index < corePosition.length; index++) { -+ EnumDirection tmp = corePositionOutDirection[index]; -+ corePosition[index] = corePosition[index].add(tmp.getAdjacentX(), 0, tmp.getAdjacentZ()); -+ } -+ } -+ return Optional.empty(); -+ } -+ // Paper end -+ -+ // Paper start -- add maxBelow param -+ public static Optional a(EntityTypes entitytypes, IWorldReader iworldreader, BlockPosition blockposition) { return isSafeRespawn(entitytypes, iworldreader, blockposition, 2); } -+ public static Optional isSafeRespawn(EntityTypes entitytypes, IWorldReader iworldreader, BlockPosition blockposition, int maxBelow) { -+ // Paper end - VoxelShape voxelshape = iworldreader.getType(blockposition).getCollisionShape(iworldreader, blockposition); - - if (voxelshape.c(EnumDirection.EnumAxis.Y) > 0.4375D) { -@@ -0,0 +0,0 @@ public class BlockBed extends BlockFacingHorizontal implements ITileEntity { - } else { - BlockPosition.MutableBlockPosition blockposition_mutableblockposition = blockposition.i(); - -- while (blockposition_mutableblockposition.getY() >= 0 && blockposition.getY() - blockposition_mutableblockposition.getY() <= 2 && iworldreader.getType(blockposition_mutableblockposition).getCollisionShape(iworldreader, blockposition_mutableblockposition).isEmpty()) { -+ while (blockposition_mutableblockposition.getY() >= 0 && blockposition.getY() - blockposition_mutableblockposition.getY() <= maxBelow && iworldreader.getType(blockposition_mutableblockposition).getCollisionShape(iworldreader, blockposition_mutableblockposition).isEmpty()) { // Paper -- configurable max distance to search below - blockposition_mutableblockposition.c(EnumDirection.DOWN); - } - diff --git a/Spigot-Server-Patches/Configurable-Cartographer-Treasure-Maps.patch b/Spigot-Server-Patches/Configurable-Cartographer-Treasure-Maps.patch index 2767a075d0..5c8a9c04ab 100644 --- a/Spigot-Server-Patches/Configurable-Cartographer-Treasure-Maps.patch +++ b/Spigot-Server-Patches/Configurable-Cartographer-Treasure-Maps.patch @@ -33,7 +33,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/LootItemFunctionExplorationMap.java @@ -0,0 +0,0 @@ public class LootItemFunctionExplorationMap extends LootItemFunctionConditional - if (blockposition != null) { + if (vec3d != null) { WorldServer worldserver = loottableinfo.getWorld(); + // Paper start + if (!worldserver.paperConfig.enableTreasureMaps) { @@ -44,9 +44,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return itemstack; + } + // Paper end - BlockPosition blockposition1 = worldserver.a(this.e, blockposition, this.h, this.i); + BlockPosition blockposition = worldserver.a(this.e, new BlockPosition(vec3d), this.h, this.i); - if (blockposition1 != null) { + if (blockposition != null) { diff --git a/src/main/java/net/minecraft/server/VillagerTrades.java b/src/main/java/net/minecraft/server/VillagerTrades.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/VillagerTrades.java diff --git a/Spigot-Server-Patches/Configurable-Keep-Spawn-Loaded-range-per-world.patch b/Spigot-Server-Patches/Configurable-Keep-Spawn-Loaded-range-per-world.patch index aef440b533..645de3ffa3 100644 --- a/Spigot-Server-Patches/Configurable-Keep-Spawn-Loaded-range-per-world.patch +++ b/Spigot-Server-Patches/Configurable-Keep-Spawn-Loaded-range-per-world.patch @@ -106,7 +106,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { - return ((PersistentIdCounts) this.getMinecraftServer().D().getWorldPersistentData().a(PersistentIdCounts::new, "idcounts")).a(); + return ((PersistentIdCounts) this.getMinecraftServer().E().getWorldPersistentData().a(PersistentIdCounts::new, "idcounts")).a(); } + // Paper start - helper function for configurable spawn radius @@ -180,13 +180,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Paper end + - public void a_(BlockPosition blockposition) { + public void a(BlockPosition blockposition, float f) { - ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(new BlockPosition(this.worldData.a(), 0, this.worldData.c())); + // Paper - configurable spawn radius + BlockPosition prevSpawn = this.getSpawn(); + //ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(new BlockPosition(this.worldData.a(), 0, this.worldData.c())); - this.worldData.setSpawn(blockposition); + this.worldData.setSpawn(blockposition, f); - this.getChunkProvider().removeTicket(TicketType.START, chunkcoordintpair, 11, Unit.INSTANCE); - this.getChunkProvider().addTicket(TicketType.START, new ChunkCoordIntPair(blockposition), 11, Unit.INSTANCE); + if (this.keepSpawnInMemory) { @@ -194,7 +194,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.removeTicketsForSpawn(this.paperConfig.keepLoadedRange, prevSpawn); + this.addTicketsForSpawn(this.paperConfig.keepLoadedRange, blockposition); + } - this.getMinecraftServer().getPlayerList().sendAll(new PacketPlayOutSpawnPosition(blockposition)); + this.getMinecraftServer().getPlayerList().sendAll(new PacketPlayOutSpawnPosition(blockposition, f)); } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/Spigot-Server-Patches/Configurable-RCON-IP-address.patch b/Spigot-Server-Patches/Configurable-RCON-IP-address.patch index 87b4c10282..c29a901007 100644 --- a/Spigot-Server-Patches/Configurable-RCON-IP-address.patch +++ b/Spigot-Server-Patches/Configurable-RCON-IP-address.patch @@ -16,19 +16,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public final String rconIp; // Paper - Add rcon ip + // CraftBukkit start - public DedicatedServerProperties(Properties properties, OptionSet optionset) { + public DedicatedServerProperties(Properties properties, IRegistryCustom iregistrycustom, OptionSet optionset) { super(properties, optionset); @@ -0,0 +0,0 @@ public class DedicatedServerProperties extends PropertyManager d = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.i); - private static final DataWatcherObject bv = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.b); + private static final DataWatcherObject bo = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.b); public static final DataWatcherObject DROWN_CONVERTING = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.i); @@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster { if (this.world != null && !this.world.isClientSide) { diff --git a/Spigot-Server-Patches/Configurable-chance-of-villager-zombie-infection.patch b/Spigot-Server-Patches/Configurable-chance-of-villager-zombie-infection.patch index c816903f2b..3085084468 100644 --- a/Spigot-Server-Patches/Configurable-chance-of-villager-zombie-infection.patch +++ b/Spigot-Server-Patches/Configurable-chance-of-villager-zombie-infection.patch @@ -27,13 +27,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/EntityZombie.java @@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster { @Override - public void a_(EntityLiving entityliving) { - super.a_(entityliving); -- if ((this.world.getDifficulty() == EnumDifficulty.NORMAL || this.world.getDifficulty() == EnumDifficulty.HARD) && entityliving instanceof EntityVillager) { -- if (this.world.getDifficulty() != EnumDifficulty.HARD && this.random.nextBoolean()) { + public void a(WorldServer worldserver, EntityLiving entityliving) { + super.a(worldserver, entityliving); +- if ((worldserver.getDifficulty() == EnumDifficulty.NORMAL || worldserver.getDifficulty() == EnumDifficulty.HARD) && entityliving instanceof EntityVillager) { +- if (worldserver.getDifficulty() != EnumDifficulty.HARD && this.random.nextBoolean()) { + // Paper start -+ if (world.paperConfig.zombieVillagerInfectionChance != 0.0 && (world.paperConfig.zombieVillagerInfectionChance != -1.0 || this.world.getDifficulty() == EnumDifficulty.NORMAL || this.world.getDifficulty() == EnumDifficulty.HARD) && entityliving instanceof EntityVillager) { -+ if (world.paperConfig.zombieVillagerInfectionChance == -1.0 && this.world.getDifficulty() != EnumDifficulty.HARD && this.random.nextBoolean()) { ++ if (world.paperConfig.zombieVillagerInfectionChance != 0.0 && (world.paperConfig.zombieVillagerInfectionChance != -1.0 || worldserver.getDifficulty() == EnumDifficulty.NORMAL || worldserver.getDifficulty() == EnumDifficulty.HARD) && entityliving instanceof EntityVillager) { ++ if (world.paperConfig.zombieVillagerInfectionChance == -1.0 && worldserver.getDifficulty() != EnumDifficulty.HARD && this.random.nextBoolean()) { return; } + if (world.paperConfig.zombieVillagerInfectionChance != -1.0 && (this.random.nextDouble() * 100.0) > world.paperConfig.zombieVillagerInfectionChance) { @@ -41,4 +41,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } // Paper end EntityVillager entityvillager = (EntityVillager) entityliving; - EntityZombieVillager entityzombievillager = (EntityZombieVillager) EntityTypes.ZOMBIE_VILLAGER.a(this.world); + // CraftBukkit start diff --git a/Spigot-Server-Patches/Configurable-end-credits.patch b/Spigot-Server-Patches/Configurable-end-credits.patch index 95723e15ee..f7d8f935a6 100644 --- a/Spigot-Server-Patches/Configurable-end-credits.patch +++ b/Spigot-Server-Patches/Configurable-end-credits.patch @@ -24,19 +24,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - private long ch = SystemUtils.getMonotonicMillis(); + private long ca = SystemUtils.getMonotonicMillis(); private Entity spectatedEntity; public boolean worldChangeInvuln; -- private boolean ck; -+ private boolean ck; private void setHasSeenCredits(boolean has) { this.ck = has; } // Paper - OBFHELPER +- private boolean cd; ++ private boolean cd; private void setHasSeenCredits(boolean has) { this.cd = has; } // Paper - OBFHELPER private final RecipeBookServer recipeBook = new RecipeBookServer(); - private Vec3D cm; - private int cn; + private Vec3D cf; + private int cg; @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + this.decouple(); this.getWorldServer().removePlayer(this); if (!this.viewingCredits) { - this.viewingCredits = true; + if (world.paperConfig.disableEndCredits) this.setHasSeenCredits(true); // Paper - Toggle to always disable end credits - this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.e, this.ck ? 0.0F : 1.0F)); - this.ck = true; - } + this.viewingCredits = true; + this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.e, this.cd ? 0.0F : 1.0F)); + this.cd = true; diff --git a/Spigot-Server-Patches/Configurable-fishing-time-ranges.patch b/Spigot-Server-Patches/Configurable-fishing-time-ranges.patch index c90f101c7b..dd5b6eff3e 100644 --- a/Spigot-Server-Patches/Configurable-fishing-time-ranges.patch +++ b/Spigot-Server-Patches/Configurable-fishing-time-ranges.patch @@ -26,13 +26,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/EntityFishingHook.java +++ b/src/main/java/net/minecraft/server/EntityFishingHook.java @@ -0,0 +0,0 @@ public class EntityFishingHook extends IProjectile { - this.ap = MathHelper.nextInt(this.random, 20, 80); + this.ai = MathHelper.nextInt(this.random, 20, 80); } } else { -- this.ao = MathHelper.nextInt(this.random, 100, 600); -+ this.ao = MathHelper.nextInt(this.random, world.paperConfig.fishingMinTicks, world.paperConfig.fishingMaxTicks); // Paper - this.ao -= this.av * 20 * 5; -+ this.ao = Math.max(0, this.ao); // Paper - Don't allow negative values; +- this.ah = MathHelper.nextInt(this.random, 100, 600); ++ this.ah = MathHelper.nextInt(this.random, world.paperConfig.fishingMinTicks, world.paperConfig.fishingMaxTicks); // Paper + this.ah -= this.ao * 20 * 5; } } - diff --git a/Spigot-Server-Patches/Configurable-top-of-nether-void-damage.patch b/Spigot-Server-Patches/Configurable-top-of-nether-void-damage.patch index 8c6619990c..1b302b0a63 100644 --- a/Spigot-Server-Patches/Configurable-top-of-nether-void-damage.patch +++ b/Spigot-Server-Patches/Configurable-top-of-nether-void-damage.patch @@ -41,7 +41,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Extracted to own function + /* if (this.locY() < -64.0D) { - this.ai(); + this.am(); } + */ + this.performVoidDamage(); @@ -50,7 +50,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (!this.world.isClientSide) { this.setFlag(0, this.fireTicks > 0); @@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - this.world.getMethodProfiler().exit(); + this.setFireTicks(0); } + // Paper start @@ -58,21 +58,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (this.locY() < -64.0D || (this.world.getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER + && world.paperConfig.doNetherTopVoidDamage() + && this.locY() >= world.paperConfig.netherVoidTopDamageHeight)) { -+ + this.doVoidDamage(); + } + } + // Paper end -+ - protected void E() { - if (this.portalCooldown > 0) { - --this.portalCooldown; -@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - this.setFireTicks(0); - } - -+ protected final void doVoidDamage() { this.ai(); } // Paper - OBFHELPER - protected void ai() { ++ protected final void doVoidDamage() { this.am(); } // Paper - OBFHELPER + protected void am() { this.die(); } diff --git a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java @@ -87,7 +78,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Extracted to own function + /* if (this.locY() < -64.0D) { - this.ai(); + this.am(); } + */ + this.performVoidDamage(); diff --git a/Spigot-Server-Patches/Custom-replacement-for-eaten-items.patch b/Spigot-Server-Patches/Custom-replacement-for-eaten-items.patch index b15a8f6f67..95aa3cc8e6 100644 --- a/Spigot-Server-Patches/Custom-replacement-for-eaten-items.patch +++ b/Spigot-Server-Patches/Custom-replacement-for-eaten-items.patch @@ -21,17 +21,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (event.isCancelled()) { @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { + } else { itemstack = this.activeItem.a(this.world, this); } - ++ + // Paper start - save the default replacement item and change it if necessary + final ItemStack defaultReplacement = itemstack; + if (event != null && event.getReplacement() != null) { + itemstack = CraftItemStack.asNMSCopy(event.getReplacement()); + } + // Paper end - this.a(this.getRaisedHand(), itemstack); // CraftBukkit end + + if (itemstack != this.activeItem) { +@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { + } + this.clearActiveItem(); + // Paper start - if the replacement is anything but the default, update the client inventory + if (this instanceof EntityPlayer && !com.google.common.base.Objects.equal(defaultReplacement, itemstack)) { diff --git a/Spigot-Server-Patches/Disable-explosion-knockback.patch b/Spigot-Server-Patches/Disable-explosion-knockback.patch index 4a190a8f62..c006445539 100644 --- a/Spigot-Server-Patches/Disable-explosion-knockback.patch +++ b/Spigot-Server-Patches/Disable-explosion-knockback.patch @@ -64,6 +64,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - if (!entityhuman.isSpectator() && (!entityhuman.isCreative() || !entityhuman.abilities.isFlying)) { + if (!entityhuman.isSpectator() && (!entityhuman.isCreative() || !entityhuman.abilities.isFlying) && !world.paperConfig.disableExplosionKnockback) { // Paper - Disable explosion knockback - this.m.put(entityhuman, new Vec3D(d8 * d13, d9 * d13, d10 * d13)); + this.n.put(entityhuman, new Vec3D(d8 * d13, d9 * d13, d10 * d13)); } } diff --git a/Spigot-Server-Patches/Disable-thunder.patch b/Spigot-Server-Patches/Disable-thunder.patch index afd1f5970d..94bfb5ea46 100644 --- a/Spigot-Server-Patches/Disable-thunder.patch +++ b/Spigot-Server-Patches/Disable-thunder.patch @@ -26,8 +26,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 gameprofilerfiller.enter("thunder"); BlockPosition blockposition; -- if (flag && this.T() && this.random.nextInt(100000) == 0) { -+ if (!this.paperConfig.disableThunder && flag && this.T() && this.random.nextInt(100000) == 0) { // Paper - Disable thunder +- if (flag && this.V() && this.random.nextInt(100000) == 0) { ++ if (!this.paperConfig.disableThunder && flag && this.V() && this.random.nextInt(100000) == 0) { // Paper - Disable thunder blockposition = this.a(this.a(j, 0, k, 15)); if (this.isRainingAt(blockposition)) { DifficultyDamageScaler difficultydamagescaler = this.getDamageScaler(blockposition); diff --git a/Spigot-Server-Patches/Do-less-work-if-we-have-a-custom-Bukkit-generator.patch b/Spigot-Server-Patches/Do-less-work-if-we-have-a-custom-Bukkit-generator.patch index 6fd63597f2..db0d833966 100644 --- a/Spigot-Server-Patches/Do-less-work-if-we-have-a-custom-Bukkit-generator.patch +++ b/Spigot-Server-Patches/Do-less-work-if-we-have-a-custom-Bukkit-generator.patch @@ -12,12 +12,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant list = worldchunkmanager.b(); - Random random = new Random(worldserver.getSeed()); -- BlockPosition blockposition = worldchunkmanager.a(0, worldserver.getSeaLevel(), 0, 256, list, random); +- BlockPosition blockposition = worldchunkmanager.a(0, worldserver.getSeaLevel(), 0, 256, (biomebase) -> { +- return biomebase.b().b(); +- }, random); - ChunkCoordIntPair chunkcoordintpair = blockposition == null ? new ChunkCoordIntPair(0, 0) : new ChunkCoordIntPair(blockposition); + // Paper start - moved down // CraftBukkit start @@ -30,9 +31,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start - if the generator created a spawn for us, then there is no need for us to also create a spawn - + // only do it if the generator did not + WorldChunkManager worldchunkmanager = chunkgenerator.getWorldChunkManager(); -+ List list = worldchunkmanager.b(); + Random random = new Random(worldserver.getSeed()); -+ BlockPosition blockposition = worldchunkmanager.a(0, worldserver.getSeaLevel(), 0, 256, list, random); ++ BlockPosition blockposition = worldchunkmanager.a(0, worldserver.getSeaLevel(), 0, 256, (biomebase) -> { ++ return biomebase.b().b(); ++ }, random); + ChunkCoordIntPair chunkcoordintpair = blockposition == null ? new ChunkCoordIntPair(0, 0) : new ChunkCoordIntPair(blockposition); + // Paper end diff --git a/Spigot-Server-Patches/Do-not-allow-bees-to-load-chunks-for-beehives.patch b/Spigot-Server-Patches/Do-not-allow-bees-to-load-chunks-for-beehives.patch index 521514d73d..9028abc3d3 100644 --- a/Spigot-Server-Patches/Do-not-allow-bees-to-load-chunks-for-beehives.patch +++ b/Spigot-Server-Patches/Do-not-allow-bees-to-load-chunks-for-beehives.patch @@ -27,7 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class EntityBee extends EntityAnimal implements IEntityAngerable, EntityB @Override public boolean g() { - if (EntityBee.this.hasHivePos() && EntityBee.this.fe() && EntityBee.this.hivePos.a((IPosition) EntityBee.this.getPositionVector(), 2.0D)) { + if (EntityBee.this.hasHivePos() && EntityBee.this.fd() && EntityBee.this.hivePos.a((IPosition) EntityBee.this.getPositionVector(), 2.0D)) { + if (!EntityBee.this.world.isLoadedAndInBounds(EntityBee.this.hivePos)) return false; // Paper TileEntity tileentity = EntityBee.this.world.getTileEntity(EntityBee.this.hivePos); diff --git a/Spigot-Server-Patches/Do-not-load-chunks-for-Pathfinding.patch b/Spigot-Server-Patches/Do-not-load-chunks-for-Pathfinding.patch index bd4db3be6c..756b6de907 100644 --- a/Spigot-Server-Patches/Do-not-load-chunks-for-Pathfinding.patch +++ b/Spigot-Server-Patches/Do-not-load-chunks-for-Pathfinding.patch @@ -49,8 +49,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (iblockdata.a(Blocks.CACTUS)) { return PathType.DANGER_CACTUS; @@ -0,0 +0,0 @@ public class PathfinderNormal extends PathfinderAbstract { - if (fluid.a((Tag) TagsFluid.LAVA)) { - return PathType.LAVA; + if (iblockaccess.getFluid(blockposition_mutableblockposition).a((Tag) TagsFluid.WATER)) { + return PathType.WATER_BORDER; } + } // Paper } diff --git a/Spigot-Server-Patches/Don-t-change-the-Entity-Random-seed-for-squids.patch b/Spigot-Server-Patches/Don-t-change-the-Entity-Random-seed-for-squids.patch index da14abf72b..16835ae2d1 100644 --- a/Spigot-Server-Patches/Don-t-change-the-Entity-Random-seed-for-squids.patch +++ b/Spigot-Server-Patches/Don-t-change-the-Entity-Random-seed-for-squids.patch @@ -14,6 +14,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 super(entitytypes, world); - this.random.setSeed((long) this.getId()); + //this.random.setSeed((long) this.getId()); // Paper - this.bB = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F; + this.bu = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F; } diff --git a/Spigot-Server-Patches/Don-t-check-ConvertSigns-boolean-every-sign-save.patch b/Spigot-Server-Patches/Don-t-check-ConvertSigns-boolean-every-sign-save.patch index ebe095889d..c4a6200bf9 100644 --- a/Spigot-Server-Patches/Don-t-check-ConvertSigns-boolean-every-sign-save.patch +++ b/Spigot-Server-Patches/Don-t-check-ConvertSigns-boolean-every-sign-save.patch @@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/TileEntitySign.java +++ b/src/main/java/net/minecraft/server/TileEntitySign.java @@ -0,0 +0,0 @@ public class TileEntitySign extends TileEntity implements ICommandListener { // - private final IChatFormatted[] g; + private final FormattedString[] g; private EnumColor color; public java.util.UUID signEditor; // Paper + private static final boolean CONVERT_LEGACY_SIGNS = Boolean.getBoolean("convertLegacySigns"); // Paper diff --git a/Spigot-Server-Patches/Don-t-let-fishinghooks-use-portals.patch b/Spigot-Server-Patches/Don-t-let-fishinghooks-use-portals.patch index ac41c2cb49..f27b00a383 100644 --- a/Spigot-Server-Patches/Don-t-let-fishinghooks-use-portals.patch +++ b/Spigot-Server-Patches/Don-t-let-fishinghooks-use-portals.patch @@ -4,19 +4,6 @@ Date: Fri, 16 Dec 2016 16:03:19 -0600 Subject: [PATCH] Don't let fishinghooks use portals -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - public boolean ac; - public boolean impulse; - public int portalCooldown; -- protected boolean inPortal; -+ protected boolean inPortal; public final boolean inPortal() { return this.inPortal; } // Paper - OBFHELPER - protected int portalTicks; - protected BlockPosition ah; - protected Vec3D ai; diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityFishingHook.java @@ -24,8 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class EntityFishingHook extends IProjectile { this.setMot(this.getMot().a(0.92D)); - this.ac(); -+ + this.ae(); + // Paper start - These shouldn't be going through portals + if (this.inPortal) { + this.die(); diff --git a/Spigot-Server-Patches/Don-t-lookup-game-profiles-that-have-no-UUID-and-no-.patch b/Spigot-Server-Patches/Don-t-lookup-game-profiles-that-have-no-UUID-and-no-.patch index 4526b7b73b..62ef06f5dc 100644 --- a/Spigot-Server-Patches/Don-t-lookup-game-profiles-that-have-no-UUID-and-no-.patch +++ b/Spigot-Server-Patches/Don-t-lookup-game-profiles-that-have-no-UUID-and-no-.patch @@ -9,11 +9,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/UserCache.java +++ b/src/main/java/net/minecraft/server/UserCache.java @@ -0,0 +0,0 @@ public class UserCache { - }; - gameprofilerepository.findProfilesByNames(new String[]{s}, Agent.MINECRAFT, profilelookupcallback); -- if (!d() && agameprofile[0] == null) { -+ if (!d() && agameprofile[0] == null && !org.apache.commons.lang3.StringUtils.isBlank(s)) { // Paper - Don't lookup a profile with a blank name - UUID uuid = EntityHuman.a(new GameProfile((UUID) null, s)); - GameProfile gameprofile = new GameProfile(uuid, s); + GameProfile gameprofile = (GameProfile) atomicreference.get(); +- if (!c() && gameprofile == null) { ++ if (!c() && gameprofile == null && !org.apache.commons.lang3.StringUtils.isBlank(s)) { // Paper - Don't lookup a profile with a blank name + UUID uuid = EntityHuman.a(new GameProfile((UUID) null, s)); + + gameprofile = new GameProfile(uuid, s); diff --git a/Spigot-Server-Patches/Don-t-mark-null-chunk-sections-for-block-updates.patch b/Spigot-Server-Patches/Don-t-mark-null-chunk-sections-for-block-updates.patch new file mode 100644 index 0000000000..b718c4c741 --- /dev/null +++ b/Spigot-Server-Patches/Don-t-mark-null-chunk-sections-for-block-updates.patch @@ -0,0 +1,18 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Mariell Hoversholm +Date: Fri, 14 Aug 2020 23:41:19 +0200 +Subject: [PATCH] Don't mark null chunk sections for block updates + + +diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/PlayerChunk.java ++++ b/src/main/java/net/minecraft/server/PlayerChunk.java +@@ -0,0 +0,0 @@ public class PlayerChunk { + this.a(world, blockposition, iblockdata); + } else { + ChunkSection chunksection = chunk.getSections()[sectionposition.getY()]; ++ if (chunksection == null) chunksection = new ChunkSection(sectionposition.getY(), chunk, world, true); // Paper - make a new chunk section if none was found + PacketPlayOutMultiBlockChange packetplayoutmultiblockchange = new PacketPlayOutMultiBlockChange(sectionposition, shortset, chunksection, this.x); + + this.a(packetplayoutmultiblockchange, false); diff --git a/Spigot-Server-Patches/Don-t-move-existing-players-to-world-spawn.patch b/Spigot-Server-Patches/Don-t-move-existing-players-to-world-spawn.patch index 875b09ea4f..ec87e6d681 100644 --- a/Spigot-Server-Patches/Don-t-move-existing-players-to-world-spawn.patch +++ b/Spigot-Server-Patches/Don-t-move-existing-players-to-world-spawn.patch @@ -17,8 +17,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.serverStatisticManager = minecraftserver.getPlayerList().getStatisticManager(this); this.advancementDataPlayer = minecraftserver.getPlayerList().f(this); this.G = 1.0F; -- this.b(worldserver); -+ //this.b(worldserver); // Paper - don't move to spawn on login, only first join +- this.c(worldserver); ++ //this.c(worldserver); // Paper - don't move to spawn on login, only first join this.cachedSingleHashSet = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<>(this); // Paper @@ -26,8 +26,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } // CraftBukkit end -+ public final void moveToSpawn(WorldServer worldserver) { b(worldserver); } // Paper - OBFHELPER - private void b(WorldServer worldserver) { ++ public final void moveToSpawn(WorldServer worldserver) { c(worldserver); } // Paper - OBFHELPER + private void c(WorldServer worldserver) { BlockPosition blockposition = worldserver.getSpawn(); @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { diff --git a/Spigot-Server-Patches/Don-t-require-FACING-data.patch b/Spigot-Server-Patches/Don-t-require-FACING-data.patch new file mode 100644 index 0000000000..08a415add6 --- /dev/null +++ b/Spigot-Server-Patches/Don-t-require-FACING-data.patch @@ -0,0 +1,35 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Mariell Hoversholm +Date: Sun, 23 Aug 2020 19:01:04 +0200 +Subject: [PATCH] Don't require FACING data + + +diff --git a/src/main/java/net/minecraft/server/DispenseBehaviorItem.java b/src/main/java/net/minecraft/server/DispenseBehaviorItem.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/DispenseBehaviorItem.java ++++ b/src/main/java/net/minecraft/server/DispenseBehaviorItem.java +@@ -0,0 +0,0 @@ import org.bukkit.event.block.BlockDispenseEvent; + // CraftBukkit end + + public class DispenseBehaviorItem implements IDispenseBehavior { ++ private EnumDirection enumdirection; // Paper + + public DispenseBehaviorItem() {} + + @Override + public final ItemStack dispense(ISourceBlock isourceblock, ItemStack itemstack) { ++ enumdirection = isourceblock.getBlockData().get(BlockDispenser.FACING); // Paper - cache facing direction + ItemStack itemstack1 = this.a(isourceblock, itemstack); + + this.a(isourceblock); +- this.a(isourceblock, (EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING)); ++ this.a(isourceblock, enumdirection); // Paper - cache facing direction + return itemstack1; + } + + protected ItemStack a(ISourceBlock isourceblock, ItemStack itemstack) { +- EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING); ++ // Paper - cached enum direction + IPosition iposition = BlockDispenser.a(isourceblock); + ItemStack itemstack1 = itemstack.cloneAndSubtract(1); + diff --git a/Spigot-Server-Patches/Duplicate-UUID-Resolve-Option.patch b/Spigot-Server-Patches/Duplicate-UUID-Resolve-Option.patch index c541487bda..fe838c4214 100644 --- a/Spigot-Server-Patches/Duplicate-UUID-Resolve-Option.patch +++ b/Spigot-Server-Patches/Duplicate-UUID-Resolve-Option.patch @@ -103,7 +103,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public final void setUUID(UUID uuid) { a_(uuid); } // Paper - OBFHELPER public void a_(UUID uuid) { this.uniqueID = uuid; - this.al = this.uniqueID.toString(); + this.ae = this.uniqueID.toString(); diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java @@ -200,7 +200,7 @@ diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -0,0 +0,0 @@ import com.google.common.collect.ImmutableList; +@@ -0,0 +0,0 @@ import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.Iterables; import co.aikar.timings.TimingHistory; // Paper import co.aikar.timings.Timings; // Paper @@ -213,16 +213,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (entity1 == null) { return false; } else { -- WorldServer.LOGGER.error("Keeping entity {} that already exists with UUID {}", EntityTypes.getName(entity1.getEntityType()), entity.getUniqueID().toString()); // CraftBukkit // paper + // Paper start + if (entity1.dead) { + unregisterEntity(entity1); // remove the existing entity + return false; + } + // Paper end -+ WorldServer.LOGGER.error("Keeping entity {} that already exists with UUID {}", entity1, entity.getUniqueID().toString()); // CraftBukkit // paper - WorldServer.LOGGER.error("Deleting duplicate entity {}", entity); // CraftBukkit // paper -+ + WorldServer.LOGGER.warn("Trying to add entity with duplicated UUID {}. Existing {}#{}, new: {}#{}", uuid, EntityTypes.getName(entity1.getEntityType()), entity1.getId(), EntityTypes.getName(entity.getEntityType()), entity.getId()); // CraftBukkit // Paper + // Paper start + if (DEBUG_ENTITIES && entity.world.paperConfig.duplicateUUIDMode != PaperWorldConfig.DuplicateUUIDMode.NOTHING) { + if (entity1.addedToWorldStack != null) { diff --git a/Spigot-Server-Patches/EnderDragon-Events.patch b/Spigot-Server-Patches/EnderDragon-Events.patch index 35ea45a96c..ef0a19b150 100644 --- a/Spigot-Server-Patches/EnderDragon-Events.patch +++ b/Spigot-Server-Patches/EnderDragon-Events.patch @@ -44,7 +44,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + else entitydragonfireball.die(); // Paper this.c = 0; if (this.d != null) { - while (!this.d.b()) { + while (!this.d.c()) { diff --git a/src/main/java/net/minecraft/server/EntityDragonFireball.java b/src/main/java/net/minecraft/server/EntityDragonFireball.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityDragonFireball.java diff --git a/Spigot-Server-Patches/Enderman.teleportRandomly.patch b/Spigot-Server-Patches/Enderman.teleportRandomly.patch index 9acdb7359d..c797bd6630 100644 --- a/Spigot-Server-Patches/Enderman.teleportRandomly.patch +++ b/Spigot-Server-Patches/Enderman.teleportRandomly.patch @@ -13,8 +13,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 super.mobTick(); } -+ public final boolean teleportRandomly() { return this.eM(); } // Paper - OBFHELPER - protected boolean eM() { ++ public final boolean teleportRandomly() { return this.eL(); } // Paper - OBFHELPER + protected boolean eL() { if (!this.world.s_() && this.isAlive()) { double d0 = this.locX() + (this.random.nextDouble() - 0.5D) * 64.0D; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java diff --git a/Spigot-Server-Patches/EndermanEscapeEvent.patch b/Spigot-Server-Patches/EndermanEscapeEvent.patch index 51f67b3941..582906b5f7 100644 --- a/Spigot-Server-Patches/EndermanEscapeEvent.patch +++ b/Spigot-Server-Patches/EndermanEscapeEvent.patch @@ -33,13 +33,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public boolean setGoalTarget(EntityLiving entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fireEvent) { if (!super.setGoalTarget(entityliving, reason, fireEvent)) { @@ -0,0 +0,0 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { - if (this.world.isDay() && this.ticksLived >= this.bz + 600) { - float f = this.aO(); + if (this.world.isDay() && this.ticksLived >= this.bs + 600) { + float f = this.aQ(); -- if (f > 0.5F && this.world.f(this.getChunkCoordinates()) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) { -+ if (f > 0.5F && this.world.f(this.getChunkCoordinates()) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.tryEscape(EndermanEscapeEvent.Reason.RUNAWAY)) { // Paper +- if (f > 0.5F && this.world.e(this.getChunkCoordinates()) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) { ++ if (f > 0.5F && this.world.e(this.getChunkCoordinates()) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.tryEscape(EndermanEscapeEvent.Reason.RUNAWAY)) { // Paper this.setGoalTarget((EntityLiving) null); - this.eM(); + this.eL(); } @@ -0,0 +0,0 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { if (this.isInvulnerable(damagesource)) { @@ -47,7 +47,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } else if (damagesource instanceof EntityDamageSourceIndirect) { + if (this.tryEscape(EndermanEscapeEvent.Reason.INDIRECT)) { // Paper start for (int i = 0; i < 64; ++i) { - if (this.eM()) { + if (this.eL()) { return true; } } @@ -57,9 +57,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } else { boolean flag = super.damageEntity(damagesource, f); -- if (!this.world.s_() && this.random.nextInt(10) != 0) { -+ if (!this.world.s_() && this.random.nextInt(10) != 0 && this.tryEscape(damagesource == DamageSource.DROWN ? EndermanEscapeEvent.Reason.DROWN : EndermanEscapeEvent.Reason.CRITICAL_HIT)) { // Paper - this.eM(); +- if (!this.world.s_() && !(damagesource.getEntity() instanceof EntityLiving) && this.random.nextInt(10) != 0) { ++ if (!this.world.s_() && !(damagesource.getEntity() instanceof EntityLiving) && this.random.nextInt(10) != 0 && this.tryEscape(damagesource == DamageSource.DROWN ? EndermanEscapeEvent.Reason.DROWN : EndermanEscapeEvent.Reason.INDIRECT)) { // Paper - use to be critical hits as else, but mojang removed critical hits in 1.16.2 due to MC-185684 + this.eL(); } @@ -0,0 +0,0 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { @@ -76,7 +76,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (this.c != null && !this.i.isPassenger()) { if (this.i.g((EntityHuman) this.c)) { - if (this.c.h((Entity) this.i) < 16.0D) { -+ if (this.c.h((Entity) this.i) < 16.0D && this.getEnderman().tryEscape(EndermanEscapeEvent.Reason.STARE)) { - this.i.eM(); ++ if (this.c.h((Entity) this.i) < 16.0D && this.getEnderman().tryEscape(EndermanEscapeEvent.Reason.STARE)) { // Paper + this.i.eL(); } diff --git a/Spigot-Server-Patches/Ensure-Entity-AABB-s-are-never-invalid.patch b/Spigot-Server-Patches/Ensure-Entity-AABB-s-are-never-invalid.patch index 77f5bba843..a333dff3ee 100644 --- a/Spigot-Server-Patches/Ensure-Entity-AABB-s-are-never-invalid.patch +++ b/Spigot-Server-Patches/Ensure-Entity-AABB-s-are-never-invalid.patch @@ -8,99 +8,12 @@ diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -0,0 +0,0 @@ - package net.minecraft.server; - -+import co.aikar.timings.MinecraftTimings; -+import co.aikar.timings.Timing; - import com.google.common.collect.Iterables; - import com.google.common.collect.Lists; - import com.google.common.collect.Sets; - import it.unimi.dsi.fastutil.objects.Object2DoubleArrayMap; - import it.unimi.dsi.fastutil.objects.Object2DoubleMap; --import java.util.Arrays; --import java.util.Collection; --import java.util.Collections; --import java.util.Iterator; --import java.util.List; --import java.util.Locale; --import java.util.Optional; --import java.util.Random; --import java.util.Set; --import java.util.UUID; --import java.util.concurrent.atomic.AtomicInteger; --import java.util.stream.Stream; --import javax.annotation.Nullable; - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; -- --// CraftBukkit start - import org.bukkit.Bukkit; - import org.bukkit.Server; - import org.bukkit.block.BlockFace; - import org.bukkit.command.CommandSender; --import org.bukkit.entity.Hanging; --import org.bukkit.entity.LivingEntity; --import org.bukkit.entity.Vehicle; --import co.aikar.timings.MinecraftTimings; // Paper --import co.aikar.timings.Timing; // Paper --import org.bukkit.event.entity.EntityCombustByEntityEvent; --import org.bukkit.event.hanging.HangingBreakByEntityEvent; --import org.bukkit.event.vehicle.VehicleBlockCollisionEvent; --import org.bukkit.event.vehicle.VehicleEnterEvent; --import org.bukkit.event.vehicle.VehicleExitEvent; - import org.bukkit.craftbukkit.CraftWorld; - import org.bukkit.craftbukkit.entity.CraftEntity; - import org.bukkit.craftbukkit.entity.CraftPlayer; - import org.bukkit.craftbukkit.event.CraftEventFactory; -+import org.bukkit.entity.Hanging; -+import org.bukkit.entity.LivingEntity; - import org.bukkit.entity.Pose; -+import org.bukkit.entity.Vehicle; - import org.bukkit.event.entity.EntityAirChangeEvent; -+import org.bukkit.event.entity.EntityCombustByEntityEvent; - import org.bukkit.event.entity.EntityCombustEvent; - import org.bukkit.event.entity.EntityDropItemEvent; - import org.bukkit.event.entity.EntityPortalEvent; - import org.bukkit.event.entity.EntityPoseChangeEvent; -+import org.bukkit.event.hanging.HangingBreakByEntityEvent; - import org.bukkit.event.player.PlayerTeleportEvent; -+import org.bukkit.event.vehicle.VehicleBlockCollisionEvent; -+import org.bukkit.event.vehicle.VehicleEnterEvent; -+import org.bukkit.event.vehicle.VehicleExitEvent; - import org.bukkit.plugin.PluginManager; -+ -+import javax.annotation.Nullable; -+import java.util.Arrays; -+import java.util.Collection; -+import java.util.Collections; -+import java.util.Iterator; -+import java.util.List; -+import java.util.Locale; -+import java.util.Optional; -+import java.util.Random; -+import java.util.Set; -+import java.util.UUID; -+import java.util.concurrent.atomic.AtomicInteger; -+import java.util.stream.Stream; -+ -+// CraftBukkit start - // CraftBukkit end - - public abstract class Entity implements INamableTileEntity, ICommandListener, KeyedObject { // Paper @@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke public void setPosition(double d0, double d1, double d2) { this.setPositionRaw(d0, d1, d2); -- float f = this.size.width / 2.0F; -- float f1 = this.size.height; -+ // Paper start - move into setPositionRaw -+ //float f = this.size.width / 2.0F; -+ //float f1 = this.size.height; - -- this.a(new AxisAlignedBB(d0 - (double) f, d1, d2 - (double) f, d0 + (double) f, d1 + (double) f1, d2 + (double) f)); -+ //this.a(new AxisAlignedBB(d0 - (double) f, d1, d2 - (double) f, d0 + (double) f, d1 + (double) f1, d2 + (double) f)); -+ // Paper end +- this.a(this.size.a(d0, d1, d2)); ++ //this.a(this.size.a(d0, d1, d2)); // Paper - move into setPositionRaw if (valid) ((WorldServer) world).chunkCheck(this); // CraftBukkit } @@ -119,9 +32,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start - never allow AABB to become desynced from position + // hanging has its own special logic + if (!(this instanceof EntityHanging) && (this.loc.x != d0 || this.loc.y != d1 || this.loc.z != d2)) { -+ float f = this.size.width / 2.0F; -+ float f1 = this.size.height; -+ this.setBoundingBox(new AxisAlignedBB(d0 - (double) f, d1, d2 - (double) f, d0 + (double) f, d1 + (double) f1, d2 + (double) f)); ++ this.setBoundingBox(this.size.a(d0, d1, d2)); + } + // Paper end if (this.loc.x != d0 || this.loc.y != d1 || this.loc.z != d2) { diff --git a/Spigot-Server-Patches/Ensure-Entity-is-never-double-registered.patch b/Spigot-Server-Patches/Ensure-Entity-is-never-double-registered.patch index 5247e488c2..9f0c804159 100644 --- a/Spigot-Server-Patches/Ensure-Entity-is-never-double-registered.patch +++ b/Spigot-Server-Patches/Ensure-Entity-is-never-double-registered.patch @@ -76,4 +76,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + entity.isQueuedForRegister = false; // Paper this.entitiesById.put(entity.getId(), entity); if (entity instanceof EntityEnderDragon) { - EntityComplexPart[] aentitycomplexpart = ((EntityEnderDragon) entity).eK(); + EntityComplexPart[] aentitycomplexpart = ((EntityEnderDragon) entity).eJ(); diff --git a/Spigot-Server-Patches/Ensure-EntityRaider-respects-game-and-entity-rules-f.patch b/Spigot-Server-Patches/Ensure-EntityRaider-respects-game-and-entity-rules-f.patch index 18a1927e0b..c13ad11390 100644 --- a/Spigot-Server-Patches/Ensure-EntityRaider-respects-game-and-entity-rules-f.patch +++ b/Spigot-Server-Patches/Ensure-EntityRaider-respects-game-and-entity-rules-f.patch @@ -23,6 +23,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override public boolean a() { + if (!getRaider().world.getGameRules().getBoolean(GameRules.MOB_GRIEFING) || !getRaider().canPickupLoot()) return false; // Paper - respect game and entity rules for picking up items - Raid raid = this.b.fb(); + Raid raid = this.b.fa(); - if (this.b.fc() && !this.b.fb().a() && this.b.eO() && !ItemStack.matches(this.b.getEquipment(EnumItemSlot.HEAD), Raid.s())) { + if (this.b.fb() && !this.b.fa().a() && this.b.eN() && !ItemStack.matches(this.b.getEquipment(EnumItemSlot.HEAD), Raid.s())) { diff --git a/Spigot-Server-Patches/Ensure-safe-gateway-teleport.patch b/Spigot-Server-Patches/Ensure-safe-gateway-teleport.patch index 477b3b7fed..fda28f4b91 100644 --- a/Spigot-Server-Patches/Ensure-safe-gateway-teleport.patch +++ b/Spigot-Server-Patches/Ensure-safe-gateway-teleport.patch @@ -9,16 +9,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/TileEntityEndGateway.java +++ b/src/main/java/net/minecraft/server/TileEntityEndGateway.java @@ -0,0 +0,0 @@ public class TileEntityEndGateway extends TileEntityEnderPortal implements ITick - --this.c; } else if (!this.world.isClientSide) { - List list = this.world.a(Entity.class, new AxisAlignedBB(this.getPosition())); -- + List list = this.world.a(Entity.class, new AxisAlignedBB(this.getPosition()), TileEntityEndGateway::a); + - if (!list.isEmpty()) { -- this.a((Entity) list.get(this.world.random.nextInt(list.size()))); +- this.b((Entity) list.get(this.world.random.nextInt(list.size()))); + // Paper start + for (Entity entity : list) { + if (entity.canPortal()) { -+ this.a(entity); ++ this.b(entity); + break; + } } diff --git a/Spigot-Server-Patches/Entity-Activation-Range-2.0.patch b/Spigot-Server-Patches/Entity-Activation-Range-2.0.patch index 71094e7dd4..2da75b46b5 100644 --- a/Spigot-Server-Patches/Entity-Activation-Range-2.0.patch +++ b/Spigot-Server-Patches/Entity-Activation-Range-2.0.patch @@ -18,14 +18,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - public boolean ac; + public boolean Y; public boolean impulse; public int portalCooldown; -- protected boolean inPortal; public final boolean inPortal() { return this.inPortal; } // Paper - OBFHELPER +- protected boolean inPortal; + public boolean inPortal; // Paper - public protected int portalTicks; - protected BlockPosition ah; - protected Vec3D ai; + protected BlockPosition ac; + private boolean invulnerable; @@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke public final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this); public final boolean defaultActivationState; @@ -39,7 +39,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } else { if (enummovetype == EnumMoveType.PISTON) { + this.activatedTick = MinecraftServer.currentTick + 20; // Paper - vec3d = this.a(vec3d); + vec3d = this.b(vec3d); if (vec3d.equals(Vec3D.a)) { return; @@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -55,9 +55,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end vec3d = this.a(vec3d, enummovetype); - Vec3D vec3d1 = this.f(vec3d); + Vec3D vec3d1 = this.g(vec3d); @@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - return this.al; + return this.ae; } + public final boolean isPushedByWater() { return this.bU(); } // Paper - OBFHELPER - the below is not an obfhelper, don't use it! @@ -86,9 +86,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Nullable - private Entity leashHolder; + public Entity leashHolder; // Paper - private -> public - private int bE; + private int bx; @Nullable - private NBTTagCompound bF; + private NBTTagCompound by; @@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving { return this.lookController; } @@ -112,25 +112,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { - protected float aU; - protected int aV; protected int getKillCount() { return this.aV; } // Paper - OBFHELPER + protected float aN; + protected int aO;protected int getKillCount() { return this.aO; } // Paper - OBFHELPER public float lastDamage; - protected boolean jumping; + public boolean jumping; // Paper protected -> public - public float aY; - public float aZ; - public float ba; + public float aR; + public float aS; + public float aT; diff --git a/src/main/java/net/minecraft/server/EntityLlama.java b/src/main/java/net/minecraft/server/EntityLlama.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityLlama.java +++ b/src/main/java/net/minecraft/server/EntityLlama.java @@ -0,0 +0,0 @@ public class EntityLlama extends EntityHorseChestedAbstract implements IRangedEn - return this.bJ != null; + return this.bC != null; } -+ public final boolean inCaravan() { return this.fD(); } // Paper - OBFHELPER - public boolean fD() { - return this.bI != null; ++ public final boolean inCaravan() { return this.fC(); } // Paper - OBFHELPER + public boolean fC() { + return this.bB != null; } diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 @@ -166,22 +166,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + protected void mobTick(boolean inactive) { this.world.getMethodProfiler().enter("villagerBrain"); - this.getBehaviorController().a((WorldServer) this.world, this); // CraftBukkit - decompile error -- this.world.getMethodProfiler().exit(); + if (!inactive) this.getBehaviorController().a((WorldServer) this.world, this); // CraftBukkit - decompile error // Paper - if (this.bM) { - this.bM = false; - } + this.world.getMethodProfiler().exit(); + if (this.bF) { + this.bF = false; @@ -0,0 +0,0 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation - this.bC = null; + this.bv = null; } - if (!this.isNoAI() && this.random.nextInt(100) == 0) { + if (!inactive && !this.isNoAI() && this.random.nextInt(100) == 0) { // Paper - Raid raid = ((WorldServer) this.world).c_(this.getChunkCoordinates()); + Raid raid = ((WorldServer) this.world).b_(this.getChunkCoordinates()); if (raid != null && raid.v() && !raid.a()) { @@ -0,0 +0,0 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation - if (this.getVillagerData().getProfession() == VillagerProfession.NONE && this.eO()) { + if (this.getVillagerData().getProfession() == VillagerProfession.NONE && this.eN()) { this.eT(); } + if (inactive) return; // Paper @@ -192,8 +191,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } -+ private void doReputationTick() { fv(); } // Paper - OBFHELPER - private void fv() { ++ private void doReputationTick() { fw(); } // Paper - OBFHELPER + private void fw() { long i = this.world.getTime(); diff --git a/src/main/java/net/minecraft/server/EntityVillagerAbstract.java b/src/main/java/net/minecraft/server/EntityVillagerAbstract.java @@ -201,17 +200,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/EntityVillagerAbstract.java +++ b/src/main/java/net/minecraft/server/EntityVillagerAbstract.java @@ -0,0 +0,0 @@ public abstract class EntityVillagerAbstract extends EntityAgeable implements NP - return super.prepare(generatoraccess, difficultydamagescaler, enummobspawn, (GroupDataEntity) groupdataentity, nbttagcompound); + return super.prepare(worldaccess, difficultydamagescaler, enummobspawn, (GroupDataEntity) groupdataentity, nbttagcompound); } -+ public final int getUnhappy() { return eL(); } // Paper - OBFHELPER - public int eL() { - return (Integer) this.datawatcher.get(EntityVillagerAbstract.bw); ++ public final int getUnhappy() { return eK(); } // Paper - OBFHELPER + public int eK() { + return (Integer) this.datawatcher.get(EntityVillagerAbstract.bp); } + public final void setUnhappy(int i) { s(i); } // Paper - OBFHELPER public void s(int i) { - this.datawatcher.set(EntityVillagerAbstract.bw, i); + this.datawatcher.set(EntityVillagerAbstract.bp, i); } diff --git a/src/main/java/net/minecraft/server/PathfinderGoal.java b/src/main/java/net/minecraft/server/PathfinderGoal.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 @@ -243,8 +242,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 protected int c; protected int d; private int g; -- protected BlockPosition e; -+ protected BlockPosition e; public BlockPosition getTarget() { return e; } public void setTarget(BlockPosition pos) { this.e = pos; getEntity().movingTarget = pos != BlockPosition.ZERO ? pos : null; } // Paper - OBFHELPER +- protected BlockPosition e;public final BlockPosition getTargetPosition() { return this.e; } // Paper - OBFHELPER ++ protected BlockPosition e; public final BlockPosition getTargetPosition() { return this.e; } public void setTargetPosition(BlockPosition pos) { this.e = pos; getEntity().movingTarget = pos != BlockPosition.ZERO ? pos : null; } // Paper - OBFHELPER private boolean h; private final int i; private final int j; @@ -256,7 +255,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @Override + public void onTaskReset() { + super.onTaskReset(); -+ setTarget(BlockPosition.ZERO); ++ setTargetPosition(BlockPosition.ZERO); + } + // Paper end @@ -266,7 +265,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 blockposition_mutableblockposition.a((BaseBlockPosition) blockposition, i1, k - 1, j1); if (this.a.a((BlockPosition) blockposition_mutableblockposition) && this.a(this.a.world, blockposition_mutableblockposition)) { this.e = blockposition_mutableblockposition; -+ setTarget(blockposition_mutableblockposition.immutableCopy()); // Paper ++ setTargetPosition(blockposition_mutableblockposition.immutableCopy()); // Paper return true; } } diff --git a/Spigot-Server-Patches/Entity-Jump-API.patch b/Spigot-Server-Patches/Entity-Jump-API.patch index da44758b6a..3de6c1dcc6 100644 --- a/Spigot-Server-Patches/Entity-Jump-API.patch +++ b/Spigot-Server-Patches/Entity-Jump-API.patch @@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { - } else if (this.aN() && (!this.onGround || d7 > d8)) { + } else if (this.aP() && (!this.onGround || d7 > d8)) { this.c((Tag) TagsFluid.LAVA); } else if ((this.onGround || flag && d7 <= d8) && this.jumpTicks == 0) { + if (new com.destroystokyo.paper.event.entity.EntityJumpEvent(getBukkitLivingEntity()).callEvent()) { // Paper @@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class EntityPanda extends EntityAnimal { EntityPanda entitypanda = (EntityPanda) iterator.next(); - if (!entitypanda.isBaby() && entitypanda.onGround && !entitypanda.isInWater() && entitypanda.fi()) { + if (!entitypanda.isBaby() && entitypanda.onGround && !entitypanda.isInWater() && entitypanda.fh()) { + if (new com.destroystokyo.paper.event.entity.EntityJumpEvent(getBukkitLivingEntity()).callEvent()) { // Paper entitypanda.jump(); + } else { this.setJumping(false); } // Paper - setJumping(false) stops a potential loop diff --git a/Spigot-Server-Patches/Entity-fromMobSpawner.patch b/Spigot-Server-Patches/Entity-fromMobSpawner.patch index 62c20bc626..48b9e4424a 100644 --- a/Spigot-Server-Patches/Entity-fromMobSpawner.patch +++ b/Spigot-Server-Patches/Entity-fromMobSpawner.patch @@ -41,13 +41,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java @@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract { + } + // Spigot End } - // Spigot End - } + entity.spawnedViaMobSpawner = true; // Paper - // Spigot Start - if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, blockposition).isCancelled()) { - Entity vehicle = entity.getVehicle(); + // Spigot Start + if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, blockposition).isCancelled()) { + Entity vehicle = entity.getVehicle(); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java diff --git a/Spigot-Server-Patches/Entity-getEntitySpawnReason.patch b/Spigot-Server-Patches/Entity-getEntitySpawnReason.patch index 7dc4b1a3e8..4eab3abf73 100644 --- a/Spigot-Server-Patches/Entity-getEntitySpawnReason.patch +++ b/Spigot-Server-Patches/Entity-getEntitySpawnReason.patch @@ -63,13 +63,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java @@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract { - // Spigot End - } + // Spigot End + } entity.spawnedViaMobSpawner = true; // Paper -+ entity.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER; // Paper - // Spigot Start - flag = true; // Paper - if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, blockposition).isCancelled()) { ++ entity.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER; // Paper + flag = true; // Paper + // Spigot Start + if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, blockposition).isCancelled()) { diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java diff --git a/Spigot-Server-Patches/EntityPathfindEvent.patch b/Spigot-Server-Patches/EntityPathfindEvent.patch index ce1659a0b7..fc162ac9f9 100644 --- a/Spigot-Server-Patches/EntityPathfindEvent.patch +++ b/Spigot-Server-Patches/EntityPathfindEvent.patch @@ -61,7 +61,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return null; } else if (this.a.locY() < 0.0D) { @@ -0,0 +0,0 @@ public abstract class NavigationAbstract { - } else if (this.c != null && !this.c.b() && set.contains(this.p)) { + } else if (this.c != null && !this.c.c() && set.contains(this.p)) { return this.c; } else { + // Paper start - Pathfind event diff --git a/Spigot-Server-Patches/EntityTransformedEvent.patch b/Spigot-Server-Patches/EntityTransformedEvent.patch deleted file mode 100644 index 0d5fbe354f..0000000000 --- a/Spigot-Server-Patches/EntityTransformedEvent.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Anthony MacAllister -Date: Thu, 26 Jul 2018 15:30:03 -0400 -Subject: [PATCH] EntityTransformedEvent - - -diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityInsentient.java -+++ b/src/main/java/net/minecraft/server/EntityInsentient.java -@@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving { - if (CraftEventFactory.callEntityTransformEvent(this, t0, EntityTransformEvent.TransformReason.DROWNED).isCancelled()) { - return null; - } -+ if (!new com.destroystokyo.paper.event.entity.EntityTransformedEvent(this.getBukkitEntity(), t0.getBukkitEntity(), com.destroystokyo.paper.event.entity.EntityTransformedEvent.TransformedReason.DROWNED).callEvent()) return null; // Paper - this.world.addEntity(t0, CreatureSpawnEvent.SpawnReason.DROWNED); - // CraftBukkit end - this.die(); -diff --git a/src/main/java/net/minecraft/server/EntityMushroomCow.java b/src/main/java/net/minecraft/server/EntityMushroomCow.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityMushroomCow.java -+++ b/src/main/java/net/minecraft/server/EntityMushroomCow.java -@@ -0,0 +0,0 @@ public class EntityMushroomCow extends EntityCow implements IShearable { - if (CraftEventFactory.callEntityTransformEvent(this, entitycow, EntityTransformEvent.TransformReason.SHEARED).isCancelled()) { - return; - } -+ if (!new com.destroystokyo.paper.event.entity.EntityTransformedEvent(this.getBukkitEntity(), entitycow.getBukkitEntity(), com.destroystokyo.paper.event.entity.EntityTransformedEvent.TransformedReason.SHEARED).callEvent()) return; // Paper - this.world.addEntity(entitycow, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SHEARED); - - this.die(); // CraftBukkit - from above -diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityVillager.java -+++ b/src/main/java/net/minecraft/server/EntityVillager.java -@@ -0,0 +0,0 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation - if (CraftEventFactory.callEntityTransformEvent(this, entitywitch, EntityTransformEvent.TransformReason.LIGHTNING).isCancelled()) { - return; - } -+ if (!new com.destroystokyo.paper.event.entity.EntityTransformedEvent(this.getBukkitEntity(), entitywitch.getBukkitEntity(), com.destroystokyo.paper.event.entity.EntityTransformedEvent.TransformedReason.LIGHTNING).callEvent()) return; // Paper - this.world.addEntity(entitywitch, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING); - // CraftBukkit end - this.die(); -diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityZombie.java -+++ b/src/main/java/net/minecraft/server/EntityZombie.java -@@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster { - if (CraftEventFactory.callEntityTransformEvent(this, entityzombievillager, EntityTransformEvent.TransformReason.INFECTION).isCancelled()) { - return; - } -+ if (!new com.destroystokyo.paper.event.entity.EntityTransformedEvent(this.getBukkitEntity(), entityvillager.getBukkitEntity(), com.destroystokyo.paper.event.entity.EntityTransformedEvent.TransformedReason.INFECTED).callEvent()) return; // Paper - entityvillager.die(); // CraftBukkit - from above - this.world.addEntity(entityzombievillager, CreatureSpawnEvent.SpawnReason.INFECTION); // CraftBukkit - add SpawnReason - // CraftBukkit end -diff --git a/src/main/java/net/minecraft/server/EntityZombieVillager.java b/src/main/java/net/minecraft/server/EntityZombieVillager.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityZombieVillager.java -+++ b/src/main/java/net/minecraft/server/EntityZombieVillager.java -@@ -0,0 +0,0 @@ public class EntityZombieVillager extends EntityZombie implements VillagerDataHo - ((ZombieVillager) getBukkitEntity()).setConversionTime(-1); // SPIGOT-5208: End conversion to stop event spam - return; - } -+ if (!new com.destroystokyo.paper.event.entity.EntityTransformedEvent(this.getBukkitEntity(), entityvillager.getBukkitEntity(), com.destroystokyo.paper.event.entity.EntityTransformedEvent.TransformedReason.CURED).callEvent()) return; // Paper - this.die(); // CraftBukkit - from above - worldserver.addEntity(entityvillager, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CURED); // CraftBukkit - add SpawnReason - // CraftBukkit end diff --git a/Spigot-Server-Patches/ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch b/Spigot-Server-Patches/ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch index 0d0006482c..bdbc3c1a61 100644 --- a/Spigot-Server-Patches/ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch +++ b/Spigot-Server-Patches/ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch @@ -15,15 +15,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } -- protected void dropExperience(World world, BlockPosition blockposition, int i) { -+ protected void dropExperience(World world, BlockPosition blockposition, int i, EntityPlayer player) { // Paper - if (!world.isClientSide && world.getGameRules().getBoolean(GameRules.DO_TILE_DROPS)) { +- protected void dropExperience(WorldServer worldserver, BlockPosition blockposition, int i) { ++ protected void dropExperience(WorldServer worldserver, BlockPosition blockposition, int i, EntityPlayer player) { // Paper + if (worldserver.getGameRules().getBoolean(GameRules.DO_TILE_DROPS)) { while (i > 0) { int j = EntityExperienceOrb.getOrbValue(i); i -= j; -- world.addEntity(new EntityExperienceOrb(world, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, j)); -+ world.addEntity(new EntityExperienceOrb(world, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, j, org.bukkit.entity.ExperienceOrb.SpawnReason.BLOCK_BREAK, player)); // Paper +- worldserver.addEntity(new EntityExperienceOrb(worldserver, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, j)); ++ worldserver.addEntity(new EntityExperienceOrb(worldserver, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, j, org.bukkit.entity.ExperienceOrb.SpawnReason.BLOCK_BREAK, player)); // Paper } } @@ -45,11 +45,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/EntityAnimal.java +++ b/src/main/java/net/minecraft/server/EntityAnimal.java @@ -0,0 +0,0 @@ public abstract class EntityAnimal extends EntityAgeable { - if (world.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) { + if (worldserver.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) { // CraftBukkit start - use event experience if (experience > 0) { -- world.addEntity(new EntityExperienceOrb(world, this.locX(), this.locY(), this.locZ(), experience)); -+ world.addEntity(new EntityExperienceOrb(world, this.locX(), this.locY(), this.locZ(), experience, org.bukkit.entity.ExperienceOrb.SpawnReason.BREED, entityplayer, entityageable)); // Paper +- worldserver.addEntity(new EntityExperienceOrb(worldserver, this.locX(), this.locY(), this.locZ(), experience)); ++ worldserver.addEntity(new EntityExperienceOrb(worldserver, this.locX(), this.locY(), this.locZ(), experience, org.bukkit.entity.ExperienceOrb.SpawnReason.BREED, entityplayer, entityageable)); // Paper } // CraftBukkit end } diff --git a/Spigot-Server-Patches/Expose-attack-cooldown-methods-for-Player.patch b/Spigot-Server-Patches/Expose-attack-cooldown-methods-for-Player.patch index 1c014a4a1d..c6bf353ea2 100644 --- a/Spigot-Server-Patches/Expose-attack-cooldown-methods-for-Player.patch +++ b/Spigot-Server-Patches/Expose-attack-cooldown-methods-for-Player.patch @@ -9,11 +9,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java @@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { - this.datawatcher.set(EntityHuman.bs, nbttagcompound); + this.datawatcher.set(EntityHuman.bl, nbttagcompound); } -+ public float getCooldownPeriod() { return this.eR(); } // Paper - OBFHELPER - public float eR() { ++ public float getCooldownPeriod() { return this.eQ(); } // Paper - OBFHELPER + public float eQ() { return (float) (1.0D / this.b(GenericAttributes.ATTACK_SPEED) * 20.0D); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/Spigot-Server-Patches/Fix-MC-124320.patch b/Spigot-Server-Patches/Fix-MC-124320.patch deleted file mode 100644 index c8c060d0d6..0000000000 --- a/Spigot-Server-Patches/Fix-MC-124320.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: BillyGalbreath -Date: Thu, 23 Aug 2018 09:25:30 -0500 -Subject: [PATCH] Fix MC-124320 - - -diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Block.java -+++ b/src/main/java/net/minecraft/server/Block.java -@@ -0,0 +0,0 @@ public class Block extends BlockBase implements IMaterial { - return this == block; - } - -+ public static IBlockData getValidBlockForPosition(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition) { return Block.b(iblockdata, generatoraccess, blockposition); } // Paper - OBFHELPER - public static IBlockData b(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition) { - IBlockData iblockdata1 = iblockdata; - BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition(); -diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityEnderman.java -+++ b/src/main/java/net/minecraft/server/EntityEnderman.java -@@ -0,0 +0,0 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { - if (block.a((Tag) TagsBlock.ENDERMAN_HOLDABLE) && flag) { - // CraftBukkit start - Pickup event - if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.enderman, blockposition, Blocks.AIR.getBlockData()).isCancelled()) { -- this.enderman.setCarried(iblockdata); -+ //this.enderman.setCarried(iblockdata); // Paper - moved down - world.a(blockposition, false); -+ this.enderman.setCarried(Block.getValidBlockForPosition(iblockdata, this.enderman.world, blockposition)); // Paper - Fix MC-124320 - } - // CraftBukkit end - } -@@ -0,0 +0,0 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { - - static class PathfinderGoalEndermanPlaceBlock extends PathfinderGoal { - -+ private EntityEnderman getEnderman() { return this.a; } // Paper - OBFHELPER - private final EntityEnderman a; - - public PathfinderGoalEndermanPlaceBlock(EntityEnderman entityenderman) { -@@ -0,0 +0,0 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { - IBlockData iblockdata = world.getType(blockposition); - BlockPosition blockposition1 = blockposition.down(); - IBlockData iblockdata1 = world.getType(blockposition1); -- IBlockData iblockdata2 = this.a.getCarried(); -+ IBlockData iblockdata2 = Block.getValidBlockForPosition(getEnderman().getCarried(), getEnderman().world, blockposition); // Paper - Fix MC-124320 - - if (iblockdata2 != null && this.a(world, blockposition, iblockdata2, iblockdata, iblockdata1, blockposition1)) { - // CraftBukkit start - Place event diff --git a/Spigot-Server-Patches/Fix-MC-187716-Use-configured-height.patch b/Spigot-Server-Patches/Fix-MC-187716-Use-configured-height.patch new file mode 100644 index 0000000000..7c4a1b7309 --- /dev/null +++ b/Spigot-Server-Patches/Fix-MC-187716-Use-configured-height.patch @@ -0,0 +1,45 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: William Blake Galbreath +Date: Sat, 15 Aug 2020 08:04:49 -0500 +Subject: [PATCH] Fix MC-187716 Use configured height + + +diff --git a/src/main/java/net/minecraft/server/WorldGenSurfaceNether.java b/src/main/java/net/minecraft/server/WorldGenSurfaceNether.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/WorldGenSurfaceNether.java ++++ b/src/main/java/net/minecraft/server/WorldGenSurfaceNether.java +@@ -0,0 +0,0 @@ public class WorldGenSurfaceNether extends WorldGenSurface= 0; --k2) { ++ for (int k2 = k; k2 >= 0; --k2) { // Paper - fix MC-187716 - use configured height + blockposition_mutableblockposition.d(k1, k2, l1); + IBlockData iblockdata4 = ichunkaccess.getType(blockposition_mutableblockposition); + +diff --git a/src/main/java/net/minecraft/server/WorldGenSurfaceNetherAbstract.java b/src/main/java/net/minecraft/server/WorldGenSurfaceNetherAbstract.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/WorldGenSurfaceNetherAbstract.java ++++ b/src/main/java/net/minecraft/server/WorldGenSurfaceNetherAbstract.java +@@ -0,0 +0,0 @@ public abstract class WorldGenSurfaceNetherAbstract extends WorldGenSurface= 0; --k2) { ++ for (int k2 = k; k2 >= 0; --k2) { // Paper - fix MC-187716 - use configured height + blockposition_mutableblockposition.d(k1, k2, l1); + IBlockData iblockdata5 = ichunkaccess.getType(blockposition_mutableblockposition); + int l2; +diff --git a/src/main/java/net/minecraft/server/WorldGenSurfaceNetherForest.java b/src/main/java/net/minecraft/server/WorldGenSurfaceNetherForest.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/WorldGenSurfaceNetherForest.java ++++ b/src/main/java/net/minecraft/server/WorldGenSurfaceNetherForest.java +@@ -0,0 +0,0 @@ public class WorldGenSurfaceNetherForest extends WorldGenSurface= 0; --k2) { ++ for (int k2 = k; k2 >= 0; --k2) { // Paper - fix MC-187716 - use configured height + blockposition_mutableblockposition.d(k1, k2, l1); + IBlockData iblockdata3 = worldgensurfaceconfigurationbase.a(); + IBlockData iblockdata4 = ichunkaccess.getType(blockposition_mutableblockposition); diff --git a/Spigot-Server-Patches/Fix-MC-197271.patch b/Spigot-Server-Patches/Fix-MC-197271.patch new file mode 100644 index 0000000000..ec0a8b8df9 --- /dev/null +++ b/Spigot-Server-Patches/Fix-MC-197271.patch @@ -0,0 +1,51 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: ishland +Date: Sun, 23 Aug 2020 10:57:44 +0200 +Subject: [PATCH] Fix MC-197271 + +This patch only fixes an issue for servers running OpenJ9. + +diff --git a/src/main/java/net/minecraft/server/RegistryGeneration.java b/src/main/java/net/minecraft/server/RegistryGeneration.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/RegistryGeneration.java ++++ b/src/main/java/net/minecraft/server/RegistryGeneration.java +@@ -0,0 +0,0 @@ public class RegistryGeneration { + public static final IRegistry g = a(IRegistry.aw, () -> { + return ProcessorLists.b; + }); +- public static final IRegistry h = a(IRegistry.ax, WorldGenFeaturePieces::a); ++ public static final IRegistry h = a(IRegistry.ax, () -> WorldGenFeaturePieces.a()); // Paper - MC-197271 + public static final IRegistry WORLDGEN_BIOME = a(IRegistry.ay, () -> { + return BiomeRegistry.a; + }); +- public static final IRegistry j = a(IRegistry.ar, GeneratorSettingBase::i); ++ public static final IRegistry j = a(IRegistry.ar, () -> GeneratorSettingBase.i()); // Paper - MC-197271 + + private static IRegistry a(ResourceKey> resourcekey, Supplier supplier) { + return a(resourcekey, Lifecycle.stable(), supplier); +@@ -0,0 +0,0 @@ public class RegistryGeneration { + MinecraftKey minecraftkey = resourcekey.a(); + + RegistryGeneration.k.put(minecraftkey, supplier); +- IRegistryWritable iregistrywritable = RegistryGeneration.l; ++ IRegistryWritable iregistrywritable = (IRegistryWritable) RegistryGeneration.l; // Paper - decompile fix + +- return (IRegistryWritable) iregistrywritable.a(resourcekey, (Object) r0, lifecycle); ++ return (R) iregistrywritable.a((ResourceKey) resourcekey, r0, lifecycle); // Paper - decompile fix + } + + public static T a(IRegistry iregistry, String s, T t0) { +@@ -0,0 +0,0 @@ public class RegistryGeneration { + } + + public static T a(IRegistry iregistry, MinecraftKey minecraftkey, T t0) { +- return ((IRegistryWritable) iregistry).a(ResourceKey.a(iregistry.f(), minecraftkey), t0, Lifecycle.stable()); ++ return (T) ((IRegistryWritable) iregistry).a(ResourceKey.a(iregistry.f(), minecraftkey), t0, Lifecycle.stable()); // Paper - decompile fix + } + + public static T a(IRegistry iregistry, int i, ResourceKey resourcekey, T t0) { +- return ((IRegistryWritable) iregistry).a(i, resourcekey, t0, Lifecycle.stable()); ++ return (T) ((IRegistryWritable) iregistry).a(i, resourcekey, t0, Lifecycle.stable()); // Paper - decompile fix + } + + public static void a() {} diff --git a/Spigot-Server-Patches/Fix-MC-99259-Wither-Boss-Bar-doesn-t-update-until-in.patch b/Spigot-Server-Patches/Fix-MC-99259-Wither-Boss-Bar-doesn-t-update-until-in.patch new file mode 100644 index 0000000000..7130dee881 --- /dev/null +++ b/Spigot-Server-Patches/Fix-MC-99259-Wither-Boss-Bar-doesn-t-update-until-in.patch @@ -0,0 +1,22 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> +Date: Thu, 20 Aug 2020 19:24:13 -0700 +Subject: [PATCH] Fix MC-99259 Wither Boss Bar doesn't update until + invulnerability period is over + + +diff --git a/src/main/java/net/minecraft/server/EntityWither.java b/src/main/java/net/minecraft/server/EntityWither.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/EntityWither.java ++++ b/src/main/java/net/minecraft/server/EntityWither.java +@@ -0,0 +0,0 @@ public class EntityWither extends EntityMonster implements IRangedEntity { + this.heal(1.0F, EntityRegainHealthEvent.RegainReason.REGEN); // CraftBukkit + } + +- this.bossBattle.setProgress(this.getHealth() / this.getMaxHealth()); ++ //this.bossBattle.setProgress(this.getHealth() / this.getMaxHealth()); // Paper - Moved down + } ++ this.bossBattle.setProgress(this.getHealth() / this.getMaxHealth()); // Paper - Fix MC-99259 (Boss bar does not update until Wither invulnerability period ends) + } + + public static boolean c(IBlockData iblockdata) { diff --git a/Spigot-Server-Patches/Fix-Per-World-Difficulty-Remembering-Difficulty.patch b/Spigot-Server-Patches/Fix-Per-World-Difficulty-Remembering-Difficulty.patch index de1a6466b3..f84095cb86 100644 --- a/Spigot-Server-Patches/Fix-Per-World-Difficulty-Remembering-Difficulty.patch +++ b/Spigot-Server-Patches/Fix-Per-World-Difficulty-Remembering-Difficulty.patch @@ -49,7 +49,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - public void a(EnumDifficulty enumdifficulty, boolean flag) { - if (flag || !this.saveData.isDifficultyLocked()) { - this.saveData.setDifficulty(this.saveData.isHardcore() ? EnumDifficulty.HARD : enumdifficulty); -- this.ba(); +- this.bb(); - this.getPlayerList().getPlayers().forEach(this::a); + // Paper start - fix per world difficulty + public void a(WorldServer world, EnumDifficulty enumdifficulty, boolean flag) { diff --git a/Spigot-Server-Patches/Fix-SPIGOT-5989.patch b/Spigot-Server-Patches/Fix-SPIGOT-5989.patch index 96dbb61a07..77a0aa5607 100644 --- a/Spigot-Server-Patches/Fix-SPIGOT-5989.patch +++ b/Spigot-Server-Patches/Fix-SPIGOT-5989.patch @@ -25,8 +25,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 Optional optional; if (blockposition != null) { -- optional = EntityHuman.getBed(worldserver1, blockposition, flag1, flag); -+ optional = EntityHuman.getBed(worldserver1, blockposition, flag1, true); // Paper - Fix SPIGOT-5989 +- optional = EntityHuman.getBed(worldserver1, blockposition, f, flag1, flag); ++ optional = EntityHuman.getBed(worldserver1, blockposition, f, flag1, true); // Paper - Fix SPIGOT-5989 } else { optional = Optional.empty(); } diff --git a/Spigot-Server-Patches/Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch b/Spigot-Server-Patches/Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch new file mode 100644 index 0000000000..4b9b1d611e --- /dev/null +++ b/Spigot-Server-Patches/Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch @@ -0,0 +1,46 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: William Blake Galbreath +Date: Sat, 22 Aug 2020 23:36:21 +0200 +Subject: [PATCH] Fix SpawnChangeEvent not firing for all use-cases + + +diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/WorldServer.java ++++ b/src/main/java/net/minecraft/server/WorldServer.java +@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { + } + // Paper end + ++ public final void setSpawn(BlockPosition blockposition, float f) { this.a(blockposition, f); } // Paper - OBFHELPER + public void a(BlockPosition blockposition, float f) { + // Paper - configurable spawn radius + BlockPosition prevSpawn = this.getSpawn(); + //ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(new BlockPosition(this.worldData.a(), 0, this.worldData.c())); + + this.worldData.setSpawn(blockposition, f); ++ new org.bukkit.event.world.SpawnChangeEvent(getWorld(), MCUtil.toLocation(this, prevSpawn)).callEvent(); // Paper + if (this.keepSpawnInMemory) { + // if this keepSpawnInMemory is false a plugin has already removed our tickets, do not re-add + this.removeTicketsForSpawn(this.paperConfig.keepLoadedRange, prevSpawn); +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +@@ -0,0 +0,0 @@ public class CraftWorld implements World { + public boolean setSpawnLocation(int x, int y, int z, float angle) { + try { + Location previousLocation = getSpawnLocation(); +- world.worldData.setSpawn(new BlockPosition(x, y, z), angle); ++ world.setSpawn(new BlockPosition(x, y, z), angle); // Paper - use WorldServer#setSpawn + ++ // Paper start - move to nms.World + // Notify anyone who's listening. +- SpawnChangeEvent event = new SpawnChangeEvent(this, previousLocation); +- server.getPluginManager().callEvent(event); ++ // SpawnChangeEvent event = new SpawnChangeEvent(this, previousLocation); ++ // server.getPluginManager().callEvent(event); ++ // Paper end + + return true; + } catch (Exception e) { diff --git a/Spigot-Server-Patches/Fix-SpongeAbsortEvent-handling.patch b/Spigot-Server-Patches/Fix-SpongeAbsortEvent-handling.patch index 22dbbed314..3acd4206e2 100644 --- a/Spigot-Server-Patches/Fix-SpongeAbsortEvent-handling.patch +++ b/Spigot-Server-Patches/Fix-SpongeAbsortEvent-handling.patch @@ -11,13 +11,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/Block.java @@ -0,0 +0,0 @@ public class Block extends BlockBase implements IMaterial { - iblockdata.dropNaturally(world, blockposition, ItemStack.b); } -- -+ public static void dropNaturally(IBlockData iblockdata, World world, BlockPosition blockposition, @Nullable TileEntity tileentity) { a(iblockdata, world, blockposition, tileentity); } - public static void a(IBlockData iblockdata, World world, BlockPosition blockposition, @Nullable TileEntity tileentity) { - if (world instanceof WorldServer) { - a(iblockdata, (WorldServer) world, blockposition, tileentity).forEach((itemstack) -> { + ++ public static void dropNaturally(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition, @Nullable TileEntity tileentity) { a(iblockdata, generatoraccess, blockposition, tileentity); } + public static void a(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition, @Nullable TileEntity tileentity) { + if (generatoraccess instanceof WorldServer) { + a(iblockdata, (WorldServer) generatoraccess, blockposition, tileentity).forEach((itemstack) -> { diff --git a/src/main/java/net/minecraft/server/BlockSponge.java b/src/main/java/net/minecraft/server/BlockSponge.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/BlockSponge.java diff --git a/Spigot-Server-Patches/Fix-World-isChunkGenerated-calls.patch b/Spigot-Server-Patches/Fix-World-isChunkGenerated-calls.patch index 2c8403088e..ff5698a9c5 100644 --- a/Spigot-Server-Patches/Fix-World-isChunkGenerated-calls.patch +++ b/Spigot-Server-Patches/Fix-World-isChunkGenerated-calls.patch @@ -204,8 +204,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/RegionFile.java +++ b/src/main/java/net/minecraft/server/RegionFile.java @@ -0,0 +0,0 @@ public class RegionFile implements AutoCloseable { - private final RegionFileBitSet freeSectors; - public final File file; + protected final RegionFileBitSet freeSectors; + public final File file; // Paper + // Paper start - Cache chunk status + private final ChunkStatus[] statuses = new ChunkStatus[32 * 32]; @@ -272,12 +272,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 try { NBTCompressedStreamTools.a(nbttagcompound, (DataOutput) dataoutputstream); -- regionfile.setOversized(chunkcoordintpair.x, chunkcoordintpair.z, false); // We don't do this anymore + regionfile.setStatus(chunkcoordintpair.x, chunkcoordintpair.z, ChunkRegionLoader.getStatus(nbttagcompound)); // Paper - cache status on disk -+ regionfile.setOversized(chunkcoordintpair.x, chunkcoordintpair.z, false); + regionfile.setOversized(chunkcoordintpair.x, chunkcoordintpair.z, false); // Paper - We don't do this anymore, mojang stores differently, but clear old meta flag if it exists to get rid of our own meta file once last oversized is gone } catch (Throwable throwable1) { throwable = throwable1; - throw throwable1; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/Spigot-Server-Patches/Fix-enderdragon-exp-dupe.patch b/Spigot-Server-Patches/Fix-enderdragon-exp-dupe.patch index f986ea7e3c..5a9ebdb591 100644 --- a/Spigot-Server-Patches/Fix-enderdragon-exp-dupe.patch +++ b/Spigot-Server-Patches/Fix-enderdragon-exp-dupe.patch @@ -13,14 +13,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster { public void saveData(NBTTagCompound nbttagcompound) { super.saveData(nbttagcompound); - nbttagcompound.setInt("DragonPhase", this.bN.a().getControllerPhase().b()); + nbttagcompound.setInt("DragonPhase", this.bG.a().getControllerPhase().b()); + nbttagcompound.setInt("Paper.DeathTick", this.deathAnimationTicks); // Paper } @Override @@ -0,0 +0,0 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster { if (nbttagcompound.hasKey("DragonPhase")) { - this.bN.setControllerPhase(DragonControllerPhase.getById(nbttagcompound.getInt("DragonPhase"))); + this.bG.setControllerPhase(DragonControllerPhase.getById(nbttagcompound.getInt("DragonPhase"))); } + this.deathAnimationTicks = nbttagcompound.getInt("Paper.DeathTick"); // Paper diff --git a/Spigot-Server-Patches/Fix-incorrect-return-for-WorldServer-addAllEntitiesS.patch b/Spigot-Server-Patches/Fix-incorrect-return-for-WorldServer-addAllEntitiesS.patch new file mode 100644 index 0000000000..217528e1a6 --- /dev/null +++ b/Spigot-Server-Patches/Fix-incorrect-return-for-WorldServer-addAllEntitiesS.patch @@ -0,0 +1,23 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: William Blake Galbreath +Date: Sat, 15 Aug 2020 09:32:00 -0500 +Subject: [PATCH] Fix incorrect return for WorldServer#addAllEntitiesSafely + + +diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/WorldServer.java ++++ b/src/main/java/net/minecraft/server/WorldServer.java +@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { + if (entity.co().anyMatch(this::isUUIDTaken)) { + return false; + } else { +- return this.addAllEntities(entity, reason); // CraftBukkit ++ // Paper start - this method is _only_ designed to return false on duplicate uuids ++ // fixes issues with things such as a plugin cancelling spawn of a /summon ++ this.addAllEntities(entity, reason); // CraftBukkit ++ return true; ++ // Paper end + } + } + diff --git a/Spigot-Server-Patches/Fix-items-not-falling-correctly.patch b/Spigot-Server-Patches/Fix-items-not-falling-correctly.patch index 440e168649..ffe447b03f 100644 --- a/Spigot-Server-Patches/Fix-items-not-falling-correctly.patch +++ b/Spigot-Server-Patches/Fix-items-not-falling-correctly.patch @@ -22,8 +22,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } -- if (!this.onGround || b(this.getMot()) > 9.999999747378752E-6D || (this.ticksLived + this.getId()) % 4 == 0) { -+ if (!this.onGround || b(this.getMot()) > 9.999999747378752E-6D || this.ticksLived % 4 == 3) { // Paper - Ensure checking item movement is always offset from Spigot's entity activation range check +- if (!this.onGround || c(this.getMot()) > 9.999999747378752E-6D || (this.ticksLived + this.getId()) % 4 == 0) { ++ if (!this.onGround || c(this.getMot()) > 9.999999747378752E-6D || this.ticksLived % 4 == 0) { // Paper - Ensure checking item movement is always offset from Spigot's entity activation range check this.move(EnumMoveType.SELF, this.getMot()); - float f = 0.98F; + float f1 = 0.98F; diff --git a/Spigot-Server-Patches/Fix-items-vanishing-through-end-portal.patch b/Spigot-Server-Patches/Fix-items-vanishing-through-end-portal.patch index 6001012c5c..b7d864913e 100644 --- a/Spigot-Server-Patches/Fix-items-vanishing-through-end-portal.patch +++ b/Spigot-Server-Patches/Fix-items-vanishing-through-end-portal.patch @@ -17,12 +17,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke + BlockPosition blockposition1; - if (blockposition == null) { // CraftBukkit - if (this.world.getTypeKey() == DimensionManager.THE_END && worldserver.getTypeKey() == DimensionManager.OVERWORLD) { // CraftBukkit + if (flag1) { + // Paper start - Ensure spawn chunk is always loaded before calculating Y coordinate + this.world.getChunkAtWorldCoords(this.world.getSpawn()); + // Paper end - // CraftBukkit start - EntityPortalEvent event = CraftEventFactory.callEntityPortalEvent(this, worldserver, worldserver.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver.getSpawn()), 0); - if (event == null) { + blockposition1 = WorldServer.a; + } else { + blockposition1 = worldserver.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver.getSpawn()); diff --git a/Spigot-Server-Patches/Fix-numerous-item-duplication-issues-and-teleport-is.patch b/Spigot-Server-Patches/Fix-numerous-item-duplication-issues-and-teleport-is.patch index b302e074b9..c90ab214e9 100644 --- a/Spigot-Server-Patches/Fix-numerous-item-duplication-issues-and-teleport-is.patch +++ b/Spigot-Server-Patches/Fix-numerous-item-duplication-issues-and-teleport-is.patch @@ -48,14 +48,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.world.getMethodProfiler().enter("changeDimension"); // CraftBukkit start @@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - entity.bukkitEntity = this.getBukkitEntity(); + entity.bukkitEntity = this.getBukkitEntity(); - if (this instanceof EntityInsentient) { -- ((EntityInsentient)this).unleash(true, false); // Unleash to prevent duping of leads. -+ ((EntityInsentient)this).unleash(true, true); // Paper drop lead + if (this instanceof EntityInsentient) { +- ((EntityInsentient) this).unleash(true, false); // Unleash to prevent duping of leads. ++ ((EntityInsentient) this).unleash(true, true); // Paper drop lead + } + // CraftBukkit end } - // CraftBukkit end - } @@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke } diff --git a/Spigot-Server-Patches/Fix-piston-physics-inconsistency-MC-188840.patch b/Spigot-Server-Patches/Fix-piston-physics-inconsistency-MC-188840.patch index 9a2ff8f2a3..01afaaa425 100644 --- a/Spigot-Server-Patches/Fix-piston-physics-inconsistency-MC-188840.patch +++ b/Spigot-Server-Patches/Fix-piston-physics-inconsistency-MC-188840.patch @@ -83,11 +83,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/TileEntityPiston.java +++ b/src/main/java/net/minecraft/server/TileEntityPiston.java @@ -0,0 +0,0 @@ public class TileEntityPiston extends TileEntity implements ITickable { - IBlockData iblockdata = Block.b(this.a, (GeneratorAccess) this.world, this.position); + IBlockData iblockdata = Block.b(this.a, (GeneratorAccess) this.world, this.position); - if (iblockdata.isAir()) { -- this.world.setTypeAndData(this.position, this.a, 84); + if (iblockdata.isAir()) { +- this.world.setTypeAndData(this.position, this.a, 84); + this.world.setTypeAndData(this.position, this.a, com.destroystokyo.paper.PaperConfig.allowPistonDuplication ? 84 : (84 | 2)); // Paper - force notify (flag 2), it's possible the set type by the piston block (which doesn't notify) set this block to air - Block.a(this.a, iblockdata, this.world, this.position, 3); - } else { - if (iblockdata.b(BlockProperties.C) && (Boolean) iblockdata.get(BlockProperties.C)) { + Block.a(this.a, iblockdata, this.world, this.position, 3); + } else { + if (iblockdata.b(BlockProperties.C) && (Boolean) iblockdata.get(BlockProperties.C)) { diff --git a/Spigot-Server-Patches/Fix-reducedDebugInfo-not-initialized-on-client.patch b/Spigot-Server-Patches/Fix-reducedDebugInfo-not-initialized-on-client.patch index 69449fc646..4eec2445e9 100644 --- a/Spigot-Server-Patches/Fix-reducedDebugInfo-not-initialized-on-client.patch +++ b/Spigot-Server-Patches/Fix-reducedDebugInfo-not-initialized-on-client.patch @@ -15,4 +15,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + playerconnection.sendPacket(new PacketPlayOutEntityStatus(entityplayer, (byte) (worldserver1.getGameRules().getBoolean(GameRules.REDUCED_DEBUG_INFO) ? 22 : 23))); // Paper - fix this rule not being initialized on the client this.d(entityplayer); entityplayer.getStatisticManager().c(); - entityplayer.B().a(entityplayer); + entityplayer.getRecipeBook().a(entityplayer); diff --git a/Spigot-Server-Patches/Fix-sign-edit-memory-leak.patch b/Spigot-Server-Patches/Fix-sign-edit-memory-leak.patch index 3fb3a8a859..08c03092c3 100644 --- a/Spigot-Server-Patches/Fix-sign-edit-memory-leak.patch +++ b/Spigot-Server-Patches/Fix-sign-edit-memory-leak.patch @@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/TileEntitySign.java @@ -0,0 +0,0 @@ public class TileEntitySign extends TileEntity implements ICommandListener { // private EntityHuman c; - private final IChatFormatted[] g; + private final FormattedString[] g; private EnumColor color; + public java.util.UUID signEditor; // Paper diff --git a/Spigot-Server-Patches/Fix-some-rails-connecting-improperly.patch b/Spigot-Server-Patches/Fix-some-rails-connecting-improperly.patch index 0bfcb91058..31d82e2b18 100644 --- a/Spigot-Server-Patches/Fix-some-rails-connecting-improperly.patch +++ b/Spigot-Server-Patches/Fix-some-rails-connecting-improperly.patch @@ -9,13 +9,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/BlockMinecartDetector.java +++ b/src/main/java/net/minecraft/server/BlockMinecartDetector.java @@ -0,0 +0,0 @@ public class BlockMinecartDetector extends BlockMinecartTrackAbstract { - } private void a(World world, BlockPosition blockposition, IBlockData iblockdata) { -+ if (iblockdata.getBlock() != this) { return; } // Paper - not our block, don't do anything - boolean flag = (Boolean) iblockdata.get(BlockMinecartDetector.POWERED); - boolean flag1 = false; - List list = this.a(world, blockposition, EntityMinecartAbstract.class, (Predicate) null); + if (this.canPlace(iblockdata, world, blockposition)) { ++ if (iblockdata.getBlock() != this) { return; } // Paper - not our block, don't do anything + boolean flag = (Boolean) iblockdata.get(BlockMinecartDetector.POWERED); + boolean flag1 = false; + List list = this.a(world, blockposition, EntityMinecartAbstract.class, (Predicate) null); diff --git a/src/main/java/net/minecraft/server/BlockMinecartTrackAbstract.java b/src/main/java/net/minecraft/server/BlockMinecartTrackAbstract.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/BlockMinecartTrackAbstract.java diff --git a/Spigot-Server-Patches/Fix-stuck-in-sneak-when-changing-worlds-MC-10657.patch b/Spigot-Server-Patches/Fix-stuck-in-sneak-when-changing-worlds-MC-10657.patch index 7f90dd3320..f682048736 100644 --- a/Spigot-Server-Patches/Fix-stuck-in-sneak-when-changing-worlds-MC-10657.patch +++ b/Spigot-Server-Patches/Fix-stuck-in-sneak-when-changing-worlds-MC-10657.patch @@ -9,14 +9,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - this.lastHealthSent = -1.0F; - this.lastFoodSent = -1; + this.lastHealthSent = -1.0F; + this.lastFoodSent = -1; + setSneaking(false); // Paper - fix MC-10657 + - // CraftBukkit start - PlayerChangedWorldEvent changeEvent = new PlayerChangedWorldEvent(this.getBukkitEntity(), worldserver1.getWorld()); - this.world.getServer().getPluginManager().callEvent(changeEvent); + // CraftBukkit start + PlayerChangedWorldEvent changeEvent = new PlayerChangedWorldEvent(this.getBukkitEntity(), worldserver1.getWorld()); + this.world.getServer().getPluginManager().callEvent(changeEvent); diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java diff --git a/Spigot-Server-Patches/Fix-this-stupid-bullshit.patch b/Spigot-Server-Patches/Fix-this-stupid-bullshit.patch index 78ecbd7fe5..17d990e8da 100644 --- a/Spigot-Server-Patches/Fix-this-stupid-bullshit.patch +++ b/Spigot-Server-Patches/Fix-this-stupid-bullshit.patch @@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -0,0 +0,0 @@ public class Main { Calendar deadline = Calendar.getInstance(); - deadline.add(Calendar.DAY_OF_YEAR, -21); + deadline.add(Calendar.DAY_OF_YEAR, -7); if (buildDate.before(deadline.getTime())) { - System.err.println("*** Error, this build is outdated ***"); + // Paper start - This is some stupid bullshit diff --git a/Spigot-Server-Patches/Further-improve-server-tick-loop.patch b/Spigot-Server-Patches/Further-improve-server-tick-loop.patch index 9963ca01c4..a353e25266 100644 --- a/Spigot-Server-Patches/Further-improve-server-tick-loop.patch +++ b/Spigot-Server-Patches/Further-improve-server-tick-loop.patch @@ -90,7 +90,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper End // Spigot End - protected void v() { + protected void w() { @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant= 0 && l < this.x; boolean flag2 = k + 4 >= 0 && k < this.x; diff --git a/Spigot-Server-Patches/Handle-Oversized-Tile-Entities-in-chunks.patch b/Spigot-Server-Patches/Handle-Oversized-Tile-Entities-in-chunks.patch index 0c0af7d473..9b4d6b7548 100644 --- a/Spigot-Server-Patches/Handle-Oversized-Tile-Entities-in-chunks.patch +++ b/Spigot-Server-Patches/Handle-Oversized-Tile-Entities-in-chunks.patch @@ -13,23 +13,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java +++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java @@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet { + private boolean h; public PacketPlayOutMapChunk() {} - + // Paper start + private final java.util.List extraPackets = new java.util.ArrayList<>(); + private static final int TE_LIMIT = Integer.getInteger("Paper.excessiveTELimit", 750); -+ + + @Override + public java.util.List getExtraPackets() { + return extraPackets; + } + // Paper end - public PacketPlayOutMapChunk(Chunk chunk, int i, boolean flag) { + public PacketPlayOutMapChunk(Chunk chunk, int i) { ChunkCoordIntPair chunkcoordintpair = chunk.getPos(); @@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet { - this.c = this.a(new PacketDataSerializer(this.k()), chunk, i); + this.c = this.a(new PacketDataSerializer(this.j()), chunk, i); this.g = Lists.newArrayList(); iterator = chunk.getTileEntities().entrySet().iterator(); + int totalTileEntities = 0; // Paper diff --git a/Spigot-Server-Patches/Here-s-Johnny.patch b/Spigot-Server-Patches/Here-s-Johnny.patch index af5164a214..89177e3e06 100644 --- a/Spigot-Server-Patches/Here-s-Johnny.patch +++ b/Spigot-Server-Patches/Here-s-Johnny.patch @@ -12,8 +12,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private static final Predicate b = (enumdifficulty) -> { return enumdifficulty == EnumDifficulty.NORMAL || enumdifficulty == EnumDifficulty.HARD; }; -- private boolean bv; -+ private boolean bv; public boolean isJohnny() { return bv; } public void setJohnny(boolean johnny) { bv = johnny; } // Paper - OBFHELPER +- private boolean bo; ++ private boolean bo; public boolean isJohnny() { return bo; } public void setJohnny(boolean johnny) { bo = johnny; } // Paper - OBFHELPER public EntityVindicator(EntityTypes entitytypes, World world) { super(entitytypes, world); diff --git a/Spigot-Server-Patches/Hook-into-CB-plugin-rewrites.patch b/Spigot-Server-Patches/Hook-into-CB-plugin-rewrites.patch index 80ee39cb53..5b2c7135e4 100644 --- a/Spigot-Server-Patches/Hook-into-CB-plugin-rewrites.patch +++ b/Spigot-Server-Patches/Hook-into-CB-plugin-rewrites.patch @@ -52,7 +52,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if ( Boolean.getBoolean( "debug.rewriteForIde" ) ) + { + // unversion incoming calls for pre-relocate debug work -+ final String NMS_REVISION_PACKAGE = "v1_16_R1/"; ++ final String NMS_REVISION_PACKAGE = "v1_16_R2/"; + + getAndRemove.put( "net/minecraft/".concat( "server/" + NMS_REVISION_PACKAGE ), NMS_REVISION_PACKAGE ); + getAndRemove.put( "org/bukkit/".concat( "craftbukkit/" + NMS_REVISION_PACKAGE ), NMS_REVISION_PACKAGE ); diff --git a/Spigot-Server-Patches/Implement-Chunk-Priority-Urgency-System-for-Chunks.patch b/Spigot-Server-Patches/Implement-Chunk-Priority-Urgency-System-for-Chunks.patch index 4345b70327..fea2e2005a 100644 --- a/Spigot-Server-Patches/Implement-Chunk-Priority-Urgency-System-for-Chunks.patch +++ b/Spigot-Server-Patches/Implement-Chunk-Priority-Urgency-System-for-Chunks.patch @@ -631,6 +631,14 @@ diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/PlayerChunk.java +++ b/src/main/java/net/minecraft/server/PlayerChunk.java +@@ -0,0 +0,0 @@ + package net.minecraft.server; + + import com.mojang.datafixers.util.Either; ++import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; // Paper + import it.unimi.dsi.fastutil.shorts.ShortArraySet; + import it.unimi.dsi.fastutil.shorts.ShortSet; + import java.util.List; @@ -0,0 +0,0 @@ public class PlayerChunk { private CompletableFuture chunkSave; public int oldTicketLevel; @@ -639,11 +647,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - final ChunkCoordIntPair location; // Paper - private -> package + volatile int n; public final int getCurrentPriority() { return n; } // Paper - OBFHELPER - make volatile since this is concurrently accessed + public final ChunkCoordIntPair location; // Paper - private -> public - private final short[] dirtyBlocks; - private int dirtyCount; + private boolean p; + private final ShortSet[] dirtyBlocks; private int r; @@ -0,0 +0,0 @@ public class PlayerChunk { - private boolean hasBeenLoaded; + private boolean x; private final PlayerChunkMap chunkMap; // Paper + public WorldServer getWorld() { return chunkMap.world; } // Paper @@ -658,7 +666,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + volatile int neighborPriority = -1; + volatile int priorityBoost = 0; + public final java.util.concurrent.ConcurrentHashMap neighbors = new java.util.concurrent.ConcurrentHashMap<>(); -+ public final it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap neighborPriorities = new it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap<>(); ++ public final Long2ObjectOpenHashMap neighborPriorities = new Long2ObjectOpenHashMap<>(); + + private int getDemandedPriority() { + int priority = neighborPriority; // if we have a neighbor priority, use it @@ -844,7 +852,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.entityTickingFuture = PlayerChunk.UNLOADED_CHUNK_FUTURE; } -- this.v.a(this.location, this::k, this.ticketLevel, this::d); +- this.u.a(this.location, this::k, this.ticketLevel, this::d); + // Paper start - raise IO/load priority if priority changes, use our preferred priority + priorityBoost = chunkMap.chunkDistanceManager.getChunkPriority(location); + int priority = getDemandedPriority(); @@ -858,7 +866,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + chunkMap.world.asyncChunkTaskManager.raisePriority(location.x, location.z, ioPriority); + } + if (getCurrentPriority() != priority) { -+ this.v.a(this.location, this::getCurrentPriority, priority, this::setPriority); // use preferred priority ++ this.u.a(this.location, this::getCurrentPriority, priority, this::setPriority); // use preferred priority + int neighborsPriority = getNeighborsPriority(); + this.neighbors.forEach((neighbor, neighborDesired) -> neighbor.setNeighborPriority(this, neighborsPriority)); + } @@ -884,6 +892,14 @@ diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/j index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java +@@ -0,0 +0,0 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap; + import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; + import it.unimi.dsi.fastutil.longs.Long2ByteMap; + import it.unimi.dsi.fastutil.longs.Long2ByteOpenHashMap; ++import it.unimi.dsi.fastutil.longs.Long2IntOpenHashMap; // Paper + import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap; + import it.unimi.dsi.fastutil.longs.Long2ObjectMap.Entry; + import it.unimi.dsi.fastutil.longs.LongIterator; @@ -0,0 +0,0 @@ import org.apache.commons.lang3.mutable.MutableBoolean; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -980,7 +996,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return playerchunk == null || unloadQueue.contains(playerchunk.location.pair()); + } + -+ private void updateChunkPriorityMap(it.unimi.dsi.fastutil.longs.Long2IntOpenHashMap map, long chunk, int level) { ++ private void updateChunkPriorityMap(Long2IntOpenHashMap map, long chunk, int level) { + int prev = map.getOrDefault(chunk, -1); + if (level > prev) { + map.put(chunk, level); @@ -993,7 +1009,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return; + } + player.lastHighPriorityChecked = currentTick; -+ it.unimi.dsi.fastutil.longs.Long2IntOpenHashMap priorities = new it.unimi.dsi.fastutil.longs.Long2IntOpenHashMap(); ++ Long2IntOpenHashMap priorities = new Long2IntOpenHashMap(); + + int viewDistance = getEffectiveNoTickViewDistance(); + BlockPosition.MutableBlockPosition pos = new BlockPosition.MutableBlockPosition(); diff --git a/Spigot-Server-Patches/Implement-EntityKnockbackByEntityEvent.patch b/Spigot-Server-Patches/Implement-EntityKnockbackByEntityEvent.patch index 8b7ed21d67..8317c3e3a0 100644 --- a/Spigot-Server-Patches/Implement-EntityKnockbackByEntityEvent.patch +++ b/Spigot-Server-Patches/Implement-EntityKnockbackByEntityEvent.patch @@ -16,14 +16,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - ((EntityLiving) entity).a((float) i * 0.5F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F))); + ((EntityLiving) entity).doKnockback((float) i * 0.5F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F)), this); // Paper } else { - entity.h((double) (-MathHelper.sin(this.yaw * 0.017453292F) * (float) i * 0.5F), 0.1D, (double) (MathHelper.cos(this.yaw * 0.017453292F) * (float) i * 0.5F)); + entity.i((double) (-MathHelper.sin(this.yaw * 0.017453292F) * (float) i * 0.5F), 0.1D, (double) (MathHelper.cos(this.yaw * 0.017453292F) * (float) i * 0.5F)); } @@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { if (entityliving != this && entityliving != entity && !this.r(entityliving) && (!(entityliving instanceof EntityArmorStand) || !((EntityArmorStand) entityliving).isMarker()) && this.h((Entity) entityliving) < 9.0D) { // CraftBukkit start - Only apply knockback if the damage hits if (entityliving.damageEntity(DamageSource.playerAttack(this).sweep(), f4)) { - entityliving.a(0.4F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F))); -+ entityliving.doKnockback(0.4F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F)), this); ++ entityliving.doKnockback(0.4F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F)), this); // Paper } // CraftBukkit end } @@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (flag) { if (f1 > 0.0F && entity instanceof EntityLiving) { - ((EntityLiving) entity).a(f1 * 0.5F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F))); -+ ((EntityLiving) entity).doKnockback(f1 * 0.5F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F)), this); ++ ((EntityLiving) entity).doKnockback(f1 * 0.5F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F)), this); // Paper this.setMot(this.getMot().d(0.6D, 1.0D, 0.6D)); } @@ -47,18 +47,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { } - this.aw = (float) (MathHelper.d(d1, d0) * 57.2957763671875D - (double) this.yaw); + this.ap = (float) (MathHelper.d(d1, d0) * 57.2957763671875D - (double) this.yaw); - this.a(0.4F, d0, d1); + this.doKnockback(0.4F, d0, d1, entity1); // Paper } else { - this.aw = (float) ((int) (Math.random() * 2.0D) * 180); + this.ap = (float) ((int) (Math.random() * 2.0D) * 180); } @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { } - protected void f(EntityLiving entityliving) { + protected void e(EntityLiving entityliving) { - entityliving.a(0.5F, entityliving.locX() - this.locX(), entityliving.locZ() - this.locZ()); -+ entityliving.doKnockback(0.5F, entityliving.locX() - this.locX(), entityliving.locZ() - this.locZ(), this); ++ entityliving.doKnockback(0.5F, entityliving.locX() - this.locX(), entityliving.locZ() - this.locZ(), this); // Paper } private boolean f(DamageSource damagesource) { diff --git a/Spigot-Server-Patches/Implement-EntityTeleportEndGatewayEvent.patch b/Spigot-Server-Patches/Implement-EntityTeleportEndGatewayEvent.patch index 6cae15a8b4..e8bd4c4b18 100644 --- a/Spigot-Server-Patches/Implement-EntityTeleportEndGatewayEvent.patch +++ b/Spigot-Server-Patches/Implement-EntityTeleportEndGatewayEvent.patch @@ -22,10 +22,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (!event.callEvent()) { + return; + } ++ // Paper end + entity1.resetPortalCooldown(); - entity1.enderTeleportAndLoad((double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D); -+ entity.enderTeleportAndLoad(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ()); -+ // Paper end - EntityTeleportEndGatewayEvent ++ entity1.enderTeleportAndLoad(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ()); // Paper } this.h(); diff --git a/Spigot-Server-Patches/Implement-Expanded-ArmorStand-API.patch b/Spigot-Server-Patches/Implement-Expanded-ArmorStand-API.patch index 2bbe2df646..f04a5e3c17 100644 --- a/Spigot-Server-Patches/Implement-Expanded-ArmorStand-API.patch +++ b/Spigot-Server-Patches/Implement-Expanded-ArmorStand-API.patch @@ -14,9 +14,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class EntityArmorStand extends EntityLiving { private final NonNullList armorItems; private boolean armorStandInvisible; - public long bp; -- private int bA; -+ private int bA; public final void setDisabledSlots(int i) { bA = i; } public final int getDisabledSlots() { return bA; } // Paper - OBFHELPER + public long bi; +- public int bv; //PAIL private -> public, rename disabledSlots ++ public int bv; public final void setDisabledSlots(int i) { bv = i; } public final int getDisabledSlots() { return bv; } // Paper - OBFHELPER public Vector3f headPose; public Vector3f bodyPose; public Vector3f leftArmPose; @@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public final boolean isSlotDisabled(EnumItemSlot slot) { return this.d(slot); } // Paper - OBFHELPER private boolean d(EnumItemSlot enumitemslot) { - return (this.bA & 1 << enumitemslot.c()) != 0 || enumitemslot.a() == EnumItemSlot.Function.HAND && !this.hasArms(); + return (this.bv & 1 << enumitemslot.c()) != 0 || enumitemslot.a() == EnumItemSlot.Function.HAND && !this.hasArms(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 diff --git a/Spigot-Server-Patches/Implement-Mob-Goal-API.patch b/Spigot-Server-Patches/Implement-Mob-Goal-API.patch index fdfd3254c8..caaf42ccf5 100644 --- a/Spigot-Server-Patches/Implement-Mob-Goal-API.patch +++ b/Spigot-Server-Patches/Implement-Mob-Goal-API.patch @@ -142,6 +142,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + deobfuscationMap.put("shulker_e", "shulker_peek"); + deobfuscationMap.put("squid_a", "squid_flee"); + deobfuscationMap.put("skeleton_abstract_1", "skeleton_melee"); ++ deobfuscationMap.put("strider_a", "strider_go_to_lava"); + deobfuscationMap.put("turtle_a", "turtle_breed"); + deobfuscationMap.put("turtle_b", "turtle_go_home"); + deobfuscationMap.put("turtle_c", "turtle_goto_water"); @@ -253,6 +254,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + bukkitMap.put(EntityZombieVillager.class, ZombieVillager.class); + bukkitMap.put(EntityHoglin.class, Hoglin.class); + bukkitMap.put(EntityPiglin.class, Piglin.class); ++ bukkitMap.put(EntityPiglinAbstract.class, PiglinAbstract.class); ++ bukkitMap.put(EntityPiglinBrute.class, PiglinBrute.class); + bukkitMap.put(EntityStrider.class, Strider.class); + bukkitMap.put(EntityZoglin.class, Zoglin.class); + } diff --git a/Spigot-Server-Patches/Implement-Player-Client-Options-API.patch b/Spigot-Server-Patches/Implement-Player-Client-Options-API.patch index 1fb03c1d3c..369df9816b 100644 --- a/Spigot-Server-Patches/Implement-Player-Client-Options-API.patch +++ b/Spigot-Server-Patches/Implement-Player-Client-Options-API.patch @@ -89,14 +89,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java @@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { - private static final Map b = ImmutableMap.builder().put(EntityPose.STANDING, EntityHuman.bo).put(EntityPose.SLEEPING, EntityHuman.ao).put(EntityPose.FALL_FLYING, EntitySize.b(0.6F, 0.6F)).put(EntityPose.SWIMMING, EntitySize.b(0.6F, 0.6F)).put(EntityPose.SPIN_ATTACK, EntitySize.b(0.6F, 0.6F)).put(EntityPose.CROUCHING, EntitySize.b(0.6F, 1.5F)).put(EntityPose.DYING, EntitySize.c(0.2F, 0.2F)).build(); + private static final Map b = ImmutableMap.builder().put(EntityPose.STANDING, EntityHuman.bh).put(EntityPose.SLEEPING, EntityHuman.ah).put(EntityPose.FALL_FLYING, EntitySize.b(0.6F, 0.6F)).put(EntityPose.SWIMMING, EntitySize.b(0.6F, 0.6F)).put(EntityPose.SPIN_ATTACK, EntitySize.b(0.6F, 0.6F)).put(EntityPose.CROUCHING, EntitySize.b(0.6F, 1.5F)).put(EntityPose.DYING, EntitySize.c(0.2F, 0.2F)).build(); private static final DataWatcherObject c = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.c); private static final DataWatcherObject d = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.b); -- protected static final DataWatcherObject bp = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.a); -+ protected static final DataWatcherObject bp = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.a); public static DataWatcherObject getSkinPartsWatcher() { return bp; } // Paper - OBFHELPER - protected static final DataWatcherObject bq = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.a); - protected static final DataWatcherObject br = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.p); - protected static final DataWatcherObject bs = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.p); +- protected static final DataWatcherObject bi = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.a); ++ protected static final DataWatcherObject bi = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.a); public static DataWatcherObject getSkinPartsWatcher() { return bi; } // Paper - OBFHELPER + protected static final DataWatcherObject bj = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.a); + protected static final DataWatcherObject bk = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.p); + protected static final DataWatcherObject bl = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.p); diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java @@ -112,10 +112,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public int lastSentExp = -99999999; public int invulnerableTicks = 60; - private EnumChatVisibility cf; -- private boolean cg = true; -+ private boolean cg = true; public boolean hasChatColorsEnabled() { return this.cg; } // Paper - OBFHELPER - private long ch = SystemUtils.getMonotonicMillis(); + private EnumChatVisibility bY; +- private boolean bZ = true; ++ private boolean bZ = true; public boolean hasChatColorsEnabled() { return this.bZ; } // Paper - OBFHELPER + private long ca = SystemUtils.getMonotonicMillis(); private Entity spectatedEntity; public boolean worldChangeInvuln; @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { @@ -159,8 +159,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import com.destroystokyo.paper.PaperSkinParts; +import com.destroystokyo.paper.ClientOption; import com.destroystokyo.paper.Title; - import com.destroystokyo.paper.profile.CraftPlayerProfile; - import com.destroystokyo.paper.profile.PlayerProfile; + import com.google.common.base.Preconditions; + import com.google.common.collect.ImmutableSet; @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { public void setViewDistance(int viewDistance) { throw new NotImplementedException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO diff --git a/Spigot-Server-Patches/Implement-PlayerLocaleChangeEvent.patch b/Spigot-Server-Patches/Implement-PlayerLocaleChangeEvent.patch index 731e33773e..d50a033311 100644 --- a/Spigot-Server-Patches/Implement-PlayerLocaleChangeEvent.patch +++ b/Spigot-Server-Patches/Implement-PlayerLocaleChangeEvent.patch @@ -24,21 +24,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (this.locale == null || !this.locale.equals(packetplayinsettings.locale)) { // Paper - check for null PlayerLocaleChangeEvent event = new PlayerLocaleChangeEvent(getBukkitEntity(), packetplayinsettings.locale); this.server.server.getPluginManager().callEvent(event); ++ new com.destroystokyo.paper.event.player.PlayerLocaleChangeEvent(this.getBukkitEntity(), this.locale, packetplayinsettings.locale).callEvent(); // Paper } this.locale = packetplayinsettings.locale; this.clientViewDistance = packetplayinsettings.viewDistance; - // CraftBukkit end -+ // Paper start - add PlayerLocaleChangeEvent -+ // Since the field is initialized to null, this event should always fire the first time the packet is received -+ String oldLocale = this.locale; -+ this.locale = packetplayinsettings.locale; -+ if (!this.locale.equals(oldLocale)) { -+ new com.destroystokyo.paper.event.player.PlayerLocaleChangeEvent(this.getBukkitEntity(), oldLocale, this.locale).callEvent(); -+ } -+ // Paper end - this.cf = packetplayinsettings.d(); - this.cg = packetplayinsettings.e(); - this.getDataWatcher().set(EntityPlayer.bp, (byte) packetplayinsettings.f()); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/Spigot-Server-Patches/Implement-alternative-item-despawn-rate.patch b/Spigot-Server-Patches/Implement-alternative-item-despawn-rate.patch index 37a7771eb3..c1f2d2733d 100644 --- a/Spigot-Server-Patches/Implement-alternative-item-despawn-rate.patch +++ b/Spigot-Server-Patches/Implement-alternative-item-despawn-rate.patch @@ -123,5 +123,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end + @Override - public Packet O() { + public Packet P() { return new PacketPlayOutSpawnEntity(this); diff --git a/Spigot-Server-Patches/Import-fastutil-classes.patch b/Spigot-Server-Patches/Import-fastutil-classes.patch new file mode 100644 index 0000000000..d7768bd32a --- /dev/null +++ b/Spigot-Server-Patches/Import-fastutil-classes.patch @@ -0,0 +1,27 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Mariell Hoversholm +Date: Wed, 12 Aug 2020 11:33:04 +0200 +Subject: [PATCH] Import fastutil classes + + +diff --git a/src/main/java/net/minecraft/server/DataWatcher.java b/src/main/java/net/minecraft/server/DataWatcher.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/DataWatcher.java ++++ b/src/main/java/net/minecraft/server/DataWatcher.java +@@ -0,0 +0,0 @@ import java.util.Map; + import java.util.concurrent.locks.ReadWriteLock; + import java.util.concurrent.locks.ReentrantReadWriteLock; + import javax.annotation.Nullable; ++import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; // Paper + import org.apache.commons.lang3.ObjectUtils; + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; +@@ -0,0 +0,0 @@ public class DataWatcher { + private static final Logger LOGGER = LogManager.getLogger(); + private static final Map, Integer> b = Maps.newHashMap(); + private final Entity entity; +- private final it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap> entries = new it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<>(); // Spigot - use better map // PAIL ++ private final Int2ObjectOpenHashMap> entries = new Int2ObjectOpenHashMap<>(); // Spigot - use better map // PAIL + // private final ReadWriteLock lock = new ReentrantReadWriteLock(); // Spigot - not required + private boolean f = true; + private boolean g; diff --git a/Spigot-Server-Patches/Improve-EntityTargetLivingEntityEvent-for-1.16-mobs.patch b/Spigot-Server-Patches/Improve-EntityTargetLivingEntityEvent-for-1.16-mobs.patch index 1501ff3910..b6fc68bc8d 100644 --- a/Spigot-Server-Patches/Improve-EntityTargetLivingEntityEvent-for-1.16-mobs.patch +++ b/Spigot-Server-Patches/Improve-EntityTargetLivingEntityEvent-for-1.16-mobs.patch @@ -39,7 +39,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + private void d(E e0, EntityTargetEvent.TargetReason reason) { // CraftBukkit start - EntityLiving old = e0.getBehaviorController().getMemory(MemoryModuleType.ATTACK_TARGET).orElse(null); -- EntityTargetEvent event = CraftEventFactory.callEntityTargetLivingEvent(e0, old, (old != null && !old.isAlive()) ? EntityTargetEvent.TargetReason.TARGET_DIED : EntityTargetEvent.TargetReason.FORGOT_TARGET); +- EntityTargetEvent event = CraftEventFactory.callEntityTargetLivingEvent(e0, null, (old != null && !old.isAlive()) ? EntityTargetEvent.TargetReason.TARGET_DIED : EntityTargetEvent.TargetReason.FORGOT_TARGET); + // Paper start - fix this event + //EntityLiving old = e0.getBehaviorController().getMemory(MemoryModuleType.ATTACK_TARGET).orElse(null); + EntityTargetEvent event = CraftEventFactory.callEntityTargetLivingEvent(e0, null, reason); diff --git a/Spigot-Server-Patches/Improve-Legacy-Component-serialization-size.patch b/Spigot-Server-Patches/Improve-Legacy-Component-serialization-size.patch index 34ac1ddeaf..004a3e112b 100644 --- a/Spigot-Server-Patches/Improve-Legacy-Component-serialization-size.patch +++ b/Spigot-Server-Patches/Improve-Legacy-Component-serialization-size.patch @@ -14,8 +14,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Separate pattern with no group 3, new lines are part of previous string private static final Pattern INCREMENTAL_PATTERN_KEEP_NEWLINES = Pattern.compile("(" + String.valueOf(org.bukkit.ChatColor.COLOR_CHAR) + "[0-9a-fk-orx])|((?:(?:https?):\\/\\/)?(?:[-\\w_\\.]{2,}\\.[a-z]{2,4}.*?(?=[\\.\\?!,;:]?(?:[" + String.valueOf(org.bukkit.ChatColor.COLOR_CHAR) + " ]|$))))", Pattern.CASE_INSENSITIVE); // ChatColor.b does not explicitly reset, its more of empty -+ private static final ChatModifier EMPTY = ChatModifier.b.setItalic(false); // Paper - OBFHELPER - private static final ChatModifier RESET = ChatModifier.b.setBold(false).setItalic(false).setUnderline(false).setStrikethrough(false).setRandom(false); ++ private static final ChatModifier EMPTY = ChatModifier.a.setItalic(false); // Paper - OBFHELPER + private static final ChatModifier RESET = ChatModifier.a.setBold(false).setItalic(false).setUnderline(false).setStrikethrough(false).setRandom(false); private final List list = new ArrayList(); @@ -0,0 +0,0 @@ public final class CraftChatMessage { diff --git a/Spigot-Server-Patches/Improve-death-events.patch b/Spigot-Server-Patches/Improve-death-events.patch index 197f4561f8..2c10cffee9 100644 --- a/Spigot-Server-Patches/Improve-death-events.patch +++ b/Spigot-Server-Patches/Improve-death-events.patch @@ -42,10 +42,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.fallDistance = 0.0F; } -+ public final void onKill(EntityLiving entityLiving) { this.a_(entityLiving); } // Paper - OBFHELPER - public void a_(EntityLiving entityliving) {} ++ public final void onKill(WorldServer worldserver, EntityLiving entityLiving) { this.a(worldserver, entityLiving); } // Paper - OBFHELPER + public void a(WorldServer worldserver, EntityLiving entityliving) {} - protected void k(double d0, double d1, double d2) { + protected void l(double d0, double d1, double d2) { diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityArmorStand.java @@ -123,14 +123,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { - protected float aS; - protected float aT; - protected float aU; -- protected int aV; -+ protected int aV; protected int getKillCount() { return this.aV; } // Paper - OBFHELPER + protected float aL; + protected float aM; + protected float aN; +- protected int aO; ++ protected int aO;protected int getKillCount() { return this.aO; } // Paper - OBFHELPER public float lastDamage; protected boolean jumping; - public float aY; + public float aR; @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { public Set collidableExemptions = new HashSet<>(); public boolean canPickUpLoot; @@ -165,9 +165,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 Entity entity = damagesource.getEntity(); EntityLiving entityliving = this.getKillingEntity(); -+ /* // Paper - move down to make death event cancellable - if (this.aV >= 0 && entityliving != null) { - entityliving.a(this, this.aV, damagesource); ++ /* // Paper - move down to make death event cancellable - this is the runKillTrigger below + if (this.aO >= 0 && entityliving != null) { + entityliving.a(this, this.aO, damagesource); } @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { if (this.isSleeping()) { @@ -177,28 +177,33 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.killed = true; - this.getCombatTracker().g(); -+ //this.getCombatTracker().g(); // Paper - if (!this.world.isClientSide) { ++ // this.getCombatTracker().g(); // Paper - moved into if below as .reset() + if (this.world instanceof WorldServer) { + if (entity != null) { +- entity.a((WorldServer) this.world, this); ++ // entity.a((WorldServer) this.world, this); // Paper - move below into if for onKill + } + - this.d(damagesource); ++ // Paper start + org.bukkit.event.entity.EntityDeathEvent deathEvent = this.d(damagesource); + if (deathEvent == null || !deathEvent.isCancelled()) { + if (this.getKillCount() >= 0 && entityliving != null) { + entityliving.runKillTrigger(this, this.getKillCount(), damagesource); + } -+ if (entity != null) { -+ entity.onKill(this); -+ } + if (this.isSleeping()) { + this.entityWakeup(); + } + this.getCombatTracker().reset(); ++ if (entity != null) { ++ entity.onKill((WorldServer) this.world, this); ++ } + } else { + this.killed = false; + this.setHealth((float) deathEvent.getReviveHealth()); + } + // Paper end -+ - this.g(entityliving); + this.f(entityliving); } + if (this.killed) { // Paper diff --git a/Spigot-Server-Patches/Improved-Watchdog-Support.patch b/Spigot-Server-Patches/Improved-Watchdog-Support.patch index 78f879447e..59af55de21 100644 --- a/Spigot-Server-Patches/Improved-Watchdog-Support.patch +++ b/Spigot-Server-Patches/Improved-Watchdog-Support.patch @@ -105,7 +105,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 r0.run(); } catch (Exception exception) { + if (exception.getCause() instanceof ThreadDeath) throw exception; // Paper - IAsyncTaskHandler.LOGGER.fatal("Error executing task on {}", this.bh(), exception); + IAsyncTaskHandler.LOGGER.fatal("Error executing task on {}", this.bi(), exception); } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -159,7 +159,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 MinecraftServer.LOGGER.info("Stopping server"); MinecraftTimings.stopServer(); // Paper @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant bF; +- protected int bd; ++ protected int bd; protected final int getEatTimeTicks() { return this.bd; } protected final void setEatTimeTicks(int value) { this.bd = value; } // Paper - OBFHELPER + protected int be; + private BlockPosition bx; + private Optional by; @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { - return ((Byte) this.datawatcher.get(EntityLiving.an) & 2) > 0 ? EnumHand.OFF_HAND : EnumHand.MAIN_HAND; + return ((Byte) this.datawatcher.get(EntityLiving.ag) & 2) > 0 ? EnumHand.OFF_HAND : EnumHand.MAIN_HAND; } + // Paper start - lag compensate eating @@ -28,19 +28,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + protected int totalEatTimeTicks; + // Paper end + - private void u() { + private void t() { if (this.isHandRaised()) { if (ItemStack.d(this.b(this.getRaisedHand()), this.activeItem)) { @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { this.b(this.activeItem, 5); } -- if (--this.bk == 0 && !this.world.isClientSide && !this.activeItem.m()) { +- if (--this.bd == 0 && !this.world.isClientSide && !this.activeItem.m()) { + // Paper start - lag compensate eating + // we add 1 to the expected time to avoid lag compensating when we should not -+ boolean shouldLagCompensate -+ = this.activeItem.getItem().isFood() && this.eatStartTime != -1 && (System.nanoTime() - this.eatStartTime) > ((1 + this.totalEatTimeTicks) * 50 * (1000 * 1000)); -+ if ((--this.bk == 0 || shouldLagCompensate) && !this.world.isClientSide && !this.activeItem.m()) { ++ boolean shouldLagCompensate = this.activeItem.getItem().isFood() && this.eatStartTime != -1 && (System.nanoTime() - this.eatStartTime) > ((1 + this.totalEatTimeTicks) * 50 * (1000 * 1000)); ++ if ((--this.bd == 0 || shouldLagCompensate) && !this.world.isClientSide && !this.activeItem.m()) { + this.setEatTimeTicks(0); + // Paper end this.s(); @@ -50,9 +49,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (!itemstack.isEmpty() && !this.isHandRaised() || forceUpdate) { // Paper use override flag this.activeItem = itemstack; -- this.bk = itemstack.k(); +- this.bd = itemstack.k(); + // Paper start - lag compensate eating -+ this.bk = this.totalEatTimeTicks = itemstack.k(); ++ this.bd = this.totalEatTimeTicks = itemstack.k(); + this.eatStartTime = System.nanoTime(); + // Paper end if (!this.world.isClientSide) { @@ -62,9 +61,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } else if (!this.isHandRaised() && !this.activeItem.isEmpty()) { this.activeItem = ItemStack.b; -- this.bk = 0; +- this.bd = 0; + // Paper start - lag compensate eating -+ this.bk = this.totalEatTimeTicks = 0; ++ this.bd = this.totalEatTimeTicks = 0; + this.eatStartTime = -1L; + // Paper end } @@ -74,9 +73,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } this.activeItem = ItemStack.b; -- this.bk = 0; +- this.bd = 0; + // Paper start - lag compensate eating -+ this.bk = this.totalEatTimeTicks = 0; ++ this.bd = this.totalEatTimeTicks = 0; + this.eatStartTime = -1L; + // Paper end } diff --git a/Spigot-Server-Patches/LivingEntity-Hand-Raised-Item-Use-API.patch b/Spigot-Server-Patches/LivingEntity-Hand-Raised-Item-Use-API.patch index 9e9a69abfb..fb2289b678 100644 --- a/Spigot-Server-Patches/LivingEntity-Hand-Raised-Item-Use-API.patch +++ b/Spigot-Server-Patches/LivingEntity-Hand-Raised-Item-Use-API.patch @@ -10,21 +10,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { - private float bB; + private float bu; private int jumpTicks; - private float bD; + private float bw; - protected ItemStack activeItem; + public ItemStack activeItem; // Paper - public - protected int bk; - protected int bl; - private BlockPosition bE; + protected int bd; + protected int be; + private BlockPosition bx; @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { return this.activeItem; } + public int getItemUseRemainingTime() { return this.dY(); } // Paper - OBFHELPER public int dY() { - return this.bk; + return this.bd; } + public int getHandRaisedTime() { return this.dZ(); } // Paper - OBFHELPER diff --git a/Spigot-Server-Patches/LivingEntity-setKiller.patch b/Spigot-Server-Patches/LivingEntity-setKiller.patch index 4edf41b263..14d6fe494b 100644 --- a/Spigot-Server-Patches/LivingEntity-setKiller.patch +++ b/Spigot-Server-Patches/LivingEntity-setKiller.patch @@ -9,14 +9,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { - public float aL; + public float aE; @Nullable public EntityHuman killer; - protected int lastDamageByPlayerTime; + public int lastDamageByPlayerTime; // Paper - protected -> public protected boolean killed; protected int ticksFarFromPlayer; - protected float aQ; + protected float aJ; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java diff --git a/Spigot-Server-Patches/Load-Chunks-for-Login-Asynchronously.patch b/Spigot-Server-Patches/Load-Chunks-for-Login-Asynchronously.patch index 78e44aeffa..647c6a14cd 100644 --- a/Spigot-Server-Patches/Load-Chunks-for-Login-Asynchronously.patch +++ b/Spigot-Server-Patches/Load-Chunks-for-Login-Asynchronously.patch @@ -22,14 +22,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - this.pitch = MathHelper.a(f1, -90.0F, 90.0F) % 360.0F; - this.lastYaw = this.yaw; - this.lastPitch = this.pitch; + this.lastY = d1; + this.lastZ = d4; + this.setPosition(d3, d1, d4); - world.getChunkAt((int) Math.floor(this.locX()) >> 4, (int) Math.floor(this.locZ()) >> 4); // CraftBukkit + if (valid) world.getChunkAt((int) Math.floor(this.locX()) >> 4, (int) Math.floor(this.locZ()) >> 4); // CraftBukkit // Paper } - public void c(Vec3D vec3d) { + public void d(Vec3D vec3d) { diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java @@ -149,7 +149,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (nbttagcompound != null) { @@ -0,0 +0,0 @@ public abstract class PlayerList { - entityplayer.B().a(entityplayer); + entityplayer.getRecipeBook().a(entityplayer); this.sendScoreboard(worldserver1.getScoreboard(), entityplayer); this.server.invalidatePingSample(); + // Paper start - async load spawn in chunk diff --git a/Spigot-Server-Patches/LootTable-API-Replenishable-Lootables-Feature.patch b/Spigot-Server-Patches/LootTable-API-Replenishable-Lootables-Feature.patch index daa7956fa2..c5e39e616c 100644 --- a/Spigot-Server-Patches/LootTable-API-Replenishable-Lootables-Feature.patch +++ b/Spigot-Server-Patches/LootTable-API-Replenishable-Lootables-Feature.patch @@ -585,7 +585,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - this.lootTable = null; + //this.lootTable = null; // Paper + this.lootableData.processRefill(entityhuman); // Paper - LootTableInfo.Builder loottableinfo_builder = (new LootTableInfo.Builder((WorldServer) this.world)).set(LootContextParameters.POSITION, this.getChunkCoordinates()).a(this.lootTableSeed); + LootTableInfo.Builder loottableinfo_builder = (new LootTableInfo.Builder((WorldServer) this.world)).set(LootContextParameters.ORIGIN, this.getPositionVector()).a(this.lootTableSeed); if (entityhuman != null) { diff --git a/src/main/java/net/minecraft/server/TileEntityLootable.java b/src/main/java/net/minecraft/server/TileEntityLootable.java @@ -641,7 +641,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - this.lootTable = null; + //this.lootTable = null; // Paper + this.lootableData.processRefill(entityhuman); // Paper - LootTableInfo.Builder loottableinfo_builder = (new LootTableInfo.Builder((WorldServer) this.world)).set(LootContextParameters.POSITION, new BlockPosition(this.position)).a(this.lootTableSeed); + LootTableInfo.Builder loottableinfo_builder = (new LootTableInfo.Builder((WorldServer) this.world)).set(LootContextParameters.ORIGIN, Vec3D.a((BaseBlockPosition) this.position)).a(this.lootTableSeed); if (entityhuman != null) { diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java diff --git a/Spigot-Server-Patches/MC-145656-Fix-Follow-Range-Initial-Target.patch b/Spigot-Server-Patches/MC-145656-Fix-Follow-Range-Initial-Target.patch index a3f188ac35..6f243e25a6 100644 --- a/Spigot-Server-Patches/MC-145656-Fix-Follow-Range-Initial-Target.patch +++ b/Spigot-Server-Patches/MC-145656-Fix-Follow-Range-Initial-Target.patch @@ -38,9 +38,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (this.b > 0.0D) { double d0 = this.g ? entityliving1.A(entityliving) : 1.0D; -- double d1 = this.b * d0; -+ double d1 = (useFollowRange ? getFollowRange(entityliving) : this.b) * d0; // Paper - double d2 = entityliving.g(entityliving1.locX(), entityliving1.locY(), entityliving1.locZ()); +- double d1 = Math.max(this.b * d0, 2.0D); ++ double d1 = Math.max((useFollowRange ? getFollowRange(entityliving) : this.b) * d0, 2.0D); // Paper + double d2 = entityliving.h(entityliving1.locX(), entityliving1.locY(), entityliving1.locZ()); if (d2 > d1 * d1) { @@ -0,0 +0,0 @@ public class PathfinderTargetCondition { diff --git a/Spigot-Server-Patches/MC-197883-Bandaid-decode-issue.patch b/Spigot-Server-Patches/MC-197883-Bandaid-decode-issue.patch new file mode 100644 index 0000000000..d0eb22b1ef --- /dev/null +++ b/Spigot-Server-Patches/MC-197883-Bandaid-decode-issue.patch @@ -0,0 +1,28 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Fri, 21 Aug 2020 21:05:28 -0400 +Subject: [PATCH] MC-197883: Bandaid decode issue + +Mojang has a mix of type and name in the data sets, but you can only +use one. + +This will retry as name if type is asked for and not found. + +diff --git a/src/main/java/com/mojang/serialization/codecs/KeyDispatchCodec.java b/src/main/java/com/mojang/serialization/codecs/KeyDispatchCodec.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/com/mojang/serialization/codecs/KeyDispatchCodec.java ++++ b/src/main/java/com/mojang/serialization/codecs/KeyDispatchCodec.java +@@ -0,0 +0,0 @@ public class KeyDispatchCodec extends MapCodec { + + @Override + public DataResult decode(final DynamicOps ops, final MapLike input) { +- final T elementName = input.get(typeKey); ++ // Paper start - bandaid MC-197883 ++ T elementName = input.get(typeKey); ++ if (elementName == null && "type".equals(typeKey)) { ++ elementName = input.get("name"); ++ } ++ // Paper end + if (elementName == null) { + return DataResult.error("Input does not contain a key [" + typeKey + "]: " + input); + } diff --git a/Spigot-Server-Patches/MC-Dev-fixes.patch b/Spigot-Server-Patches/MC-Dev-fixes.patch index 9c2d91305d..faa6cd03c1 100644 --- a/Spigot-Server-Patches/MC-Dev-fixes.patch +++ b/Spigot-Server-Patches/MC-Dev-fixes.patch @@ -54,171 +54,31 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/BiomeBase.java +++ b/src/main/java/net/minecraft/server/BiomeBase.java @@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger; - public class BiomeBase { + public final class BiomeBase { public static final Logger LOGGER = LogManager.getLogger(); -- public static final Codec b = RecordCodecBuilder.create((instance) -> { -- RecordCodecBuilder recordcodecbuilder = BiomeBase.Precipitation.d.fieldOf("precipitation").forGetter((biomebase) -> { -- return biomebase.o; -- }); -- RecordCodecBuilder recordcodecbuilder1 = BiomeBase.Geography.r.fieldOf("category").forGetter((biomebase) -> { -- return biomebase.n; -- }); -- RecordCodecBuilder recordcodecbuilder2 = Codec.FLOAT.fieldOf("depth").forGetter((biomebase) -> { -- return biomebase.h; -- }); -- RecordCodecBuilder recordcodecbuilder3 = Codec.FLOAT.fieldOf("scale").forGetter((biomebase) -> { -- return biomebase.i; -- }); -- RecordCodecBuilder recordcodecbuilder4 = Codec.FLOAT.fieldOf("temperature").forGetter((biomebase) -> { -- return biomebase.j; -- }); -- RecordCodecBuilder recordcodecbuilder5 = Codec.FLOAT.fieldOf("downfall").forGetter((biomebase) -> { -- return biomebase.k; -- }); -- RecordCodecBuilder recordcodecbuilder6 = BiomeFog.a.fieldOf("effects").forGetter((biomebase) -> { -- return biomebase.p; -- }); -- RecordCodecBuilder recordcodecbuilder7 = Codec.INT.fieldOf("sky_color").forGetter((biomebase) -> { -- return biomebase.t; -- }); -- RecordCodecBuilder recordcodecbuilder8 = WorldGenSurfaceComposite.a.fieldOf("surface_builder").forGetter((biomebase) -> { -- return biomebase.m; -- }); -- Codec codec = WorldGenStage.Features.c; -- Codec codec1 = WorldGenCarverWrapper.a.listOf(); -- Logger logger = BiomeBase.LOGGER; -- -- logger.getClass(); -- RecordCodecBuilder recordcodecbuilder9 = Codec.simpleMap(codec, codec1.promotePartial(SystemUtils.a("Carver: ", logger::error)), INamable.a(WorldGenStage.Features.values())).fieldOf("carvers").forGetter((biomebase) -> { -- return biomebase.q; -- }); -- -- codec1 = WorldGenStage.Decoration.k; -- Codec codec2 = WorldGenFeatureConfigured.b.listOf(); -- Logger logger1 = BiomeBase.LOGGER; -- -- logger1.getClass(); -- RecordCodecBuilder recordcodecbuilder10 = Codec.simpleMap(codec1, codec2.promotePartial(SystemUtils.a("Feature: ", logger1::error)), INamable.a(WorldGenStage.Decoration.values())).fieldOf("features").forGetter((biomebase) -> { -- return biomebase.r; -- }); -- -- codec2 = StructureFeature.a.listOf(); -- logger1 = BiomeBase.LOGGER; -- logger1.getClass(); -- RecordCodecBuilder recordcodecbuilder11 = codec2.promotePartial(SystemUtils.a("Structure start: ", logger1::error)).fieldOf("starts").forGetter((biomebase) -> { -- return (List) biomebase.u.values().stream().sorted(Comparator.comparing((structurefeature) -> { -- return IRegistry.STRUCTURE_FEATURE.getKey(structurefeature.b); -- })).collect(Collectors.toList()); -- }); -- Codec codec3 = EnumCreatureType.g; -- Codec codec4 = BiomeBase.BiomeMeta.b.listOf(); -- Logger logger2 = BiomeBase.LOGGER; -- -- logger2.getClass(); -- return instance.group(recordcodecbuilder, recordcodecbuilder1, recordcodecbuilder2, recordcodecbuilder3, recordcodecbuilder4, recordcodecbuilder5, recordcodecbuilder6, recordcodecbuilder7, recordcodecbuilder8, recordcodecbuilder9, recordcodecbuilder10, recordcodecbuilder11, Codec.simpleMap(codec3, codec4.promotePartial(SystemUtils.a("Spawn data: ", logger2::error)), INamable.a(EnumCreatureType.values())).fieldOf("spawners").forGetter((biomebase) -> { -- return biomebase.v; -- }), BiomeBase.d.a.listOf().fieldOf("climate_parameters").forGetter((biomebase) -> { -- return biomebase.x; -- }), Codec.STRING.optionalFieldOf("parent").forGetter((biomebase) -> { -- return Optional.ofNullable(biomebase.l); -- })).apply(instance, BiomeBase::new); -+ // Paper decompile error - Spigots stupid decompiler -+ public static final Codec b = RecordCodecBuilder.create(i -> { -+ Codec k1 = WorldGenStage.Decoration.k; // Erase type - WorldGenstage.Decoration has wrong type -+ return i.group( -+ Precipitation.d.fieldOf("precipitation").forGetter(biome -> biome.o), -+ Geography.r.fieldOf("category").forGetter(biome -> biome.n), -+ Codec.FLOAT.fieldOf("depth").forGetter(biome -> biome.h), -+ Codec.FLOAT.fieldOf("scale").forGetter(biome -> biome.i), -+ Codec.FLOAT.fieldOf("temperature").forGetter(biome -> biome.j), -+ Codec.FLOAT.fieldOf("downfall").forGetter(biome -> biome.k), -+ BiomeFog.a.fieldOf("effects").forGetter(biome -> biome.p), -+ Codec.INT.fieldOf("sky_color").forGetter(biome -> biome.t), -+ WorldGenSurfaceComposite.a.fieldOf("surface_builder").forGetter(biome -> biome.m), -+ Codec.simpleMap(WorldGenStage.Features.c, WorldGenCarverWrapper.a.listOf().promotePartial(SystemUtils.a("Carver: ", LOGGER::error)), INamable.a(WorldGenStage.Features.values())).fieldOf("carvers").forGetter(biome -> biome.q), -+ Codec.simpleMap((Codec) k1, WorldGenFeatureConfigured.b.listOf().promotePartial(SystemUtils.a("Feature: ", LOGGER::error)), INamable.a(WorldGenStage.Decoration.values())).fieldOf("features").forGetter(biome -> biome.r), -+ StructureFeature.a.listOf().promotePartial(SystemUtils.a("Structure start: ", LOGGER::error)).fieldOf("starts").forGetter(biome -> biome.u.values().stream().sorted(Comparator.comparing(cf -> IRegistry.STRUCTURE_FEATURE.getKey(cf.b))).collect(Collectors.toList())), -+ Codec.simpleMap(EnumCreatureType.g, BiomeMeta.b.listOf().promotePartial(SystemUtils.a("Spawn data: ", LOGGER::error)), INamable.a(EnumCreatureType.values())).fieldOf("spawners").forGetter(biome -> biome.v), -+ d.a.listOf().fieldOf("climate_parameters").forGetter(biome -> biome.x), -+ Codec.STRING.optionalFieldOf("parent").forGetter(biome -> Optional.ofNullable(biome.l)) -+ ).apply(i, BiomeBase::new); -+ // Paper end ++ // Paper start ++ private static class dProxy extends BiomeBase.d { ++ private dProxy(Precipitation biomebase_precipitation, float f, TemperatureModifier biomebase_temperaturemodifier, float f1) { ++ super(biomebase_precipitation, f, biomebase_temperaturemodifier, f1); ++ } ++ }; ++ // Paper end + public static final Codec b = RecordCodecBuilder.create((instance) -> { +- return instance.group(BiomeBase.d.a.forGetter((biomebase) -> { ++ return instance.group(dProxy.a.forGetter((biomebase) -> { // Paper + return biomebase.j; + }), BiomeBase.Geography.r.fieldOf("category").forGetter((biomebase) -> { + return biomebase.o; +@@ -0,0 +0,0 @@ public final class BiomeBase { + })).apply(instance, BiomeBase::new); }); - public static final Set c = Sets.newHashSet(); -- public static final RegistryBlockID d = new RegistryBlockID<>(); -- protected static final NoiseGenerator3 e = new NoiseGenerator3(new SeededRandom(1234L), ImmutableList.of(0)); -+ public static final RegistryBlockID reg = new RegistryBlockID<>(); // Paper - decompile error - rename -+ protected static final NoiseGenerator3 NOISE_GENERATOR_3 = new NoiseGenerator3(new SeededRandom(1234L), ImmutableList.of(0)); // Paper - decompile error - rename - public static final NoiseGenerator3 f = new NoiseGenerator3(new SeededRandom(2345L), ImmutableList.of(0)); - @Nullable - protected String g; -@@ -0,0 +0,0 @@ public class BiomeBase { - - @Nullable - public static BiomeBase a(BiomeBase biomebase) { -- return (BiomeBase) BiomeBase.d.fromId(IRegistry.BIOME.a((Object) biomebase)); -+ return (BiomeBase) BiomeBase.reg.fromId(IRegistry.BIOME.a(biomebase)); // Paper - decompile fix / rename - } - - public static WorldGenCarverWrapper a(WorldGenCarverAbstract worldgencarverabstract, C c0) { -@@ -0,0 +0,0 @@ public class BiomeBase { - }, Function.identity())); - this.v = map2; - this.x = list1; -- this.l = (String) optional.orElse((Object) null); -+ this.l = (String) optional.orElse(null); // Paper - decompile fix - Stream stream = map1.values().stream().flatMap(Collection::stream).filter((worldgenfeatureconfigured) -> { - return worldgenfeatureconfigured.d == WorldGenerator.DECORATED_FLOWER; - }); -@@ -0,0 +0,0 @@ public class BiomeBase { - - protected float a(BlockPosition blockposition) { - if (blockposition.getY() > 64) { -- float f = (float) (BiomeBase.e.a((double) ((float) blockposition.getX() / 8.0F), (double) ((float) blockposition.getZ() / 8.0F), false) * 4.0D); -+ float f = (float) (BiomeBase.NOISE_GENERATOR_3.a((double) ((float) blockposition.getX() / 8.0F), (double) ((float) blockposition.getZ() / 8.0F), false) * 4.0D); // Paper - decompile error - rename - - return this.getTemperature() - (f + (float) blockposition.getY() - 64.0F) * 0.05F / 30.0F; - } else { -diff --git a/src/main/java/net/minecraft/server/BiomeFrozenDeepOcean.java b/src/main/java/net/minecraft/server/BiomeFrozenDeepOcean.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BiomeFrozenDeepOcean.java -+++ b/src/main/java/net/minecraft/server/BiomeFrozenDeepOcean.java -@@ -0,0 +0,0 @@ public class BiomeFrozenDeepOcean extends BiomeBase { - } - - if (blockposition.getY() > 64) { -- float f1 = (float) (BiomeFrozenDeepOcean.e.a((double) ((float) blockposition.getX() / 8.0F), (double) ((float) blockposition.getZ() / 8.0F), false) * 4.0D); -+ float f1 = (float) (BiomeFrozenDeepOcean.NOISE_GENERATOR_3.a((double) ((float) blockposition.getX() / 8.0F), (double) ((float) blockposition.getZ() / 8.0F), false) * 4.0D); // Paper - rename - - return f - (f1 + (float) blockposition.getY() - 64.0F) * 0.05F / 30.0F; - } else { -diff --git a/src/main/java/net/minecraft/server/BiomeFrozenOcean.java b/src/main/java/net/minecraft/server/BiomeFrozenOcean.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BiomeFrozenOcean.java -+++ b/src/main/java/net/minecraft/server/BiomeFrozenOcean.java -@@ -0,0 +0,0 @@ public final class BiomeFrozenOcean extends BiomeBase { - } - - if (blockposition.getY() > 64) { -- float f1 = (float) (BiomeFrozenOcean.e.a((double) ((float) blockposition.getX() / 8.0F), (double) ((float) blockposition.getZ() / 8.0F), false) * 4.0D); -+ float f1 = (float) (BiomeFrozenOcean.NOISE_GENERATOR_3.a((double) ((float) blockposition.getX() / 8.0F), (double) ((float) blockposition.getZ() / 8.0F), false) * 4.0D); // Paper - rename - - return f - (f1 + (float) blockposition.getY() - 64.0F) * 0.05F / 30.0F; - } else { -diff --git a/src/main/java/net/minecraft/server/Biomes.java b/src/main/java/net/minecraft/server/Biomes.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Biomes.java -+++ b/src/main/java/net/minecraft/server/Biomes.java -@@ -0,0 +0,0 @@ public abstract class Biomes { - private static BiomeBase a(int i, String s, BiomeBase biomebase) { - IRegistry.a(IRegistry.BIOME, i, s, biomebase); - if (biomebase.b()) { -- BiomeBase.d.a(biomebase, IRegistry.BIOME.a(IRegistry.BIOME.get(new MinecraftKey(biomebase.l)))); -+ BiomeBase.reg.a(biomebase, IRegistry.BIOME.a(IRegistry.BIOME.get(new MinecraftKey(biomebase.l)))); - } - - return biomebase; + public static final Codec c = RecordCodecBuilder.create((instance) -> { +- return instance.group(BiomeBase.d.a.forGetter((biomebase) -> { ++ return instance.group(dProxy.a.forGetter((biomebase) -> { // Paper + return biomebase.j; + }), BiomeBase.Geography.r.fieldOf("category").forGetter((biomebase) -> { + return biomebase.o; diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/BlockPosition.java @@ -262,6 +122,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.n = j2 != 0; blockposition_mutableblockposition = this.h.d(i1 + l1, j1 + i2, k1 + j2); } +@@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition { + }; + } + +- public static Iterable a(BlockPosition blockposition, int i, EnumDirection enumdirection, EnumDirection enumdirection1) { ++ public static Iterable a(BlockPosition blockposition, int I, EnumDirection enumdirection, EnumDirection enumdirection1) { // Paper - decompile fix + Validate.validState(enumdirection.n() != enumdirection1.n(), "The two directions cannot be on the same axis", new Object[0]); + return () -> { + return new AbstractIterator() { + private final EnumDirection[] e = new EnumDirection[]{enumdirection, enumdirection1, enumdirection.opposite(), enumdirection1.opposite()}; + private final BlockPosition.MutableBlockPosition f = blockposition.i().c(enumdirection1); +- private final int g = 4 * i; ++ private final int g = 4 * I; + private int h = -1; + private int i; + private int j; diff --git a/src/main/java/net/minecraft/server/BlockStateEnum.java b/src/main/java/net/minecraft/server/BlockStateEnum.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/BlockStateEnum.java @@ -292,6 +168,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 })); CraftingManager.LOGGER.info("Loaded {} recipes", map1.size()); } +diff --git a/src/main/java/net/minecraft/server/EnderDragonBattle.java b/src/main/java/net/minecraft/server/EnderDragonBattle.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/EnderDragonBattle.java ++++ b/src/main/java/net/minecraft/server/EnderDragonBattle.java +@@ -0,0 +0,0 @@ public class EnderDragonBattle { + } + } + +- worldgenendtrophy.b((WorldGenFeatureConfiguration) WorldGenFeatureConfiguration.k).a(this.world, this.world.getChunkProvider().getChunkGenerator(), new Random(), this.exitPortalLocation); ++ worldgenendtrophy.b(WorldGenFeatureConfiguration.k).a(this.world, this.world.getChunkProvider().getChunkGenerator(), new Random(), this.exitPortalLocation); // Paper - decompile fix + } + + private EntityEnderDragon o() { diff --git a/src/main/java/net/minecraft/server/EntityVindicator.java b/src/main/java/net/minecraft/server/EntityVindicator.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityVindicator.java @@ -313,8 +202,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public enum EnumProtocol { -- HANDSHAKING(-1, b().a(EnumProtocolDirection.SERVERBOUND, (new EnumProtocol.a<>()).a(PacketHandshakingInSetProtocol.class, PacketHandshakingInSetProtocol::new))), PLAY(0, b().a(EnumProtocolDirection.CLIENTBOUND, (new EnumProtocol.a<>()).a(PacketPlayOutSpawnEntity.class, PacketPlayOutSpawnEntity::new).a(PacketPlayOutSpawnEntityExperienceOrb.class, PacketPlayOutSpawnEntityExperienceOrb::new).a(PacketPlayOutSpawnEntityLiving.class, PacketPlayOutSpawnEntityLiving::new).a(PacketPlayOutSpawnEntityPainting.class, PacketPlayOutSpawnEntityPainting::new).a(PacketPlayOutNamedEntitySpawn.class, PacketPlayOutNamedEntitySpawn::new).a(PacketPlayOutAnimation.class, PacketPlayOutAnimation::new).a(PacketPlayOutStatistic.class, PacketPlayOutStatistic::new).a(PacketPlayOutBlockBreak.class, PacketPlayOutBlockBreak::new).a(PacketPlayOutBlockBreakAnimation.class, PacketPlayOutBlockBreakAnimation::new).a(PacketPlayOutTileEntityData.class, PacketPlayOutTileEntityData::new).a(PacketPlayOutBlockAction.class, PacketPlayOutBlockAction::new).a(PacketPlayOutBlockChange.class, PacketPlayOutBlockChange::new).a(PacketPlayOutBoss.class, PacketPlayOutBoss::new).a(PacketPlayOutServerDifficulty.class, PacketPlayOutServerDifficulty::new).a(PacketPlayOutChat.class, PacketPlayOutChat::new).a(PacketPlayOutMultiBlockChange.class, PacketPlayOutMultiBlockChange::new).a(PacketPlayOutTabComplete.class, PacketPlayOutTabComplete::new).a(PacketPlayOutCommands.class, PacketPlayOutCommands::new).a(PacketPlayOutTransaction.class, PacketPlayOutTransaction::new).a(PacketPlayOutCloseWindow.class, PacketPlayOutCloseWindow::new).a(PacketPlayOutWindowItems.class, PacketPlayOutWindowItems::new).a(PacketPlayOutWindowData.class, PacketPlayOutWindowData::new).a(PacketPlayOutSetSlot.class, PacketPlayOutSetSlot::new).a(PacketPlayOutSetCooldown.class, PacketPlayOutSetCooldown::new).a(PacketPlayOutCustomPayload.class, PacketPlayOutCustomPayload::new).a(PacketPlayOutCustomSoundEffect.class, PacketPlayOutCustomSoundEffect::new).a(PacketPlayOutKickDisconnect.class, PacketPlayOutKickDisconnect::new).a(PacketPlayOutEntityStatus.class, PacketPlayOutEntityStatus::new).a(PacketPlayOutExplosion.class, PacketPlayOutExplosion::new).a(PacketPlayOutUnloadChunk.class, PacketPlayOutUnloadChunk::new).a(PacketPlayOutGameStateChange.class, PacketPlayOutGameStateChange::new).a(PacketPlayOutOpenWindowHorse.class, PacketPlayOutOpenWindowHorse::new).a(PacketPlayOutKeepAlive.class, PacketPlayOutKeepAlive::new).a(PacketPlayOutMapChunk.class, PacketPlayOutMapChunk::new).a(PacketPlayOutWorldEvent.class, PacketPlayOutWorldEvent::new).a(PacketPlayOutWorldParticles.class, PacketPlayOutWorldParticles::new).a(PacketPlayOutLightUpdate.class, PacketPlayOutLightUpdate::new).a(PacketPlayOutLogin.class, PacketPlayOutLogin::new).a(PacketPlayOutMap.class, PacketPlayOutMap::new).a(PacketPlayOutOpenWindowMerchant.class, PacketPlayOutOpenWindowMerchant::new).a(PacketPlayOutEntity.PacketPlayOutRelEntityMove.class, PacketPlayOutEntity.PacketPlayOutRelEntityMove::new).a(PacketPlayOutEntity.PacketPlayOutRelEntityMoveLook.class, PacketPlayOutEntity.PacketPlayOutRelEntityMoveLook::new).a(PacketPlayOutEntity.PacketPlayOutEntityLook.class, PacketPlayOutEntity.PacketPlayOutEntityLook::new).a(PacketPlayOutEntity.class, PacketPlayOutEntity::new).a(PacketPlayOutVehicleMove.class, PacketPlayOutVehicleMove::new).a(PacketPlayOutOpenBook.class, PacketPlayOutOpenBook::new).a(PacketPlayOutOpenWindow.class, PacketPlayOutOpenWindow::new).a(PacketPlayOutOpenSignEditor.class, PacketPlayOutOpenSignEditor::new).a(PacketPlayOutAutoRecipe.class, PacketPlayOutAutoRecipe::new).a(PacketPlayOutAbilities.class, PacketPlayOutAbilities::new).a(PacketPlayOutCombatEvent.class, PacketPlayOutCombatEvent::new).a(PacketPlayOutPlayerInfo.class, PacketPlayOutPlayerInfo::new).a(PacketPlayOutLookAt.class, PacketPlayOutLookAt::new).a(PacketPlayOutPosition.class, PacketPlayOutPosition::new).a(PacketPlayOutRecipes.class, PacketPlayOutRecipes::new).a(PacketPlayOutEntityDestroy.class, PacketPlayOutEntityDestroy::new).a(PacketPlayOutRemoveEntityEffect.class, PacketPlayOutRemoveEntityEffect::new).a(PacketPlayOutResourcePackSend.class, PacketPlayOutResourcePackSend::new).a(PacketPlayOutRespawn.class, PacketPlayOutRespawn::new).a(PacketPlayOutEntityHeadRotation.class, PacketPlayOutEntityHeadRotation::new).a(PacketPlayOutSelectAdvancementTab.class, PacketPlayOutSelectAdvancementTab::new).a(PacketPlayOutWorldBorder.class, PacketPlayOutWorldBorder::new).a(PacketPlayOutCamera.class, PacketPlayOutCamera::new).a(PacketPlayOutHeldItemSlot.class, PacketPlayOutHeldItemSlot::new).a(PacketPlayOutViewCentre.class, PacketPlayOutViewCentre::new).a(PacketPlayOutViewDistance.class, PacketPlayOutViewDistance::new).a(PacketPlayOutSpawnPosition.class, PacketPlayOutSpawnPosition::new).a(PacketPlayOutScoreboardDisplayObjective.class, PacketPlayOutScoreboardDisplayObjective::new).a(PacketPlayOutEntityMetadata.class, PacketPlayOutEntityMetadata::new).a(PacketPlayOutAttachEntity.class, PacketPlayOutAttachEntity::new).a(PacketPlayOutEntityVelocity.class, PacketPlayOutEntityVelocity::new).a(PacketPlayOutEntityEquipment.class, PacketPlayOutEntityEquipment::new).a(PacketPlayOutExperience.class, PacketPlayOutExperience::new).a(PacketPlayOutUpdateHealth.class, PacketPlayOutUpdateHealth::new).a(PacketPlayOutScoreboardObjective.class, PacketPlayOutScoreboardObjective::new).a(PacketPlayOutMount.class, PacketPlayOutMount::new).a(PacketPlayOutScoreboardTeam.class, PacketPlayOutScoreboardTeam::new).a(PacketPlayOutScoreboardScore.class, PacketPlayOutScoreboardScore::new).a(PacketPlayOutUpdateTime.class, PacketPlayOutUpdateTime::new).a(PacketPlayOutTitle.class, PacketPlayOutTitle::new).a(PacketPlayOutEntitySound.class, PacketPlayOutEntitySound::new).a(PacketPlayOutNamedSoundEffect.class, PacketPlayOutNamedSoundEffect::new).a(PacketPlayOutStopSound.class, PacketPlayOutStopSound::new).a(PacketPlayOutPlayerListHeaderFooter.class, PacketPlayOutPlayerListHeaderFooter::new).a(PacketPlayOutNBTQuery.class, PacketPlayOutNBTQuery::new).a(PacketPlayOutCollect.class, PacketPlayOutCollect::new).a(PacketPlayOutEntityTeleport.class, PacketPlayOutEntityTeleport::new).a(PacketPlayOutAdvancements.class, PacketPlayOutAdvancements::new).a(PacketPlayOutUpdateAttributes.class, PacketPlayOutUpdateAttributes::new).a(PacketPlayOutEntityEffect.class, PacketPlayOutEntityEffect::new).a(PacketPlayOutRecipeUpdate.class, PacketPlayOutRecipeUpdate::new).a(PacketPlayOutTags.class, PacketPlayOutTags::new)).a(EnumProtocolDirection.SERVERBOUND, (new EnumProtocol.a<>()).a(PacketPlayInTeleportAccept.class, PacketPlayInTeleportAccept::new).a(PacketPlayInTileNBTQuery.class, PacketPlayInTileNBTQuery::new).a(PacketPlayInDifficultyChange.class, PacketPlayInDifficultyChange::new).a(PacketPlayInChat.class, PacketPlayInChat::new).a(PacketPlayInClientCommand.class, PacketPlayInClientCommand::new).a(PacketPlayInSettings.class, PacketPlayInSettings::new).a(PacketPlayInTabComplete.class, PacketPlayInTabComplete::new).a(PacketPlayInTransaction.class, PacketPlayInTransaction::new).a(PacketPlayInEnchantItem.class, PacketPlayInEnchantItem::new).a(PacketPlayInWindowClick.class, PacketPlayInWindowClick::new).a(PacketPlayInCloseWindow.class, PacketPlayInCloseWindow::new).a(PacketPlayInCustomPayload.class, PacketPlayInCustomPayload::new).a(PacketPlayInBEdit.class, PacketPlayInBEdit::new).a(PacketPlayInEntityNBTQuery.class, PacketPlayInEntityNBTQuery::new).a(PacketPlayInUseEntity.class, PacketPlayInUseEntity::new).a(PacketPlayInJigsawGenerate.class, PacketPlayInJigsawGenerate::new).a(PacketPlayInKeepAlive.class, PacketPlayInKeepAlive::new).a(PacketPlayInDifficultyLock.class, PacketPlayInDifficultyLock::new).a(PacketPlayInFlying.PacketPlayInPosition.class, PacketPlayInFlying.PacketPlayInPosition::new).a(PacketPlayInFlying.PacketPlayInPositionLook.class, PacketPlayInFlying.PacketPlayInPositionLook::new).a(PacketPlayInFlying.PacketPlayInLook.class, PacketPlayInFlying.PacketPlayInLook::new).a(PacketPlayInFlying.class, PacketPlayInFlying::new).a(PacketPlayInVehicleMove.class, PacketPlayInVehicleMove::new).a(PacketPlayInBoatMove.class, PacketPlayInBoatMove::new).a(PacketPlayInPickItem.class, PacketPlayInPickItem::new).a(PacketPlayInAutoRecipe.class, PacketPlayInAutoRecipe::new).a(PacketPlayInAbilities.class, PacketPlayInAbilities::new).a(PacketPlayInBlockDig.class, PacketPlayInBlockDig::new).a(PacketPlayInEntityAction.class, PacketPlayInEntityAction::new).a(PacketPlayInSteerVehicle.class, PacketPlayInSteerVehicle::new).a(PacketPlayInRecipeDisplayed.class, PacketPlayInRecipeDisplayed::new).a(PacketPlayInItemName.class, PacketPlayInItemName::new).a(PacketPlayInResourcePackStatus.class, PacketPlayInResourcePackStatus::new).a(PacketPlayInAdvancements.class, PacketPlayInAdvancements::new).a(PacketPlayInTrSel.class, PacketPlayInTrSel::new).a(PacketPlayInBeacon.class, PacketPlayInBeacon::new).a(PacketPlayInHeldItemSlot.class, PacketPlayInHeldItemSlot::new).a(PacketPlayInSetCommandBlock.class, PacketPlayInSetCommandBlock::new).a(PacketPlayInSetCommandMinecart.class, PacketPlayInSetCommandMinecart::new).a(PacketPlayInSetCreativeSlot.class, PacketPlayInSetCreativeSlot::new).a(PacketPlayInSetJigsaw.class, PacketPlayInSetJigsaw::new).a(PacketPlayInStruct.class, PacketPlayInStruct::new).a(PacketPlayInUpdateSign.class, PacketPlayInUpdateSign::new).a(PacketPlayInArmAnimation.class, PacketPlayInArmAnimation::new).a(PacketPlayInSpectate.class, PacketPlayInSpectate::new).a(PacketPlayInUseItem.class, PacketPlayInUseItem::new).a(PacketPlayInBlockPlace.class, PacketPlayInBlockPlace::new))), STATUS(1, b().a(EnumProtocolDirection.SERVERBOUND, (new EnumProtocol.a<>()).a(PacketStatusInStart.class, PacketStatusInStart::new).a(PacketStatusInPing.class, PacketStatusInPing::new)).a(EnumProtocolDirection.CLIENTBOUND, (new EnumProtocol.a<>()).a(PacketStatusOutServerInfo.class, PacketStatusOutServerInfo::new).a(PacketStatusOutPong.class, PacketStatusOutPong::new))), LOGIN(2, b().a(EnumProtocolDirection.CLIENTBOUND, (new EnumProtocol.a<>()).a(PacketLoginOutDisconnect.class, PacketLoginOutDisconnect::new).a(PacketLoginOutEncryptionBegin.class, PacketLoginOutEncryptionBegin::new).a(PacketLoginOutSuccess.class, PacketLoginOutSuccess::new).a(PacketLoginOutSetCompression.class, PacketLoginOutSetCompression::new).a(PacketLoginOutCustomPayload.class, PacketLoginOutCustomPayload::new)).a(EnumProtocolDirection.SERVERBOUND, (new EnumProtocol.a<>()).a(PacketLoginInStart.class, PacketLoginInStart::new).a(PacketLoginInEncryptionBegin.class, PacketLoginInEncryptionBegin::new).a(PacketLoginInCustomPayload.class, PacketLoginInCustomPayload::new))); -+ HANDSHAKING(-1, b().a(EnumProtocolDirection.SERVERBOUND, (new EnumProtocol.a()).a(PacketHandshakingInSetProtocol.class, PacketHandshakingInSetProtocol::new))), PLAY(0, b().a(EnumProtocolDirection.CLIENTBOUND, (new EnumProtocol.a()).a(PacketPlayOutSpawnEntity.class, PacketPlayOutSpawnEntity::new).a(PacketPlayOutSpawnEntityExperienceOrb.class, PacketPlayOutSpawnEntityExperienceOrb::new).a(PacketPlayOutSpawnEntityLiving.class, PacketPlayOutSpawnEntityLiving::new).a(PacketPlayOutSpawnEntityPainting.class, PacketPlayOutSpawnEntityPainting::new).a(PacketPlayOutNamedEntitySpawn.class, PacketPlayOutNamedEntitySpawn::new).a(PacketPlayOutAnimation.class, PacketPlayOutAnimation::new).a(PacketPlayOutStatistic.class, PacketPlayOutStatistic::new).a(PacketPlayOutBlockBreak.class, PacketPlayOutBlockBreak::new).a(PacketPlayOutBlockBreakAnimation.class, PacketPlayOutBlockBreakAnimation::new).a(PacketPlayOutTileEntityData.class, PacketPlayOutTileEntityData::new).a(PacketPlayOutBlockAction.class, PacketPlayOutBlockAction::new).a(PacketPlayOutBlockChange.class, PacketPlayOutBlockChange::new).a(PacketPlayOutBoss.class, PacketPlayOutBoss::new).a(PacketPlayOutServerDifficulty.class, PacketPlayOutServerDifficulty::new).a(PacketPlayOutChat.class, PacketPlayOutChat::new).a(PacketPlayOutMultiBlockChange.class, PacketPlayOutMultiBlockChange::new).a(PacketPlayOutTabComplete.class, PacketPlayOutTabComplete::new).a(PacketPlayOutCommands.class, PacketPlayOutCommands::new).a(PacketPlayOutTransaction.class, PacketPlayOutTransaction::new).a(PacketPlayOutCloseWindow.class, PacketPlayOutCloseWindow::new).a(PacketPlayOutWindowItems.class, PacketPlayOutWindowItems::new).a(PacketPlayOutWindowData.class, PacketPlayOutWindowData::new).a(PacketPlayOutSetSlot.class, PacketPlayOutSetSlot::new).a(PacketPlayOutSetCooldown.class, PacketPlayOutSetCooldown::new).a(PacketPlayOutCustomPayload.class, PacketPlayOutCustomPayload::new).a(PacketPlayOutCustomSoundEffect.class, PacketPlayOutCustomSoundEffect::new).a(PacketPlayOutKickDisconnect.class, PacketPlayOutKickDisconnect::new).a(PacketPlayOutEntityStatus.class, PacketPlayOutEntityStatus::new).a(PacketPlayOutExplosion.class, PacketPlayOutExplosion::new).a(PacketPlayOutUnloadChunk.class, PacketPlayOutUnloadChunk::new).a(PacketPlayOutGameStateChange.class, PacketPlayOutGameStateChange::new).a(PacketPlayOutOpenWindowHorse.class, PacketPlayOutOpenWindowHorse::new).a(PacketPlayOutKeepAlive.class, PacketPlayOutKeepAlive::new).a(PacketPlayOutMapChunk.class, PacketPlayOutMapChunk::new).a(PacketPlayOutWorldEvent.class, PacketPlayOutWorldEvent::new).a(PacketPlayOutWorldParticles.class, PacketPlayOutWorldParticles::new).a(PacketPlayOutLightUpdate.class, PacketPlayOutLightUpdate::new).a(PacketPlayOutLogin.class, PacketPlayOutLogin::new).a(PacketPlayOutMap.class, PacketPlayOutMap::new).a(PacketPlayOutOpenWindowMerchant.class, PacketPlayOutOpenWindowMerchant::new).a(PacketPlayOutEntity.PacketPlayOutRelEntityMove.class, PacketPlayOutEntity.PacketPlayOutRelEntityMove::new).a(PacketPlayOutEntity.PacketPlayOutRelEntityMoveLook.class, PacketPlayOutEntity.PacketPlayOutRelEntityMoveLook::new).a(PacketPlayOutEntity.PacketPlayOutEntityLook.class, PacketPlayOutEntity.PacketPlayOutEntityLook::new).a(PacketPlayOutEntity.class, PacketPlayOutEntity::new).a(PacketPlayOutVehicleMove.class, PacketPlayOutVehicleMove::new).a(PacketPlayOutOpenBook.class, PacketPlayOutOpenBook::new).a(PacketPlayOutOpenWindow.class, PacketPlayOutOpenWindow::new).a(PacketPlayOutOpenSignEditor.class, PacketPlayOutOpenSignEditor::new).a(PacketPlayOutAutoRecipe.class, PacketPlayOutAutoRecipe::new).a(PacketPlayOutAbilities.class, PacketPlayOutAbilities::new).a(PacketPlayOutCombatEvent.class, PacketPlayOutCombatEvent::new).a(PacketPlayOutPlayerInfo.class, PacketPlayOutPlayerInfo::new).a(PacketPlayOutLookAt.class, PacketPlayOutLookAt::new).a(PacketPlayOutPosition.class, PacketPlayOutPosition::new).a(PacketPlayOutRecipes.class, PacketPlayOutRecipes::new).a(PacketPlayOutEntityDestroy.class, PacketPlayOutEntityDestroy::new).a(PacketPlayOutRemoveEntityEffect.class, PacketPlayOutRemoveEntityEffect::new).a(PacketPlayOutResourcePackSend.class, PacketPlayOutResourcePackSend::new).a(PacketPlayOutRespawn.class, PacketPlayOutRespawn::new).a(PacketPlayOutEntityHeadRotation.class, PacketPlayOutEntityHeadRotation::new).a(PacketPlayOutSelectAdvancementTab.class, PacketPlayOutSelectAdvancementTab::new).a(PacketPlayOutWorldBorder.class, PacketPlayOutWorldBorder::new).a(PacketPlayOutCamera.class, PacketPlayOutCamera::new).a(PacketPlayOutHeldItemSlot.class, PacketPlayOutHeldItemSlot::new).a(PacketPlayOutViewCentre.class, PacketPlayOutViewCentre::new).a(PacketPlayOutViewDistance.class, PacketPlayOutViewDistance::new).a(PacketPlayOutSpawnPosition.class, PacketPlayOutSpawnPosition::new).a(PacketPlayOutScoreboardDisplayObjective.class, PacketPlayOutScoreboardDisplayObjective::new).a(PacketPlayOutEntityMetadata.class, PacketPlayOutEntityMetadata::new).a(PacketPlayOutAttachEntity.class, PacketPlayOutAttachEntity::new).a(PacketPlayOutEntityVelocity.class, PacketPlayOutEntityVelocity::new).a(PacketPlayOutEntityEquipment.class, PacketPlayOutEntityEquipment::new).a(PacketPlayOutExperience.class, PacketPlayOutExperience::new).a(PacketPlayOutUpdateHealth.class, PacketPlayOutUpdateHealth::new).a(PacketPlayOutScoreboardObjective.class, PacketPlayOutScoreboardObjective::new).a(PacketPlayOutMount.class, PacketPlayOutMount::new).a(PacketPlayOutScoreboardTeam.class, PacketPlayOutScoreboardTeam::new).a(PacketPlayOutScoreboardScore.class, PacketPlayOutScoreboardScore::new).a(PacketPlayOutUpdateTime.class, PacketPlayOutUpdateTime::new).a(PacketPlayOutTitle.class, PacketPlayOutTitle::new).a(PacketPlayOutEntitySound.class, PacketPlayOutEntitySound::new).a(PacketPlayOutNamedSoundEffect.class, PacketPlayOutNamedSoundEffect::new).a(PacketPlayOutStopSound.class, PacketPlayOutStopSound::new).a(PacketPlayOutPlayerListHeaderFooter.class, PacketPlayOutPlayerListHeaderFooter::new).a(PacketPlayOutNBTQuery.class, PacketPlayOutNBTQuery::new).a(PacketPlayOutCollect.class, PacketPlayOutCollect::new).a(PacketPlayOutEntityTeleport.class, PacketPlayOutEntityTeleport::new).a(PacketPlayOutAdvancements.class, PacketPlayOutAdvancements::new).a(PacketPlayOutUpdateAttributes.class, PacketPlayOutUpdateAttributes::new).a(PacketPlayOutEntityEffect.class, PacketPlayOutEntityEffect::new).a(PacketPlayOutRecipeUpdate.class, PacketPlayOutRecipeUpdate::new).a(PacketPlayOutTags.class, PacketPlayOutTags::new)).a(EnumProtocolDirection.SERVERBOUND, (new EnumProtocol.a()).a(PacketPlayInTeleportAccept.class, PacketPlayInTeleportAccept::new).a(PacketPlayInTileNBTQuery.class, PacketPlayInTileNBTQuery::new).a(PacketPlayInDifficultyChange.class, PacketPlayInDifficultyChange::new).a(PacketPlayInChat.class, PacketPlayInChat::new).a(PacketPlayInClientCommand.class, PacketPlayInClientCommand::new).a(PacketPlayInSettings.class, PacketPlayInSettings::new).a(PacketPlayInTabComplete.class, PacketPlayInTabComplete::new).a(PacketPlayInTransaction.class, PacketPlayInTransaction::new).a(PacketPlayInEnchantItem.class, PacketPlayInEnchantItem::new).a(PacketPlayInWindowClick.class, PacketPlayInWindowClick::new).a(PacketPlayInCloseWindow.class, PacketPlayInCloseWindow::new).a(PacketPlayInCustomPayload.class, PacketPlayInCustomPayload::new).a(PacketPlayInBEdit.class, PacketPlayInBEdit::new).a(PacketPlayInEntityNBTQuery.class, PacketPlayInEntityNBTQuery::new).a(PacketPlayInUseEntity.class, PacketPlayInUseEntity::new).a(PacketPlayInJigsawGenerate.class, PacketPlayInJigsawGenerate::new).a(PacketPlayInKeepAlive.class, PacketPlayInKeepAlive::new).a(PacketPlayInDifficultyLock.class, PacketPlayInDifficultyLock::new).a(PacketPlayInFlying.PacketPlayInPosition.class, PacketPlayInFlying.PacketPlayInPosition::new).a(PacketPlayInFlying.PacketPlayInPositionLook.class, PacketPlayInFlying.PacketPlayInPositionLook::new).a(PacketPlayInFlying.PacketPlayInLook.class, PacketPlayInFlying.PacketPlayInLook::new).a(PacketPlayInFlying.class, PacketPlayInFlying::new).a(PacketPlayInVehicleMove.class, PacketPlayInVehicleMove::new).a(PacketPlayInBoatMove.class, PacketPlayInBoatMove::new).a(PacketPlayInPickItem.class, PacketPlayInPickItem::new).a(PacketPlayInAutoRecipe.class, PacketPlayInAutoRecipe::new).a(PacketPlayInAbilities.class, PacketPlayInAbilities::new).a(PacketPlayInBlockDig.class, PacketPlayInBlockDig::new).a(PacketPlayInEntityAction.class, PacketPlayInEntityAction::new).a(PacketPlayInSteerVehicle.class, PacketPlayInSteerVehicle::new).a(PacketPlayInRecipeDisplayed.class, PacketPlayInRecipeDisplayed::new).a(PacketPlayInItemName.class, PacketPlayInItemName::new).a(PacketPlayInResourcePackStatus.class, PacketPlayInResourcePackStatus::new).a(PacketPlayInAdvancements.class, PacketPlayInAdvancements::new).a(PacketPlayInTrSel.class, PacketPlayInTrSel::new).a(PacketPlayInBeacon.class, PacketPlayInBeacon::new).a(PacketPlayInHeldItemSlot.class, PacketPlayInHeldItemSlot::new).a(PacketPlayInSetCommandBlock.class, PacketPlayInSetCommandBlock::new).a(PacketPlayInSetCommandMinecart.class, PacketPlayInSetCommandMinecart::new).a(PacketPlayInSetCreativeSlot.class, PacketPlayInSetCreativeSlot::new).a(PacketPlayInSetJigsaw.class, PacketPlayInSetJigsaw::new).a(PacketPlayInStruct.class, PacketPlayInStruct::new).a(PacketPlayInUpdateSign.class, PacketPlayInUpdateSign::new).a(PacketPlayInArmAnimation.class, PacketPlayInArmAnimation::new).a(PacketPlayInSpectate.class, PacketPlayInSpectate::new).a(PacketPlayInUseItem.class, PacketPlayInUseItem::new).a(PacketPlayInBlockPlace.class, PacketPlayInBlockPlace::new))), STATUS(1, b().a(EnumProtocolDirection.SERVERBOUND, (new EnumProtocol.a()).a(PacketStatusInStart.class, PacketStatusInStart::new).a(PacketStatusInPing.class, PacketStatusInPing::new)).a(EnumProtocolDirection.CLIENTBOUND, (new EnumProtocol.a()).a(PacketStatusOutServerInfo.class, PacketStatusOutServerInfo::new).a(PacketStatusOutPong.class, PacketStatusOutPong::new))), LOGIN(2, b().a(EnumProtocolDirection.CLIENTBOUND, (new EnumProtocol.a()).a(PacketLoginOutDisconnect.class, PacketLoginOutDisconnect::new).a(PacketLoginOutEncryptionBegin.class, PacketLoginOutEncryptionBegin::new).a(PacketLoginOutSuccess.class, PacketLoginOutSuccess::new).a(PacketLoginOutSetCompression.class, PacketLoginOutSetCompression::new).a(PacketLoginOutCustomPayload.class, PacketLoginOutCustomPayload::new)).a(EnumProtocolDirection.SERVERBOUND, (new EnumProtocol.a()).a(PacketLoginInStart.class, PacketLoginInStart::new).a(PacketLoginInEncryptionBegin.class, PacketLoginInEncryptionBegin::new).a(PacketLoginInCustomPayload.class, PacketLoginInCustomPayload::new))); // Paper - fix decompile error +- HANDSHAKING(-1, b().a(EnumProtocolDirection.SERVERBOUND, (new EnumProtocol.a<>()).a(PacketHandshakingInSetProtocol.class, PacketHandshakingInSetProtocol::new))), PLAY(0, b().a(EnumProtocolDirection.CLIENTBOUND, (new EnumProtocol.a<>()).a(PacketPlayOutSpawnEntity.class, PacketPlayOutSpawnEntity::new).a(PacketPlayOutSpawnEntityExperienceOrb.class, PacketPlayOutSpawnEntityExperienceOrb::new).a(PacketPlayOutSpawnEntityLiving.class, PacketPlayOutSpawnEntityLiving::new).a(PacketPlayOutSpawnEntityPainting.class, PacketPlayOutSpawnEntityPainting::new).a(PacketPlayOutNamedEntitySpawn.class, PacketPlayOutNamedEntitySpawn::new).a(PacketPlayOutAnimation.class, PacketPlayOutAnimation::new).a(PacketPlayOutStatistic.class, PacketPlayOutStatistic::new).a(PacketPlayOutBlockBreak.class, PacketPlayOutBlockBreak::new).a(PacketPlayOutBlockBreakAnimation.class, PacketPlayOutBlockBreakAnimation::new).a(PacketPlayOutTileEntityData.class, PacketPlayOutTileEntityData::new).a(PacketPlayOutBlockAction.class, PacketPlayOutBlockAction::new).a(PacketPlayOutBlockChange.class, PacketPlayOutBlockChange::new).a(PacketPlayOutBoss.class, PacketPlayOutBoss::new).a(PacketPlayOutServerDifficulty.class, PacketPlayOutServerDifficulty::new).a(PacketPlayOutChat.class, PacketPlayOutChat::new).a(PacketPlayOutTabComplete.class, PacketPlayOutTabComplete::new).a(PacketPlayOutCommands.class, PacketPlayOutCommands::new).a(PacketPlayOutTransaction.class, PacketPlayOutTransaction::new).a(PacketPlayOutCloseWindow.class, PacketPlayOutCloseWindow::new).a(PacketPlayOutWindowItems.class, PacketPlayOutWindowItems::new).a(PacketPlayOutWindowData.class, PacketPlayOutWindowData::new).a(PacketPlayOutSetSlot.class, PacketPlayOutSetSlot::new).a(PacketPlayOutSetCooldown.class, PacketPlayOutSetCooldown::new).a(PacketPlayOutCustomPayload.class, PacketPlayOutCustomPayload::new).a(PacketPlayOutCustomSoundEffect.class, PacketPlayOutCustomSoundEffect::new).a(PacketPlayOutKickDisconnect.class, PacketPlayOutKickDisconnect::new).a(PacketPlayOutEntityStatus.class, PacketPlayOutEntityStatus::new).a(PacketPlayOutExplosion.class, PacketPlayOutExplosion::new).a(PacketPlayOutUnloadChunk.class, PacketPlayOutUnloadChunk::new).a(PacketPlayOutGameStateChange.class, PacketPlayOutGameStateChange::new).a(PacketPlayOutOpenWindowHorse.class, PacketPlayOutOpenWindowHorse::new).a(PacketPlayOutKeepAlive.class, PacketPlayOutKeepAlive::new).a(PacketPlayOutMapChunk.class, PacketPlayOutMapChunk::new).a(PacketPlayOutWorldEvent.class, PacketPlayOutWorldEvent::new).a(PacketPlayOutWorldParticles.class, PacketPlayOutWorldParticles::new).a(PacketPlayOutLightUpdate.class, PacketPlayOutLightUpdate::new).a(PacketPlayOutLogin.class, PacketPlayOutLogin::new).a(PacketPlayOutMap.class, PacketPlayOutMap::new).a(PacketPlayOutOpenWindowMerchant.class, PacketPlayOutOpenWindowMerchant::new).a(PacketPlayOutEntity.PacketPlayOutRelEntityMove.class, PacketPlayOutEntity.PacketPlayOutRelEntityMove::new).a(PacketPlayOutEntity.PacketPlayOutRelEntityMoveLook.class, PacketPlayOutEntity.PacketPlayOutRelEntityMoveLook::new).a(PacketPlayOutEntity.PacketPlayOutEntityLook.class, PacketPlayOutEntity.PacketPlayOutEntityLook::new).a(PacketPlayOutEntity.class, PacketPlayOutEntity::new).a(PacketPlayOutVehicleMove.class, PacketPlayOutVehicleMove::new).a(PacketPlayOutOpenBook.class, PacketPlayOutOpenBook::new).a(PacketPlayOutOpenWindow.class, PacketPlayOutOpenWindow::new).a(PacketPlayOutOpenSignEditor.class, PacketPlayOutOpenSignEditor::new).a(PacketPlayOutAutoRecipe.class, PacketPlayOutAutoRecipe::new).a(PacketPlayOutAbilities.class, PacketPlayOutAbilities::new).a(PacketPlayOutCombatEvent.class, PacketPlayOutCombatEvent::new).a(PacketPlayOutPlayerInfo.class, PacketPlayOutPlayerInfo::new).a(PacketPlayOutLookAt.class, PacketPlayOutLookAt::new).a(PacketPlayOutPosition.class, PacketPlayOutPosition::new).a(PacketPlayOutRecipes.class, PacketPlayOutRecipes::new).a(PacketPlayOutEntityDestroy.class, PacketPlayOutEntityDestroy::new).a(PacketPlayOutRemoveEntityEffect.class, PacketPlayOutRemoveEntityEffect::new).a(PacketPlayOutResourcePackSend.class, PacketPlayOutResourcePackSend::new).a(PacketPlayOutRespawn.class, PacketPlayOutRespawn::new).a(PacketPlayOutEntityHeadRotation.class, PacketPlayOutEntityHeadRotation::new).a(PacketPlayOutMultiBlockChange.class, PacketPlayOutMultiBlockChange::new).a(PacketPlayOutSelectAdvancementTab.class, PacketPlayOutSelectAdvancementTab::new).a(PacketPlayOutWorldBorder.class, PacketPlayOutWorldBorder::new).a(PacketPlayOutCamera.class, PacketPlayOutCamera::new).a(PacketPlayOutHeldItemSlot.class, PacketPlayOutHeldItemSlot::new).a(PacketPlayOutViewCentre.class, PacketPlayOutViewCentre::new).a(PacketPlayOutViewDistance.class, PacketPlayOutViewDistance::new).a(PacketPlayOutSpawnPosition.class, PacketPlayOutSpawnPosition::new).a(PacketPlayOutScoreboardDisplayObjective.class, PacketPlayOutScoreboardDisplayObjective::new).a(PacketPlayOutEntityMetadata.class, PacketPlayOutEntityMetadata::new).a(PacketPlayOutAttachEntity.class, PacketPlayOutAttachEntity::new).a(PacketPlayOutEntityVelocity.class, PacketPlayOutEntityVelocity::new).a(PacketPlayOutEntityEquipment.class, PacketPlayOutEntityEquipment::new).a(PacketPlayOutExperience.class, PacketPlayOutExperience::new).a(PacketPlayOutUpdateHealth.class, PacketPlayOutUpdateHealth::new).a(PacketPlayOutScoreboardObjective.class, PacketPlayOutScoreboardObjective::new).a(PacketPlayOutMount.class, PacketPlayOutMount::new).a(PacketPlayOutScoreboardTeam.class, PacketPlayOutScoreboardTeam::new).a(PacketPlayOutScoreboardScore.class, PacketPlayOutScoreboardScore::new).a(PacketPlayOutUpdateTime.class, PacketPlayOutUpdateTime::new).a(PacketPlayOutTitle.class, PacketPlayOutTitle::new).a(PacketPlayOutEntitySound.class, PacketPlayOutEntitySound::new).a(PacketPlayOutNamedSoundEffect.class, PacketPlayOutNamedSoundEffect::new).a(PacketPlayOutStopSound.class, PacketPlayOutStopSound::new).a(PacketPlayOutPlayerListHeaderFooter.class, PacketPlayOutPlayerListHeaderFooter::new).a(PacketPlayOutNBTQuery.class, PacketPlayOutNBTQuery::new).a(PacketPlayOutCollect.class, PacketPlayOutCollect::new).a(PacketPlayOutEntityTeleport.class, PacketPlayOutEntityTeleport::new).a(PacketPlayOutAdvancements.class, PacketPlayOutAdvancements::new).a(PacketPlayOutUpdateAttributes.class, PacketPlayOutUpdateAttributes::new).a(PacketPlayOutEntityEffect.class, PacketPlayOutEntityEffect::new).a(PacketPlayOutRecipeUpdate.class, PacketPlayOutRecipeUpdate::new).a(PacketPlayOutTags.class, PacketPlayOutTags::new)).a(EnumProtocolDirection.SERVERBOUND, (new EnumProtocol.a<>()).a(PacketPlayInTeleportAccept.class, PacketPlayInTeleportAccept::new).a(PacketPlayInTileNBTQuery.class, PacketPlayInTileNBTQuery::new).a(PacketPlayInDifficultyChange.class, PacketPlayInDifficultyChange::new).a(PacketPlayInChat.class, PacketPlayInChat::new).a(PacketPlayInClientCommand.class, PacketPlayInClientCommand::new).a(PacketPlayInSettings.class, PacketPlayInSettings::new).a(PacketPlayInTabComplete.class, PacketPlayInTabComplete::new).a(PacketPlayInTransaction.class, PacketPlayInTransaction::new).a(PacketPlayInEnchantItem.class, PacketPlayInEnchantItem::new).a(PacketPlayInWindowClick.class, PacketPlayInWindowClick::new).a(PacketPlayInCloseWindow.class, PacketPlayInCloseWindow::new).a(PacketPlayInCustomPayload.class, PacketPlayInCustomPayload::new).a(PacketPlayInBEdit.class, PacketPlayInBEdit::new).a(PacketPlayInEntityNBTQuery.class, PacketPlayInEntityNBTQuery::new).a(PacketPlayInUseEntity.class, PacketPlayInUseEntity::new).a(PacketPlayInJigsawGenerate.class, PacketPlayInJigsawGenerate::new).a(PacketPlayInKeepAlive.class, PacketPlayInKeepAlive::new).a(PacketPlayInDifficultyLock.class, PacketPlayInDifficultyLock::new).a(PacketPlayInFlying.PacketPlayInPosition.class, PacketPlayInFlying.PacketPlayInPosition::new).a(PacketPlayInFlying.PacketPlayInPositionLook.class, PacketPlayInFlying.PacketPlayInPositionLook::new).a(PacketPlayInFlying.PacketPlayInLook.class, PacketPlayInFlying.PacketPlayInLook::new).a(PacketPlayInFlying.class, PacketPlayInFlying::new).a(PacketPlayInVehicleMove.class, PacketPlayInVehicleMove::new).a(PacketPlayInBoatMove.class, PacketPlayInBoatMove::new).a(PacketPlayInPickItem.class, PacketPlayInPickItem::new).a(PacketPlayInAutoRecipe.class, PacketPlayInAutoRecipe::new).a(PacketPlayInAbilities.class, PacketPlayInAbilities::new).a(PacketPlayInBlockDig.class, PacketPlayInBlockDig::new).a(PacketPlayInEntityAction.class, PacketPlayInEntityAction::new).a(PacketPlayInSteerVehicle.class, PacketPlayInSteerVehicle::new).a(PacketPlayInRecipeSettings.class, PacketPlayInRecipeSettings::new).a(PacketPlayInRecipeDisplayed.class, PacketPlayInRecipeDisplayed::new).a(PacketPlayInItemName.class, PacketPlayInItemName::new).a(PacketPlayInResourcePackStatus.class, PacketPlayInResourcePackStatus::new).a(PacketPlayInAdvancements.class, PacketPlayInAdvancements::new).a(PacketPlayInTrSel.class, PacketPlayInTrSel::new).a(PacketPlayInBeacon.class, PacketPlayInBeacon::new).a(PacketPlayInHeldItemSlot.class, PacketPlayInHeldItemSlot::new).a(PacketPlayInSetCommandBlock.class, PacketPlayInSetCommandBlock::new).a(PacketPlayInSetCommandMinecart.class, PacketPlayInSetCommandMinecart::new).a(PacketPlayInSetCreativeSlot.class, PacketPlayInSetCreativeSlot::new).a(PacketPlayInSetJigsaw.class, PacketPlayInSetJigsaw::new).a(PacketPlayInStruct.class, PacketPlayInStruct::new).a(PacketPlayInUpdateSign.class, PacketPlayInUpdateSign::new).a(PacketPlayInArmAnimation.class, PacketPlayInArmAnimation::new).a(PacketPlayInSpectate.class, PacketPlayInSpectate::new).a(PacketPlayInUseItem.class, PacketPlayInUseItem::new).a(PacketPlayInBlockPlace.class, PacketPlayInBlockPlace::new))), STATUS(1, b().a(EnumProtocolDirection.SERVERBOUND, (new EnumProtocol.a<>()).a(PacketStatusInStart.class, PacketStatusInStart::new).a(PacketStatusInPing.class, PacketStatusInPing::new)).a(EnumProtocolDirection.CLIENTBOUND, (new EnumProtocol.a<>()).a(PacketStatusOutServerInfo.class, PacketStatusOutServerInfo::new).a(PacketStatusOutPong.class, PacketStatusOutPong::new))), LOGIN(2, b().a(EnumProtocolDirection.CLIENTBOUND, (new EnumProtocol.a<>()).a(PacketLoginOutDisconnect.class, PacketLoginOutDisconnect::new).a(PacketLoginOutEncryptionBegin.class, PacketLoginOutEncryptionBegin::new).a(PacketLoginOutSuccess.class, PacketLoginOutSuccess::new).a(PacketLoginOutSetCompression.class, PacketLoginOutSetCompression::new).a(PacketLoginOutCustomPayload.class, PacketLoginOutCustomPayload::new)).a(EnumProtocolDirection.SERVERBOUND, (new EnumProtocol.a<>()).a(PacketLoginInStart.class, PacketLoginInStart::new).a(PacketLoginInEncryptionBegin.class, PacketLoginInEncryptionBegin::new).a(PacketLoginInCustomPayload.class, PacketLoginInCustomPayload::new))); ++ // Paper - fix decompile error - add generic names to < > like PacketListenerPlayOut ++ HANDSHAKING(-1, b().a(EnumProtocolDirection.SERVERBOUND, (new EnumProtocol.a()).a(PacketHandshakingInSetProtocol.class, PacketHandshakingInSetProtocol::new))), PLAY(0, b().a(EnumProtocolDirection.CLIENTBOUND, (new EnumProtocol.a()).a(PacketPlayOutSpawnEntity.class, PacketPlayOutSpawnEntity::new).a(PacketPlayOutSpawnEntityExperienceOrb.class, PacketPlayOutSpawnEntityExperienceOrb::new).a(PacketPlayOutSpawnEntityLiving.class, PacketPlayOutSpawnEntityLiving::new).a(PacketPlayOutSpawnEntityPainting.class, PacketPlayOutSpawnEntityPainting::new).a(PacketPlayOutNamedEntitySpawn.class, PacketPlayOutNamedEntitySpawn::new).a(PacketPlayOutAnimation.class, PacketPlayOutAnimation::new).a(PacketPlayOutStatistic.class, PacketPlayOutStatistic::new).a(PacketPlayOutBlockBreak.class, PacketPlayOutBlockBreak::new).a(PacketPlayOutBlockBreakAnimation.class, PacketPlayOutBlockBreakAnimation::new).a(PacketPlayOutTileEntityData.class, PacketPlayOutTileEntityData::new).a(PacketPlayOutBlockAction.class, PacketPlayOutBlockAction::new).a(PacketPlayOutBlockChange.class, PacketPlayOutBlockChange::new).a(PacketPlayOutBoss.class, PacketPlayOutBoss::new).a(PacketPlayOutServerDifficulty.class, PacketPlayOutServerDifficulty::new).a(PacketPlayOutChat.class, PacketPlayOutChat::new).a(PacketPlayOutTabComplete.class, PacketPlayOutTabComplete::new).a(PacketPlayOutCommands.class, PacketPlayOutCommands::new).a(PacketPlayOutTransaction.class, PacketPlayOutTransaction::new).a(PacketPlayOutCloseWindow.class, PacketPlayOutCloseWindow::new).a(PacketPlayOutWindowItems.class, PacketPlayOutWindowItems::new).a(PacketPlayOutWindowData.class, PacketPlayOutWindowData::new).a(PacketPlayOutSetSlot.class, PacketPlayOutSetSlot::new).a(PacketPlayOutSetCooldown.class, PacketPlayOutSetCooldown::new).a(PacketPlayOutCustomPayload.class, PacketPlayOutCustomPayload::new).a(PacketPlayOutCustomSoundEffect.class, PacketPlayOutCustomSoundEffect::new).a(PacketPlayOutKickDisconnect.class, PacketPlayOutKickDisconnect::new).a(PacketPlayOutEntityStatus.class, PacketPlayOutEntityStatus::new).a(PacketPlayOutExplosion.class, PacketPlayOutExplosion::new).a(PacketPlayOutUnloadChunk.class, PacketPlayOutUnloadChunk::new).a(PacketPlayOutGameStateChange.class, PacketPlayOutGameStateChange::new).a(PacketPlayOutOpenWindowHorse.class, PacketPlayOutOpenWindowHorse::new).a(PacketPlayOutKeepAlive.class, PacketPlayOutKeepAlive::new).a(PacketPlayOutMapChunk.class, PacketPlayOutMapChunk::new).a(PacketPlayOutWorldEvent.class, PacketPlayOutWorldEvent::new).a(PacketPlayOutWorldParticles.class, PacketPlayOutWorldParticles::new).a(PacketPlayOutLightUpdate.class, PacketPlayOutLightUpdate::new).a(PacketPlayOutLogin.class, PacketPlayOutLogin::new).a(PacketPlayOutMap.class, PacketPlayOutMap::new).a(PacketPlayOutOpenWindowMerchant.class, PacketPlayOutOpenWindowMerchant::new).a(PacketPlayOutEntity.PacketPlayOutRelEntityMove.class, PacketPlayOutEntity.PacketPlayOutRelEntityMove::new).a(PacketPlayOutEntity.PacketPlayOutRelEntityMoveLook.class, PacketPlayOutEntity.PacketPlayOutRelEntityMoveLook::new).a(PacketPlayOutEntity.PacketPlayOutEntityLook.class, PacketPlayOutEntity.PacketPlayOutEntityLook::new).a(PacketPlayOutEntity.class, PacketPlayOutEntity::new).a(PacketPlayOutVehicleMove.class, PacketPlayOutVehicleMove::new).a(PacketPlayOutOpenBook.class, PacketPlayOutOpenBook::new).a(PacketPlayOutOpenWindow.class, PacketPlayOutOpenWindow::new).a(PacketPlayOutOpenSignEditor.class, PacketPlayOutOpenSignEditor::new).a(PacketPlayOutAutoRecipe.class, PacketPlayOutAutoRecipe::new).a(PacketPlayOutAbilities.class, PacketPlayOutAbilities::new).a(PacketPlayOutCombatEvent.class, PacketPlayOutCombatEvent::new).a(PacketPlayOutPlayerInfo.class, PacketPlayOutPlayerInfo::new).a(PacketPlayOutLookAt.class, PacketPlayOutLookAt::new).a(PacketPlayOutPosition.class, PacketPlayOutPosition::new).a(PacketPlayOutRecipes.class, PacketPlayOutRecipes::new).a(PacketPlayOutEntityDestroy.class, PacketPlayOutEntityDestroy::new).a(PacketPlayOutRemoveEntityEffect.class, PacketPlayOutRemoveEntityEffect::new).a(PacketPlayOutResourcePackSend.class, PacketPlayOutResourcePackSend::new).a(PacketPlayOutRespawn.class, PacketPlayOutRespawn::new).a(PacketPlayOutEntityHeadRotation.class, PacketPlayOutEntityHeadRotation::new).a(PacketPlayOutMultiBlockChange.class, PacketPlayOutMultiBlockChange::new).a(PacketPlayOutSelectAdvancementTab.class, PacketPlayOutSelectAdvancementTab::new).a(PacketPlayOutWorldBorder.class, PacketPlayOutWorldBorder::new).a(PacketPlayOutCamera.class, PacketPlayOutCamera::new).a(PacketPlayOutHeldItemSlot.class, PacketPlayOutHeldItemSlot::new).a(PacketPlayOutViewCentre.class, PacketPlayOutViewCentre::new).a(PacketPlayOutViewDistance.class, PacketPlayOutViewDistance::new).a(PacketPlayOutSpawnPosition.class, PacketPlayOutSpawnPosition::new).a(PacketPlayOutScoreboardDisplayObjective.class, PacketPlayOutScoreboardDisplayObjective::new).a(PacketPlayOutEntityMetadata.class, PacketPlayOutEntityMetadata::new).a(PacketPlayOutAttachEntity.class, PacketPlayOutAttachEntity::new).a(PacketPlayOutEntityVelocity.class, PacketPlayOutEntityVelocity::new).a(PacketPlayOutEntityEquipment.class, PacketPlayOutEntityEquipment::new).a(PacketPlayOutExperience.class, PacketPlayOutExperience::new).a(PacketPlayOutUpdateHealth.class, PacketPlayOutUpdateHealth::new).a(PacketPlayOutScoreboardObjective.class, PacketPlayOutScoreboardObjective::new).a(PacketPlayOutMount.class, PacketPlayOutMount::new).a(PacketPlayOutScoreboardTeam.class, PacketPlayOutScoreboardTeam::new).a(PacketPlayOutScoreboardScore.class, PacketPlayOutScoreboardScore::new).a(PacketPlayOutUpdateTime.class, PacketPlayOutUpdateTime::new).a(PacketPlayOutTitle.class, PacketPlayOutTitle::new).a(PacketPlayOutEntitySound.class, PacketPlayOutEntitySound::new).a(PacketPlayOutNamedSoundEffect.class, PacketPlayOutNamedSoundEffect::new).a(PacketPlayOutStopSound.class, PacketPlayOutStopSound::new).a(PacketPlayOutPlayerListHeaderFooter.class, PacketPlayOutPlayerListHeaderFooter::new).a(PacketPlayOutNBTQuery.class, PacketPlayOutNBTQuery::new).a(PacketPlayOutCollect.class, PacketPlayOutCollect::new).a(PacketPlayOutEntityTeleport.class, PacketPlayOutEntityTeleport::new).a(PacketPlayOutAdvancements.class, PacketPlayOutAdvancements::new).a(PacketPlayOutUpdateAttributes.class, PacketPlayOutUpdateAttributes::new).a(PacketPlayOutEntityEffect.class, PacketPlayOutEntityEffect::new).a(PacketPlayOutRecipeUpdate.class, PacketPlayOutRecipeUpdate::new).a(PacketPlayOutTags.class, PacketPlayOutTags::new)).a(EnumProtocolDirection.SERVERBOUND, (new EnumProtocol.a()).a(PacketPlayInTeleportAccept.class, PacketPlayInTeleportAccept::new).a(PacketPlayInTileNBTQuery.class, PacketPlayInTileNBTQuery::new).a(PacketPlayInDifficultyChange.class, PacketPlayInDifficultyChange::new).a(PacketPlayInChat.class, PacketPlayInChat::new).a(PacketPlayInClientCommand.class, PacketPlayInClientCommand::new).a(PacketPlayInSettings.class, PacketPlayInSettings::new).a(PacketPlayInTabComplete.class, PacketPlayInTabComplete::new).a(PacketPlayInTransaction.class, PacketPlayInTransaction::new).a(PacketPlayInEnchantItem.class, PacketPlayInEnchantItem::new).a(PacketPlayInWindowClick.class, PacketPlayInWindowClick::new).a(PacketPlayInCloseWindow.class, PacketPlayInCloseWindow::new).a(PacketPlayInCustomPayload.class, PacketPlayInCustomPayload::new).a(PacketPlayInBEdit.class, PacketPlayInBEdit::new).a(PacketPlayInEntityNBTQuery.class, PacketPlayInEntityNBTQuery::new).a(PacketPlayInUseEntity.class, PacketPlayInUseEntity::new).a(PacketPlayInJigsawGenerate.class, PacketPlayInJigsawGenerate::new).a(PacketPlayInKeepAlive.class, PacketPlayInKeepAlive::new).a(PacketPlayInDifficultyLock.class, PacketPlayInDifficultyLock::new).a(PacketPlayInFlying.PacketPlayInPosition.class, PacketPlayInFlying.PacketPlayInPosition::new).a(PacketPlayInFlying.PacketPlayInPositionLook.class, PacketPlayInFlying.PacketPlayInPositionLook::new).a(PacketPlayInFlying.PacketPlayInLook.class, PacketPlayInFlying.PacketPlayInLook::new).a(PacketPlayInFlying.class, PacketPlayInFlying::new).a(PacketPlayInVehicleMove.class, PacketPlayInVehicleMove::new).a(PacketPlayInBoatMove.class, PacketPlayInBoatMove::new).a(PacketPlayInPickItem.class, PacketPlayInPickItem::new).a(PacketPlayInAutoRecipe.class, PacketPlayInAutoRecipe::new).a(PacketPlayInAbilities.class, PacketPlayInAbilities::new).a(PacketPlayInBlockDig.class, PacketPlayInBlockDig::new).a(PacketPlayInEntityAction.class, PacketPlayInEntityAction::new).a(PacketPlayInSteerVehicle.class, PacketPlayInSteerVehicle::new).a(PacketPlayInRecipeSettings.class, PacketPlayInRecipeSettings::new).a(PacketPlayInRecipeDisplayed.class, PacketPlayInRecipeDisplayed::new).a(PacketPlayInItemName.class, PacketPlayInItemName::new).a(PacketPlayInResourcePackStatus.class, PacketPlayInResourcePackStatus::new).a(PacketPlayInAdvancements.class, PacketPlayInAdvancements::new).a(PacketPlayInTrSel.class, PacketPlayInTrSel::new).a(PacketPlayInBeacon.class, PacketPlayInBeacon::new).a(PacketPlayInHeldItemSlot.class, PacketPlayInHeldItemSlot::new).a(PacketPlayInSetCommandBlock.class, PacketPlayInSetCommandBlock::new).a(PacketPlayInSetCommandMinecart.class, PacketPlayInSetCommandMinecart::new).a(PacketPlayInSetCreativeSlot.class, PacketPlayInSetCreativeSlot::new).a(PacketPlayInSetJigsaw.class, PacketPlayInSetJigsaw::new).a(PacketPlayInStruct.class, PacketPlayInStruct::new).a(PacketPlayInUpdateSign.class, PacketPlayInUpdateSign::new).a(PacketPlayInArmAnimation.class, PacketPlayInArmAnimation::new).a(PacketPlayInSpectate.class, PacketPlayInSpectate::new).a(PacketPlayInUseItem.class, PacketPlayInUseItem::new).a(PacketPlayInBlockPlace.class, PacketPlayInBlockPlace::new))), STATUS(1, b().a(EnumProtocolDirection.SERVERBOUND, (new EnumProtocol.a()).a(PacketStatusInStart.class, PacketStatusInStart::new).a(PacketStatusInPing.class, PacketStatusInPing::new)).a(EnumProtocolDirection.CLIENTBOUND, (new EnumProtocol.a()).a(PacketStatusOutServerInfo.class, PacketStatusOutServerInfo::new).a(PacketStatusOutPong.class, PacketStatusOutPong::new))), LOGIN(2, b().a(EnumProtocolDirection.CLIENTBOUND, (new EnumProtocol.a()).a(PacketLoginOutDisconnect.class, PacketLoginOutDisconnect::new).a(PacketLoginOutEncryptionBegin.class, PacketLoginOutEncryptionBegin::new).a(PacketLoginOutSuccess.class, PacketLoginOutSuccess::new).a(PacketLoginOutSetCompression.class, PacketLoginOutSetCompression::new).a(PacketLoginOutCustomPayload.class, PacketLoginOutCustomPayload::new)).a(EnumProtocolDirection.SERVERBOUND, (new EnumProtocol.a()).a(PacketLoginInStart.class, PacketLoginInStart::new).a(PacketLoginInEncryptionBegin.class, PacketLoginInEncryptionBegin::new).a(PacketLoginInCustomPayload.class, PacketLoginInCustomPayload::new))); private static final EnumProtocol[] e = new EnumProtocol[4]; private static final Map>, EnumProtocol> f = Maps.newHashMap(); @@ -357,6 +247,65 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return true; } } +diff --git a/src/main/java/net/minecraft/server/IBlockDataHolder.java b/src/main/java/net/minecraft/server/IBlockDataHolder.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/IBlockDataHolder.java ++++ b/src/main/java/net/minecraft/server/IBlockDataHolder.java +@@ -0,0 +0,0 @@ public abstract class IBlockDataHolder { + } else { + IBlockState iblockstate = (IBlockState) entry.getKey(); + +- return iblockstate.getName() + "=" + this.a(iblockstate, (Comparable) entry.getValue()); ++ return iblockstate.getName() + "=" + this.a((IBlockState) iblockstate, (Comparable) entry.getValue()); // Paper - decompile fix + } + } + +- private > String a(IBlockState iblockstate, Comparable comparable) { ++ private > String a(IBlockState iblockstate, T comparable) { // Paper - decompile error + return iblockstate.a(comparable); + } + }; +@@ -0,0 +0,0 @@ public abstract class IBlockDataHolder { + } + + public > S a(IBlockState iblockstate) { +- return this.set(iblockstate, (Comparable) a(iblockstate.getValues(), (Object) this.get(iblockstate))); ++ return this.set(iblockstate, a(iblockstate.getValues(), this.get(iblockstate))); // Paper - decompile error + } + + protected static T a(Collection collection, T t0) { +- Iterator iterator = collection.iterator(); ++ Iterator iterator = collection.iterator(); // Paper + + do { + if (!iterator.hasNext()) { +@@ -0,0 +0,0 @@ public abstract class IBlockDataHolder { + if (comparable == null) { + throw new IllegalArgumentException("Cannot get property " + iblockstate + " as it does not exist in " + this.c); + } else { +- return (Comparable) iblockstate.getType().cast(comparable); ++ return iblockstate.getType().cast(comparable); // Paper - decompile error + } + } + +@@ -0,0 +0,0 @@ public abstract class IBlockDataHolder { + if (comparable == null) { + throw new IllegalArgumentException("Cannot set property " + iblockstate + " as it does not exist in " + this.c); + } else if (comparable == v0) { +- return this; ++ return (S) this; // Paper - decompile error + } else { + S s0 = this.e.get(iblockstate, v0); + +@@ -0,0 +0,0 @@ public abstract class IBlockDataHolder { + return codec.dispatch("Name", (iblockdataholder) -> { + return iblockdataholder.c; + }, (object) -> { +- S s0 = (IBlockDataHolder) function.apply(object); ++ S s0 = function.apply(object); // Paper - decompile error + + return s0.getStateMap().isEmpty() ? Codec.unit(s0) : s0.d.fieldOf("Properties").codec(); + }); diff --git a/src/main/java/net/minecraft/server/IBlockState.java b/src/main/java/net/minecraft/server/IBlockState.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/IBlockState.java @@ -408,7 +357,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + T t1 = iterator.next(); // Paper - decompile fix if (pathfindertargetcondition.a(entityliving, t1)) { - double d4 = t1.g(d0, d1, d2); + double d4 = t1.h(d0, d1, d2); @@ -0,0 +0,0 @@ public interface IEntityAccess { default List a(Class oclass, PathfinderTargetCondition pathfindertargetcondition, EntityLiving entityliving, AxisAlignedBB axisalignedbb) { List list = this.a(oclass, axisalignedbb, (Predicate) null); @@ -633,6 +582,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } this.c.set(i, t0); +@@ -0,0 +0,0 @@ public class RegistryBlockID implements Registry { + this.a(t0, this.a); + } + ++ // Paper start - decompile fix ++ @Override ++ public int a(T t) { ++ return getId(t); ++ } ++ // Paper end ++ + public int getId(T t0) { + Integer integer = (Integer) this.b.get(t0); + diff --git a/src/main/java/net/minecraft/server/RegistryID.java b/src/main/java/net/minecraft/server/RegistryID.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/RegistryID.java @@ -648,7 +611,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.d = (K[]) (new Object[i]); // Paper - decompile fix } ++ // Paper start - decompile fix ++ @Override ++ public int a(K k) { ++ return getId(k); ++ } ++ // Paper end ++ public int getId(@Nullable K k0) { + return this.c(this.b(k0, this.d(k0))); + } @@ -0,0 +0,0 @@ public class RegistryID implements Registry { K[] ak = this.b; int[] aint = this.c; @@ -661,11 +633,31 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.e = 0; this.f = 0; +diff --git a/src/main/java/net/minecraft/server/ServerStatisticManager.java b/src/main/java/net/minecraft/server/ServerStatisticManager.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/ServerStatisticManager.java ++++ b/src/main/java/net/minecraft/server/ServerStatisticManager.java +@@ -0,0 +0,0 @@ public class ServerStatisticManager extends StatisticManager { + ObjectIterator objectiterator = this.a.object2IntEntrySet().iterator(); + + while (objectiterator.hasNext()) { +- it.unimi.dsi.fastutil.objects.Object2IntMap.Entry> it_unimi_dsi_fastutil_objects_object2intmap_entry = (it.unimi.dsi.fastutil.objects.Object2IntMap.Entry) objectiterator.next(); ++ Object2IntMap.Entry> it_unimi_dsi_fastutil_objects_object2intmap_entry = (Object2IntMap.Entry) objectiterator.next(); // Paper - decompile fix + Statistic statistic = (Statistic) it_unimi_dsi_fastutil_objects_object2intmap_entry.getKey(); + + ((JsonObject) map.computeIfAbsent(statistic.getWrapper(), (statisticwrapper) -> { diff --git a/src/main/java/net/minecraft/server/StructureGenerator.java b/src/main/java/net/minecraft/server/StructureGenerator.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/StructureGenerator.java +++ b/src/main/java/net/minecraft/server/StructureGenerator.java @@ -0,0 +0,0 @@ public abstract class StructureGenerator + public static final StructureGenerator BASTION_REMNANT = a("Bastion_Remnant", new WorldGenFeatureBastionRemnant(WorldGenFeatureVillageConfiguration.a), WorldGenStage.Decoration.SURFACE_STRUCTURES); + public static final List> t = ImmutableList.of(StructureGenerator.PILLAGER_OUTPOST, StructureGenerator.VILLAGE, StructureGenerator.NETHER_FOSSIL); + private static final MinecraftKey w = new MinecraftKey("jigsaw"); +- private static final Map x = ImmutableMap.builder().put(new MinecraftKey("nvi"), StructureGenerator.w).put(new MinecraftKey("pcp"), StructureGenerator.w).put(new MinecraftKey("bastionremnant"), StructureGenerator.w).put(new MinecraftKey("runtime"), StructureGenerator.w).build(); ++ private static final Map x = ImmutableMap.builder().put(new MinecraftKey("nvi"), StructureGenerator.w).put(new MinecraftKey("pcp"), StructureGenerator.w).put(new MinecraftKey("bastionremnant"), StructureGenerator.w).put(new MinecraftKey("runtime"), StructureGenerator.w).build(); // Paper - decompile fix + private final Codec>> y; + private static > F a(String s, F f0, WorldGenStage.Decoration worldgenstage_decoration) { StructureGenerator.a.put(s.toLowerCase(Locale.ROOT), f0); StructureGenerator.u.put(f0, worldgenstage_decoration); @@ -802,15 +794,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - public static final Map> a = (Map) SystemUtils.a((Object) Maps.newHashMap(), (hashmap) -> { + public static final Map> a = SystemUtils.a(Maps.newHashMap(), (hashmap) -> { // Paper - decompile fix hashmap.put(VillagerProfession.FARMER, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.WHEAT, 20, 16, 2), new VillagerTrades.b(Items.POTATO, 26, 16, 2), new VillagerTrades.b(Items.CARROT, 22, 16, 2), new VillagerTrades.b(Items.BEETROOT, 15, 16, 2), new VillagerTrades.h(Items.BREAD, 1, 6, 16, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Blocks.PUMPKIN, 6, 12, 10), new VillagerTrades.h(Items.PUMPKIN_PIE, 1, 4, 5), new VillagerTrades.h(Items.APPLE, 1, 4, 16, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.COOKIE, 3, 18, 10), new VillagerTrades.b(Blocks.MELON, 4, 12, 20)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Blocks.CAKE, 1, 1, 12, 15), new VillagerTrades.i(MobEffects.NIGHT_VISION, 100, 15), new VillagerTrades.i(MobEffects.JUMP, 160, 15), new VillagerTrades.i(MobEffects.WEAKNESS, 140, 15), new VillagerTrades.i(MobEffects.BLINDNESS, 120, 15), new VillagerTrades.i(MobEffects.POISON, 280, 15), new VillagerTrades.i(MobEffects.SATURATION, 7, 15)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.GOLDEN_CARROT, 3, 3, 30), new VillagerTrades.h(Items.GLISTERING_MELON_SLICE, 4, 3, 30)}))); -- hashmap.put(VillagerProfession.FISHERMAN, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.STRING, 20, 16, 2), new VillagerTrades.b(Items.COAL, 10, 16, 2), new VillagerTrades.g(Items.COD, 6, Items.COOKED_COD, 6, 16, 1), new VillagerTrades.h(Items.COD_BUCKET, 3, 1, 16, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.COD, 15, 16, 10), new VillagerTrades.g(Items.SALMON, 6, Items.COOKED_SALMON, 6, 16, 5), new VillagerTrades.h(Items.rm, 2, 1, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.SALMON, 13, 16, 20), new VillagerTrades.e(Items.FISHING_ROD, 3, 3, 10, 0.2F)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.TROPICAL_FISH, 6, 12, 30)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.PUFFERFISH, 4, 12, 30), new VillagerTrades.c(1, 12, 30, ImmutableMap.builder().put(VillagerType.PLAINS, Items.OAK_BOAT).put(VillagerType.TAIGA, Items.SPRUCE_BOAT).put(VillagerType.SNOW, Items.SPRUCE_BOAT).put(VillagerType.DESERT, Items.JUNGLE_BOAT).put(VillagerType.JUNGLE, Items.JUNGLE_BOAT).put(VillagerType.SAVANNA, Items.ACACIA_BOAT).put(VillagerType.SWAMP, Items.DARK_OAK_BOAT).build())}))); -+ hashmap.put(VillagerProfession.FISHERMAN, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.STRING, 20, 16, 2), new VillagerTrades.b(Items.COAL, 10, 16, 2), new VillagerTrades.g(Items.COD, 6, Items.COOKED_COD, 6, 16, 1), new VillagerTrades.h(Items.COD_BUCKET, 3, 1, 16, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.COD, 15, 16, 10), new VillagerTrades.g(Items.SALMON, 6, Items.COOKED_SALMON, 6, 16, 5), new VillagerTrades.h(Items.rm, 2, 1, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.SALMON, 13, 16, 20), new VillagerTrades.e(Items.FISHING_ROD, 3, 3, 10, 0.2F)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.TROPICAL_FISH, 6, 12, 30)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.PUFFERFISH, 4, 12, 30), new VillagerTrades.c(1, 12, 30, ImmutableMap.builder().put(VillagerType.PLAINS, Items.OAK_BOAT).put(VillagerType.TAIGA, Items.SPRUCE_BOAT).put(VillagerType.SNOW, Items.SPRUCE_BOAT).put(VillagerType.DESERT, Items.JUNGLE_BOAT).put(VillagerType.JUNGLE, Items.JUNGLE_BOAT).put(VillagerType.SAVANNA, Items.ACACIA_BOAT).put(VillagerType.SWAMP, Items.DARK_OAK_BOAT).build())}))); // +- hashmap.put(VillagerProfession.FISHERMAN, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.STRING, 20, 16, 2), new VillagerTrades.b(Items.COAL, 10, 16, 2), new VillagerTrades.g(Items.COD, 6, Items.COOKED_COD, 6, 16, 1), new VillagerTrades.h(Items.COD_BUCKET, 3, 1, 16, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.COD, 15, 16, 10), new VillagerTrades.g(Items.SALMON, 6, Items.COOKED_SALMON, 6, 16, 5), new VillagerTrades.h(Items.rn, 2, 1, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.SALMON, 13, 16, 20), new VillagerTrades.e(Items.FISHING_ROD, 3, 3, 10, 0.2F)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.TROPICAL_FISH, 6, 12, 30)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.PUFFERFISH, 4, 12, 30), new VillagerTrades.c(1, 12, 30, ImmutableMap.builder().put(VillagerType.PLAINS, Items.OAK_BOAT).put(VillagerType.TAIGA, Items.SPRUCE_BOAT).put(VillagerType.SNOW, Items.SPRUCE_BOAT).put(VillagerType.DESERT, Items.JUNGLE_BOAT).put(VillagerType.JUNGLE, Items.JUNGLE_BOAT).put(VillagerType.SAVANNA, Items.ACACIA_BOAT).put(VillagerType.SWAMP, Items.DARK_OAK_BOAT).build())}))); ++ hashmap.put(VillagerProfession.FISHERMAN, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.STRING, 20, 16, 2), new VillagerTrades.b(Items.COAL, 10, 16, 2), new VillagerTrades.g(Items.COD, 6, Items.COOKED_COD, 6, 16, 1), new VillagerTrades.h(Items.COD_BUCKET, 3, 1, 16, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.COD, 15, 16, 10), new VillagerTrades.g(Items.SALMON, 6, Items.COOKED_SALMON, 6, 16, 5), new VillagerTrades.h(Items.rn, 2, 1, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.SALMON, 13, 16, 20), new VillagerTrades.e(Items.FISHING_ROD, 3, 3, 10, 0.2F)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.TROPICAL_FISH, 6, 12, 30)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.PUFFERFISH, 4, 12, 30), new VillagerTrades.c(1, 12, 30, ImmutableMap.builder().put(VillagerType.PLAINS, Items.OAK_BOAT).put(VillagerType.TAIGA, Items.SPRUCE_BOAT).put(VillagerType.SNOW, Items.SPRUCE_BOAT).put(VillagerType.DESERT, Items.JUNGLE_BOAT).put(VillagerType.JUNGLE, Items.JUNGLE_BOAT).put(VillagerType.SAVANNA, Items.ACACIA_BOAT).put(VillagerType.SWAMP, Items.DARK_OAK_BOAT).build())}))); // Paper - add to ImmutableMap..builder() hashmap.put(VillagerProfession.SHEPHERD, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Blocks.WHITE_WOOL, 18, 16, 2), new VillagerTrades.b(Blocks.BROWN_WOOL, 18, 16, 2), new VillagerTrades.b(Blocks.BLACK_WOOL, 18, 16, 2), new VillagerTrades.b(Blocks.GRAY_WOOL, 18, 16, 2), new VillagerTrades.h(Items.SHEARS, 2, 1, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.WHITE_DYE, 12, 16, 10), new VillagerTrades.b(Items.GRAY_DYE, 12, 16, 10), new VillagerTrades.b(Items.BLACK_DYE, 12, 16, 10), new VillagerTrades.b(Items.LIGHT_BLUE_DYE, 12, 16, 10), new VillagerTrades.b(Items.LIME_DYE, 12, 16, 10), new VillagerTrades.h(Blocks.WHITE_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.ORANGE_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.MAGENTA_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.LIGHT_BLUE_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.YELLOW_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.LIME_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.PINK_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.GRAY_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.LIGHT_GRAY_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.CYAN_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.PURPLE_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.BLUE_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.BROWN_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.GREEN_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.RED_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.BLACK_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.WHITE_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.ORANGE_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.MAGENTA_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.LIGHT_BLUE_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.YELLOW_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.LIME_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.PINK_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.GRAY_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.LIGHT_GRAY_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.CYAN_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.PURPLE_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.BLUE_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.BROWN_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.GREEN_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.RED_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.BLACK_CARPET, 1, 4, 16, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.YELLOW_DYE, 12, 16, 20), new VillagerTrades.b(Items.LIGHT_GRAY_DYE, 12, 16, 20), new VillagerTrades.b(Items.ORANGE_DYE, 12, 16, 20), new VillagerTrades.b(Items.RED_DYE, 12, 16, 20), new VillagerTrades.b(Items.PINK_DYE, 12, 16, 20), new VillagerTrades.h(Blocks.WHITE_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.YELLOW_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.RED_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.BLACK_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.BLUE_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.BROWN_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.CYAN_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.GRAY_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.GREEN_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.LIGHT_BLUE_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.LIGHT_GRAY_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.LIME_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.MAGENTA_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.ORANGE_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.PINK_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.PURPLE_BED, 3, 1, 12, 10)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.BROWN_DYE, 12, 16, 30), new VillagerTrades.b(Items.PURPLE_DYE, 12, 16, 30), new VillagerTrades.b(Items.BLUE_DYE, 12, 16, 30), new VillagerTrades.b(Items.GREEN_DYE, 12, 16, 30), new VillagerTrades.b(Items.MAGENTA_DYE, 12, 16, 30), new VillagerTrades.b(Items.CYAN_DYE, 12, 16, 30), new VillagerTrades.h(Items.WHITE_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.BLUE_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.LIGHT_BLUE_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.RED_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.PINK_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.GREEN_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.LIME_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.GRAY_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.BLACK_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.PURPLE_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.MAGENTA_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.CYAN_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.BROWN_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.YELLOW_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.ORANGE_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.LIGHT_GRAY_BANNER, 3, 1, 12, 15)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.PAINTING, 2, 3, 30)}))); hashmap.put(VillagerProfession.FLETCHER, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.STICK, 32, 16, 2), new VillagerTrades.h(Items.ARROW, 1, 16, 1), new VillagerTrades.g(Blocks.GRAVEL, 10, Items.FLINT, 10, 12, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.FLINT, 26, 12, 10), new VillagerTrades.h(Items.BOW, 2, 1, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.STRING, 14, 16, 20), new VillagerTrades.h(Items.CROSSBOW, 3, 1, 10)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.FEATHER, 24, 16, 30), new VillagerTrades.e(Items.BOW, 2, 3, 15)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.es, 8, 12, 30), new VillagerTrades.e(Items.CROSSBOW, 3, 3, 15), new VillagerTrades.j(Items.ARROW, 5, Items.TIPPED_ARROW, 5, 2, 12, 30)}))); -- hashmap.put(VillagerProfession.LIBRARIAN, a(ImmutableMap.builder().put(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.PAPER, 24, 16, 2), new VillagerTrades.d(1), new VillagerTrades.h(Blocks.BOOKSHELF, 9, 1, 12, 1)}).put(2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.BOOK, 4, 12, 10), new VillagerTrades.d(5), new VillagerTrades.h(Items.rj, 1, 1, 5)}).put(3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.INK_SAC, 5, 12, 20), new VillagerTrades.d(10), new VillagerTrades.h(Items.az, 1, 4, 10)}).put(4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.WRITABLE_BOOK, 2, 12, 30), new VillagerTrades.d(15), new VillagerTrades.h(Items.CLOCK, 5, 1, 15), new VillagerTrades.h(Items.COMPASS, 4, 1, 15)}).put(5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.NAME_TAG, 20, 1, 30)}).build())); -+ hashmap.put(VillagerProfession.LIBRARIAN, a(ImmutableMap.builder().put(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.PAPER, 24, 16, 2), new VillagerTrades.d(1), new VillagerTrades.h(Blocks.BOOKSHELF, 9, 1, 12, 1)}).put(2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.BOOK, 4, 12, 10), new VillagerTrades.d(5), new VillagerTrades.h(Items.rj, 1, 1, 5)}).put(3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.INK_SAC, 5, 12, 20), new VillagerTrades.d(10), new VillagerTrades.h(Items.az, 1, 4, 10)}).put(4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.WRITABLE_BOOK, 2, 12, 30), new VillagerTrades.d(15), new VillagerTrades.h(Items.CLOCK, 5, 1, 15), new VillagerTrades.h(Items.COMPASS, 4, 1, 15)}).put(5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.NAME_TAG, 20, 1, 30)}).build())); // Integer, IMerchantRecipeOption[] +- hashmap.put(VillagerProfession.LIBRARIAN, a(ImmutableMap.builder().put(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.PAPER, 24, 16, 2), new VillagerTrades.d(1), new VillagerTrades.h(Blocks.BOOKSHELF, 9, 1, 12, 1)}).put(2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.BOOK, 4, 12, 10), new VillagerTrades.d(5), new VillagerTrades.h(Items.rk, 1, 1, 5)}).put(3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.INK_SAC, 5, 12, 20), new VillagerTrades.d(10), new VillagerTrades.h(Items.az, 1, 4, 10)}).put(4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.WRITABLE_BOOK, 2, 12, 30), new VillagerTrades.d(15), new VillagerTrades.h(Items.CLOCK, 5, 1, 15), new VillagerTrades.h(Items.COMPASS, 4, 1, 15)}).put(5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.NAME_TAG, 20, 1, 30)}).build())); ++ hashmap.put(VillagerProfession.LIBRARIAN, a(ImmutableMap.builder().put(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.PAPER, 24, 16, 2), new VillagerTrades.d(1), new VillagerTrades.h(Blocks.BOOKSHELF, 9, 1, 12, 1)}).put(2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.BOOK, 4, 12, 10), new VillagerTrades.d(5), new VillagerTrades.h(Items.rk, 1, 1, 5)}).put(3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.INK_SAC, 5, 12, 20), new VillagerTrades.d(10), new VillagerTrades.h(Items.az, 1, 4, 10)}).put(4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.WRITABLE_BOOK, 2, 12, 30), new VillagerTrades.d(15), new VillagerTrades.h(Items.CLOCK, 5, 1, 15), new VillagerTrades.h(Items.COMPASS, 4, 1, 15)}).put(5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.NAME_TAG, 20, 1, 30)}).build())); // Paper - add to ImmutableMap..builder() hashmap.put(VillagerProfession.CARTOGRAPHER, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.PAPER, 24, 16, 2), new VillagerTrades.h(Items.MAP, 7, 1, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.dP, 11, 16, 10), new VillagerTrades.k(13, StructureGenerator.MONUMENT, MapIcon.Type.MONUMENT, 12, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.COMPASS, 1, 12, 20), new VillagerTrades.k(14, StructureGenerator.MANSION, MapIcon.Type.MANSION, 12, 10)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.ITEM_FRAME, 7, 1, 15), new VillagerTrades.h(Items.WHITE_BANNER, 3, 1, 15), new VillagerTrades.h(Items.BLUE_BANNER, 3, 1, 15), new VillagerTrades.h(Items.LIGHT_BLUE_BANNER, 3, 1, 15), new VillagerTrades.h(Items.RED_BANNER, 3, 1, 15), new VillagerTrades.h(Items.PINK_BANNER, 3, 1, 15), new VillagerTrades.h(Items.GREEN_BANNER, 3, 1, 15), new VillagerTrades.h(Items.LIME_BANNER, 3, 1, 15), new VillagerTrades.h(Items.GRAY_BANNER, 3, 1, 15), new VillagerTrades.h(Items.BLACK_BANNER, 3, 1, 15), new VillagerTrades.h(Items.PURPLE_BANNER, 3, 1, 15), new VillagerTrades.h(Items.MAGENTA_BANNER, 3, 1, 15), new VillagerTrades.h(Items.CYAN_BANNER, 3, 1, 15), new VillagerTrades.h(Items.BROWN_BANNER, 3, 1, 15), new VillagerTrades.h(Items.YELLOW_BANNER, 3, 1, 15), new VillagerTrades.h(Items.ORANGE_BANNER, 3, 1, 15), new VillagerTrades.h(Items.LIGHT_GRAY_BANNER, 3, 1, 15)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.GLOBE_BANNER_PATTERN, 8, 1, 30)}))); hashmap.put(VillagerProfession.CLERIC, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.ROTTEN_FLESH, 32, 16, 2), new VillagerTrades.h(Items.REDSTONE, 1, 2, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.GOLD_INGOT, 3, 12, 10), new VillagerTrades.h(Items.LAPIS_LAZULI, 1, 1, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.RABBIT_FOOT, 2, 12, 20), new VillagerTrades.h(Blocks.GLOWSTONE, 4, 1, 12, 10)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.SCUTE, 4, 12, 30), new VillagerTrades.b(Items.GLASS_BOTTLE, 9, 12, 30), new VillagerTrades.h(Items.ENDER_PEARL, 5, 1, 15)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.NETHER_WART, 22, 12, 30), new VillagerTrades.h(Items.EXPERIENCE_BOTTLE, 3, 1, 30)}))); - hashmap.put(VillagerProfession.ARMORER, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.COAL, 15, 16, 2), new VillagerTrades.h(new ItemStack(Items.IRON_LEGGINGS), 7, 1, 12, 1, 0.2F), new VillagerTrades.h(new ItemStack(Items.IRON_BOOTS), 4, 1, 12, 1, 0.2F), new VillagerTrades.h(new ItemStack(Items.IRON_HELMET), 5, 1, 12, 1, 0.2F), new VillagerTrades.h(new ItemStack(Items.IRON_CHESTPLATE), 9, 1, 12, 1, 0.2F)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.IRON_INGOT, 4, 12, 10), new VillagerTrades.h(new ItemStack(Items.ri), 36, 1, 12, 5, 0.2F), new VillagerTrades.h(new ItemStack(Items.CHAINMAIL_BOOTS), 1, 1, 12, 5, 0.2F), new VillagerTrades.h(new ItemStack(Items.CHAINMAIL_LEGGINGS), 3, 1, 12, 5, 0.2F)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.LAVA_BUCKET, 1, 12, 20), new VillagerTrades.b(Items.DIAMOND, 1, 12, 20), new VillagerTrades.h(new ItemStack(Items.CHAINMAIL_HELMET), 1, 1, 12, 10, 0.2F), new VillagerTrades.h(new ItemStack(Items.CHAINMAIL_CHESTPLATE), 4, 1, 12, 10, 0.2F), new VillagerTrades.h(new ItemStack(Items.SHIELD), 5, 1, 12, 10, 0.2F)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.e(Items.DIAMOND_LEGGINGS, 14, 3, 15, 0.2F), new VillagerTrades.e(Items.DIAMOND_BOOTS, 8, 3, 15, 0.2F)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.e(Items.DIAMOND_HELMET, 8, 3, 30, 0.2F), new VillagerTrades.e(Items.DIAMOND_CHESTPLATE, 16, 3, 30, 0.2F)}))); + hashmap.put(VillagerProfession.ARMORER, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.COAL, 15, 16, 2), new VillagerTrades.h(new ItemStack(Items.IRON_LEGGINGS), 7, 1, 12, 1, 0.2F), new VillagerTrades.h(new ItemStack(Items.IRON_BOOTS), 4, 1, 12, 1, 0.2F), new VillagerTrades.h(new ItemStack(Items.IRON_HELMET), 5, 1, 12, 1, 0.2F), new VillagerTrades.h(new ItemStack(Items.IRON_CHESTPLATE), 9, 1, 12, 1, 0.2F)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.IRON_INGOT, 4, 12, 10), new VillagerTrades.h(new ItemStack(Items.rj), 36, 1, 12, 5, 0.2F), new VillagerTrades.h(new ItemStack(Items.CHAINMAIL_BOOTS), 1, 1, 12, 5, 0.2F), new VillagerTrades.h(new ItemStack(Items.CHAINMAIL_LEGGINGS), 3, 1, 12, 5, 0.2F)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.LAVA_BUCKET, 1, 12, 20), new VillagerTrades.b(Items.DIAMOND, 1, 12, 20), new VillagerTrades.h(new ItemStack(Items.CHAINMAIL_HELMET), 1, 1, 12, 10, 0.2F), new VillagerTrades.h(new ItemStack(Items.CHAINMAIL_CHESTPLATE), 4, 1, 12, 10, 0.2F), new VillagerTrades.h(new ItemStack(Items.SHIELD), 5, 1, 12, 10, 0.2F)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.e(Items.DIAMOND_LEGGINGS, 14, 3, 15, 0.2F), new VillagerTrades.e(Items.DIAMOND_BOOTS, 8, 3, 15, 0.2F)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.e(Items.DIAMOND_HELMET, 8, 3, 30, 0.2F), new VillagerTrades.e(Items.DIAMOND_CHESTPLATE, 16, 3, 30, 0.2F)}))); diff --git a/src/main/java/net/minecraft/server/VoxelShapeMergerList.java b/src/main/java/net/minecraft/server/VoxelShapeMergerList.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/VoxelShapeMergerList.java diff --git a/Spigot-Server-Patches/MC-Utils.patch b/Spigot-Server-Patches/MC-Utils.patch index 68d687af01..e5b676708e 100644 --- a/Spigot-Server-Patches/MC-Utils.patch +++ b/Spigot-Server-Patches/MC-Utils.patch @@ -2336,13 +2336,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/BlockBase.java +++ b/src/main/java/net/minecraft/server/BlockBase.java @@ -0,0 +0,0 @@ public abstract class BlockBase { - return this.a != null ? this.a.e : Block.a(this.getCollisionShape(iblockaccess, blockposition)); + return this.a != null ? this.a.d : Block.a(this.getCollisionShape(iblockaccess, blockposition)); } + public final IBlockData getBlockData() { return p(); } // Paper - OBFHELPER protected abstract IBlockData p(); - public boolean isAlwaysDestroyable() { + public boolean isRequiresSpecialTool() { diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/BlockPosition.java @@ -2729,6 +2729,17 @@ diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/m index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java +@@ -0,0 +0,0 @@ import java.util.function.Consumer; + import java.util.function.Function; + import java.util.function.Supplier; + import javax.annotation.Nullable; ++import com.destroystokyo.paper.exception.ServerInternalException; ++import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; // Paper ++import org.apache.logging.log4j.LogManager; ++import org.apache.logging.log4j.Logger; + + public class ChunkProviderServer extends IChunkProvider { + @@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { private final ChunkMapDistance chunkMapDistance; public final ChunkGenerator chunkGenerator; @@ -2744,7 +2755,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private SpawnerCreature.d p; + // Paper start + final com.destroystokyo.paper.util.concurrent.WeakSeqLock loadedChunkMapSeqLock = new com.destroystokyo.paper.util.concurrent.WeakSeqLock(); -+ final it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap loadedChunkMap = new it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap<>(8192, 0.5f); ++ final Long2ObjectOpenHashMap loadedChunkMap = new Long2ObjectOpenHashMap<>(8192, 0.5f); + + private final Chunk[] lastLoadedChunks = new Chunk[4 * 4]; + private final long[] lastLoadedChunkKeys = new long[4 * 4]; @@ -3053,30 +3064,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void b(PacketDataSerializer packetdataserializer) { this.a(); packetdataserializer.writeByte(this.i); -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener { - - } - -- @Nullable -- public AxisAlignedBB ay() { -+ -+ @Nullable public final AxisAlignedBB getCollisionBox(){return ay();} //Paper - OBFHELPER -+ @Nullable public AxisAlignedBB ay() { - return null; - } - -@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener { - return EnumInteractionResult.PASS; - } - -+ public final AxisAlignedBB getHardCollisionBox(Entity entity){ return j(entity);}//Paper - OBFHELPER - @Nullable - public AxisAlignedBB j(Entity entity) { - return null; diff --git a/src/main/java/net/minecraft/server/EntityCreature.java b/src/main/java/net/minecraft/server/EntityCreature.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityCreature.java @@ -3137,11 +3124,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet cachedSingleHashSet; // Paper + public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) { - super(worldserver, worldserver.getSpawn(), gameprofile); + super(worldserver, worldserver.getSpawn(), worldserver.v(), gameprofile); this.spawnDimension = World.OVERWORLD; @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { this.G = 1.0F; - this.b(worldserver); + this.c(worldserver); + this.cachedSingleHashSet = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<>(this); // Paper + @@ -3161,14 +3148,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import java.util.function.Function; import java.util.stream.Stream; @@ -0,0 +0,0 @@ public class EntityTypes { - return this.bq.height; + return this.br.height; } - @Nullable - public T a(World world) { + public T create(World world) { return this.a(world); } // Paper - OBFHELPER + @Nullable public T a(World world) { // Paper - OBFHELPER - return this.be.create(this, world); + return this.bf.create(this, world); } diff --git a/src/main/java/net/minecraft/server/IAsyncTaskHandler.java b/src/main/java/net/minecraft/server/IAsyncTaskHandler.java @@ -3196,16 +3183,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/IBlockAccess.java +++ b/src/main/java/net/minecraft/server/IBlockAccess.java @@ -0,0 +0,0 @@ public interface IBlockAccess { - @Nullable TileEntity getTileEntity(BlockPosition blockposition); -+ IBlockData getTypeIfLoaded(BlockPosition blockposition); // Paper - if loaded util IBlockData getType(BlockPosition blockposition); - -+ Fluid getFluidIfLoaded(BlockPosition blockposition); // Paper - if loaded util - Fluid getFluid(BlockPosition blockposition); - + // Paper start - if loaded util ++ IBlockData getTypeIfLoaded(BlockPosition blockposition); + default Material getMaterialIfLoaded(BlockPosition blockposition) { + IBlockData type = this.getTypeIfLoaded(blockposition); + return type == null ? null : type.getMaterial(); @@ -3215,11 +3197,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + IBlockData type = this.getTypeIfLoaded(blockposition); + return type == null ? null : type.getBlock(); + } ++ Fluid getFluidIfLoaded(BlockPosition blockposition); + // Paper end -+ - default int h(BlockPosition blockposition) { - return this.getType(blockposition).f(); - } + + Fluid getFluid(BlockPosition blockposition); + diff --git a/src/main/java/net/minecraft/server/IOWorker.java b/src/main/java/net/minecraft/server/IOWorker.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/IOWorker.java @@ -3309,6 +3291,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +import com.destroystokyo.paper.block.TargetBlockInfo; +import com.google.common.util.concurrent.ThreadFactoryBuilder; ++import it.unimi.dsi.fastutil.objects.ObjectRBTreeSet; +import org.apache.commons.lang.exception.ExceptionUtils; +import org.bukkit.Location; +import org.bukkit.block.BlockFace; @@ -3517,7 +3500,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + // assumes the sets have the same comparator, and if this comparator is null then assume T is Comparable + public static void mergeSortedSets(final java.util.function.Consumer consumer, final java.util.Comparator comparator, final java.util.SortedSet...sets) { -+ final it.unimi.dsi.fastutil.objects.ObjectRBTreeSet all = new it.unimi.dsi.fastutil.objects.ObjectRBTreeSet<>(comparator); ++ final ObjectRBTreeSet all = new ObjectRBTreeSet<>(comparator); + // note: this is done in log(n!) ~ nlogn time. It could be improved if it were to mimic what mergesort does. + for (java.util.SortedSet set : sets) { + if (set != null) { @@ -3820,7 +3803,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } catch (java.lang.InterruptedException ignored) {} // Paper if (org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly) { LOGGER.info("Saving usercache.json"); - this.getUserCache().c(); + this.getUserCache().b(); diff --git a/src/main/java/net/minecraft/server/NBTTagCompound.java b/src/main/java/net/minecraft/server/NBTTagCompound.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/NBTTagCompound.java @@ -3865,8 +3848,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } -+ private void sendPacketQueue() { this.o(); } // Paper - OBFHELPER - private void o() { ++ private void sendPacketQueue() { this.p(); } // Paper - OBFHELPER + private void p() { if (this.channel != null && this.channel.isOpen()) { Queue queue = this.packetQueue; @@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler> { @@ -3912,12 +3895,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet { private NBTTagCompound d; @Nullable - private BiomeStorage e; + private int[] e; - private byte[] f; + private byte[] f; private byte[] getData() { return this.f; } // Paper - OBFHELPER private List g; private boolean h; - private boolean i; + @@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet { return bytebuf; } @@ -3944,8 +3927,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public int oldTicketLevel; private int ticketLevel; @@ -0,0 +0,0 @@ public class PlayerChunk { - public final PlayerChunk.d players; private boolean hasBeenLoaded; + private boolean x; + private final PlayerChunkMap chunkMap; // Paper + @@ -4090,7 +4073,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } @@ -0,0 +0,0 @@ public class PlayerChunk { - throw (IllegalStateException) SystemUtils.c(new IllegalStateException()); + throw (IllegalStateException) SystemUtils.c((Throwable) (new IllegalStateException())); } - this.entityTickingFuture = playerchunkmap.b(this.location); @@ -4168,7 +4151,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } + this.addPlayerToDistanceMaps(entityplayer); // Paper - distance maps } else { - SectionPosition sectionposition = entityplayer.N(); + SectionPosition sectionposition = entityplayer.O(); @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { if (!flag2) { @@ -4257,7 +4240,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/RegionFile.java +++ b/src/main/java/net/minecraft/server/RegionFile.java @@ -0,0 +0,0 @@ public class RegionFile implements AutoCloseable { - return this.d.resolve(s); + return this.e.resolve(s); } + @Nullable public synchronized DataInputStream getReadStream(ChunkCoordIntPair chunkCoordIntPair) throws IOException { return a(chunkCoordIntPair);} // Paper - OBFHELPER @@ -4363,7 +4346,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // CraftBukkit end @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - protected World(WorldDataMutable worlddatamutable, ResourceKey resourcekey, ResourceKey resourcekey1, DimensionManager dimensionmanager, Supplier supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env) { + protected World(WorldDataMutable worlddatamutable, ResourceKey resourcekey, final DimensionManager dimensionmanager, Supplier supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env) { this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((WorldDataServer) worlddatamutable).getName()); // Spigot - this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(worlddata.getName(), this.spigotConfig); // Paper + this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig((((WorldDataServer)worlddatamutable).getName()), this.spigotConfig); // Paper @@ -4438,6 +4421,14 @@ diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java +@@ -0,0 +0,0 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap; + import it.unimi.dsi.fastutil.ints.Int2ObjectMap.Entry; + import it.unimi.dsi.fastutil.longs.LongSet; + import it.unimi.dsi.fastutil.longs.LongSets; ++import it.unimi.dsi.fastutil.objects.Object2IntMap; + import it.unimi.dsi.fastutil.objects.ObjectIterator; + import it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet; + import java.io.BufferedWriter; @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { private final Map entitiesByUUID = Maps.newHashMap(); private final Queue entitiesToAdd = Queues.newArrayDeque(); @@ -4447,6 +4438,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 boolean tickingEntities; private final MinecraftServer server; public final WorldDataServer worldDataServer; // CraftBukkit - type +@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { + ObjectIterator objectiterator = spawnercreature_d.b().object2IntEntrySet().iterator(); + + while (objectiterator.hasNext()) { +- it.unimi.dsi.fastutil.objects.Object2IntMap.Entry it_unimi_dsi_fastutil_objects_object2intmap_entry = (it.unimi.dsi.fastutil.objects.Object2IntMap.Entry) objectiterator.next(); ++ Object2IntMap.Entry it_unimi_dsi_fastutil_objects_object2intmap_entry = (Object2IntMap.Entry) objectiterator.next(); // Paper - decompile fix + + bufferedwriter.write(String.format("spawn_count.%s: %d\n", ((EnumCreatureType) it_unimi_dsi_fastutil_objects_object2intmap_entry.getKey()).b(), it_unimi_dsi_fastutil_objects_object2intmap_entry.getIntValue())); + } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java @@ -4678,10 +4678,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java +++ b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java @@ -0,0 +0,0 @@ public class DummyGeneratorAccess implements GeneratorAccess { - public boolean a(BlockPosition blockposition, boolean flag, Entity entity, int i) { + public Fluid getFluid(BlockPosition blockposition) { throw new UnsupportedOperationException("Not supported yet."); } -+ + // Paper start - if loaded util + @javax.annotation.Nullable + @Override @@ -4693,13 +4692,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public IBlockData getTypeIfLoaded(BlockPosition blockposition) { + throw new UnsupportedOperationException("Not supported yet."); + } -+ + + @Override + public Fluid getFluidIfLoaded(BlockPosition blockposition) { + throw new UnsupportedOperationException("Not supported yet."); + } + // Paper end - } + @Override + public WorldBorder getWorldBorder() { + throw new UnsupportedOperationException("Not supported yet."); diff --git a/src/main/java/org/bukkit/craftbukkit/util/UnsafeList.java b/src/main/java/org/bukkit/craftbukkit/util/UnsafeList.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/UnsafeList.java diff --git a/Spigot-Server-Patches/Make-shield-blocking-delay-configurable.patch b/Spigot-Server-Patches/Make-shield-blocking-delay-configurable.patch index d1eb5d785d..2bdf430dda 100644 --- a/Spigot-Server-Patches/Make-shield-blocking-delay-configurable.patch +++ b/Spigot-Server-Patches/Make-shield-blocking-delay-configurable.patch @@ -26,8 +26,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (this.isHandRaised() && !this.activeItem.isEmpty()) { Item item = this.activeItem.getItem(); -- return item.d_(this.activeItem) != EnumAnimation.BLOCK ? false : item.e_(this.activeItem) - this.bk >= 5; -+ return item.d_(this.activeItem) != EnumAnimation.BLOCK ? false : item.e_(this.activeItem) - this.bk >= getShieldBlockingDelay(); // Paper - shieldBlockingDelay +- return item.d_(this.activeItem) != EnumAnimation.BLOCK ? false : item.e_(this.activeItem) - this.bd >= 5; ++ return item.d_(this.activeItem) != EnumAnimation.BLOCK ? false : item.e_(this.activeItem) - this.bd >= getShieldBlockingDelay(); // Paper - shieldBlockingDelay } else { return false; } diff --git a/Spigot-Server-Patches/Mid-Tick-Chunk-Tasks-Speed-up-processing-of-chunk-lo.patch b/Spigot-Server-Patches/Mid-Tick-Chunk-Tasks-Speed-up-processing-of-chunk-lo.patch index cf1ca82dd3..f1a784171b 100644 --- a/Spigot-Server-Patches/Mid-Tick-Chunk-Tasks-Speed-up-processing-of-chunk-lo.patch +++ b/Spigot-Server-Patches/Mid-Tick-Chunk-Tasks-Speed-up-processing-of-chunk-lo.patch @@ -239,7 +239,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.persistentRaid.a(); @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { timings.doSounds.startTiming(); // Spigot - this.ah(); + this.aj(); timings.doSounds.stopTiming(); // Spigot + this.getMinecraftServer().midTickLoadChunks(); // Paper this.ticking = false; diff --git a/Spigot-Server-Patches/Mob-Pathfinding-API.patch b/Spigot-Server-Patches/Mob-Pathfinding-API.patch index 1da6849bca..8343000c8a 100644 --- a/Spigot-Server-Patches/Mob-Pathfinding-API.patch +++ b/Spigot-Server-Patches/Mob-Pathfinding-API.patch @@ -221,12 +221,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public PathEntity(List list, BlockPosition blockposition, boolean flag) { this.a = list; @@ -0,0 +0,0 @@ public class PathEntity { - return this.e >= this.a.size(); } -- @Nullable -- public PathPoint c() { -+ public PathPoint getFinalPoint() { return c(); } @Nullable public PathPoint c() { // Paper - OBFHELPER + @Nullable +- public PathPoint d() { ++ public PathPoint getFinalPoint() { return d(); } @Nullable public PathPoint d() { // Paper - OBFHELPER return !this.a.isEmpty() ? (PathPoint) this.a.get(this.a.size() - 1) : null; } @@ -234,11 +233,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return this.a(entity, this.e); } -- public BaseBlockPosition g() { -+ public BaseBlockPosition getNext() { return g(); } public BaseBlockPosition g() { // Paper - OBFHELPER - PathPoint pathpoint = this.h(); +- public BlockPosition g() { ++ public BlockPosition getNext() { return g(); } public BlockPosition g() { // Paper - OBFHELPER + return ((PathPoint) this.a.get(this.e)).a(); + } - return new BaseBlockPosition(pathpoint.a, pathpoint.b, pathpoint.c); diff --git a/src/main/java/net/minecraft/server/PathPoint.java b/src/main/java/net/minecraft/server/PathPoint.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/PathPoint.java diff --git a/Spigot-Server-Patches/Move-range-check-for-block-placing-up.patch b/Spigot-Server-Patches/Move-range-check-for-block-placing-up.patch index d828b85bb2..3fbf993cab 100644 --- a/Spigot-Server-Patches/Move-range-check-for-block-placing-up.patch +++ b/Spigot-Server-Patches/Move-range-check-for-block-placing-up.patch @@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.player.resetIdleTimer(); if (blockposition.getY() < this.minecraftServer.getMaxBuildHeight()) { - if (this.teleportPos == null && this.player.g((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && worldserver.a((EntityHuman) this.player, blockposition)) { + if (this.teleportPos == null && this.player.h((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && worldserver.a((EntityHuman) this.player, blockposition)) { // CraftBukkit start - Check if we can actually do something over this large a distance - Location eyeLoc = this.getPlayer().getEyeLocation(); - double reachDistance = NumberConversions.square(eyeLoc.getX() - blockposition.getX()) + NumberConversions.square(eyeLoc.getY() - blockposition.getY()) + NumberConversions.square(eyeLoc.getZ() - blockposition.getZ()); diff --git a/Spigot-Server-Patches/No-Tick-view-distance-implementation.patch b/Spigot-Server-Patches/No-Tick-view-distance-implementation.patch index e8e4686b16..0e720b4123 100644 --- a/Spigot-Server-Patches/No-Tick-view-distance-implementation.patch +++ b/Spigot-Server-Patches/No-Tick-view-distance-implementation.patch @@ -125,7 +125,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + boolean needsChunkCenterUpdate; // Paper - no-tick view distance + public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) { - super(worldserver, worldserver.getSpawn(), gameprofile); + super(worldserver, worldserver.getSpawn(), worldserver.v(), gameprofile); this.spawnDimension = World.OVERWORLD; diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 @@ -167,12 +167,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class PlayerChunk { } - public void a(int i, int j, int k) { + public void a(BlockPosition blockposition) { - Chunk chunk = this.getChunk(); + Chunk chunk = this.getSendingChunk(); // Paper - no-tick view distance if (chunk != null) { - this.r |= 1 << (j >> 4); + byte b0 = (byte) SectionPosition.a(blockposition.getY()); @@ -0,0 +0,0 @@ public class PlayerChunk { } @@ -556,7 +556,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + final void sendChunk(EntityPlayer entityplayer, Packet[] apacket, Chunk chunk) { this.a(entityplayer, apacket, chunk); } // Paper - OBFHELPER private void a(EntityPlayer entityplayer, Packet[] apacket, Chunk chunk) { if (apacket[0] == null) { - apacket[0] = new PacketPlayOutMapChunk(chunk, 65535, true); + apacket[0] = new PacketPlayOutMapChunk(chunk, 65535); @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(this.tracker.chunkX, this.tracker.chunkZ); PlayerChunk playerchunk = PlayerChunkMap.this.getVisibleChunk(chunkcoordintpair.pair()); @@ -574,15 +574,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 boolean flag1 = gamerules.getBoolean(GameRules.REDUCED_DEBUG_INFO); // Spigot - view distance -- playerconnection.sendPacket(new PacketPlayOutLogin(entityplayer.getId(), entityplayer.playerInteractManager.getGameMode(), entityplayer.playerInteractManager.c(), BiomeManager.a(worldserver1.getSeed()), worlddata.isHardcore(), this.server.E(), this.s, worldserver1.getTypeKey(), worldserver1.getDimensionKey(), this.getMaxPlayers(), worldserver1.spigotConfig.viewDistance, flag1, !flag, worldserver1.isDebugWorld(), worldserver1.isFlatWorld())); -+ playerconnection.sendPacket(new PacketPlayOutLogin(entityplayer.getId(), entityplayer.playerInteractManager.getGameMode(), entityplayer.playerInteractManager.c(), BiomeManager.a(worldserver1.getSeed()), worlddata.isHardcore(), this.server.E(), this.s, worldserver1.getTypeKey(), worldserver1.getDimensionKey(), this.getMaxPlayers(), worldserver1.getChunkProvider().playerChunkMap.getLoadViewDistance(), flag1, !flag, worldserver1.isDebugWorld(), worldserver1.isFlatWorld())); // Paper - no-tick view distance +- playerconnection.sendPacket(new PacketPlayOutLogin(entityplayer.getId(), entityplayer.playerInteractManager.getGameMode(), entityplayer.playerInteractManager.c(), BiomeManager.a(worldserver1.getSeed()), worlddata.isHardcore(), this.server.F(), this.s, worldserver1.getDimensionManager(), worldserver1.getDimensionKey(), this.getMaxPlayers(), worldserver1.spigotConfig.viewDistance, flag1, !flag, worldserver1.isDebugWorld(), worldserver1.isFlatWorld())); ++ playerconnection.sendPacket(new PacketPlayOutLogin(entityplayer.getId(), entityplayer.playerInteractManager.getGameMode(), entityplayer.playerInteractManager.c(), BiomeManager.a(worldserver1.getSeed()), worlddata.isHardcore(), this.server.F(), this.s, worldserver1.getDimensionManager(), worldserver1.getDimensionKey(), this.getMaxPlayers(), worldserver1.getChunkProvider().playerChunkMap.getLoadViewDistance(), flag1, !flag, worldserver1.isDebugWorld(), worldserver1.isFlatWorld())); // Paper - no-tick view distance entityplayer.getBukkitEntity().sendSupportedChannels(); // CraftBukkit playerconnection.sendPacket(new PacketPlayOutCustomPayload(PacketPlayOutCustomPayload.a, (new PacketDataSerializer(Unpooled.buffer())).a(this.getServer().getServerModName()))); playerconnection.sendPacket(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked())); @@ -0,0 +0,0 @@ public abstract class PlayerList { // CraftBukkit start WorldData worlddata = worldserver1.getWorldData(); - entityplayer1.playerConnection.sendPacket(new PacketPlayOutRespawn(worldserver1.getTypeKey(), worldserver1.getDimensionKey(), BiomeManager.a(worldserver1.getSeed()), entityplayer1.playerInteractManager.getGameMode(), entityplayer1.playerInteractManager.c(), worldserver1.isDebugWorld(), worldserver1.isFlatWorld(), flag)); + entityplayer1.playerConnection.sendPacket(new PacketPlayOutRespawn(worldserver1.getDimensionManager(), worldserver1.getDimensionKey(), BiomeManager.a(worldserver1.getSeed()), entityplayer1.playerInteractManager.getGameMode(), entityplayer1.playerInteractManager.c(), worldserver1.isDebugWorld(), worldserver1.isFlatWorld(), flag)); - entityplayer1.playerConnection.sendPacket(new PacketPlayOutViewDistance(worldserver1.spigotConfig.viewDistance)); // Spigot + entityplayer1.playerConnection.sendPacket(new PacketPlayOutViewDistance(worldserver1.getChunkProvider().playerChunkMap.getLoadViewDistance())); // Spigot // Paper - no-tick view distance entityplayer1.spawnIn(worldserver1); diff --git a/Spigot-Server-Patches/Ocelot-despawns-should-honor-nametags-and-leash.patch b/Spigot-Server-Patches/Ocelot-despawns-should-honor-nametags-and-leash.patch index a1ab905d58..2765d6bd28 100644 --- a/Spigot-Server-Patches/Ocelot-despawns-should-honor-nametags-and-leash.patch +++ b/Spigot-Server-Patches/Ocelot-despawns-should-honor-nametags-and-leash.patch @@ -16,4 +16,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return !this.isTrusting() && !this.hasCustomName() && !this.isLeashed() /*&& this.ticksLived > 2400*/; // CraftBukkit // Paper - honor name and leash } - public static AttributeProvider.Builder eL() { + public static AttributeProvider.Builder eK() { diff --git a/Spigot-Server-Patches/Optimise-IEntityAccess-getPlayerByUUID.patch b/Spigot-Server-Patches/Optimise-IEntityAccess-getPlayerByUUID.patch index bc43aa1dc9..2d69247479 100644 --- a/Spigot-Server-Patches/Optimise-IEntityAccess-getPlayerByUUID.patch +++ b/Spigot-Server-Patches/Optimise-IEntityAccess-getPlayerByUUID.patch @@ -40,5 +40,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end + // Add env and gen to constructor, WorldData -> WorldDataServer - public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey resourcekey, ResourceKey resourcekey1, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { - super(iworlddataserver, resourcekey, resourcekey1, dimensionmanager, minecraftserver::getMethodProfiler, false, flag, i, gen, env, executor); // Paper pass executor + public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey resourcekey, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { + super(iworlddataserver, resourcekey, dimensionmanager, minecraftserver::getMethodProfiler, false, flag, i, gen, env, executor); // Paper pass executor diff --git a/Spigot-Server-Patches/Optimise-TickListServer-by-rewriting-it.patch b/Spigot-Server-Patches/Optimise-TickListServer-by-rewriting-it.patch index 0bf1db23e4..579f538686 100644 --- a/Spigot-Server-Patches/Optimise-TickListServer-by-rewriting-it.patch +++ b/Spigot-Server-Patches/Optimise-TickListServer-by-rewriting-it.patch @@ -1208,8 +1208,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end - rewrite ticklistserver + // Add env and gen to constructor, WorldData -> WorldDataServer - public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey resourcekey, ResourceKey resourcekey1, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { - super(iworlddataserver, resourcekey, resourcekey1, dimensionmanager, minecraftserver::getMethodProfiler, false, flag, i, gen, env, executor); // Paper pass executor + public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey resourcekey, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { + super(iworlddataserver, resourcekey, dimensionmanager, minecraftserver::getMethodProfiler, false, flag, i, gen, env, executor); // Paper pass executor @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { convertable = convertable_conversionsession; uuid = WorldUUID.getUUID(convertable_conversionsession.folder.toFile()); @@ -1246,6 +1246,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.worldDataServer.setTime(i); // Paper - diff on change, we want the below to be ran right after this + this.nextTickListBlock.nextTick(); // Paper + this.nextTickListFluid.nextTick(); // Paper - this.worldDataServer.t().a(this.server, i); - if (this.worldData.p().getBoolean(GameRules.DO_DAYLIGHT_CYCLE)) { + this.worldDataServer.u().a(this.server, i); + if (this.worldData.q().getBoolean(GameRules.DO_DAYLIGHT_CYCLE)) { this.setDayTime(this.worldData.getDayTime() + 1L); diff --git a/Spigot-Server-Patches/Optimise-entity-hard-collision-checking.patch b/Spigot-Server-Patches/Optimise-entity-hard-collision-checking.patch deleted file mode 100644 index 0bd90bb9f8..0000000000 --- a/Spigot-Server-Patches/Optimise-entity-hard-collision-checking.patch +++ /dev/null @@ -1,228 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Spottedleaf -Date: Wed, 15 Apr 2020 18:08:53 -0700 -Subject: [PATCH] Optimise entity hard collision checking - -Very few entities actually hard collide, so store them in their own -entity slices and provide a special getEntites type call just for them. -This reduces entity collision checking impact (in my testing) by 25% -for crammed entities (shove 130 cows into an 8x6 area in one chunk). -Less crammed entities are likely to show significantly less benefit. -Effectively, this patch optimises crammed entity situations. - -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { - private final int[] inventoryEntityCounts = new int[16]; - // Paper end - -+ // Paper start - optimise hard collision handling -+ final com.destroystokyo.paper.util.maplist.EntityList[] hardCollidingEntities = new com.destroystokyo.paper.util.maplist.EntityList[16]; -+ -+ { -+ for (int i = 0, len = this.hardCollidingEntities.length; i < len; ++i) { -+ this.hardCollidingEntities[i] = new com.destroystokyo.paper.util.maplist.EntityList(); -+ } -+ } -+ -+ public final void getHardCollidingEntities(@Nullable Entity entity, AxisAlignedBB axisalignedbb, List into, Predicate predicate) { -+ // copied from getEntities -+ int min = MathHelper.floor((axisalignedbb.minY - 2.0D) / 16.0D); -+ int max = MathHelper.floor((axisalignedbb.maxY + 2.0D) / 16.0D); -+ -+ min = MathHelper.clamp(min, 0, this.hardCollidingEntities.length - 1); -+ max = MathHelper.clamp(max, 0, this.hardCollidingEntities.length - 1); -+ -+ for (int k = min; k <= max; ++k) { -+ com.destroystokyo.paper.util.maplist.EntityList entityList = this.hardCollidingEntities[k]; -+ Entity[] entities = entityList.getRawData(); -+ -+ for (int i = 0, len = entityList.size(); i < len; ++i) { -+ Entity entity1 = entities[i]; -+ if (entity1.shouldBeRemoved) continue; // Paper -+ -+ if (entity1 != entity && entity1.getBoundingBox().intersects(axisalignedbb) && (predicate == null || predicate.test(entity1))) { -+ into.add(entity1); -+ -+ if (!(entity1 instanceof EntityEnderDragon)) { -+ continue; -+ } -+ -+ EntityComplexPart[] aentitycomplexpart = ((EntityEnderDragon) entity1).getComplexParts(); -+ int l = aentitycomplexpart.length; -+ -+ for (int i1 = 0; i1 < l; ++i1) { -+ EntityComplexPart entitycomplexpart = aentitycomplexpart[i1]; -+ -+ if (entitycomplexpart != entity && entitycomplexpart.getBoundingBox().intersects(axisalignedbb) && (predicate == null || predicate.test(entitycomplexpart))) { -+ into.add(entitycomplexpart); -+ } -+ } -+ } -+ } -+ } -+ } -+ // Paper end - optimise hard collision handling -+ - public Chunk(World world, ChunkCoordIntPair chunkcoordintpair, BiomeStorage biomestorage, ChunkConverter chunkconverter, TickList ticklist, TickList ticklist1, long i, @Nullable ChunkSection[] achunksection, @Nullable Consumer consumer) { - this.sections = new ChunkSection[16]; - this.e = Maps.newHashMap(); -@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { - entity.chunkY = k; - entity.chunkZ = this.loc.z; - this.entities.add(entity); // Paper - per chunk entity list -- this.entitySlices[k].add(entity); -+ this.entitySlices[k].add(entity); if (entity.hardCollides()) this.hardCollidingEntities[k].add(entity); // Paper - optimise hard colliding entities - // Paper start - if (entity instanceof EntityItem) { - itemCounts[k]++; -@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { - entity.entitySlice = null; - entity.inChunk = false; - } -- if (!this.entitySlices[i].remove(entity)) { -+ if (entity.hardCollides()) this.hardCollidingEntities[i].remove(entity); if (!this.entitySlices[i].remove(entity)) { // Paper - optimise hard colliding entities - return; - } - if (entity instanceof EntityItem) { -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - } - // CraftBukkit end - -+ // Paper start -+ /** -+ * Overriding this field will cause memory leaks. -+ */ -+ private final boolean hardCollides; -+ -+ private static final java.util.Map, Boolean> cachedOverrides = java.util.Collections.synchronizedMap(new java.util.WeakHashMap<>()); -+ { -+ Boolean hardCollides = cachedOverrides.get(this.getClass()); -+ if (hardCollides == null) { -+ try { -+ Object getHardCollisionBoxMethod = Entity.class.getMethod("ay"); -+ Object getHardCollisionBoxEntityMethod = Entity.class.getMethod("j", Entity.class); -+ if (!this.getClass().getMethod("ay").equals(getHardCollisionBoxMethod)) { -+ hardCollides = Boolean.TRUE; -+ } else if (!this.getClass().getMethod("j", Entity.class).equals(getHardCollisionBoxEntityMethod)) { -+ hardCollides = Boolean.TRUE; -+ } else { -+ hardCollides = Boolean.FALSE; -+ } -+ cachedOverrides.put(this.getClass(), hardCollides); -+ } catch (Throwable thr) { -+ // shouldn't happen, just explode -+ throw new RuntimeException(thr); -+ } -+ } -+ this.hardCollides = hardCollides.booleanValue(); -+ } -+ -+ public final boolean hardCollides() { -+ return this.hardCollides; -+ } -+ // Paper end -+ - public Entity(EntityTypes entitytypes, World world) { - this.id = Entity.entityCount.incrementAndGet(); - this.passengers = Lists.newArrayList(); -diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityEnderDragon.java -+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java -@@ -0,0 +0,0 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster { - @Override - public void checkDespawn() {} - -+ public final EntityComplexPart[] getComplexParts() { return this.eK(); } // Paper - OBFHELPER - public EntityComplexPart[] eK() { - return this.children; - } -diff --git a/src/main/java/net/minecraft/server/IEntityAccess.java b/src/main/java/net/minecraft/server/IEntityAccess.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/IEntityAccess.java -+++ b/src/main/java/net/minecraft/server/IEntityAccess.java -@@ -0,0 +0,0 @@ public interface IEntityAccess { - return this.b(oclass, axisalignedbb, IEntitySelector.g); - } - -+ // Paper start - optimise hard collision -+ /** -+ * Not guaranteed to only return hard colliding entites -+ */ -+ default List getHardCollidingEntities(@Nullable Entity entity, AxisAlignedBB axisalignedbb, Predicate predicate) { -+ return this.getEntities(entity, axisalignedbb, predicate); -+ } -+ // Paper end - optimise hard collision -+ - default Stream c(@Nullable Entity entity, AxisAlignedBB axisalignedbb, Predicate predicate) { - if (axisalignedbb.a() < 1.0E-7D) { - return Stream.empty(); - } else { - AxisAlignedBB axisalignedbb1 = axisalignedbb.g(1.0E-7D); - -- return this.getEntities(entity, axisalignedbb1, predicate.and((entity1) -> { -+ // Paper start -+ Predicate effectivePredicate = predicate.and((entity1) -> { - return entity == null || !entity.isSameVehicle(entity1); -- })).stream().flatMap((entity1) -> { -+ }); -+ -+ return ((entity != null && entity.hardCollides()) ? this.getEntities(entity, axisalignedbb, effectivePredicate) : this.getHardCollidingEntities(entity, axisalignedbb1, effectivePredicate)).stream().flatMap((entity1) -> { - if (entity != null) { -- AxisAlignedBB axisalignedbb2 = entity.j(entity1); -+ AxisAlignedBB axisalignedbb2 = entity.j(entity1); // Paper - diff on change, hard collision box method - - if (axisalignedbb2 != null && axisalignedbb2.c(axisalignedbb1)) { - return Stream.of(entity1.ay(), axisalignedbb2); - } - } - -- return Stream.of(entity1.ay()); -+ return Stream.of(entity1.ay()); // Paper - diff on change, hard collision box method - }).filter(Objects::nonNull).map(VoxelShapes::a); - } - } -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - return this.getChunkAt(i, j, ChunkStatus.FULL, false); - } - -+ // Paper start - optimise hard collision handling -+ @Override -+ public List getHardCollidingEntities(@Nullable Entity entity, AxisAlignedBB axisalignedbb, Predicate predicate) { -+ // copied from below -+ List list = Lists.newArrayList(); -+ int i = MathHelper.floor((axisalignedbb.minX - 2.0D) / 16.0D); -+ int j = MathHelper.floor((axisalignedbb.maxX + 2.0D) / 16.0D); -+ int k = MathHelper.floor((axisalignedbb.minZ - 2.0D) / 16.0D); -+ int l = MathHelper.floor((axisalignedbb.maxZ + 2.0D) / 16.0D); -+ -+ ChunkProviderServer chunkProvider = ((WorldServer)this).getChunkProvider(); -+ -+ for (int i1 = i; i1 <= j; ++i1) { -+ for (int j1 = k; j1 <= l; ++j1) { -+ Chunk chunk = chunkProvider.getChunkAtIfLoadedMainThread(i1, j1); -+ -+ if (chunk != null) { -+ chunk.getHardCollidingEntities(entity, axisalignedbb, list, predicate); -+ } -+ } -+ } -+ -+ return list; -+ } -+ // Paper end - optimise hard collision handling -+ - @Override - public List getEntities(@Nullable Entity entity, AxisAlignedBB axisalignedbb, @Nullable Predicate predicate) { - this.getMethodProfiler().c("getEntities"); diff --git a/Spigot-Server-Patches/Optimise-random-block-ticking.patch b/Spigot-Server-Patches/Optimise-random-block-ticking.patch index 426d3783c2..a87626c766 100644 --- a/Spigot-Server-Patches/Optimise-random-block-ticking.patch +++ b/Spigot-Server-Patches/Optimise-random-block-ticking.patch @@ -111,7 +111,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - private short tickingBlockCount; + short tickingBlockCount; // Paper - private -> package-private private short e; - final DataPaletteBlock blockIds; + final DataPaletteBlock blockIds; // Paper - package-private + final com.destroystokyo.paper.util.maplist.IBlockDataList tickingList = new com.destroystokyo.paper.util.maplist.IBlockDataList(); // Paper + @@ -237,17 +237,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } public void setHomePos(BlockPosition blockposition) { -- this.datawatcher.set(EntityTurtle.bw, blockposition); -+ this.datawatcher.set(EntityTurtle.bw, blockposition.immutableCopy()); // Paper - called with mutablepos... +- this.datawatcher.set(EntityTurtle.bp, blockposition); ++ this.datawatcher.set(EntityTurtle.bp, blockposition.immutableCopy()); // Paper - called with mutablepos... } + public BlockPosition getHomePos() { // Paper - public - return (BlockPosition) this.datawatcher.get(EntityTurtle.bw); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - public abstract TagRegistry p(); + public abstract ITagRegistry p(); public BlockPosition a(int i, int j, int k, int l) { + // Paper start - allow use of mutable pos @@ -291,7 +291,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - BlockPosition blockposition; + final BlockPosition.MutableBlockPosition blockposition = this.chunkTickMutablePosition; // Paper - use mutable to reduce allocation rate, final to force compile fail on change - if (!this.paperConfig.disableThunder && flag && this.T() && this.random.nextInt(100000) == 0) { // Paper - Disable thunder + if (!this.paperConfig.disableThunder && flag && this.V() && this.random.nextInt(100000) == 0) { // Paper - Disable thunder - blockposition = this.a(this.a(j, 0, k, 15)); + blockposition.setValues(this.a(this.a(j, 0, k, 15))); // Paper if (this.isRainingAt(blockposition)) { @@ -313,11 +313,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end BiomeBase biomebase = this.getBiome(blockposition); -- if (biomebase.a((IWorldReader) this, blockposition1)) { +- if (biomebase.a(this, blockposition1)) { - org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition1, Blocks.ICE.getBlockData(), null); // CraftBukkit + // Paper start - optimise chunk ticking + blockposition.setY(downY); -+ if (biomebase.a((IWorldReader) this, blockposition)) { ++ if (biomebase.a(this, blockposition)) { + org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition, Blocks.ICE.getBlockData(), null); // CraftBukkit + // Paper end } @@ -327,11 +327,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition, Blocks.SNOW.getBlockData(), null); // CraftBukkit } -- if (flag && this.getBiome(blockposition1).d() == BiomeBase.Precipitation.RAIN) { +- if (flag && this.getBiome(blockposition1).c() == BiomeBase.Precipitation.RAIN) { - this.getType(blockposition1).getBlock().c((World) this, blockposition1); + // Paper start - optimise chunk ticking + blockposition.setY(downY); -+ if (flag && this.getBiome(blockposition).d() == BiomeBase.Precipitation.RAIN) { ++ if (flag && this.getBiome(blockposition).c() == BiomeBase.Precipitation.RAIN) { + chunk.getType(blockposition).getBlock().c((World) this, blockposition); + // Paper end } diff --git a/Spigot-Server-Patches/Optimise-removeQueue.patch b/Spigot-Server-Patches/Optimise-removeQueue.patch index a475831e28..be7dc0f675 100644 --- a/Spigot-Server-Patches/Optimise-removeQueue.patch +++ b/Spigot-Server-Patches/Optimise-removeQueue.patch @@ -54,7 +54,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener { - return LoginListener.this.server.U() && socketaddress instanceof InetSocketAddress ? ((InetSocketAddress) socketaddress).getAddress() : null; + return LoginListener.this.server.V() && socketaddress instanceof InetSocketAddress ? ((InetSocketAddress) socketaddress).getAddress() : null; } - }; - diff --git a/Spigot-Server-Patches/Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch b/Spigot-Server-Patches/Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch index f1f8c6ed2e..390c19df1f 100644 --- a/Spigot-Server-Patches/Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch +++ b/Spigot-Server-Patches/Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch @@ -5,73 +5,88 @@ 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/server/BiomeBase.java b/src/main/java/net/minecraft/server/BiomeBase.java +diff --git a/src/main/java/net/minecraft/server/BiomeSettingsMobs.java b/src/main/java/net/minecraft/server/BiomeSettingsMobs.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BiomeBase.java -+++ b/src/main/java/net/minecraft/server/BiomeBase.java -@@ -0,0 +0,0 @@ public class BiomeBase { - this.r.put(worldgenstage_decoration, Lists.newArrayList()); - } - -- this.v = Maps.newHashMap(); -+ this.v = Maps.newEnumMap(EnumCreatureType.class); // Paper - EnumCreatureType[] aenumcreaturetype = EnumCreatureType.values(); - - i = aenumcreaturetype.length; -@@ -0,0 +0,0 @@ public class BiomeBase { - for (j = 0; j < i; ++j) { - EnumCreatureType enumcreaturetype = aenumcreaturetype[j]; - -- this.v.put(enumcreaturetype, Lists.newArrayList()); -+ this.v.put(enumcreaturetype, new MobList()); // Paper - } - - } else { -@@ -0,0 +0,0 @@ public class BiomeBase { - this.u = (Map) list.stream().collect(Collectors.toMap((structurefeature) -> { - return structurefeature.b; - }, Function.identity())); -- this.v = map2; -+ this.v = Maps.newEnumMap(EnumCreatureType.class); this.v.putAll(map2); // Paper - this.x = list1; - this.l = (String) optional.orElse(null); // Paper - decompile fix - Stream stream = map1.values().stream().flatMap(Collection::stream).filter((worldgenfeatureconfigured) -> { -@@ -0,0 +0,0 @@ public class BiomeBase { - return this.l; - } - -+ // Paper start - 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<>(); -+ -+ @Override -+ public boolean contains(Object o) { -+ return biomes.contains(o); -+ } -+ -+ @Override -+ public boolean add(BiomeMeta biomeMeta) { -+ biomes.add(biomeMeta); -+ return super.add(biomeMeta); -+ } -+ -+ @Override -+ public BiomeMeta remove(int index) { -+ BiomeMeta removed = super.remove(index); -+ if (removed != null) { -+ biomes.remove(removed); -+ } -+ return removed; -+ } -+ -+ @Override -+ public void clear() { -+ biomes.clear(); -+ super.clear(); +--- a/src/main/java/net/minecraft/server/BiomeSettingsMobs.java ++++ b/src/main/java/net/minecraft/server/BiomeSettingsMobs.java +@@ -0,0 +0,0 @@ public class BiomeSettingsMobs { + }, (enumcreaturetype) -> { + return ImmutableList.of(); + })), ImmutableMap.of(), false); ++ // Paper start- decompile error workaround ++ private static class bProxy extends BiomeSettingsMobs.b { ++ private bProxy(double d0, double d1) { ++ super(d0, d1); + } + } ++ private static class cProxy extends BiomeSettingsMobs.c { ++ public cProxy(EntityTypes entitytypes, int i, int j, int k) { ++ super(entitytypes, i, j, k); ++ } ++ }; + // Paper end -+ - public static class d { + public static final MapCodec c = RecordCodecBuilder.mapCodec((instance) -> { +- RecordCodecBuilder recordcodecbuilder = Codec.FLOAT.optionalFieldOf("creature_spawn_probability", 0.1F).forGetter((biomesettingsmobs) -> { ++ RecordCodecBuilder recordcodecbuilder = Codec.FLOAT.optionalFieldOf("creature_spawn_probability", 0.1F).forGetter((biomesettingsmobs) -> { // Paper - add type to builder + return biomesettingsmobs.d; + }); +- Codec codec = EnumCreatureType.g; +- Codec codec1 = BiomeSettingsMobs.c.b.listOf(); +- Logger logger = BiomeSettingsMobs.LOGGER; ++ // Paper - remove unused vars - public static final Codec a = RecordCodecBuilder.create((instance) -> { +- logger.getClass(); +- return instance.group(recordcodecbuilder, Codec.simpleMap(codec, codec1.promotePartial(SystemUtils.a("Spawn data: ", logger::error)), INamable.a(EnumCreatureType.values())).fieldOf("spawners").forGetter((biomesettingsmobs) -> { ++ return instance.group(recordcodecbuilder, Codec.simpleMap(EnumCreatureType.g, cProxy.b.listOf().promotePartial(SystemUtils.a("Spawn data: ", BiomeSettingsMobs.LOGGER::error)), INamable.a(EnumCreatureType.values())).fieldOf("spawners").forGetter((biomesettingsmobs) -> { // Paper - inline codec, cProxy, LOGGER + return biomesettingsmobs.e; +- }), Codec.simpleMap(IRegistry.ENTITY_TYPE, BiomeSettingsMobs.b.a, IRegistry.ENTITY_TYPE).fieldOf("spawn_costs").forGetter((biomesettingsmobs) -> { ++ }), Codec.simpleMap(IRegistry.ENTITY_TYPE, bProxy.a, IRegistry.ENTITY_TYPE).fieldOf("spawn_costs").forGetter((biomesettingsmobs) -> { // Paper - decompile error - bProxy + return biomesettingsmobs.f; + }), Codec.BOOL.fieldOf("player_spawn_friendly").orElse(false).forGetter(BiomeSettingsMobs::b)).apply(instance, BiomeSettingsMobs::new); + }); +@@ -0,0 +0,0 @@ public class BiomeSettingsMobs { + + public static class a { + +- private final Map> a = (Map) Stream.of(EnumCreatureType.values()).collect(ImmutableMap.toImmutableMap((enumcreaturetype) -> { ++ // Paper start - 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<>(); ++ ++ @Override ++ public boolean contains(Object o) { ++ return biomes.contains(o); ++ } ++ ++ @Override ++ public boolean add(BiomeSettingsMobs.c BiomeSettingsMobs) { ++ biomes.add(BiomeSettingsMobs); ++ return super.add(BiomeSettingsMobs); ++ } ++ ++ @Override ++ public BiomeSettingsMobs.c remove(int index) { ++ BiomeSettingsMobs.c removed = super.remove(index); ++ if (removed != null) { ++ biomes.remove(removed); ++ } ++ return removed; ++ } ++ ++ @Override ++ public void clear() { ++ biomes.clear(); ++ super.clear(); ++ } ++ } ++ // use toImmutableEnumMap collector ++ private final Map> a = (Map) Stream.of(EnumCreatureType.values()).collect(Maps.toImmutableEnumMap((enumcreaturetype) -> { + return enumcreaturetype; + }, (enumcreaturetype) -> { +- return Lists.newArrayList(); ++ return new MobList(); // Use MobList instead of ArrayList + })); ++ // Paper end + private final Map, BiomeSettingsMobs.b> b = Maps.newLinkedHashMap(); + private float c = 0.1F; + private boolean d; diff --git a/Spigot-Server-Patches/Optimize-Bit-Operations-by-inlining.patch b/Spigot-Server-Patches/Optimize-Bit-Operations-by-inlining.patch index 916d149f12..4f81573607 100644 --- a/Spigot-Server-Patches/Optimize-Bit-Operations-by-inlining.patch +++ b/Spigot-Server-Patches/Optimize-Bit-Operations-by-inlining.patch @@ -131,11 +131,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - int j = b(blockposition.getY()); - int k = b(blockposition.getZ()); - -- return (short) (i << 8 | k << 4 | j); +- return (short) (i << 8 | k << 4 | j << 0); + return (short) ((blockposition.getX() & 15) << 8 | (blockposition.getZ() & 15) << 4 | blockposition.getY() & 15); // Paper - simplify/inline } - public static int c(int i) { + public static int a(short short0) { @@ -0,0 +0,0 @@ public class SectionPosition extends BaseBlockPosition { return this.getZ(); } diff --git a/Spigot-Server-Patches/Optimize-BlockPosition-helper-methods.patch b/Spigot-Server-Patches/Optimize-BlockPosition-helper-methods.patch index 8b41511ab7..b6e61ccf58 100644 --- a/Spigot-Server-Patches/Optimize-BlockPosition-helper-methods.patch +++ b/Spigot-Server-Patches/Optimize-BlockPosition-helper-methods.patch @@ -10,13 +10,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/BlockPosition.java +++ b/src/main/java/net/minecraft/server/BlockPosition.java @@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition { - } + @Override public BlockPosition up() { - return this.shift(EnumDirection.UP); + return new BlockPosition(this.getX(), this.getY() + 1, this.getZ()); // Paper - Optimize BlockPosition } + @Override public BlockPosition up(int i) { - return this.shift(EnumDirection.UP, i); + return i == 0 ? this : new BlockPosition(this.getX(), this.getY() + i, this.getZ()); // Paper - Optimize BlockPosition diff --git a/Spigot-Server-Patches/Optimize-Captured-TileEntity-Lookup.patch b/Spigot-Server-Patches/Optimize-Captured-TileEntity-Lookup.patch index b966bc8c6e..d5ab4ace82 100644 --- a/Spigot-Server-Patches/Optimize-Captured-TileEntity-Lookup.patch +++ b/Spigot-Server-Patches/Optimize-Captured-TileEntity-Lookup.patch @@ -29,4 +29,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + //TileEntity tileentity = null; // Paper - move up if (this.tickingTileEntities) { - tileentity = this.D(blockposition); + tileentity = this.E(blockposition); diff --git a/Spigot-Server-Patches/Optimize-Hoppers.patch b/Spigot-Server-Patches/Optimize-Hoppers.patch index 6b274f9d54..ac2e408966 100644 --- a/Spigot-Server-Patches/Optimize-Hoppers.patch +++ b/Spigot-Server-Patches/Optimize-Hoppers.patch @@ -423,7 +423,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } public static List c(IHopper ihopper) { -- return (List) ihopper.ac_().d().stream().flatMap((axisalignedbb) -> { +- return (List) ihopper.aa_().d().stream().flatMap((axisalignedbb) -> { - return ihopper.getWorld().a(EntityItem.class, axisalignedbb.d(ihopper.x() - 0.5D, ihopper.z() - 0.5D, ihopper.A() - 0.5D), IEntitySelector.a).stream(); - }).collect(Collectors.toList()); + // Paper start - Optimize item suck in. remove streams, restore 1.12 checks. Seriously checking the bowl?! diff --git a/Spigot-Server-Patches/Optimize-Light-Engine.patch b/Spigot-Server-Patches/Optimize-Light-Engine.patch index 62fd6c2cb9..4b43373d32 100644 --- a/Spigot-Server-Patches/Optimize-Light-Engine.patch +++ b/Spigot-Server-Patches/Optimize-Light-Engine.patch @@ -55,7 +55,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end IBlockAccess iblockaccess = this.a.c(j >> 4, l >> 4); - return iblockaccess != null ? iblockaccess.h(this.f.d(j, k, l)) : 0; + return iblockaccess != null ? iblockaccess.g(this.f.d(j, k, l)) : 0; @@ -0,0 +0,0 @@ public final class LightEngineBlock extends LightEngineLayer= 15) { return k; @@ -1030,6 +1030,14 @@ diff --git a/src/main/java/net/minecraft/server/LightEngineThreaded.java b/src/m index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/LightEngineThreaded.java +++ b/src/main/java/net/minecraft/server/LightEngineThreaded.java +@@ -0,0 +0,0 @@ + package net.minecraft.server; + + import com.mojang.datafixers.util.Pair; ++import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap; // Paper + import it.unimi.dsi.fastutil.objects.ObjectArrayList; + import it.unimi.dsi.fastutil.objects.ObjectList; + import it.unimi.dsi.fastutil.objects.ObjectListIterator; @@ -0,0 +0,0 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable { private static final Logger LOGGER = LogManager.getLogger(); @@ -1077,13 +1085,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + class LightQueue { + private int size = 0; + private int lowestPriority = MAX_PRIORITIES; -+ private final it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap[] buckets = new it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap[MAX_PRIORITIES]; ++ private final Long2ObjectLinkedOpenHashMap[] buckets = new Long2ObjectLinkedOpenHashMap[MAX_PRIORITIES]; + private final java.util.concurrent.ConcurrentLinkedQueue pendingTasks = new java.util.concurrent.ConcurrentLinkedQueue<>(); + private final java.util.concurrent.ConcurrentLinkedQueue priorityChanges = new java.util.concurrent.ConcurrentLinkedQueue<>(); + + private LightQueue() { + for (int i = 0; i < buckets.length; i++) { -+ buckets[i] = new it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap<>(); ++ buckets[i] = new Long2ObjectLinkedOpenHashMap<>(); + } + } + @@ -1152,9 +1160,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + run.run(); + } + boolean hasWork = false; -+ it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap[] buckets = this.buckets; ++ Long2ObjectLinkedOpenHashMap[] buckets = this.buckets; + while (lowestPriority < MAX_PRIORITIES && !isEmpty()) { -+ it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap bucket = buckets[lowestPriority]; ++ Long2ObjectLinkedOpenHashMap bucket = buckets[lowestPriority]; + if (bucket.isEmpty()) { + lowestPriority++; + if (hasWork && lowestPriority <= 3) { @@ -1340,7 +1348,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + chunkMap.world.getChunkProvider().getLightEngine().queue.changePriority(location.pair(), getCurrentPriority(), priority); } if (getCurrentPriority() != priority) { - this.v.a(this.location, this::getCurrentPriority, priority, this::setPriority); // use preferred priority + this.u.a(this.location, this::getCurrentPriority, priority, this::setPriority); // use preferred priority diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java diff --git a/Spigot-Server-Patches/Optimize-Network-Manager-and-add-advanced-packet-sup.patch b/Spigot-Server-Patches/Optimize-Network-Manager-and-add-advanced-packet-sup.patch index c410458aca..7348811464 100644 --- a/Spigot-Server-Patches/Optimize-Network-Manager-and-add-advanced-packet-sup.patch +++ b/Spigot-Server-Patches/Optimize-Network-Manager-and-add-advanced-packet-sup.patch @@ -99,7 +99,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void sendPacket(Packet packet, @Nullable GenericFutureListener> genericfuturelistener) { - if (this.isConnected()) { -- this.o(); +- this.p(); - this.b(packet, genericfuturelistener); - } else { - this.packetQueue.add(new NetworkManager.QueuedPacket(packet, genericfuturelistener)); @@ -212,14 +212,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } -- private void sendPacketQueue() { this.o(); } // Paper - OBFHELPER -- private void o() { +- private void sendPacketQueue() { this.p(); } // Paper - OBFHELPER +- private void p() { - if (this.channel != null && this.channel.isOpen()) { - Queue queue = this.packetQueue; - -+ // Paper start - rewrite this to be safer on -+ private boolean sendPacketQueue() { return this.o(); } // OBFHELPER // void -> boolean -+ private boolean o() { // void -> boolean ++ // Paper start - rewrite this to be safer if ran off main thread ++ private boolean sendPacketQueue() { return this.p(); } // OBFHELPER // void -> boolean ++ private boolean p() { // void -> boolean + if (!isConnected()) { + return true; + } @@ -264,7 +264,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end public void a() { - this.o(); + this.p(); @@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler> { return this.socketAddress; } @@ -295,15 +295,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + //NetworkManager.LOGGER.warn("handleDisconnection() called twice"); // Paper - Do not log useless message } else { this.o = true; - if (this.j() != null) { + if (this.k() != null) { @@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler> { - } else if (this.i() != null) { - this.i().a(new ChatMessage("multiplayer.disconnect.generic")); + } else if (this.j() != null) { + this.j().a(new ChatMessage("multiplayer.disconnect.generic")); } - this.packetQueue.clear(); // Free up packet queue. + clearPacketQueue(); // Paper // Paper start - Add PlayerConnectionCloseEvent - final PacketListener packetListener = this.i(); + final PacketListener packetListener = this.j(); if (packetListener instanceof PlayerConnection) { diff --git a/src/main/java/net/minecraft/server/Packet.java b/src/main/java/net/minecraft/server/Packet.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 @@ -368,5 +368,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (!disableFlushConsolidation) channel.pipeline().addFirst(new FlushConsolidationHandler()); // Paper channel.pipeline().addLast("timeout", new ReadTimeoutHandler(30)).addLast("legacy_query", new LegacyPingHandler(ServerConnection.this)).addLast("splitter", new PacketSplitter()).addLast("decoder", new PacketDecoder(EnumProtocolDirection.SERVERBOUND)).addLast("prepender", new PacketPrepender()).addLast("encoder", new PacketEncoder(EnumProtocolDirection.CLIENTBOUND)); - NetworkManager networkmanager = new NetworkManager(EnumProtocolDirection.SERVERBOUND); - + int j = ServerConnection.this.e.k(); + Object object = j > 0 ? new NetworkManagerServer(j) : new NetworkManager(EnumProtocolDirection.SERVERBOUND); diff --git a/Spigot-Server-Patches/Optimize-NibbleArray-to-use-pooled-buffers.patch b/Spigot-Server-Patches/Optimize-NibbleArray-to-use-pooled-buffers.patch index 37d0fc4e1d..1a437c4744 100644 --- a/Spigot-Server-Patches/Optimize-NibbleArray-to-use-pooled-buffers.patch +++ b/Spigot-Server-Patches/Optimize-NibbleArray-to-use-pooled-buffers.patch @@ -174,7 +174,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + registerCleaner(); + // Paper end if (abyte.length != 2048) { - throw (IllegalArgumentException) SystemUtils.c(new IllegalArgumentException("ChunkNibbleArrays should be 2048 bytes not: " + abyte.length)); + throw (IllegalArgumentException) SystemUtils.c((Throwable) (new IllegalArgumentException("ChunkNibbleArrays should be 2048 bytes not: " + abyte.length))); } @@ -0,0 +0,0 @@ public class NibbleArray { diff --git a/Spigot-Server-Patches/Optimize-PlayerChunkMap-memory-use-for-visibleChunks.patch b/Spigot-Server-Patches/Optimize-PlayerChunkMap-memory-use-for-visibleChunks.patch index 11c0d25cab..330ddf3527 100644 --- a/Spigot-Server-Patches/Optimize-PlayerChunkMap-memory-use-for-visibleChunks.patch +++ b/Spigot-Server-Patches/Optimize-PlayerChunkMap-memory-use-for-visibleChunks.patch @@ -246,10 +246,10 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/jav index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -0,0 +0,0 @@ import net.minecraft.server.GameRules; - import net.minecraft.server.GroupDataEntity; +@@ -0,0 +0,0 @@ import net.minecraft.server.GroupDataEntity; import net.minecraft.server.IBlockData; import net.minecraft.server.IChunkAccess; + import net.minecraft.server.IRegistry; +import net.minecraft.server.MCUtil; import net.minecraft.server.MinecraftKey; import net.minecraft.server.MinecraftServer; diff --git a/Spigot-Server-Patches/Optimize-RegistryID.c.patch b/Spigot-Server-Patches/Optimize-RegistryID.c.patch index b87763d6f3..e60159a156 100644 --- a/Spigot-Server-Patches/Optimize-RegistryID.c.patch +++ b/Spigot-Server-Patches/Optimize-RegistryID.c.patch @@ -23,7 +23,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.usedIds = new java.util.BitSet(); // Paper } - public int getId(@Nullable K k0) { + // Paper start - decompile fix @@ -0,0 +0,0 @@ public class RegistryID implements Registry { } diff --git a/Spigot-Server-Patches/Optimize-RegistryMaterials.patch b/Spigot-Server-Patches/Optimize-RegistryMaterials.patch index 7ff21e016b..f800de2b87 100644 --- a/Spigot-Server-Patches/Optimize-RegistryMaterials.patch +++ b/Spigot-Server-Patches/Optimize-RegistryMaterials.patch @@ -11,43 +11,51 @@ diff --git a/src/main/java/net/minecraft/server/RegistryMaterials.java b/src/mai index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/RegistryMaterials.java +++ b/src/main/java/net/minecraft/server/RegistryMaterials.java -@@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger; - public class RegistryMaterials extends IRegistryWritable { +@@ -0,0 +0,0 @@ import java.util.OptionalInt; + import java.util.Random; + import java.util.Set; + import javax.annotation.Nullable; ++import it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap; // Paper + import org.apache.commons.lang3.Validate; + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; +@@ -0,0 +0,0 @@ public class RegistryMaterials extends IRegistryWritable { protected static final Logger LOGGER = LogManager.getLogger(); -- protected final RegistryID b = new RegistryID<>(256); -- protected final BiMap c = HashBiMap.create(); -- private final BiMap, T> bb = HashBiMap.create(); -+ protected final RegistryID b = new RegistryID<>(2048); // Paper - use bigger expected size to reduce collisions -+ protected final BiMap c = HashBiMap.create(2048); // Paper - use bigger expected size to reduce collisions -+ private final BiMap, T> bb = HashBiMap.create(2048); // Paper - use bigger expected size to reduce collisions - private final Set> bc = Sets.newIdentityHashSet(); - protected Object[] d; - private int bd; + private final ObjectList bf = new ObjectArrayList(256); +- private final Object2IntMap bg = new Object2IntOpenCustomHashMap(SystemUtils.k()); ++ private final Reference2IntOpenHashMap bg = new Reference2IntOpenHashMap(2048);// Paper - use bigger expected size to reduce collisions and direct intent for FastUtil to be identity map + private final BiMap bh; + private final BiMap, T> bi; + private final Map bj; @@ -0,0 +0,0 @@ public class RegistryMaterials extends IRegistryWritable { - this.d = collection.toArray(new Object[collection.size()]); - } - -- return SystemUtils.a(this.d, random); -+ return (T) SystemUtils.a(this.d, random); // Paper - Decompile fix + public RegistryMaterials(ResourceKey> resourcekey, Lifecycle lifecycle) { + super(resourcekey, lifecycle); + this.bg.defaultReturnValue(-1); +- this.bh = HashBiMap.create(); +- this.bi = HashBiMap.create(); +- this.bj = Maps.newIdentityHashMap(); ++ this.bh = HashBiMap.create(2048); // Paper - use bigger expected size to reduce collisions ++ this.bi = HashBiMap.create(2048); // Paper - use bigger expected size to reduce collisions ++ this.bj = new java.util.IdentityHashMap<>(2048); // Paper - use bigger expected size to reduce collisions + this.bk = lifecycle; } - @Override @@ -0,0 +0,0 @@ public class RegistryMaterials extends IRegistryWritable { - Iterator iterator = registrymaterials.b.iterator(); + this.b = collection.toArray(new Object[collection.size()]); + } + +- return SystemUtils.a(this.b, random); ++ return (T) SystemUtils.a(this.b, random); // Paper - Decompile fix + } + + public static Codec> a(ResourceKey> resourcekey, Lifecycle lifecycle, Codec codec) { +@@ -0,0 +0,0 @@ public class RegistryMaterials extends IRegistryWritable { + Iterator iterator = registrymaterials.iterator(); while (iterator.hasNext()) { - T t0 = iterator.next(); + T t0 = (T) iterator.next(); // Paper - Decompile fix - builder.add(Pair.of(registrymaterials.c(t0).get(), t0)); + builder.add(new RegistryMaterials.a<>((ResourceKey) registrymaterials.c(t0).get(), registrymaterials.a(t0), t0)); } -@@ -0,0 +0,0 @@ public class RegistryMaterials extends IRegistryWritable { - - registrymaterials.bb.entrySet().stream().filter((entry) -> { - return registrymaterials.c((ResourceKey) entry.getKey()); -- }).forEach(com_google_common_collect_immutablemap_builder::put); -+ }).forEach(entry1 -> com_google_common_collect_immutablemap_builder.put((java.util.Map.Entry,? extends T>) entry1)); // Paper - compiler fix (expand method reference + add cast) - return com_google_common_collect_immutablemap_builder.build(); - }); - } diff --git a/Spigot-Server-Patches/Optimize-TileEntity-Ticking.patch b/Spigot-Server-Patches/Optimize-TileEntity-Ticking.patch index 0c44929716..ca196313df 100644 --- a/Spigot-Server-Patches/Optimize-TileEntity-Ticking.patch +++ b/Spigot-Server-Patches/Optimize-TileEntity-Ticking.patch @@ -32,15 +32,29 @@ diff --git a/src/main/java/net/minecraft/server/BlockChest.java b/src/main/java/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/BlockChest.java +++ b/src/main/java/net/minecraft/server/BlockChest.java -@@ -0,0 +0,0 @@ public class BlockChest extends BlockChestAbstract implements I +@@ -0,0 +0,0 @@ import javax.annotation.Nullable; + public class BlockChest extends BlockChestAbstract implements IBlockWaterlogged { public static final BlockStateDirection FACING = BlockFacingHorizontal.FACING; - public static final BlockStateEnum c = BlockProperties.aF; +- public static final BlockStateEnum c = BlockProperties.aF; - public static final BlockStateBoolean d = BlockProperties.C; ++ public static final BlockStateEnum c = BlockProperties.aF; public static final BlockStateEnum CHEST_TYPE_PROPERTY = c; // Paper - OBFHELPER + public static final BlockStateBoolean d = BlockProperties.C; public static final BlockStateBoolean waterlogged() { return d; } // Paper OBFHELPER protected static final VoxelShape e = Block.a(1.0D, 0.0D, 0.0D, 15.0D, 14.0D, 15.0D); protected static final VoxelShape f = Block.a(1.0D, 0.0D, 1.0D, 15.0D, 14.0D, 16.0D); protected static final VoxelShape g = Block.a(0.0D, 0.0D, 1.0D, 15.0D, 14.0D, 15.0D); +diff --git a/src/main/java/net/minecraft/server/IBlockDataHolder.java b/src/main/java/net/minecraft/server/IBlockDataHolder.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/IBlockDataHolder.java ++++ b/src/main/java/net/minecraft/server/IBlockDataHolder.java +@@ -0,0 +0,0 @@ public abstract class IBlockDataHolder { + return Collections.unmodifiableCollection(this.b.keySet()); + } + ++ public > boolean contains(IBlockState iblockstate) { return this.b(iblockstate); } // Paper - OBFHELPER + public > boolean b(IBlockState iblockstate) { + return this.b.containsKey(iblockstate); + } diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/java/net/minecraft/server/TileEntityChest.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/TileEntityChest.java @@ -79,7 +93,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class TileEntityChest extends TileEntityLootable implements ITickable { if (this.viewingCount > 0 && this.a == 0.0F) { - this.a(SoundEffects.BLOCK_CHEST_OPEN); + this.playOpenSound(SoundEffects.BLOCK_CHEST_OPEN); } + } @@ -94,11 +108,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 float f2 = 0.5F; if (this.a < 0.5F && f1 >= 0.5F) { -- this.a(SoundEffects.BLOCK_CHEST_CLOSE); -- } -+ */ ++ */ + MCUtil.scheduleTask(10, () -> { -+ this.a(SoundEffects.BLOCK_CHEST_CLOSE); + this.playOpenSound(SoundEffects.BLOCK_CHEST_CLOSE); +- } + }, "Chest Sounds"); + //} // Paper end @@ -107,8 +120,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class TileEntityChest extends TileEntityLootable implements ITickable { } - public void a(SoundEffect soundeffect) { // PAIL private -> public, rename playSound -+ if (!this.getBlock().b(BlockChest.c)) { return; } // Paper - this can be delayed, double check exists - Fixes GH-2074 + public void playOpenSound(SoundEffect soundeffect) { ++ if (!this.getBlock().contains(BlockChest.CHEST_TYPE_PROPERTY)) { return; } // Paper - this can be delayed, double check exists - Fixes GH-2074 BlockPropertyChestType blockpropertychesttype = (BlockPropertyChestType) this.getBlock().get(BlockChest.c); if (blockpropertychesttype != BlockPropertyChestType.LEFT) { diff --git a/Spigot-Server-Patches/Optimize-UserCache-Thread-Safe.patch b/Spigot-Server-Patches/Optimize-UserCache-Thread-Safe.patch index bd71d8f7b0..8e17035494 100644 --- a/Spigot-Server-Patches/Optimize-UserCache-Thread-Safe.patch +++ b/Spigot-Server-Patches/Optimize-UserCache-Thread-Safe.patch @@ -9,6 +9,19 @@ easier to do this than replace the entire thing. Additionally, move Saving of the User cache to be done async, incase the user never changed the default setting for Spigot's save on stop only. +diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/DedicatedServer.java ++++ b/src/main/java/net/minecraft/server/DedicatedServer.java +@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer + } + + if (this.convertNames()) { +- this.getUserCache().b(); ++ this.getUserCache().b(false); // Paper + } + + if (!NameReferencingFileConverter.e(this)) { diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java @@ -17,8 +30,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } catch (java.lang.InterruptedException ignored) {} // Paper if (org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly) { LOGGER.info("Saving usercache.json"); -- this.getUserCache().c(); -+ this.getUserCache().c(false); // Paper +- this.getUserCache().b(); ++ this.getUserCache().b(false); // Paper } // Spigot end @@ -27,36 +40,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/UserCache.java +++ b/src/main/java/net/minecraft/server/UserCache.java @@ -0,0 +0,0 @@ public class UserCache { - - public static final SimpleDateFormat a = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z"); - private static boolean c; -- private final Map d = Maps.newHashMap(); -- private final Map e = Maps.newHashMap(); -+ private final Map d = new java.util.concurrent.ConcurrentHashMap<>(); // Paper -+ private final Map e = new java.util.concurrent.ConcurrentHashMap<>(); // Paper - private final Deque f = new java.util.concurrent.LinkedBlockingDeque(); // CraftBukkit - private final GameProfileRepository g; - protected final Gson b; -@@ -0,0 +0,0 @@ public class UserCache { - this.a(gameprofile, (Date) null); + return UserCache.b; } -- private void a(GameProfile gameprofile, Date date) { -+ private synchronized void a(GameProfile gameprofile, Date date) { // Paper - synchronize - UUID uuid = gameprofile.getId(); +- public void a(GameProfile gameprofile) { ++ public synchronized void a(GameProfile gameprofile) { // Paper - synchronize + Calendar calendar = Calendar.getInstance(); - if (date == null) { + calendar.setTime(new Date()); @@ -0,0 +0,0 @@ public class UserCache { - UserCache.UserCacheEntry usercache_usercacheentry = new UserCache.UserCacheEntry(gameprofile, date); -- if (this.e.containsKey(uuid)) { -+ //if (this.e.containsKey(uuid)) { // Paper - UserCache.UserCacheEntry usercache_usercacheentry1 = (UserCache.UserCacheEntry) this.e.get(uuid); -+ if (usercache_usercacheentry1 != null) { // Paper + this.a(usercache_usercacheentry); +- if( !org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly ) this.b(); // Spigot - skip saving if disabled ++ if( !org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly ) this.b(true); // Spigot - skip saving if disabled // Paper - async + } - this.d.remove(usercache_usercacheentry1.a().getName().toLowerCase(Locale.ROOT)); - this.f.remove(gameprofile); + private long d() { @@ -0,0 +0,0 @@ public class UserCache { } @@ -64,27 +64,37 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - public GameProfile getProfile(String s) { + public synchronized GameProfile getProfile(String s) { // Paper - synchronize String s1 = s.toLowerCase(Locale.ROOT); - UserCache.UserCacheEntry usercache_usercacheentry = (UserCache.UserCacheEntry) this.d.get(s1); - + UserCache.UserCacheEntry usercache_usercacheentry = (UserCache.UserCacheEntry) this.c.get(s1); + boolean flag = false; @@ -0,0 +0,0 @@ public class UserCache { + } + if (flag && !org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly) { // Spigot - skip saving if disabled +- this.b(); ++ this.b(true); // Paper + } + + return gameprofile; +@@ -0,0 +0,0 @@ public class UserCache { + return arraylist; } -+ // Paper start - public void c() { -+ c(true); -+ } -+ public void c(boolean asyncSave) { -+ // Paper end - String s = this.b.toJson(this.a(org.spigotmc.SpigotConfig.userCacheCap)); -+ Runnable save = () -> { -+ - BufferedWriter bufferedwriter = null; +- public void b() { ++ public void b(boolean asyncSave) { // Paper + JsonArray jsonarray = new JsonArray(); + DateFormat dateformat = e(); + +@@ -0,0 +0,0 @@ public class UserCache { + jsonarray.add(a(usercache_usercacheentry, dateformat)); + }); + String s = this.f.toJson(jsonarray); ++ Runnable save = () -> { // Paper try { + BufferedWriter bufferedwriter = Files.newWriter(this.g, StandardCharsets.UTF_8); @@ -0,0 +0,0 @@ public class UserCache { - } finally { - IOUtils.closeQuietly(bufferedwriter); + } catch (IOException ioexception) { + ; } + // Paper start + }; diff --git a/Spigot-Server-Patches/Optimize-call-to-getFluid-for-explosions.patch b/Spigot-Server-Patches/Optimize-call-to-getFluid-for-explosions.patch index 5e9e7cb003..1c92597884 100644 --- a/Spigot-Server-Patches/Optimize-call-to-getFluid-for-explosions.patch +++ b/Spigot-Server-Patches/Optimize-call-to-getFluid-for-explosions.patch @@ -14,6 +14,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 IBlockData iblockdata = this.world.getType(blockposition); - Fluid fluid = this.world.getFluid(blockposition); + Fluid fluid = iblockdata.getFluid(); // Paper - Optional optional = this.k.a(this, this.world, blockposition, iblockdata, fluid); + Optional optional = this.l.a(this, this.world, blockposition, iblockdata, fluid); if (optional.isPresent()) { diff --git a/Spigot-Server-Patches/Optimize-isOutsideRange-to-use-distance-maps.patch b/Spigot-Server-Patches/Optimize-isOutsideRange-to-use-distance-maps.patch index 697382e8f7..4fe152038b 100644 --- a/Spigot-Server-Patches/Optimize-isOutsideRange-to-use-distance-maps.patch +++ b/Spigot-Server-Patches/Optimize-isOutsideRange-to-use-distance-maps.patch @@ -158,7 +158,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + double lastEntitySpawnRadiusSquared; // Paper - optimise isOutsideRange, this field is in blocks + public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) { - super(worldserver, worldserver.getSpawn(), gameprofile); + super(worldserver, worldserver.getSpawn(), worldserver.v(), gameprofile); this.spawnDimension = World.OVERWORLD; diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 diff --git a/Spigot-Server-Patches/Optimize-isValidLocation-getType-and-getBlockData-fo.patch b/Spigot-Server-Patches/Optimize-isValidLocation-getType-and-getBlockData-fo.patch index 38dfa8c504..634c4042d9 100644 --- a/Spigot-Server-Patches/Optimize-isValidLocation-getType-and-getBlockData-fo.patch +++ b/Spigot-Server-Patches/Optimize-isValidLocation-getType-and-getBlockData-fo.patch @@ -77,12 +77,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public class ChunkEmpty extends Chunk { - private static final BiomeBase[] b = (BiomeBase[]) SystemUtils.a((Object) (new BiomeBase[BiomeStorage.a]), (abiomebase) -> { -+ private static final BiomeBase[] b = (BiomeBase[]) SystemUtils.a((new BiomeBase[BiomeStorage.a]), (abiomebase) -> { // Paper - decompile error - Arrays.fill(abiomebase, Biomes.PLAINS); ++ private static final BiomeBase[] b = SystemUtils.a((new BiomeBase[BiomeStorage.a]), (abiomebase) -> { // Paper - decompile error + Arrays.fill(abiomebase, BiomeRegistry.a); }); @@ -0,0 +0,0 @@ public class ChunkEmpty extends Chunk { - super(world, chunkcoordintpair, new BiomeStorage(ChunkEmpty.b)); + super(world, chunkcoordintpair, new BiomeStorage(world.r().b(IRegistry.ay), ChunkEmpty.b)); } + // Paper start @@ -106,7 +106,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private short tickingBlockCount; private short e; - private final DataPaletteBlock blockIds; -+ final DataPaletteBlock blockIds; ++ final DataPaletteBlock blockIds; // Paper - package-private public ChunkSection(int i) { this(i, (short) 0, (short) 0, (short) 0); @@ -199,17 +199,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } public static boolean isValidLocation(BlockPosition blockposition) { -- return !isOutsideWorld(blockposition) && e(blockposition); -+ return blockposition.isValidLocation(); +- return !isOutsideWorld(blockposition) && D(blockposition); ++ return blockposition.isValidLocation(); // Paper - use better/optimized check } - public static boolean k(BlockPosition blockposition) { -@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - } - - public static boolean isOutsideWorld(BlockPosition blockposition) { -- return b(blockposition.getY()); -+ return blockposition.isInvalidYLocation(); - } - - public static boolean b(int i) { + public static boolean l(BlockPosition blockposition) { diff --git a/Spigot-Server-Patches/Option-to-prevent-armor-stands-from-doing-entity-loo.patch b/Spigot-Server-Patches/Option-to-prevent-armor-stands-from-doing-entity-loo.patch index f56ab24534..01e6a57a93 100644 --- a/Spigot-Server-Patches/Option-to-prevent-armor-stands-from-doing-entity-loo.patch +++ b/Spigot-Server-Patches/Option-to-prevent-armor-stands-from-doing-entity-loo.patch @@ -9,8 +9,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { - log("Bed Search Radius: " + bedSearchRadius); - } + private void scanForLegacyEnderDragon() { + scanForLegacyEnderDragon = getBoolean("game-mechanics.scan-for-legacy-ender-dragon", true); } + + public boolean armorStandEntityLookups = true; diff --git a/Spigot-Server-Patches/Optional-TNT-doesn-t-move-in-water.patch b/Spigot-Server-Patches/Optional-TNT-doesn-t-move-in-water.patch index 16d0875b7c..3077d4c279 100644 --- a/Spigot-Server-Patches/Optional-TNT-doesn-t-move-in-water.patch +++ b/Spigot-Server-Patches/Optional-TNT-doesn-t-move-in-water.patch @@ -81,7 +81,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private void explode() { @@ -0,0 +0,0 @@ public class EntityTNTPrimed extends Entity { - public Packet O() { + public Packet P() { return new PacketPlayOutSpawnEntity(this); } + diff --git a/Spigot-Server-Patches/POM-Changes.patch b/Spigot-Server-Patches/POM-Changes.patch index 3efc6741ae..1e5bd20ed2 100644 --- a/Spigot-Server-Patches/POM-Changes.patch +++ b/Spigot-Server-Patches/POM-Changes.patch @@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - spigot + paper jar - 1.16.1-R0.1-SNAPSHOT + 1.16.2-R0.1-SNAPSHOT - Spigot - https://www.spigotmc.org/ + Paper @@ -27,7 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + UTF-8 unknown - 1.16.1 + 1.16.2 @@ -0,0 +0,0 @@ @@ -201,7 +201,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + Date buildDate = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").parse(Main.class.getPackage().getImplementationVendor()); // Paper Calendar deadline = Calendar.getInstance(); - deadline.add(Calendar.DAY_OF_YEAR, -21); + deadline.add(Calendar.DAY_OF_YEAR, -7); diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java diff --git a/Spigot-Server-Patches/Paper-config-files.patch b/Spigot-Server-Patches/Paper-config-files.patch index 73913d1ad7..f75faf7da1 100644 --- a/Spigot-Server-Patches/Paper-config-files.patch +++ b/Spigot-Server-Patches/Paper-config-files.patch @@ -603,7 +603,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java @@ -0,0 +0,0 @@ public class Main { - DedicatedServerSettings dedicatedserversettings = new DedicatedServerSettings(optionset); // CraftBukkit - CLI argument support + DedicatedServerSettings dedicatedserversettings = new DedicatedServerSettings(iregistrycustom_dimension, optionset); // CraftBukkit - CLI argument support dedicatedserversettings.save(); + // Paper start - load config files for access below if needed @@ -647,7 +647,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private org.spigotmc.TickLimiter entityLimiter; @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - protected World(WorldDataMutable worlddatamutable, ResourceKey resourcekey, ResourceKey resourcekey1, DimensionManager dimensionmanager, Supplier supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env) { + protected World(WorldDataMutable worlddatamutable, ResourceKey resourcekey, final DimensionManager dimensionmanager, Supplier supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env) { this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((WorldDataServer) worlddatamutable).getName()); // Spigot + this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(worlddata.getName(), this.spigotConfig); // Paper this.generator = gen; diff --git a/Spigot-Server-Patches/Player-affects-spawning-API.patch b/Spigot-Server-Patches/Player-affects-spawning-API.patch index 5d8f009c95..d212c1e2fd 100644 --- a/Spigot-Server-Patches/Player-affects-spawning-API.patch +++ b/Spigot-Server-Patches/Player-affects-spawning-API.patch @@ -4,12 +4,24 @@ Date: Tue, 1 Mar 2016 14:47:52 -0600 Subject: [PATCH] Player affects spawning API +diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/Entity.java ++++ b/src/main/java/net/minecraft/server/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke + return MathHelper.c(f * f + f1 * f1 + f2 * f2); + } + ++ public double getDistanceSquared(double x, double y, double z) { return h(x, y, z); } // Paper - OBFHELPER + public double h(double d0, double d1, double d2) { + double d3 = this.locX() - d0; + double d4 = this.locY() - d1; diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java @@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { - private final ItemCooldown bT; + private final ItemCooldown bM; @Nullable public EntityFishingHook hookedFish; + // Paper start @@ -36,7 +48,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/EntitySilverfish.java +++ b/src/main/java/net/minecraft/server/EntitySilverfish.java @@ -0,0 +0,0 @@ public class EntitySilverfish extends EntityMonster { - if (d(entitytypes, generatoraccess, enummobspawn, blockposition, random)) { + if (c(entitytypes, generatoraccess, enummobspawn, blockposition, random)) { EntityHuman entityhuman = generatoraccess.a((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, 5.0D, true); - return entityhuman == null; @@ -78,7 +90,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + entityhuman = (EntityHuman) iterator.next(); + } while (!IEntitySelector.affectsSpawning.test(entityhuman)); + -+ d4 = entityhuman.g(d0, d1, d2); ++ d4 = entityhuman.getDistanceSquared(d0, d1, d2); + } while (d3 >= 0.0D && d4 >= d3 * d3); + + return true; diff --git a/Spigot-Server-Patches/Player.setPlayerProfile-API.patch b/Spigot-Server-Patches/Player.setPlayerProfile-API.patch index 9586e3c3f2..487fc58ac6 100644 --- a/Spigot-Server-Patches/Player.setPlayerProfile-API.patch +++ b/Spigot-Server-Patches/Player.setPlayerProfile-API.patch @@ -10,13 +10,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java @@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { - protected int bN; - protected final float bO = 0.02F; + protected int bG; + protected final float bH = 0.02F; private int g; -- private final GameProfile bQ; -+ private GameProfile bQ; public final void setProfile(final GameProfile profile) { this.bQ = profile; } // Paper - OBFHELPER - private ItemStack bS; - private final ItemCooldown bT; +- private final GameProfile bJ; ++ private GameProfile bJ; public final void setProfile(final GameProfile profile) { this.bJ = profile; } // Paper - OBFHELPER + private ItemStack bL; + private final ItemCooldown bM; @Nullable diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 @@ -51,23 +51,6 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -0,0 +0,0 @@ - package org.bukkit.craftbukkit.entity; - - import com.destroystokyo.paper.Title; -+import com.destroystokyo.paper.profile.CraftPlayerProfile; -+import com.destroystokyo.paper.profile.PlayerProfile; - import com.google.common.base.Preconditions; - import com.google.common.collect.ImmutableSet; - import com.google.common.io.BaseEncoding; -@@ -0,0 +0,0 @@ import net.minecraft.server.EnumColor; - import net.minecraft.server.EnumGamemode; - import net.minecraft.server.GenericAttributes; - import net.minecraft.server.IChatBaseComponent; -+import net.minecraft.server.MCUtil; - import net.minecraft.server.MapIcon; - import net.minecraft.server.MinecraftKey; - import net.minecraft.server.NBTTagCompound; @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { hiddenPlayers.put(player.getUniqueId(), hidingPlugins); @@ -109,9 +92,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + registerPlayer(player); + } + } -+ public void setPlayerProfile(PlayerProfile profile) { ++ public void setPlayerProfile(com.destroystokyo.paper.profile.PlayerProfile profile) { + EntityPlayer self = getHandle(); -+ self.setProfile(CraftPlayerProfile.asAuthlibCopy(profile)); ++ self.setProfile(com.destroystokyo.paper.profile.CraftPlayerProfile.asAuthlibCopy(profile)); + if (!self.sentListPacket) { + return; + } @@ -121,8 +104,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + refreshPlayer(); + } -+ public PlayerProfile getPlayerProfile() { -+ return new CraftPlayerProfile(this).clone(); ++ public com.destroystokyo.paper.profile.PlayerProfile getPlayerProfile() { ++ return new com.destroystokyo.paper.profile.CraftPlayerProfile(this).clone(); + } + + private void refreshPlayer() { @@ -135,7 +118,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + //Respawn the player then update their position and selected slot + WorldServer worldserver = handle.getWorldServer(); -+ connection.sendPacket(new net.minecraft.server.PacketPlayOutRespawn(worldserver.getTypeKey(), worldserver.getDimensionKey(), net.minecraft.server.BiomeManager.a(worldserver.getSeed()), handle.playerInteractManager.getGameMode(), handle.playerInteractManager.c(), worldserver.isDebugWorld(), worldserver.isFlatWorld(), true)); ++ connection.sendPacket(new net.minecraft.server.PacketPlayOutRespawn(worldserver.getDimensionManager(), worldserver.getDimensionKey(), net.minecraft.server.BiomeManager.a(worldserver.getSeed()), handle.playerInteractManager.getGameMode(), handle.playerInteractManager.c(), worldserver.isDebugWorld(), worldserver.isFlatWorld(), true)); + handle.updateAbilities(); + connection.sendPacket(new net.minecraft.server.PacketPlayOutPosition(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch(), new HashSet<>(), 0)); + net.minecraft.server.MinecraftServer.getServer().getPlayerList().updateClient(handle); diff --git a/Spigot-Server-Patches/PlayerDeathEvent-shouldDropExperience.patch b/Spigot-Server-Patches/PlayerDeathEvent-shouldDropExperience.patch index dc279458f3..aaae8b073e 100644 --- a/Spigot-Server-Patches/PlayerDeathEvent-shouldDropExperience.patch +++ b/Spigot-Server-Patches/PlayerDeathEvent-shouldDropExperience.patch @@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - this.eW(); + this.eV(); } // SPIGOT-5478 must be called manually now - this.dropExperience(); diff --git a/Spigot-Server-Patches/PlayerPickupExperienceEvent.patch b/Spigot-Server-Patches/PlayerPickupExperienceEvent.patch index a98c235140..70063a890d 100644 --- a/Spigot-Server-Patches/PlayerPickupExperienceEvent.patch +++ b/Spigot-Server-Patches/PlayerPickupExperienceEvent.patch @@ -13,8 +13,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override public void pickup(EntityHuman entityhuman) { if (!this.world.isClientSide) { -- if (this.d == 0 && entityhuman.bB == 0) { -+ if (this.d == 0 && entityhuman.bB == 0 && new com.destroystokyo.paper.event.player.PlayerPickupExperienceEvent(((EntityPlayer) entityhuman).getBukkitEntity(), (org.bukkit.entity.ExperienceOrb) this.getBukkitEntity()).callEvent()) { // Paper - entityhuman.bB = 2; +- if (this.d == 0 && entityhuman.bu == 0) { ++ if (this.d == 0 && entityhuman.bu == 0 && new com.destroystokyo.paper.event.player.PlayerPickupExperienceEvent(((EntityPlayer) entityhuman).getBukkitEntity(), (org.bukkit.entity.ExperienceOrb) this.getBukkitEntity()).callEvent()) { // Paper + entityhuman.bu = 2; entityhuman.receive(this, 1); Entry entry = EnchantmentManager.a(Enchantments.MENDING, (EntityLiving) entityhuman, ItemStack::f); diff --git a/Spigot-Server-Patches/PreCreatureSpawnEvent.patch b/Spigot-Server-Patches/PreCreatureSpawnEvent.patch index 54f268c6aa..38b785aa5f 100644 --- a/Spigot-Server-Patches/PreCreatureSpawnEvent.patch +++ b/Spigot-Server-Patches/PreCreatureSpawnEvent.patch @@ -19,58 +19,62 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java @@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract { - double d5 = j >= 3 ? nbttaglist.h(2) : (double) blockposition.getZ() + (world.random.nextDouble() - world.random.nextDouble()) * (double) this.spawnRange + 0.5D; + WorldServer worldserver = (WorldServer) world; - if (world.b(((EntityTypes) optional.get()).a(d3, d4, d5)) && EntityPositionTypes.a((EntityTypes) optional.get(), world.getMinecraftWorld(), EnumMobSpawn.SPAWNER, new BlockPosition(d3, d4, d5), world.getRandom())) { -+ // Paper start -+ EntityTypes entityType = optional.get(); -+ String key = EntityTypes.getName(entityType).getKey(); + if (EntityPositionTypes.a((EntityTypes) optional.get(), worldserver, EnumMobSpawn.SPAWNER, new BlockPosition(d3, d4, d5), world.getRandom())) { ++ // Paper start ++ EntityTypes entityType = optional.get(); ++ String key = EntityTypes.getName(entityType).getKey(); + -+ org.bukkit.entity.EntityType type = org.bukkit.entity.EntityType.fromName(key); -+ if (type != null) { -+ com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event; -+ event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent( -+ MCUtil.toLocation(world, d3, d4, d5), -+ type, -+ org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER -+ ); -+ if (!event.callEvent()) { -+ flag = true; -+ if (event.shouldAbortSpawn()) { -+ break; ++ org.bukkit.entity.EntityType type = org.bukkit.entity.EntityType.fromName(key); ++ if (type != null) { ++ com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event; ++ event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent( ++ MCUtil.toLocation(world, d3, d4, d5), ++ type, ++ org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER ++ ); ++ if (!event.callEvent()) { ++ flag = true; ++ if (event.shouldAbortSpawn()) { ++ break; ++ } ++ continue; + } -+ continue; + } -+ } -+ // Paper end - Entity entity = EntityTypes.a(nbttagcompound, world, (entity1) -> { - entity1.setPositionRotation(d3, d4, d5, entity1.yaw, entity1.pitch); - return entity1; ++ // Paper end + Entity entity = EntityTypes.a(nbttagcompound, world, (entity1) -> { + entity1.setPositionRotation(d3, d4, d5, entity1.yaw, entity1.pitch); + return entity1; diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/SpawnerCreature.java +++ b/src/main/java/net/minecraft/server/SpawnerCreature.java @@ -0,0 +0,0 @@ public final class SpawnerCreature { - j1 = biomebase_biomemeta.d + worldserver.random.nextInt(1 + biomebase_biomemeta.e - biomebase_biomemeta.d); + j1 = biomesettingsmobs_c.d + worldserver.random.nextInt(1 + biomesettingsmobs_c.e - biomesettingsmobs_c.d); } -- if (a(worldserver, enumcreaturetype, structuremanager, chunkgenerator, biomebase_biomemeta, blockposition_mutableblockposition, d2) && spawnercreature_c.test(biomebase_biomemeta.c, blockposition_mutableblockposition, ichunkaccess)) { +- if (a(worldserver, enumcreaturetype, structuremanager, chunkgenerator, biomesettingsmobs_c, blockposition_mutableblockposition, d2) && spawnercreature_c.test(biomesettingsmobs_c.c, blockposition_mutableblockposition, ichunkaccess)) { + // Paper start -+ Boolean doSpawning = a(worldserver, enumcreaturetype, structuremanager, chunkgenerator, biomebase_biomemeta, blockposition_mutableblockposition, d2); ++ Boolean doSpawning = a(worldserver, enumcreaturetype, structuremanager, chunkgenerator, biomesettingsmobs_c, blockposition_mutableblockposition, d2); + if (doSpawning == null) { + return; + } -+ if (doSpawning.booleanValue() && spawnercreature_c.test(biomebase_biomemeta.c, blockposition_mutableblockposition, ichunkaccess)) { // Paper end - EntityInsentient entityinsentient = a(worldserver, biomebase_biomemeta.c); ++ if (doSpawning && spawnercreature_c.test(biomesettingsmobs_c.c, blockposition_mutableblockposition, ichunkaccess)) { ++ // Paper end + EntityInsentient entityinsentient = a(worldserver, biomesettingsmobs_c.c); ++ if (entityinsentient == null) { + return; + } @@ -0,0 +0,0 @@ public final class SpawnerCreature { } } -- private static boolean a(WorldServer worldserver, EnumCreatureType enumcreaturetype, StructureManager structuremanager, ChunkGenerator chunkgenerator, BiomeBase.BiomeMeta biomebase_biomemeta, BlockPosition.MutableBlockPosition blockposition_mutableblockposition, double d0) { -+ private static Boolean a(WorldServer worldserver, EnumCreatureType enumcreaturetype, StructureManager structuremanager, ChunkGenerator chunkgenerator, BiomeBase.BiomeMeta biomebase_biomemeta, BlockPosition.MutableBlockPosition blockposition_mutableblockposition, double d0) { // Paper - EntityTypes entitytypes = biomebase_biomemeta.c; +- private static boolean a(WorldServer worldserver, EnumCreatureType enumcreaturetype, StructureManager structuremanager, ChunkGenerator chunkgenerator, BiomeSettingsMobs.c biomesettingsmobs_c, BlockPosition.MutableBlockPosition blockposition_mutableblockposition, double d0) { ++ private static Boolean a(WorldServer worldserver, EnumCreatureType enumcreaturetype, StructureManager structuremanager, ChunkGenerator chunkgenerator, BiomeSettingsMobs.c biomesettingsmobs_c, BlockPosition.MutableBlockPosition blockposition_mutableblockposition, double d0) { // Paper + EntityTypes entitytypes = biomesettingsmobs_c.c; + // Paper start + com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event; + org.bukkit.entity.EntityType type = org.bukkit.entity.EntityType.fromName(EntityTypes.getName(entitytypes).getKey()); @@ -83,7 +87,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (event.shouldAbortSpawn()) { + return null; + } -+ return false; // TODO is this handled correctly? ++ return false; + } + } + // Paper end diff --git a/Spigot-Server-Patches/PreSpawnerSpawnEvent.patch b/Spigot-Server-Patches/PreSpawnerSpawnEvent.patch index c7bb6d0b42..5414464a17 100644 --- a/Spigot-Server-Patches/PreSpawnerSpawnEvent.patch +++ b/Spigot-Server-Patches/PreSpawnerSpawnEvent.patch @@ -14,16 +14,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java @@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract { - org.bukkit.entity.EntityType type = org.bukkit.entity.EntityType.fromName(key); - if (type != null) { -- com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event; -- event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent( + org.bukkit.entity.EntityType type = org.bukkit.entity.EntityType.fromName(key); + if (type != null) { +- com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event; +- event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent( + com.destroystokyo.paper.event.entity.PreSpawnerSpawnEvent event; + event = new com.destroystokyo.paper.event.entity.PreSpawnerSpawnEvent( - MCUtil.toLocation(world, d3, d4, d5), - type, -- org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER + MCUtil.toLocation(world, d3, d4, d5), + type, +- org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER + MCUtil.toLocation(world, blockposition) - ); - if (!event.callEvent()) { - flag = true; + ); + if (!event.callEvent()) { + flag = true; diff --git a/Spigot-Server-Patches/Prevent-Enderman-from-loading-chunks.patch b/Spigot-Server-Patches/Prevent-Enderman-from-loading-chunks.patch index 892390ef1e..ba4f7579a6 100644 --- a/Spigot-Server-Patches/Prevent-Enderman-from-loading-chunks.patch +++ b/Spigot-Server-Patches/Prevent-Enderman-from-loading-chunks.patch @@ -27,4 +27,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (iblockdata == null) return; // Paper BlockPosition blockposition1 = blockposition.down(); IBlockData iblockdata1 = world.getType(blockposition1); - IBlockData iblockdata2 = Block.getValidBlockForPosition(getEnderman().getCarried(), getEnderman().world, blockposition); // Paper - Fix MC-124320 + IBlockData iblockdata2 = this.a.getCarried(); diff --git a/Spigot-Server-Patches/Prevent-Fire-from-loading-chunks.patch b/Spigot-Server-Patches/Prevent-Fire-from-loading-chunks.patch index 1af6fc395c..f1cedae5a2 100644 --- a/Spigot-Server-Patches/Prevent-Fire-from-loading-chunks.patch +++ b/Spigot-Server-Patches/Prevent-Fire-from-loading-chunks.patch @@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/BlockFire.java +++ b/src/main/java/net/minecraft/server/BlockFire.java @@ -0,0 +0,0 @@ public class BlockFire extends BlockFireAbstract { - BlockStateBoolean blockstateboolean = (BlockStateBoolean) BlockFire.p.get(enumdirection); + BlockStateBoolean blockstateboolean = (BlockStateBoolean) BlockFire.h.get(enumdirection); if (blockstateboolean != null) { - iblockdata1 = (IBlockData) iblockdata1.set(blockstateboolean, this.e(iblockaccess.getType(blockposition.shift(enumdirection)))); diff --git a/Spigot-Server-Patches/Prevent-Saving-Bad-entities-to-chunks.patch b/Spigot-Server-Patches/Prevent-Saving-Bad-entities-to-chunks.patch index 748fe3a33e..f868d1ed02 100644 --- a/Spigot-Server-Patches/Prevent-Saving-Bad-entities-to-chunks.patch +++ b/Spigot-Server-Patches/Prevent-Saving-Bad-entities-to-chunks.patch @@ -92,7 +92,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 List entityslice = aentityslice[j]; // Spigot Iterator iterator = entityslice.iterator(); @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { - throw (IllegalStateException) SystemUtils.c(new IllegalStateException("Removing entity while ticking!")); + throw (IllegalStateException) SystemUtils.c((Throwable) (new IllegalStateException("Removing entity while ticking!"))); } + // Paper start - move out entities that shouldn't be in this chunk before it unloads diff --git a/Spigot-Server-Patches/Prevent-consuming-the-wrong-itemstack.patch b/Spigot-Server-Patches/Prevent-consuming-the-wrong-itemstack.patch index 1104879e50..9fd43d010a 100644 --- a/Spigot-Server-Patches/Prevent-consuming-the-wrong-itemstack.patch +++ b/Spigot-Server-Patches/Prevent-consuming-the-wrong-itemstack.patch @@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { - this.datawatcher.set(EntityLiving.an, (byte) j); + this.datawatcher.set(EntityLiving.ag, (byte) j); } - public void c(EnumHand enumhand) { @@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - if (!itemstack.isEmpty() && !this.isHandRaised()) { + if (!itemstack.isEmpty() && !this.isHandRaised() || forceUpdate) { // Paper use override flag this.activeItem = itemstack; - this.bk = itemstack.k(); + this.bd = itemstack.k(); if (!this.world.isClientSide) { @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { this.releaseActiveItem(); @@ -33,8 +33,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // CraftBukkit start - fire PlayerItemConsumeEvent ItemStack itemstack; @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { - this.a(this.getRaisedHand(), itemstack); - // CraftBukkit end + } + this.clearActiveItem(); - // Paper start - if the replacement is anything but the default, update the client inventory - if (this instanceof EntityPlayer && !com.google.common.base.Objects.equal(defaultReplacement, itemstack)) { diff --git a/Spigot-Server-Patches/Prevent-headless-pistons-from-being-created.patch b/Spigot-Server-Patches/Prevent-headless-pistons-from-being-created.patch new file mode 100644 index 0000000000..85c8bd5b40 --- /dev/null +++ b/Spigot-Server-Patches/Prevent-headless-pistons-from-being-created.patch @@ -0,0 +1,57 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: commandblockguy +Date: Fri, 14 Aug 2020 14:44:14 -0500 +Subject: [PATCH] Prevent headless pistons from being created + +Prevent headless pistons from being created by explosions or tree/mushroom growth. + +diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java +@@ -0,0 +0,0 @@ public class PaperConfig { + set("settings.unsupported-settings.allow-tnt-duplication", null); + } + ++ public static boolean allowHeadlessPistons; ++ private static void allowHeadlessPistons() { ++ config.set("settings.unsupported-settings.allow-headless-pistons-readme", "This setting controls if players should be able to create headless pistons."); ++ allowHeadlessPistons = getBoolean("settings.unsupported-settings.allow-headless-pistons", false); ++ } ++ + public static int playerAutoSaveRate = -1; + public static int maxPlayerAutoSavePerTick = 10; + private static void playerAutoSaveRate() { +diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/Explosion.java ++++ b/src/main/java/net/minecraft/server/Explosion.java +@@ -0,0 +0,0 @@ public class Explosion { + + if (f > 0.0F && this.l.a(this, this.world, blockposition, iblockdata, f) && blockposition.getY() < 256 && blockposition.getY() >= 0) { // CraftBukkit - don't wrap explosions + set.add(blockposition); ++ // Paper start - prevent headless pistons from forming ++ if (!com.destroystokyo.paper.PaperConfig.allowHeadlessPistons && iblockdata.getBlock() == Blocks.MOVING_PISTON) { ++ TileEntityPiston extension = (TileEntityPiston)this.world.getTileEntity(blockposition); ++ if (extension.isHead()) { ++ EnumDirection direction = iblockdata.get(BlockPistonExtension.FACING); ++ set.add(blockposition.shift(direction.opposite())); ++ } ++ } ++ // Paper end + } + + d4 += d0 * 0.30000001192092896D; +diff --git a/src/main/java/net/minecraft/server/TileEntityPiston.java b/src/main/java/net/minecraft/server/TileEntityPiston.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/TileEntityPiston.java ++++ b/src/main/java/net/minecraft/server/TileEntityPiston.java +@@ -0,0 +0,0 @@ public class TileEntityPiston extends TileEntity implements ITickable { + return this.b; + } + ++ public final boolean isHead() { return this.h(); } // Paper - OBFHELPER ++ + public boolean h() { + return this.g; + } diff --git a/Spigot-Server-Patches/Prevent-mob-spawning-from-loading-generating-chunks.patch b/Spigot-Server-Patches/Prevent-mob-spawning-from-loading-generating-chunks.patch index b7d1b289c4..4bf4c43577 100644 --- a/Spigot-Server-Patches/Prevent-mob-spawning-from-loading-generating-chunks.patch +++ b/Spigot-Server-Patches/Prevent-mob-spawning-from-loading-generating-chunks.patch @@ -23,10 +23,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 int k = 0; @@ -0,0 +0,0 @@ public final class SpawnerCreature { if (entityhuman != null) { - double d2 = entityhuman.g(d0, (double) i, d1); + double d2 = entityhuman.h(d0, (double) i, d1); - if (a(worldserver, ichunkaccess, blockposition_mutableblockposition, d2)) { + if (a(worldserver, ichunkaccess, blockposition_mutableblockposition, d2) && worldserver.isLoadedAndInBounds(blockposition_mutableblockposition)) { // Paper - don't load chunks for mob spawn - if (biomebase_biomemeta == null) { - biomebase_biomemeta = a(worldserver, structuremanager, chunkgenerator, enumcreaturetype, worldserver.random, (BlockPosition) blockposition_mutableblockposition); - if (biomebase_biomemeta == null) { + if (biomesettingsmobs_c == null) { + biomesettingsmobs_c = a(worldserver, structuremanager, chunkgenerator, enumcreaturetype, worldserver.random, (BlockPosition) blockposition_mutableblockposition); + if (biomesettingsmobs_c == null) { diff --git a/Spigot-Server-Patches/Prevent-position-desync-in-playerconnection-causing-.patch b/Spigot-Server-Patches/Prevent-position-desync-in-playerconnection-causing-.patch index 8058812e0d..995af88640 100644 --- a/Spigot-Server-Patches/Prevent-position-desync-in-playerconnection-causing-.patch +++ b/Spigot-Server-Patches/Prevent-position-desync-in-playerconnection-causing-.patch @@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { this.player.move(EnumMoveType.PLAYER, new Vec3D(d7, d8, d9)); - this.player.c(packetplayinflying.b()); // CraftBukkit - SPIGOT-5810, SPIGOT-5835: reset by this.player.move + this.player.setOnGround(packetplayinflying.b()); // CraftBukkit - SPIGOT-5810, SPIGOT-5835: reset by this.player.move + // Paper start - prevent position desync + if (this.teleportPos != null) { + return; // ... thanks Mojang for letting move calls teleport across dimensions. diff --git a/Spigot-Server-Patches/ProfileWhitelistVerifyEvent.patch b/Spigot-Server-Patches/ProfileWhitelistVerifyEvent.patch index 283d860642..4078820694 100644 --- a/Spigot-Server-Patches/ProfileWhitelistVerifyEvent.patch +++ b/Spigot-Server-Patches/ProfileWhitelistVerifyEvent.patch @@ -46,4 +46,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end public boolean isOp(GameProfile gameprofile) { - return this.operators.d(gameprofile) || this.server.a(gameprofile) && this.server.getSaveData().n() || this.v; + return this.operators.d(gameprofile) || this.server.a(gameprofile) && this.server.getSaveData().o() || this.v; diff --git a/Spigot-Server-Patches/Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch b/Spigot-Server-Patches/Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch index 7d2a4c3667..0a763aba1d 100644 --- a/Spigot-Server-Patches/Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch +++ b/Spigot-Server-Patches/Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch @@ -48,7 +48,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this != Blocks.END_PORTAL_FRAME && + this != Blocks.END_PORTAL && + this != Blocks.END_GATEWAY && -+ this != Blocks.MOVING_PISTON; // try to prevent creation of headless pistons ++ this != Blocks.COMMAND_BLOCK && ++ this != Blocks.REPEATING_COMMAND_BLOCK && ++ this != Blocks.CHAIN_COMMAND_BLOCK && ++ this != Blocks.BARRIER && ++ this != Blocks.STRUCTURE_BLOCK && ++ this != Blocks.JIGSAW; + } public co.aikar.timings.Timing timing; public co.aikar.timings.Timing getTiming() { @@ -140,7 +145,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 IBlockData iblockdata = this.world.getType(blockposition); + if (!iblockdata.isDestroyable()) continue; // Paper Fluid fluid = iblockdata.getFluid(); // Paper - Optional optional = this.k.a(this, this.world, blockposition, iblockdata, fluid); + Optional optional = this.l.a(this, this.world, blockposition, iblockdata, fluid); @@ -0,0 +0,0 @@ public class Explosion { IBlockData iblockdata = this.world.getType(blockposition); diff --git a/Spigot-Server-Patches/Re-add-vanilla-entity-warnings-for-duplicates.patch b/Spigot-Server-Patches/Re-add-vanilla-entity-warnings-for-duplicates.patch index 59b21a72d2..353d687d30 100644 --- a/Spigot-Server-Patches/Re-add-vanilla-entity-warnings-for-duplicates.patch +++ b/Spigot-Server-Patches/Re-add-vanilla-entity-warnings-for-duplicates.patch @@ -15,9 +15,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (entity1 == null) { return false; } else { -- // WorldServer.LOGGER.warn("Keeping entity {} that already exists with UUID {}", EntityTypes.getName(entity1.getEntityType()), entity.getUniqueID().toString()); // CraftBukkit -+ WorldServer.LOGGER.error("Keeping entity {} that already exists with UUID {}", EntityTypes.getName(entity1.getEntityType()), entity.getUniqueID().toString()); // CraftBukkit // paper -+ WorldServer.LOGGER.error("Deleting duplicate entity {}", entity); // CraftBukkit // paper +- // WorldServer.LOGGER.warn("Trying to add entity with duplicated UUID {}. Existing {}#{}, new: {}#{}", uuid, EntityTypes.getName(entity1.getEntityType()), entity1.getId(), EntityTypes.getName(entity.getEntityType()), entity.getId()); // CraftBukkit ++ WorldServer.LOGGER.warn("Trying to add entity with duplicated UUID {}. Existing {}#{}, new: {}#{}", uuid, EntityTypes.getName(entity1.getEntityType()), entity1.getId(), EntityTypes.getName(entity.getEntityType()), entity.getId()); // CraftBukkit // Paper return true; } } diff --git a/Spigot-Server-Patches/Reduce-memory-footprint-of-NBTTagCompound.patch b/Spigot-Server-Patches/Reduce-memory-footprint-of-NBTTagCompound.patch index dfd42f7172..c4d67de9b6 100644 --- a/Spigot-Server-Patches/Reduce-memory-footprint-of-NBTTagCompound.patch +++ b/Spigot-Server-Patches/Reduce-memory-footprint-of-NBTTagCompound.patch @@ -11,12 +11,20 @@ diff --git a/src/main/java/net/minecraft/server/NBTTagCompound.java b/src/main/j index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/NBTTagCompound.java +++ b/src/main/java/net/minecraft/server/NBTTagCompound.java +@@ -0,0 +0,0 @@ import java.util.Set; + import java.util.UUID; + import java.util.regex.Pattern; + import javax.annotation.Nullable; ++import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; // Paper + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; + @@ -0,0 +0,0 @@ public class NBTTagCompound implements NBTBase { if (i > 512) { throw new RuntimeException("Tried to read NBT tag with too high complexity, depth > 512"); } else { - HashMap hashmap = Maps.newHashMap(); -+ it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap hashmap = new it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<>(8, 0.8f); // Paper - reduce memory footprint of NBTTagCompound ++ Object2ObjectOpenHashMap hashmap = new Object2ObjectOpenHashMap<>(8, 0.8f); // Paper - reduce memory footprint of NBTTagCompound byte b0; @@ -25,7 +33,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public NBTTagCompound() { - this(Maps.newHashMap()); -+ this(new it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<>(8, 0.8f)); // Paper - reduce memory footprint of NBTTagCompound ++ this(new Object2ObjectOpenHashMap<>(8, 0.8f)); // Paper - reduce memory footprint of NBTTagCompound } @Override @@ -35,10 +43,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public NBTTagCompound clone() { - Map map = Maps.newHashMap(Maps.transformValues(this.map, NBTBase::clone)); + // Paper start - reduce memory footprint of NBTTagCompound -+ it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap ret = new it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<>(this.map.size(), 0.8f); ++ Object2ObjectOpenHashMap ret = new Object2ObjectOpenHashMap<>(this.map.size(), 0.8f); - return new NBTTagCompound(map); -+ Iterator> iterator = (this.map instanceof it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap) ? ((it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap)this.map).object2ObjectEntrySet().fastIterator() : this.map.entrySet().iterator(); ++ Iterator> iterator = (this.map instanceof Object2ObjectOpenHashMap) ? ((Object2ObjectOpenHashMap)this.map).object2ObjectEntrySet().fastIterator() : this.map.entrySet().iterator(); + while (iterator.hasNext()) { + Map.Entry entry = iterator.next(); + ret.put(entry.getKey(), entry.getValue().clone()); diff --git a/Spigot-Server-Patches/Reduce-sync-loads.patch b/Spigot-Server-Patches/Reduce-sync-loads.patch index e2d7b7693f..32b9e0c758 100644 --- a/Spigot-Server-Patches/Reduce-sync-loads.patch +++ b/Spigot-Server-Patches/Reduce-sync-loads.patch @@ -344,4 +344,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end // Add env and gen to constructor, WorldData -> WorldDataServer - public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey resourcekey, ResourceKey resourcekey1, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { + public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey resourcekey, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { diff --git a/Spigot-Server-Patches/Remove-armour-stand-double-add-to-world.patch b/Spigot-Server-Patches/Remove-armour-stand-double-add-to-world.patch new file mode 100644 index 0000000000..c220d33fb5 --- /dev/null +++ b/Spigot-Server-Patches/Remove-armour-stand-double-add-to-world.patch @@ -0,0 +1,28 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Mariell Hoversholm +Date: Fri, 14 Aug 2020 23:59:26 +0200 +Subject: [PATCH] Remove armour stand double add to world + + +diff --git a/src/main/java/net/minecraft/server/ItemArmorStand.java b/src/main/java/net/minecraft/server/ItemArmorStand.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/ItemArmorStand.java ++++ b/src/main/java/net/minecraft/server/ItemArmorStand.java +@@ -0,0 +0,0 @@ public class ItemArmorStand extends Item { + return EnumInteractionResult.FAIL; + } + +- worldserver.addAllEntities(entityarmorstand); ++ // Paper - moved down + float f = (float) MathHelper.d((MathHelper.g(itemactioncontext.h() - 180.0F) + 22.5F) / 45.0F) * 45.0F; + + entityarmorstand.setPositionRotation(entityarmorstand.locX(), entityarmorstand.locY(), entityarmorstand.locZ(), f, 0.0F); +@@ -0,0 +0,0 @@ public class ItemArmorStand extends Item { + return EnumInteractionResult.FAIL; + } + // CraftBukkit end +- world.addEntity(entityarmorstand); ++ worldserver.addAllEntities(entityarmorstand); // Paper - moved down + world.playSound((EntityHuman) null, entityarmorstand.locX(), entityarmorstand.locY(), entityarmorstand.locZ(), SoundEffects.ENTITY_ARMOR_STAND_PLACE, SoundCategory.BLOCKS, 0.75F, 0.8F); + } + diff --git a/Spigot-Server-Patches/Remove-some-streams-from-structures.patch b/Spigot-Server-Patches/Remove-some-streams-from-structures.patch index 41b3ba71fe..ba9ef82a40 100644 --- a/Spigot-Server-Patches/Remove-some-streams-from-structures.patch +++ b/Spigot-Server-Patches/Remove-some-streams-from-structures.patch @@ -9,16 +9,16 @@ diff --git a/src/main/java/net/minecraft/server/BiomeBase.java b/src/main/java/n index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/BiomeBase.java +++ b/src/main/java/net/minecraft/server/BiomeBase.java -@@ -0,0 +0,0 @@ public class BiomeBase { - int j1 = l << 4; +@@ -0,0 +0,0 @@ public final class BiomeBase { + int l1 = j1 << 4; try { - structuremanager.a(SectionPosition.a(blockposition), structuregenerator).forEach((structurestart) -> { -- structurestart.a(generatoraccessseed, structuremanager, chunkgenerator, seededrandom, new StructureBoundingBox(i1, j1, i1 + 15, j1 + 15), new ChunkCoordIntPair(k, l)); +- structurestart.a(regionlimitedworldaccess, structuremanager, chunkgenerator, seededrandom, new StructureBoundingBox(k1, l1, k1 + 15, l1 + 15), new ChunkCoordIntPair(i1, j1)); - }); + // Paper start - remove structure streams + for (StructureStart structureStart : structuremanager.getFeatureStarts(SectionPosition.a(blockposition), structuregenerator)) { -+ structureStart.a(generatoraccessseed, structuremanager, chunkgenerator, seededrandom, new StructureBoundingBox(i1, j1, i1 + 15, j1 + 15), new ChunkCoordIntPair(k, l)); ++ structureStart.a(regionlimitedworldaccess, structuremanager, chunkgenerator, seededrandom, new StructureBoundingBox(k1, l1, k1 + 15, l1 + 15), new ChunkCoordIntPair(i1, j1)); + } + // Paper end } catch (Exception exception) { @@ -50,7 +50,13 @@ diff --git a/src/main/java/net/minecraft/server/StructureManager.java b/src/main index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/StructureManager.java +++ b/src/main/java/net/minecraft/server/StructureManager.java -@@ -0,0 +0,0 @@ import javax.annotation.Nullable; +@@ -0,0 +0,0 @@ + package net.minecraft.server; + + import com.mojang.datafixers.DataFixUtils; ++import it.unimi.dsi.fastutil.objects.ObjectArrayList; // Paper + import java.util.stream.Stream; + import javax.annotation.Nullable; public class StructureManager { @@ -65,7 +71,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start - remove structure streams + public java.util.List> getFeatureStarts(SectionPosition sectionPosition, StructureGenerator structureGenerator) { -+ java.util.List> list = new it.unimi.dsi.fastutil.objects.ObjectArrayList<>(); ++ java.util.List> list = new ObjectArrayList<>(); + for (Long curLong: getLevel().getChunkAt(sectionPosition.a(), sectionPosition.c(), ChunkStatus.STRUCTURE_REFERENCES).b(structureGenerator)) { + SectionPosition sectionPosition1 = SectionPosition.a(new ChunkCoordIntPair(curLong), 0); + StructureStart structurestart = a(sectionPosition1, structureGenerator, getLevel().getChunkAt(sectionPosition1.a(), sectionPosition1.c(), ChunkStatus.STRUCTURE_STARTS)); diff --git a/Spigot-Server-Patches/Remove-streams-from-classes-related-villager-gossip.patch b/Spigot-Server-Patches/Remove-streams-from-classes-related-villager-gossip.patch index 2cb459c17a..9c691f3d8a 100644 --- a/Spigot-Server-Patches/Remove-streams-from-classes-related-villager-gossip.patch +++ b/Spigot-Server-Patches/Remove-streams-from-classes-related-villager-gossip.patch @@ -8,13 +8,21 @@ diff --git a/src/main/java/net/minecraft/server/Reputation.java b/src/main/java/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/Reputation.java +++ b/src/main/java/net/minecraft/server/Reputation.java +@@ -0,0 +0,0 @@ import com.mojang.serialization.DynamicOps; + import it.unimi.dsi.fastutil.objects.Object2IntMap; + import it.unimi.dsi.fastutil.objects.Object2IntMap.Entry; + import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; ++import it.unimi.dsi.fastutil.objects.ObjectArrayList; // Paper + import it.unimi.dsi.fastutil.objects.ObjectIterator; + import java.util.Arrays; + import java.util.Collection; @@ -0,0 +0,0 @@ public class Reputation { }); } + // Paper start - Remove streams from reputation + private List decompress() { -+ List list = new it.unimi.dsi.fastutil.objects.ObjectArrayList<>(); ++ List list = new ObjectArrayList<>(); + for (Map.Entry entry : getReputations().entrySet()) { + for (Reputation.b cur : entry.getValue().decompress(entry.getKey())) { + if (cur.a() != 0) @@ -68,7 +76,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + public List decompress(UUID uuid) { -+ List list = new it.unimi.dsi.fastutil.objects.ObjectArrayList<>(); ++ List list = new ObjectArrayList<>(); + for (Object2IntMap.Entry entry : getEntries().object2IntEntrySet()) { + list.add(new Reputation.b(uuid, entry.getKey(), entry.getIntValue())); + } diff --git a/Spigot-Server-Patches/Remove-unused-World-Tile-Entity-List.patch b/Spigot-Server-Patches/Remove-unused-World-Tile-Entity-List.patch index 46629b18d4..591935f648 100644 --- a/Spigot-Server-Patches/Remove-unused-World-Tile-Entity-List.patch +++ b/Spigot-Server-Patches/Remove-unused-World-Tile-Entity-List.patch @@ -10,8 +10,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - public static final ResourceKey THE_NETHER = ResourceKey.a(IRegistry.ae, new MinecraftKey("the_nether")); - public static final ResourceKey THE_END = ResourceKey.a(IRegistry.ae, new MinecraftKey("the_end")); + public static final ResourceKey THE_NETHER = ResourceKey.a(IRegistry.L, new MinecraftKey("the_nether")); + public static final ResourceKey THE_END = ResourceKey.a(IRegistry.L, new MinecraftKey("the_end")); private static final EnumDirection[] a = EnumDirection.values(); - public final List tileEntityList = Lists.newArrayList(); + //public final List tileEntityList = Lists.newArrayList(); // Paper - remove unused list diff --git a/Spigot-Server-Patches/Reset-players-airTicks-on-respawn.patch b/Spigot-Server-Patches/Reset-players-airTicks-on-respawn.patch index d462a27237..6f0a2d3947 100644 --- a/Spigot-Server-Patches/Reset-players-airTicks-on-respawn.patch +++ b/Spigot-Server-Patches/Reset-players-airTicks-on-respawn.patch @@ -12,8 +12,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } -+ public final int getMaxAirTicks() { return bD(); } // Paper - OBFHELPER - public int bD() { ++ public final int getMaxAirTicks() { return bG(); } // Paper - OBFHELPER + public int bG() { return 300; } diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java diff --git a/Spigot-Server-Patches/Reset-spawner-timer-when-spawner-event-is-cancelled.patch b/Spigot-Server-Patches/Reset-spawner-timer-when-spawner-event-is-cancelled.patch index 97bbbf8cf1..40a3ba28e4 100644 --- a/Spigot-Server-Patches/Reset-spawner-timer-when-spawner-event-is-cancelled.patch +++ b/Spigot-Server-Patches/Reset-spawner-timer-when-spawner-event-is-cancelled.patch @@ -9,19 +9,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java @@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract { - } + // Spigot End + } entity.spawnedViaMobSpawner = true; // Paper - // Spigot Start -+ flag = true; // Paper - if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, blockposition).isCancelled()) { - Entity vehicle = entity.getVehicle(); - if (vehicle != null) { ++ flag = true; // Paper + // Spigot Start + if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, blockposition).isCancelled()) { + Entity vehicle = entity.getVehicle(); @@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract { - ((EntityInsentient) entity).doSpawnEffect(); - } + ((EntityInsentient) entity).doSpawnEffect(); + } -- flag = true; -+ /*flag = true;*/ // Paper - moved up above cancellable event +- flag = true; ++ /*flag = true;*/ // Paper - moved up above cancellable event + } } } - diff --git a/Spigot-Server-Patches/Restrict-vanilla-teleport-command-to-valid-locations.patch b/Spigot-Server-Patches/Restrict-vanilla-teleport-command-to-valid-locations.patch index 691c930c1b..ee550107db 100644 --- a/Spigot-Server-Patches/Restrict-vanilla-teleport-command-to-valid-locations.patch +++ b/Spigot-Server-Patches/Restrict-vanilla-teleport-command-to-valid-locations.patch @@ -20,5 +20,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Paper end - if (!World.k(blockposition)) { + if (!World.l(blockposition)) { throw CommandTeleport.a.create(); diff --git a/Spigot-Server-Patches/Send-attack-SoundEffects-only-to-players-who-can-see.patch b/Spigot-Server-Patches/Send-attack-SoundEffects-only-to-players-who-can-see.patch index 076a7a7187..0f9f232304 100644 --- a/Spigot-Server-Patches/Send-attack-SoundEffects-only-to-players-who-can-see.patch +++ b/Spigot-Server-Patches/Send-attack-SoundEffects-only-to-players-who-can-see.patch @@ -9,22 +9,6 @@ diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { - return vec3d; - } - -+ // Paper start - send SoundEffect to everyone who can see fromEntity -+ private static void sendSoundEffect(EntityHuman fromEntity, double x, double y, double z, SoundEffect soundEffect, SoundCategory soundCategory, float volume, float pitch) { -+ fromEntity.world.playSound(fromEntity, x, y, z, soundEffect, soundCategory, volume, pitch); // This will not send the effect to the entity himself -+ if (fromEntity instanceof EntityPlayer) { -+ ((EntityPlayer) fromEntity).playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect(soundEffect, soundCategory, x, y, z, volume, pitch)); -+ } -+ } -+ // Paper end -+ - public void attack(Entity entity) { - if (entity.bH()) { - if (!entity.t(this)) { @@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { int i = b0 + EnchantmentManager.b((EntityLiving) this); @@ -71,3 +55,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (flag4) { entity.extinguish(); } +@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { + public int getExpToLevel() { + return this.expLevel >= 30 ? 112 + (this.expLevel - 30) * 9 : (this.expLevel >= 15 ? 37 + (this.expLevel - 15) * 5 : 7 + this.expLevel * 2); + } ++ // Paper start - send SoundEffect to everyone who can see fromEntity ++ private static void sendSoundEffect(EntityHuman fromEntity, double x, double y, double z, SoundEffect soundEffect, SoundCategory soundCategory, float volume, float pitch) { ++ fromEntity.world.playSound(fromEntity, x, y, z, soundEffect, soundCategory, volume, pitch); // This will not send the effect to the entity himself ++ if (fromEntity instanceof EntityPlayer) { ++ ((EntityPlayer) fromEntity).playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect(soundEffect, soundCategory, x, y, z, volume, pitch)); ++ } ++ } ++ // Paper end + + public void applyExhaustion(float f) { + if (!this.abilities.isInvulnerable) { diff --git a/Spigot-Server-Patches/Set-Zombie-last-tick-at-start-of-drowning-process.patch b/Spigot-Server-Patches/Set-Zombie-last-tick-at-start-of-drowning-process.patch index 930dd28dc3..691ee3b044 100644 --- a/Spigot-Server-Patches/Set-Zombie-last-tick-at-start-of-drowning-process.patch +++ b/Spigot-Server-Patches/Set-Zombie-last-tick-at-start-of-drowning-process.patch @@ -10,10 +10,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/EntityZombie.java +++ b/src/main/java/net/minecraft/server/EntityZombie.java @@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster { - ++this.bA; - if (this.bA >= 600) { + ++this.bt; + if (this.bt >= 600) { this.startDrownedConversion(300); + this.lastTick = MinecraftServer.currentTick; // Paper - Make sure this is set at start of process - GH-1887 } } else { - this.bA = -1; + this.bt = -1; diff --git a/Spigot-Server-Patches/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch b/Spigot-Server-Patches/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch index f9a0414736..6ccd8feeed 100644 --- a/Spigot-Server-Patches/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch +++ b/Spigot-Server-Patches/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch @@ -49,7 +49,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -0,0 +0,0 @@ public class Main { - deadline.add(Calendar.DAY_OF_YEAR, -21); + deadline.add(Calendar.DAY_OF_YEAR, -7); if (buildDate.before(deadline.getTime())) { System.err.println("*** Error, this build is outdated ***"); - System.err.println("*** Please download a new build as per instructions from https://www.spigotmc.org/go/outdated-spigot ***"); diff --git a/Spigot-Server-Patches/SkeletonHorse-Additions.patch b/Spigot-Server-Patches/SkeletonHorse-Additions.patch index e24df8ae7e..a3b3309b9b 100644 --- a/Spigot-Server-Patches/SkeletonHorse-Additions.patch +++ b/Spigot-Server-Patches/SkeletonHorse-Additions.patch @@ -10,10 +10,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/EntityHorseSkeleton.java @@ -0,0 +0,0 @@ public class EntityHorseSkeleton extends EntityHorseAbstract { - private final PathfinderGoalHorseTrap bD = new PathfinderGoalHorseTrap(this); - private boolean bE; -- private int bF; -+ private int bF; public int getTrapTime() { return this.bF; } // Paper - OBFHELPER + private final PathfinderGoalHorseTrap bw = new PathfinderGoalHorseTrap(this); + private boolean bx; +- private int by; ++ private int by; public int getTrapTime() { return this.by; } // Paper - OBFHELPER public EntityHorseSkeleton(EntityTypes entitytypes, World world) { super(entitytypes, world); @@ -21,25 +21,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return 0.96F; } -+ public boolean isTrap() { return this.eN(); } // Paper - OBFHELPER - public boolean eN() { - return this.bE; ++ public boolean isTrap() { return this.eM(); } // Paper - OBFHELPER + public boolean eM() { + return this.bx; } + public void setTrap(boolean trap) { this.t(trap); } // Paper - OBFHELPER public void t(boolean flag) { - if (flag != this.bE) { - this.bE = flag; + if (flag != this.bx) { + this.bx = flag; diff --git a/src/main/java/net/minecraft/server/PathfinderGoalHorseTrap.java b/src/main/java/net/minecraft/server/PathfinderGoalHorseTrap.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/PathfinderGoalHorseTrap.java +++ b/src/main/java/net/minecraft/server/PathfinderGoalHorseTrap.java @@ -0,0 +0,0 @@ public class PathfinderGoalHorseTrap extends PathfinderGoal { - @Override public void e() { + WorldServer worldserver = (WorldServer) this.a.world; + if (!new com.destroystokyo.paper.event.entity.SkeletonHorseTrapEvent((org.bukkit.entity.SkeletonHorse) this.a.getBukkitEntity()).callEvent()) return; // Paper - DifficultyDamageScaler difficultydamagescaler = this.a.world.getDamageScaler(this.a.getChunkCoordinates()); + DifficultyDamageScaler difficultydamagescaler = worldserver.getDamageScaler(this.a.getChunkCoordinates()); this.a.t(false); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeletonHorse.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeletonHorse.java diff --git a/Spigot-Server-Patches/Slime-Pathfinder-Events.patch b/Spigot-Server-Patches/Slime-Pathfinder-Events.patch index 56902859c0..937ef1d4f9 100644 --- a/Spigot-Server-Patches/Slime-Pathfinder-Events.patch +++ b/Spigot-Server-Patches/Slime-Pathfinder-Events.patch @@ -8,8 +8,8 @@ diff --git a/src/main/java/net/minecraft/server/EntitySlime.java b/src/main/java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntitySlime.java +++ b/src/main/java/net/minecraft/server/EntitySlime.java -@@ -0,0 +0,0 @@ package net.minecraft.server; - import java.util.EnumSet; +@@ -0,0 +0,0 @@ import java.util.Objects; + import java.util.Optional; import java.util.Random; import javax.annotation.Nullable; +// Paper start @@ -24,25 +24,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import java.util.ArrayList; import java.util.List; @@ -0,0 +0,0 @@ public class EntitySlime extends EntityInsentient implements IMonster { - super.saveData(nbttagcompound); - nbttagcompound.setInt("Size", this.getSize() - 1); - nbttagcompound.setBoolean("wasOnGround", this.bw); -+ nbttagcompound.setBoolean("Paper.canWander", this.canWander); // Paper - } - @Override + public void saveData(NBTTagCompound nbttagcompound) { + super.saveData(nbttagcompound); ++ nbttagcompound.setBoolean("Paper.canWander", this.canWander); // Paper + nbttagcompound.setInt("Size", this.getSize() - 1); + nbttagcompound.setBoolean("wasOnGround", this.bp); + } @@ -0,0 +0,0 @@ public class EntitySlime extends EntityInsentient implements IMonster { + this.setSize(i + 1, false); super.loadData(nbttagcompound); - this.bw = nbttagcompound.getBoolean("wasOnGround"); + // Paper start - check exists before loading or this will be loaded as false + if (nbttagcompound.hasKey("Paper.canWander")) { + this.canWander = nbttagcompound.getBoolean("Paper.canWander"); + } + // Paper end + this.bp = nbttagcompound.getBoolean("wasOnGround"); } - public boolean eR() { @@ -0,0 +0,0 @@ public class EntitySlime extends EntityInsentient implements IMonster { @Override @@ -56,8 +56,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override public boolean a() { -- return (this.a.isInWater() || this.a.aN()) && this.a.getControllerMove() instanceof EntitySlime.ControllerMoveSlime; -+ return (this.a.isInWater() || this.a.aN()) && this.a.getControllerMove() instanceof EntitySlime.ControllerMoveSlime && this.a.canWander && new SlimeSwimEvent((Slime) this.a.getBukkitEntity()).callEvent(); // Paper +- return (this.a.isInWater() || this.a.aP()) && this.a.getControllerMove() instanceof EntitySlime.ControllerMoveSlime; ++ return (this.a.isInWater() || this.a.aP()) && this.a.getControllerMove() instanceof EntitySlime.ControllerMoveSlime && this.a.canWander && new SlimeSwimEvent((Slime) this.a.getBukkitEntity()).callEvent(); // Paper } @Override @@ -65,8 +65,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override public boolean a() { -- return this.a.getGoalTarget() == null && (this.a.onGround || this.a.isInWater() || this.a.aN() || this.a.hasEffect(MobEffects.LEVITATION)) && this.a.getControllerMove() instanceof EntitySlime.ControllerMoveSlime; -+ return this.a.canWander && this.a.getGoalTarget() == null && (this.a.onGround || this.a.isInWater() || this.a.aN() || this.a.hasEffect(MobEffects.LEVITATION)) && this.a.getControllerMove() instanceof EntitySlime.ControllerMoveSlime; +- return this.a.getGoalTarget() == null && (this.a.onGround || this.a.isInWater() || this.a.aP() || this.a.hasEffect(MobEffects.LEVITATION)) && this.a.getControllerMove() instanceof EntitySlime.ControllerMoveSlime; ++ return this.a.getGoalTarget() == null && (this.a.onGround || this.a.isInWater() || this.a.aP() || this.a.hasEffect(MobEffects.LEVITATION)) && this.a.getControllerMove() instanceof EntitySlime.ControllerMoveSlime && this.a.canWander; // Paper - add canWander } @Override @@ -118,7 +118,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override @@ -0,0 +0,0 @@ public class EntitySlime extends EntityInsentient implements IMonster { this.a.a((Entity) this.a.getGoalTarget(), 10.0F, 10.0F); - ((EntitySlime.ControllerMoveSlime) this.a.getControllerMove()).a(this.a.yaw, this.a.eM()); + ((EntitySlime.ControllerMoveSlime) this.a.getControllerMove()).a(this.a.yaw, this.a.eL()); } + + // Paper start - clear timer and target when goal resets diff --git a/Spigot-Server-Patches/Thread-Safe-Vanilla-Command-permission-checking.patch b/Spigot-Server-Patches/Thread-Safe-Vanilla-Command-permission-checking.patch index dd93281cfc..354d62cffa 100644 --- a/Spigot-Server-Patches/Thread-Safe-Vanilla-Command-permission-checking.patch +++ b/Spigot-Server-Patches/Thread-Safe-Vanilla-Command-permission-checking.patch @@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/com/mojang/brigadier/tree/CommandNode.java +++ b/src/main/java/com/mojang/brigadier/tree/CommandNode.java @@ -0,0 +0,0 @@ public abstract class CommandNode implements Comparable> { - // CraftBukkit start + public synchronized boolean canUse(final S source) { if (source instanceof CommandListenerWrapper) { try { - ((CommandListenerWrapper) source).currentCommand = this; @@ -33,7 +33,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private final ResultConsumer l; private final ArgumentAnchor.Anchor m; private final Vec2F n; -- public CommandNode currentCommand; // CraftBukkit +- public volatile CommandNode currentCommand; // CraftBukkit + public ThreadLocal currentCommand = new ThreadLocal<>(); // CraftBukkit // Paper public CommandListenerWrapper(ICommandListener icommandlistener, Vec3D vec3d, Vec2F vec2f, WorldServer worldserver, int i, String s, IChatBaseComponent ichatbasecomponent, MinecraftServer minecraftserver, @Nullable Entity entity) { @@ -42,6 +42,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override public boolean hasPermission(int i) { // CraftBukkit start +- CommandNode currentCommand = this.currentCommand; + // Paper start - fix concurrency issue + CommandNode currentCommand = this.currentCommand.get(); if (currentCommand != null) { diff --git a/Spigot-Server-Patches/Timings-v2.patch b/Spigot-Server-Patches/Timings-v2.patch index 47705a5182..d15c40fd91 100644 --- a/Spigot-Server-Patches/Timings-v2.patch +++ b/Spigot-Server-Patches/Timings-v2.patch @@ -720,7 +720,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/Block.java +++ b/src/main/java/net/minecraft/server/Block.java @@ -0,0 +0,0 @@ public class Block extends BlockBase implements IMaterial { - private static final VoxelShape c = a(7.0D, 0.0D, 7.0D, 9.0D, 10.0D, 9.0D); + }); protected final BlockStateList blockStateList; private IBlockData blockData; + // Paper start @@ -801,7 +801,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.world.getMethodProfiler().enter("naturalSpawnCount"); + this.world.timings.countNaturalMobs.startTiming(); // Paper - timings int l = this.chunkMapDistance.b(); - SpawnerCreature.d spawnercreature_d = SpawnerCreature.a(l, this.world.z(), this::a); + SpawnerCreature.d spawnercreature_d = SpawnerCreature.a(l, this.world.A(), this::a); + this.world.timings.countNaturalMobs.stopTiming(); // Paper - timings this.p = spawnercreature_d; @@ -1006,7 +1006,7 @@ diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -0,0 +0,0 @@ import org.bukkit.command.CommandSender; +@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.event.CraftPortalEvent; import org.bukkit.entity.Hanging; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Vehicle; @@ -1040,7 +1040,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - org.bukkit.craftbukkit.SpigotTimings.entityMoveTimer.stopTiming(); // Spigot } - protected BlockPosition ak() { + protected BlockPosition ao() { diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java @@ -1060,8 +1060,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void tick() { - SpigotTimings.timerEntityBaseTick.startTiming(); // Spigot super.tick(); - this.u(); - this.x(); + this.t(); + this.v(); @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { } } @@ -1080,7 +1080,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - SpigotTimings.timerEntityTickRest.stopTiming(); // Spigot } - private void q() { + private void p() { @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { this.setMot(d4, d5, d6); @@ -1088,7 +1088,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - SpigotTimings.timerEntityAI.startTiming(); // Spigot if (this.isFrozen()) { this.jumping = false; - this.aY = 0.0F; + this.aR = 0.0F; @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { this.doTick(); this.world.getMethodProfiler().exit(); @@ -1098,15 +1098,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.world.getMethodProfiler().exit(); this.world.getMethodProfiler().enter("jump"); @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { - this.t(); + this.r(); AxisAlignedBB axisalignedbb = this.getBoundingBox(); - SpigotTimings.timerEntityAIMove.startTiming(); // Spigot - this.f(new Vec3D((double) this.aY, (double) this.aZ, (double) this.ba)); ++ // SpigotTimings.timerEntityAIMove.startTiming(); // Spigot // Paper + this.g(new Vec3D((double) this.aR, (double) this.aS, (double) this.aT)); - SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot ++ // SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot // Paper this.world.getMethodProfiler().exit(); this.world.getMethodProfiler().enter("push"); - if (this.bm > 0) { + if (this.bf > 0) { @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { this.a(axisalignedbb, this.getBoundingBox()); } @@ -1115,7 +1117,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.collideNearby(); - SpigotTimings.timerEntityAICollision.stopTiming(); // Spigot this.world.getMethodProfiler().exit(); - if (!this.world.isClientSide && this.dN() && this.aC()) { + if (!this.world.isClientSide && this.dN() && this.aF()) { this.damageEntity(DamageSource.DROWN, 1.0F); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 @@ -1136,9 +1138,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private long nextTick; - private long W; - private boolean X; -+ private long W;final long getTickOversleepMaxTime() { return this.W; } // Paper - OBFHELPER ++ private long W; final long getTickOversleepMaxTime() { return this.W; } // Paper - OBFHELPER + private boolean X; final boolean hasExecutedTask() { return this.X; } // Paper - OBFHELPER - private final ResourcePackRepository resourcePackRepository; + private final ResourcePackRepository resourcePackRepository; private final ScoreboardServer scoreboardServer; @Nullable @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant 200) { ++ this.g.setDigging(new com.destroystokyo.paper.event.entity.TurtleStartDiggingEvent((org.bukkit.entity.Turtle) this.g.getBukkitEntity(), MCUtil.toLocation(this.g.world, this.getTargetPosition())).callEvent()); // Paper + } else if (this.g.bv > 200) { World world = this.g.world; // CraftBukkit start @@ -87,6 +86,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } @Override +diff --git a/src/main/java/net/minecraft/server/PathfinderGoalGotoTarget.java b/src/main/java/net/minecraft/server/PathfinderGoalGotoTarget.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/PathfinderGoalGotoTarget.java ++++ b/src/main/java/net/minecraft/server/PathfinderGoalGotoTarget.java +@@ -0,0 +0,0 @@ public abstract class PathfinderGoalGotoTarget extends PathfinderGoal { + protected int c; + protected int d; + private int g; +- protected BlockPosition e; ++ protected BlockPosition e;public final BlockPosition getTargetPosition() { return this.e; } // Paper - OBFHELPER + private boolean h; + private final int i; + private final int j; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTurtle.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTurtle.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTurtle.java diff --git a/Spigot-Server-Patches/Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch b/Spigot-Server-Patches/Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch index a7b9a6486f..2bf0ba7f75 100644 --- a/Spigot-Server-Patches/Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch +++ b/Spigot-Server-Patches/Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch @@ -15,7 +15,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private static final DataWatcherObject POWERED = DataWatcher.a(EntityCreeper.class, DataWatcherRegistry.i); - private static final DataWatcherObject d = DataWatcher.a(EntityCreeper.class, DataWatcherRegistry.i); + private static final DataWatcherObject d = DataWatcher.a(EntityCreeper.class, DataWatcherRegistry.i); private static final DataWatcherObject isIgnitedDW = d; // Paper OBFHELPER - private int bv; + private int bo; private int fuseTicks; public int maxFuseTicks = 30; @@ -0,0 +0,0 @@ public class EntityCreeper extends EntityMonster { diff --git a/Spigot-Server-Patches/Use-a-Shared-Random-for-Entities.patch b/Spigot-Server-Patches/Use-a-Shared-Random-for-Entities.patch index 4e5e51641e..7b858352dd 100644 --- a/Spigot-Server-Patches/Use-a-Shared-Random-for-Entities.patch +++ b/Spigot-Server-Patches/Use-a-Shared-Random-for-Entities.patch @@ -33,8 +33,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public CraftEntity getBukkitEntity() { @@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke this.x = Vec3D.a; - this.at = 1.0F; - this.au = 1.0F; + this.am = 1.0F; + this.an = 1.0F; - this.random = new Random(); + this.random = SHARED_RANDOM; // Paper this.fireTicks = -this.getMaxFireTicks(); diff --git a/Spigot-Server-Patches/Use-distance-map-to-optimise-entity-tracker.patch b/Spigot-Server-Patches/Use-distance-map-to-optimise-entity-tracker.patch index 2a7b598adc..c5417374bb 100644 --- a/Spigot-Server-Patches/Use-distance-map-to-optimise-entity-tracker.patch +++ b/Spigot-Server-Patches/Use-distance-map-to-optimise-entity-tracker.patch @@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/Entity.java @@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke } - // Paper end + // CraftBukkit end + // Paper start - optimise entity tracking + final org.spigotmc.TrackingRange.TrackingRangeType trackingRangeType = org.spigotmc.TrackingRange.getTrackingRangeType(this); diff --git a/Spigot-Server-Patches/Use-getChunkIfLoadedImmediately-in-places.patch b/Spigot-Server-Patches/Use-getChunkIfLoadedImmediately-in-places.patch index 37c99acefa..a65f228a9b 100644 --- a/Spigot-Server-Patches/Use-getChunkIfLoadedImmediately-in-places.patch +++ b/Spigot-Server-Patches/Use-getChunkIfLoadedImmediately-in-places.patch @@ -35,9 +35,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Paper end + - protected World(WorldDataMutable worlddatamutable, ResourceKey resourcekey, ResourceKey resourcekey1, DimensionManager dimensionmanager, Supplier supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env, java.util.concurrent.Executor executor) { - this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((WorldDataServer) worlddatamutable).getName()); // Spigot - this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig((((WorldDataServer)worlddatamutable).getName()), this.spigotConfig); // Paper + public ResourceKey getTypeKey() { + return typeKey; + } @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { } diff --git a/Spigot-Server-Patches/Vanished-players-don-t-have-rights.patch b/Spigot-Server-Patches/Vanished-players-don-t-have-rights.patch index 650c07a580..720cfbb5cf 100644 --- a/Spigot-Server-Patches/Vanished-players-don-t-have-rights.patch +++ b/Spigot-Server-Patches/Vanished-players-don-t-have-rights.patch @@ -29,18 +29,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public final List passengers; protected int j; @Nullable -diff --git a/src/main/java/net/minecraft/server/EntityFireworks.java b/src/main/java/net/minecraft/server/EntityFireworks.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityFireworks.java -+++ b/src/main/java/net/minecraft/server/EntityFireworks.java -@@ -0,0 +0,0 @@ public class EntityFireworks extends IProjectile { - this.move(EnumMoveType.SELF, vec3d); - this.setMot(vec3d); - } -- - MovingObjectPosition movingobjectposition = ProjectileHelper.a(this, this::a, RayTrace.BlockCollisionOption.COLLIDER); - - if (!this.noclip) { diff --git a/src/main/java/net/minecraft/server/IProjectile.java b/src/main/java/net/minecraft/server/IProjectile.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/IProjectile.java @@ -106,7 +94,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public static final boolean applyOperation(VoxelShape voxelshape, VoxelShape voxelshape1, OperatorBoolean operatorboolean) { return VoxelShapes.c(voxelshape, voxelshape1, operatorboolean); } // Paper - OBFHELPER public static boolean c(VoxelShape voxelshape, VoxelShape voxelshape1, OperatorBoolean operatorboolean) { if (operatorboolean.apply(false, false)) { - throw (IllegalArgumentException) SystemUtils.c(new IllegalArgumentException()); + throw (IllegalArgumentException) SystemUtils.c((Throwable) (new IllegalArgumentException())); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/World.java diff --git a/Spigot-Server-Patches/Vex-getSummoner-API.patch b/Spigot-Server-Patches/Vex-getSummoner-API.patch index aafee41f81..044288fc97 100644 --- a/Spigot-Server-Patches/Vex-getSummoner-API.patch +++ b/Spigot-Server-Patches/Vex-getSummoner-API.patch @@ -13,8 +13,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } -+ public EntityInsentient getOwner() { return eL(); } // Paper - OBFHELPER - public EntityInsentient eL() { ++ public EntityInsentient getOwner() { return eK(); } // Paper - OBFHELPER + public EntityInsentient eK() { return this.c; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java diff --git a/Spigot-Server-Patches/Villager-Restocks-API.patch b/Spigot-Server-Patches/Villager-Restocks-API.patch index 0cbe114363..cd61da6c01 100644 --- a/Spigot-Server-Patches/Villager-Restocks-API.patch +++ b/Spigot-Server-Patches/Villager-Restocks-API.patch @@ -9,14 +9,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/EntityVillager.java +++ b/src/main/java/net/minecraft/server/EntityVillager.java @@ -0,0 +0,0 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation - private long bH; - private int bI; - private long bJ; -- private int bK; -+ private int bK; public int getRestocksToday(){ return this.bK; } public void setRestocksToday(int restocksToday){ this.bK = restocksToday; } // Paper OBFHELPER - private long bL; - private boolean bM; - private static final ImmutableList> bN = ImmutableList.of(MemoryModuleType.HOME, MemoryModuleType.JOB_SITE, MemoryModuleType.POTENTIAL_JOB_SITE, MemoryModuleType.MEETING_POINT, MemoryModuleType.MOBS, MemoryModuleType.VISIBLE_MOBS, MemoryModuleType.VISIBLE_VILLAGER_BABIES, MemoryModuleType.NEAREST_PLAYERS, MemoryModuleType.NEAREST_VISIBLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_TARGETABLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_WANTED_ITEM, MemoryModuleType.WALK_TARGET, new MemoryModuleType[]{MemoryModuleType.LOOK_TARGET, MemoryModuleType.INTERACTION_TARGET, MemoryModuleType.BREED_TARGET, MemoryModuleType.PATH, MemoryModuleType.INTERACTABLE_DOORS, MemoryModuleType.OPENED_DOORS, MemoryModuleType.NEAREST_BED, MemoryModuleType.HURT_BY, MemoryModuleType.HURT_BY_ENTITY, MemoryModuleType.NEAREST_HOSTILE, MemoryModuleType.SECONDARY_JOB_SITE, MemoryModuleType.HIDING_PLACE, MemoryModuleType.HEARD_BELL_TIME, MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE, MemoryModuleType.LAST_SLEPT, MemoryModuleType.LAST_WOKEN, MemoryModuleType.LAST_WORKED_AT_POI, MemoryModuleType.GOLEM_LAST_SEEN_TIME}); + private long bA; + private int bB; + private long bC; +- private int bD; ++ private int bD; public int getRestocksToday(){ return this.bD; } public void setRestocksToday(int restocksToday){ this.bD = restocksToday; } // Paper OBFHELPER + private long bE; + private boolean bF; + private static final ImmutableList> bG = ImmutableList.of(MemoryModuleType.HOME, MemoryModuleType.JOB_SITE, MemoryModuleType.POTENTIAL_JOB_SITE, MemoryModuleType.MEETING_POINT, MemoryModuleType.MOBS, MemoryModuleType.VISIBLE_MOBS, MemoryModuleType.VISIBLE_VILLAGER_BABIES, MemoryModuleType.NEAREST_PLAYERS, MemoryModuleType.NEAREST_VISIBLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_TARGETABLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_WANTED_ITEM, MemoryModuleType.WALK_TARGET, new MemoryModuleType[]{MemoryModuleType.LOOK_TARGET, MemoryModuleType.INTERACTION_TARGET, MemoryModuleType.BREED_TARGET, MemoryModuleType.PATH, MemoryModuleType.DOORS_TO_CLOSE, MemoryModuleType.NEAREST_BED, MemoryModuleType.HURT_BY, MemoryModuleType.HURT_BY_ENTITY, MemoryModuleType.NEAREST_HOSTILE, MemoryModuleType.SECONDARY_JOB_SITE, MemoryModuleType.HIDING_PLACE, MemoryModuleType.HEARD_BELL_TIME, MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE, MemoryModuleType.LAST_SLEPT, MemoryModuleType.LAST_WOKEN, MemoryModuleType.LAST_WORKED_AT_POI, MemoryModuleType.GOLEM_DETECTED_RECENTLY}); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java diff --git a/Spigot-Server-Patches/WitchReadyPotionEvent.patch b/Spigot-Server-Patches/WitchReadyPotionEvent.patch index 00410edec8..3500939c1b 100644 --- a/Spigot-Server-Patches/WitchReadyPotionEvent.patch +++ b/Spigot-Server-Patches/WitchReadyPotionEvent.patch @@ -18,6 +18,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + org.bukkit.inventory.ItemStack bukkitStack = com.destroystokyo.paper.event.entity.WitchReadyPotionEvent.process((org.bukkit.entity.Witch) this.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(potion)); + this.setSlot(EnumItemSlot.MAINHAND, org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(bukkitStack)); + // Paper end - this.bx = this.getItemInMainHand().k(); + this.bq = this.getItemInMainHand().k(); this.v(true); if (!this.isSilent()) { diff --git a/Spigot-Server-Patches/Workaround-for-Client-Lag-Spikes-MC-162253.patch b/Spigot-Server-Patches/Workaround-for-Client-Lag-Spikes-MC-162253.patch index 5843536c77..f1d6011e4a 100644 --- a/Spigot-Server-Patches/Workaround-for-Client-Lag-Spikes-MC-162253.patch +++ b/Spigot-Server-Patches/Workaround-for-Client-Lag-Spikes-MC-162253.patch @@ -93,7 +93,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + apacket = new Packet[10]; + } + // Paper end - apacket[0] = new PacketPlayOutMapChunk(chunk, 65535, true); + apacket[0] = new PacketPlayOutMapChunk(chunk, 65535); apacket[1] = new PacketPlayOutLightUpdate(chunk.getPos(), this.lightEngine, true); + + // Paper start - Fix MC-162253 diff --git a/Spigot-Server-Patches/Workaround-for-vehicle-tracking-issue-on-disconnect.patch b/Spigot-Server-Patches/Workaround-for-vehicle-tracking-issue-on-disconnect.patch index ce224f2784..eedf2d6596 100644 --- a/Spigot-Server-Patches/Workaround-for-vehicle-tracking-issue-on-disconnect.patch +++ b/Spigot-Server-Patches/Workaround-for-vehicle-tracking-issue-on-disconnect.patch @@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public void p() { - this.co = true; + this.ch = true; this.ejectPassengers(); + + // Paper start - Workaround an issue where the vehicle doesn't track the passenger disconnection dismount. diff --git a/Spigot-Server-Patches/force-entity-dismount-during-teleportation.patch b/Spigot-Server-Patches/force-entity-dismount-during-teleportation.patch index ce228b2c42..c117d5ba42 100644 --- a/Spigot-Server-Patches/force-entity-dismount-during-teleportation.patch +++ b/Spigot-Server-Patches/force-entity-dismount-during-teleportation.patch @@ -27,9 +27,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } -- public void bb() { +- public void be() { + // Paper start -+ public void bb() { stopRiding(false); } ++ public void be() { stopRiding(false); } + public void stopRiding(boolean suppressCancellation) { + // Paper end if (this.vehicle != null) { @@ -80,10 +80,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } - @Override -- public void bb() { -- super.bb(); +- public void be() { +- super.be(); + // Paper start -+ @Override public void bb() { stopRiding(false); } ++ @Override public void be() { stopRiding(false); } + @Override public void stopRiding(boolean suppressCancellation) { + // Paper end + super.stopRiding(suppressCancellation); // Paper - suppress @@ -95,7 +95,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { - return ((Byte) this.datawatcher.get(EntityLiving.an) & 4) != 0; + return ((Byte) this.datawatcher.get(EntityLiving.ag) & 4) != 0; } - @Override diff --git a/Spigot-Server-Patches/implement-optional-per-player-mob-spawns.patch b/Spigot-Server-Patches/implement-optional-per-player-mob-spawns.patch index 1f06174400..08dffb10d2 100644 --- a/Spigot-Server-Patches/implement-optional-per-player-mob-spawns.patch +++ b/Spigot-Server-Patches/implement-optional-per-player-mob-spawns.patch @@ -552,7 +552,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.world.getMethodProfiler().enter("naturalSpawnCount"); this.world.timings.countNaturalMobs.startTiming(); // Paper - timings int l = this.chunkMapDistance.b(); -- SpawnerCreature.d spawnercreature_d = SpawnerCreature.a(l, this.world.z(), this::a); +- SpawnerCreature.d spawnercreature_d = SpawnerCreature.a(l, this.world.A(), this::a); + // Paper start - per player mob spawning + SpawnerCreature.d spawnercreature_d; // moved down + if (this.playerChunkMap.playerMobDistanceMap != null) { @@ -564,9 +564,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + for (EntityPlayer player : this.world.players) { + Arrays.fill(player.mobCounts, 0); + } -+ spawnercreature_d = SpawnerCreature.countMobs(l, this.world.z(), this::a, true); ++ spawnercreature_d = SpawnerCreature.countMobs(l, this.world.A(), this::a, true); + } else { -+ spawnercreature_d = SpawnerCreature.countMobs(l, this.world.z(), this::a, false); ++ spawnercreature_d = SpawnerCreature.countMobs(l, this.world.A(), this::a, false); + } + // Paper end this.world.timings.countNaturalMobs.stopTiming(); // Paper - timings @@ -600,21 +600,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } -+ public final SectionPosition getPlayerMapSection() { return this.N(); } // Paper - OBFHELPER - public SectionPosition N() { - return this.cq; ++ public final SectionPosition getPlayerMapSection() { return this.O(); } // Paper - OBFHELPER + public SectionPosition O() { + return this.cj; } diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityTypes.java +++ b/src/main/java/net/minecraft/server/EntityTypes.java @@ -0,0 +0,0 @@ public class EntityTypes { - return this.bk; + return this.bl; } + public final EnumCreatureType getEnumCreatureType() { return this.e(); } // Paper - OBFHELPER public EnumCreatureType e() { - return this.bf; + return this.bg; } diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 @@ -758,13 +758,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 while (k < 3) { @@ -0,0 +0,0 @@ public final class SpawnerCreature { // Paper start - Boolean doSpawning = a(worldserver, enumcreaturetype, structuremanager, chunkgenerator, biomebase_biomemeta, blockposition_mutableblockposition, d2); + Boolean doSpawning = a(worldserver, enumcreaturetype, structuremanager, chunkgenerator, biomesettingsmobs_c, blockposition_mutableblockposition, d2); if (doSpawning == null) { - return; + return j; // Paper } - if (doSpawning.booleanValue() && spawnercreature_c.test(biomebase_biomemeta.c, blockposition_mutableblockposition, ichunkaccess)) { // Paper end - EntityInsentient entityinsentient = a(worldserver, biomebase_biomemeta.c); + if (doSpawning && spawnercreature_c.test(biomesettingsmobs_c.c, blockposition_mutableblockposition, ichunkaccess)) { + // Paper end +@@ -0,0 +0,0 @@ public final class SpawnerCreature { + if (entityinsentient == null) { - return; @@ -775,7 +777,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public final class SpawnerCreature { groupdataentity = entityinsentient.prepare(worldserver, worldserver.getDamageScaler(entityinsentient.getChunkCoordinates()), EnumMobSpawn.NATURAL, groupdataentity, (NBTTagCompound) null); // CraftBukkit start - if (worldserver.addEntity(entityinsentient, SpawnReason.NATURAL)) { + if (worldserver.addAllEntities(entityinsentient, SpawnReason.NATURAL)) { - ++j; + ++j; // Paper - force diff on name change - we expect this to be the total amount spawned ++k1; diff --git a/Spigot-Server-Patches/incremental-chunk-saving.patch b/Spigot-Server-Patches/incremental-chunk-saving.patch index 4cda1db64c..25dfd04fce 100644 --- a/Spigot-Server-Patches/incremental-chunk-saving.patch +++ b/Spigot-Server-Patches/incremental-chunk-saving.patch @@ -174,12 +174,20 @@ diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/j index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java +@@ -0,0 +0,0 @@ import java.util.function.Supplier; + import java.util.stream.Collectors; + import java.util.stream.Stream; + import javax.annotation.Nullable; ++import it.unimi.dsi.fastutil.objects.ObjectRBTreeSet; // Paper + import org.apache.commons.lang3.mutable.MutableBoolean; + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } + // Paper start - incremental autosave -+ final it.unimi.dsi.fastutil.objects.ObjectRBTreeSet autoSaveQueue = new it.unimi.dsi.fastutil.objects.ObjectRBTreeSet<>((playerchunk1, playerchunk2) -> { ++ final ObjectRBTreeSet autoSaveQueue = new ObjectRBTreeSet<>((playerchunk1, playerchunk2) -> { + int timeCompare = Long.compare(playerchunk1.lastAutoSaveTime, playerchunk2.lastAutoSaveTime); + if (timeCompare != 0) { + return timeCompare; @@ -309,7 +317,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // CraftBukkit end } -+ private void saveData() { this.ag(); } // Paper - OBFHELPER - private void ag() { ++ private void saveData() { this.ai(); } // Paper - OBFHELPER + private void ai() { if (this.dragonBattle != null) { this.worldDataServer.a(this.dragonBattle.a()); // CraftBukkit diff --git a/Spigot-Server-Patches/only-add-passanger-entities-once-from-spawners.patch b/Spigot-Server-Patches/only-add-passanger-entities-once-from-spawners.patch deleted file mode 100644 index 58f2ea03de..0000000000 --- a/Spigot-Server-Patches/only-add-passanger-entities-once-from-spawners.patch +++ /dev/null @@ -1,19 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: kickash32 -Date: Wed, 21 Aug 2019 23:57:32 +0500 -Subject: [PATCH] only add passanger entities once from spawners - - -diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -@@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract { - } - - private void a(Entity entity) { -- if (this.a().addEntity(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER)) { // CraftBukkit -+ if (entity.valid || this.a().addEntity(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER)) { // CraftBukkit // Paper - Iterator iterator = entity.getPassengers().iterator(); - - while (iterator.hasNext()) { diff --git a/Spigot-Server-Patches/remove-null-possibility-for-getServer-singleton.patch b/Spigot-Server-Patches/remove-null-possibility-for-getServer-singleton.patch index 5193bfb69e..4e250a7f36 100644 --- a/Spigot-Server-Patches/remove-null-possibility-for-getServer-singleton.patch +++ b/Spigot-Server-Patches/remove-null-possibility-for-getServer-singleton.patch @@ -19,10 +19,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public static final WorldSettings c = new WorldSettings("Demo World", EnumGamemode.SURVIVAL, false, EnumDifficulty.NORMAL, false, new GameRules(), DataPackConfiguration.a); @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant resourcepackrepository, Proxy proxy, DataFixer datafixer, DataPackResources datapackresources, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) { + public MinecraftServer(OptionSet options, DataPackConfiguration datapackconfiguration, Thread thread, IRegistryCustom.Dimension iregistrycustom_dimension, Convertable.ConversionSession convertable_conversionsession, SaveData savedata, ResourcePackRepository resourcepackrepository, Proxy proxy, DataFixer datafixer, DataPackResources datapackresources, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) { super("Server"); + SERVER = this; // Paper - better singleton - this.m = new GameProfilerSwitcher(SystemUtils.a, this::ag); + this.m = new GameProfilerSwitcher(SystemUtils.a, this::ah); this.methodProfiler = GameProfilerDisabled.a; this.serverPing = new ServerPing(); @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant" exit 1; fi -repo=$(git remote get-url origin | sed -E 's/github.com(:|\/)//g') +repo=$(git remote get-url origin | sed -E 's/(.*@)?github.com(:|\/)//g' | sed 's/.git$//g') data=$(curl -q https://api.github.com/repos/$repo/pulls/$1 2>/dev/null) url=$(echo -e "$data" | grep --color=none ssh_url | head -n 1 |awk '{print $2}' | sed 's/"//g' | sed 's/,//g') ref=$(echo -e "$data" | grep --color=none '"head":' -A 3 | grep ref | head -n 1 |awk '{print $2}' | sed 's/"//g' | sed 's/,//g') @@ -16,23 +16,39 @@ git branch -D $branch 2>/dev/null 1>&2 git checkout -b $branch $up/$ref 2>/dev/null|| true echo "Merging $prevbranch into $branch" git fetch origin -git merge origin/$prevbranch - +read -p "Press 'm' to merge, 'r' to rebase, or 'n' for nothing" -n 1 -r >&2 +echo +if [[ "$REPLY" =~ ^[Mm]$ ]]; then + git merge origin/$prevbranch +elif [[ "$REPLY" =~ ^[Rr]$ ]]; then + git rebase master +fi echo "Dropping to new shell, exit to delete the refs" -bash -i +"${SHELL:-bash}" -i read -p "Press 'p' to push. " -n 1 -r >&2 echo -if [[ "d$REPLY" =~ ^d[Pp]$ ]]; then +pushed=0 +if [[ "$REPLY" =~ ^[Pp]$ ]]; then git push $up $branch:$ref -f - + pushed=1 echo "Pushed" >&2 fi echo "Deleting branch/upstream" git checkout $prevbranch +if [[ "$pushed" == "1" ]]; then + read -p "Press 'm' to merge or 'r' to rebase merge " -n 1 -r >&2 + if [[ "$REPLY" =~ ^[Mm]$ ]]; then + git merge $branch + fi + if [[ "$REPLY" =~ ^[Rr]$ ]]; then + git merge --ff-only $branch + fi +fi + git branch -D $branch git remote remove $up git gc #git branch -u $up/$ref $branch -#git checkout $branch \ No newline at end of file +#git checkout $branch diff --git a/scripts/importmcdev.sh b/scripts/importmcdev.sh index 269f68bcd4..ddeef85baa 100755 --- a/scripts/importmcdev.sh +++ b/scripts/importmcdev.sh @@ -106,6 +106,7 @@ done # dont forget \ at end of each line but last importLibrary com.mojang authlib com/mojang/authlib yggdrasil/YggdrasilGameProfileRepository.java importLibrary com.mojang datafixerupper com/mojang/datafixers/util Either.java +importLibrary com.mojang datafixerupper com/mojang/serialization/codecs KeyDispatchCodec.java ######################################################## ######################################################## diff --git a/scripts/requireDeps.sh b/scripts/requireDeps.sh new file mode 100755 index 0000000000..911460e872 --- /dev/null +++ b/scripts/requireDeps.sh @@ -0,0 +1,28 @@ +#!/bin/sh +set -ue + +# Check if an application is on the PATH. +# If it is not, return with non-zero. +_is_dep_available() { + command -v "$1" >/dev/null || (echo "$1 ${2:-was not found and is a required dependency}"; return 1) +} + +if [ -z "${1:-}" ]; then + # No specific dependency was found; let's just check for all required ones. + _is_dep_available git + _is_dep_available patch + _is_dep_available mvn + + # Ensure we don't have a JAVA_HOME set first. + # Maven should work fine without the JAVA_HOME var as long as the JDK is on the PATH. + if [ -z "${JAVA_HOME:-}" ]; then + _is_dep_available javac "was not found; you can download the JDK from https://adoptopenjdk.net/ or via your package manager" + fi +else + # Require all dependencies provided. + for dep in $@; do + _is_dep_available "$dep" + done +fi + +# vim: set ff=unix autoindent ts=4 sw=4 tw=0 et : diff --git a/work/BuildData b/work/BuildData index be3371e674..2589242cca 160000 --- a/work/BuildData +++ b/work/BuildData @@ -1 +1 @@ -Subproject commit be3371e67489b5a2293306e24420793106baadc1 +Subproject commit 2589242ccafbffaeb0a36d16e9f59f97ab3411b7 diff --git a/work/Bukkit b/work/Bukkit index eeb1042f1a..29e9b367a4 160000 --- a/work/Bukkit +++ b/work/Bukkit @@ -1 +1 @@ -Subproject commit eeb1042f1ac356cc989dd1c4e35b37ee0ab93891 +Subproject commit 29e9b367a4abdf77098b02318c22f24b92a218d2 diff --git a/work/CraftBukkit b/work/CraftBukkit index f6227934a3..bad55dbb5a 160000 --- a/work/CraftBukkit +++ b/work/CraftBukkit @@ -1 +1 @@ -Subproject commit f6227934a3462237f45b494b5d8a71795e998d0d +Subproject commit bad55dbb5a5268934f3fcfc467bcd44c40426633 diff --git a/work/Spigot b/work/Spigot index 9639cf7897..d65430a1cd 160000 --- a/work/Spigot +++ b/work/Spigot @@ -1 +1 @@ -Subproject commit 9639cf78974513349ec5d78f22d27365bebd0d0a +Subproject commit d65430a1cd93c9158dad04e0a7c21cb4a4d4ba76