From 99fec767022d900d3d9a97f13154aa974edf9292 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Mon, 29 Feb 2016 17:09:49 -0600 Subject: [PATCH] Paper 1.9 --- .gitignore | 4 +- .travis.yml | 2 +- Bukkit | 2 +- CraftBukkit | 2 +- README.md | 6 +- Spigot-API-Patches/0001-POM-changes.patch | 28 +- .../0002-Add-float-methods-to-configs.patch | 90 - .../0002-Player-affects-spawning-API.patch | 34 + .../0003-Add-getTPS-method.patch | 46 + ...p-using-spigot-s-website-for-timings.patch | 31 - .../0004-Add-async-chunk-load-API.patch | 92 + .../0004-Player-affects-spawning-API.patch | 42 - .../0005-Add-getTPS-method.patch | 27 - ...ck-and-TNTPrimed-source-location-API.patch | 41 + .../0006-Add-async-chunk-load-API.patch | 29 - .../0006-Check-Paper-versions.patch | 77 + ...=> 0007-Add-PlayerLocaleChangeEvent.patch} | 20 +- .../0007-Add-TNT-source-location-API.patch | 25 - .../0008-Add-player-view-distance-API.patch | 34 + .../0008-Check-PaperSpigot-versions.patch | 63 - ...patch => 0009-Add-BeaconEffectEvent.patch} | 14 +- ...Add-FallingBlock-source-location-API.patch | 25 - ...=> 0010-Add-PlayerInitialSpawnEvent.patch} | 18 +- .../0011-Add-player-view-distance-API.patch | 40 - ...Timings-v2.patch => 0011-Timings-v2.patch} | 206 +- ...ort-to-tab-completers-vanilla-featu.patch} | 63 +- ...ade-EntityDismountEvent-Cancellable.patch} | 28 +- ...y-disable-plugins-that-fail-to-load.patch} | 12 +- .../0015-Expose-server-CommandMap.patch | 74 + ...ord-chat-API-from-spigot-subclasses.patch} | 14 +- ...0017-Player-Tab-List-and-Title-APIs.patch} | 291 +- ... 0018-Add-exception-reporting-event.patch} | 980 +++-- .../0018-Expose-server-CommandMap.patch | 67 - ...rverListPingEvent-flagging-as-Async.patch} | 6 +- Spigot-Server-Patches/0001-POM-Changes.patch | 145 +- .../0002-Paper-config-files.patch | 291 ++ .../0002-PaperSpigot-config-files.patch | 321 -- .../0003-mc-dev-imports.patch | 3284 +++++++---------- ...4-Vanished-players-don-t-have-rights.patch | 83 +- ...low-undead-horse-types-to-be-leashed.patch | 41 - ...0005-Configurable-squid-spawn-ranges.patch | 40 + ...ctus-and-reed-natural-growth-heights.patch | 53 + ...0006-Configurable-squid-spawn-ranges.patch | 41 - ...figurable-baby-zombie-movement-speed.patch | 49 + ...e-damage-multiplier-for-PvP-blocking.patch | 38 - ...ctus-and-reed-natural-growth-heights.patch | 53 - ...008-Configurable-fishing-time-ranges.patch | 39 + ...h => 0009-Allow-nerfed-mobs-to-jump.patch} | 30 +- ...figurable-baby-zombie-movement-speed.patch | 37 - ...010-Configurable-fishing-time-ranges.patch | 39 - ...0-Toggle-for-player-interact-limiter.patch | 40 + .../0011-Player-Exhaustion-Multipliers.patch | 60 + ...-despawn-distances-for-living-entiti.patch | 55 + ...2-Toggle-for-player-interact-limiter.patch | 42 - ...3-Allow-for-toggling-of-spawn-chunks.patch | 36 + .../0013-Player-Exhaustion-Multipliers.patch | 59 - ...-despawn-distances-for-living-entiti.patch | 56 - ...ck-and-tnt-entities-at-the-specified.patch | 68 + ...5-Allow-for-toggling-of-spawn-chunks.patch | 37 - ...e-speed-for-water-flowing-over-lava.patch} | 59 +- ...ck-and-tnt-entities-at-the-specified.patch | 78 - ...ent-crashes-server-lists-and-Mojang.patch} | 39 +- ...=> 0017-Player-affects-spawning-API.patch} | 148 +- ...{0020-Metrics.patch => 0018-Metrics.patch} | 10 +- ...ve-invalid-mob-spawner-tile-entities.patch | 24 + .../0020-Optimize-TileEntity-Ticking.patch | 238 ++ ...21-Further-improve-server-tick-loop.patch} | 83 +- ...ve-invalid-mob-spawner-tile-entities.patch | 41 - ...22-Only-refresh-abilities-if-needed.patch} | 14 +- .../0022-Optimize-TileEntity-Ticking.patch | 248 -- ...ch => 0023-Add-async-chunk-load-API.patch} | 22 +- ...ntities-that-fly-through-unloaded-ch.patch | 119 - ...rength-and-weakness-effect-modifiers.patch | 39 - ...ck-and-TNTPrimed-source-location-API.patch | 267 ++ ...vent-tile-entity-and-entity-crashes.patch} | 53 +- ...nfigurable-top-of-nether-void-damage.patch | 51 + ...-before-converting-and-renaming-pla.patch} | 12 +- ...-Configurable-game-mechanics-changes.patch | 82 - .../0028-Fix-redstone-lag-issues.patch | 79 + ...ItemStacks-to-retain-their-invalid-d.patch | 68 - .../0029-Always-tick-falling-blocks.patch | 57 + .../0030-Add-TNT-source-location-API.patch | 132 - ...30-Configurable-async-light-updates.patch} | 156 +- .../0031-Optimize-draining.patch | 28 + ...ble-end-credits-when-leaving-the-end.patch | 75 + ...nfigurable-top-of-nether-void-damage.patch | 51 - ...e-block-they-re-holding-when-they-di.patch | 27 - ...explosions-processing-dead-entities.patch} | 12 +- .../0034-Generator-Settings.patch | 278 ++ .../0035-Fix-redstone-lag-issues.patch | 77 - ...s.patch => 0035-Optimize-explosions.patch} | 77 +- .../0036-Always-tick-falling-blocks.patch | 29 - ...owing-block-if-material-has-changed.patch} | 12 +- ...Add-FallingBlock-source-location-API.patch | 148 - ...raining.patch => 0037-Fast-draining.patch} | 75 +- .../0038-Configurable-lava-flow-speed.patch | 39 + .../0039-Add-player-view-distance-API.patch | 113 + .../0039-Optimize-draining.patch | 29 - .../0040-Disable-explosion-knockback.patch | 73 + ...r-crits-helps-mitigate-hacked-client.patch | 38 - .../0041-Add-PlayerLocaleChangeEvent.patch | 45 - .../0041-Disable-thunder.patch | 37 + .../0042-Disable-ice-and-snow.patch | 36 + ...-Fix-jar-being-shaded-multiple-times.patch | 21 - ...ble-end-credits-when-leaving-the-end.patch | 93 - ...3-Configurable-mob-spawner-tick-rate.patch | 68 + ...=> 0044-Configurable-TNT-cannon-fix.patch} | 251 +- ...s-for-specific-entities-that-fly-thr.patch | 206 -- ...ition-the-first-time-an-entity-is-s.patch} | 72 +- .../0045-Stackable-Buckets.patch | 174 - .../0046-Add-BeaconEffectEvent.patch | 77 + ...figurable-container-update-tick-rate.patch | 49 + .../0047-Generator-Settings.patch | 280 -- ...me-times-creating-air-instead-of-co.patch} | 12 +- ...-TNT-entities-collide-with-specific-.patch | 45 - ...0049-Use-UserCache-for-player-heads.patch} | 31 +- ...> 0050-Disable-spigot-tick-limiters.patch} | 26 +- ...Bump-thread-count-for-chunk-loading.patch} | 12 +- ...on-File-s-when-checking-if-chunk-ex.patch} | 31 +- .../0053-Configurable-lava-flow-speed.patch | 40 - ...-t-create-a-chunk-just-to-unload-it.patch} | 18 +- .../0054-Add-player-view-distance-API.patch | 139 - ...0054-Don-t-sleep-between-chunk-saves.patch | 41 + .../0055-Disable-explosion-knockback.patch | 71 - ...AR-Fix-bug-with-teleporting-entities.patch | 49 + ...=> 0056-Add-PlayerInitialSpawnEvent.patch} | 14 +- .../0056-Disable-thunder.patch | 37 - .../0057-Disable-ice-and-snow.patch | 37 - ...tity-Chunk-Registration-on-Teleport.patch} | 12 +- .../0058-Disable-mood-sounds.patch | 37 - ...Timings-v2.patch => 0058-Timings-v2.patch} | 668 ++-- ...9-Configurable-mob-spawner-tick-rate.patch | 69 - .../0059-Disable-chest-cat-detection.patch | 39 + ...0-Ensure-commands-are-not-ran-async.patch} | 22 +- .../0060-Optimize-getCubes.patch | 45 - ...chunks-are-slime-spawn-chunks-toggle.patch | 37 + .../0061-ChunkMap-caching.patch | 140 - ...ort-to-tab-completers-vanilla-featu.patch} | 122 +- ...Made-EntityDismountEvent-Cancellable.patch | 34 + .../0063-Optimize-Spigot-s-Anti-X-Ray.patch | 88 - .../0064-Add-BeaconEffectEvent.patch | 66 - .../0064-Optimize-Pathfinding.patch | 51 + ...figurable-container-update-tick-rate.patch | 52 - ...patch => 0065-Optimize-getBlockData.patch} | 24 +- ...pper-searches-if-there-are-no-items.patch} | 68 +- ...66-Configurable-TNT-explosion-volume.patch | 40 - ...ch => 0067-Expose-server-CommandMap.patch} | 10 +- ...-informative-in-maxHealth-exception.patch} | 15 +- ...ord-chat-API-from-spigot-subclasses.patch} | 14 +- ...Re-add-Spigot-s-hopper-check-feature.patch | 40 - .../0070-Player-Tab-List-and-Title-APIs.patch | 310 ++ ...on-t-damage-already-dead-ArmorStands.patch | 25 - .../0071-Ensure-inv-drag-is-in-bounds.patch | 22 + ...entation-of-tile-entity-removal-list.patch | 65 + ...dd-configurable-portal-search-radius.patch | 62 + .../0074-Add-velocity-warnings.patch | 26 + ...AR-Fix-bug-with-teleporting-entities.patch | 39 - ...-inter-world-teleportation-glitches.patch} | 46 +- ... 0076-Add-exception-reporting-event.patch} | 756 ++-- ...esolve-bed-issues-on-unloaded-chunks.patch | 31 - .../0080-Disable-chest-cat-detection.patch | 42 - ...chunks-are-slime-spawn-chunks-toggle.patch | 39 - ...-Speedup-BlockPos-by-fixing-inlining.patch | 156 - ...y-invalid-Redstone-event-for-Netherr.patch | 27 - ...Made-EntityDismountEvent-Cancellable.patch | 68 - .../0087-Optimize-Pathfinding.patch | 68 - ...arts-losing-all-of-their-velocity-on.patch | 38 - .../0094-Player-Tab-List-and-Title-APIs.patch | 205 - .../0095-Ensure-inv-drag-is-in-bounds.patch | 22 - ...entation-of-tile-entity-removal-list.patch | 65 - ...dd-configurable-portal-search-radius.patch | 63 - .../0098-Add-velocity-warnings.patch | 52 - applyPatches.sh | 25 +- build.sh | 2 +- decompile.sh | 2 +- newApplyPatches.sh | 39 - newRebuildPatches.sh | 42 - paperclip.sh | 6 +- pom.xml | 14 +- rebuildPatches.sh | 25 +- 180 files changed, 7198 insertions(+), 9759 deletions(-) delete mode 100644 Spigot-API-Patches/0002-Add-float-methods-to-configs.patch create mode 100644 Spigot-API-Patches/0002-Player-affects-spawning-API.patch create mode 100644 Spigot-API-Patches/0003-Add-getTPS-method.patch delete mode 100644 Spigot-API-Patches/0003-Stop-using-spigot-s-website-for-timings.patch create mode 100644 Spigot-API-Patches/0004-Add-async-chunk-load-API.patch delete mode 100644 Spigot-API-Patches/0004-Player-affects-spawning-API.patch delete mode 100644 Spigot-API-Patches/0005-Add-getTPS-method.patch create mode 100644 Spigot-API-Patches/0005-FallingBlock-and-TNTPrimed-source-location-API.patch delete mode 100644 Spigot-API-Patches/0006-Add-async-chunk-load-API.patch create mode 100644 Spigot-API-Patches/0006-Check-Paper-versions.patch rename Spigot-API-Patches/{0010-Add-PlayerLocaleChangeEvent.patch => 0007-Add-PlayerLocaleChangeEvent.patch} (68%) delete mode 100644 Spigot-API-Patches/0007-Add-TNT-source-location-API.patch create mode 100644 Spigot-API-Patches/0008-Add-player-view-distance-API.patch delete mode 100644 Spigot-API-Patches/0008-Check-PaperSpigot-versions.patch rename Spigot-API-Patches/{0012-Add-BeaconEffectEvent.patch => 0009-Add-BeaconEffectEvent.patch} (83%) delete mode 100644 Spigot-API-Patches/0009-Add-FallingBlock-source-location-API.patch rename Spigot-API-Patches/{0013-Add-PlayerInitialSpawnEvent.patch => 0010-Add-PlayerInitialSpawnEvent.patch} (71%) delete mode 100644 Spigot-API-Patches/0011-Add-player-view-distance-API.patch rename Spigot-API-Patches/{0014-Timings-v2.patch => 0011-Timings-v2.patch} (94%) rename Spigot-API-Patches/{0015-Add-Location-support-to-tab-completers-vanilla-featu.patch => 0012-Add-Location-support-to-tab-completers-vanilla-featu.patch} (81%) rename Spigot-API-Patches/{0016-Made-EntityDismountEvent-Cancellable.patch => 0013-Made-EntityDismountEvent-Cancellable.patch} (68%) rename Spigot-API-Patches/{0017-Automatically-disable-plugins-that-fail-to-load.patch => 0014-Automatically-disable-plugins-that-fail-to-load.patch} (77%) create mode 100644 Spigot-API-Patches/0015-Expose-server-CommandMap.patch rename Spigot-API-Patches/{0019-Graduate-bungeecord-chat-API-from-spigot-subclasses.patch => 0016-Graduate-bungeecord-chat-API-from-spigot-subclasses.patch} (91%) rename Spigot-API-Patches/{0020-Player-Tab-List-and-Title-APIs.patch => 0017-Player-Tab-List-and-Title-APIs.patch} (94%) rename Spigot-API-Patches/{0021-Add-exception-reporting-event.patch => 0018-Add-exception-reporting-event.patch} (76%) delete mode 100644 Spigot-API-Patches/0018-Expose-server-CommandMap.patch rename Spigot-API-Patches/{0021-Fix-ServerListPingEvent-flagging-as-Async.patch => 0019-Fix-ServerListPingEvent-flagging-as-Async.patch} (95%) create mode 100644 Spigot-Server-Patches/0002-Paper-config-files.patch delete mode 100644 Spigot-Server-Patches/0002-PaperSpigot-config-files.patch delete mode 100644 Spigot-Server-Patches/0005-Allow-undead-horse-types-to-be-leashed.patch create mode 100644 Spigot-Server-Patches/0005-Configurable-squid-spawn-ranges.patch create mode 100644 Spigot-Server-Patches/0006-Configurable-cactus-and-reed-natural-growth-heights.patch delete mode 100644 Spigot-Server-Patches/0006-Configurable-squid-spawn-ranges.patch create mode 100644 Spigot-Server-Patches/0007-Configurable-baby-zombie-movement-speed.patch delete mode 100644 Spigot-Server-Patches/0007-Configurable-damage-multiplier-for-PvP-blocking.patch delete mode 100644 Spigot-Server-Patches/0008-Configurable-cactus-and-reed-natural-growth-heights.patch create mode 100644 Spigot-Server-Patches/0008-Configurable-fishing-time-ranges.patch rename Spigot-Server-Patches/{0011-Allow-nerfed-mobs-to-jump.patch => 0009-Allow-nerfed-mobs-to-jump.patch} (64%) delete mode 100644 Spigot-Server-Patches/0009-Configurable-baby-zombie-movement-speed.patch delete mode 100644 Spigot-Server-Patches/0010-Configurable-fishing-time-ranges.patch create mode 100644 Spigot-Server-Patches/0010-Toggle-for-player-interact-limiter.patch create mode 100644 Spigot-Server-Patches/0011-Player-Exhaustion-Multipliers.patch create mode 100644 Spigot-Server-Patches/0012-Add-configurable-despawn-distances-for-living-entiti.patch delete mode 100644 Spigot-Server-Patches/0012-Toggle-for-player-interact-limiter.patch create mode 100644 Spigot-Server-Patches/0013-Allow-for-toggling-of-spawn-chunks.patch delete mode 100644 Spigot-Server-Patches/0013-Player-Exhaustion-Multipliers.patch delete mode 100644 Spigot-Server-Patches/0014-Add-configurable-despawn-distances-for-living-entiti.patch create mode 100644 Spigot-Server-Patches/0014-Drop-falling-block-and-tnt-entities-at-the-specified.patch delete mode 100644 Spigot-Server-Patches/0015-Allow-for-toggling-of-spawn-chunks.patch rename Spigot-Server-Patches/{0017-Configurable-speed-for-water-flowing-over-lava.patch => 0015-Configurable-speed-for-water-flowing-over-lava.patch} (50%) delete mode 100644 Spigot-Server-Patches/0016-Drop-falling-block-and-tnt-entities-at-the-specified.patch rename Spigot-Server-Patches/{0019-Show-PaperSpigot-in-client-crashes-server-lists-and-.patch => 0016-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch} (61%) rename Spigot-Server-Patches/{0018-Player-affects-spawning-API.patch => 0017-Player-affects-spawning-API.patch} (57%) rename Spigot-Server-Patches/{0020-Metrics.patch => 0018-Metrics.patch} (78%) create mode 100644 Spigot-Server-Patches/0019-Remove-invalid-mob-spawner-tile-entities.patch create mode 100644 Spigot-Server-Patches/0020-Optimize-TileEntity-Ticking.patch rename Spigot-Server-Patches/{0025-Further-improve-server-tick-loop.patch => 0021-Further-improve-server-tick-loop.patch} (79%) delete mode 100644 Spigot-Server-Patches/0021-Remove-invalid-mob-spawner-tile-entities.patch rename Spigot-Server-Patches/{0026-Only-refresh-abilities-if-needed.patch => 0022-Only-refresh-abilities-if-needed.patch} (76%) delete mode 100644 Spigot-Server-Patches/0022-Optimize-TileEntity-Ticking.patch rename Spigot-Server-Patches/{0028-Add-async-chunk-load-API.patch => 0023-Add-async-chunk-load-API.patch} (67%) delete mode 100644 Spigot-Server-Patches/0023-Remove-certain-entities-that-fly-through-unloaded-ch.patch delete mode 100644 Spigot-Server-Patches/0024-Configurable-strength-and-weakness-effect-modifiers.patch create mode 100644 Spigot-Server-Patches/0024-FallingBlock-and-TNTPrimed-source-location-API.patch rename Spigot-Server-Patches/{0031-Prevent-tile-entity-and-entity-crashes.patch => 0025-Prevent-tile-entity-and-entity-crashes.patch} (60%) create mode 100644 Spigot-Server-Patches/0026-Configurable-top-of-nether-void-damage.patch rename Spigot-Server-Patches/{0034-Check-online-mode-before-converting-and-renaming-pla.patch => 0027-Check-online-mode-before-converting-and-renaming-pla.patch} (78%) delete mode 100644 Spigot-Server-Patches/0027-Configurable-game-mechanics-changes.patch create mode 100644 Spigot-Server-Patches/0028-Fix-redstone-lag-issues.patch delete mode 100644 Spigot-Server-Patches/0029-Allow-specified-ItemStacks-to-retain-their-invalid-d.patch create mode 100644 Spigot-Server-Patches/0029-Always-tick-falling-blocks.patch delete mode 100644 Spigot-Server-Patches/0030-Add-TNT-source-location-API.patch rename Spigot-Server-Patches/{0038-Configurable-async-light-updates.patch => 0030-Configurable-async-light-updates.patch} (64%) create mode 100644 Spigot-Server-Patches/0031-Optimize-draining.patch create mode 100644 Spigot-Server-Patches/0032-Configurable-end-credits-when-leaving-the-end.patch delete mode 100644 Spigot-Server-Patches/0032-Configurable-top-of-nether-void-damage.patch delete mode 100644 Spigot-Server-Patches/0033-Enderman-drop-the-block-they-re-holding-when-they-di.patch rename Spigot-Server-Patches/{0046-Fix-lag-from-explosions-processing-dead-entities.patch => 0033-Fix-lag-from-explosions-processing-dead-entities.patch} (83%) create mode 100644 Spigot-Server-Patches/0034-Generator-Settings.patch delete mode 100644 Spigot-Server-Patches/0035-Fix-redstone-lag-issues.patch rename Spigot-Server-Patches/{0050-Optimize-explosions.patch => 0035-Optimize-explosions.patch} (75%) delete mode 100644 Spigot-Server-Patches/0036-Always-tick-falling-blocks.patch rename Spigot-Server-Patches/{0051-Stop-updating-flowing-block-if-material-has-changed.patch => 0036-Stop-updating-flowing-block-if-material-has-changed.patch} (60%) delete mode 100644 Spigot-Server-Patches/0037-Add-FallingBlock-source-location-API.patch rename Spigot-Server-Patches/{0052-Fast-draining.patch => 0037-Fast-draining.patch} (55%) create mode 100644 Spigot-Server-Patches/0038-Configurable-lava-flow-speed.patch create mode 100644 Spigot-Server-Patches/0039-Add-player-view-distance-API.patch delete mode 100644 Spigot-Server-Patches/0039-Optimize-draining.patch create mode 100644 Spigot-Server-Patches/0040-Disable-explosion-knockback.patch delete mode 100644 Spigot-Server-Patches/0040-Toggleable-player-crits-helps-mitigate-hacked-client.patch delete mode 100644 Spigot-Server-Patches/0041-Add-PlayerLocaleChangeEvent.patch create mode 100644 Spigot-Server-Patches/0041-Disable-thunder.patch create mode 100644 Spigot-Server-Patches/0042-Disable-ice-and-snow.patch delete mode 100644 Spigot-Server-Patches/0042-Fix-jar-being-shaded-multiple-times.patch delete mode 100644 Spigot-Server-Patches/0043-Configurable-end-credits-when-leaving-the-end.patch create mode 100644 Spigot-Server-Patches/0043-Configurable-mob-spawner-tick-rate.patch rename Spigot-Server-Patches/{0048-Configurable-TNT-cannon-fix.patch => 0044-Configurable-TNT-cannon-fix.patch} (59%) delete mode 100644 Spigot-Server-Patches/0044-Force-load-chunks-for-specific-entities-that-fly-thr.patch rename Spigot-Server-Patches/{0062-Send-absolute-position-the-first-time-an-entity-is-s.patch => 0045-Send-absolute-position-the-first-time-an-entity-is-s.patch} (61%) delete mode 100644 Spigot-Server-Patches/0045-Stackable-Buckets.patch create mode 100644 Spigot-Server-Patches/0046-Add-BeaconEffectEvent.patch create mode 100644 Spigot-Server-Patches/0047-Configurable-container-update-tick-rate.patch delete mode 100644 Spigot-Server-Patches/0047-Generator-Settings.patch rename Spigot-Server-Patches/{0067-Fix-lava-water-some-times-creating-air-instead-of-co.patch => 0048-Fix-lava-water-some-times-creating-air-instead-of-co.patch} (71%) delete mode 100644 Spigot-Server-Patches/0049-FallingBlock-and-TNT-entities-collide-with-specific-.patch rename Spigot-Server-Patches/{0068-Use-UserCache-for-player-heads.patch => 0049-Use-UserCache-for-player-heads.patch} (56%) rename Spigot-Server-Patches/{0070-Disable-spigot-tick-limiters.patch => 0050-Disable-spigot-tick-limiters.patch} (68%) rename Spigot-Server-Patches/{0072-Bump-thread-count-for-chunk-loading.patch => 0051-Bump-thread-count-for-chunk-loading.patch} (76%) rename Spigot-Server-Patches/{0073-Don-t-create-Region-File-s-when-checking-if-chunk-ex.patch => 0052-Don-t-create-Region-File-s-when-checking-if-chunk-ex.patch} (73%) delete mode 100644 Spigot-Server-Patches/0053-Configurable-lava-flow-speed.patch rename Spigot-Server-Patches/{0074-Don-t-create-a-chunk-just-to-unload-it.patch => 0053-Don-t-create-a-chunk-just-to-unload-it.patch} (55%) delete mode 100644 Spigot-Server-Patches/0054-Add-player-view-distance-API.patch create mode 100644 Spigot-Server-Patches/0054-Don-t-sleep-between-chunk-saves.patch delete mode 100644 Spigot-Server-Patches/0055-Disable-explosion-knockback.patch create mode 100644 Spigot-Server-Patches/0055-EAR-Fix-bug-with-teleporting-entities.patch rename Spigot-Server-Patches/{0076-Add-PlayerInitialSpawnEvent.patch => 0056-Add-PlayerInitialSpawnEvent.patch} (78%) delete mode 100644 Spigot-Server-Patches/0056-Disable-thunder.patch delete mode 100644 Spigot-Server-Patches/0057-Disable-ice-and-snow.patch rename Spigot-Server-Patches/{0077-Process-Entity-Chunk-Registration-on-Teleport.patch => 0057-Process-Entity-Chunk-Registration-on-Teleport.patch} (75%) delete mode 100644 Spigot-Server-Patches/0058-Disable-mood-sounds.patch rename Spigot-Server-Patches/{0079-Timings-v2.patch => 0058-Timings-v2.patch} (73%) delete mode 100644 Spigot-Server-Patches/0059-Configurable-mob-spawner-tick-rate.patch create mode 100644 Spigot-Server-Patches/0059-Disable-chest-cat-detection.patch rename Spigot-Server-Patches/{0081-Ensure-commands-are-not-ran-async.patch => 0060-Ensure-commands-are-not-ran-async.patch} (89%) delete mode 100644 Spigot-Server-Patches/0060-Optimize-getCubes.patch create mode 100644 Spigot-Server-Patches/0061-All-chunks-are-slime-spawn-chunks-toggle.patch delete mode 100644 Spigot-Server-Patches/0061-ChunkMap-caching.patch rename Spigot-Server-Patches/{0085-Add-Location-support-to-tab-completers-vanilla-featu.patch => 0062-Add-Location-support-to-tab-completers-vanilla-featu.patch} (58%) create mode 100644 Spigot-Server-Patches/0063-Made-EntityDismountEvent-Cancellable.patch delete mode 100644 Spigot-Server-Patches/0063-Optimize-Spigot-s-Anti-X-Ray.patch delete mode 100644 Spigot-Server-Patches/0064-Add-BeaconEffectEvent.patch create mode 100644 Spigot-Server-Patches/0064-Optimize-Pathfinding.patch delete mode 100644 Spigot-Server-Patches/0065-Configurable-container-update-tick-rate.patch rename Spigot-Server-Patches/{0088-Optimize-getBlockData.patch => 0065-Optimize-getBlockData.patch} (59%) rename Spigot-Server-Patches/{0089-Avoid-hopper-searches-if-there-are-no-items.patch => 0066-Avoid-hopper-searches-if-there-are-no-items.patch} (64%) delete mode 100644 Spigot-Server-Patches/0066-Configurable-TNT-explosion-volume.patch rename Spigot-Server-Patches/{0090-Expose-server-CommandMap.patch => 0067-Expose-server-CommandMap.patch} (69%) rename Spigot-Server-Patches/{0092-Be-a-bit-more-informative-in-maxHealth-exception.patch => 0068-Be-a-bit-more-informative-in-maxHealth-exception.patch} (61%) rename Spigot-Server-Patches/{0093-Graduate-bungeecord-chat-API-from-spigot-subclasses.patch => 0069-Graduate-bungeecord-chat-API-from-spigot-subclasses.patch} (85%) delete mode 100644 Spigot-Server-Patches/0069-Re-add-Spigot-s-hopper-check-feature.patch create mode 100644 Spigot-Server-Patches/0070-Player-Tab-List-and-Title-APIs.patch delete mode 100644 Spigot-Server-Patches/0071-Don-t-damage-already-dead-ArmorStands.patch create mode 100644 Spigot-Server-Patches/0071-Ensure-inv-drag-is-in-bounds.patch create mode 100644 Spigot-Server-Patches/0072-Change-implementation-of-tile-entity-removal-list.patch create mode 100644 Spigot-Server-Patches/0073-Add-configurable-portal-search-radius.patch create mode 100644 Spigot-Server-Patches/0074-Add-velocity-warnings.patch delete mode 100644 Spigot-Server-Patches/0075-EAR-Fix-bug-with-teleporting-entities.patch rename Spigot-Server-Patches/{0099-Fix-inter-world-teleportation-glitches.patch => 0075-Fix-inter-world-teleportation-glitches.patch} (69%) rename Spigot-Server-Patches/{0100-Add-exception-reporting-event.patch => 0076-Add-exception-reporting-event.patch} (55%) delete mode 100644 Spigot-Server-Patches/0078-SPIGOT-1387-Resolve-bed-issues-on-unloaded-chunks.patch delete mode 100644 Spigot-Server-Patches/0080-Disable-chest-cat-detection.patch delete mode 100644 Spigot-Server-Patches/0082-All-chunks-are-slime-spawn-chunks-toggle.patch delete mode 100644 Spigot-Server-Patches/0083-Speedup-BlockPos-by-fixing-inlining.patch delete mode 100644 Spigot-Server-Patches/0084-Remove-completely-invalid-Redstone-event-for-Netherr.patch delete mode 100644 Spigot-Server-Patches/0086-Made-EntityDismountEvent-Cancellable.patch delete mode 100644 Spigot-Server-Patches/0087-Optimize-Pathfinding.patch delete mode 100644 Spigot-Server-Patches/0091-Fix-FurnaceMinecarts-losing-all-of-their-velocity-on.patch delete mode 100644 Spigot-Server-Patches/0094-Player-Tab-List-and-Title-APIs.patch delete mode 100644 Spigot-Server-Patches/0095-Ensure-inv-drag-is-in-bounds.patch delete mode 100644 Spigot-Server-Patches/0096-Change-implementation-of-tile-entity-removal-list.patch delete mode 100644 Spigot-Server-Patches/0097-Add-configurable-portal-search-radius.patch delete mode 100644 Spigot-Server-Patches/0098-Add-velocity-warnings.patch delete mode 100755 newApplyPatches.sh delete mode 100755 newRebuildPatches.sh diff --git a/.gitignore b/.gitignore index f61f6b333c..78ec8315fc 100644 --- a/.gitignore +++ b/.gitignore @@ -39,9 +39,11 @@ work/ # other stuff Spigot-API Spigot-Server +Paper-Server +Paper-API PaperSpigot-Server PaperSpigot-API Bukkit CraftBukkit Paperclip -Paperclip.jar \ No newline at end of file +Paperclip.jar diff --git a/.travis.yml b/.travis.yml index bac1d57188..179161f43c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,7 @@ before_install: - ./remap.sh - ./decompile.sh - ./init.sh - - ./newApplyPatches.sh + - ./applyPatches.sh after_success: - ./paperclip.sh cache: diff --git a/Bukkit b/Bukkit index 972b9fea86..fccf27b47d 160000 --- a/Bukkit +++ b/Bukkit @@ -1 +1 @@ -Subproject commit 972b9fea86022c4136504fbd3ac9c00070b96baa +Subproject commit fccf27b47d27d5bece10ccfc21770adfe89e26de diff --git a/CraftBukkit b/CraftBukkit index c194444207..e2c5473e07 160000 --- a/CraftBukkit +++ b/CraftBukkit @@ -1 +1 @@ -Subproject commit c194444207ae8543dc4ec4669a6e0d446f41d3b6 +Subproject commit e2c5473e0780cea305203070ac25f4c9d2369077 diff --git a/README.md b/README.md index 49f2215390..fef1799c53 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -PaperSpigot [![CI Status](http://ci.destroystokyo.com/buildStatus/icon?job=PaperSpigot)](http://ci.destroystokyo.com/job/PaperSpigot/) +Paper [![CI Status](http://ci.destroystokyo.com/buildStatus/icon?job=PaperSpigot)](http://ci.destroystokyo.com/job/PaperSpigot/) =========== High performance Spigot fork that aims to fix gameplay and mechanics inconsistencies. @@ -15,12 +15,12 @@ https://ci.destroystokyo.com/job/PaperSpigot/ Run the PaperClip jar directly from your server. Just like old times -PaperSpigot requires **JRE 8** or above. +PaperSpigot requires **Java 8** or above. How To (Compiling From Source) ------ -To compile PaperSpigot, you need JDK8, maven, and an internet connection. +To compile PaperSpigot, you need JDK 8, maven, and an internet connection. Clone this repo, run ./build.sh from *bash*, get files. diff --git a/Spigot-API-Patches/0001-POM-changes.patch b/Spigot-API-Patches/0001-POM-changes.patch index 969036849f..4c5ab4393c 100644 --- a/Spigot-API-Patches/0001-POM-changes.patch +++ b/Spigot-API-Patches/0001-POM-changes.patch @@ -1,11 +1,11 @@ -From 5d7fe1d8ba54b000f583088bc50141a184818516 Mon Sep 17 00:00:00 2001 -From: Zach Brown -Date: Tue, 6 Jan 2015 22:12:31 -0600 +From 6f357f8fcd6d70079999cfc38064ec0df97c4b99 Mon Sep 17 00:00:00 2001 +From: Zach Brown +Date: Mon, 29 Feb 2016 17:16:08 -0600 Subject: [PATCH] POM changes diff --git a/pom.xml b/pom.xml -index cb142f2..d63151f 100644 +index dec3b6c..b85201d 100644 --- a/pom.xml +++ b/pom.xml @@ -4,35 +4,37 @@ @@ -15,22 +15,22 @@ index cb142f2..d63151f 100644 - org.sonatype.oss - oss-parent - 9 -+ org.github.paperspigot -+ paperspigot-parent ++ com.destroystokyo.paper ++ paper-parent + dev-SNAPSHOT - org.spigotmc - spigot-api -+ org.github.paperspigot -+ paperspigot-api - 1.8.8-R0.1-SNAPSHOT ++ com.destroystokyo.paper ++ paper-api + 1.9-SNAPSHOT jar - Spigot-API - http://www.spigotmc.org/ -+ PaperSpigot-API -+ https://hub.spigotmc.org/stash/projects/PAPER/ ++ Paper-API ++ https://github.com/PaperSpigot/Paper An enhanced plugin API for Minecraft servers. @@ -65,7 +65,7 @@ index cb142f2..d63151f 100644 - org.codehaus.mojo - animal-sniffer-maven-plugin -- 1.13 +- 1.14 - - - process-classes @@ -85,7 +85,7 @@ index cb142f2..d63151f 100644 - org.apache.maven.plugins maven-shade-plugin - 2.3 + 2.4.1 -- -2.7.1 +2.7.2 diff --git a/Spigot-API-Patches/0002-Add-float-methods-to-configs.patch b/Spigot-API-Patches/0002-Add-float-methods-to-configs.patch deleted file mode 100644 index af8be23e1e..0000000000 --- a/Spigot-API-Patches/0002-Add-float-methods-to-configs.patch +++ /dev/null @@ -1,90 +0,0 @@ -From 5db35d30b2c5deb83eae1e6b2f9f9e60dba9a31e Mon Sep 17 00:00:00 2001 -From: Zach Brown -Date: Mon, 19 May 2014 22:51:45 -0500 -Subject: [PATCH] Add float methods to configs - - -diff --git a/src/main/java/org/bukkit/configuration/ConfigurationSection.java b/src/main/java/org/bukkit/configuration/ConfigurationSection.java -index 1bd7fb5..9afc1dc 100644 ---- a/src/main/java/org/bukkit/configuration/ConfigurationSection.java -+++ b/src/main/java/org/bukkit/configuration/ConfigurationSection.java -@@ -355,6 +355,48 @@ public interface ConfigurationSection { - */ - public boolean isDouble(String path); - -+ // PaperSpigot start - Add getFloat -+ /** -+ * Gets the requested float by path. -+ *

-+ * If the float does not exist but a default value has been specified, -+ * this will return the default value. If the float does not exist and no -+ * default value was specified, this will return 0. -+ * -+ * @param path Path of the float to get. -+ * @return Requested float. -+ */ -+ public float getFloat(String path); -+ -+ /** -+ * Gets the requested float by path, returning a default value if not -+ * found. -+ *

-+ * If the float does not exist then the specified default value will -+ * returned regardless of if a default has been identified in the root -+ * {@link Configuration}. -+ * -+ * @param path Path of the float to get. -+ * @param def The default value to return if the path is not found or is -+ * not a float. -+ * @return Requested float. -+ */ -+ public float getFloat(String path, float def); -+ -+ /** -+ * Checks if the specified path is a float. -+ *

-+ * If the path exists but is not a float, this will return false. If the -+ * path does not exist, this will return false. If the path does not exist -+ * but a default value has been specified, this will check if that default -+ * value is a gloat and return appropriately. -+ * -+ * @param path Path of the float to check. -+ * @return Whether or not the specified path is a float. -+ */ -+ public boolean isFloat(String path); -+ // PaperSpigot end -+ - /** - * Gets the requested long by path. - *

-diff --git a/src/main/java/org/bukkit/configuration/MemorySection.java b/src/main/java/org/bukkit/configuration/MemorySection.java -index f180bf5..0e2b26a 100644 ---- a/src/main/java/org/bukkit/configuration/MemorySection.java -+++ b/src/main/java/org/bukkit/configuration/MemorySection.java -@@ -336,6 +336,23 @@ public class MemorySection implements ConfigurationSection { - return val instanceof Double; - } - -+ // PaperSpigot start - Add getFloat -+ public float getFloat(String path) { -+ Object def = getDefault(path); -+ return getFloat(path, (def instanceof Float) ? toFloat(def) : 0); -+ } -+ -+ public float getFloat(String path, float def) { -+ Object val = get(path, def); -+ return (val instanceof Float) ? toFloat(val) : def; -+ } -+ -+ public boolean isFloat(String path) { -+ Object val = get(path); -+ return val instanceof Float; -+ } -+ // PaperSpigot end -+ - public long getLong(String path) { - Object def = getDefault(path); - return getLong(path, (def instanceof Number) ? toLong(def) : 0); --- -1.9.1 - diff --git a/Spigot-API-Patches/0002-Player-affects-spawning-API.patch b/Spigot-API-Patches/0002-Player-affects-spawning-API.patch new file mode 100644 index 0000000000..d4116c6182 --- /dev/null +++ b/Spigot-API-Patches/0002-Player-affects-spawning-API.patch @@ -0,0 +1,34 @@ +From 9a4a2c1714d36269d90b39931fbc0209bacc9194 Mon Sep 17 00:00:00 2001 +From: Jedediah Smith +Date: Mon, 29 Feb 2016 17:22:34 -0600 +Subject: [PATCH] Player affects spawning API + + +diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java +index dc58bea..2721f4c 100644 +--- a/src/main/java/org/bukkit/entity/Player.java ++++ b/src/main/java/org/bukkit/entity/Player.java +@@ -1270,6 +1270,20 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline + */ + public void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data); + ++ /** ++ * Get whether the player can affect mob spawning ++ * ++ * @return if the player can affect mob spawning ++ */ ++ public boolean getAffectsSpawning(); ++ ++ /** ++ * Set whether the player can affect mob spawning ++ * ++ * @param affects Whether the player can affect mob spawning ++ */ ++ public void setAffectsSpawning(boolean affects); ++ + // Spigot start + public class Spigot extends Entity.Spigot + { +-- +2.7.2 + diff --git a/Spigot-API-Patches/0003-Add-getTPS-method.patch b/Spigot-API-Patches/0003-Add-getTPS-method.patch new file mode 100644 index 0000000000..758746560e --- /dev/null +++ b/Spigot-API-Patches/0003-Add-getTPS-method.patch @@ -0,0 +1,46 @@ +From 9082960948db00f8186644598d78836679ac08cf Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Mon, 29 Feb 2016 17:24:57 -0600 +Subject: [PATCH] Add getTPS method + + +diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java +index dc2c9d1..e19f3d7 100644 +--- a/src/main/java/org/bukkit/Bukkit.java ++++ b/src/main/java/org/bukkit/Bukkit.java +@@ -1141,6 +1141,14 @@ public final class Bukkit { + } + + /** ++ * Gets the current server TPS ++ * @return current server TPS (1m, 5m, 15m in Paper-Server) ++ */ ++ public static double[] getTPS() { ++ return server.getTPS(); ++ } ++ ++ /** + * @see UnsafeValues + * @return the unsafe values instance + */ +diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java +index 69720e9..92a5cbc 100644 +--- a/src/main/java/org/bukkit/Server.java ++++ b/src/main/java/org/bukkit/Server.java +@@ -934,6 +934,13 @@ public interface Server extends PluginMessageRecipient { + BossBar createBossBar(String title, BarColor color, BarStyle style, BarFlag ...flags); + + /** ++ * Gets the current server TPS ++ * ++ * @return current server TPS (1m, 5m, 15m in Paper-Server) ++ */ ++ public double[] getTPS(); ++ ++ /** + * @see UnsafeValues + * @return the unsafe values instance + */ +-- +2.7.2 + diff --git a/Spigot-API-Patches/0003-Stop-using-spigot-s-website-for-timings.patch b/Spigot-API-Patches/0003-Stop-using-spigot-s-website-for-timings.patch deleted file mode 100644 index 4ea914c2fb..0000000000 --- a/Spigot-API-Patches/0003-Stop-using-spigot-s-website-for-timings.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 1ada1bf4361c4a6312d2228ad5fa62ade8d0d91e Mon Sep 17 00:00:00 2001 -From: Zach Brown -Date: Thu, 28 May 2015 00:00:29 -0500 -Subject: [PATCH] Stop using spigot's website for timings - - -diff --git a/src/main/java/org/bukkit/command/defaults/TimingsCommand.java b/src/main/java/org/bukkit/command/defaults/TimingsCommand.java -index fc59aa3..9782a3b 100644 ---- a/src/main/java/org/bukkit/command/defaults/TimingsCommand.java -+++ b/src/main/java/org/bukkit/command/defaults/TimingsCommand.java -@@ -94,7 +94,7 @@ public class TimingsCommand extends BukkitCommand { - } - - sender.sendMessage("Timings written to " + timings.getPath()); -- sender.sendMessage( "Paste contents of file into form at http://www.spigotmc.org/go/timings to read results." ); -+ sender.sendMessage( "Paste contents of file into form at http://aikar.co/timings.php to read results." ); - - } catch (IOException e) { - } finally { -@@ -241,7 +241,7 @@ public class TimingsCommand extends BukkitCommand { - - String location = con.getHeaderField( "Location" ); - String pasteID = location.substring( "http://paste.ubuntu.com/".length(), location.length() - 1 ); -- sender.sendMessage( ChatColor.GREEN + "Timings results can be viewed at http://www.spigotmc.org/go/timings?url=" + pasteID ); -+ sender.sendMessage( ChatColor.GREEN + "Timings results can be viewed at http://aikar.co/timings.php?url=" + pasteID ); - } catch ( IOException ex ) - { - sender.sendMessage( ChatColor.RED + "Error pasting timings, check your console for more information" ); --- -2.4.1.windows.1 - diff --git a/Spigot-API-Patches/0004-Add-async-chunk-load-API.patch b/Spigot-API-Patches/0004-Add-async-chunk-load-API.patch new file mode 100644 index 0000000000..c8692fa23e --- /dev/null +++ b/Spigot-API-Patches/0004-Add-async-chunk-load-API.patch @@ -0,0 +1,92 @@ +From 71adf6472ca1b721a50a1258ae05839fe735e00d Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Mon, 29 Feb 2016 17:43:33 -0600 +Subject: [PATCH] Add async chunk load API + + +diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java +index 4125633..724d7a9 100644 +--- a/src/main/java/org/bukkit/World.java ++++ b/src/main/java/org/bukkit/World.java +@@ -130,6 +130,78 @@ public interface World extends PluginMessageRecipient, Metadatable { + public Chunk getChunkAt(Block block); + + /** ++ * Used by {@link World#getChunkAtAsync(Location,ChunkLoadCallback)} methods ++ * to request a {@link Chunk} to be loaded, with this callback receiving ++ * the chunk when it is finished. ++ * ++ * This callback will be executed on synchronously on the main thread. ++ * ++ * Timing and order this callback is fired is intentionally not defined and ++ * and subject to change. ++ */ ++ public static interface ChunkLoadCallback { ++ public void onLoad(Chunk chunk); ++ } ++ ++ /** ++ * Requests a {@link Chunk} to be loaded at the given coordinates ++ * ++ * This method makes no guarantee on how fast the chunk will load, ++ * and will return the chunk to the callback at a later time. ++ * ++ * You should use this method if you need a chunk but do not need it ++ * immediately, and you wish to let the server control the speed ++ * of chunk loads, keeping performance in mind. ++ * ++ * The {@link ChunkLoadCallback} will always be executed synchronously ++ * on the main Server Thread. ++ * ++ * @param x Chunk X-coordinate of the chunk - (world coordinate / 16) ++ * @param z Chunk Z-coordinate of the chunk - (world coordinate / 16) ++ * @param cb Callback to receive the chunk when it is loaded. ++ * will be executed synchronously ++ */ ++ public void getChunkAtAsync(int x, int z, ChunkLoadCallback cb); ++ ++ /** ++ * Requests a {@link Chunk} to be loaded at the given {@link Location} ++ * ++ * This method makes no guarantee on how fast the chunk will load, ++ * and will return the chunk to the callback at a later time. ++ * ++ * You should use this method if you need a chunk but do not need it ++ * immediately, and you wish to let the server control the speed ++ * of chunk loads, keeping performance in mind. ++ * ++ * The {@link ChunkLoadCallback} will always be executed synchronously ++ * on the main Server Thread. ++ * ++ * @param location Location of the chunk ++ * @param cb Callback to receive the chunk when it is loaded. ++ * will be executed synchronously ++ */ ++ public void getChunkAtAsync(Location location, ChunkLoadCallback cb); ++ ++ /** ++ * Requests {@link Chunk} to be loaded that contains the given {@link Block} ++ * ++ * This method makes no guarantee on how fast the chunk will load, ++ * and will return the chunk to the callback at a later time. ++ * ++ * You should use this method if you need a chunk but do not need it ++ * immediately, and you wish to let the server control the speed ++ * of chunk loads, keeping performance in mind. ++ * ++ * The {@link ChunkLoadCallback} will always be executed synchronously ++ * on the main Server Thread. ++ * ++ * @param block Block to get the containing chunk from ++ * @param cb Callback to receive the chunk when it is loaded. ++ * will be executed synchronously ++ */ ++ public void getChunkAtAsync(Block block, ChunkLoadCallback cb); ++ ++ /** + * Checks if the specified {@link Chunk} is loaded + * + * @param chunk The chunk to check +-- +2.7.2 + diff --git a/Spigot-API-Patches/0004-Player-affects-spawning-API.patch b/Spigot-API-Patches/0004-Player-affects-spawning-API.patch deleted file mode 100644 index 37efe0dfb6..0000000000 --- a/Spigot-API-Patches/0004-Player-affects-spawning-API.patch +++ /dev/null @@ -1,42 +0,0 @@ -From ca5a9ea7df0a2f0fbe9f584560528dcc1cdb1605 Mon Sep 17 00:00:00 2001 -From: Jedediah Smith -Date: Fri, 8 Aug 2014 22:51:26 -0500 -Subject: [PATCH] Player affects spawning API - - -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 9508e84..f93dcec 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -1161,6 +1161,28 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline - public void sendMessage(net.md_5.bungee.api.chat.BaseComponent... components) { - throw new UnsupportedOperationException("Not supported yet."); - } -+ -+ /** -+ * Get whether the player affects mob spawning -+ * -+ * @return whether or not the player affects -+ * mob spawning. -+ */ -+ public boolean getAffectsSpawning() -+ { -+ throw new UnsupportedOperationException( "Not supported yet." ); -+ } -+ -+ /** -+ * Set whether or not the player affects mob spawning -+ * -+ * @param affects whether or not the player should affect -+ * spawning or not. -+ */ -+ public void setAffectsSpawning(boolean affects) -+ { -+ throw new UnsupportedOperationException( "Not supported yet" ); -+ } - } - - Spigot spigot(); --- -1.9.5.msysgit.1 - diff --git a/Spigot-API-Patches/0005-Add-getTPS-method.patch b/Spigot-API-Patches/0005-Add-getTPS-method.patch deleted file mode 100644 index b9c90cf7b1..0000000000 --- a/Spigot-API-Patches/0005-Add-getTPS-method.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 8bce4a508162d640c99efa7ddde38c1fe773d49e Mon Sep 17 00:00:00 2001 -From: Zach Brown -Date: Sun, 19 Oct 2014 18:22:18 -0500 -Subject: [PATCH] Add getTPS method - - -diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 169008a..26acdda 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -956,6 +956,13 @@ public interface Server extends PluginMessageRecipient { - public void restart() { - throw new UnsupportedOperationException("Not supported yet."); - } -+ -+ // PaperSpigot start - Add getTPS method -+ public double[] getTPS() -+ { -+ throw new UnsupportedOperationException( "Not supported yet." ); -+ } -+ // PaperSpigot end - } - - Spigot spigot(); --- -2.5.0 - diff --git a/Spigot-API-Patches/0005-FallingBlock-and-TNTPrimed-source-location-API.patch b/Spigot-API-Patches/0005-FallingBlock-and-TNTPrimed-source-location-API.patch new file mode 100644 index 0000000000..5845c56297 --- /dev/null +++ b/Spigot-API-Patches/0005-FallingBlock-and-TNTPrimed-source-location-API.patch @@ -0,0 +1,41 @@ +From a1986bb1ab9932a428e2e58202ee90900c09e620 Mon Sep 17 00:00:00 2001 +From: Byteflux +Date: Mon, 29 Feb 2016 17:50:31 -0600 +Subject: [PATCH] FallingBlock and TNTPrimed source location API + + +diff --git a/src/main/java/org/bukkit/entity/FallingBlock.java b/src/main/java/org/bukkit/entity/FallingBlock.java +index bc56fa2..ae9033c 100644 +--- a/src/main/java/org/bukkit/entity/FallingBlock.java ++++ b/src/main/java/org/bukkit/entity/FallingBlock.java +@@ -59,4 +59,11 @@ public interface FallingBlock extends Entity { + * @param hurtEntities whether entities will be damaged by this block. + */ + void setHurtEntities(boolean hurtEntities); ++ ++ /** ++ * Gets the source block location of the FallingBlock ++ * ++ * @return the source block location the FallingBlock was spawned from ++ */ ++ public org.bukkit.Location getSourceLoc(); + } +diff --git a/src/main/java/org/bukkit/entity/TNTPrimed.java b/src/main/java/org/bukkit/entity/TNTPrimed.java +index 3ce322d..74b82f9 100644 +--- a/src/main/java/org/bukkit/entity/TNTPrimed.java ++++ b/src/main/java/org/bukkit/entity/TNTPrimed.java +@@ -35,4 +35,11 @@ public interface TNTPrimed extends Explosive { + * @return the source of this primed TNT + */ + public Entity getSource(); ++ ++ /** ++ * Gets the source block location of the TNTPrimed ++ * ++ * @return the source block location the TNTPrimed was spawned from ++ */ ++ public org.bukkit.Location getSourceLoc(); + } +-- +2.7.2 + diff --git a/Spigot-API-Patches/0006-Add-async-chunk-load-API.patch b/Spigot-API-Patches/0006-Add-async-chunk-load-API.patch deleted file mode 100644 index 2bd3009695..0000000000 --- a/Spigot-API-Patches/0006-Add-async-chunk-load-API.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 498f77bac894f37bb813f93a2d3da2c127a2384f Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Thu, 6 Nov 2014 18:29:20 -0600 -Subject: [PATCH] Add async chunk load API - - -diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index ab73174..c962e7d 100644 ---- a/src/main/java/org/bukkit/World.java -+++ b/src/main/java/org/bukkit/World.java -@@ -129,6 +129,15 @@ public interface World extends PluginMessageRecipient, Metadatable { - */ - public Chunk getChunkAt(Block block); - -+ // PaperSpigot start - Async chunk load API -+ public static interface ChunkLoadCallback { -+ public void onLoad(Chunk chunk); -+ } -+ public void getChunkAtAsync(int x, int z, ChunkLoadCallback cb); -+ public void getChunkAtAsync(Location location, ChunkLoadCallback cb); -+ public void getChunkAtAsync(Block block, ChunkLoadCallback cb); -+ // PaperSpigot end -+ - /** - * Checks if the specified {@link Chunk} is loaded - * --- -1.9.1 - diff --git a/Spigot-API-Patches/0006-Check-Paper-versions.patch b/Spigot-API-Patches/0006-Check-Paper-versions.patch new file mode 100644 index 0000000000..22017d4162 --- /dev/null +++ b/Spigot-API-Patches/0006-Check-Paper-versions.patch @@ -0,0 +1,77 @@ +From 7d9c89c650173fed78c662109eea960d61b6e678 Mon Sep 17 00:00:00 2001 +From: Zach Brown +Date: Mon, 29 Feb 2016 17:58:01 -0600 +Subject: [PATCH] Check Paper versions + + +diff --git a/src/main/java/org/bukkit/command/defaults/VersionCommand.java b/src/main/java/org/bukkit/command/defaults/VersionCommand.java +index b55abdb..e1bea95 100644 +--- a/src/main/java/org/bukkit/command/defaults/VersionCommand.java ++++ b/src/main/java/org/bukkit/command/defaults/VersionCommand.java +@@ -185,30 +185,17 @@ public class VersionCommand extends BukkitCommand { + private void obtainVersion() { + String version = Bukkit.getVersion(); + if (version == null) version = "Custom"; +- if (version.startsWith("git-Spigot-")) { +- String[] parts = version.substring("git-Spigot-".length()).split("-"); +- int cbVersions = getDistance("craftbukkit", parts[1].substring(0, parts[1].indexOf(' '))); +- int spigotVersions = getDistance("spigot", parts[0]); +- if (cbVersions == -1 || spigotVersions == -1) { ++ // Paper start ++ if (version.startsWith("git-Paper-")) { ++ String[] parts = version.substring("git-Paper-".length()).split("[-\\s]"); ++ int paperVersions = getDistance("paper", parts[0]); ++ if (paperVersions == -1) { + setVersionMessage("Error obtaining version information"); + } else { +- if (cbVersions == 0 && spigotVersions == 0) { ++ if (paperVersions == 0) { + setVersionMessage("You are running the latest version"); + } else { +- setVersionMessage("You are " + (cbVersions + spigotVersions) + " version(s) behind"); +- } +- } +- +- } else if (version.startsWith("git-Bukkit-")) { +- version = version.substring("git-Bukkit-".length()); +- int cbVersions = getDistance("craftbukkit", version.substring(0, version.indexOf(' '))); +- if (cbVersions == -1) { +- setVersionMessage("Error obtaining version information"); +- } else { +- if (cbVersions == 0) { +- setVersionMessage("You are running the latest version"); +- } else { +- setVersionMessage("You are " + cbVersions + " version(s) behind"); ++ setVersionMessage("You are " + paperVersions + " version(s) behind"); + } + } + } else { +@@ -232,17 +219,20 @@ public class VersionCommand extends BukkitCommand { + } + } + +- private static int getDistance(String repo, String hash) { ++ private static int getDistance(String repo, String currentVerInt) { // Paper + try { + BufferedReader reader = Resources.asCharSource( +- new URL("https://hub.spigotmc.org/stash/rest/api/1.0/projects/SPIGOT/repos/" + repo + "/commits?since=" + URLEncoder.encode(hash, "UTF-8") + "&withCounts=true"), ++ new URL("https://ci.destroystokyo.com/job/PaperSpigot/lastSuccessfulBuild/buildNumber"), // Paper + Charsets.UTF_8 + ).openBufferedStream(); + try { +- JSONObject obj = (JSONObject) new JSONParser().parse(reader); +- return ((Number) obj.get("totalCount")).intValue(); +- } catch (ParseException ex) { ++ // Paper start ++ int newVer = Integer.decode(reader.readLine()); ++ int currentVer = Integer.decode(currentVerInt); ++ return newVer - currentVer; ++ } catch (NumberFormatException ex) { + ex.printStackTrace(); ++ // Paper end + return -1; + } finally { + reader.close(); +-- +2.7.2 + diff --git a/Spigot-API-Patches/0010-Add-PlayerLocaleChangeEvent.patch b/Spigot-API-Patches/0007-Add-PlayerLocaleChangeEvent.patch similarity index 68% rename from Spigot-API-Patches/0010-Add-PlayerLocaleChangeEvent.patch rename to Spigot-API-Patches/0007-Add-PlayerLocaleChangeEvent.patch index 550b3ff8c0..3626013763 100644 --- a/Spigot-API-Patches/0010-Add-PlayerLocaleChangeEvent.patch +++ b/Spigot-API-Patches/0007-Add-PlayerLocaleChangeEvent.patch @@ -1,19 +1,20 @@ -From eb89a2994624f064ca2508434247629e746a8dd4 Mon Sep 17 00:00:00 2001 -From: Isaac Moore -Date: Mon, 27 Apr 2015 21:41:39 -0500 +From 3c8bd87bc36a0c83f24b14609fe615824d1b6002 Mon Sep 17 00:00:00 2001 +From: Zach Brown +Date: Mon, 29 Feb 2016 18:02:25 -0600 Subject: [PATCH] Add PlayerLocaleChangeEvent -diff --git a/src/main/java/org/bukkit/event/player/PlayerLocaleChangeEvent.java b/src/main/java/org/bukkit/event/player/PlayerLocaleChangeEvent.java +diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerLocaleChangeEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerLocaleChangeEvent.java new file mode 100644 -index 0000000..3efd159 +index 0000000..17afc8c --- /dev/null -+++ b/src/main/java/org/bukkit/event/player/PlayerLocaleChangeEvent.java -@@ -0,0 +1,46 @@ -+package org.bukkit.event.player; ++++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerLocaleChangeEvent.java +@@ -0,0 +1,47 @@ ++package com.destroystokyo.paper.event.player; + +import org.bukkit.entity.Player; +import org.bukkit.event.HandlerList; ++import org.bukkit.event.player.PlayerEvent; + +/** + * Called when the locale of the player is changed. @@ -56,7 +57,6 @@ index 0000000..3efd159 + return handlers; + } +} -\ No newline at end of file -- -1.9.1 +2.7.2 diff --git a/Spigot-API-Patches/0007-Add-TNT-source-location-API.patch b/Spigot-API-Patches/0007-Add-TNT-source-location-API.patch deleted file mode 100644 index 76f958c342..0000000000 --- a/Spigot-API-Patches/0007-Add-TNT-source-location-API.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 28b66c77af202f83255000ebfa9050978a83af4a Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sun, 30 Nov 2014 22:57:17 -0600 -Subject: [PATCH] Add TNT source location API - - -diff --git a/src/main/java/org/bukkit/entity/TNTPrimed.java b/src/main/java/org/bukkit/entity/TNTPrimed.java -index 3ce322d..7b1b6b6 100644 ---- a/src/main/java/org/bukkit/entity/TNTPrimed.java -+++ b/src/main/java/org/bukkit/entity/TNTPrimed.java -@@ -35,4 +35,11 @@ public interface TNTPrimed extends Explosive { - * @return the source of this primed TNT - */ - public Entity getSource(); -+ -+ /** -+ * Gets the source block location of the primed TNT. -+ * -+ * @return the source block location the TNT was spawned from -+ */ -+ public org.bukkit.Location getSourceLoc(); - } --- -1.9.1 - diff --git a/Spigot-API-Patches/0008-Add-player-view-distance-API.patch b/Spigot-API-Patches/0008-Add-player-view-distance-API.patch new file mode 100644 index 0000000000..b22a2ae178 --- /dev/null +++ b/Spigot-API-Patches/0008-Add-player-view-distance-API.patch @@ -0,0 +1,34 @@ +From 43f1261cbeab869585712a558a8a333b7a316348 Mon Sep 17 00:00:00 2001 +From: Byteflux +Date: Mon, 29 Feb 2016 18:05:37 -0600 +Subject: [PATCH] Add player view distance API + + +diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java +index 2721f4c..ed8b8f1 100644 +--- a/src/main/java/org/bukkit/entity/Player.java ++++ b/src/main/java/org/bukkit/entity/Player.java +@@ -1284,6 +1284,20 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline + */ + public void setAffectsSpawning(boolean affects); + ++ /** ++ * Gets the view distance for this player ++ * ++ * @return the player's view distance ++ */ ++ public int getViewDistance(); ++ ++ /** ++ * Sets the view distance for this player ++ * ++ * @param viewDistance the player's view distance ++ */ ++ public void setViewDistance(int viewDistance); ++ + // Spigot start + public class Spigot extends Entity.Spigot + { +-- +2.7.2 + diff --git a/Spigot-API-Patches/0008-Check-PaperSpigot-versions.patch b/Spigot-API-Patches/0008-Check-PaperSpigot-versions.patch deleted file mode 100644 index 11ba5f103a..0000000000 --- a/Spigot-API-Patches/0008-Check-PaperSpigot-versions.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 386d76f2e47c4d3e3b824d6ec2c25d914fbe6e2c Mon Sep 17 00:00:00 2001 -From: Zach Brown -Date: Sun, 28 Dec 2014 16:28:21 -0600 -Subject: [PATCH] Check PaperSpigot versions - - -diff --git a/src/main/java/org/bukkit/command/defaults/VersionCommand.java b/src/main/java/org/bukkit/command/defaults/VersionCommand.java -index b55abdb..e91e1d8 100644 ---- a/src/main/java/org/bukkit/command/defaults/VersionCommand.java -+++ b/src/main/java/org/bukkit/command/defaults/VersionCommand.java -@@ -185,7 +185,21 @@ public class VersionCommand extends BukkitCommand { - private void obtainVersion() { - String version = Bukkit.getVersion(); - if (version == null) version = "Custom"; -- if (version.startsWith("git-Spigot-")) { -+ // PaperSpigot start -+ if (version.startsWith("git-PaperSpigot-")) { -+ String[] parts = version.substring("git-PaperSpigot-".length()).split("[-\\s]"); -+ int paperSpigotVersions = getDistance("paperspigot", parts[0]); -+ if (paperSpigotVersions == -1) { -+ setVersionMessage("Error obtaining version information"); -+ } else { -+ if (paperSpigotVersions == 0) { -+ setVersionMessage("You are running the latest version"); -+ } else { -+ setVersionMessage("You are " + paperSpigotVersions + " version(s) behind"); -+ } -+ } -+ } else if (version.startsWith("git-Spigot-")) { -+ // PaperSpigot end - String[] parts = version.substring("git-Spigot-".length()).split("-"); - int cbVersions = getDistance("craftbukkit", parts[1].substring(0, parts[1].indexOf(' '))); - int spigotVersions = getDistance("spigot", parts[0]); -@@ -232,17 +246,20 @@ public class VersionCommand extends BukkitCommand { - } - } - -- private static int getDistance(String repo, String hash) { -+ private static int getDistance(String repo, String currentVerInt) { // PaperSpigot - try { - BufferedReader reader = Resources.asCharSource( -- new URL("https://hub.spigotmc.org/stash/rest/api/1.0/projects/SPIGOT/repos/" + repo + "/commits?since=" + URLEncoder.encode(hash, "UTF-8") + "&withCounts=true"), -+ new URL("https://ci.destroystokyo.com/job/PaperSpigot/lastSuccessfulBuild/buildNumber"), // PaperSpigot - Charsets.UTF_8 - ).openBufferedStream(); - try { -- JSONObject obj = (JSONObject) new JSONParser().parse(reader); -- return ((Number) obj.get("totalCount")).intValue(); -- } catch (ParseException ex) { -- ex.printStackTrace(); -+ // PaperSpigot start -+ int newVer = Integer.decode(reader.readLine()); -+ int currentVer = Integer.decode(currentVerInt); -+ return newVer - currentVer; -+ } catch (NumberFormatException ex) { -+ //ex.printStackTrace(); -+ // PaperSpigot end - return -1; - } finally { - reader.close(); --- -2.7.1 - diff --git a/Spigot-API-Patches/0012-Add-BeaconEffectEvent.patch b/Spigot-API-Patches/0009-Add-BeaconEffectEvent.patch similarity index 83% rename from Spigot-API-Patches/0012-Add-BeaconEffectEvent.patch rename to Spigot-API-Patches/0009-Add-BeaconEffectEvent.patch index 8053936780..a281f94fc1 100644 --- a/Spigot-API-Patches/0012-Add-BeaconEffectEvent.patch +++ b/Spigot-API-Patches/0009-Add-BeaconEffectEvent.patch @@ -1,16 +1,16 @@ -From f126884b3b8347bc53ee7223e58f653028facacb Mon Sep 17 00:00:00 2001 +From 9070ef66368a21f22fca497c89a62e1dacded81a Mon Sep 17 00:00:00 2001 From: Byteflux -Date: Thu, 23 Jul 2015 11:45:20 -0700 +Date: Mon, 29 Feb 2016 18:09:40 -0600 Subject: [PATCH] Add BeaconEffectEvent -diff --git a/src/main/java/org/github/paperspigot/event/block/BeaconEffectEvent.java b/src/main/java/org/github/paperspigot/event/block/BeaconEffectEvent.java +diff --git a/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java b/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java new file mode 100644 -index 0000000..d9f9b95 +index 0000000..6579ae9 --- /dev/null -+++ b/src/main/java/org/github/paperspigot/event/block/BeaconEffectEvent.java ++++ b/src/main/java/com/destroystokyo/paper/event/block/BeaconEffectEvent.java @@ -0,0 +1,81 @@ -+package org.github.paperspigot.event.block; ++package com.destroystokyo.paper.event.block; + +import org.bukkit.block.Block; +import org.bukkit.entity.Player; @@ -92,5 +92,5 @@ index 0000000..d9f9b95 + } +} -- -2.5.1 +2.7.2 diff --git a/Spigot-API-Patches/0009-Add-FallingBlock-source-location-API.patch b/Spigot-API-Patches/0009-Add-FallingBlock-source-location-API.patch deleted file mode 100644 index a109a64438..0000000000 --- a/Spigot-API-Patches/0009-Add-FallingBlock-source-location-API.patch +++ /dev/null @@ -1,25 +0,0 @@ -From f255e1de552da583447620334ba2df03daabf61d Mon Sep 17 00:00:00 2001 -From: Byteflux -Date: Fri, 17 Apr 2015 02:43:00 -0700 -Subject: [PATCH] Add FallingBlock source location API - - -diff --git a/src/main/java/org/bukkit/entity/FallingBlock.java b/src/main/java/org/bukkit/entity/FallingBlock.java -index bc56fa2..240a278 100644 ---- a/src/main/java/org/bukkit/entity/FallingBlock.java -+++ b/src/main/java/org/bukkit/entity/FallingBlock.java -@@ -59,4 +59,11 @@ public interface FallingBlock extends Entity { - * @param hurtEntities whether entities will be damaged by this block. - */ - void setHurtEntities(boolean hurtEntities); -+ -+ /** -+ * Gets the source block location of the falling block -+ * -+ * @return the source block location the falling block was spawned from -+ */ -+ org.bukkit.Location getSourceLoc(); // PaperSpigot - Add FallingBlock source location API - } --- -2.5.2 - diff --git a/Spigot-API-Patches/0013-Add-PlayerInitialSpawnEvent.patch b/Spigot-API-Patches/0010-Add-PlayerInitialSpawnEvent.patch similarity index 71% rename from Spigot-API-Patches/0013-Add-PlayerInitialSpawnEvent.patch rename to Spigot-API-Patches/0010-Add-PlayerInitialSpawnEvent.patch index e4b4fc33f6..87a3a67939 100644 --- a/Spigot-API-Patches/0013-Add-PlayerInitialSpawnEvent.patch +++ b/Spigot-API-Patches/0010-Add-PlayerInitialSpawnEvent.patch @@ -1,21 +1,22 @@ -From 391fd5f868cb9dcafb5be14f3a1efec2eec4faec Mon Sep 17 00:00:00 2001 +From 0bae0f2147779322e69049cf9514e97f2b346a0e Mon Sep 17 00:00:00 2001 From: Steve Anton -Date: Tue, 22 Dec 2015 22:04:15 -0600 +Date: Mon, 29 Feb 2016 18:13:58 -0600 Subject: [PATCH] Add PlayerInitialSpawnEvent For modifying a player's initial spawn location as they join the server -diff --git a/src/main/java/org/bukkit/event/player/PlayerInitialSpawnEvent.java b/src/main/java/org/bukkit/event/player/PlayerInitialSpawnEvent.java +diff --git a/src/main/java/com/destroystokyo/paper/event/player/PlayerInitialSpawnEvent.java b/src/main/java/com/destroystokyo/paper/event/player/PlayerInitialSpawnEvent.java new file mode 100644 -index 0000000..be82593 +index 0000000..d1d6f33 --- /dev/null -+++ b/src/main/java/org/bukkit/event/player/PlayerInitialSpawnEvent.java -@@ -0,0 +1,42 @@ -+package org.bukkit.event.player; ++++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerInitialSpawnEvent.java +@@ -0,0 +1,43 @@ ++package com.destroystokyo.paper.event.player; + +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.event.HandlerList; ++import org.bukkit.event.player.PlayerEvent; + +public class PlayerInitialSpawnEvent extends PlayerEvent { + private static final HandlerList handlers = new HandlerList(); @@ -53,7 +54,6 @@ index 0000000..be82593 + return handlers; + } +} -\ No newline at end of file -- -2.6.4 +2.7.2 diff --git a/Spigot-API-Patches/0011-Add-player-view-distance-API.patch b/Spigot-API-Patches/0011-Add-player-view-distance-API.patch deleted file mode 100644 index f5e7b5540f..0000000000 --- a/Spigot-API-Patches/0011-Add-player-view-distance-API.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 4159fb44e468dfea3813b86d3c69956393ec8dde Mon Sep 17 00:00:00 2001 -From: Byteflux -Date: Wed, 1 Jul 2015 00:59:50 -0700 -Subject: [PATCH] Add player view distance API - - -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index f93dcec..7522d45 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -1183,6 +1183,26 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline - { - throw new UnsupportedOperationException( "Not supported yet" ); - } -+ -+ /** -+ * Get the view distance for this player -+ * -+ * @return View distance -+ */ -+ public int getViewDistance() -+ { -+ throw new UnsupportedOperationException( "Not supported yet" ); -+ } -+ -+ /** -+ * Set the view distance for this player -+ * -+ * @param viewDistance View distance -+ */ -+ public void setViewDistance(int viewDistance) -+ { -+ throw new UnsupportedOperationException( "Not supported yet" ); -+ } - } - - Spigot spigot(); --- -1.9.5.msysgit.1 - diff --git a/Spigot-API-Patches/0014-Timings-v2.patch b/Spigot-API-Patches/0011-Timings-v2.patch similarity index 94% rename from Spigot-API-Patches/0014-Timings-v2.patch rename to Spigot-API-Patches/0011-Timings-v2.patch index d790637e12..f953027474 100644 --- a/Spigot-API-Patches/0014-Timings-v2.patch +++ b/Spigot-API-Patches/0011-Timings-v2.patch @@ -1,14 +1,19 @@ -From b5e8582ab199f61b7dcdf2520e9a921907f4e35f Mon Sep 17 00:00:00 2001 +From 2913f79fb789598971e82b36b116972502375d43 Mon Sep 17 00:00:00 2001 From: Aikar -Date: Fri, 8 Jan 2016 23:12:28 -0600 +Date: Mon, 29 Feb 2016 18:48:17 -0600 Subject: [PATCH] Timings v2 diff --git a/pom.xml b/pom.xml -index d63151f..fe9d6d2 100644 +index 2e8b318..3be5e5b 100644 --- a/pom.xml +++ b/pom.xml -@@ -48,6 +48,13 @@ +@@ -1,4 +1,3 @@ +- + + 4.0.0 +@@ -48,6 +47,13 @@ @@ -1709,7 +1714,7 @@ index 0000000..fe19ea0 + parent.put("config", createObject( + pair("spigot", mapAsJSON(Bukkit.spigot().getSpigotConfig(), null)), + pair("bukkit", mapAsJSON(Bukkit.spigot().getBukkitConfig(), null)), -+ pair("paperspigot", mapAsJSON(Bukkit.spigot().getPaperSpigotConfig(), null)) ++ pair("paperspigot", mapAsJSON(Bukkit.spigot().getPaperConfig(), null)) + )); + + new TimingsExport(sender, parent, history).start(); @@ -2778,10 +2783,10 @@ index 0000000..3a288d2 + } +} diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 584fe11..a4396e8 100644 +index e19f3d7..8d602a3 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java -@@ -533,7 +533,6 @@ public final class Bukkit { +@@ -537,7 +537,6 @@ public final class Bukkit { */ public static void reload() { server.reload(); @@ -2790,10 +2795,10 @@ index 584fe11..a4396e8 100644 /** diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 26acdda..ae75bd4 100644 +index 92a5cbc..86fe389 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java -@@ -926,12 +926,27 @@ public interface Server extends PluginMessageRecipient { +@@ -949,12 +949,27 @@ public interface Server extends PluginMessageRecipient { public class Spigot { @@ -2814,7 +2819,7 @@ index 26acdda..ae75bd4 100644 + throw new UnsupportedOperationException("Not supported yet."); + } + -+ public org.bukkit.configuration.file.YamlConfiguration getPaperSpigotConfig() ++ public org.bukkit.configuration.file.YamlConfiguration getPaperConfig() + { + throw new UnsupportedOperationException("Not supported yet."); + } @@ -2896,26 +2901,56 @@ index a08a49d..a300ae7 100644 fallbackPrefix = fallbackPrefix.toLowerCase().trim(); boolean registered = register(label, command, false, fallbackPrefix); diff --git a/src/main/java/org/bukkit/command/defaults/TimingsCommand.java b/src/main/java/org/bukkit/command/defaults/TimingsCommand.java -index 9782a3b..80e0b0f 100644 +deleted file mode 100644 +index fc59aa3..0000000 --- a/src/main/java/org/bukkit/command/defaults/TimingsCommand.java -+++ b/src/main/java/org/bukkit/command/defaults/TimingsCommand.java -@@ -33,87 +33,22 @@ import org.spigotmc.CustomTimingsHandler; - // Spigot end - - public class TimingsCommand extends BukkitCommand { ++++ /dev/null +@@ -1,253 +0,0 @@ +-package org.bukkit.command.defaults; +- +-import java.io.File; +-import java.io.IOException; +-import java.io.PrintStream; +-import java.util.ArrayList; +-import java.util.List; +- +-import org.apache.commons.lang.Validate; +-import org.bukkit.Bukkit; +-import org.bukkit.ChatColor; +-import org.bukkit.command.CommandSender; +-import org.bukkit.event.Event; +-import org.bukkit.event.HandlerList; +-import org.bukkit.plugin.Plugin; +-import org.bukkit.plugin.RegisteredListener; +-import org.bukkit.plugin.TimedRegisteredListener; +-import org.bukkit.util.StringUtil; +- +-import com.google.common.collect.ImmutableList; +- +-// Spigot start +-import java.io.ByteArrayOutputStream; +-import java.io.OutputStream; +-import java.net.HttpURLConnection; +-import java.net.URL; +-import java.net.URLEncoder; +-import java.util.logging.Level; +- +-import org.bukkit.command.RemoteConsoleCommandSender; +-import org.bukkit.plugin.SimplePluginManager; +-import org.spigotmc.CustomTimingsHandler; +-// Spigot end +- +-public class TimingsCommand extends BukkitCommand { - private static final List TIMINGS_SUBCOMMANDS = ImmutableList.of("report", "reset", "on", "off", "paste"); // Spigot - public static long timingStart = 0; // Spigot -+ public static final List TIMINGS_SUBCOMMANDS = ImmutableList.of("merged", "reset", "separate"); - - public TimingsCommand(String name) { - super(name); +- +- public TimingsCommand(String name) { +- super(name); - this.description = "Manages Spigot Timings data to see performance of the server."; // Spigot - this.usageMessage = "/timings "; // Spigot -+ this.description = "Records timings for all plugin events"; -+ this.usageMessage = "/timings "; - this.setPermission("bukkit.command.timings"); - } - +- this.setPermission("bukkit.command.timings"); +- } +- - // Spigot start - redesigned Timings Command - public void executeSpigotTimings(CommandSender sender, String[] args) { - if ( "on".equals( args[0] ) ) @@ -2967,7 +3002,7 @@ index 9782a3b..80e0b0f 100644 - } - - sender.sendMessage("Timings written to " + timings.getPath()); -- sender.sendMessage( "Paste contents of file into form at http://aikar.co/timings.php to read results." ); +- sender.sendMessage( "Paste contents of file into form at http://www.spigotmc.org/go/timings to read results." ); - - } catch (IOException e) { - } finally { @@ -2979,22 +3014,99 @@ index 9782a3b..80e0b0f 100644 - } - // Spigot end - - @Override - public boolean execute(CommandSender sender, String currentAlias, String[] args) { - if (!testPermission(sender)) return true; +- @Override +- public boolean execute(CommandSender sender, String currentAlias, String[] args) { +- if (!testPermission(sender)) return true; - if (args.length < 1) { // Spigot -+ if (args.length != 1) { - sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage); - return false; - } +- sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage); +- return false; +- } - if (true) { executeSpigotTimings(sender, args); return true; } // Spigot - if (!sender.getServer().getPluginManager().useTimings()) { - sender.sendMessage("Please enable timings by setting \"settings.plugin-profiling\" to true in bukkit.yml"); - return true; -@@ -199,55 +134,4 @@ public class TimingsCommand extends BukkitCommand { - } - return ImmutableList.of(); - } +- if (!sender.getServer().getPluginManager().useTimings()) { +- sender.sendMessage("Please enable timings by setting \"settings.plugin-profiling\" to true in bukkit.yml"); +- return true; +- } +- +- boolean separate = "separate".equalsIgnoreCase(args[0]); +- if ("reset".equalsIgnoreCase(args[0])) { +- for (HandlerList handlerList : HandlerList.getHandlerLists()) { +- for (RegisteredListener listener : handlerList.getRegisteredListeners()) { +- if (listener instanceof TimedRegisteredListener) { +- ((TimedRegisteredListener)listener).reset(); +- } +- } +- } +- sender.sendMessage("Timings reset"); +- } else if ("merged".equalsIgnoreCase(args[0]) || separate) { +- +- int index = 0; +- int pluginIdx = 0; +- File timingFolder = new File("timings"); +- timingFolder.mkdirs(); +- File timings = new File(timingFolder, "timings.txt"); +- File names = null; +- while (timings.exists()) timings = new File(timingFolder, "timings" + (++index) + ".txt"); +- PrintStream fileTimings = null; +- PrintStream fileNames = null; +- try { +- fileTimings = new PrintStream(timings); +- if (separate) { +- names = new File(timingFolder, "names" + index + ".txt"); +- fileNames = new PrintStream(names); +- } +- for (Plugin plugin : Bukkit.getPluginManager().getPlugins()) { +- pluginIdx++; +- long totalTime = 0; +- if (separate) { +- fileNames.println(pluginIdx + " " + plugin.getDescription().getFullName()); +- fileTimings.println("Plugin " + pluginIdx); +- } +- else fileTimings.println(plugin.getDescription().getFullName()); +- for (RegisteredListener listener : HandlerList.getRegisteredListeners(plugin)) { +- if (listener instanceof TimedRegisteredListener) { +- TimedRegisteredListener trl = (TimedRegisteredListener) listener; +- long time = trl.getTotalTime(); +- int count = trl.getCount(); +- if (count == 0) continue; +- long avg = time / count; +- totalTime += time; +- Class eventClass = trl.getEventClass(); +- if (count > 0 && eventClass != null) { +- fileTimings.println(" " + eventClass.getSimpleName() + (trl.hasMultiple() ? " (and sub-classes)" : "") + " Time: " + time + " Count: " + count + " Avg: " + avg); +- } +- } +- } +- fileTimings.println(" Total time " + totalTime + " (" + totalTime / 1000000000 + "s)"); +- } +- sender.sendMessage("Timings written to " + timings.getPath()); +- if (separate) sender.sendMessage("Names written to " + names.getPath()); +- } catch (IOException e) { +- } finally { +- if (fileTimings != null) { +- fileTimings.close(); +- } +- if (fileNames != null) { +- fileNames.close(); +- } +- } +- } else { +- sender.sendMessage(ChatColor.RED + "Usage: " + usageMessage); +- return false; +- } +- return true; +- } +- +- @Override +- public List tabComplete(CommandSender sender, String alias, String[] args) { +- Validate.notNull(sender, "Sender cannot be null"); +- Validate.notNull(args, "Arguments cannot be null"); +- Validate.notNull(alias, "Alias cannot be null"); +- +- if (args.length == 1) { +- return StringUtil.copyPartialMatches(args[0], TIMINGS_SUBCOMMANDS, new ArrayList(TIMINGS_SUBCOMMANDS.size())); +- } +- return ImmutableList.of(); +- } - - // Spigot start - private static class PasteThread extends Thread @@ -3037,7 +3149,7 @@ index 9782a3b..80e0b0f 100644 - - String location = con.getHeaderField( "Location" ); - String pasteID = location.substring( "http://paste.ubuntu.com/".length(), location.length() - 1 ); -- sender.sendMessage( ChatColor.GREEN + "Timings results can be viewed at http://aikar.co/timings.php?url=" + pasteID ); +- sender.sendMessage( ChatColor.GREEN + "Timings results can be viewed at http://www.spigotmc.org/go/timings?url=" + pasteID ); - } catch ( IOException ex ) - { - sender.sendMessage( ChatColor.RED + "Error pasting timings, check your console for more information" ); @@ -3046,14 +3158,14 @@ index 9782a3b..80e0b0f 100644 - } - } - // Spigot end - } +-} diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 7522d45..c0ebe65 100644 +index ed8b8f1..855bde5 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -1203,6 +1203,11 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline - { - throw new UnsupportedOperationException( "Not supported yet" ); +@@ -1384,6 +1384,11 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline + public void sendMessage(net.md_5.bungee.api.chat.BaseComponent... components) { + throw new UnsupportedOperationException("Not supported yet."); } + + public int getPing() @@ -3426,5 +3538,5 @@ index 8d98297..7e89b97 100644 - } } -- -2.7.1 +2.7.2 diff --git a/Spigot-API-Patches/0015-Add-Location-support-to-tab-completers-vanilla-featu.patch b/Spigot-API-Patches/0012-Add-Location-support-to-tab-completers-vanilla-featu.patch similarity index 81% rename from Spigot-API-Patches/0015-Add-Location-support-to-tab-completers-vanilla-featu.patch rename to Spigot-API-Patches/0012-Add-Location-support-to-tab-completers-vanilla-featu.patch index 239c782119..b030d32962 100644 --- a/Spigot-API-Patches/0015-Add-Location-support-to-tab-completers-vanilla-featu.patch +++ b/Spigot-API-Patches/0012-Add-Location-support-to-tab-completers-vanilla-featu.patch @@ -1,12 +1,12 @@ -From c2382d5656ff7e3c1b42ecc8cec1278b60b366d9 Mon Sep 17 00:00:00 2001 +From 78cc4ff51183b89e12aa39a47d39bf06497613ea Mon Sep 17 00:00:00 2001 From: DemonWav -Date: Sat, 30 Jan 2016 18:58:09 -0600 +Date: Mon, 29 Feb 2016 19:37:41 -0600 Subject: [PATCH] Add Location support to tab completers (vanilla feature missing in CraftBukkit) diff --git a/src/main/java/org/bukkit/command/Command.java b/src/main/java/org/bukkit/command/Command.java -index 548d570..c126a1e 100644 +index 548d570..18c54b3 100644 --- a/src/main/java/org/bukkit/command/Command.java +++ b/src/main/java/org/bukkit/command/Command.java @@ -8,6 +8,7 @@ import java.util.Set; @@ -17,11 +17,12 @@ index 548d570..c126a1e 100644 import org.bukkit.Server; import org.bukkit.entity.Player; import org.bukkit.entity.minecart.CommandMinecart; -@@ -109,6 +110,30 @@ public abstract class Command { +@@ -109,6 +110,31 @@ public abstract class Command { return matchedPlayers; } -+ // PaperSpigot start - location tab-completes ++ // Paper start - location tab-completes ++ + /** + * Executed on tab completion for this command, returning a list of options the player can tab through. This method + * returns the {@link Location} of the block the player is looking at at the time of the tab complete. @@ -31,46 +32,40 @@ index 548d570..c126a1e 100644 + * attempts the tab complete. For this to be valid, the block must be highlighted by the player (i.e. the player is + * close enough to interact with the block). + * -+ * @param sender Source object which is executing this command -+ * @param alias the alias being used -+ * @param args All arguments passed to the command, split via ' ' ++ * @param sender Source object which is executing this command ++ * @param alias the alias being used ++ * @param args All arguments passed to the command, split via ' ' + * @param location the location of the block the player is looking at + * @return a list of tab-completions for the specified arguments. This -+ * will never be null. List may be immutable. ++ * will never be null. List may be immutable. + * @throws IllegalArgumentException if sender, alias, or args is null + */ + public List tabComplete(CommandSender sender, String alias, String[] args, Location location) throws IllegalArgumentException { + // Simply default to the standard tab-complete, subclasses can override this if needed + return tabComplete(sender, alias, args); + } -+ // PaperSpigot end ++ // Paper end + /** * Returns the name of this command * diff --git a/src/main/java/org/bukkit/command/PluginCommand.java b/src/main/java/org/bukkit/command/PluginCommand.java -index 3bfa31f..597d7c2 100644 +index 3bfa31f..9b93872 100644 --- a/src/main/java/org/bukkit/command/PluginCommand.java +++ b/src/main/java/org/bukkit/command/PluginCommand.java -@@ -1,10 +1,11 @@ - package org.bukkit.command; +@@ -3,6 +3,7 @@ package org.bukkit.command; + import java.util.List; --import java.util.List; -- import org.apache.commons.lang.Validate; +import org.bukkit.Location; import org.bukkit.plugin.Plugin; -+import java.util.List; -+ /** - * Represents a {@link Command} belonging to a plugin - */ @@ -122,6 +123,15 @@ public final class PluginCommand extends Command implements PluginIdentifiableCo */ @Override public java.util.List tabComplete(CommandSender sender, String alias, String[] args) throws CommandException, IllegalArgumentException { -+ return tabComplete(sender, alias, args, null); // PaperSpigot - The code from this method has been (slightly modified) moved to the Location method. ++ return tabComplete(sender, alias, args, null); // Paper - The code from this method has been (slightly modified) moved to the Location method. + } + + // PaperSpigot start - location tab-completes @@ -87,11 +82,11 @@ index 3bfa31f..597d7c2 100644 try { if (completer != null) { - completions = completer.onTabComplete(sender, this, alias, args); -+ completions = completer.onTabComplete(sender, this, alias, args, location); // PaperSpigot - add location argument ++ completions = completer.onTabComplete(sender, this, alias, args, location); // Paper - add location argument } if (completions == null && executor instanceof TabCompleter) { - completions = ((TabCompleter) executor).onTabComplete(sender, this, alias, args); -+ completions = ((TabCompleter) executor).onTabComplete(sender, this, alias, args, location); // PaperSpigot - add location argument ++ completions = ((TabCompleter) executor).onTabComplete(sender, this, alias, args, location); // Paper - add location argument } } catch (Throwable ex) { StringBuilder message = new StringBuilder(); @@ -99,12 +94,12 @@ index 3bfa31f..597d7c2 100644 } return completions; } -+ // PaperSpigot end ++ // Paper end @Override public String toString() { diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java -index a300ae7..12d9232 100644 +index a300ae7..980c4fd 100644 --- a/src/main/java/org/bukkit/command/SimpleCommandMap.java +++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java @@ -12,6 +12,7 @@ import java.util.Map; @@ -119,12 +114,12 @@ index a300ae7..12d9232 100644 } public List tabComplete(CommandSender sender, String cmdLine) { -+ return tabComplete(sender, cmdLine, null); // PaperSpigot - location tab-completes, code moved below ++ return tabComplete(sender, cmdLine, null); // Paper - location tab-completes, code moved below + } + -+ // PaperSpigot start - location tab-completes -+ /* -+ this code was copied, except for the noted change, from tabComplete(CommandSender sender, String cmdLine) ++ // Paper start - location tab-completes ++ /** ++ * This code was copied, except for the noted change, from tabComplete(CommandSender sender, String cmdLine) + */ + public List tabComplete(CommandSender sender, String cmdLine, Location location) { Validate.notNull(sender, "Sender cannot be null"); @@ -135,19 +130,19 @@ index a300ae7..12d9232 100644 try { - return target.tabComplete(sender, commandName, args); -+ return target.tabComplete(sender, commandName, args, location); // PaperSpigot - add location argument ++ return target.tabComplete(sender, commandName, args, location); // Paper - add location argument } catch (CommandException ex) { throw ex; } catch (Throwable ex) { throw new CommandException("Unhandled exception executing tab-completer for '" + cmdLine + "' in " + target, ex); } } -+ // PaperSpigot end ++ // Paper end public Collection getCommands() { return Collections.unmodifiableCollection(knownCommands.values()); diff --git a/src/main/java/org/bukkit/command/TabCompleter.java b/src/main/java/org/bukkit/command/TabCompleter.java -index 6d61e3a..2cb971c 100644 +index 6d61e3a..85b10e5 100644 --- a/src/main/java/org/bukkit/command/TabCompleter.java +++ b/src/main/java/org/bukkit/command/TabCompleter.java @@ -1,5 +1,7 @@ @@ -163,12 +158,12 @@ index 6d61e3a..2cb971c 100644 */ public List onTabComplete(CommandSender sender, Command command, String alias, String[] args); + -+ // PaperSpigot start - location tab-completes ++ // Paper start - location tab-completes + default List onTabComplete(CommandSender sender, Command command, String alias, String[] args, Location location) { + return onTabComplete(sender, command, alias, args); + } -+ // PaperSpigot end ++ // Paper end } -- -2.7.1 +2.7.2 diff --git a/Spigot-API-Patches/0016-Made-EntityDismountEvent-Cancellable.patch b/Spigot-API-Patches/0013-Made-EntityDismountEvent-Cancellable.patch similarity index 68% rename from Spigot-API-Patches/0016-Made-EntityDismountEvent-Cancellable.patch rename to Spigot-API-Patches/0013-Made-EntityDismountEvent-Cancellable.patch index 0a0c7941de..16277b76f3 100644 --- a/Spigot-API-Patches/0016-Made-EntityDismountEvent-Cancellable.patch +++ b/Spigot-API-Patches/0013-Made-EntityDismountEvent-Cancellable.patch @@ -1,36 +1,36 @@ -From 09b55d7828f2499a4179e60f0be9dbb6b7888ba8 Mon Sep 17 00:00:00 2001 +From ae556b9d833294cf0e1f865b6851447a11cdcda5 Mon Sep 17 00:00:00 2001 From: Nik Gil -Date: Mon, 1 Feb 2016 23:36:31 -0700 +Date: Mon, 29 Feb 2016 19:42:10 -0600 Subject: [PATCH] Made EntityDismountEvent Cancellable diff --git a/src/main/java/org/spigotmc/event/entity/EntityDismountEvent.java b/src/main/java/org/spigotmc/event/entity/EntityDismountEvent.java -index 24d4942..b35c7c1 100644 +index 24d4942..ce989bb 100644 --- a/src/main/java/org/spigotmc/event/entity/EntityDismountEvent.java +++ b/src/main/java/org/spigotmc/event/entity/EntityDismountEvent.java -@@ -4,11 +4,15 @@ import org.bukkit.entity.Entity; +@@ -1,6 +1,7 @@ + package org.spigotmc.event.entity; + + import org.bukkit.entity.Entity; ++import org.bukkit.event.Cancellable; import org.bukkit.event.HandlerList; import org.bukkit.event.entity.EntityEvent; -+// PaperSpigot start -+import org.bukkit.event.Cancellable; -+// PaperSpigot end -+ - /** +@@ -8,7 +9,7 @@ import org.bukkit.event.entity.EntityEvent; * Called when an entity stops riding another entity. * */ -public class EntityDismountEvent extends EntityEvent -+public class EntityDismountEvent extends EntityEvent implements Cancellable // PaperSpigot - implement Cancellable ++public class EntityDismountEvent extends EntityEvent implements Cancellable // Paper - implement Cancellable { private static final HandlerList handlers = new HandlerList(); -@@ -36,4 +40,16 @@ public class EntityDismountEvent extends EntityEvent +@@ -36,4 +37,16 @@ public class EntityDismountEvent extends EntityEvent { return handlers; } + -+ // PaperSpigot start - implement Cancellable methods ++ // Paper start - Implement cancellable methods + @Override + public boolean isCancelled() { + return cancelled; @@ -40,8 +40,8 @@ index 24d4942..b35c7c1 100644 + public void setCancelled(boolean cancelled) { + this.cancelled = cancelled; + } -+ // PaperSpigot end ++ // Paper end } -- -2.7.0 +2.7.2 diff --git a/Spigot-API-Patches/0017-Automatically-disable-plugins-that-fail-to-load.patch b/Spigot-API-Patches/0014-Automatically-disable-plugins-that-fail-to-load.patch similarity index 77% rename from Spigot-API-Patches/0017-Automatically-disable-plugins-that-fail-to-load.patch rename to Spigot-API-Patches/0014-Automatically-disable-plugins-that-fail-to-load.patch index d85c7caa15..78feefc3f0 100644 --- a/Spigot-API-Patches/0017-Automatically-disable-plugins-that-fail-to-load.patch +++ b/Spigot-API-Patches/0014-Automatically-disable-plugins-that-fail-to-load.patch @@ -1,24 +1,24 @@ -From 94997a931505151e58013ba362249d63daa09654 Mon Sep 17 00:00:00 2001 +From 9003dd80621ac325f76aab4af72047c9da57f691 Mon Sep 17 00:00:00 2001 From: Aikar -Date: Thu, 11 Feb 2016 23:21:31 -0500 +Date: Mon, 29 Feb 2016 19:45:21 -0600 Subject: [PATCH] Automatically disable plugins that fail to load diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -index 4983ea8..b057b05 100644 +index 4983ea8..93a43dd 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java @@ -332,6 +332,10 @@ public final class JavaPluginLoader implements PluginLoader { jPlugin.setEnabled(true); } catch (Throwable ex) { server.getLogger().log(Level.SEVERE, "Error occurred while enabling " + plugin.getDescription().getFullName() + " (Is it up to date?)", ex); -+ // PaperSpigot start - Disable plugins that fail to load ++ // Paper start - Disable plugins that fail to load + disablePlugin(jPlugin); + return; -+ // PaperSpigot end ++ // Paper end } // Perhaps abort here, rather than continue going, but as it stands, -- -2.7.1 +2.7.2 diff --git a/Spigot-API-Patches/0015-Expose-server-CommandMap.patch b/Spigot-API-Patches/0015-Expose-server-CommandMap.patch new file mode 100644 index 0000000000..1e2c2b8a8e --- /dev/null +++ b/Spigot-API-Patches/0015-Expose-server-CommandMap.patch @@ -0,0 +1,74 @@ +From 7c9892de7be9a27ba1014d2ee6202c70230b114d Mon Sep 17 00:00:00 2001 +From: kashike +Date: Mon, 29 Feb 2016 19:48:59 -0600 +Subject: [PATCH] Expose server CommandMap + + +diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java +index 8d602a3..b6a0b40 100644 +--- a/src/main/java/org/bukkit/Bukkit.java ++++ b/src/main/java/org/bukkit/Bukkit.java +@@ -17,10 +17,7 @@ import org.bukkit.boss.BarColor; + import org.bukkit.boss.BarFlag; + import org.bukkit.boss.BarStyle; + import org.bukkit.boss.BossBar; +-import org.bukkit.command.CommandException; +-import org.bukkit.command.CommandSender; +-import org.bukkit.command.ConsoleCommandSender; +-import org.bukkit.command.PluginCommand; ++import org.bukkit.command.*; + import org.bukkit.entity.Entity; + import org.bukkit.entity.Player; + import org.bukkit.event.inventory.InventoryType; +@@ -1156,6 +1153,17 @@ public final class Bukkit { + return server.getUnsafe(); + } + ++ // Paper start ++ /** ++ * Gets the active {@link CommandMap} ++ * ++ * @return the active command map ++ */ ++ public static CommandMap getCommandMap() { ++ return server.getCommandMap(); ++ } ++ // Paper end ++ + public static Server.Spigot spigot() + { + return server.spigot(); +diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java +index 86fe389..9ee3815 100644 +--- a/src/main/java/org/bukkit/Server.java ++++ b/src/main/java/org/bukkit/Server.java +@@ -17,10 +17,7 @@ import org.bukkit.boss.BarColor; + import org.bukkit.boss.BarFlag; + import org.bukkit.boss.BarStyle; + import org.bukkit.boss.BossBar; +-import org.bukkit.command.CommandException; +-import org.bukkit.command.CommandSender; +-import org.bukkit.command.ConsoleCommandSender; +-import org.bukkit.command.PluginCommand; ++import org.bukkit.command.*; + import org.bukkit.entity.Entity; + import org.bukkit.entity.Player; + import org.bukkit.event.inventory.InventoryType; +@@ -940,6 +937,14 @@ public interface Server extends PluginMessageRecipient { + */ + public double[] getTPS(); + ++ // Paper start ++ /** ++ * Gets the active {@link CommandMap} ++ * ++ * @return the active command map ++ */ ++ CommandMap getCommandMap(); ++ + /** + * @see UnsafeValues + * @return the unsafe values instance +-- +2.7.2 + diff --git a/Spigot-API-Patches/0019-Graduate-bungeecord-chat-API-from-spigot-subclasses.patch b/Spigot-API-Patches/0016-Graduate-bungeecord-chat-API-from-spigot-subclasses.patch similarity index 91% rename from Spigot-API-Patches/0019-Graduate-bungeecord-chat-API-from-spigot-subclasses.patch rename to Spigot-API-Patches/0016-Graduate-bungeecord-chat-API-from-spigot-subclasses.patch index c1a81bdbd0..254b7bd7a0 100644 --- a/Spigot-API-Patches/0019-Graduate-bungeecord-chat-API-from-spigot-subclasses.patch +++ b/Spigot-API-Patches/0016-Graduate-bungeecord-chat-API-from-spigot-subclasses.patch @@ -1,11 +1,11 @@ -From 0cedba608ed4c22ed465f612d48437ec5955953b Mon Sep 17 00:00:00 2001 +From 47ecb6bf0557814cd48f9b732e1bd5bee223f923 Mon Sep 17 00:00:00 2001 From: Zach Brown -Date: Tue, 16 Feb 2016 19:15:30 -0600 +Date: Mon, 29 Feb 2016 19:54:32 -0600 Subject: [PATCH] Graduate bungeecord chat API from spigot subclasses diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index f0e1b99..8fbc828 100644 +index b6a0b40..f93ca2e 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java @@ -292,6 +292,26 @@ public final class Bukkit { @@ -36,7 +36,7 @@ index f0e1b99..8fbc828 100644 * Gets the name of the update folder. The update folder is used to safely * update plugins at the right moment on a plugin load. diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 316336d..1b62463 100644 +index 9ee3815..77d4f34 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java @@ -238,6 +238,22 @@ public interface Server extends PluginMessageRecipient { @@ -63,10 +63,10 @@ index 316336d..1b62463 100644 * Gets the name of the update folder. The update folder is used to safely * update plugins at the right moment on a plugin load. diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index c0ebe65..9ebfa47 100644 +index 855bde5..024b8dd 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -330,6 +330,22 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline +@@ -331,6 +331,22 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline */ public void sendMap(MapView map); @@ -90,5 +90,5 @@ index c0ebe65..9ebfa47 100644 * Forces an update of the player's entire inventory. * -- -2.7.1 +2.7.2 diff --git a/Spigot-API-Patches/0020-Player-Tab-List-and-Title-APIs.patch b/Spigot-API-Patches/0017-Player-Tab-List-and-Title-APIs.patch similarity index 94% rename from Spigot-API-Patches/0020-Player-Tab-List-and-Title-APIs.patch rename to Spigot-API-Patches/0017-Player-Tab-List-and-Title-APIs.patch index 6f287798ee..3d592a99cb 100644 --- a/Spigot-API-Patches/0020-Player-Tab-List-and-Title-APIs.patch +++ b/Spigot-API-Patches/0017-Player-Tab-List-and-Title-APIs.patch @@ -1,154 +1,16 @@ -From 9da88eae7c63d03c2303ddfa86cededaf1244d70 Mon Sep 17 00:00:00 2001 +From 084b100716809ddb5c563ed03318c2cb010f7382 Mon Sep 17 00:00:00 2001 From: Techcable -Date: Tue, 16 Feb 2016 19:51:11 -0600 +Date: Mon, 29 Feb 2016 20:02:40 -0600 Subject: [PATCH] Player Tab List and Title APIs -diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 9ebfa47..d02fe56 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -19,6 +19,9 @@ import org.bukkit.conversations.Conversable; - import org.bukkit.map.MapView; - import org.bukkit.plugin.messaging.PluginMessageRecipient; - import org.bukkit.scoreboard.Scoreboard; -+// PaperSpigot start -+import org.github.paperspigot.Title; -+// PaperSpigot end - - /** - * Represents a player, connected or not -@@ -344,6 +347,112 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline - * @param components the components to send - */ - public void sendMessage(net.md_5.bungee.api.chat.BaseComponent... components); -+ -+ /** -+ * Set the text displayed in the player list header and footer for this player -+ * -+ * @param header content for the top of the player list -+ * @param footer content for the bottom of the player list -+ */ -+ public void setPlayerListHeaderFooter(net.md_5.bungee.api.chat.BaseComponent[] header, net.md_5.bungee.api.chat.BaseComponent[] footer); -+ -+ /** -+ * Set the text displayed in the player list header and footer for this player -+ * -+ * @param header content for the top of the player list -+ * @param footer content for the bottom of the player list -+ */ -+ public void setPlayerListHeaderFooter(net.md_5.bungee.api.chat.BaseComponent header, net.md_5.bungee.api.chat.BaseComponent footer); -+ -+ /** -+ * Update the times for titles displayed to the player -+ * -+ * @param fadeInTicks ticks to fade-in -+ * @param stayTicks ticks to stay visible -+ * @param fadeOutTicks ticks to fade-out -+ * @deprecated Use {@link #updateTitle(Title)} -+ */ -+ @Deprecated -+ public void setTitleTimes(int fadeInTicks, int stayTicks, int fadeOutTicks); -+ -+ /** -+ * Update the subtitle of titles displayed to the player -+ * @deprecated Use {@link #updateTitle(Title)} -+ */ -+ @Deprecated -+ public void setSubtitle(net.md_5.bungee.api.chat.BaseComponent[] subtitle); -+ -+ /** -+ * Update the subtitle of titles displayed to the player -+ * @deprecated Use {@link #updateTitle(Title)} -+ */ -+ @Deprecated -+ public void setSubtitle(net.md_5.bungee.api.chat.BaseComponent subtitle); -+ -+ /** -+ * Show the given title to the player, along with the last subtitle set, using the last set times -+ * @deprecated Use {@link #sendTitle(Title)} or {@link #updateTitle(Title)} -+ */ -+ @Deprecated -+ public void showTitle(net.md_5.bungee.api.chat.BaseComponent[] title); -+ -+ /** -+ * Show the given title to the player, along with the last subtitle set, using the last set times -+ * @deprecated Use {@link #sendTitle(Title)} or {@link #updateTitle(Title)} -+ */ -+ @Deprecated -+ public void showTitle(net.md_5.bungee.api.chat.BaseComponent title); -+ -+ /** -+ * Show the given title and subtitle to the player using the given times -+ * -+ * @param title big text -+ * @param subtitle little text under it -+ * @param fadeInTicks ticks to fade-in -+ * @param stayTicks ticks to stay visible -+ * @param fadeOutTicks ticks to fade-out -+ * @deprecated Use {@link #sendTitle(Title)} or {@link #updateTitle(Title)} -+ */ -+ @Deprecated -+ public void showTitle(net.md_5.bungee.api.chat.BaseComponent[] title, net.md_5.bungee.api.chat.BaseComponent[] subtitle, int fadeInTicks, int stayTicks, int fadeOutTicks); -+ -+ /** -+ * Show the given title and subtitle to the player using the given times -+ * -+ * @param title big text -+ * @param subtitle little text under it -+ * @param fadeInTicks ticks to fade-in -+ * @param stayTicks ticks to stay visible -+ * @param fadeOutTicks ticks to fade-out -+ * @deprecated Use {@link #sendTitle(Title)} or {@link #updateTitle(Title)} -+ */ -+ @Deprecated -+ public void showTitle(net.md_5.bungee.api.chat.BaseComponent title, net.md_5.bungee.api.chat.BaseComponent subtitle, int fadeInTicks, int stayTicks, int fadeOutTicks); -+ -+ /** -+ * Show the title to the player, overriding any previously displayed title. -+ * -+ *

This method overrides any previous title, use {@link #updateTitle(Title)} to change the existing one.

-+ * -+ * @param title the title to send -+ * @throws NullPointerException if the title is null -+ */ -+ void sendTitle(Title title); -+ -+ /** -+ * Show the title to the player, overriding any previously displayed title. -+ * -+ *

This method doesn't override previous titles, but changes their values.

-+ * -+ * @param title the title to send -+ * @throws NullPointerException if title is null -+ */ -+ void updateTitle(Title title); -+ -+ /** -+ * Hide any title that is currently visible to the player -+ */ -+ public void hideTitle(); - // Paper end - - /** -@@ -1086,9 +1195,8 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline - - /** - * Resets the title displayed to the player. -- * @deprecated API subject to change. - */ -- @Deprecated -+ // Paper - Undeprecate - public void resetTitle(); - - // Spigot start -diff --git a/src/main/java/org/github/paperspigot/Title.java b/src/main/java/org/github/paperspigot/Title.java +diff --git a/src/main/java/com/destroystokyo/paper/Title.java b/src/main/java/com/destroystokyo/paper/Title.java new file mode 100644 -index 0000000..27f9bc2 +index 0000000..e1ecd44 --- /dev/null -+++ b/src/main/java/org/github/paperspigot/Title.java ++++ b/src/main/java/com/destroystokyo/paper/Title.java @@ -0,0 +1,358 @@ -+package org.github.paperspigot; ++package com.destroystokyo.paper; + +import net.md_5.bungee.api.chat.BaseComponent; +import net.md_5.bungee.api.chat.TextComponent; @@ -506,7 +368,144 @@ index 0000000..27f9bc2 + } + } +} -\ No newline at end of file +diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java +index 024b8dd..50a6a41 100644 +--- a/src/main/java/org/bukkit/entity/Player.java ++++ b/src/main/java/org/bukkit/entity/Player.java +@@ -2,6 +2,7 @@ package org.bukkit.entity; + + import java.net.InetSocketAddress; + ++import com.destroystokyo.paper.Title; + import org.bukkit.Achievement; + import org.bukkit.ChatColor; + import org.bukkit.Effect; +@@ -345,6 +346,116 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline + * @param components the components to send + */ + public void sendMessage(net.md_5.bungee.api.chat.BaseComponent... components); ++ ++ /** ++ * Set the text displayed in the player list header and footer for this player ++ * ++ * @param header content for the top of the player list ++ * @param footer content for the bottom of the player list ++ */ ++ public void setPlayerListHeaderFooter(net.md_5.bungee.api.chat.BaseComponent[] header, net.md_5.bungee.api.chat.BaseComponent[] footer); ++ ++ /** ++ * Set the text displayed in the player list header and footer for this player ++ * ++ * @param header content for the top of the player list ++ * @param footer content for the bottom of the player list ++ */ ++ public void setPlayerListHeaderFooter(net.md_5.bungee.api.chat.BaseComponent header, net.md_5.bungee.api.chat.BaseComponent footer); ++ ++ /** ++ * Update the times for titles displayed to the player ++ * ++ * @param fadeInTicks ticks to fade-in ++ * @param stayTicks ticks to stay visible ++ * @param fadeOutTicks ticks to fade-out ++ * @deprecated Use {@link #updateTitle(Title)} ++ */ ++ @Deprecated ++ public void setTitleTimes(int fadeInTicks, int stayTicks, int fadeOutTicks); ++ ++ /** ++ * Update the subtitle of titles displayed to the player ++ * ++ * @deprecated Use {@link #updateTitle(Title)} ++ */ ++ @Deprecated ++ public void setSubtitle(net.md_5.bungee.api.chat.BaseComponent[] subtitle); ++ ++ /** ++ * Update the subtitle of titles displayed to the player ++ * ++ * @deprecated Use {@link #updateTitle(Title)} ++ */ ++ @Deprecated ++ public void setSubtitle(net.md_5.bungee.api.chat.BaseComponent subtitle); ++ ++ /** ++ * Show the given title to the player, along with the last subtitle set, using the last set times ++ * ++ * @deprecated Use {@link #sendTitle(Title)} or {@link #updateTitle(Title)} ++ */ ++ @Deprecated ++ public void showTitle(net.md_5.bungee.api.chat.BaseComponent[] title); ++ ++ /** ++ * Show the given title to the player, along with the last subtitle set, using the last set times ++ * ++ * @deprecated Use {@link #sendTitle(Title)} or {@link #updateTitle(Title)} ++ */ ++ @Deprecated ++ public void showTitle(net.md_5.bungee.api.chat.BaseComponent title); ++ ++ /** ++ * Show the given title and subtitle to the player using the given times ++ * ++ * @param title big text ++ * @param subtitle little text under it ++ * @param fadeInTicks ticks to fade-in ++ * @param stayTicks ticks to stay visible ++ * @param fadeOutTicks ticks to fade-out ++ * @deprecated Use {@link #sendTitle(Title)} or {@link #updateTitle(Title)} ++ */ ++ @Deprecated ++ public void showTitle(net.md_5.bungee.api.chat.BaseComponent[] title, net.md_5.bungee.api.chat.BaseComponent[] subtitle, int fadeInTicks, int stayTicks, int fadeOutTicks); ++ ++ /** ++ * Show the given title and subtitle to the player using the given times ++ * ++ * @param title big text ++ * @param subtitle little text under it ++ * @param fadeInTicks ticks to fade-in ++ * @param stayTicks ticks to stay visible ++ * @param fadeOutTicks ticks to fade-out ++ * @deprecated Use {@link #sendTitle(Title)} or {@link #updateTitle(Title)} ++ */ ++ @Deprecated ++ public void showTitle(net.md_5.bungee.api.chat.BaseComponent title, net.md_5.bungee.api.chat.BaseComponent subtitle, int fadeInTicks, int stayTicks, int fadeOutTicks); ++ ++ /** ++ * Show the title to the player, overriding any previously displayed title. ++ *

++ *

This method overrides any previous title, use {@link #updateTitle(Title)} to change the existing one.

++ * ++ * @param title the title to send ++ * @throws NullPointerException if the title is null ++ */ ++ void sendTitle(Title title); ++ ++ /** ++ * Show the title to the player, overriding any previously displayed title. ++ *

++ *

This method doesn't override previous titles, but changes their values.

++ * ++ * @param title the title to send ++ * @throws NullPointerException if title is null ++ */ ++ void updateTitle(Title title); ++ ++ /** ++ * Hide any title that is currently visible to the player ++ */ ++ public void hideTitle(); + // Paper end + + /** +@@ -1089,7 +1200,7 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline + * Resets the title displayed to the player. + * @deprecated API subject to change. + */ +- @Deprecated ++ // Paper - undeprecate + public void resetTitle(); + + -- -2.7.1 +2.7.2 diff --git a/Spigot-API-Patches/0021-Add-exception-reporting-event.patch b/Spigot-API-Patches/0018-Add-exception-reporting-event.patch similarity index 76% rename from Spigot-API-Patches/0021-Add-exception-reporting-event.patch rename to Spigot-API-Patches/0018-Add-exception-reporting-event.patch index 95562c1de2..ae12c5b915 100644 --- a/Spigot-API-Patches/0021-Add-exception-reporting-event.patch +++ b/Spigot-API-Patches/0018-Add-exception-reporting-event.patch @@ -1,23 +1,476 @@ -From 19bf0a56a0ee703d978da8e5f84999d1f5b20602 Mon Sep 17 00:00:00 2001 -From: Joseph Hirschfeld -Date: Sat, 20 Feb 2016 20:07:46 -0500 +From d6d60f8002718e1a350932f6d62cd10babcb4c53 Mon Sep 17 00:00:00 2001 +From: Zach Brown +Date: Mon, 29 Feb 2016 20:24:35 -0600 Subject: [PATCH] Add exception reporting event +diff --git a/src/main/java/com/destroystokyo/paper/event/server/ServerExceptionEvent.java b/src/main/java/com/destroystokyo/paper/event/server/ServerExceptionEvent.java +new file mode 100644 +index 0000000..4109454 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/event/server/ServerExceptionEvent.java +@@ -0,0 +1,37 @@ ++package com.destroystokyo.paper.event.server; ++ ++import com.google.common.base.Preconditions; ++import org.apache.commons.lang.Validate; ++import org.bukkit.event.Event; ++import org.bukkit.event.HandlerList; ++import com.destroystokyo.paper.exception.ServerException; ++ ++/** ++ * Called whenever an exception is thrown in a recoverable section of the server. ++ */ ++public class ServerExceptionEvent extends Event { ++ private static final HandlerList handlers = new HandlerList(); ++ private ServerException exception; ++ ++ public ServerExceptionEvent(ServerException exception) { ++ this.exception = Preconditions.checkNotNull(exception, "exception"); ++ } ++ ++ /** ++ * Gets the wrapped exception that was thrown. ++ * ++ * @return Exception thrown ++ */ ++ public ServerException getException() { ++ return exception; ++ } ++ ++ @Override ++ public HandlerList getHandlers() { ++ return handlers; ++ } ++ ++ public static HandlerList getHandlerList() { ++ return handlers; ++ } ++} +diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerCommandException.java b/src/main/java/com/destroystokyo/paper/exception/ServerCommandException.java +new file mode 100644 +index 0000000..6fb39af +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/exception/ServerCommandException.java +@@ -0,0 +1,64 @@ ++package com.destroystokyo.paper.exception; ++ ++import org.bukkit.command.Command; ++import org.bukkit.command.CommandSender; ++ ++import static com.google.common.base.Preconditions.checkNotNull; ++ ++/** ++ * Thrown when a command throws an exception ++ */ ++public class ServerCommandException extends ServerException { ++ ++ private final Command command; ++ private final CommandSender commandSender; ++ private final String[] arguments; ++ ++ public ServerCommandException(String message, Throwable cause, Command command, CommandSender commandSender, String[] arguments) { ++ super(message, cause); ++ this.commandSender = checkNotNull(commandSender, "commandSender"); ++ this.arguments = checkNotNull(arguments, "arguments"); ++ this.command = checkNotNull(command, "command"); ++ } ++ ++ public ServerCommandException(Throwable cause, Command command, CommandSender commandSender, String[] arguments) { ++ super(cause); ++ this.commandSender = checkNotNull(commandSender, "commandSender"); ++ this.arguments = checkNotNull(arguments, "arguments"); ++ this.command = checkNotNull(command, "command"); ++ } ++ ++ protected ServerCommandException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Command command, CommandSender commandSender, String[] arguments) { ++ super(message, cause, enableSuppression, writableStackTrace); ++ this.commandSender = checkNotNull(commandSender, "commandSender"); ++ this.arguments = checkNotNull(arguments, "arguments"); ++ this.command = checkNotNull(command, "command"); ++ } ++ ++ /** ++ * Gets the command which threw the exception ++ * ++ * @return exception throwing command ++ */ ++ public Command getCommand() { ++ return command; ++ } ++ ++ /** ++ * Gets the command sender which executed the command request ++ * ++ * @return command sender of exception thrown command request ++ */ ++ public CommandSender getCommandSender() { ++ return commandSender; ++ } ++ ++ /** ++ * Gets the arguments which threw the exception for the command ++ * ++ * @return arguments of exception thrown command request ++ */ ++ public String[] getArguments() { ++ return arguments; ++ } ++} +diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerEventException.java b/src/main/java/com/destroystokyo/paper/exception/ServerEventException.java +new file mode 100644 +index 0000000..410b241 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/exception/ServerEventException.java +@@ -0,0 +1,52 @@ ++package com.destroystokyo.paper.exception; ++ ++import org.bukkit.event.Event; ++import org.bukkit.event.Listener; ++import org.bukkit.plugin.Plugin; ++ ++import static com.google.common.base.Preconditions.*; ++ ++/** ++ * Exception thrown when a server event listener throws an exception ++ */ ++public class ServerEventException extends ServerPluginException { ++ ++ private final Listener listener; ++ private final Event event; ++ ++ public ServerEventException(String message, Throwable cause, Plugin responsiblePlugin, Listener listener, Event event) { ++ super(message, cause, responsiblePlugin); ++ this.listener = checkNotNull(listener, "listener"); ++ this.event = checkNotNull(event, "event"); ++ } ++ ++ public ServerEventException(Throwable cause, Plugin responsiblePlugin, Listener listener, Event event) { ++ super(cause, responsiblePlugin); ++ this.listener = checkNotNull(listener, "listener"); ++ this.event = checkNotNull(event, "event"); ++ } ++ ++ protected ServerEventException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Plugin responsiblePlugin, Listener listener, Event event) { ++ super(message, cause, enableSuppression, writableStackTrace, responsiblePlugin); ++ this.listener = checkNotNull(listener, "listener"); ++ this.event = checkNotNull(event, "event"); ++ } ++ ++ /** ++ * Gets the listener which threw the exception ++ * ++ * @return event listener ++ */ ++ public Listener getListener() { ++ return listener; ++ } ++ ++ /** ++ * Gets the event which caused the exception ++ * ++ * @return event ++ */ ++ public Event getEvent() { ++ return event; ++ } ++} +diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerException.java b/src/main/java/com/destroystokyo/paper/exception/ServerException.java +new file mode 100644 +index 0000000..c06ea39 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/exception/ServerException.java +@@ -0,0 +1,23 @@ ++package com.destroystokyo.paper.exception; ++ ++/** ++ * Wrapper exception for all exceptions that are thrown by the server. ++ */ ++public class ServerException extends Exception { ++ ++ public ServerException(String message) { ++ super(message); ++ } ++ ++ public ServerException(String message, Throwable cause) { ++ super(message, cause); ++ } ++ ++ public ServerException(Throwable cause) { ++ super(cause); ++ } ++ ++ protected ServerException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { ++ super(message, cause, enableSuppression, writableStackTrace); ++ } ++} +diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerInternalException.java b/src/main/java/com/destroystokyo/paper/exception/ServerInternalException.java +new file mode 100644 +index 0000000..e762ed0 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/exception/ServerInternalException.java +@@ -0,0 +1,35 @@ ++package com.destroystokyo.paper.exception; ++ ++import org.bukkit.Bukkit; ++import com.destroystokyo.paper.event.server.ServerExceptionEvent; ++ ++/** ++ * Thrown when the internal server throws a recoverable exception. ++ */ ++public class ServerInternalException extends ServerException { ++ ++ public ServerInternalException(String message) { ++ super(message); ++ } ++ ++ public ServerInternalException(String message, Throwable cause) { ++ super(message, cause); ++ } ++ ++ public ServerInternalException(Throwable cause) { ++ super(cause); ++ } ++ ++ protected ServerInternalException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { ++ super(message, cause, enableSuppression, writableStackTrace); ++ } ++ ++ public static void reportInternalException(Throwable cause) { ++ try { ++ Bukkit.getPluginManager().callEvent(new ServerExceptionEvent(new ServerInternalException(cause))); ++ ; ++ } catch (Throwable t) { ++ t.printStackTrace(); // Don't want to rethrow! ++ } ++ } ++} +diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerPluginEnableDisableException.java b/src/main/java/com/destroystokyo/paper/exception/ServerPluginEnableDisableException.java +new file mode 100644 +index 0000000..f016ba3 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/exception/ServerPluginEnableDisableException.java +@@ -0,0 +1,20 @@ ++package com.destroystokyo.paper.exception; ++ ++import org.bukkit.plugin.Plugin; ++ ++/** ++ * Thrown whenever there is an exception with any enabling or disabling of plugins. ++ */ ++public class ServerPluginEnableDisableException extends ServerPluginException { ++ public ServerPluginEnableDisableException(String message, Throwable cause, Plugin responsiblePlugin) { ++ super(message, cause, responsiblePlugin); ++ } ++ ++ public ServerPluginEnableDisableException(Throwable cause, Plugin responsiblePlugin) { ++ super(cause, responsiblePlugin); ++ } ++ ++ protected ServerPluginEnableDisableException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Plugin responsiblePlugin) { ++ super(message, cause, enableSuppression, writableStackTrace, responsiblePlugin); ++ } ++} +\ No newline at end of file +diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerPluginException.java b/src/main/java/com/destroystokyo/paper/exception/ServerPluginException.java +new file mode 100644 +index 0000000..6defac2 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/exception/ServerPluginException.java +@@ -0,0 +1,38 @@ ++package com.destroystokyo.paper.exception; ++ ++import com.google.common.base.Preconditions; ++import org.apache.commons.lang.Validate; ++import org.bukkit.plugin.Plugin; ++ ++import static com.google.common.base.Preconditions.*; ++ ++/** ++ * Wrapper exception for all cases to which a plugin can be immediately blamed for ++ */ ++public class ServerPluginException extends ServerException { ++ public ServerPluginException(String message, Throwable cause, Plugin responsiblePlugin) { ++ super(message, cause); ++ this.responsiblePlugin = checkNotNull(responsiblePlugin, "responsiblePlugin"); ++ } ++ ++ public ServerPluginException(Throwable cause, Plugin responsiblePlugin) { ++ super(cause); ++ this.responsiblePlugin = checkNotNull(responsiblePlugin, "responsiblePlugin"); ++ } ++ ++ protected ServerPluginException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Plugin responsiblePlugin) { ++ super(message, cause, enableSuppression, writableStackTrace); ++ this.responsiblePlugin = checkNotNull(responsiblePlugin, "responsiblePlugin"); ++ } ++ ++ private final Plugin responsiblePlugin; ++ ++ /** ++ * Gets the plugin which is directly responsible for the exception being thrown ++ * ++ * @return plugin which is responsible for the exception throw ++ */ ++ public Plugin getResponsiblePlugin() { ++ return responsiblePlugin; ++ } ++} +diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerPluginMessageException.java b/src/main/java/com/destroystokyo/paper/exception/ServerPluginMessageException.java +new file mode 100644 +index 0000000..89e1325 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/exception/ServerPluginMessageException.java +@@ -0,0 +1,64 @@ ++package com.destroystokyo.paper.exception; ++ ++import org.bukkit.entity.Player; ++import org.bukkit.plugin.Plugin; ++ ++import static com.google.common.base.Preconditions.*; ++ ++/** ++ * Thrown when an incoming plugin message channel throws an exception ++ */ ++public class ServerPluginMessageException extends ServerPluginException { ++ ++ private final Player player; ++ private final String channel; ++ private final byte[] data; ++ ++ public ServerPluginMessageException(String message, Throwable cause, Plugin responsiblePlugin, Player player, String channel, byte[] data) { ++ super(message, cause, responsiblePlugin); ++ this.player = checkNotNull(player, "player"); ++ this.channel = checkNotNull(channel, "channel"); ++ this.data = checkNotNull(data, "data"); ++ } ++ ++ public ServerPluginMessageException(Throwable cause, Plugin responsiblePlugin, Player player, String channel, byte[] data) { ++ super(cause, responsiblePlugin); ++ this.player = checkNotNull(player, "player"); ++ this.channel = checkNotNull(channel, "channel"); ++ this.data = checkNotNull(data, "data"); ++ } ++ ++ protected ServerPluginMessageException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Plugin responsiblePlugin, Player player, String channel, byte[] data) { ++ super(message, cause, enableSuppression, writableStackTrace, responsiblePlugin); ++ this.player = checkNotNull(player, "player"); ++ this.channel = checkNotNull(channel, "channel"); ++ this.data = checkNotNull(data, "data"); ++ } ++ ++ /** ++ * Gets the channel to which the error occurred from recieving data from ++ * ++ * @return exception channel ++ */ ++ public String getChannel() { ++ return channel; ++ } ++ ++ /** ++ * Gets the data to which the error occurred from ++ * ++ * @return exception data ++ */ ++ public byte[] getData() { ++ return data; ++ } ++ ++ /** ++ * Gets the player which the plugin message causing the exception originated from ++ * ++ * @return exception player ++ */ ++ public Player getPlayer() { ++ return player; ++ } ++} +diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerSchedulerException.java b/src/main/java/com/destroystokyo/paper/exception/ServerSchedulerException.java +new file mode 100644 +index 0000000..2d0b2d4 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/exception/ServerSchedulerException.java +@@ -0,0 +1,37 @@ ++package com.destroystokyo.paper.exception; ++ ++import org.bukkit.scheduler.BukkitTask; ++ ++import static com.google.common.base.Preconditions.checkNotNull; ++ ++/** ++ * Thrown when a plugin's scheduler fails with an exception ++ */ ++public class ServerSchedulerException extends ServerPluginException { ++ ++ private final BukkitTask task; ++ ++ public ServerSchedulerException(String message, Throwable cause, BukkitTask task) { ++ super(message, cause, task.getOwner()); ++ this.task = checkNotNull(task, "task"); ++ } ++ ++ public ServerSchedulerException(Throwable cause, BukkitTask task) { ++ super(cause, task.getOwner()); ++ this.task = checkNotNull(task, "task"); ++ } ++ ++ protected ServerSchedulerException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, BukkitTask task) { ++ super(message, cause, enableSuppression, writableStackTrace, task.getOwner()); ++ this.task = checkNotNull(task, "task"); ++ } ++ ++ /** ++ * Gets the task which threw the exception ++ * ++ * @return exception throwing task ++ */ ++ public BukkitTask getTask() { ++ return task; ++ } ++} +diff --git a/src/main/java/com/destroystokyo/paper/exception/ServerTabCompleteException.java b/src/main/java/com/destroystokyo/paper/exception/ServerTabCompleteException.java +new file mode 100644 +index 0000000..5582999 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/exception/ServerTabCompleteException.java +@@ -0,0 +1,22 @@ ++package com.destroystokyo.paper.exception; ++ ++import org.bukkit.command.Command; ++import org.bukkit.command.CommandSender; ++ ++/** ++ * Called when a tab-complete request throws an exception ++ */ ++public class ServerTabCompleteException extends ServerCommandException { ++ ++ public ServerTabCompleteException(String message, Throwable cause, Command command, CommandSender commandSender, String[] arguments) { ++ super(message, cause, command, commandSender, arguments); ++ } ++ ++ public ServerTabCompleteException(Throwable cause, Command command, CommandSender commandSender, String[] arguments) { ++ super(cause, command, commandSender, arguments); ++ } ++ ++ protected ServerTabCompleteException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Command command, CommandSender commandSender, String[] arguments) { ++ super(message, cause, enableSuppression, writableStackTrace, command, commandSender, arguments); ++ } ++} diff --git a/src/main/java/org/bukkit/command/SimpleCommandMap.java b/src/main/java/org/bukkit/command/SimpleCommandMap.java -index 12d9232..f35bc09 100644 +index 980c4fd..98b71e2 100644 --- a/src/main/java/org/bukkit/command/SimpleCommandMap.java +++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java -@@ -17,6 +17,9 @@ import org.bukkit.Server; - import org.bukkit.command.defaults.*; - import org.bukkit.entity.Player; - import org.bukkit.util.StringUtil; -+import org.github.paperspigot.event.ServerExceptionEvent; -+import org.github.paperspigot.exception.ServerCommandException; -+import org.github.paperspigot.exception.ServerTabCompleteException; +@@ -11,6 +11,9 @@ import java.util.List; + import java.util.Map; + import java.util.regex.Pattern; - public class SimpleCommandMap implements CommandMap { - private static final Pattern PATTERN_ON_SPACE = Pattern.compile(" ", Pattern.LITERAL); ++import com.destroystokyo.paper.event.server.ServerExceptionEvent; ++import com.destroystokyo.paper.exception.ServerCommandException; ++import com.destroystokyo.paper.exception.ServerTabCompleteException; + import org.apache.commons.lang.Validate; + import org.bukkit.Location; + import org.bukkit.Server; @@ -147,7 +150,9 @@ public class SimpleCommandMap implements CommandMap { throw ex; } catch (Throwable ex) { @@ -39,21 +492,21 @@ index 12d9232..f35bc09 100644 + throw new CommandException(msg, ex); } } - // PaperSpigot end + // Paper end diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java -index 1325b03..ce9839e 100644 +index 1325b03..49f5872 100644 --- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java +++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java -@@ -33,6 +33,9 @@ import org.bukkit.permissions.PermissionDefault; - import org.bukkit.util.FileUtil; +@@ -18,6 +18,9 @@ import java.util.logging.Level; + import java.util.regex.Matcher; + import java.util.regex.Pattern; - import com.google.common.collect.ImmutableSet; -+import org.github.paperspigot.event.ServerExceptionEvent; -+import org.github.paperspigot.exception.ServerEventException; -+import org.github.paperspigot.exception.ServerPluginEnableDisableException; - - /** - * Handles all plugin management from the Server ++import com.destroystokyo.paper.event.server.ServerExceptionEvent; ++import com.destroystokyo.paper.exception.ServerEventException; ++import com.destroystokyo.paper.exception.ServerPluginEnableDisableException; + import org.apache.commons.lang.Validate; + import org.bukkit.Server; + import org.bukkit.command.Command; @@ -403,7 +406,8 @@ public final class SimplePluginManager implements PluginManager { try { plugin.getPluginLoader().enablePlugin(plugin); @@ -133,483 +586,6 @@ index 1325b03..ce9839e 100644 } } } -diff --git a/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java b/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java -index 4c171e8..9ef6525 100644 ---- a/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java -+++ b/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java -@@ -8,6 +8,8 @@ import java.util.Map; - import java.util.Set; - import org.bukkit.entity.Player; - import org.bukkit.plugin.Plugin; -+import org.github.paperspigot.event.ServerExceptionEvent; -+import org.github.paperspigot.exception.ServerPluginMessageException; - - /** - * Standard implementation to {@link Messenger} -@@ -427,7 +429,13 @@ public class StandardMessenger implements Messenger { - registration.getListener().onPluginMessageReceived( channel, source, message ); - } catch ( Throwable t ) - { -- org.bukkit.Bukkit.getLogger().log( java.util.logging.Level.WARNING, "Could not pass incoming plugin message to " + registration.getPlugin(), t ); -+ // Paper start -+ String msg = "Could not pass incoming plugin message to " + registration.getPlugin(); -+ org.bukkit.Bukkit.getLogger().log( java.util.logging.Level.WARNING, msg, t ); -+ source.getServer().getPluginManager().callEvent(new ServerExceptionEvent( -+ new ServerPluginMessageException(msg, t, registration.getPlugin(), source, channel, message) -+ )); -+ // Paper end - } - // Spigot End - } -diff --git a/src/main/java/org/github/paperspigot/event/ServerExceptionEvent.java b/src/main/java/org/github/paperspigot/event/ServerExceptionEvent.java -new file mode 100644 -index 0000000..317e9d2 ---- /dev/null -+++ b/src/main/java/org/github/paperspigot/event/ServerExceptionEvent.java -@@ -0,0 +1,36 @@ -+package org.github.paperspigot.event; -+ -+import com.google.common.base.Preconditions; -+import org.apache.commons.lang.Validate; -+import org.bukkit.event.Event; -+import org.bukkit.event.HandlerList; -+import org.github.paperspigot.exception.ServerException; -+ -+/** -+ * Called whenever an exception is thrown in a recoverable section of the server. -+ */ -+public class ServerExceptionEvent extends Event { -+ private static final HandlerList handlers = new HandlerList(); -+ private ServerException exception; -+ -+ public ServerExceptionEvent (ServerException exception) { -+ this.exception = Preconditions.checkNotNull(exception, "exception"); -+ } -+ -+ /** -+ * Gets the wrapped exception that was thrown. -+ * @return Exception thrown -+ */ -+ public ServerException getException() { -+ return exception; -+ } -+ -+ @Override -+ public HandlerList getHandlers() { -+ return handlers; -+ } -+ -+ public static HandlerList getHandlerList() { -+ return handlers; -+ } -+} -diff --git a/src/main/java/org/github/paperspigot/exception/ServerCommandException.java b/src/main/java/org/github/paperspigot/exception/ServerCommandException.java -new file mode 100644 -index 0000000..aae647a ---- /dev/null -+++ b/src/main/java/org/github/paperspigot/exception/ServerCommandException.java -@@ -0,0 +1,64 @@ -+package org.github.paperspigot.exception; -+ -+import org.bukkit.command.Command; -+import org.bukkit.command.CommandSender; -+ -+import static com.google.common.base.Preconditions.checkNotNull; -+ -+/** -+ * Thrown when a command throws an exception -+ */ -+public class ServerCommandException extends ServerException { -+ -+ private final Command command; -+ private final CommandSender commandSender; -+ private final String[] arguments; -+ -+ public ServerCommandException(String message, Throwable cause, Command command, CommandSender commandSender, String[] arguments) { -+ super(message, cause); -+ this.commandSender = checkNotNull(commandSender, "commandSender"); -+ this.arguments = checkNotNull(arguments, "arguments"); -+ this.command = checkNotNull(command, "command"); -+ } -+ -+ public ServerCommandException(Throwable cause, Command command, CommandSender commandSender, String[] arguments) { -+ super(cause); -+ this.commandSender = checkNotNull(commandSender, "commandSender"); -+ this.arguments = checkNotNull(arguments, "arguments"); -+ this.command = checkNotNull(command, "command"); -+ } -+ -+ protected ServerCommandException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Command command, CommandSender commandSender, String[] arguments) { -+ super(message, cause, enableSuppression, writableStackTrace); -+ this.commandSender = checkNotNull(commandSender, "commandSender"); -+ this.arguments = checkNotNull(arguments, "arguments"); -+ this.command = checkNotNull(command, "command"); -+ } -+ -+ /** -+ * Gets the command which threw the exception -+ * -+ * @return exception throwing command -+ */ -+ public Command getCommand() { -+ return command; -+ } -+ -+ /** -+ * Gets the command sender which executed the command request -+ * -+ * @return command sender of exception thrown command request -+ */ -+ public CommandSender getCommandSender() { -+ return commandSender; -+ } -+ -+ /** -+ * Gets the arguments which threw the exception for the command -+ * -+ * @return arguments of exception thrown command request -+ */ -+ public String[] getArguments() { -+ return arguments; -+ } -+} -diff --git a/src/main/java/org/github/paperspigot/exception/ServerEventException.java b/src/main/java/org/github/paperspigot/exception/ServerEventException.java -new file mode 100644 -index 0000000..d99cab8 ---- /dev/null -+++ b/src/main/java/org/github/paperspigot/exception/ServerEventException.java -@@ -0,0 +1,52 @@ -+package org.github.paperspigot.exception; -+ -+import org.bukkit.event.Event; -+import org.bukkit.event.Listener; -+import org.bukkit.plugin.Plugin; -+ -+import static com.google.common.base.Preconditions.*; -+ -+/** -+ * Exception thrown when a server event listener throws an exception -+ */ -+public class ServerEventException extends ServerPluginException { -+ -+ private final Listener listener; -+ private final Event event; -+ -+ public ServerEventException(String message, Throwable cause, Plugin responsiblePlugin, Listener listener, Event event) { -+ super(message, cause, responsiblePlugin); -+ this.listener = checkNotNull(listener, "listener"); -+ this.event = checkNotNull(event, "event"); -+ } -+ -+ public ServerEventException(Throwable cause, Plugin responsiblePlugin, Listener listener, Event event) { -+ super(cause, responsiblePlugin); -+ this.listener = checkNotNull(listener, "listener"); -+ this.event = checkNotNull(event, "event"); -+ } -+ -+ protected ServerEventException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Plugin responsiblePlugin, Listener listener, Event event) { -+ super(message, cause, enableSuppression, writableStackTrace, responsiblePlugin); -+ this.listener = checkNotNull(listener, "listener"); -+ this.event = checkNotNull(event, "event"); -+ } -+ -+ /** -+ * Gets the listener which threw the exception -+ * -+ * @return event listener -+ */ -+ public Listener getListener() { -+ return listener; -+ } -+ -+ /** -+ * Gets the event which caused the exception -+ * -+ * @return event -+ */ -+ public Event getEvent() { -+ return event; -+ } -+} -diff --git a/src/main/java/org/github/paperspigot/exception/ServerException.java b/src/main/java/org/github/paperspigot/exception/ServerException.java -new file mode 100644 -index 0000000..f7aad05 ---- /dev/null -+++ b/src/main/java/org/github/paperspigot/exception/ServerException.java -@@ -0,0 +1,23 @@ -+package org.github.paperspigot.exception; -+ -+/** -+ * Wrapper exception for all exceptions that are thrown by the server. -+ */ -+public class ServerException extends Exception { -+ -+ public ServerException(String message) { -+ super(message); -+ } -+ -+ public ServerException(String message, Throwable cause) { -+ super(message, cause); -+ } -+ -+ public ServerException(Throwable cause) { -+ super(cause); -+ } -+ -+ protected ServerException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { -+ super(message, cause, enableSuppression, writableStackTrace); -+ } -+} -diff --git a/src/main/java/org/github/paperspigot/exception/ServerInternalException.java b/src/main/java/org/github/paperspigot/exception/ServerInternalException.java -new file mode 100644 -index 0000000..17ad4cb ---- /dev/null -+++ b/src/main/java/org/github/paperspigot/exception/ServerInternalException.java -@@ -0,0 +1,35 @@ -+package org.github.paperspigot.exception; -+ -+import org.bukkit.Bukkit; -+import org.bukkit.entity.ThrownExpBottle; -+import org.github.paperspigot.event.ServerExceptionEvent; -+ -+/** -+ * Thrown when the internal server throws a recoverable exception. -+ */ -+public class ServerInternalException extends ServerException { -+ -+ public ServerInternalException(String message) { -+ super(message); -+ } -+ -+ public ServerInternalException(String message, Throwable cause) { -+ super(message, cause); -+ } -+ -+ public ServerInternalException(Throwable cause) { -+ super(cause); -+ } -+ -+ protected ServerInternalException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { -+ super(message, cause, enableSuppression, writableStackTrace); -+ } -+ -+ public static void reportInternalException(Throwable cause) { -+ try { -+ Bukkit.getPluginManager().callEvent(new ServerExceptionEvent(new ServerInternalException(cause)));; -+ } catch (Throwable t) { -+ t.printStackTrace(); // Don't want to rethrow! -+ } -+ } -+} -diff --git a/src/main/java/org/github/paperspigot/exception/ServerPluginEnableDisableException.java b/src/main/java/org/github/paperspigot/exception/ServerPluginEnableDisableException.java -new file mode 100644 -index 0000000..8c938d0 ---- /dev/null -+++ b/src/main/java/org/github/paperspigot/exception/ServerPluginEnableDisableException.java -@@ -0,0 +1,20 @@ -+package org.github.paperspigot.exception; -+ -+import org.bukkit.plugin.Plugin; -+ -+/** -+ * Thrown whenever there is an exception with any enabling or disabling of plugins. -+ */ -+public class ServerPluginEnableDisableException extends ServerPluginException { -+ public ServerPluginEnableDisableException(String message, Throwable cause, Plugin responsiblePlugin) { -+ super(message, cause, responsiblePlugin); -+ } -+ -+ public ServerPluginEnableDisableException(Throwable cause, Plugin responsiblePlugin) { -+ super(cause, responsiblePlugin); -+ } -+ -+ protected ServerPluginEnableDisableException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Plugin responsiblePlugin) { -+ super(message, cause, enableSuppression, writableStackTrace, responsiblePlugin); -+ } -+} -diff --git a/src/main/java/org/github/paperspigot/exception/ServerPluginException.java b/src/main/java/org/github/paperspigot/exception/ServerPluginException.java -new file mode 100644 -index 0000000..f9241ad ---- /dev/null -+++ b/src/main/java/org/github/paperspigot/exception/ServerPluginException.java -@@ -0,0 +1,39 @@ -+package org.github.paperspigot.exception; -+ -+import com.google.common.base.Preconditions; -+import org.apache.commons.lang.Validate; -+import org.bukkit.plugin.Plugin; -+ -+import static com.google.common.base.Preconditions.*; -+ -+/** -+ * Wrapper exception for all cases to which a plugin can be immediately blamed for -+ */ -+public class ServerPluginException extends ServerException { -+ public ServerPluginException(String message, Throwable cause, Plugin responsiblePlugin) { -+ super(message, cause); -+ this.responsiblePlugin = checkNotNull(responsiblePlugin, "responsiblePlugin"); -+ } -+ -+ public ServerPluginException(Throwable cause, Plugin responsiblePlugin) { -+ super(cause); -+ this.responsiblePlugin = checkNotNull(responsiblePlugin, "responsiblePlugin"); -+ } -+ -+ protected ServerPluginException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Plugin responsiblePlugin) { -+ super(message, cause, enableSuppression, writableStackTrace); -+ this.responsiblePlugin = checkNotNull(responsiblePlugin, "responsiblePlugin"); -+ } -+ -+ private final Plugin responsiblePlugin; -+ -+ /** -+ * Gets the plugin which is directly responsible for the exception being thrown -+ * -+ * @return plugin which is responsible for the exception throw -+ */ -+ public Plugin getResponsiblePlugin() { -+ return responsiblePlugin; -+ } -+ -+} -diff --git a/src/main/java/org/github/paperspigot/exception/ServerPluginMessageException.java b/src/main/java/org/github/paperspigot/exception/ServerPluginMessageException.java -new file mode 100644 -index 0000000..b71303b ---- /dev/null -+++ b/src/main/java/org/github/paperspigot/exception/ServerPluginMessageException.java -@@ -0,0 +1,61 @@ -+package org.github.paperspigot.exception; -+ -+import org.bukkit.entity.Player; -+import org.bukkit.plugin.Plugin; -+ -+import static com.google.common.base.Preconditions.*; -+ -+/** -+ * Thrown when an incoming plugin message channel throws an exception -+ */ -+public class ServerPluginMessageException extends ServerPluginException { -+ -+ private final Player player; -+ private final String channel; -+ private final byte[] data; -+ -+ public ServerPluginMessageException(String message, Throwable cause, Plugin responsiblePlugin, Player player, String channel, byte[] data) { -+ super(message, cause, responsiblePlugin); -+ this.player = checkNotNull(player, "player"); -+ this.channel = checkNotNull(channel, "channel"); -+ this.data = checkNotNull(data, "data"); -+ } -+ -+ public ServerPluginMessageException(Throwable cause, Plugin responsiblePlugin, Player player, String channel, byte[] data) { -+ super(cause, responsiblePlugin); -+ this.player = checkNotNull(player, "player"); -+ this.channel = checkNotNull(channel, "channel"); -+ this.data = checkNotNull(data, "data"); -+ } -+ -+ protected ServerPluginMessageException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Plugin responsiblePlugin, Player player, String channel, byte[] data) { -+ super(message, cause, enableSuppression, writableStackTrace, responsiblePlugin); -+ this.player = checkNotNull(player, "player"); -+ this.channel = checkNotNull(channel, "channel"); -+ this.data = checkNotNull(data, "data"); -+ } -+ -+ /** -+ * Gets the channel to which the error occurred from recieving data from -+ * @return exception channel -+ */ -+ public String getChannel() { -+ return channel; -+ } -+ -+ /** -+ * Gets the data to which the error occurred from -+ * @return exception data -+ */ -+ public byte[] getData() { -+ return data; -+ } -+ -+ /** -+ * Gets the player which the plugin message causing the exception originated from -+ * @return exception player -+ */ -+ public Player getPlayer() { -+ return player; -+ } -+} -diff --git a/src/main/java/org/github/paperspigot/exception/ServerSchedulerException.java b/src/main/java/org/github/paperspigot/exception/ServerSchedulerException.java -new file mode 100644 -index 0000000..99757ee ---- /dev/null -+++ b/src/main/java/org/github/paperspigot/exception/ServerSchedulerException.java -@@ -0,0 +1,37 @@ -+package org.github.paperspigot.exception; -+ -+import org.bukkit.scheduler.BukkitTask; -+ -+import static com.google.common.base.Preconditions.checkNotNull; -+ -+/** -+ * Thrown when a plugin's scheduler fails with an exception -+ */ -+public class ServerSchedulerException extends ServerPluginException { -+ -+ private final BukkitTask task; -+ -+ public ServerSchedulerException(String message, Throwable cause, BukkitTask task) { -+ super(message, cause, task.getOwner()); -+ this.task = checkNotNull(task, "task"); -+ } -+ -+ public ServerSchedulerException(Throwable cause, BukkitTask task) { -+ super(cause, task.getOwner()); -+ this.task = checkNotNull(task, "task"); -+ } -+ -+ protected ServerSchedulerException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, BukkitTask task) { -+ super(message, cause, enableSuppression, writableStackTrace, task.getOwner()); -+ this.task = checkNotNull(task, "task"); -+ } -+ -+ /** -+ * Gets the task which threw the exception -+ * @return exception throwing task -+ */ -+ public BukkitTask getTask() { -+ return task; -+ } -+ -+} -diff --git a/src/main/java/org/github/paperspigot/exception/ServerTabCompleteException.java b/src/main/java/org/github/paperspigot/exception/ServerTabCompleteException.java -new file mode 100644 -index 0000000..6e1e2ab ---- /dev/null -+++ b/src/main/java/org/github/paperspigot/exception/ServerTabCompleteException.java -@@ -0,0 +1,22 @@ -+package org.github.paperspigot.exception; -+ -+import org.bukkit.command.Command; -+import org.bukkit.command.CommandSender; -+ -+/** -+ * Called when a tab-complete request throws an exception -+ */ -+public class ServerTabCompleteException extends ServerCommandException { -+ -+ public ServerTabCompleteException(String message, Throwable cause, Command command, CommandSender commandSender, String[] arguments) { -+ super(message, cause, command, commandSender, arguments); -+ } -+ -+ public ServerTabCompleteException(Throwable cause, Command command, CommandSender commandSender, String[] arguments) { -+ super(cause, command, commandSender, arguments); -+ } -+ -+ protected ServerTabCompleteException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace, Command command, CommandSender commandSender, String[] arguments) { -+ super(message, cause, enableSuppression, writableStackTrace, command, commandSender, arguments); -+ } -+} -- -2.5.0 +2.7.2 diff --git a/Spigot-API-Patches/0018-Expose-server-CommandMap.patch b/Spigot-API-Patches/0018-Expose-server-CommandMap.patch deleted file mode 100644 index 36de441a16..0000000000 --- a/Spigot-API-Patches/0018-Expose-server-CommandMap.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 184494ffcdbd826e48aa98fd8945b44723793af8 Mon Sep 17 00:00:00 2001 -From: kashike -Date: Mon, 15 Feb 2016 07:11:17 -0800 -Subject: [PATCH] Expose server CommandMap - - -diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index a4396e8..f0e1b99 100644 ---- a/src/main/java/org/bukkit/Bukkit.java -+++ b/src/main/java/org/bukkit/Bukkit.java -@@ -14,6 +14,7 @@ import java.util.logging.Logger; - - import org.bukkit.Warning.WarningState; - import org.bukkit.command.CommandException; -+import org.bukkit.command.CommandMap; - import org.bukkit.command.CommandSender; - import org.bukkit.command.ConsoleCommandSender; - import org.bukkit.command.PluginCommand; -@@ -1130,6 +1131,17 @@ public final class Bukkit { - return server.getUnsafe(); - } - -+ // Paper start -+ /** -+ * Gets the active {@link CommandMap}. -+ * -+ * @return the active command map -+ */ -+ public static CommandMap getCommandMap() { -+ return server.getCommandMap(); -+ } -+ // Paper end -+ - public static Server.Spigot spigot() - { - return server.spigot(); -diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index ae75bd4..316336d 100644 ---- a/src/main/java/org/bukkit/Server.java -+++ b/src/main/java/org/bukkit/Server.java -@@ -14,6 +14,7 @@ import java.util.logging.Logger; - - import org.bukkit.Warning.WarningState; - import org.bukkit.command.CommandException; -+import org.bukkit.command.CommandMap; - import org.bukkit.command.CommandSender; - import org.bukkit.command.ConsoleCommandSender; - import org.bukkit.command.PluginCommand; -@@ -924,6 +925,15 @@ public interface Server extends PluginMessageRecipient { - @Deprecated - UnsafeValues getUnsafe(); - -+ // Paper start -+ /** -+ * Gets the active {@link CommandMap}. -+ * -+ * @return the active command map -+ */ -+ CommandMap getCommandMap(); -+ // Paper end -+ - public class Spigot - { - @Deprecated --- -2.7.0.rc0.20.g4b9ab0e - diff --git a/Spigot-API-Patches/0021-Fix-ServerListPingEvent-flagging-as-Async.patch b/Spigot-API-Patches/0019-Fix-ServerListPingEvent-flagging-as-Async.patch similarity index 95% rename from Spigot-API-Patches/0021-Fix-ServerListPingEvent-flagging-as-Async.patch rename to Spigot-API-Patches/0019-Fix-ServerListPingEvent-flagging-as-Async.patch index 95a21e9c67..2d47507f74 100644 --- a/Spigot-API-Patches/0021-Fix-ServerListPingEvent-flagging-as-Async.patch +++ b/Spigot-API-Patches/0019-Fix-ServerListPingEvent-flagging-as-Async.patch @@ -1,6 +1,6 @@ -From f77db2e56a6185471090b6cfeba2c441e19af096 Mon Sep 17 00:00:00 2001 +From c872380e8a9e221324e69639a39bffb18fc8f883 Mon Sep 17 00:00:00 2001 From: Aikar -Date: Wed, 24 Feb 2016 00:57:22 -0500 +Date: Mon, 29 Feb 2016 20:26:39 -0600 Subject: [PATCH] Fix ServerListPingEvent flagging as Async This event can sometimes fire Async, set the proper boolean @@ -50,5 +50,5 @@ index 343f238..3c38d85 100644 this.address = address; this.motd = motd; -- -2.7.1 +2.7.2 diff --git a/Spigot-Server-Patches/0001-POM-Changes.patch b/Spigot-Server-Patches/0001-POM-Changes.patch index 38a61013f3..4eb4c49baf 100644 --- a/Spigot-Server-Patches/0001-POM-Changes.patch +++ b/Spigot-Server-Patches/0001-POM-Changes.patch @@ -1,11 +1,11 @@ -From 9e315343a720a550c61568b70657ad2076501022 Mon Sep 17 00:00:00 2001 +From 3f12fafbace495fff95f54531ff5d52d6706b3c1 Mon Sep 17 00:00:00 2001 From: Zach Brown -Date: Thu, 19 Mar 2015 19:41:15 -0500 +Date: Mon, 29 Feb 2016 20:40:33 -0600 Subject: [PATCH] POM Changes diff --git a/pom.xml b/pom.xml -index 91627ff..fd051da 100644 +index 953cdbc..ddbb829 100644 --- a/pom.xml +++ b/pom.xml @@ -1,12 +1,12 @@ @@ -14,24 +14,24 @@ index 91627ff..fd051da 100644 4.0.0 - org.spigotmc - spigot -+ org.github.paperspigot -+ paperspigot ++ com.destroystokyo.paper ++ paper jar - 1.8.8-R0.1-SNAPSHOT + 1.9-SNAPSHOT - Spigot - http://www.spigotmc.org -+ PaperSpigot -+ https://hub.spigotmc.org/stash/projects/PAPER/ ++ Paper ++ https://github.com/PaperSpigot/Paper UTF-8 -@@ -16,13 +16,14 @@ - 1_8_R3 +@@ -15,21 +15,22 @@ + 1_9_R1 git-Bukkit- - 1.6 - 1.6 -+ ++ + 1.8 + 1.8 @@ -39,43 +39,37 @@ index 91627ff..fd051da 100644 - org.spigotmc - spigot-parent -+ org.github.paperspigot -+ paperspigot-parent ++ com.destroystokyo.paper ++ paper-parent dev-SNAPSHOT ../pom.xml -@@ -34,8 +35,8 @@ - 3.0.3 - + + - org.spigotmc - spigot-api -+ org.github.paperspigot -+ paperspigot-api ++ com.destroystokyo.paper ++ paper-api ${project.version} - jar compile -@@ -96,6 +97,11 @@ - spigotmc-public - https://hub.spigotmc.org/nexus/content/groups/public/ - -+ -+ -+ destroystokyo -+ https://ci.destroystokyo.com/plugin/repository/everything/ -+ - - - -@@ -103,36 +109,22 @@ - install + +@@ -95,32 +96,18 @@ + - net.md-5 - scriptus - 0.2 -- -- ++ com.lukegb.mojo ++ gitdescribe-maven-plugin ++ 1.3 ++ ++ git-Paper- ++ .. ++ + + - ex-spigot - - git-Spigot-%s @@ -95,32 +89,19 @@ index 91627ff..fd051da 100644 - craftbukkit.desc - - initialize -- ++ compile + - describe -- -- -- -- -+ com.lukegb.mojo -+ gitdescribe-maven-plugin -+ 1.3 -+ -+ git-PaperSpigot- -+ .. -+ -+ -+ -+ compile -+ -+ gitdescribe -+ -+ -+ -+
- - org.apache.maven.plugins ++ gitdescribe + +
+
+@@ -130,11 +117,12 @@ maven-jar-plugin -@@ -142,7 +134,7 @@ + 2.6 + ++ true + org.bukkit.craftbukkit.Main CraftBukkit @@ -129,13 +110,13 @@ index 91627ff..fd051da 100644 Bukkit Team Bukkit ${api.version} -@@ -172,26 +164,6 @@ +@@ -164,26 +152,6 @@
- org.codehaus.mojo - animal-sniffer-maven-plugin -- 1.13 +- 1.14 - - - process-classes @@ -155,22 +136,30 @@ index 91627ff..fd051da 100644 - org.apache.maven.plugins maven-shade-plugin - 2.3 -diff --git a/src/main/java/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java b/src/main/java/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java -index c110e0c..5540dde 100644 ---- a/src/main/java/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java -+++ b/src/main/java/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java -@@ -11,7 +11,7 @@ public class PathfinderGoalNearestAttackableTarget exten - protected final Class a; - private final int g; - protected final PathfinderGoalNearestAttackableTarget.DistanceComparator b; -- protected Predicate c; -+ protected Predicate c; - protected EntityLiving d; - - public PathfinderGoalNearestAttackableTarget(EntityCreature entitycreature, Class oclass, boolean flag) { + 2.4.1 +@@ -232,20 +200,6 @@ + maven-compiler-plugin + + 3.1 +- +- +- eclipse +- +- true +- +- +- +- +- org.codehaus.plexus +- plexus-compiler-eclipse +- 2.5.0-spigotmc +- +- + + + org.apache.maven.plugins diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java -index 9304637..3a4b142 100644 +index 9304637..674096c 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java +++ b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java @@ -11,7 +11,7 @@ public final class Versioning { @@ -178,10 +167,10 @@ index 9304637..3a4b142 100644 String result = "Unknown-Version"; - InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/org.spigotmc/spigot-api/pom.properties"); -+ InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/org.github.paperspigot/paperspigot-api/pom.properties"); ++ InputStream stream = Bukkit.class.getClassLoader().getResourceAsStream("META-INF/maven/com.destroystokyo.paper/paper-api/pom.properties"); Properties properties = new Properties(); if (stream != null) { -- -2.7.1 +2.7.2 diff --git a/Spigot-Server-Patches/0002-Paper-config-files.patch b/Spigot-Server-Patches/0002-Paper-config-files.patch new file mode 100644 index 0000000000..4023cca9e8 --- /dev/null +++ b/Spigot-Server-Patches/0002-Paper-config-files.patch @@ -0,0 +1,291 @@ +From 377f09f50cc994ec746ef79a44d51bae391884b2 Mon Sep 17 00:00:00 2001 +From: Zach Brown +Date: Mon, 29 Feb 2016 21:02:09 -0600 +Subject: [PATCH] Paper config files + + +diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java +new file mode 100644 +index 0000000..dca7763 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java +@@ -0,0 +1,122 @@ ++package com.destroystokyo.paper; ++ ++import com.google.common.base.Throwables; ++ ++import java.io.File; ++import java.io.IOException; ++import java.lang.reflect.InvocationTargetException; ++import java.lang.reflect.Method; ++import java.lang.reflect.Modifier; ++import java.util.HashMap; ++import java.util.List; ++import java.util.Map; ++import java.util.logging.Level; ++ ++import net.minecraft.server.MinecraftServer; ++import org.bukkit.Bukkit; ++import org.bukkit.command.Command; ++import org.bukkit.configuration.InvalidConfigurationException; ++import org.bukkit.configuration.file.YamlConfiguration; ++ ++public class PaperConfig { ++ ++ private static File CONFIG_FILE; ++ private static final String HEADER = "This is the main configuration file for Paper.\n" ++ + "As you can see, there's tons to configure. Some options may impact gameplay, so use\n" ++ + "with caution, and make sure you know what each option does before configuring.\n" ++ + "\n" ++ + "If you need help with the configuration or have any questions related to PaperSpigot,\n" ++ + "join us at the IRC.\n" ++ + "\n" ++ + "IRC: #paperspigot @ irc.spi.gt ( http://irc.spi.gt/iris/?channels=PaperSpigot )\n" ++ + "Wiki: https://paper.readthedocs.org/ \n" ++ + "Paper Forums: https://aquifermc.org/ \n"; ++ /*========================================================================*/ ++ public static YamlConfiguration config; ++ static int version; ++ static Map commands; ++ /*========================================================================*/ ++ ++ public static void init(File configFile) { ++ CONFIG_FILE = configFile; ++ config = new YamlConfiguration(); ++ try { ++ config.load(CONFIG_FILE); ++ } catch (IOException ex) { ++ } catch (InvalidConfigurationException ex) { ++ Bukkit.getLogger().log(Level.SEVERE, "Could not load paper.yml, please correct your syntax errors", ex); ++ throw Throwables.propagate(ex); ++ } ++ config.options().header(HEADER); ++ config.options().copyDefaults(true); ++ ++ commands = new HashMap(); ++ ++ version = getInt("config-version", 9); ++ set("config-version", 9); ++ readConfig(PaperConfig.class, null); ++ } ++ ++ public static void registerCommands() { ++ for (Map.Entry entry : commands.entrySet()) { ++ MinecraftServer.getServer().server.getCommandMap().register(entry.getKey(), "Paper", entry.getValue()); ++ } ++ } ++ ++ static void readConfig(Class clazz, Object instance) { ++ for (Method method : clazz.getDeclaredMethods()) { ++ if (Modifier.isPrivate(method.getModifiers())) { ++ if (method.getParameterTypes().length == 0 && method.getReturnType() == Void.TYPE) { ++ try { ++ method.setAccessible(true); ++ method.invoke(instance); ++ } catch (InvocationTargetException ex) { ++ throw Throwables.propagate(ex.getCause()); ++ } catch (Exception ex) { ++ Bukkit.getLogger().log(Level.SEVERE, "Error invoking " + method, ex); ++ } ++ } ++ } ++ } ++ ++ try { ++ config.save(CONFIG_FILE); ++ } catch (IOException ex) { ++ Bukkit.getLogger().log(Level.SEVERE, "Could not save " + CONFIG_FILE, ex); ++ } ++ } ++ ++ private static void set(String path, Object val) { ++ config.set(path, val); ++ } ++ ++ private static boolean getBoolean(String path, boolean def) { ++ config.addDefault(path, def); ++ return config.getBoolean(path, config.getBoolean(path)); ++ } ++ ++ private static double getDouble(String path, double def) { ++ config.addDefault(path, def); ++ return config.getDouble(path, config.getDouble(path)); ++ } ++ ++ private static float getFloat(String path, float def) { ++ // TODO: Figure out why getFloat() always returns the default value. ++ return (float) getDouble(path, (double) def); ++ } ++ ++ private static int getInt(String path, int def) { ++ config.addDefault(path, def); ++ return config.getInt(path, config.getInt(path)); ++ } ++ ++ private static List getList(String path, T def) { ++ config.addDefault(path, def); ++ return (List) config.getList(path, config.getList(path)); ++ } ++ ++ private static String getString(String path, String def) { ++ config.addDefault(path, def); ++ return config.getString(path, config.getString(path)); ++ } ++} +diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +new file mode 100644 +index 0000000..ca6d1a2 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -0,0 +1,66 @@ ++package com.destroystokyo.paper; ++ ++import java.util.List; ++ ++import org.bukkit.Bukkit; ++import org.bukkit.configuration.file.YamlConfiguration; ++ ++public class PaperWorldConfig { ++ ++ private final String worldName; ++ private final YamlConfiguration config; ++ private boolean verbose; ++ ++ public PaperWorldConfig(String worldName) { ++ this.worldName = worldName; ++ this.config = PaperConfig.config; ++ init(); ++ } ++ ++ public void init() { ++ this.verbose = getBoolean("verbose", false); ++ ++ log("-------- World Settings For [" + worldName + "] --------"); ++ PaperConfig.readConfig(PaperWorldConfig.class, this); ++ } ++ ++ private void log(String s) { ++ if (verbose) { ++ Bukkit.getLogger().info(s); ++ } ++ } ++ ++ private void set(String path, Object val) { ++ config.set("world-settings.default." + path, val); ++ } ++ ++ private boolean getBoolean(String path, boolean def) { ++ config.addDefault("world-settings.default." + path, def); ++ return config.getBoolean("world-settings." + worldName + "." + path, config.getBoolean("world-settings.default." + path)); ++ } ++ ++ private double getDouble(String path, double def) { ++ config.addDefault("world-settings.default." + path, def); ++ return config.getDouble("world-settings." + worldName + "." + path, config.getDouble("world-settings.default." + path)); ++ } ++ ++ private int getInt(String path, int def) { ++ config.addDefault("world-settings.default." + path, def); ++ return config.getInt("world-settings." + worldName + "." + path, config.getInt("world-settings.default." + path)); ++ } ++ ++ private float getFloat(String path, float def) { ++ // TODO: Figure out why getFloat() always returns the default value. ++ return (float) getDouble(path, (double) def); ++ } ++ ++ private List getList(String path, T def) { ++ config.addDefault("world-settings.default." + path, def); ++ return (List) config.getList("world-settings." + worldName + "." + path, config.getList("world-settings.default." + path)); ++ } ++ ++ private String getString(String path, String def) { ++ config.addDefault("world-settings.default." + path, def); ++ return config.getString("world-settings." + worldName + "." + path, config.getString("world-settings.default." + path)); ++ } ++} +diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java +index 0f8c10a..45680ed 100644 +--- a/src/main/java/net/minecraft/server/DedicatedServer.java ++++ b/src/main/java/net/minecraft/server/DedicatedServer.java +@@ -180,6 +180,10 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer + org.spigotmc.SpigotConfig.init((File) options.valueOf("spigot-settings")); + org.spigotmc.SpigotConfig.registerCommands(); + // Spigot end ++ // Paper start ++ com.destroystokyo.paper.PaperConfig.init((File) options.valueOf("paper-settings")); ++ com.destroystokyo.paper.PaperConfig.registerCommands(); ++ // Paper end + + DedicatedServer.LOGGER.info("Generating keypair"); + this.a(MinecraftEncryption.b()); +diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java +index 833d5a4..227fd95 100644 +--- a/src/main/java/net/minecraft/server/World.java ++++ b/src/main/java/net/minecraft/server/World.java +@@ -125,6 +125,8 @@ public abstract class World implements IBlockAccess { + private int tickPosition; + public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot + ++ public final com.destroystokyo.paper.PaperWorldConfig paperConfig; // Paper ++ + public final SpigotTimings.WorldTimingsHandler timings; // Spigot + private boolean guardEntityList; // Spigot + public static boolean haveWeSilencedAPhysicsCrash; +@@ -147,6 +149,7 @@ public abstract class World implements IBlockAccess { + + protected World(IDataManager idatamanager, WorldData worlddata, WorldProvider worldprovider, MethodProfiler methodprofiler, boolean flag, ChunkGenerator gen, org.bukkit.World.Environment env) { + this.spigotConfig = new org.spigotmc.SpigotWorldConfig( worlddata.getName() ); // Spigot ++ this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig( worlddata.getName() ); // Paper + this.generator = gen; + this.world = new CraftWorld((WorldServer) this, gen, env); + this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +index 7831a12..7e5870f 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +@@ -692,6 +692,7 @@ public final class CraftServer implements Server { + } + + org.spigotmc.SpigotConfig.init((File) console.options.valueOf("spigot-settings")); // Spigot ++ com.destroystokyo.paper.PaperConfig.init((File) console.options.valueOf("paper-settings")); // Paper + for (WorldServer world : console.worlds) { + world.worldData.setDifficulty(difficulty); + world.setSpawnFlags(monsters, animals); +@@ -707,12 +708,14 @@ public final class CraftServer implements Server { + world.ticksPerMonsterSpawns = this.getTicksPerMonsterSpawns(); + } + world.spigotConfig.init(); // Spigot ++ world.paperConfig.init(); // Paper + } + + pluginManager.clearPlugins(); + commandMap.clearCommands(); + resetRecipes(); + org.spigotmc.SpigotConfig.registerCommands(); // Spigot ++ com.destroystokyo.paper.PaperConfig.registerCommands(); // Paper + + overrideAllCommandBlockCommands = commandsConfiguration.getStringList("command-block-overrides").contains("*"); + +diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java +index 337aa29..979adad 100644 +--- a/src/main/java/org/bukkit/craftbukkit/Main.java ++++ b/src/main/java/org/bukkit/craftbukkit/Main.java +@@ -122,6 +122,14 @@ public class Main { + .defaultsTo(new File("spigot.yml")) + .describedAs("Yml file"); + // Spigot End ++ ++ // Paper Start ++ acceptsAll(asList("paper", "paper-settings"), "File for paper settings") ++ .withRequiredArg() ++ .ofType(File.class) ++ .defaultsTo(new File("paper.yml")) ++ .describedAs("Yml file"); ++ // Paper end + } + }; + +-- +2.7.2 + diff --git a/Spigot-Server-Patches/0002-PaperSpigot-config-files.patch b/Spigot-Server-Patches/0002-PaperSpigot-config-files.patch deleted file mode 100644 index c94fd2d5f6..0000000000 --- a/Spigot-Server-Patches/0002-PaperSpigot-config-files.patch +++ /dev/null @@ -1,321 +0,0 @@ -From d27df4714c775e383f7388373b4dac6aea181526 Mon Sep 17 00:00:00 2001 -From: Zach Brown -Date: Thu, 28 May 2015 00:08:15 -0500 -Subject: [PATCH] PaperSpigot config files - - -diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index c30867d..45cea14 100644 ---- a/src/main/java/net/minecraft/server/DedicatedServer.java -+++ b/src/main/java/net/minecraft/server/DedicatedServer.java -@@ -177,6 +177,10 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - org.spigotmc.SpigotConfig.init((File) options.valueOf("spigot-settings")); - org.spigotmc.SpigotConfig.registerCommands(); - // Spigot end -+ // PaperSpigot start -+ org.github.paperspigot.PaperSpigotConfig.init((File) options.valueOf("paper-settings")); -+ org.github.paperspigot.PaperSpigotConfig.registerCommands(); -+ // PaperSpigot end - - DedicatedServer.LOGGER.info("Generating keypair"); - this.a(MinecraftEncryption.b()); -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index eca86db8..bb46799 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -161,6 +161,8 @@ public abstract class World implements IBlockAccess { - - public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot - -+ public final org.github.paperspigot.PaperSpigotWorldConfig paperSpigotConfig; // PaperSpigot -+ - public final SpigotTimings.WorldTimingsHandler timings; // Spigot - - public CraftWorld getWorld() { -@@ -177,6 +179,7 @@ public abstract class World implements IBlockAccess { - - protected World(IDataManager idatamanager, WorldData worlddata, WorldProvider worldprovider, MethodProfiler methodprofiler, boolean flag, ChunkGenerator gen, org.bukkit.World.Environment env) { - this.spigotConfig = new org.spigotmc.SpigotWorldConfig( worlddata.getName() ); // Spigot -+ this.paperSpigotConfig = new org.github.paperspigot.PaperSpigotWorldConfig( worlddata.getName() ); // PaperSpigot - this.generator = gen; - this.world = new CraftWorld((WorldServer) this, gen, env); - this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 2759425..019f7a9 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -688,6 +688,7 @@ public final class CraftServer implements Server { - } - - org.spigotmc.SpigotConfig.init((File) console.options.valueOf("spigot-settings")); // Spigot -+ org.github.paperspigot.PaperSpigotConfig.init((File) console.options.valueOf("paper-settings")); // PaperSpigot - for (WorldServer world : console.worlds) { - world.worldData.setDifficulty(difficulty); - world.setSpawnFlags(monsters, animals); -@@ -703,12 +704,14 @@ public final class CraftServer implements Server { - world.ticksPerMonsterSpawns = this.getTicksPerMonsterSpawns(); - } - world.spigotConfig.init(); // Spigot -+ world.paperSpigotConfig.init(); // PaperSpigot - } - - pluginManager.clearPlugins(); - commandMap.clearCommands(); - resetRecipes(); - org.spigotmc.SpigotConfig.registerCommands(); // Spigot -+ org.github.paperspigot.PaperSpigotConfig.registerCommands(); // PaperSpigot - - overrideAllCommandBlockCommands = commandsConfiguration.getStringList("command-block-overrides").contains("*"); - -diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 337aa29..c936219 100644 ---- a/src/main/java/org/bukkit/craftbukkit/Main.java -+++ b/src/main/java/org/bukkit/craftbukkit/Main.java -@@ -122,6 +122,14 @@ public class Main { - .defaultsTo(new File("spigot.yml")) - .describedAs("Yml file"); - // Spigot End -+ -+ // PaperSpigot Start -+ acceptsAll(asList("paper", "paper-settings"), "File for paperspigot settings") -+ .withRequiredArg() -+ .ofType(File.class) -+ .defaultsTo(new File("paper.yml")) -+ .describedAs("Yml file"); -+ // PaperSpigot End - } - }; - -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java -new file mode 100644 -index 0000000..a08688f ---- /dev/null -+++ b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java -@@ -0,0 +1,141 @@ -+package org.github.paperspigot; -+ -+import com.google.common.base.Throwables; -+import java.io.File; -+import java.io.IOException; -+import java.lang.reflect.InvocationTargetException; -+import java.lang.reflect.Method; -+import java.lang.reflect.Modifier; -+import java.util.HashMap; -+import java.util.List; -+import java.util.Map; -+import java.util.logging.Level; -+import net.minecraft.server.MinecraftServer; -+import org.bukkit.Bukkit; -+import org.bukkit.command.Command; -+import org.bukkit.configuration.InvalidConfigurationException; -+import org.bukkit.configuration.file.YamlConfiguration; -+ -+public class PaperSpigotConfig -+{ -+ -+ private static File CONFIG_FILE; -+ private static final String HEADER = "This is the main configuration file for PaperSpigot.\n" -+ + "As you can see, there's tons to configure. Some options may impact gameplay, so use\n" -+ + "with caution, and make sure you know what each option does before configuring.\n" -+ + "\n" -+ + "If you need help with the configuration or have any questions related to PaperSpigot,\n" -+ + "join us at the IRC.\n" -+ + "\n" -+ + "IRC: #paperspigot @ irc.spi.gt ( http://irc.spi.gt/iris/?channels=PaperSpigot )\n"; -+ /*========================================================================*/ -+ public static YamlConfiguration config; -+ static int version; -+ static Map commands; -+ /*========================================================================*/ -+ -+ public static void init(File configFile) -+ { -+ CONFIG_FILE = configFile; -+ config = new YamlConfiguration(); -+ try -+ { -+ config.load ( CONFIG_FILE ); -+ } catch ( IOException ex ) -+ { -+ } catch ( InvalidConfigurationException ex ) -+ { -+ Bukkit.getLogger().log( Level.SEVERE, "Could not load paper.yml, please correct your syntax errors", ex ); -+ throw Throwables.propagate( ex ); -+ } -+ config.options().header( HEADER ); -+ config.options().copyDefaults( true ); -+ -+ commands = new HashMap(); -+ -+ version = getInt( "config-version", 9 ); -+ set( "config-version", 9 ); -+ readConfig( PaperSpigotConfig.class, null ); -+ } -+ -+ public static void registerCommands() -+ { -+ for ( Map.Entry entry : commands.entrySet() ) -+ { -+ MinecraftServer.getServer().server.getCommandMap().register( entry.getKey(), "PaperSpigot", entry.getValue() ); -+ } -+ } -+ -+ static void readConfig(Class clazz, Object instance) -+ { -+ for ( Method method : clazz.getDeclaredMethods() ) -+ { -+ if ( Modifier.isPrivate( method.getModifiers() ) ) -+ { -+ if ( method.getParameterTypes().length == 0 && method.getReturnType() == Void.TYPE ) -+ { -+ try -+ { -+ method.setAccessible( true ); -+ method.invoke( instance ); -+ } catch ( InvocationTargetException ex ) -+ { -+ throw Throwables.propagate( ex.getCause() ); -+ } catch ( Exception ex ) -+ { -+ Bukkit.getLogger().log( Level.SEVERE, "Error invoking " + method, ex ); -+ } -+ } -+ } -+ } -+ -+ try -+ { -+ config.save( CONFIG_FILE ); -+ } catch ( IOException ex ) -+ { -+ Bukkit.getLogger().log( Level.SEVERE, "Could not save " + CONFIG_FILE, ex ); -+ } -+ } -+ -+ private static void set(String path, Object val) -+ { -+ config.set( path, val ); -+ } -+ -+ private static boolean getBoolean(String path, boolean def) -+ { -+ config.addDefault( path, def ); -+ return config.getBoolean( path, config.getBoolean( path ) ); -+ } -+ -+ private static double getDouble(String path, double def) -+ { -+ config.addDefault( path, def ); -+ return config.getDouble( path, config.getDouble( path ) ); -+ } -+ -+ private static float getFloat(String path, float def) -+ { -+ // TODO: Figure out why getFloat() always returns the default value. -+ return (float) getDouble( path, (double) def ); -+ } -+ -+ private static int getInt(String path, int def) -+ { -+ config.addDefault( path, def ); -+ return config.getInt( path, config.getInt( path ) ); -+ } -+ -+ private static List getList(String path, T def) -+ { -+ config.addDefault( path, def ); -+ return (List) config.getList( path, config.getList( path ) ); -+ } -+ -+ private static String getString(String path, String def) -+ { -+ config.addDefault( path, def ); -+ return config.getString( path, config.getString( path ) ); -+ } -+} -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -new file mode 100644 -index 0000000..146324a ---- /dev/null -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -0,0 +1,77 @@ -+package org.github.paperspigot; -+ -+import java.util.List; -+import org.bukkit.Bukkit; -+import org.bukkit.configuration.file.YamlConfiguration; -+ -+public class PaperSpigotWorldConfig -+{ -+ -+ private final String worldName; -+ private final YamlConfiguration config; -+ private boolean verbose; -+ -+ public PaperSpigotWorldConfig(String worldName) -+ { -+ this.worldName = worldName; -+ this.config = PaperSpigotConfig.config; -+ init(); -+ } -+ -+ public void init() -+ { -+ this.verbose = getBoolean( "verbose", true ); -+ -+ log( "-------- World Settings For [" + worldName + "] --------" ); -+ PaperSpigotConfig.readConfig( PaperSpigotWorldConfig.class, this ); -+ } -+ -+ private void log(String s) -+ { -+ if ( verbose ) -+ { -+ Bukkit.getLogger().info( s ); -+ } -+ } -+ -+ private void set(String path, Object val) -+ { -+ config.set( "world-settings.default." + path, val ); -+ } -+ -+ private boolean getBoolean(String path, boolean def) -+ { -+ config.addDefault( "world-settings.default." + path, def ); -+ return config.getBoolean( "world-settings." + worldName + "." + path, config.getBoolean( "world-settings.default." + path ) ); -+ } -+ -+ private double getDouble(String path, double def) -+ { -+ config.addDefault( "world-settings.default." + path, def ); -+ return config.getDouble( "world-settings." + worldName + "." + path, config.getDouble( "world-settings.default." + path ) ); -+ } -+ -+ private int getInt(String path, int def) -+ { -+ config.addDefault( "world-settings.default." + path, def ); -+ return config.getInt( "world-settings." + worldName + "." + path, config.getInt( "world-settings.default." + path ) ); -+ } -+ -+ private float getFloat(String path, float def) -+ { -+ // TODO: Figure out why getFloat() always returns the default value. -+ return (float) getDouble( path, (double) def ); -+ } -+ -+ private List getList(String path, T def) -+ { -+ config.addDefault( "world-settings.default." + path, def ); -+ return (List) config.getList( "world-settings." + worldName + "." + path, config.getList( "world-settings.default." + path ) ); -+ } -+ -+ private String getString(String path, String def) -+ { -+ config.addDefault( "world-settings.default." + path, def ); -+ return config.getString( "world-settings." + worldName + "." + path, config.getString( "world-settings.default." + path ) ); -+ } -+} --- -2.7.0 - diff --git a/Spigot-Server-Patches/0003-mc-dev-imports.patch b/Spigot-Server-Patches/0003-mc-dev-imports.patch index 0bae8eccb9..d20315fe42 100644 --- a/Spigot-Server-Patches/0003-mc-dev-imports.patch +++ b/Spigot-Server-Patches/0003-mc-dev-imports.patch @@ -1,114 +1,21 @@ -From e9f93a9efde92cdfd70b6d404621281f3761c519 Mon Sep 17 00:00:00 2001 +From 541eaa4579cd06028863b58078500cdcb86fab6d Mon Sep 17 00:00:00 2001 From: Zach Brown -Date: Mon, 25 May 2015 15:37:00 -0500 +Date: Mon, 29 Feb 2016 21:09:10 -0600 Subject: [PATCH] mc-dev imports -diff --git a/src/main/java/net/minecraft/server/BaseBlockPosition.java b/src/main/java/net/minecraft/server/BaseBlockPosition.java -new file mode 100644 -index 0000000..0b2277c ---- /dev/null -+++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java -@@ -0,0 +1,85 @@ -+package net.minecraft.server; -+ -+import com.google.common.base.Objects; -+ -+public class BaseBlockPosition implements Comparable { -+ -+ public static final BaseBlockPosition ZERO = new BaseBlockPosition(0, 0, 0); -+ private final int a; -+ private final int c; -+ private final int d; -+ -+ public BaseBlockPosition(int i, int j, int k) { -+ this.a = i; -+ this.c = j; -+ this.d = k; -+ } -+ -+ public BaseBlockPosition(double d0, double d1, double d2) { -+ this(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2)); -+ } -+ -+ public boolean equals(Object object) { -+ if (this == object) { -+ return true; -+ } else if (!(object instanceof BaseBlockPosition)) { -+ return false; -+ } else { -+ BaseBlockPosition baseblockposition = (BaseBlockPosition) object; -+ -+ return this.getX() != baseblockposition.getX() ? false : (this.getY() != baseblockposition.getY() ? false : this.getZ() == baseblockposition.getZ()); -+ } -+ } -+ -+ public int hashCode() { -+ return (this.getY() + this.getZ() * 31) * 31 + this.getX(); -+ } -+ -+ public int g(BaseBlockPosition baseblockposition) { -+ return this.getY() == baseblockposition.getY() ? (this.getZ() == baseblockposition.getZ() ? this.getX() - baseblockposition.getX() : this.getZ() - baseblockposition.getZ()) : this.getY() - baseblockposition.getY(); -+ } -+ -+ public int getX() { -+ return this.a; -+ } -+ -+ public int getY() { -+ return this.c; -+ } -+ -+ public int getZ() { -+ return this.d; -+ } -+ -+ public BaseBlockPosition d(BaseBlockPosition baseblockposition) { -+ return new BaseBlockPosition(this.getY() * baseblockposition.getZ() - this.getZ() * baseblockposition.getY(), this.getZ() * baseblockposition.getX() - this.getX() * baseblockposition.getZ(), this.getX() * baseblockposition.getY() - this.getY() * baseblockposition.getX()); -+ } -+ -+ public double c(double d0, double d1, double d2) { -+ double d3 = (double) this.getX() - d0; -+ double d4 = (double) this.getY() - d1; -+ double d5 = (double) this.getZ() - d2; -+ -+ return d3 * d3 + d4 * d4 + d5 * d5; -+ } -+ -+ public double d(double d0, double d1, double d2) { -+ double d3 = (double) this.getX() + 0.5D - d0; -+ double d4 = (double) this.getY() + 0.5D - d1; -+ double d5 = (double) this.getZ() + 0.5D - d2; -+ -+ return d3 * d3 + d4 * d4 + d5 * d5; -+ } -+ -+ public double i(BaseBlockPosition baseblockposition) { -+ return this.c((double) baseblockposition.getX(), (double) baseblockposition.getY(), (double) baseblockposition.getZ()); -+ } -+ -+ public String toString() { -+ return Objects.toStringHelper(this).add("x", this.getX()).add("y", this.getY()).add("z", this.getZ()).toString(); -+ } -+ -+ public int compareTo(Object object) { -+ return this.g((BaseBlockPosition) object); -+ } -+} diff --git a/src/main/java/net/minecraft/server/BiomeBase.java b/src/main/java/net/minecraft/server/BiomeBase.java new file mode 100644 -index 0000000..b1ae67a +index 0000000..be4b871 --- /dev/null +++ b/src/main/java/net/minecraft/server/BiomeBase.java -@@ -0,0 +1,489 @@ +@@ -0,0 +1,463 @@ +package net.minecraft.server; + +import com.google.common.collect.Lists; -+import com.google.common.collect.Maps; +import com.google.common.collect.Sets; +import java.util.Collections; +import java.util.List; -+import java.util.Map; +import java.util.Random; +import java.util.Set; +import org.apache.logging.log4j.LogManager; @@ -116,153 +23,95 @@ index 0000000..b1ae67a + +public abstract class BiomeBase { + -+ private static final Logger aD = LogManager.getLogger(); -+ protected static final BiomeTemperature a = new BiomeTemperature(0.1F, 0.2F); -+ protected static final BiomeTemperature b = new BiomeTemperature(-0.5F, 0.0F); -+ protected static final BiomeTemperature c = new BiomeTemperature(-1.0F, 0.1F); -+ protected static final BiomeTemperature d = new BiomeTemperature(-1.8F, 0.1F); -+ protected static final BiomeTemperature e = new BiomeTemperature(0.125F, 0.05F); -+ protected static final BiomeTemperature f = new BiomeTemperature(0.2F, 0.2F); -+ protected static final BiomeTemperature g = new BiomeTemperature(0.45F, 0.3F); -+ protected static final BiomeTemperature h = new BiomeTemperature(1.5F, 0.025F); -+ protected static final BiomeTemperature i = new BiomeTemperature(1.0F, 0.5F); -+ protected static final BiomeTemperature j = new BiomeTemperature(0.0F, 0.025F); -+ protected static final BiomeTemperature k = new BiomeTemperature(0.1F, 0.8F); -+ protected static final BiomeTemperature l = new BiomeTemperature(0.2F, 0.3F); -+ protected static final BiomeTemperature m = new BiomeTemperature(-0.2F, 0.1F); -+ private static final BiomeBase[] biomes = new BiomeBase[256]; -+ public static final Set n = Sets.newHashSet(); -+ public static final Map o = Maps.newHashMap(); -+ public static final BiomeBase OCEAN = (new BiomeOcean(0)).b(112).a("Ocean").a(BiomeBase.c); -+ public static final BiomeBase PLAINS = (new BiomePlains(1)).b(9286496).a("Plains"); -+ public static final BiomeBase DESERT = (new BiomeDesert(2)).b(16421912).a("Desert").b().a(2.0F, 0.0F).a(BiomeBase.e); -+ public static final BiomeBase EXTREME_HILLS = (new BiomeBigHills(3, false)).b(6316128).a("Extreme Hills").a(BiomeBase.i).a(0.2F, 0.3F); -+ public static final BiomeBase FOREST = (new BiomeForest(4, 0)).b(353825).a("Forest"); -+ public static final BiomeBase TAIGA = (new BiomeTaiga(5, 0)).b(747097).a("Taiga").a(5159473).a(0.25F, 0.8F).a(BiomeBase.f); -+ public static final BiomeBase SWAMPLAND = (new BiomeSwamp(6)).b(522674).a("Swampland").a(9154376).a(BiomeBase.m).a(0.8F, 0.9F); -+ public static final BiomeBase RIVER = (new BiomeRiver(7)).b(255).a("River").a(BiomeBase.b); -+ public static final BiomeBase HELL = (new BiomeHell(8)).b(16711680).a("Hell").b().a(2.0F, 0.0F); -+ public static final BiomeBase SKY = (new BiomeTheEnd(9)).b(8421631).a("The End").b(); -+ public static final BiomeBase FROZEN_OCEAN = (new BiomeOcean(10)).b(9474208).a("FrozenOcean").c().a(BiomeBase.c).a(0.0F, 0.5F); -+ public static final BiomeBase FROZEN_RIVER = (new BiomeRiver(11)).b(10526975).a("FrozenRiver").c().a(BiomeBase.b).a(0.0F, 0.5F); -+ public static final BiomeBase ICE_PLAINS = (new BiomeIcePlains(12, false)).b(16777215).a("Ice Plains").c().a(0.0F, 0.5F).a(BiomeBase.e); -+ public static final BiomeBase ICE_MOUNTAINS = (new BiomeIcePlains(13, false)).b(10526880).a("Ice Mountains").c().a(BiomeBase.g).a(0.0F, 0.5F); -+ public static final BiomeBase MUSHROOM_ISLAND = (new BiomeMushrooms(14)).b(16711935).a("MushroomIsland").a(0.9F, 1.0F).a(BiomeBase.l); -+ public static final BiomeBase MUSHROOM_SHORE = (new BiomeMushrooms(15)).b(10486015).a("MushroomIslandShore").a(0.9F, 1.0F).a(BiomeBase.j); -+ public static final BiomeBase BEACH = (new BiomeBeach(16)).b(16440917).a("Beach").a(0.8F, 0.4F).a(BiomeBase.j); -+ public static final BiomeBase DESERT_HILLS = (new BiomeDesert(17)).b(13786898).a("DesertHills").b().a(2.0F, 0.0F).a(BiomeBase.g); -+ public static final BiomeBase FOREST_HILLS = (new BiomeForest(18, 0)).b(2250012).a("ForestHills").a(BiomeBase.g); -+ public static final BiomeBase TAIGA_HILLS = (new BiomeTaiga(19, 0)).b(1456435).a("TaigaHills").a(5159473).a(0.25F, 0.8F).a(BiomeBase.g); -+ public static final BiomeBase SMALL_MOUNTAINS = (new BiomeBigHills(20, true)).b(7501978).a("Extreme Hills Edge").a(BiomeBase.i.a()).a(0.2F, 0.3F); -+ public static final BiomeBase JUNGLE = (new BiomeJungle(21, false)).b(5470985).a("Jungle").a(5470985).a(0.95F, 0.9F); -+ public static final BiomeBase JUNGLE_HILLS = (new BiomeJungle(22, false)).b(2900485).a("JungleHills").a(5470985).a(0.95F, 0.9F).a(BiomeBase.g); -+ public static final BiomeBase JUNGLE_EDGE = (new BiomeJungle(23, true)).b(6458135).a("JungleEdge").a(5470985).a(0.95F, 0.8F); -+ public static final BiomeBase DEEP_OCEAN = (new BiomeOcean(24)).b(48).a("Deep Ocean").a(BiomeBase.d); -+ public static final BiomeBase STONE_BEACH = (new BiomeStoneBeach(25)).b(10658436).a("Stone Beach").a(0.2F, 0.3F).a(BiomeBase.k); -+ public static final BiomeBase COLD_BEACH = (new BiomeBeach(26)).b(16445632).a("Cold Beach").a(0.05F, 0.3F).a(BiomeBase.j).c(); -+ public static final BiomeBase BIRCH_FOREST = (new BiomeForest(27, 2)).a("Birch Forest").b(3175492); -+ public static final BiomeBase BIRCH_FOREST_HILLS = (new BiomeForest(28, 2)).a("Birch Forest Hills").b(2055986).a(BiomeBase.g); -+ public static final BiomeBase ROOFED_FOREST = (new BiomeForest(29, 3)).b(4215066).a("Roofed Forest"); -+ public static final BiomeBase COLD_TAIGA = (new BiomeTaiga(30, 0)).b(3233098).a("Cold Taiga").a(5159473).c().a(-0.5F, 0.4F).a(BiomeBase.f).c(16777215); -+ public static final BiomeBase COLD_TAIGA_HILLS = (new BiomeTaiga(31, 0)).b(2375478).a("Cold Taiga Hills").a(5159473).c().a(-0.5F, 0.4F).a(BiomeBase.g).c(16777215); -+ public static final BiomeBase MEGA_TAIGA = (new BiomeTaiga(32, 1)).b(5858897).a("Mega Taiga").a(5159473).a(0.3F, 0.8F).a(BiomeBase.f); -+ public static final BiomeBase MEGA_TAIGA_HILLS = (new BiomeTaiga(33, 1)).b(4542270).a("Mega Taiga Hills").a(5159473).a(0.3F, 0.8F).a(BiomeBase.g); -+ public static final BiomeBase EXTREME_HILLS_PLUS = (new BiomeBigHills(34, true)).b(5271632).a("Extreme Hills+").a(BiomeBase.i).a(0.2F, 0.3F); -+ public static final BiomeBase SAVANNA = (new BiomeSavanna(35)).b(12431967).a("Savanna").a(1.2F, 0.0F).b().a(BiomeBase.e); -+ public static final BiomeBase SAVANNA_PLATEAU = (new BiomeSavanna(36)).b(10984804).a("Savanna Plateau").a(1.0F, 0.0F).b().a(BiomeBase.h); -+ public static final BiomeBase MESA = (new BiomeMesa(37, false, false)).b(14238997).a("Mesa"); -+ public static final BiomeBase MESA_PLATEAU_F = (new BiomeMesa(38, false, true)).b(11573093).a("Mesa Plateau F").a(BiomeBase.h); -+ public static final BiomeBase MESA_PLATEAU = (new BiomeMesa(39, false, false)).b(13274213).a("Mesa Plateau").a(BiomeBase.h); -+ public static final BiomeBase ad = BiomeBase.OCEAN; -+ protected static final NoiseGenerator3 ae; -+ protected static final NoiseGenerator3 af; -+ protected static final WorldGenTallPlant ag; -+ public String ah; -+ public int ai; -+ public int aj; -+ public IBlockData ak; -+ public IBlockData al; -+ public int am; -+ public float an; -+ public float ao; -+ public float temperature; -+ public float humidity; -+ public int ar; -+ public BiomeDecorator as; -+ protected List at; -+ protected List au; -+ protected List av; -+ protected List aw; -+ protected boolean ax; -+ protected boolean ay; -+ public final int id; -+ protected WorldGenTrees aA; -+ protected WorldGenBigTree aB; -+ protected WorldGenSwampTree aC; ++ private static final Logger y = LogManager.getLogger(); ++ protected static final IBlockData a = Blocks.STONE.getBlockData(); ++ protected static final IBlockData b = Blocks.AIR.getBlockData(); ++ protected static final IBlockData c = Blocks.BEDROCK.getBlockData(); ++ protected static final IBlockData d = Blocks.GRAVEL.getBlockData(); ++ protected static final IBlockData e = Blocks.RED_SANDSTONE.getBlockData(); ++ protected static final IBlockData f = Blocks.SANDSTONE.getBlockData(); ++ protected static final IBlockData g = Blocks.ICE.getBlockData(); ++ protected static final IBlockData h = Blocks.WATER.getBlockData(); ++ public static final Set i = Sets.newHashSet(); ++ public static final RegistryBlockID j = new RegistryBlockID(); ++ protected static final NoiseGenerator3 k = new NoiseGenerator3(new Random(1234L), 1); ++ protected static final NoiseGenerator3 l = new NoiseGenerator3(new Random(2345L), 1); ++ protected static final WorldGenTallPlant m = new WorldGenTallPlant(); ++ protected static final WorldGenTrees n = new WorldGenTrees(false); ++ protected static final WorldGenBigTree o = new WorldGenBigTree(false); ++ protected static final WorldGenSwampTree p = new WorldGenSwampTree(); ++ public static final RegistryMaterials REGISTRY_ID = new RegistryMaterials(); ++ private final String z; ++ private final float A; ++ private final float B; ++ private final float C; ++ private final float D; ++ private final int E; ++ private final boolean F; ++ private final boolean G; ++ private final String H; ++ public IBlockData r; ++ public IBlockData s; ++ public BiomeDecorator t; ++ protected List u; ++ protected List v; ++ protected List w; ++ protected List x; + -+ protected BiomeBase(int i) { -+ this.ak = Blocks.GRASS.getBlockData(); -+ this.al = Blocks.DIRT.getBlockData(); -+ this.am = 5169201; -+ this.an = BiomeBase.a.a; -+ this.ao = BiomeBase.a.b; -+ this.temperature = 0.5F; -+ this.humidity = 0.5F; -+ this.ar = 16777215; -+ this.at = Lists.newArrayList(); -+ this.au = Lists.newArrayList(); -+ this.av = Lists.newArrayList(); -+ this.aw = Lists.newArrayList(); -+ this.ay = true; -+ this.aA = new WorldGenTrees(false); -+ this.aB = new WorldGenBigTree(false); -+ this.aC = new WorldGenSwampTree(); -+ this.id = i; -+ BiomeBase.biomes[i] = this; -+ this.as = this.a(); -+ this.au.add(new BiomeMeta(EntitySheep.class, 12, 4, 4)); -+ this.au.add(new BiomeMeta(EntityRabbit.class, 10, 3, 3)); -+ this.au.add(new BiomeMeta(EntityPig.class, 10, 4, 4)); -+ this.au.add(new BiomeMeta(EntityChicken.class, 10, 4, 4)); -+ this.au.add(new BiomeMeta(EntityCow.class, 8, 4, 4)); -+ this.at.add(new BiomeMeta(EntitySpider.class, 100, 4, 4)); -+ this.at.add(new BiomeMeta(EntityZombie.class, 100, 4, 4)); -+ this.at.add(new BiomeMeta(EntitySkeleton.class, 100, 4, 4)); -+ this.at.add(new BiomeMeta(EntityCreeper.class, 100, 4, 4)); -+ this.at.add(new BiomeMeta(EntitySlime.class, 100, 4, 4)); -+ this.at.add(new BiomeMeta(EntityEnderman.class, 10, 1, 4)); -+ this.at.add(new BiomeMeta(EntityWitch.class, 5, 1, 1)); -+ this.av.add(new BiomeMeta(EntitySquid.class, 10, 4, 4)); -+ this.aw.add(new BiomeMeta(EntityBat.class, 10, 8, 8)); ++ public static int a(BiomeBase biomebase) { ++ return BiomeBase.REGISTRY_ID.a((Object) biomebase); ++ } ++ ++ public static BiomeBase a(int i) { ++ return (BiomeBase) BiomeBase.REGISTRY_ID.getId(i); ++ } ++ ++ public static BiomeBase b(BiomeBase biomebase) { ++ return (BiomeBase) BiomeBase.j.fromId(a(biomebase)); ++ } ++ ++ protected BiomeBase(BiomeBase.a biomebase_a) { ++ this.r = Blocks.GRASS.getBlockData(); ++ this.s = Blocks.DIRT.getBlockData(); ++ this.u = Lists.newArrayList(); ++ this.v = Lists.newArrayList(); ++ this.w = Lists.newArrayList(); ++ this.x = Lists.newArrayList(); ++ this.z = biomebase_a.a; ++ this.A = biomebase_a.b; ++ this.B = biomebase_a.c; ++ this.C = biomebase_a.d; ++ this.D = biomebase_a.e; ++ this.E = biomebase_a.f; ++ this.F = biomebase_a.g; ++ this.G = biomebase_a.h; ++ this.H = biomebase_a.i; ++ this.t = this.a(); ++ this.v.add(new BiomeBase.BiomeMeta(EntitySheep.class, 12, 4, 4)); ++ this.v.add(new BiomeBase.BiomeMeta(EntityPig.class, 10, 4, 4)); ++ this.v.add(new BiomeBase.BiomeMeta(EntityChicken.class, 10, 4, 4)); ++ this.v.add(new BiomeBase.BiomeMeta(EntityCow.class, 8, 4, 4)); ++ this.u.add(new BiomeBase.BiomeMeta(EntitySpider.class, 100, 4, 4)); ++ this.u.add(new BiomeBase.BiomeMeta(EntityZombie.class, 100, 4, 4)); ++ this.u.add(new BiomeBase.BiomeMeta(EntitySkeleton.class, 100, 4, 4)); ++ this.u.add(new BiomeBase.BiomeMeta(EntityCreeper.class, 100, 4, 4)); ++ this.u.add(new BiomeBase.BiomeMeta(EntitySlime.class, 100, 4, 4)); ++ this.u.add(new BiomeBase.BiomeMeta(EntityEnderman.class, 10, 1, 4)); ++ this.u.add(new BiomeBase.BiomeMeta(EntityWitch.class, 5, 1, 1)); ++ this.w.add(new BiomeBase.BiomeMeta(EntitySquid.class, 10, 4, 4)); ++ this.x.add(new BiomeBase.BiomeMeta(EntityBat.class, 10, 8, 8)); + } + + protected BiomeDecorator a() { + return new BiomeDecorator(); + } + -+ protected BiomeBase a(float f, float f1) { -+ if (f > 0.1F && f < 0.2F) { -+ throw new IllegalArgumentException("Please avoid temperatures in the range 0.1 - 0.2 because of snow"); -+ } else { -+ this.temperature = f; -+ this.humidity = f1; -+ return this; -+ } -+ } -+ -+ protected final BiomeBase a(BiomeTemperature biomebase_biometemperature) { -+ this.an = biomebase_biometemperature.a; -+ this.ao = biomebase_biometemperature.b; -+ return this; -+ } -+ -+ protected BiomeBase b() { -+ this.ay = false; -+ return this; ++ public boolean b() { ++ return this.H != null; + } + + public WorldGenTreeAbstract a(Random random) { -+ return (WorldGenTreeAbstract) (random.nextInt(10) == 0 ? this.aB : this.aA); ++ return (WorldGenTreeAbstract) (random.nextInt(10) == 0 ? BiomeBase.o : BiomeBase.n); + } + + public WorldGenerator b(Random random) { @@ -273,97 +122,53 @@ index 0000000..b1ae67a + return random.nextInt(3) > 0 ? BlockFlowers.EnumFlowerVarient.DANDELION : BlockFlowers.EnumFlowerVarient.POPPY; + } + -+ protected BiomeBase c() { -+ this.ax = true; -+ return this; -+ } -+ -+ protected BiomeBase a(String s) { -+ this.ah = s; -+ return this; -+ } -+ -+ protected BiomeBase a(int i) { -+ this.am = i; -+ return this; -+ } -+ -+ protected BiomeBase b(int i) { -+ this.a(i, false); -+ return this; -+ } -+ -+ protected BiomeBase c(int i) { -+ this.aj = i; -+ return this; -+ } -+ -+ protected BiomeBase a(int i, boolean flag) { -+ this.ai = i; -+ if (flag) { -+ this.aj = (i & 16711422) >> 1; -+ } else { -+ this.aj = i; -+ } -+ -+ return this; -+ } -+ -+ public List getMobs(EnumCreatureType enumcreaturetype) { -+ switch (SyntheticClass_1.switchMap[enumcreaturetype.ordinal()]) { ++ public List getMobs(EnumCreatureType enumcreaturetype) { ++ switch (BiomeBase.SyntheticClass_1.a[enumcreaturetype.ordinal()]) { + case 1: -+ return this.at; ++ return this.u; + + case 2: -+ return this.au; ++ return this.v; + + case 3: -+ return this.av; ++ return this.w; + + case 4: -+ return this.aw; ++ return this.x; + + default: + return Collections.emptyList(); + } + } + ++ public boolean c() { ++ return this.p(); ++ } ++ + public boolean d() { -+ return this.j(); ++ return this.p() ? false : this.G; + } + + public boolean e() { -+ return this.j() ? false : this.ay; ++ return this.getHumidity() > 0.85F; + } + -+ public boolean f() { -+ return this.humidity > 0.85F; -+ } -+ -+ public float g() { ++ public float f() { + return 0.1F; + } + -+ public final int h() { -+ return (int) (this.humidity * 65536.0F); -+ } -+ + public final float a(BlockPosition blockposition) { + if (blockposition.getY() > 64) { -+ float f = (float) (BiomeBase.ae.a((double) blockposition.getX() * 1.0D / 8.0D, (double) blockposition.getZ() * 1.0D / 8.0D) * 4.0D); ++ float f = (float) (BiomeBase.k.a((double) ((float) blockposition.getX() / 8.0F), (double) ((float) blockposition.getZ() / 8.0F)) * 4.0D); + -+ return this.temperature - (f + (float) blockposition.getY() - 64.0F) * 0.05F / 30.0F; ++ return this.getTemperature() - (f + (float) blockposition.getY() - 64.0F) * 0.05F / 30.0F; + } else { -+ return this.temperature; ++ return this.getTemperature(); + } + } + + public void a(World world, Random random, BlockPosition blockposition) { -+ this.as.a(world, random, this, blockposition); -+ } -+ -+ public boolean j() { -+ return this.ax; ++ this.t.a(world, random, this, blockposition); + } + + public void a(World world, Random random, ChunkSnapshot chunksnapshot, int i, int j, double d0) { @@ -371,9 +176,9 @@ index 0000000..b1ae67a + } + + public final void b(World world, Random random, ChunkSnapshot chunksnapshot, int i, int j, double d0) { -+ int k = world.F(); -+ IBlockData iblockdata = this.ak; -+ IBlockData iblockdata1 = this.al; ++ int k = world.K(); ++ IBlockData iblockdata = this.r; ++ IBlockData iblockdata1 = this.s; + int l = -1; + int i1 = (int) (d0 / 3.0D + 3.0D + random.nextDouble() * 0.25D); + int j1 = i & 15; @@ -382,27 +187,27 @@ index 0000000..b1ae67a + + for (int l1 = 255; l1 >= 0; --l1) { + if (l1 <= random.nextInt(5)) { -+ chunksnapshot.a(k1, l1, j1, Blocks.BEDROCK.getBlockData()); ++ chunksnapshot.a(k1, l1, j1, BiomeBase.c); + } else { + IBlockData iblockdata2 = chunksnapshot.a(k1, l1, j1); + -+ if (iblockdata2.getBlock().getMaterial() == Material.AIR) { ++ if (iblockdata2.getMaterial() == Material.AIR) { + l = -1; + } else if (iblockdata2.getBlock() == Blocks.STONE) { + if (l == -1) { + if (i1 <= 0) { -+ iblockdata = null; -+ iblockdata1 = Blocks.STONE.getBlockData(); ++ iblockdata = BiomeBase.b; ++ iblockdata1 = BiomeBase.a; + } else if (l1 >= k - 4 && l1 <= k + 1) { -+ iblockdata = this.ak; -+ iblockdata1 = this.al; ++ iblockdata = this.r; ++ iblockdata1 = this.s; + } + -+ if (l1 < k && (iblockdata == null || iblockdata.getBlock().getMaterial() == Material.AIR)) { ++ if (l1 < k && (iblockdata == null || iblockdata.getMaterial() == Material.AIR)) { + if (this.a((BlockPosition) blockposition_mutableblockposition.c(i, l1, j)) < 0.15F) { -+ iblockdata = Blocks.ICE.getBlockData(); ++ iblockdata = BiomeBase.g; + } else { -+ iblockdata = Blocks.WATER.getBlockData(); ++ iblockdata = BiomeBase.h; + } + } + @@ -410,9 +215,9 @@ index 0000000..b1ae67a + if (l1 >= k - 1) { + chunksnapshot.a(k1, l1, j1, iblockdata); + } else if (l1 < k - 7 - i1) { -+ iblockdata = null; -+ iblockdata1 = Blocks.STONE.getBlockData(); -+ chunksnapshot.a(k1, l1, j1, Blocks.GRAVEL.getBlockData()); ++ iblockdata = BiomeBase.b; ++ iblockdata1 = BiomeBase.a; ++ chunksnapshot.a(k1, l1, j1, BiomeBase.d); + } else { + chunksnapshot.a(k1, l1, j1, iblockdata1); + } @@ -421,7 +226,7 @@ index 0000000..b1ae67a + chunksnapshot.a(k1, l1, j1, iblockdata1); + if (l == 0 && iblockdata1.getBlock() == Blocks.SAND) { + l = random.nextInt(4) + Math.max(0, l1 - 63); -+ iblockdata1 = iblockdata1.get(BlockSand.VARIANT) == BlockSand.EnumSandVariant.RED_SAND ? Blocks.RED_SANDSTONE.getBlockData() : Blocks.SANDSTONE.getBlockData(); ++ iblockdata1 = iblockdata1.get(BlockSand.VARIANT) == BlockSand.EnumSandVariant.RED_SAND ? BiomeBase.e : BiomeBase.f; + } + } + } @@ -430,28 +235,12 @@ index 0000000..b1ae67a + + } + -+ protected BiomeBase k() { -+ return this.d(this.id + 128); -+ } -+ -+ protected BiomeBase d(int i) { -+ return new BiomeBaseSub(i, this); -+ } -+ -+ public Class l() { ++ public Class g() { + return this.getClass(); + } + -+ public boolean a(BiomeBase biomebase) { -+ return biomebase == this ? true : (biomebase == null ? false : this.l() == biomebase.l()); -+ } -+ -+ public EnumTemperature m() { -+ return (double) this.temperature < 0.2D ? EnumTemperature.COLD : ((double) this.temperature < 1.0D ? EnumTemperature.MEDIUM : EnumTemperature.WARM); -+ } -+ -+ public static BiomeBase[] getBiomes() { -+ return BiomeBase.biomes; ++ public BiomeBase.EnumTemperature h() { ++ return (double) this.getTemperature() < 0.2D ? BiomeBase.EnumTemperature.COLD : ((double) this.getTemperature() < 1.0D ? BiomeBase.EnumTemperature.MEDIUM : BiomeBase.EnumTemperature.WARM); + } + + public static BiomeBase getBiome(int i) { @@ -459,90 +248,138 @@ index 0000000..b1ae67a + } + + public static BiomeBase getBiome(int i, BiomeBase biomebase) { -+ if (i >= 0 && i <= BiomeBase.biomes.length) { -+ BiomeBase biomebase1 = BiomeBase.biomes[i]; ++ BiomeBase biomebase1 = a(i); + -+ return biomebase1 == null ? biomebase : biomebase1; -+ } else { -+ BiomeBase.aD.warn("Biome ID is out of bounds: " + i + ", defaulting to 0 (Ocean)"); -+ return BiomeBase.OCEAN; -+ } ++ return biomebase1 == null ? biomebase : biomebase1; + } + -+ static { -+ BiomeBase.PLAINS.k(); -+ BiomeBase.DESERT.k(); -+ BiomeBase.FOREST.k(); -+ BiomeBase.TAIGA.k(); -+ BiomeBase.SWAMPLAND.k(); -+ BiomeBase.ICE_PLAINS.k(); -+ BiomeBase.JUNGLE.k(); -+ BiomeBase.JUNGLE_EDGE.k(); -+ BiomeBase.COLD_TAIGA.k(); -+ BiomeBase.SAVANNA.k(); -+ BiomeBase.SAVANNA_PLATEAU.k(); -+ BiomeBase.MESA.k(); -+ BiomeBase.MESA_PLATEAU_F.k(); -+ BiomeBase.MESA_PLATEAU.k(); -+ BiomeBase.BIRCH_FOREST.k(); -+ BiomeBase.BIRCH_FOREST_HILLS.k(); -+ BiomeBase.ROOFED_FOREST.k(); -+ BiomeBase.MEGA_TAIGA.k(); -+ BiomeBase.EXTREME_HILLS.k(); -+ BiomeBase.EXTREME_HILLS_PLUS.k(); -+ BiomeBase.MEGA_TAIGA.d(BiomeBase.MEGA_TAIGA_HILLS.id + 128).a("Redwood Taiga Hills M"); -+ BiomeBase[] abiomebase = BiomeBase.biomes; -+ int i = abiomebase.length; ++ public boolean i() { ++ return false; ++ } + -+ for (int j = 0; j < i; ++j) { -+ BiomeBase biomebase = abiomebase[j]; ++ public final float j() { ++ return this.A; ++ } + -+ if (biomebase != null) { -+ if (BiomeBase.o.containsKey(biomebase.ah)) { -+ throw new Error("Biome \"" + biomebase.ah + "\" is defined as both ID " + ((BiomeBase) BiomeBase.o.get(biomebase.ah)).id + " and " + biomebase.id); -+ } ++ public final float getHumidity() { ++ return this.D; ++ } + -+ BiomeBase.o.put(biomebase.ah, biomebase); -+ if (biomebase.id < 128) { -+ BiomeBase.n.add(biomebase); -+ } -+ } ++ public final String l() { ++ return this.z; ++ } ++ ++ public final float m() { ++ return this.B; ++ } ++ ++ public final float getTemperature() { ++ return this.C; ++ } ++ ++ public final boolean p() { ++ return this.F; ++ } ++ ++ public static void q() { ++ a(0, "ocean", new BiomeOcean((new BiomeBase.a("Ocean")).c(-1.0F).d(0.1F))); ++ a(1, "plains", new BiomePlains(false, (new BiomeBase.a("Plains")).c(0.125F).d(0.05F).a(0.8F).b(0.4F))); ++ a(2, "desert", new BiomeDesert((new BiomeBase.a("Desert")).c(0.125F).d(0.05F).a(2.0F).b(0.0F).a())); ++ a(3, "extreme_hills", new BiomeBigHills(BiomeBigHills.Type.NORMAL, (new BiomeBase.a("Extreme Hills")).c(1.0F).d(0.5F).a(0.2F).b(0.3F))); ++ a(4, "forest", new BiomeForest(BiomeForest.Type.NORMAL, (new BiomeBase.a("Forest")).a(0.7F).b(0.8F))); ++ a(5, "taiga", new BiomeTaiga(BiomeTaiga.Type.NORMAL, (new BiomeBase.a("Taiga")).c(0.2F).d(0.2F).a(0.25F).b(0.8F))); ++ a(6, "swampland", new BiomeSwamp((new BiomeBase.a("Swampland")).c(-0.2F).d(0.1F).a(0.8F).b(0.9F).a(14745518))); ++ a(7, "river", new BiomeRiver((new BiomeBase.a("River")).c(-0.5F).d(0.0F))); ++ a(8, "hell", new BiomeHell((new BiomeBase.a("Hell")).a(2.0F).b(0.0F).a())); ++ a(9, "sky", new BiomeTheEnd((new BiomeBase.a("The End")).a())); ++ a(10, "frozen_ocean", new BiomeOcean((new BiomeBase.a("FrozenOcean")).c(-1.0F).d(0.1F).a(0.0F).b(0.5F).b())); ++ a(11, "frozen_river", new BiomeRiver((new BiomeBase.a("FrozenRiver")).c(-0.5F).d(0.0F).a(0.0F).b(0.5F).b())); ++ a(12, "ice_flats", new BiomeIcePlains(false, (new BiomeBase.a("Ice Plains")).c(0.125F).d(0.05F).a(0.0F).b(0.5F).b())); ++ a(13, "ice_mountains", new BiomeIcePlains(false, (new BiomeBase.a("Ice Mountains")).c(0.45F).d(0.3F).a(0.0F).b(0.5F).b())); ++ a(14, "mushroom_island", new BiomeMushrooms((new BiomeBase.a("MushroomIsland")).c(0.2F).d(0.3F).a(0.9F).b(1.0F))); ++ a(15, "mushroom_island_shore", new BiomeMushrooms((new BiomeBase.a("MushroomIslandShore")).c(0.0F).d(0.025F).a(0.9F).b(1.0F))); ++ a(16, "beaches", new BiomeBeach((new BiomeBase.a("Beach")).c(0.0F).d(0.025F).a(0.8F).b(0.4F))); ++ a(17, "desert_hills", new BiomeDesert((new BiomeBase.a("DesertHills")).c(0.45F).d(0.3F).a(2.0F).b(0.0F).a())); ++ a(18, "forest_hills", new BiomeForest(BiomeForest.Type.NORMAL, (new BiomeBase.a("ForestHills")).c(0.45F).d(0.3F).a(0.7F).b(0.8F))); ++ a(19, "taiga_hills", new BiomeTaiga(BiomeTaiga.Type.NORMAL, (new BiomeBase.a("TaigaHills")).a(0.25F).b(0.8F).c(0.45F).d(0.3F))); ++ a(20, "smaller_extreme_hills", new BiomeBigHills(BiomeBigHills.Type.EXTRA_TREES, (new BiomeBase.a("Extreme Hills Edge")).c(0.8F).d(0.3F).a(0.2F).b(0.3F))); ++ a(21, "jungle", new BiomeJungle(false, (new BiomeBase.a("Jungle")).a(0.95F).b(0.9F))); ++ a(22, "jungle_hills", new BiomeJungle(false, (new BiomeBase.a("JungleHills")).c(0.45F).d(0.3F).a(0.95F).b(0.9F))); ++ a(23, "jungle_edge", new BiomeJungle(true, (new BiomeBase.a("JungleEdge")).a(0.95F).b(0.8F))); ++ a(24, "deep_ocean", new BiomeOcean((new BiomeBase.a("Deep Ocean")).c(-1.8F).d(0.1F))); ++ a(25, "stone_beach", new BiomeStoneBeach((new BiomeBase.a("Stone Beach")).c(0.1F).d(0.8F).a(0.2F).b(0.3F))); ++ a(26, "cold_beach", new BiomeBeach((new BiomeBase.a("Cold Beach")).c(0.0F).d(0.025F).a(0.05F).b(0.3F).b())); ++ a(27, "birch_forest", new BiomeForest(BiomeForest.Type.BIRCH, (new BiomeBase.a("Birch Forest")).a(0.6F).b(0.6F))); ++ a(28, "birch_forest_hills", new BiomeForest(BiomeForest.Type.BIRCH, (new BiomeBase.a("Birch Forest Hills")).c(0.45F).d(0.3F).a(0.6F).b(0.6F))); ++ a(29, "roofed_forest", new BiomeForest(BiomeForest.Type.ROOFED, (new BiomeBase.a("Roofed Forest")).a(0.7F).b(0.8F))); ++ a(30, "taiga_cold", new BiomeTaiga(BiomeTaiga.Type.NORMAL, (new BiomeBase.a("Cold Taiga")).c(0.2F).d(0.2F).a(-0.5F).b(0.4F).b())); ++ a(31, "taiga_cold_hills", new BiomeTaiga(BiomeTaiga.Type.NORMAL, (new BiomeBase.a("Cold Taiga Hills")).c(0.45F).d(0.3F).a(-0.5F).b(0.4F).b())); ++ a(32, "redwood_taiga", new BiomeTaiga(BiomeTaiga.Type.MEGA, (new BiomeBase.a("Mega Taiga")).a(0.3F).b(0.8F).c(0.2F).d(0.2F))); ++ a(33, "redwood_taiga_hills", new BiomeTaiga(BiomeTaiga.Type.MEGA, (new BiomeBase.a("Mega Taiga Hills")).c(0.45F).d(0.3F).a(0.3F).b(0.8F))); ++ a(34, "extreme_hills_with_trees", new BiomeBigHills(BiomeBigHills.Type.EXTRA_TREES, (new BiomeBase.a("Extreme Hills+")).c(1.0F).d(0.5F).a(0.2F).b(0.3F))); ++ a(35, "savanna", new BiomeSavanna((new BiomeBase.a("Savanna")).c(0.125F).d(0.05F).a(1.2F).b(0.0F).a())); ++ a(36, "savanna_rock", new BiomeSavanna((new BiomeBase.a("Savanna Plateau")).c(1.5F).d(0.025F).a(1.0F).b(0.0F).a())); ++ a(37, "mesa", new BiomeMesa(false, false, (new BiomeBase.a("Mesa")).a(2.0F).b(0.0F).a())); ++ a(38, "mesa_rock", new BiomeMesa(false, true, (new BiomeBase.a("Mesa Plateau F")).c(1.5F).d(0.025F).a(2.0F).b(0.0F).a())); ++ a(39, "mesa_clear_rock", new BiomeMesa(false, false, (new BiomeBase.a("Mesa Plateau")).c(1.5F).d(0.025F).a(2.0F).b(0.0F).a())); ++ a(127, "void", new BiomeVoid((new BiomeBase.a("The Void")).a())); ++ a(129, "mutated_plains", new BiomePlains(true, (new BiomeBase.a("Sunflower Plains")).a("plains").c(0.125F).d(0.05F).a(0.8F).b(0.4F))); ++ a(130, "mutated_desert", new BiomeDesert((new BiomeBase.a("Desert M")).a("desert").c(0.225F).d(0.25F).a(2.0F).b(0.0F).a())); ++ a(131, "mutated_extreme_hills", new BiomeBigHills(BiomeBigHills.Type.MUTATED, (new BiomeBase.a("Extreme Hills M")).a("extreme_hills").c(1.0F).d(0.5F).a(0.2F).b(0.3F))); ++ a(132, "mutated_forest", new BiomeForest(BiomeForest.Type.FLOWER, (new BiomeBase.a("Flower Forest")).a("forest").d(0.4F).a(0.7F).b(0.8F))); ++ a(133, "mutated_taiga", new BiomeTaiga(BiomeTaiga.Type.NORMAL, (new BiomeBase.a("Taiga M")).a("taiga").c(0.3F).d(0.4F).a(0.25F).b(0.8F))); ++ a(134, "mutated_swampland", new BiomeSwamp((new BiomeBase.a("Swampland M")).a("swampland").c(-0.1F).d(0.3F).a(0.8F).b(0.9F).a(14745518))); ++ a(140, "mutated_ice_flats", new BiomeIcePlains(true, (new BiomeBase.a("Ice Plains Spikes")).a("ice_flats").c(0.425F).d(0.45000002F).a(0.0F).b(0.5F).b())); ++ a(149, "mutated_jungle", new BiomeJungle(false, (new BiomeBase.a("Jungle M")).a("jungle").c(0.2F).d(0.4F).a(0.95F).b(0.9F))); ++ a(151, "mutated_jungle_edge", new BiomeJungle(true, (new BiomeBase.a("JungleEdge M")).a("jungle_edge").c(0.2F).d(0.4F).a(0.95F).b(0.8F))); ++ a(155, "mutated_birch_forest", new BiomeForestMutated((new BiomeBase.a("Birch Forest M")).a("birch_forest").c(0.2F).d(0.4F).a(0.6F).b(0.6F))); ++ a(156, "mutated_birch_forest_hills", new BiomeForestMutated((new BiomeBase.a("Birch Forest Hills M")).a("birch_forest").c(0.55F).d(0.5F).a(0.6F).b(0.6F))); ++ a(157, "mutated_roofed_forest", new BiomeForest(BiomeForest.Type.ROOFED, (new BiomeBase.a("Roofed Forest M")).a("roofed_forest").c(0.2F).d(0.4F).a(0.7F).b(0.8F))); ++ a(158, "mutated_taiga_cold", new BiomeTaiga(BiomeTaiga.Type.NORMAL, (new BiomeBase.a("Cold Taiga M")).a("taiga_cold").c(0.3F).d(0.4F).a(-0.5F).b(0.4F).b())); ++ a(160, "mutated_redwood_taiga", new BiomeTaiga(BiomeTaiga.Type.MEGA_SPRUCE, (new BiomeBase.a("Mega Spruce Taiga")).a("redwood_taiga").c(0.2F).d(0.2F).a(0.25F).b(0.8F))); ++ a(161, "mutated_redwood_taiga_hills", new BiomeTaiga(BiomeTaiga.Type.MEGA_SPRUCE, (new BiomeBase.a("Redwood Taiga Hills M")).a("redwood_taiga_hills").c(0.2F).d(0.2F).a(0.25F).b(0.8F))); ++ a(162, "mutated_extreme_hills_with_trees", new BiomeBigHills(BiomeBigHills.Type.MUTATED, (new BiomeBase.a("Extreme Hills+ M")).a("extreme_hills_with_trees").c(1.0F).d(0.5F).a(0.2F).b(0.3F))); ++ a(163, "mutated_savanna", new BiomeSavannaMutated((new BiomeBase.a("Savanna M")).a("savanna").c(0.3625F).d(1.225F).a(1.1F).b(0.0F).a())); ++ a(164, "mutated_savanna_rock", new BiomeSavannaMutated((new BiomeBase.a("Savanna Plateau M")).a("savanna_rock").c(1.05F).d(1.2125001F).a(1.0F).b(0.0F).a())); ++ a(165, "mutated_mesa", new BiomeMesa(true, false, (new BiomeBase.a("Mesa (Bryce)")).a("mesa").a(2.0F).b(0.0F).a())); ++ a(166, "mutated_mesa_rock", new BiomeMesa(false, true, (new BiomeBase.a("Mesa Plateau F M")).a("mesa_rock").c(0.45F).d(0.3F).a(2.0F).b(0.0F).a())); ++ a(167, "mutated_mesa_clear_rock", new BiomeMesa(false, false, (new BiomeBase.a("Mesa Plateau M")).a("mesa_clear_rock").c(0.45F).d(0.3F).a(2.0F).b(0.0F).a())); ++ Collections.addAll(BiomeBase.i, new BiomeBase[] { Biomes.a, Biomes.c, Biomes.d, Biomes.e, Biomes.f, Biomes.g, Biomes.h, Biomes.i, Biomes.m, Biomes.n, Biomes.o, Biomes.p, Biomes.q, Biomes.r, Biomes.s, Biomes.t, Biomes.u, Biomes.w, Biomes.x, Biomes.y, Biomes.z, Biomes.A, Biomes.B, Biomes.C, Biomes.D, Biomes.E, Biomes.F, Biomes.G, Biomes.H, Biomes.I, Biomes.J, Biomes.K, Biomes.L, Biomes.M, Biomes.N, Biomes.O}); ++ } ++ ++ private static void a(int i, String s, BiomeBase biomebase) { ++ BiomeBase.REGISTRY_ID.a(i, new MinecraftKey(s), biomebase); ++ if (biomebase.b()) { ++ BiomeBase.j.a(biomebase, a((BiomeBase) BiomeBase.REGISTRY_ID.get(new MinecraftKey(biomebase.H)))); + } + -+ BiomeBase.n.remove(BiomeBase.HELL); -+ BiomeBase.n.remove(BiomeBase.SKY); -+ BiomeBase.n.remove(BiomeBase.FROZEN_OCEAN); -+ BiomeBase.n.remove(BiomeBase.SMALL_MOUNTAINS); -+ ae = new NoiseGenerator3(new Random(1234L), 1); -+ af = new NoiseGenerator3(new Random(2345L), 1); -+ ag = new WorldGenTallPlant(); + } + + static class SyntheticClass_1 { + -+ static final int[] switchMap = new int[EnumCreatureType.values().length]; ++ static final int[] a = new int[EnumCreatureType.values().length]; + + static { + try { -+ SyntheticClass_1.switchMap[EnumCreatureType.MONSTER.ordinal()] = 1; ++ BiomeBase.SyntheticClass_1.a[EnumCreatureType.MONSTER.ordinal()] = 1; + } catch (NoSuchFieldError nosuchfielderror) { + ; + } + + try { -+ SyntheticClass_1.switchMap[EnumCreatureType.CREATURE.ordinal()] = 2; ++ BiomeBase.SyntheticClass_1.a[EnumCreatureType.CREATURE.ordinal()] = 2; + } catch (NoSuchFieldError nosuchfielderror1) { + ; + } + + try { -+ SyntheticClass_1.switchMap[EnumCreatureType.WATER_CREATURE.ordinal()] = 3; ++ BiomeBase.SyntheticClass_1.a[EnumCreatureType.WATER_CREATURE.ordinal()] = 3; + } catch (NoSuchFieldError nosuchfielderror2) { + ; + } + + try { -+ SyntheticClass_1.switchMap[EnumCreatureType.AMBIENT.ordinal()] = 4; ++ BiomeBase.SyntheticClass_1.a[EnumCreatureType.AMBIENT.ordinal()] = 4; + } catch (NoSuchFieldError nosuchfielderror3) { + ; + } @@ -550,6 +387,67 @@ index 0000000..b1ae67a + } + } + ++ public static class a { ++ ++ private final String a; ++ private float b = 0.1F; ++ private float c = 0.2F; ++ private float d = 0.5F; ++ private float e = 0.5F; ++ private int f = 16777215; ++ private boolean g; ++ private boolean h = true; ++ private String i; ++ ++ public a(String s) { ++ this.a = s; ++ } ++ ++ protected BiomeBase.a a(float f) { ++ if (f > 0.1F && f < 0.2F) { ++ throw new IllegalArgumentException("Please avoid temperatures in the range 0.1 - 0.2 because of snow"); ++ } else { ++ this.d = f; ++ return this; ++ } ++ } ++ ++ protected BiomeBase.a b(float f) { ++ this.e = f; ++ return this; ++ } ++ ++ protected BiomeBase.a c(float f) { ++ this.b = f; ++ return this; ++ } ++ ++ protected BiomeBase.a d(float f) { ++ this.c = f; ++ return this; ++ } ++ ++ protected BiomeBase.a a() { ++ this.h = false; ++ return this; ++ } ++ ++ protected BiomeBase.a b() { ++ this.g = true; ++ return this; ++ } ++ ++ protected BiomeBase.a a(int i) { ++ this.f = i; ++ return this; ++ } ++ ++ protected BiomeBase.a a(String s) { ++ this.i = s; ++ return this; ++ } ++ } ++ + public static class BiomeMeta extends WeightedRandom.WeightedRandomChoice { + + public Class b; @@ -568,21 +466,6 @@ index 0000000..b1ae67a + } + } + -+ public static class BiomeTemperature { -+ -+ public float a; -+ public float b; -+ -+ public BiomeTemperature(float f, float f1) { -+ this.a = f; -+ this.b = f1; -+ } -+ -+ public BiomeTemperature a() { -+ return new BiomeTemperature(this.a * 0.8F, this.b * 0.6F); -+ } -+ } -+ + public static enum EnumTemperature { + + OCEAN, COLD, MEDIUM, WARM; @@ -592,10 +475,10 @@ index 0000000..b1ae67a +} diff --git a/src/main/java/net/minecraft/server/BiomeMesa.java b/src/main/java/net/minecraft/server/BiomeMesa.java new file mode 100644 -index 0000000..fd827f2 +index 0000000..3ce22aa --- /dev/null +++ b/src/main/java/net/minecraft/server/BiomeMesa.java -@@ -0,0 +1,264 @@ +@@ -0,0 +1,252 @@ +package net.minecraft.server; + +import java.util.Arrays; @@ -603,37 +486,41 @@ index 0000000..fd827f2 + +public class BiomeMesa extends BiomeBase { + -+ private IBlockData[] aD; -+ private long aE; -+ private NoiseGenerator3 aF; -+ private NoiseGenerator3 aG; -+ private NoiseGenerator3 aH; -+ private boolean aI; -+ private boolean aJ; ++ protected static final IBlockData y = Blocks.DIRT.getBlockData().set(BlockDirt.VARIANT, BlockDirt.EnumDirtVariant.COARSE_DIRT); ++ protected static final IBlockData z = Blocks.GRASS.getBlockData(); ++ protected static final IBlockData A = Blocks.HARDENED_CLAY.getBlockData(); ++ protected static final IBlockData B = Blocks.STAINED_HARDENED_CLAY.getBlockData(); ++ protected static final IBlockData C = BiomeMesa.B.set(BlockCloth.COLOR, EnumColor.ORANGE); ++ protected static final IBlockData D = Blocks.SAND.getBlockData().set(BlockSand.VARIANT, BlockSand.EnumSandVariant.RED_SAND); ++ private IBlockData[] E; ++ private long F; ++ private NoiseGenerator3 G; ++ private NoiseGenerator3 H; ++ private NoiseGenerator3 I; ++ private boolean J; ++ private boolean K; + -+ public BiomeMesa(int i, boolean flag, boolean flag1) { -+ super(i); -+ this.aI = flag; -+ this.aJ = flag1; -+ this.b(); -+ this.a(2.0F, 0.0F); -+ this.au.clear(); -+ this.ak = Blocks.SAND.getBlockData().set(BlockSand.VARIANT, BlockSand.EnumSandVariant.RED_SAND); -+ this.al = Blocks.STAINED_HARDENED_CLAY.getBlockData(); -+ this.as.A = -999; -+ this.as.D = 20; -+ this.as.F = 3; -+ this.as.G = 5; -+ this.as.B = 0; -+ this.au.clear(); ++ public BiomeMesa(boolean flag, boolean flag1, BiomeBase.a biomebase_a) { ++ super(biomebase_a); ++ this.J = flag; ++ this.K = flag1; ++ this.v.clear(); ++ this.r = BiomeMesa.D; ++ this.s = BiomeMesa.B; ++ this.t.z = -999; ++ this.t.C = 20; ++ this.t.E = 3; ++ this.t.F = 5; ++ this.t.A = 0; ++ this.v.clear(); + if (flag1) { -+ this.as.A = 5; ++ this.t.z = 5; + } + + } + + public WorldGenTreeAbstract a(Random random) { -+ return this.aA; ++ return BiomeMesa.n; + } + + public void a(World world, Random random, BlockPosition blockposition) { @@ -641,30 +528,30 @@ index 0000000..fd827f2 + } + + public void a(World world, Random random, ChunkSnapshot chunksnapshot, int i, int j, double d0) { -+ if (this.aD == null || this.aE != world.getSeed()) { ++ if (this.E == null || this.F != world.getSeed()) { + this.a(world.getSeed()); + } + -+ if (this.aF == null || this.aG == null || this.aE != world.getSeed()) { -+ Random random1 = new Random(this.aE); ++ if (this.G == null || this.H == null || this.F != world.getSeed()) { ++ Random random1 = new Random(this.F); + -+ this.aF = new NoiseGenerator3(random1, 4); -+ this.aG = new NoiseGenerator3(random1, 1); ++ this.G = new NoiseGenerator3(random1, 4); ++ this.H = new NoiseGenerator3(random1, 1); + } + -+ this.aE = world.getSeed(); ++ this.F = world.getSeed(); + double d1 = 0.0D; + int k; + int l; + -+ if (this.aI) { ++ if (this.J) { + k = (i & -16) + (j & 15); + l = (j & -16) + (i & 15); -+ double d2 = Math.min(Math.abs(d0), this.aF.a((double) k * 0.25D, (double) l * 0.25D)); ++ double d2 = Math.min(Math.abs(d0), this.G.a((double) k * 0.25D, (double) l * 0.25D)); + + if (d2 > 0.0D) { + double d3 = 0.001953125D; -+ double d4 = Math.abs(this.aG.a((double) k * d3, (double) l * d3)); ++ double d4 = Math.abs(this.H.a((double) k * d3, (double) l * d3)); + + d1 = d2 * d2 * 2.5D; + double d5 = Math.ceil(d4 * 50.0D) + 14.0D; @@ -679,80 +566,79 @@ index 0000000..fd827f2 + + k = i & 15; + l = j & 15; -+ int i1 = world.F(); -+ IBlockData iblockdata = Blocks.STAINED_HARDENED_CLAY.getBlockData(); -+ IBlockData iblockdata1 = this.al; ++ int i1 = world.K(); ++ IBlockData iblockdata = BiomeMesa.B; ++ IBlockData iblockdata1 = this.s; + int j1 = (int) (d0 / 3.0D + 3.0D + random.nextDouble() * 0.25D); + boolean flag = Math.cos(d0 / 3.0D * 3.141592653589793D) > 0.0D; + int k1 = -1; + boolean flag1 = false; + + for (int l1 = 255; l1 >= 0; --l1) { -+ if (chunksnapshot.a(l, l1, k).getBlock().getMaterial() == Material.AIR && l1 < (int) d1) { -+ chunksnapshot.a(l, l1, k, Blocks.STONE.getBlockData()); ++ if (chunksnapshot.a(l, l1, k).getMaterial() == Material.AIR && l1 < (int) d1) { ++ chunksnapshot.a(l, l1, k, BiomeMesa.a); + } + + if (l1 <= random.nextInt(5)) { -+ chunksnapshot.a(l, l1, k, Blocks.BEDROCK.getBlockData()); ++ chunksnapshot.a(l, l1, k, BiomeMesa.c); + } else { + IBlockData iblockdata2 = chunksnapshot.a(l, l1, k); + -+ if (iblockdata2.getBlock().getMaterial() == Material.AIR) { ++ if (iblockdata2.getMaterial() == Material.AIR) { + k1 = -1; + } else if (iblockdata2.getBlock() == Blocks.STONE) { -+ IBlockData iblockdata3; -+ + if (k1 == -1) { + flag1 = false; + if (j1 <= 0) { -+ iblockdata = null; -+ iblockdata1 = Blocks.STONE.getBlockData(); ++ iblockdata = BiomeMesa.b; ++ iblockdata1 = BiomeMesa.a; + } else if (l1 >= i1 - 4 && l1 <= i1 + 1) { -+ iblockdata = Blocks.STAINED_HARDENED_CLAY.getBlockData(); -+ iblockdata1 = this.al; ++ iblockdata = BiomeMesa.B; ++ iblockdata1 = this.s; + } + -+ if (l1 < i1 && (iblockdata == null || iblockdata.getBlock().getMaterial() == Material.AIR)) { -+ iblockdata = Blocks.WATER.getBlockData(); ++ if (l1 < i1 && (iblockdata == null || iblockdata.getMaterial() == Material.AIR)) { ++ iblockdata = BiomeMesa.h; + } + + k1 = j1 + Math.max(0, l1 - i1); + if (l1 >= i1 - 1) { -+ if (this.aJ && l1 > 86 + j1 * 2) { ++ if (this.K && l1 > 86 + j1 * 2) { + if (flag) { -+ chunksnapshot.a(l, l1, k, Blocks.DIRT.getBlockData().set(BlockDirt.VARIANT, BlockDirt.EnumDirtVariant.COARSE_DIRT)); ++ chunksnapshot.a(l, l1, k, BiomeMesa.y); + } else { -+ chunksnapshot.a(l, l1, k, Blocks.GRASS.getBlockData()); ++ chunksnapshot.a(l, l1, k, BiomeMesa.z); + } + } else if (l1 > i1 + 3 + j1) { ++ IBlockData iblockdata3; ++ + if (l1 >= 64 && l1 <= 127) { + if (flag) { -+ iblockdata3 = Blocks.HARDENED_CLAY.getBlockData(); ++ iblockdata3 = BiomeMesa.A; + } else { + iblockdata3 = this.a(i, l1, j); + } + } else { -+ iblockdata3 = Blocks.STAINED_HARDENED_CLAY.getBlockData().set(BlockCloth.COLOR, EnumColor.ORANGE); ++ iblockdata3 = BiomeMesa.C; + } + + chunksnapshot.a(l, l1, k, iblockdata3); + } else { -+ chunksnapshot.a(l, l1, k, this.ak); ++ chunksnapshot.a(l, l1, k, this.r); + flag1 = true; + } + } else { + chunksnapshot.a(l, l1, k, iblockdata1); + if (iblockdata1.getBlock() == Blocks.STAINED_HARDENED_CLAY) { -+ chunksnapshot.a(l, l1, k, iblockdata1.getBlock().getBlockData().set(BlockCloth.COLOR, EnumColor.ORANGE)); ++ chunksnapshot.a(l, l1, k, BiomeMesa.C); + } + } + } else if (k1 > 0) { + --k1; + if (flag1) { -+ chunksnapshot.a(l, l1, k, Blocks.STAINED_HARDENED_CLAY.getBlockData().set(BlockCloth.COLOR, EnumColor.ORANGE)); ++ chunksnapshot.a(l, l1, k, BiomeMesa.C); + } else { -+ iblockdata3 = this.a(i, l1, j); -+ chunksnapshot.a(l, l1, k, iblockdata3); ++ chunksnapshot.a(l, l1, k, this.a(i, l1, j)); + } + } + } @@ -762,18 +648,18 @@ index 0000000..fd827f2 + } + + private void a(long i) { -+ this.aD = new IBlockData[64]; -+ Arrays.fill(this.aD, Blocks.HARDENED_CLAY.getBlockData()); ++ this.E = new IBlockData[64]; ++ Arrays.fill(this.E, BiomeMesa.A); + Random random = new Random(i); + -+ this.aH = new NoiseGenerator3(random, 1); ++ this.I = new NoiseGenerator3(random, 1); + + int j; + + for (j = 0; j < 64; ++j) { + j += random.nextInt(5) + 1; + if (j < 64) { -+ this.aD[j] = Blocks.STAINED_HARDENED_CLAY.getBlockData().set(BlockCloth.COLOR, EnumColor.ORANGE); ++ this.E[j] = BiomeMesa.C; + } + } + @@ -789,7 +675,7 @@ index 0000000..fd827f2 + i1 = random.nextInt(64); + + for (j1 = 0; i1 + j1 < 64 && j1 < l; ++j1) { -+ this.aD[i1 + j1] = Blocks.STAINED_HARDENED_CLAY.getBlockData().set(BlockCloth.COLOR, EnumColor.YELLOW); ++ this.E[i1 + j1] = BiomeMesa.B.set(BlockCloth.COLOR, EnumColor.YELLOW); + } + } + @@ -802,7 +688,7 @@ index 0000000..fd827f2 + j1 = random.nextInt(64); + + for (k1 = 0; j1 + k1 < 64 && k1 < i1; ++k1) { -+ this.aD[j1 + k1] = Blocks.STAINED_HARDENED_CLAY.getBlockData().set(BlockCloth.COLOR, EnumColor.BROWN); ++ this.E[j1 + k1] = BiomeMesa.B.set(BlockCloth.COLOR, EnumColor.BROWN); + } + } + @@ -813,7 +699,7 @@ index 0000000..fd827f2 + k1 = random.nextInt(64); + + for (int l1 = 0; k1 + l1 < 64 && l1 < j1; ++l1) { -+ this.aD[k1 + l1] = Blocks.STAINED_HARDENED_CLAY.getBlockData().set(BlockCloth.COLOR, EnumColor.RED); ++ this.E[k1 + l1] = BiomeMesa.B.set(BlockCloth.COLOR, EnumColor.RED); + } + } + @@ -826,13 +712,13 @@ index 0000000..fd827f2 + j1 += random.nextInt(16) + 4; + + for (int i2 = 0; j1 + i2 < 64 && i2 < b0; ++i2) { -+ this.aD[j1 + i2] = Blocks.STAINED_HARDENED_CLAY.getBlockData().set(BlockCloth.COLOR, EnumColor.WHITE); ++ this.E[j1 + i2] = BiomeMesa.B.set(BlockCloth.COLOR, EnumColor.WHITE); + if (j1 + i2 > 1 && random.nextBoolean()) { -+ this.aD[j1 + i2 - 1] = Blocks.STAINED_HARDENED_CLAY.getBlockData().set(BlockCloth.COLOR, EnumColor.SILVER); ++ this.E[j1 + i2 - 1] = BiomeMesa.B.set(BlockCloth.COLOR, EnumColor.SILVER); + } + + if (j1 + i2 < 63 && random.nextBoolean()) { -+ this.aD[j1 + i2 + 1] = Blocks.STAINED_HARDENED_CLAY.getBlockData().set(BlockCloth.COLOR, EnumColor.SILVER); ++ this.E[j1 + i2 + 1] = BiomeMesa.B.set(BlockCloth.COLOR, EnumColor.SILVER); + } + } + } @@ -840,75 +726,52 @@ index 0000000..fd827f2 + } + + private IBlockData a(int i, int j, int k) { -+ int l = (int) Math.round(this.aH.a((double) i * 1.0D / 512.0D, (double) i * 1.0D / 512.0D) * 2.0D); ++ int l = (int) Math.round(this.I.a((double) i / 512.0D, (double) i / 512.0D) * 2.0D); + -+ return this.aD[(j + l + 64) % 64]; -+ } -+ -+ protected BiomeBase d(int i) { -+ boolean flag = this.id == BiomeBase.MESA.id; -+ BiomeMesa biomemesa = new BiomeMesa(i, flag, this.aJ); -+ -+ if (!flag) { -+ biomemesa.a(BiomeMesa.g); -+ biomemesa.a(this.ah + " M"); -+ } else { -+ biomemesa.a(this.ah + " (Bryce)"); -+ } -+ -+ biomemesa.a(this.ai, true); -+ return biomemesa; ++ return this.E[(j + l + 64) % 64]; + } +} diff --git a/src/main/java/net/minecraft/server/BlockChest.java b/src/main/java/net/minecraft/server/BlockChest.java new file mode 100644 -index 0000000..f725aea +index 0000000..7d27317 --- /dev/null +++ b/src/main/java/net/minecraft/server/BlockChest.java -@@ -0,0 +1,455 @@ +@@ -0,0 +1,452 @@ +package net.minecraft.server; + -+import com.google.common.base.Predicate; +import java.util.Iterator; + -+public class BlockChest extends BlockContainer { ++public class BlockChest extends BlockTileEntity { + -+ public static final BlockStateDirection FACING = BlockStateDirection.of("facing", (Predicate) EnumDirection.EnumDirectionLimit.HORIZONTAL); -+ public final int b; ++ public static final BlockStateDirection FACING = BlockFacingHorizontal.FACING; ++ protected static final AxisAlignedBB b = new AxisAlignedBB(0.0625D, 0.0D, 0.0D, 0.9375D, 0.875D, 0.9375D); ++ protected static final AxisAlignedBB c = new AxisAlignedBB(0.0625D, 0.0D, 0.0625D, 0.9375D, 0.875D, 1.0D); ++ protected static final AxisAlignedBB d = new AxisAlignedBB(0.0D, 0.0D, 0.0625D, 0.9375D, 0.875D, 0.9375D); ++ protected static final AxisAlignedBB e = new AxisAlignedBB(0.0625D, 0.0D, 0.0625D, 1.0D, 0.875D, 0.9375D); ++ protected static final AxisAlignedBB f = new AxisAlignedBB(0.0625D, 0.0D, 0.0625D, 0.9375D, 0.875D, 0.9375D); ++ public final Type g; + -+ protected BlockChest(int i) { ++ protected BlockChest(Type blockchest_type) { + super(Material.WOOD); -+ this.j(this.blockStateList.getBlockData().set(BlockChest.FACING, EnumDirection.NORTH)); -+ this.b = i; -+ this.a(CreativeModeTab.c); -+ this.a(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F); ++ this.w(this.blockStateList.getBlockData().set(BlockChest.FACING, EnumDirection.NORTH)); ++ this.g = blockchest_type; ++ this.a(blockchest_type == Type.TRAP ? CreativeModeTab.d : CreativeModeTab.c); + } + -+ public boolean c() { ++ public boolean b(IBlockData iblockdata) { + return false; + } + -+ public boolean d() { ++ public boolean c(IBlockData iblockdata) { + return false; + } + -+ public int b() { -+ return 2; ++ public EnumRenderType a(IBlockData iblockdata) { ++ return EnumRenderType.ENTITYBLOCK_ANIMATED; + } + -+ public void updateShape(IBlockAccess iblockaccess, BlockPosition blockposition) { -+ if (iblockaccess.getType(blockposition.north()).getBlock() == this) { -+ this.a(0.0625F, 0.0F, 0.0F, 0.9375F, 0.875F, 0.9375F); -+ } else if (iblockaccess.getType(blockposition.south()).getBlock() == this) { -+ this.a(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 1.0F); -+ } else if (iblockaccess.getType(blockposition.west()).getBlock() == this) { -+ this.a(0.0F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F); -+ } else if (iblockaccess.getType(blockposition.east()).getBlock() == this) { -+ this.a(0.0625F, 0.0F, 0.0625F, 1.0F, 0.875F, 0.9375F); -+ } else { -+ this.a(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F); -+ } -+ ++ public AxisAlignedBB a(IBlockData iblockdata, IBlockAccess iblockaccess, BlockPosition blockposition) { ++ return iblockaccess.getType(blockposition.north()).getBlock() == this ? BlockChest.b : (iblockaccess.getType(blockposition.south()).getBlock() == this ? BlockChest.c : (iblockaccess.getType(blockposition.west()).getBlock() == this ? BlockChest.d : (iblockaccess.getType(blockposition.east()).getBlock() == this ? BlockChest.e : BlockChest.f))); + } + + public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata) { @@ -983,24 +846,20 @@ index 0000000..f725aea + IBlockData iblockdata3 = world.getType(blockposition.west()); + IBlockData iblockdata4 = world.getType(blockposition.east()); + EnumDirection enumdirection = (EnumDirection) iblockdata.get(BlockChest.FACING); -+ Block block = iblockdata1.getBlock(); -+ Block block1 = iblockdata2.getBlock(); -+ Block block2 = iblockdata3.getBlock(); -+ Block block3 = iblockdata4.getBlock(); + -+ if (block != this && block1 != this) { -+ boolean flag = block.o(); -+ boolean flag1 = block1.o(); ++ if (iblockdata1.getBlock() != this && iblockdata2.getBlock() != this) { ++ boolean flag = iblockdata1.b(); ++ boolean flag1 = iblockdata2.b(); + -+ if (block2 == this || block3 == this) { -+ BlockPosition blockposition1 = block2 == this ? blockposition.west() : blockposition.east(); ++ if (iblockdata3.getBlock() == this || iblockdata4.getBlock() == this) { ++ BlockPosition blockposition1 = iblockdata3.getBlock() == this ? blockposition.west() : blockposition.east(); + IBlockData iblockdata5 = world.getType(blockposition1.north()); + IBlockData iblockdata6 = world.getType(blockposition1.south()); + + enumdirection = EnumDirection.SOUTH; + EnumDirection enumdirection1; + -+ if (block2 == this) { ++ if (iblockdata3.getBlock() == this) { + enumdirection1 = (EnumDirection) iblockdata3.get(BlockChest.FACING); + } else { + enumdirection1 = (EnumDirection) iblockdata4.get(BlockChest.FACING); @@ -1010,26 +869,23 @@ index 0000000..f725aea + enumdirection = EnumDirection.NORTH; + } + -+ Block block4 = iblockdata5.getBlock(); -+ Block block5 = iblockdata6.getBlock(); -+ -+ if ((flag || block4.o()) && !flag1 && !block5.o()) { ++ if ((flag || iblockdata5.b()) && !flag1 && !iblockdata6.b()) { + enumdirection = EnumDirection.SOUTH; + } + -+ if ((flag1 || block5.o()) && !flag && !block4.o()) { ++ if ((flag1 || iblockdata6.b()) && !flag && !iblockdata5.b()) { + enumdirection = EnumDirection.NORTH; + } + } + } else { -+ BlockPosition blockposition2 = block == this ? blockposition.north() : blockposition.south(); ++ BlockPosition blockposition2 = iblockdata1.getBlock() == this ? blockposition.north() : blockposition.south(); + IBlockData iblockdata7 = world.getType(blockposition2.west()); + IBlockData iblockdata8 = world.getType(blockposition2.east()); + + enumdirection = EnumDirection.EAST; + EnumDirection enumdirection2; + -+ if (block == this) { ++ if (iblockdata1.getBlock() == this) { + enumdirection2 = (EnumDirection) iblockdata1.get(BlockChest.FACING); + } else { + enumdirection2 = (EnumDirection) iblockdata2.get(BlockChest.FACING); @@ -1039,14 +895,11 @@ index 0000000..f725aea + enumdirection = EnumDirection.WEST; + } + -+ Block block6 = iblockdata7.getBlock(); -+ Block block7 = iblockdata8.getBlock(); -+ -+ if ((block2.o() || block6.o()) && !block3.o() && !block7.o()) { ++ if ((iblockdata3.b() || iblockdata7.b()) && !iblockdata4.b() && !iblockdata8.b()) { + enumdirection = EnumDirection.EAST; + } + -+ if ((block3.o() || block7.o()) && !block2.o() && !block6.o()) { ++ if ((iblockdata4.b() || iblockdata8.b()) && !iblockdata3.b() && !iblockdata7.b()) { + enumdirection = EnumDirection.WEST; + } + } @@ -1069,7 +922,7 @@ index 0000000..f725aea + return iblockdata; + } + -+ if (iblockdata1.getBlock().o()) { ++ if (iblockdata1.b()) { + if (enumdirection != null) { + enumdirection = null; + break; @@ -1084,15 +937,15 @@ index 0000000..f725aea + } else { + EnumDirection enumdirection2 = (EnumDirection) iblockdata.get(BlockChest.FACING); + -+ if (world.getType(blockposition.shift(enumdirection2)).getBlock().o()) { ++ if (world.getType(blockposition.shift(enumdirection2)).b()) { + enumdirection2 = enumdirection2.opposite(); + } + -+ if (world.getType(blockposition.shift(enumdirection2)).getBlock().o()) { ++ if (world.getType(blockposition.shift(enumdirection2)).b()) { + enumdirection2 = enumdirection2.e(); + } + -+ if (world.getType(blockposition.shift(enumdirection2)).getBlock().o()) { ++ if (world.getType(blockposition.shift(enumdirection2)).b()) { + enumdirection2 = enumdirection2.opposite(); + } + @@ -1108,7 +961,7 @@ index 0000000..f725aea + BlockPosition blockposition4 = blockposition.south(); + + if (world.getType(blockposition1).getBlock() == this) { -+ if (this.m(world, blockposition1)) { ++ if (this.d(world, blockposition1)) { + return false; + } + @@ -1116,7 +969,7 @@ index 0000000..f725aea + } + + if (world.getType(blockposition2).getBlock() == this) { -+ if (this.m(world, blockposition2)) { ++ if (this.d(world, blockposition2)) { + return false; + } + @@ -1124,7 +977,7 @@ index 0000000..f725aea + } + + if (world.getType(blockposition3).getBlock() == this) { -+ if (this.m(world, blockposition3)) { ++ if (this.d(world, blockposition3)) { + return false; + } + @@ -1132,7 +985,7 @@ index 0000000..f725aea + } + + if (world.getType(blockposition4).getBlock() == this) { -+ if (this.m(world, blockposition4)) { ++ if (this.d(world, blockposition4)) { + return false; + } + @@ -1142,7 +995,7 @@ index 0000000..f725aea + return i <= 1; + } + -+ private boolean m(World world, BlockPosition blockposition) { ++ private boolean d(World world, BlockPosition blockposition) { + if (world.getType(blockposition).getBlock() != this) { + return false; + } else { @@ -1167,7 +1020,7 @@ index 0000000..f725aea + TileEntity tileentity = world.getTileEntity(blockposition); + + if (tileentity instanceof TileEntityChest) { -+ tileentity.E(); ++ tileentity.invalidateBlockCache(); + } + + } @@ -1183,18 +1036,18 @@ index 0000000..f725aea + super.remove(world, blockposition, iblockdata); + } + -+ public boolean interact(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman, EnumDirection enumdirection, float f, float f1, float f2) { ++ public boolean interact(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman, EnumHand enumhand, ItemStack itemstack, EnumDirection enumdirection, float f, float f1, float f2) { + if (world.isClientSide) { + return true; + } else { -+ ITileInventory itileinventory = this.f(world, blockposition); ++ ITileInventory itileinventory = this.c(world, blockposition); + + if (itileinventory != null) { + entityhuman.openContainer(itileinventory); -+ if (this.b == 0) { -+ entityhuman.b(StatisticList.aa); -+ } else if (this.b == 1) { -+ entityhuman.b(StatisticList.U); ++ if (this.g == Type.BASIC) { ++ entityhuman.b(StatisticList.ac); ++ } else if (this.g == Type.TRAP) { ++ entityhuman.b(StatisticList.W); + } + } + @@ -1202,7 +1055,7 @@ index 0000000..f725aea + } + } + -+ public ITileInventory f(World world, BlockPosition blockposition) { ++ public ITileInventory c(World world, BlockPosition blockposition) { + TileEntity tileentity = world.getTileEntity(blockposition); + + if (!(tileentity instanceof TileEntityChest)) { @@ -1210,7 +1063,7 @@ index 0000000..f725aea + } else { + Object object = (TileEntityChest) tileentity; + -+ if (this.n(world, blockposition)) { ++ if (this.e(world, blockposition)) { + return null; + } else { + Iterator iterator = EnumDirection.EnumDirectionLimit.HORIZONTAL.iterator(); @@ -1221,7 +1074,7 @@ index 0000000..f725aea + Block block = world.getType(blockposition1).getBlock(); + + if (block == this) { -+ if (this.n(world, blockposition1)) { ++ if (this.e(world, blockposition1)) { + return null; + } + @@ -1246,12 +1099,12 @@ index 0000000..f725aea + return new TileEntityChest(); + } + -+ public boolean isPowerSource() { -+ return this.b == 1; ++ public boolean isPowerSource(IBlockData iblockdata) { ++ return this.g == Type.TRAP; + } + -+ public int a(IBlockAccess iblockaccess, BlockPosition blockposition, IBlockData iblockdata, EnumDirection enumdirection) { -+ if (!this.isPowerSource()) { ++ public int b(IBlockData iblockdata, IBlockAccess iblockaccess, BlockPosition blockposition, EnumDirection enumdirection) { ++ if (!iblockdata.m()) { + return 0; + } else { + int i = 0; @@ -1265,19 +1118,19 @@ index 0000000..f725aea + } + } + -+ public int b(IBlockAccess iblockaccess, BlockPosition blockposition, IBlockData iblockdata, EnumDirection enumdirection) { -+ return enumdirection == EnumDirection.UP ? this.a(iblockaccess, blockposition, iblockdata, enumdirection) : 0; ++ public int c(IBlockData iblockdata, IBlockAccess iblockaccess, BlockPosition blockposition, EnumDirection enumdirection) { ++ return enumdirection == EnumDirection.UP ? iblockdata.a(iblockaccess, blockposition, enumdirection) : 0; + } + -+ private boolean n(World world, BlockPosition blockposition) { -+ return this.o(world, blockposition) || this.p(world, blockposition); ++ private boolean e(World world, BlockPosition blockposition) { ++ return this.i(world, blockposition) || this.j(world, blockposition); + } + -+ private boolean o(World world, BlockPosition blockposition) { -+ return world.getType(blockposition.up()).getBlock().isOccluding(); ++ private boolean i(World world, BlockPosition blockposition) { ++ return world.getType(blockposition.up()).l(); + } + -+ private boolean p(World world, BlockPosition blockposition) { ++ private boolean j(World world, BlockPosition blockposition) { + Iterator iterator = world.a(EntityOcelot.class, new AxisAlignedBB((double) blockposition.getX(), (double) (blockposition.getY() + 1), (double) blockposition.getZ(), (double) (blockposition.getX() + 1), (double) (blockposition.getY() + 2), (double) (blockposition.getZ() + 1))).iterator(); + + EntityOcelot entityocelot; @@ -1295,12 +1148,12 @@ index 0000000..f725aea + return true; + } + -+ public boolean isComplexRedstone() { ++ public boolean isComplexRedstone(IBlockData iblockdata) { + return true; + } + -+ public int l(World world, BlockPosition blockposition) { -+ return Container.b((IInventory) this.f(world, blockposition)); ++ public int d(IBlockData iblockdata, World world, BlockPosition blockposition) { ++ return Container.b((IInventory) this.c(world, blockposition)); + } + + public IBlockData fromLegacyData(int i) { @@ -1317,13 +1170,28 @@ index 0000000..f725aea + return ((EnumDirection) iblockdata.get(BlockChest.FACING)).a(); + } + ++ public IBlockData a(IBlockData iblockdata, EnumBlockRotation enumblockrotation) { ++ return iblockdata.set(BlockChest.FACING, enumblockrotation.a((EnumDirection) iblockdata.get(BlockChest.FACING))); ++ } ++ ++ public IBlockData a(IBlockData iblockdata, EnumBlockMirror enumblockmirror) { ++ return iblockdata.a(enumblockmirror.a((EnumDirection) iblockdata.get(BlockChest.FACING))); ++ } ++ + protected BlockStateList getStateList() { + return new BlockStateList(this, new IBlockState[] { BlockChest.FACING}); + } ++ ++ public static enum Type { ++ ++ BASIC, TRAP; ++ ++ private Type() {} ++ } +} diff --git a/src/main/java/net/minecraft/server/BlockFalling.java b/src/main/java/net/minecraft/server/BlockFalling.java new file mode 100644 -index 0000000..29f8554 +index 0000000..6654240 --- /dev/null +++ b/src/main/java/net/minecraft/server/BlockFalling.java @@ -0,0 +1,75 @@ @@ -1354,13 +1222,13 @@ index 0000000..29f8554 + + public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) { + if (!world.isClientSide) { -+ this.f(world, blockposition); ++ this.b(world, blockposition); + } + + } + -+ private void f(World world, BlockPosition blockposition) { -+ if (canFall(world, blockposition.down()) && blockposition.getY() >= 0) { ++ private void b(World world, BlockPosition blockposition) { ++ if (i(world.getType(blockposition.down())) && blockposition.getY() >= 0) { + byte b0 = 32; + + if (!BlockFalling.instaFall && world.areChunksLoadedBetween(blockposition.a(-b0, -b0, -b0), blockposition.a(b0, b0, b0))) { @@ -1375,7 +1243,7 @@ index 0000000..29f8554 + + BlockPosition blockposition1; + -+ for (blockposition1 = blockposition.down(); canFall(world, blockposition1) && blockposition1.getY() > 0; blockposition1 = blockposition1.down()) { ++ for (blockposition1 = blockposition.down(); i(world.getType(blockposition1)) && blockposition1.getY() > 0; blockposition1 = blockposition1.down()) { + ; + } + @@ -1393,9 +1261,9 @@ index 0000000..29f8554 + return 2; + } + -+ public static boolean canFall(World world, BlockPosition blockposition) { -+ Block block = world.getType(blockposition).getBlock(); -+ Material material = block.material; ++ public static boolean i(IBlockData iblockdata) { ++ Block block = iblockdata.getBlock(); ++ Material material = iblockdata.getMaterial(); + + return block == Blocks.FIRE || material == Material.AIR || material == Material.WATER || material == Material.LAVA; + } @@ -1404,10 +1272,10 @@ index 0000000..29f8554 +} diff --git a/src/main/java/net/minecraft/server/BlockFluids.java b/src/main/java/net/minecraft/server/BlockFluids.java new file mode 100644 -index 0000000..b610450 +index 0000000..675cdc0 --- /dev/null +++ b/src/main/java/net/minecraft/server/BlockFluids.java -@@ -0,0 +1,212 @@ +@@ -0,0 +1,224 @@ +package net.minecraft.server; + +import java.util.Iterator; @@ -1419,16 +1287,23 @@ index 0000000..b610450 + + protected BlockFluids(Material material) { + super(material); -+ this.j(this.blockStateList.getBlockData().set(BlockFluids.LEVEL, Integer.valueOf(0))); -+ this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); ++ this.w(this.blockStateList.getBlockData().set(BlockFluids.LEVEL, Integer.valueOf(0))); + this.a(true); + } + ++ public AxisAlignedBB a(IBlockData iblockdata, IBlockAccess iblockaccess, BlockPosition blockposition) { ++ return BlockFluids.j; ++ } ++ ++ public AxisAlignedBB a(IBlockData iblockdata, World world, BlockPosition blockposition) { ++ return BlockFluids.k; ++ } ++ + public boolean b(IBlockAccess iblockaccess, BlockPosition blockposition) { + return this.material != Material.LAVA; + } + -+ public static float b(int i) { ++ public static float e(int i) { + if (i >= 8) { + i = 0; + } @@ -1436,21 +1311,21 @@ index 0000000..b610450 + return (float) (i + 1) / 9.0F; + } + -+ protected int e(IBlockAccess iblockaccess, BlockPosition blockposition) { -+ return iblockaccess.getType(blockposition).getBlock().getMaterial() == this.material ? ((Integer) iblockaccess.getType(blockposition).get(BlockFluids.LEVEL)).intValue() : -1; ++ protected int c(IBlockAccess iblockaccess, BlockPosition blockposition) { ++ return iblockaccess.getType(blockposition).getMaterial() == this.material ? ((Integer) iblockaccess.getType(blockposition).get(BlockFluids.LEVEL)).intValue() : -1; + } + -+ protected int f(IBlockAccess iblockaccess, BlockPosition blockposition) { -+ int i = this.e(iblockaccess, blockposition); ++ protected int d(IBlockAccess iblockaccess, BlockPosition blockposition) { ++ int i = this.c(iblockaccess, blockposition); + + return i >= 8 ? 0 : i; + } + -+ public boolean d() { ++ public boolean c(IBlockData iblockdata) { + return false; + } + -+ public boolean c() { ++ public boolean b(IBlockData iblockdata) { + return false; + } + @@ -1458,18 +1333,14 @@ index 0000000..b610450 + return flag && ((Integer) iblockdata.get(BlockFluids.LEVEL)).intValue() == 0; + } + -+ public boolean b(IBlockAccess iblockaccess, BlockPosition blockposition, EnumDirection enumdirection) { -+ Material material = iblockaccess.getType(blockposition).getBlock().getMaterial(); ++ public boolean a(IBlockAccess iblockaccess, BlockPosition blockposition, EnumDirection enumdirection) { ++ Material material = iblockaccess.getType(blockposition).getMaterial(); + -+ return material == this.material ? false : (enumdirection == EnumDirection.UP ? true : (material == Material.ICE ? false : super.b(iblockaccess, blockposition, enumdirection))); ++ return material == this.material ? false : (enumdirection == EnumDirection.UP ? true : (material == Material.ICE ? false : super.a(iblockaccess, blockposition, enumdirection))); + } + -+ public AxisAlignedBB a(World world, BlockPosition blockposition, IBlockData iblockdata) { -+ return null; -+ } -+ -+ public int b() { -+ return 1; ++ public EnumRenderType a(IBlockData iblockdata) { ++ return EnumRenderType.LIQUID; + } + + public Item getDropType(IBlockData iblockdata, Random random, int i) { @@ -1480,56 +1351,65 @@ index 0000000..b610450 + return 0; + } + -+ protected Vec3D h(IBlockAccess iblockaccess, BlockPosition blockposition) { -+ Vec3D vec3d = new Vec3D(0.0D, 0.0D, 0.0D); -+ int i = this.f(iblockaccess, blockposition); ++ protected Vec3D f(IBlockAccess iblockaccess, BlockPosition blockposition) { ++ double d0 = 0.0D; ++ double d1 = 0.0D; ++ double d2 = 0.0D; ++ int i = this.d(iblockaccess, blockposition); ++ BlockPosition.PooledBlockPosition blockposition_pooledblockposition = BlockPosition.PooledBlockPosition.s(); + Iterator iterator = EnumDirection.EnumDirectionLimit.HORIZONTAL.iterator(); + -+ EnumDirection enumdirection; -+ BlockPosition blockposition1; -+ + while (iterator.hasNext()) { -+ enumdirection = (EnumDirection) iterator.next(); -+ blockposition1 = blockposition.shift(enumdirection); -+ int j = this.f(iblockaccess, blockposition1); ++ EnumDirection enumdirection = (EnumDirection) iterator.next(); ++ ++ blockposition_pooledblockposition.h(blockposition).c(enumdirection); ++ int j = this.d(iblockaccess, blockposition_pooledblockposition); + int k; + + if (j < 0) { -+ if (!iblockaccess.getType(blockposition1).getBlock().getMaterial().isSolid()) { -+ j = this.f(iblockaccess, blockposition1.down()); ++ if (!iblockaccess.getType(blockposition_pooledblockposition).getMaterial().isSolid()) { ++ j = this.d(iblockaccess, blockposition_pooledblockposition.down()); + if (j >= 0) { + k = j - (i - 8); -+ vec3d = vec3d.add((double) ((blockposition1.getX() - blockposition.getX()) * k), (double) ((blockposition1.getY() - blockposition.getY()) * k), (double) ((blockposition1.getZ() - blockposition.getZ()) * k)); ++ d0 += (double) (enumdirection.getAdjacentX() * k); ++ d1 += (double) (enumdirection.getAdjacentY() * k); ++ d2 += (double) (enumdirection.getAdjacentZ() * k); + } + } + } else if (j >= 0) { + k = j - i; -+ vec3d = vec3d.add((double) ((blockposition1.getX() - blockposition.getX()) * k), (double) ((blockposition1.getY() - blockposition.getY()) * k), (double) ((blockposition1.getZ() - blockposition.getZ()) * k)); ++ d0 += (double) (enumdirection.getAdjacentX() * k); ++ d1 += (double) (enumdirection.getAdjacentY() * k); ++ d2 += (double) (enumdirection.getAdjacentZ() * k); + } + } + -+ if (((Integer) iblockaccess.getType(blockposition).get(BlockFluids.LEVEL)).intValue() >= 8) { -+ iterator = EnumDirection.EnumDirectionLimit.HORIZONTAL.iterator(); ++ Vec3D vec3d = new Vec3D(d0, d1, d2); + -+ while (iterator.hasNext()) { -+ enumdirection = (EnumDirection) iterator.next(); -+ blockposition1 = blockposition.shift(enumdirection); -+ if (this.b(iblockaccess, blockposition1, enumdirection) || this.b(iblockaccess, blockposition1.up(), enumdirection)) { ++ if (((Integer) iblockaccess.getType(blockposition).get(BlockFluids.LEVEL)).intValue() >= 8) { ++ Iterator iterator1 = EnumDirection.EnumDirectionLimit.HORIZONTAL.iterator(); ++ ++ while (iterator1.hasNext()) { ++ EnumDirection enumdirection1 = (EnumDirection) iterator1.next(); ++ ++ blockposition_pooledblockposition.h(blockposition).c(enumdirection1); ++ if (this.a(iblockaccess, (BlockPosition) blockposition_pooledblockposition, enumdirection1) || this.a(iblockaccess, blockposition_pooledblockposition.up(), enumdirection1)) { + vec3d = vec3d.a().add(0.0D, -6.0D, 0.0D); + break; + } + } + } + ++ blockposition_pooledblockposition.t(); + return vec3d.a(); + } + + public Vec3D a(World world, BlockPosition blockposition, Entity entity, Vec3D vec3d) { -+ return vec3d.e(this.h(world, blockposition)); ++ return vec3d.e(this.f(world, blockposition)); + } + + public int a(World world) { -+ return this.material == Material.WATER ? 5 : (this.material == Material.LAVA ? (world.worldProvider.o() ? 10 : 30) : 0); ++ return this.material == Material.WATER ? 5 : (this.material == Material.LAVA ? (world.worldProvider.m() ? 10 : 30) : 0); + } + + public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata) { @@ -1549,7 +1429,7 @@ index 0000000..b610450 + for (int j = 0; j < i; ++j) { + EnumDirection enumdirection = aenumdirection[j]; + -+ if (enumdirection != EnumDirection.DOWN && world.getType(blockposition.shift(enumdirection)).getBlock().getMaterial() == Material.WATER) { ++ if (enumdirection != EnumDirection.DOWN && world.getType(blockposition.shift(enumdirection)).getMaterial() == Material.WATER) { + flag = true; + break; + } @@ -1580,7 +1460,7 @@ index 0000000..b610450 + double d1 = (double) blockposition.getY(); + double d2 = (double) blockposition.getZ(); + -+ world.makeSound(d0 + 0.5D, d1 + 0.5D, d2 + 0.5D, "random.fizz", 0.5F, 2.6F + (world.random.nextFloat() - world.random.nextFloat()) * 0.8F); ++ world.a((EntityHuman) null, blockposition, SoundEffects.db, SoundCategory.BLOCKS, 0.5F, 2.6F + (world.random.nextFloat() - world.random.nextFloat()) * 0.8F); + + for (int i = 0; i < 8; ++i) { + world.addParticle(EnumParticle.SMOKE_LARGE, d0 + Math.random(), d1 + 1.2D, d2 + Math.random(), 0.0D, 0.0D, 0.0D, new int[0]); @@ -1620,278 +1500,12 @@ index 0000000..b610450 + } + } +} -diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java -new file mode 100644 -index 0000000..2bd5499 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/BlockPosition.java -@@ -0,0 +1,260 @@ -+package net.minecraft.server; -+ -+import com.google.common.collect.AbstractIterator; -+import java.util.Iterator; -+ -+public class BlockPosition extends BaseBlockPosition { -+ -+ public static final BlockPosition ZERO = new BlockPosition(0, 0, 0); -+ private static final int c = 1 + MathHelper.c(MathHelper.b(30000000)); -+ private static final int d = BlockPosition.c; -+ private static final int e = 64 - BlockPosition.c - BlockPosition.d; -+ private static final int f = 0 + BlockPosition.d; -+ private static final int g = BlockPosition.f + BlockPosition.e; -+ private static final long h = (1L << BlockPosition.c) - 1L; -+ private static final long i = (1L << BlockPosition.e) - 1L; -+ private static final long j = (1L << BlockPosition.d) - 1L; -+ -+ public BlockPosition(int i, int j, int k) { -+ super(i, j, k); -+ } -+ -+ public BlockPosition(double d0, double d1, double d2) { -+ super(d0, d1, d2); -+ } -+ -+ public BlockPosition(Entity entity) { -+ this(entity.locX, entity.locY, entity.locZ); -+ } -+ -+ public BlockPosition(Vec3D vec3d) { -+ this(vec3d.a, vec3d.b, vec3d.c); -+ } -+ -+ public BlockPosition(BaseBlockPosition baseblockposition) { -+ this(baseblockposition.getX(), baseblockposition.getY(), baseblockposition.getZ()); -+ } -+ -+ public BlockPosition a(double d0, double d1, double d2) { -+ return d0 == 0.0D && d1 == 0.0D && d2 == 0.0D ? this : new BlockPosition((double) this.getX() + d0, (double) this.getY() + d1, (double) this.getZ() + d2); -+ } -+ -+ public BlockPosition a(int i, int j, int k) { -+ return i == 0 && j == 0 && k == 0 ? this : new BlockPosition(this.getX() + i, this.getY() + j, this.getZ() + k); -+ } -+ -+ public BlockPosition a(BaseBlockPosition baseblockposition) { -+ return baseblockposition.getX() == 0 && baseblockposition.getY() == 0 && baseblockposition.getZ() == 0 ? this : new BlockPosition(this.getX() + baseblockposition.getX(), this.getY() + baseblockposition.getY(), this.getZ() + baseblockposition.getZ()); -+ } -+ -+ public BlockPosition b(BaseBlockPosition baseblockposition) { -+ return baseblockposition.getX() == 0 && baseblockposition.getY() == 0 && baseblockposition.getZ() == 0 ? this : new BlockPosition(this.getX() - baseblockposition.getX(), this.getY() - baseblockposition.getY(), this.getZ() - baseblockposition.getZ()); -+ } -+ -+ public BlockPosition up() { -+ return this.up(1); -+ } -+ -+ public BlockPosition up(int i) { -+ return this.shift(EnumDirection.UP, i); -+ } -+ -+ public BlockPosition down() { -+ return this.down(1); -+ } -+ -+ public BlockPosition down(int i) { -+ return this.shift(EnumDirection.DOWN, i); -+ } -+ -+ public BlockPosition north() { -+ return this.north(1); -+ } -+ -+ public BlockPosition north(int i) { -+ return this.shift(EnumDirection.NORTH, i); -+ } -+ -+ public BlockPosition south() { -+ return this.south(1); -+ } -+ -+ public BlockPosition south(int i) { -+ return this.shift(EnumDirection.SOUTH, i); -+ } -+ -+ public BlockPosition west() { -+ return this.west(1); -+ } -+ -+ public BlockPosition west(int i) { -+ return this.shift(EnumDirection.WEST, i); -+ } -+ -+ public BlockPosition east() { -+ return this.east(1); -+ } -+ -+ public BlockPosition east(int i) { -+ return this.shift(EnumDirection.EAST, i); -+ } -+ -+ public BlockPosition shift(EnumDirection enumdirection) { -+ return this.shift(enumdirection, 1); -+ } -+ -+ public BlockPosition shift(EnumDirection enumdirection, int i) { -+ return i == 0 ? this : new BlockPosition(this.getX() + enumdirection.getAdjacentX() * i, this.getY() + enumdirection.getAdjacentY() * i, this.getZ() + enumdirection.getAdjacentZ() * i); -+ } -+ -+ public BlockPosition c(BaseBlockPosition baseblockposition) { -+ return new BlockPosition(this.getY() * baseblockposition.getZ() - this.getZ() * baseblockposition.getY(), this.getZ() * baseblockposition.getX() - this.getX() * baseblockposition.getZ(), this.getX() * baseblockposition.getY() - this.getY() * baseblockposition.getX()); -+ } -+ -+ public long asLong() { -+ return ((long) this.getX() & BlockPosition.h) << BlockPosition.g | ((long) this.getY() & BlockPosition.i) << BlockPosition.f | ((long) this.getZ() & BlockPosition.j) << 0; -+ } -+ -+ public static BlockPosition fromLong(long i) { -+ int j = (int) (i << 64 - BlockPosition.g - BlockPosition.c >> 64 - BlockPosition.c); -+ int k = (int) (i << 64 - BlockPosition.f - BlockPosition.e >> 64 - BlockPosition.e); -+ int l = (int) (i << 64 - BlockPosition.d >> 64 - BlockPosition.d); -+ -+ return new BlockPosition(j, k, l); -+ } -+ -+ public static Iterable a(BlockPosition blockposition, BlockPosition blockposition1) { -+ final BlockPosition blockposition2 = new BlockPosition(Math.min(blockposition.getX(), blockposition1.getX()), Math.min(blockposition.getY(), blockposition1.getY()), Math.min(blockposition.getZ(), blockposition1.getZ())); -+ final BlockPosition blockposition3 = new BlockPosition(Math.max(blockposition.getX(), blockposition1.getX()), Math.max(blockposition.getY(), blockposition1.getY()), Math.max(blockposition.getZ(), blockposition1.getZ())); -+ -+ return new Iterable() { -+ public Iterator iterator() { -+ return new AbstractIterator() { -+ private BlockPosition b = null; -+ -+ protected BlockPosition a() { -+ if (this.b == null) { -+ this.b = blockposition; -+ return this.b; -+ } else if (this.b.equals(blockposition1)) { -+ return (BlockPosition) this.endOfData(); -+ } else { -+ int i = this.b.getX(); -+ int j = this.b.getY(); -+ int k = this.b.getZ(); -+ -+ if (i < blockposition1.getX()) { -+ ++i; -+ } else if (j < blockposition1.getY()) { -+ i = blockposition.getX(); -+ ++j; -+ } else if (k < blockposition1.getZ()) { -+ i = blockposition.getX(); -+ j = blockposition.getY(); -+ ++k; -+ } -+ -+ this.b = new BlockPosition(i, j, k); -+ return this.b; -+ } -+ } -+ -+ protected Object computeNext() { -+ return this.a(); -+ } -+ }; -+ } -+ }; -+ } -+ -+ public static Iterable b(BlockPosition blockposition, BlockPosition blockposition1) { -+ final BlockPosition blockposition2 = new BlockPosition(Math.min(blockposition.getX(), blockposition1.getX()), Math.min(blockposition.getY(), blockposition1.getY()), Math.min(blockposition.getZ(), blockposition1.getZ())); -+ final BlockPosition blockposition3 = new BlockPosition(Math.max(blockposition.getX(), blockposition1.getX()), Math.max(blockposition.getY(), blockposition1.getY()), Math.max(blockposition.getZ(), blockposition1.getZ())); -+ -+ return new Iterable() { -+ public Iterator iterator() { -+ return new AbstractIterator() { -+ private BlockPosition.MutableBlockPosition b = null; -+ -+ protected BlockPosition.MutableBlockPosition a() { -+ if (this.b == null) { -+ this.b = new BlockPosition.MutableBlockPosition(blockposition.getX(), blockposition.getY(), blockposition.getZ()); -+ return this.b; -+ } else if (this.b.equals(blockposition1)) { -+ return (BlockPosition.MutableBlockPosition) this.endOfData(); -+ } else { -+ int i = this.b.getX(); -+ int j = this.b.getY(); -+ int k = this.b.getZ(); -+ -+ if (i < blockposition1.getX()) { -+ ++i; -+ } else if (j < blockposition1.getY()) { -+ i = blockposition.getX(); -+ ++j; -+ } else if (k < blockposition1.getZ()) { -+ i = blockposition.getX(); -+ j = blockposition.getY(); -+ ++k; -+ } -+ -+ this.b.c = i; -+ this.b.d = j; -+ this.b.e = k; -+ return this.b; -+ } -+ } -+ -+ protected Object computeNext() { -+ return this.a(); -+ } -+ }; -+ } -+ }; -+ } -+ -+ public BaseBlockPosition d(BaseBlockPosition baseblockposition) { -+ return this.c(baseblockposition); -+ } -+ -+ public static final class MutableBlockPosition extends BlockPosition { -+ -+ private int c; -+ private int d; -+ private int e; -+ -+ public MutableBlockPosition() { -+ this(0, 0, 0); -+ } -+ -+ public MutableBlockPosition(int i, int j, int k) { -+ super(0, 0, 0); -+ this.c = i; -+ this.d = j; -+ this.e = k; -+ } -+ -+ public int getX() { -+ return this.c; -+ } -+ -+ public int getY() { -+ return this.d; -+ } -+ -+ public int getZ() { -+ return this.e; -+ } -+ -+ public BlockPosition.MutableBlockPosition c(int i, int j, int k) { -+ this.c = i; -+ this.d = j; -+ this.e = k; -+ return this; -+ } -+ -+ public BaseBlockPosition d(BaseBlockPosition baseblockposition) { -+ return super.c(baseblockposition); -+ } -+ } -+} diff --git a/src/main/java/net/minecraft/server/ChunkProviderFlat.java b/src/main/java/net/minecraft/server/ChunkProviderFlat.java new file mode 100644 -index 0000000..d1e10c6 +index 0000000..17e0b8e --- /dev/null +++ b/src/main/java/net/minecraft/server/ChunkProviderFlat.java -@@ -0,0 +1,244 @@ +@@ -0,0 +1,214 @@ +package net.minecraft.server; + +import com.google.common.collect.Lists; @@ -1900,10 +1514,10 @@ index 0000000..d1e10c6 +import java.util.Map; +import java.util.Random; + -+public class ChunkProviderFlat implements IChunkProvider { ++public class ChunkProviderFlat implements ChunkGenerator { + -+ private World a; -+ private Random b; ++ private final World a; ++ private final Random b; + private final IBlockData[] c = new IBlockData[256]; + private final WorldGenFlatInfo d; + private final List e = Lists.newArrayList(); @@ -1981,7 +1595,7 @@ index 0000000..d1e10c6 + } + + world.b(j); -+ this.f = flag1 ? false : this.d.b().containsKey("decoration"); ++ this.f = flag1 && this.d.a() != BiomeBase.a(Biomes.P) ? false : this.d.b().containsKey("decoration"); + } + + public Chunk getOrCreateChunk(int i, int j) { @@ -2006,7 +1620,7 @@ index 0000000..d1e10c6 + while (iterator.hasNext()) { + WorldGenBase worldgenbase = (WorldGenBase) iterator.next(); + -+ worldgenbase.a(this, this.a, i, j, chunksnapshot); ++ worldgenbase.a(this.a, i, j, chunksnapshot); + } + + Chunk chunk = new Chunk(this.a, chunksnapshot, i, j); @@ -2014,18 +1628,14 @@ index 0000000..d1e10c6 + byte[] abyte = chunk.getBiomeIndex(); + + for (k = 0; k < abyte.length; ++k) { -+ abyte[k] = (byte) abiomebase[k].id; ++ abyte[k] = (byte) BiomeBase.a(abiomebase[k]); + } + + chunk.initLighting(); + return chunk; + } + -+ public boolean isChunkLoaded(int i, int j) { -+ return true; -+ } -+ -+ public void getChunkAt(IChunkProvider ichunkprovider, int i, int j) { ++ public void recreateStructures(int i, int j) { + int k = i * 16; + int l = j * 16; + BlockPosition blockposition = new BlockPosition(k, 0, l); @@ -2056,7 +1666,7 @@ index 0000000..d1e10c6 + if (this.i != null && !flag && this.b.nextInt(8) == 0) { + BlockPosition blockposition1 = blockposition.a(this.b.nextInt(16) + 8, this.b.nextInt(this.b.nextInt(248) + 8), this.b.nextInt(16) + 8); + -+ if (blockposition1.getY() < this.a.F() || this.b.nextInt(10) == 0) { ++ if (blockposition1.getY() < this.a.K() || this.b.nextInt(10) == 0) { + this.i.generate(this.a, this.b, blockposition1); + } + } @@ -2073,28 +1683,10 @@ index 0000000..d1e10c6 + + } + -+ public boolean a(IChunkProvider ichunkprovider, Chunk chunk, int i, int j) { ++ public boolean a(Chunk chunk, int i, int j) { + return false; + } + -+ public boolean saveChunks(boolean flag, IProgressUpdate iprogressupdate) { -+ return true; -+ } -+ -+ public void c() {} -+ -+ public boolean unloadChunks() { -+ return false; -+ } -+ -+ public boolean canSave() { -+ return true; -+ } -+ -+ public String getName() { -+ return "FlatLevelSource"; -+ } -+ + public List getMobsFor(EnumCreatureType enumcreaturetype, BlockPosition blockposition) { + BiomeBase biomebase = this.a.getBiome(blockposition); + @@ -2117,109 +1709,102 @@ index 0000000..d1e10c6 + return null; + } + -+ public int getLoadedChunks() { -+ return 0; -+ } -+ + public void recreateStructures(Chunk chunk, int i, int j) { + Iterator iterator = this.e.iterator(); + + while (iterator.hasNext()) { + StructureGenerator structuregenerator = (StructureGenerator) iterator.next(); + -+ structuregenerator.a(this, this.a, i, j, (ChunkSnapshot) null); ++ structuregenerator.a(this.a, i, j, (ChunkSnapshot) null); + } + + } -+ -+ public Chunk getChunkAt(BlockPosition blockposition) { -+ return this.getOrCreateChunk(blockposition.getX() >> 4, blockposition.getZ() >> 4); -+ } +} diff --git a/src/main/java/net/minecraft/server/ChunkProviderGenerate.java b/src/main/java/net/minecraft/server/ChunkProviderGenerate.java new file mode 100644 -index 0000000..e0be3c1 +index 0000000..88d0374 --- /dev/null +++ b/src/main/java/net/minecraft/server/ChunkProviderGenerate.java -@@ -0,0 +1,472 @@ +@@ -0,0 +1,449 @@ +package net.minecraft.server; + +import java.util.List; +import java.util.Random; + -+public class ChunkProviderGenerate implements IChunkProvider { ++public class ChunkProviderGenerate implements ChunkGenerator { + -+ private Random h; -+ private NoiseGeneratorOctaves i; -+ private NoiseGeneratorOctaves j; -+ private NoiseGeneratorOctaves k; -+ private NoiseGenerator3 l; -+ public NoiseGeneratorOctaves a; ++ protected static final IBlockData a = Blocks.STONE.getBlockData(); ++ private final Random i; ++ private final NoiseGeneratorOctaves j; ++ private final NoiseGeneratorOctaves k; ++ private final NoiseGeneratorOctaves l; ++ private final NoiseGenerator3 m; + public NoiseGeneratorOctaves b; + public NoiseGeneratorOctaves c; -+ private World m; -+ private final boolean n; -+ private WorldType o; -+ private final double[] p; -+ private final float[] q; -+ private CustomWorldSettingsFinal r; -+ private Block s; -+ private double[] t; -+ private WorldGenBase u; -+ private WorldGenStronghold v; -+ private WorldGenVillage w; -+ private WorldGenMineshaft x; -+ private WorldGenLargeFeature y; -+ private WorldGenBase z; -+ private WorldGenMonument A; -+ private BiomeBase[] B; -+ double[] d; ++ public NoiseGeneratorOctaves d; ++ private final World n; ++ private final boolean o; ++ private final WorldType p; ++ private final double[] q; ++ private final float[] r; ++ private CustomWorldSettingsFinal s; ++ private IBlockData t; ++ private double[] u; ++ private final WorldGenBase v; ++ private final WorldGenStronghold w; ++ private final WorldGenVillage x; ++ private final WorldGenMineshaft y; ++ private final WorldGenLargeFeature z; ++ private final WorldGenBase A; ++ private final WorldGenMonument B; ++ private BiomeBase[] C; + double[] e; + double[] f; + double[] g; ++ double[] h; + + public ChunkProviderGenerate(World world, long i, boolean flag, String s) { -+ this.s = Blocks.WATER; -+ this.t = new double[256]; -+ this.u = new WorldGenCaves(); -+ this.v = new WorldGenStronghold(); -+ this.w = new WorldGenVillage(); -+ this.x = new WorldGenMineshaft(); -+ this.y = new WorldGenLargeFeature(); -+ this.z = new WorldGenCanyon(); -+ this.A = new WorldGenMonument(); -+ this.m = world; -+ this.n = flag; -+ this.o = world.getWorldData().getType(); -+ this.h = new Random(i); -+ this.i = new NoiseGeneratorOctaves(this.h, 16); -+ this.j = new NoiseGeneratorOctaves(this.h, 16); -+ this.k = new NoiseGeneratorOctaves(this.h, 8); -+ this.l = new NoiseGenerator3(this.h, 4); -+ this.a = new NoiseGeneratorOctaves(this.h, 10); -+ this.b = new NoiseGeneratorOctaves(this.h, 16); -+ this.c = new NoiseGeneratorOctaves(this.h, 8); -+ this.p = new double[825]; -+ this.q = new float[25]; ++ this.t = Blocks.WATER.getBlockData(); ++ this.u = new double[256]; ++ this.v = new WorldGenCaves(); ++ this.w = new WorldGenStronghold(); ++ this.x = new WorldGenVillage(); ++ this.y = new WorldGenMineshaft(); ++ this.z = new WorldGenLargeFeature(); ++ this.A = new WorldGenCanyon(); ++ this.B = new WorldGenMonument(); ++ this.n = world; ++ this.o = flag; ++ this.p = world.getWorldData().getType(); ++ this.i = new Random(i); ++ this.j = new NoiseGeneratorOctaves(this.i, 16); ++ this.k = new NoiseGeneratorOctaves(this.i, 16); ++ this.l = new NoiseGeneratorOctaves(this.i, 8); ++ this.m = new NoiseGenerator3(this.i, 4); ++ this.b = new NoiseGeneratorOctaves(this.i, 10); ++ this.c = new NoiseGeneratorOctaves(this.i, 16); ++ this.d = new NoiseGeneratorOctaves(this.i, 8); ++ this.q = new double[825]; ++ this.r = new float[25]; + + for (int j = -2; j <= 2; ++j) { + for (int k = -2; k <= 2; ++k) { + float f = 10.0F / MathHelper.c((float) (j * j + k * k) + 0.2F); + -+ this.q[j + 2 + (k + 2) * 5] = f; ++ this.r[j + 2 + (k + 2) * 5] = f; + } + } + + if (s != null) { -+ this.r = CustomWorldSettingsFinal.CustomWorldSettings.a(s).b(); -+ this.s = this.r.E ? Blocks.LAVA : Blocks.WATER; -+ world.b(this.r.q); ++ this.s = CustomWorldSettingsFinal.CustomWorldSettings.a(s).b(); ++ this.t = this.s.E ? Blocks.LAVA.getBlockData() : Blocks.WATER.getBlockData(); ++ world.b(this.s.q); + } + + } + + public void a(int i, int j, ChunkSnapshot chunksnapshot) { -+ this.B = this.m.getWorldChunkManager().getBiomes(this.B, i * 4 - 2, j * 4 - 2, 10, 10); ++ this.C = this.n.getWorldChunkManager().getBiomes(this.C, i * 4 - 2, j * 4 - 2, 10, 10); + this.a(i * 4, 0, j * 4); + + for (int k = 0; k < 4; ++k) { @@ -2234,14 +1819,14 @@ index 0000000..e0be3c1 + + for (int k2 = 0; k2 < 32; ++k2) { + double d0 = 0.125D; -+ double d1 = this.p[k1 + k2]; -+ double d2 = this.p[l1 + k2]; -+ double d3 = this.p[i2 + k2]; -+ double d4 = this.p[j2 + k2]; -+ double d5 = (this.p[k1 + k2 + 1] - d1) * d0; -+ double d6 = (this.p[l1 + k2 + 1] - d2) * d0; -+ double d7 = (this.p[i2 + k2 + 1] - d3) * d0; -+ double d8 = (this.p[j2 + k2 + 1] - d4) * d0; ++ double d1 = this.q[k1 + k2]; ++ double d2 = this.q[l1 + k2]; ++ double d3 = this.q[i2 + k2]; ++ double d4 = this.q[j2 + k2]; ++ double d5 = (this.q[k1 + k2 + 1] - d1) * d0; ++ double d6 = (this.q[l1 + k2 + 1] - d2) * d0; ++ double d7 = (this.q[i2 + k2 + 1] - d3) * d0; ++ double d8 = (this.q[j2 + k2 + 1] - d4) * d0; + + for (int l2 = 0; l2 < 8; ++l2) { + double d9 = 0.25D; @@ -2257,9 +1842,9 @@ index 0000000..e0be3c1 + + for (int j3 = 0; j3 < 4; ++j3) { + if ((d16 += d15) > 0.0D) { -+ chunksnapshot.a(k * 4 + i3, k2 * 8 + l2, j1 * 4 + j3, Blocks.STONE.getBlockData()); -+ } else if (k2 * 8 + l2 < this.r.q) { -+ chunksnapshot.a(k * 4 + i3, k2 * 8 + l2, j1 * 4 + j3, this.s.getBlockData()); ++ chunksnapshot.a(k * 4 + i3, k2 * 8 + l2, j1 * 4 + j3, ChunkProviderGenerate.a); ++ } else if (k2 * 8 + l2 < this.s.q) { ++ chunksnapshot.a(k * 4 + i3, k2 * 8 + l2, j1 * 4 + j3, this.t); + } + } + @@ -2281,58 +1866,60 @@ index 0000000..e0be3c1 + public void a(int i, int j, ChunkSnapshot chunksnapshot, BiomeBase[] abiomebase) { + double d0 = 0.03125D; + -+ this.t = this.l.a(this.t, (double) (i * 16), (double) (j * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D); ++ this.u = this.m.a(this.u, (double) (i * 16), (double) (j * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D); + + for (int k = 0; k < 16; ++k) { + for (int l = 0; l < 16; ++l) { + BiomeBase biomebase = abiomebase[l + k * 16]; + -+ biomebase.a(this.m, this.h, chunksnapshot, i * 16 + k, j * 16 + l, this.t[l + k * 16]); ++ biomebase.a(this.n, this.i, chunksnapshot, i * 16 + k, j * 16 + l, this.u[l + k * 16]); + } + } + + } + + public Chunk getOrCreateChunk(int i, int j) { -+ this.h.setSeed((long) i * 341873128712L + (long) j * 132897987541L); ++ this.i.setSeed((long) i * 341873128712L + (long) j * 132897987541L); + ChunkSnapshot chunksnapshot = new ChunkSnapshot(); + + this.a(i, j, chunksnapshot); -+ this.B = this.m.getWorldChunkManager().getBiomeBlock(this.B, i * 16, j * 16, 16, 16); -+ this.a(i, j, chunksnapshot, this.B); -+ if (this.r.r) { -+ this.u.a(this, this.m, i, j, chunksnapshot); ++ this.C = this.n.getWorldChunkManager().getBiomeBlock(this.C, i * 16, j * 16, 16, 16); ++ this.a(i, j, chunksnapshot, this.C); ++ if (this.s.r) { ++ this.v.a(this.n, i, j, chunksnapshot); + } + -+ if (this.r.z) { -+ this.z.a(this, this.m, i, j, chunksnapshot); ++ if (this.s.z) { ++ this.A.a(this.n, i, j, chunksnapshot); + } + -+ if (this.r.w && this.n) { -+ this.x.a(this, this.m, i, j, chunksnapshot); ++ if (this.o) { ++ if (this.s.w) { ++ this.y.a(this.n, i, j, chunksnapshot); ++ } ++ ++ if (this.s.v) { ++ this.x.a(this.n, i, j, chunksnapshot); ++ } ++ ++ if (this.s.u) { ++ this.w.a(this.n, i, j, chunksnapshot); ++ } ++ ++ if (this.s.x) { ++ this.z.a(this.n, i, j, chunksnapshot); ++ } ++ ++ if (this.s.y) { ++ this.B.a(this.n, i, j, chunksnapshot); ++ } + } + -+ if (this.r.v && this.n) { -+ this.w.a(this, this.m, i, j, chunksnapshot); -+ } -+ -+ if (this.r.u && this.n) { -+ this.v.a(this, this.m, i, j, chunksnapshot); -+ } -+ -+ if (this.r.x && this.n) { -+ this.y.a(this, this.m, i, j, chunksnapshot); -+ } -+ -+ if (this.r.y && this.n) { -+ this.A.a(this, this.m, i, j, chunksnapshot); -+ } -+ -+ Chunk chunk = new Chunk(this.m, chunksnapshot, i, j); ++ Chunk chunk = new Chunk(this.n, chunksnapshot, i, j); + byte[] abyte = chunk.getBiomeIndex(); + + for (int k = 0; k < abyte.length; ++k) { -+ abyte[k] = (byte) this.B[k].id; ++ abyte[k] = (byte) BiomeBase.a(this.C[k]); + } + + chunk.initLighting(); @@ -2340,13 +1927,13 @@ index 0000000..e0be3c1 + } + + private void a(int i, int j, int k) { -+ this.g = this.b.a(this.g, i, k, 5, 5, (double) this.r.e, (double) this.r.f, (double) this.r.g); -+ float f = this.r.a; -+ float f1 = this.r.b; ++ this.h = this.c.a(this.h, i, k, 5, 5, (double) this.s.e, (double) this.s.f, (double) this.s.g); ++ float f = this.s.a; ++ float f1 = this.s.b; + -+ this.d = this.k.a(this.d, i, j, k, 5, 33, 5, (double) (f / this.r.h), (double) (f1 / this.r.i), (double) (f / this.r.j)); -+ this.e = this.i.a(this.e, i, j, k, 5, 33, 5, (double) f, (double) f1, (double) f); ++ this.e = this.l.a(this.e, i, j, k, 5, 33, 5, (double) (f / this.s.h), (double) (f1 / this.s.i), (double) (f / this.s.j)); + this.f = this.j.a(this.f, i, j, k, 5, 33, 5, (double) f, (double) f1, (double) f); ++ this.g = this.k.a(this.g, i, j, k, 5, 33, 5, (double) f, (double) f1, (double) f); + boolean flag = false; + boolean flag1 = false; + int l = 0; @@ -2358,22 +1945,22 @@ index 0000000..e0be3c1 + float f3 = 0.0F; + float f4 = 0.0F; + byte b0 = 2; -+ BiomeBase biomebase = this.B[j1 + 2 + (k1 + 2) * 10]; ++ BiomeBase biomebase = this.C[j1 + 2 + (k1 + 2) * 10]; + + for (int l1 = -b0; l1 <= b0; ++l1) { + for (int i2 = -b0; i2 <= b0; ++i2) { -+ BiomeBase biomebase1 = this.B[j1 + l1 + 2 + (k1 + i2 + 2) * 10]; -+ float f5 = this.r.n + biomebase1.an * this.r.m; -+ float f6 = this.r.p + biomebase1.ao * this.r.o; ++ BiomeBase biomebase1 = this.C[j1 + l1 + 2 + (k1 + i2 + 2) * 10]; ++ float f5 = this.s.n + biomebase1.j() * this.s.m; ++ float f6 = this.s.p + biomebase1.m() * this.s.o; + -+ if (this.o == WorldType.AMPLIFIED && f5 > 0.0F) { ++ if (this.p == WorldType.AMPLIFIED && f5 > 0.0F) { + f5 = 1.0F + f5 * 2.0F; + f6 = 1.0F + f6 * 4.0F; + } + -+ float f7 = this.q[l1 + 2 + (i2 + 2) * 5] / (f5 + 2.0F); ++ float f7 = this.r[l1 + 2 + (i2 + 2) * 5] / (f5 + 2.0F); + -+ if (biomebase1.an > biomebase.an) { ++ if (biomebase1.j() > biomebase.j()) { + f7 /= 2.0F; + } + @@ -2387,7 +1974,7 @@ index 0000000..e0be3c1 + f3 /= f4; + f2 = f2 * 0.9F + 0.1F; + f3 = (f3 * 4.0F - 1.0F) / 8.0F; -+ double d0 = this.g[i1] / 8000.0D; ++ double d0 = this.h[i1] / 8000.0D; + + if (d0 < 0.0D) { + d0 = -d0 * 0.3D; @@ -2415,19 +2002,19 @@ index 0000000..e0be3c1 + double d2 = (double) f2; + + d1 += d0 * 0.2D; -+ d1 = d1 * (double) this.r.k / 8.0D; -+ double d3 = (double) this.r.k + d1 * 4.0D; ++ d1 = d1 * (double) this.s.k / 8.0D; ++ double d3 = (double) this.s.k + d1 * 4.0D; + + for (int j2 = 0; j2 < 33; ++j2) { -+ double d4 = ((double) j2 - d3) * (double) this.r.l * 128.0D / 256.0D / d2; ++ double d4 = ((double) j2 - d3) * (double) this.s.l * 128.0D / 256.0D / d2; + + if (d4 < 0.0D) { + d4 *= 4.0D; + } + -+ double d5 = this.e[l] / (double) this.r.d; -+ double d6 = this.f[l] / (double) this.r.c; -+ double d7 = (this.d[l] / 10.0D + 1.0D) / 2.0D; ++ double d5 = this.f[l] / (double) this.s.d; ++ double d6 = this.g[l] / (double) this.s.c; ++ double d7 = (this.e[l] / 10.0D + 1.0D) / 2.0D; + double d8 = MathHelper.b(d5, d6, d7) - d4; + + if (j2 > 29) { @@ -2436,7 +2023,7 @@ index 0000000..e0be3c1 + d8 = d8 * (1.0D - d9) + -10.0D * d9; + } + -+ this.p[l] = d8; ++ this.q[l] = d8; + ++l; + } + } @@ -2444,90 +2031,88 @@ index 0000000..e0be3c1 + + } + -+ public boolean isChunkLoaded(int i, int j) { -+ return true; -+ } -+ -+ public void getChunkAt(IChunkProvider ichunkprovider, int i, int j) { ++ public void recreateStructures(int i, int j) { + BlockFalling.instaFall = true; + int k = i * 16; + int l = j * 16; + BlockPosition blockposition = new BlockPosition(k, 0, l); -+ BiomeBase biomebase = this.m.getBiome(blockposition.a(16, 0, 16)); ++ BiomeBase biomebase = this.n.getBiome(blockposition.a(16, 0, 16)); + -+ this.h.setSeed(this.m.getSeed()); -+ long i1 = this.h.nextLong() / 2L * 2L + 1L; -+ long j1 = this.h.nextLong() / 2L * 2L + 1L; ++ this.i.setSeed(this.n.getSeed()); ++ long i1 = this.i.nextLong() / 2L * 2L + 1L; ++ long j1 = this.i.nextLong() / 2L * 2L + 1L; + -+ this.h.setSeed((long) i * i1 + (long) j * j1 ^ this.m.getSeed()); ++ this.i.setSeed((long) i * i1 + (long) j * j1 ^ this.n.getSeed()); + boolean flag = false; + ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i, j); + -+ if (this.r.w && this.n) { -+ this.x.a(this.m, this.h, chunkcoordintpair); -+ } ++ if (this.o) { ++ if (this.s.w) { ++ this.y.a(this.n, this.i, chunkcoordintpair); ++ } + -+ if (this.r.v && this.n) { -+ flag = this.w.a(this.m, this.h, chunkcoordintpair); -+ } ++ if (this.s.v) { ++ flag = this.x.a(this.n, this.i, chunkcoordintpair); ++ } + -+ if (this.r.u && this.n) { -+ this.v.a(this.m, this.h, chunkcoordintpair); -+ } ++ if (this.s.u) { ++ this.w.a(this.n, this.i, chunkcoordintpair); ++ } + -+ if (this.r.x && this.n) { -+ this.y.a(this.m, this.h, chunkcoordintpair); -+ } ++ if (this.s.x) { ++ this.z.a(this.n, this.i, chunkcoordintpair); ++ } + -+ if (this.r.y && this.n) { -+ this.A.a(this.m, this.h, chunkcoordintpair); ++ if (this.s.y) { ++ this.B.a(this.n, this.i, chunkcoordintpair); ++ } + } + + int k1; + int l1; + int i2; + -+ if (biomebase != BiomeBase.DESERT && biomebase != BiomeBase.DESERT_HILLS && this.r.A && !flag && this.h.nextInt(this.r.B) == 0) { -+ k1 = this.h.nextInt(16) + 8; -+ l1 = this.h.nextInt(256); -+ i2 = this.h.nextInt(16) + 8; -+ (new WorldGenLakes(Blocks.WATER)).generate(this.m, this.h, blockposition.a(k1, l1, i2)); ++ if (biomebase != Biomes.d && biomebase != Biomes.s && this.s.A && !flag && this.i.nextInt(this.s.B) == 0) { ++ k1 = this.i.nextInt(16) + 8; ++ l1 = this.i.nextInt(256); ++ i2 = this.i.nextInt(16) + 8; ++ (new WorldGenLakes(Blocks.WATER)).generate(this.n, this.i, blockposition.a(k1, l1, i2)); + } + -+ if (!flag && this.h.nextInt(this.r.D / 10) == 0 && this.r.C) { -+ k1 = this.h.nextInt(16) + 8; -+ l1 = this.h.nextInt(this.h.nextInt(248) + 8); -+ i2 = this.h.nextInt(16) + 8; -+ if (l1 < this.m.F() || this.h.nextInt(this.r.D / 8) == 0) { -+ (new WorldGenLakes(Blocks.LAVA)).generate(this.m, this.h, blockposition.a(k1, l1, i2)); ++ if (!flag && this.i.nextInt(this.s.D / 10) == 0 && this.s.C) { ++ k1 = this.i.nextInt(16) + 8; ++ l1 = this.i.nextInt(this.i.nextInt(248) + 8); ++ i2 = this.i.nextInt(16) + 8; ++ if (l1 < this.n.K() || this.i.nextInt(this.s.D / 8) == 0) { ++ (new WorldGenLakes(Blocks.LAVA)).generate(this.n, this.i, blockposition.a(k1, l1, i2)); + } + } + -+ if (this.r.s) { -+ for (k1 = 0; k1 < this.r.t; ++k1) { -+ l1 = this.h.nextInt(16) + 8; -+ i2 = this.h.nextInt(256); -+ int j2 = this.h.nextInt(16) + 8; ++ if (this.s.s) { ++ for (k1 = 0; k1 < this.s.t; ++k1) { ++ l1 = this.i.nextInt(16) + 8; ++ i2 = this.i.nextInt(256); ++ int j2 = this.i.nextInt(16) + 8; + -+ (new WorldGenDungeons()).generate(this.m, this.h, blockposition.a(l1, i2, j2)); ++ (new WorldGenDungeons()).generate(this.n, this.i, blockposition.a(l1, i2, j2)); + } + } + -+ biomebase.a(this.m, this.h, new BlockPosition(k, 0, l)); -+ SpawnerCreature.a(this.m, biomebase, k + 8, l + 8, 16, 16, this.h); ++ biomebase.a(this.n, this.i, new BlockPosition(k, 0, l)); ++ SpawnerCreature.a(this.n, biomebase, k + 8, l + 8, 16, 16, this.i); + blockposition = blockposition.a(8, 0, 8); + + for (k1 = 0; k1 < 16; ++k1) { + for (l1 = 0; l1 < 16; ++l1) { -+ BlockPosition blockposition1 = this.m.q(blockposition.a(k1, 0, l1)); ++ BlockPosition blockposition1 = this.n.p(blockposition.a(k1, 0, l1)); + BlockPosition blockposition2 = blockposition1.down(); + -+ if (this.m.v(blockposition2)) { -+ this.m.setTypeAndData(blockposition2, Blocks.ICE.getBlockData(), 2); ++ if (this.n.u(blockposition2)) { ++ this.n.setTypeAndData(blockposition2, Blocks.ICE.getBlockData(), 2); + } + -+ if (this.m.f(blockposition1, true)) { -+ this.m.setTypeAndData(blockposition1, Blocks.SNOW_LAYER.getBlockData(), 2); ++ if (this.n.f(blockposition1, true)) { ++ this.n.setTypeAndData(blockposition1, Blocks.SNOW_LAYER.getBlockData(), 2); + } + } + } @@ -2535,44 +2120,26 @@ index 0000000..e0be3c1 + BlockFalling.instaFall = false; + } + -+ public boolean a(IChunkProvider ichunkprovider, Chunk chunk, int i, int j) { ++ public boolean a(Chunk chunk, int i, int j) { + boolean flag = false; + -+ if (this.r.y && this.n && chunk.w() < 3600L) { -+ flag |= this.A.a(this.m, this.h, new ChunkCoordIntPair(i, j)); ++ if (this.s.y && this.o && chunk.x() < 3600L) { ++ flag |= this.B.a(this.n, this.i, new ChunkCoordIntPair(i, j)); + } + + return flag; + } + -+ public boolean saveChunks(boolean flag, IProgressUpdate iprogressupdate) { -+ return true; -+ } -+ -+ public void c() {} -+ -+ public boolean unloadChunks() { -+ return false; -+ } -+ -+ public boolean canSave() { -+ return true; -+ } -+ -+ public String getName() { -+ return "RandomLevelSource"; -+ } -+ + public List getMobsFor(EnumCreatureType enumcreaturetype, BlockPosition blockposition) { -+ BiomeBase biomebase = this.m.getBiome(blockposition); ++ BiomeBase biomebase = this.n.getBiome(blockposition); + -+ if (this.n) { -+ if (enumcreaturetype == EnumCreatureType.MONSTER && this.y.a(blockposition)) { -+ return this.y.b(); ++ if (this.o) { ++ if (enumcreaturetype == EnumCreatureType.MONSTER && this.z.a(blockposition)) { ++ return this.z.b(); + } + -+ if (enumcreaturetype == EnumCreatureType.MONSTER && this.r.y && this.A.a(this.m, blockposition)) { -+ return this.A.b(); ++ if (enumcreaturetype == EnumCreatureType.MONSTER && this.s.y && this.B.b(this.n, blockposition)) { ++ return this.B.b(); + } + } + @@ -2580,125 +2147,125 @@ index 0000000..e0be3c1 + } + + public BlockPosition findNearestMapFeature(World world, String s, BlockPosition blockposition) { -+ return "Stronghold".equals(s) && this.v != null ? this.v.getNearestGeneratedFeature(world, blockposition) : null; -+ } -+ -+ public int getLoadedChunks() { -+ return 0; ++ return "Stronghold".equals(s) && this.w != null ? this.w.getNearestGeneratedFeature(world, blockposition) : null; + } + + public void recreateStructures(Chunk chunk, int i, int j) { -+ if (this.r.w && this.n) { -+ this.x.a(this, this.m, i, j, (ChunkSnapshot) null); ++ if (this.o) { ++ if (this.s.w) { ++ this.y.a(this.n, i, j, (ChunkSnapshot) null); ++ } ++ ++ if (this.s.v) { ++ this.x.a(this.n, i, j, (ChunkSnapshot) null); ++ } ++ ++ if (this.s.u) { ++ this.w.a(this.n, i, j, (ChunkSnapshot) null); ++ } ++ ++ if (this.s.x) { ++ this.z.a(this.n, i, j, (ChunkSnapshot) null); ++ } ++ ++ if (this.s.y) { ++ this.B.a(this.n, i, j, (ChunkSnapshot) null); ++ } + } + -+ if (this.r.v && this.n) { -+ this.w.a(this, this.m, i, j, (ChunkSnapshot) null); -+ } -+ -+ if (this.r.u && this.n) { -+ this.v.a(this, this.m, i, j, (ChunkSnapshot) null); -+ } -+ -+ if (this.r.x && this.n) { -+ this.y.a(this, this.m, i, j, (ChunkSnapshot) null); -+ } -+ -+ if (this.r.y && this.n) { -+ this.A.a(this, this.m, i, j, (ChunkSnapshot) null); -+ } -+ -+ } -+ -+ public Chunk getChunkAt(BlockPosition blockposition) { -+ return this.getOrCreateChunk(blockposition.getX() >> 4, blockposition.getZ() >> 4); + } +} diff --git a/src/main/java/net/minecraft/server/ChunkProviderHell.java b/src/main/java/net/minecraft/server/ChunkProviderHell.java new file mode 100644 -index 0000000..2f01bbf +index 0000000..0150efd --- /dev/null +++ b/src/main/java/net/minecraft/server/ChunkProviderHell.java -@@ -0,0 +1,393 @@ +@@ -0,0 +1,369 @@ +package net.minecraft.server; + +import java.util.List; +import java.util.Random; + -+public class ChunkProviderHell implements IChunkProvider { ++public class ChunkProviderHell implements ChunkGenerator { + -+ private final World h; -+ private final boolean i; -+ private final Random j; -+ private double[] k = new double[256]; -+ private double[] l = new double[256]; -+ private double[] m = new double[256]; -+ private double[] n; -+ private final NoiseGeneratorOctaves o; -+ private final NoiseGeneratorOctaves p; -+ private final NoiseGeneratorOctaves q; -+ private final NoiseGeneratorOctaves r; -+ private final NoiseGeneratorOctaves s; -+ public final NoiseGeneratorOctaves a; -+ public final NoiseGeneratorOctaves b; -+ private final WorldGenFire t = new WorldGenFire(); -+ private final WorldGenLightStone1 u = new WorldGenLightStone1(); -+ private final WorldGenLightStone2 v = new WorldGenLightStone2(); -+ private final WorldGenerator w; -+ private final WorldGenHellLava x; -+ private final WorldGenHellLava y; -+ private final WorldGenMushrooms z; -+ private final WorldGenMushrooms A; -+ private final WorldGenNether B; -+ private final WorldGenBase C; -+ double[] c; -+ double[] d; -+ double[] e; -+ double[] f; -+ double[] g; ++ protected static final IBlockData a = Blocks.AIR.getBlockData(); ++ protected static final IBlockData b = Blocks.NETHERRACK.getBlockData(); ++ protected static final IBlockData c = Blocks.BEDROCK.getBlockData(); ++ protected static final IBlockData d = Blocks.LAVA.getBlockData(); ++ protected static final IBlockData e = Blocks.GRAVEL.getBlockData(); ++ protected static final IBlockData f = Blocks.SOUL_SAND.getBlockData(); ++ private final World n; ++ private final boolean o; ++ private final Random p; ++ private double[] q = new double[256]; ++ private double[] r = new double[256]; ++ private double[] s = new double[256]; ++ private double[] t; ++ private final NoiseGeneratorOctaves u; ++ private final NoiseGeneratorOctaves v; ++ private final NoiseGeneratorOctaves w; ++ private final NoiseGeneratorOctaves x; ++ private final NoiseGeneratorOctaves y; ++ public final NoiseGeneratorOctaves g; ++ public final NoiseGeneratorOctaves h; ++ private final WorldGenFire z = new WorldGenFire(); ++ private final WorldGenLightStone1 A = new WorldGenLightStone1(); ++ private final WorldGenLightStone2 B = new WorldGenLightStone2(); ++ private final WorldGenerator C; ++ private final WorldGenHellLava D; ++ private final WorldGenHellLava E; ++ private final WorldGenMushrooms F; ++ private final WorldGenMushrooms G; ++ private final WorldGenNether H; ++ private final WorldGenBase I; ++ double[] i; ++ double[] j; ++ double[] k; ++ double[] l; ++ double[] m; + + public ChunkProviderHell(World world, boolean flag, long i) { -+ this.w = new WorldGenMinable(Blocks.QUARTZ_ORE.getBlockData(), 14, BlockPredicate.a(Blocks.NETHERRACK)); -+ this.x = new WorldGenHellLava(Blocks.FLOWING_LAVA, true); -+ this.y = new WorldGenHellLava(Blocks.FLOWING_LAVA, false); -+ this.z = new WorldGenMushrooms(Blocks.BROWN_MUSHROOM); -+ this.A = new WorldGenMushrooms(Blocks.RED_MUSHROOM); -+ this.B = new WorldGenNether(); -+ this.C = new WorldGenCavesHell(); -+ this.h = world; -+ this.i = flag; -+ this.j = new Random(i); -+ this.o = new NoiseGeneratorOctaves(this.j, 16); -+ this.p = new NoiseGeneratorOctaves(this.j, 16); -+ this.q = new NoiseGeneratorOctaves(this.j, 8); -+ this.r = new NoiseGeneratorOctaves(this.j, 4); -+ this.s = new NoiseGeneratorOctaves(this.j, 4); -+ this.a = new NoiseGeneratorOctaves(this.j, 10); -+ this.b = new NoiseGeneratorOctaves(this.j, 16); ++ this.C = new WorldGenMinable(Blocks.QUARTZ_ORE.getBlockData(), 14, BlockPredicate.a(Blocks.NETHERRACK)); ++ this.D = new WorldGenHellLava(Blocks.FLOWING_LAVA, true); ++ this.E = new WorldGenHellLava(Blocks.FLOWING_LAVA, false); ++ this.F = new WorldGenMushrooms(Blocks.BROWN_MUSHROOM); ++ this.G = new WorldGenMushrooms(Blocks.RED_MUSHROOM); ++ this.H = new WorldGenNether(); ++ this.I = new WorldGenCavesHell(); ++ this.n = world; ++ this.o = flag; ++ this.p = new Random(i); ++ this.u = new NoiseGeneratorOctaves(this.p, 16); ++ this.v = new NoiseGeneratorOctaves(this.p, 16); ++ this.w = new NoiseGeneratorOctaves(this.p, 8); ++ this.x = new NoiseGeneratorOctaves(this.p, 4); ++ this.y = new NoiseGeneratorOctaves(this.p, 4); ++ this.g = new NoiseGeneratorOctaves(this.p, 10); ++ this.h = new NoiseGeneratorOctaves(this.p, 16); + world.b(63); + } + + public void a(int i, int j, ChunkSnapshot chunksnapshot) { + byte b0 = 4; -+ int k = this.h.F() / 2 + 1; ++ int k = this.n.K() / 2 + 1; + int l = b0 + 1; + byte b1 = 17; + int i1 = b0 + 1; + -+ this.n = this.a(this.n, i * b0, 0, j * b0, l, b1, i1); ++ this.t = this.a(this.t, i * b0, 0, j * b0, l, b1, i1); + + for (int j1 = 0; j1 < b0; ++j1) { + for (int k1 = 0; k1 < b0; ++k1) { + for (int l1 = 0; l1 < 16; ++l1) { + double d0 = 0.125D; -+ double d1 = this.n[((j1 + 0) * i1 + k1 + 0) * b1 + l1 + 0]; -+ double d2 = this.n[((j1 + 0) * i1 + k1 + 1) * b1 + l1 + 0]; -+ double d3 = this.n[((j1 + 1) * i1 + k1 + 0) * b1 + l1 + 0]; -+ double d4 = this.n[((j1 + 1) * i1 + k1 + 1) * b1 + l1 + 0]; -+ double d5 = (this.n[((j1 + 0) * i1 + k1 + 0) * b1 + l1 + 1] - d1) * d0; -+ double d6 = (this.n[((j1 + 0) * i1 + k1 + 1) * b1 + l1 + 1] - d2) * d0; -+ double d7 = (this.n[((j1 + 1) * i1 + k1 + 0) * b1 + l1 + 1] - d3) * d0; -+ double d8 = (this.n[((j1 + 1) * i1 + k1 + 1) * b1 + l1 + 1] - d4) * d0; ++ double d1 = this.t[((j1 + 0) * i1 + k1 + 0) * b1 + l1 + 0]; ++ double d2 = this.t[((j1 + 0) * i1 + k1 + 1) * b1 + l1 + 0]; ++ double d3 = this.t[((j1 + 1) * i1 + k1 + 0) * b1 + l1 + 0]; ++ double d4 = this.t[((j1 + 1) * i1 + k1 + 1) * b1 + l1 + 0]; ++ double d5 = (this.t[((j1 + 0) * i1 + k1 + 0) * b1 + l1 + 1] - d1) * d0; ++ double d6 = (this.t[((j1 + 0) * i1 + k1 + 1) * b1 + l1 + 1] - d2) * d0; ++ double d7 = (this.t[((j1 + 1) * i1 + k1 + 0) * b1 + l1 + 1] - d3) * d0; ++ double d8 = (this.t[((j1 + 1) * i1 + k1 + 1) * b1 + l1 + 1] - d4) * d0; + + for (int i2 = 0; i2 < 8; ++i2) { + double d9 = 0.25D; @@ -2716,11 +2283,11 @@ index 0000000..2f01bbf + IBlockData iblockdata = null; + + if (l1 * 8 + i2 < k) { -+ iblockdata = Blocks.LAVA.getBlockData(); ++ iblockdata = ChunkProviderHell.d; + } + + if (d15 > 0.0D) { -+ iblockdata = Blocks.NETHERRACK.getBlockData(); ++ iblockdata = ChunkProviderHell.b; + } + + int l2 = j2 + j1 * 4; @@ -2747,48 +2314,48 @@ index 0000000..2f01bbf + } + + public void b(int i, int j, ChunkSnapshot chunksnapshot) { -+ int k = this.h.F() + 1; ++ int k = this.n.K() + 1; + double d0 = 0.03125D; + -+ this.k = this.r.a(this.k, i * 16, j * 16, 0, 16, 16, 1, d0, d0, 1.0D); -+ this.l = this.r.a(this.l, i * 16, 109, j * 16, 16, 1, 16, d0, 1.0D, d0); -+ this.m = this.s.a(this.m, i * 16, j * 16, 0, 16, 16, 1, d0 * 2.0D, d0 * 2.0D, d0 * 2.0D); ++ this.q = this.x.a(this.q, i * 16, j * 16, 0, 16, 16, 1, d0, d0, 1.0D); ++ this.r = this.x.a(this.r, i * 16, 109, j * 16, 16, 1, 16, d0, 1.0D, d0); ++ this.s = this.y.a(this.s, i * 16, j * 16, 0, 16, 16, 1, d0 * 2.0D, d0 * 2.0D, d0 * 2.0D); + + for (int l = 0; l < 16; ++l) { + for (int i1 = 0; i1 < 16; ++i1) { -+ boolean flag = this.k[l + i1 * 16] + this.j.nextDouble() * 0.2D > 0.0D; -+ boolean flag1 = this.l[l + i1 * 16] + this.j.nextDouble() * 0.2D > 0.0D; -+ int j1 = (int) (this.m[l + i1 * 16] / 3.0D + 3.0D + this.j.nextDouble() * 0.25D); ++ boolean flag = this.q[l + i1 * 16] + this.p.nextDouble() * 0.2D > 0.0D; ++ boolean flag1 = this.r[l + i1 * 16] + this.p.nextDouble() * 0.2D > 0.0D; ++ int j1 = (int) (this.s[l + i1 * 16] / 3.0D + 3.0D + this.p.nextDouble() * 0.25D); + int k1 = -1; -+ IBlockData iblockdata = Blocks.NETHERRACK.getBlockData(); -+ IBlockData iblockdata1 = Blocks.NETHERRACK.getBlockData(); ++ IBlockData iblockdata = ChunkProviderHell.b; ++ IBlockData iblockdata1 = ChunkProviderHell.b; + + for (int l1 = 127; l1 >= 0; --l1) { -+ if (l1 < 127 - this.j.nextInt(5) && l1 > this.j.nextInt(5)) { ++ if (l1 < 127 - this.p.nextInt(5) && l1 > this.p.nextInt(5)) { + IBlockData iblockdata2 = chunksnapshot.a(i1, l1, l); + -+ if (iblockdata2.getBlock() != null && iblockdata2.getBlock().getMaterial() != Material.AIR) { ++ if (iblockdata2.getBlock() != null && iblockdata2.getMaterial() != Material.AIR) { + if (iblockdata2.getBlock() == Blocks.NETHERRACK) { + if (k1 == -1) { + if (j1 <= 0) { -+ iblockdata = null; -+ iblockdata1 = Blocks.NETHERRACK.getBlockData(); ++ iblockdata = ChunkProviderHell.a; ++ iblockdata1 = ChunkProviderHell.b; + } else if (l1 >= k - 4 && l1 <= k + 1) { -+ iblockdata = Blocks.NETHERRACK.getBlockData(); -+ iblockdata1 = Blocks.NETHERRACK.getBlockData(); ++ iblockdata = ChunkProviderHell.b; ++ iblockdata1 = ChunkProviderHell.b; + if (flag1) { -+ iblockdata = Blocks.GRAVEL.getBlockData(); -+ iblockdata1 = Blocks.NETHERRACK.getBlockData(); ++ iblockdata = ChunkProviderHell.e; ++ iblockdata1 = ChunkProviderHell.b; + } + + if (flag) { -+ iblockdata = Blocks.SOUL_SAND.getBlockData(); -+ iblockdata1 = Blocks.SOUL_SAND.getBlockData(); ++ iblockdata = ChunkProviderHell.f; ++ iblockdata1 = ChunkProviderHell.f; + } + } + -+ if (l1 < k && (iblockdata == null || iblockdata.getBlock().getMaterial() == Material.AIR)) { -+ iblockdata = Blocks.LAVA.getBlockData(); ++ if (l1 < k && (iblockdata == null || iblockdata.getMaterial() == Material.AIR)) { ++ iblockdata = ChunkProviderHell.d; + } + + k1 = j1; @@ -2806,7 +2373,7 @@ index 0000000..2f01bbf + k1 = -1; + } + } else { -+ chunksnapshot.a(i1, l1, l, Blocks.BEDROCK.getBlockData()); ++ chunksnapshot.a(i1, l1, l, ChunkProviderHell.c); + } + } + } @@ -2815,25 +2382,25 @@ index 0000000..2f01bbf + } + + public Chunk getOrCreateChunk(int i, int j) { -+ this.j.setSeed((long) i * 341873128712L + (long) j * 132897987541L); ++ this.p.setSeed((long) i * 341873128712L + (long) j * 132897987541L); + ChunkSnapshot chunksnapshot = new ChunkSnapshot(); + + this.a(i, j, chunksnapshot); + this.b(i, j, chunksnapshot); -+ this.C.a(this, this.h, i, j, chunksnapshot); -+ if (this.i) { -+ this.B.a(this, this.h, i, j, chunksnapshot); ++ this.I.a(this.n, i, j, chunksnapshot); ++ if (this.o) { ++ this.H.a(this.n, i, j, chunksnapshot); + } + -+ Chunk chunk = new Chunk(this.h, chunksnapshot, i, j); -+ BiomeBase[] abiomebase = this.h.getWorldChunkManager().getBiomeBlock((BiomeBase[]) null, i * 16, j * 16, 16, 16); ++ Chunk chunk = new Chunk(this.n, chunksnapshot, i, j); ++ BiomeBase[] abiomebase = this.n.getWorldChunkManager().getBiomeBlock((BiomeBase[]) null, i * 16, j * 16, 16, 16); + byte[] abyte = chunk.getBiomeIndex(); + + for (int k = 0; k < abyte.length; ++k) { -+ abyte[k] = (byte) abiomebase[k].id; ++ abyte[k] = (byte) BiomeBase.a(abiomebase[k]); + } + -+ chunk.l(); ++ chunk.m(); + return chunk; + } + @@ -2845,11 +2412,11 @@ index 0000000..2f01bbf + double d0 = 684.412D; + double d1 = 2053.236D; + -+ this.f = this.a.a(this.f, i, j, k, l, 1, j1, 1.0D, 0.0D, 1.0D); -+ this.g = this.b.a(this.g, i, j, k, l, 1, j1, 100.0D, 0.0D, 100.0D); -+ this.c = this.q.a(this.c, i, j, k, l, i1, j1, d0 / 80.0D, d1 / 60.0D, d0 / 80.0D); -+ this.d = this.o.a(this.d, i, j, k, l, i1, j1, d0, d1, d0); -+ this.e = this.p.a(this.e, i, j, k, l, i1, j1, d0, d1, d0); ++ this.l = this.g.a(this.l, i, j, k, l, 1, j1, 1.0D, 0.0D, 1.0D); ++ this.m = this.h.a(this.m, i, j, k, l, 1, j1, 100.0D, 0.0D, 100.0D); ++ this.i = this.w.a(this.i, i, j, k, l, i1, j1, d0 / 80.0D, d1 / 60.0D, d0 / 80.0D); ++ this.j = this.u.a(this.j, i, j, k, l, i1, j1, d0, d1, d0); ++ this.k = this.v.a(this.k, i, j, k, l, i1, j1, d0, d1, d0); + int k1 = 0; + double[] adouble1 = new double[i1]; + @@ -2876,9 +2443,9 @@ index 0000000..2f01bbf + for (int j2 = 0; j2 < i1; ++j2) { + double d4 = 0.0D; + double d5 = adouble1[j2]; -+ double d6 = this.d[k1] / 512.0D; -+ double d7 = this.e[k1] / 512.0D; -+ double d8 = (this.c[k1] / 10.0D + 1.0D) / 2.0D; ++ double d6 = this.j[k1] / 512.0D; ++ double d7 = this.k[k1] / 512.0D; ++ double d8 = (this.i[k1] / 10.0D + 1.0D) / 2.0D; + + if (d8 < 0.0D) { + d4 = d6; @@ -2911,88 +2478,66 @@ index 0000000..2f01bbf + return adouble; + } + -+ public boolean isChunkLoaded(int i, int j) { -+ return true; -+ } -+ -+ public void getChunkAt(IChunkProvider ichunkprovider, int i, int j) { ++ public void recreateStructures(int i, int j) { + BlockFalling.instaFall = true; + BlockPosition blockposition = new BlockPosition(i * 16, 0, j * 16); + ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i, j); + -+ this.B.a(this.h, this.j, chunkcoordintpair); ++ this.H.a(this.n, this.p, chunkcoordintpair); + + int k; + + for (k = 0; k < 8; ++k) { -+ this.y.generate(this.h, this.j, blockposition.a(this.j.nextInt(16) + 8, this.j.nextInt(120) + 4, this.j.nextInt(16) + 8)); ++ this.E.generate(this.n, this.p, blockposition.a(this.p.nextInt(16) + 8, this.p.nextInt(120) + 4, this.p.nextInt(16) + 8)); + } + -+ for (k = 0; k < this.j.nextInt(this.j.nextInt(10) + 1) + 1; ++k) { -+ this.t.generate(this.h, this.j, blockposition.a(this.j.nextInt(16) + 8, this.j.nextInt(120) + 4, this.j.nextInt(16) + 8)); ++ for (k = 0; k < this.p.nextInt(this.p.nextInt(10) + 1) + 1; ++k) { ++ this.z.generate(this.n, this.p, blockposition.a(this.p.nextInt(16) + 8, this.p.nextInt(120) + 4, this.p.nextInt(16) + 8)); + } + -+ for (k = 0; k < this.j.nextInt(this.j.nextInt(10) + 1); ++k) { -+ this.u.generate(this.h, this.j, blockposition.a(this.j.nextInt(16) + 8, this.j.nextInt(120) + 4, this.j.nextInt(16) + 8)); ++ for (k = 0; k < this.p.nextInt(this.p.nextInt(10) + 1); ++k) { ++ this.A.generate(this.n, this.p, blockposition.a(this.p.nextInt(16) + 8, this.p.nextInt(120) + 4, this.p.nextInt(16) + 8)); + } + + for (k = 0; k < 10; ++k) { -+ this.v.generate(this.h, this.j, blockposition.a(this.j.nextInt(16) + 8, this.j.nextInt(128), this.j.nextInt(16) + 8)); ++ this.B.generate(this.n, this.p, blockposition.a(this.p.nextInt(16) + 8, this.p.nextInt(128), this.p.nextInt(16) + 8)); + } + -+ if (this.j.nextBoolean()) { -+ this.z.generate(this.h, this.j, blockposition.a(this.j.nextInt(16) + 8, this.j.nextInt(128), this.j.nextInt(16) + 8)); ++ if (this.p.nextBoolean()) { ++ this.F.generate(this.n, this.p, blockposition.a(this.p.nextInt(16) + 8, this.p.nextInt(128), this.p.nextInt(16) + 8)); + } + -+ if (this.j.nextBoolean()) { -+ this.A.generate(this.h, this.j, blockposition.a(this.j.nextInt(16) + 8, this.j.nextInt(128), this.j.nextInt(16) + 8)); ++ if (this.p.nextBoolean()) { ++ this.G.generate(this.n, this.p, blockposition.a(this.p.nextInt(16) + 8, this.p.nextInt(128), this.p.nextInt(16) + 8)); + } + + for (k = 0; k < 16; ++k) { -+ this.w.generate(this.h, this.j, blockposition.a(this.j.nextInt(16), this.j.nextInt(108) + 10, this.j.nextInt(16))); ++ this.C.generate(this.n, this.p, blockposition.a(this.p.nextInt(16), this.p.nextInt(108) + 10, this.p.nextInt(16))); + } + + for (k = 0; k < 16; ++k) { -+ this.x.generate(this.h, this.j, blockposition.a(this.j.nextInt(16), this.j.nextInt(108) + 10, this.j.nextInt(16))); ++ this.D.generate(this.n, this.p, blockposition.a(this.p.nextInt(16), this.p.nextInt(108) + 10, this.p.nextInt(16))); + } + + BlockFalling.instaFall = false; + } + -+ public boolean a(IChunkProvider ichunkprovider, Chunk chunk, int i, int j) { ++ public boolean a(Chunk chunk, int i, int j) { + return false; + } + -+ public boolean saveChunks(boolean flag, IProgressUpdate iprogressupdate) { -+ return true; -+ } -+ -+ public void c() {} -+ -+ public boolean unloadChunks() { -+ return false; -+ } -+ -+ public boolean canSave() { -+ return true; -+ } -+ -+ public String getName() { -+ return "HellRandomLevelSource"; -+ } -+ + public List getMobsFor(EnumCreatureType enumcreaturetype, BlockPosition blockposition) { + if (enumcreaturetype == EnumCreatureType.MONSTER) { -+ if (this.B.b(blockposition)) { -+ return this.B.b(); ++ if (this.H.b(blockposition)) { ++ return this.H.b(); + } + -+ if (this.B.a(this.h, blockposition) && this.h.getType(blockposition.down()).getBlock() == Blocks.NETHER_BRICK) { -+ return this.B.b(); ++ if (this.H.b(this.n, blockposition) && this.n.getType(blockposition.down()).getBlock() == Blocks.NETHER_BRICK) { ++ return this.H.b(); + } + } + -+ BiomeBase biomebase = this.h.getBiome(blockposition); ++ BiomeBase biomebase = this.n.getBiome(blockposition); + + return biomebase.getMobs(enumcreaturetype); + } @@ -3001,175 +2546,204 @@ index 0000000..2f01bbf + return null; + } + -+ public int getLoadedChunks() { -+ return 0; -+ } -+ + public void recreateStructures(Chunk chunk, int i, int j) { -+ this.B.a(this, this.h, i, j, (ChunkSnapshot) null); -+ } -+ -+ public Chunk getChunkAt(BlockPosition blockposition) { -+ return this.getOrCreateChunk(blockposition.getX() >> 4, blockposition.getZ() >> 4); ++ this.H.a(this.n, i, j, (ChunkSnapshot) null); + } +} -diff --git a/src/main/java/net/minecraft/server/EntityMinecartFurnace.java b/src/main/java/net/minecraft/server/EntityMinecartFurnace.java +diff --git a/src/main/java/net/minecraft/server/EntitySquid.java b/src/main/java/net/minecraft/server/EntitySquid.java new file mode 100644 -index 0000000..55f04b4 +index 0000000..b94444d --- /dev/null -+++ b/src/main/java/net/minecraft/server/EntityMinecartFurnace.java -@@ -0,0 +1,145 @@ ++++ b/src/main/java/net/minecraft/server/EntitySquid.java +@@ -0,0 +1,182 @@ +package net.minecraft.server; + -+public class EntityMinecartFurnace extends EntityMinecartAbstract { ++public class EntitySquid extends EntityWaterAnimal { + -+ private int c; -+ public double a; -+ public double b; ++ public float a; ++ public float b; ++ public float c; ++ public float bt; ++ public float bu; ++ public float bv; ++ public float bw; ++ public float bx; ++ private float by; ++ private float bz; ++ private float bA; ++ private float bB; ++ private float bC; ++ private float bD; + -+ public EntityMinecartFurnace(World world) { ++ public EntitySquid(World world) { + super(world); ++ this.setSize(0.8F, 0.8F); ++ this.random.setSeed((long) (1 + this.getId())); ++ this.bz = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F; + } + -+ public EntityMinecartFurnace(World world, double d0, double d1, double d2) { -+ super(world, d0, d1, d2); ++ protected void r() { ++ this.goalSelector.a(0, new PathfinderGoalSquid(this)); + } + -+ public EnumMinecartType s() { -+ return EnumMinecartType.FURNACE; ++ protected void initAttributes() { ++ super.initAttributes(); ++ this.getAttributeInstance(GenericAttributes.maxHealth).setValue(10.0D); + } + -+ protected void h() { -+ super.h(); -+ this.datawatcher.a(16, new Byte((byte) 0)); ++ public float getHeadHeight() { ++ return this.length * 0.5F; + } + -+ public void t_() { -+ super.t_(); -+ if (this.c > 0) { -+ --this.c; -+ } -+ -+ if (this.c <= 0) { -+ this.a = this.b = 0.0D; -+ } -+ -+ this.i(this.c > 0); -+ if (this.j() && this.random.nextInt(4) == 0) { -+ this.world.addParticle(EnumParticle.SMOKE_LARGE, this.locX, this.locY + 0.8D, this.locZ, 0.0D, 0.0D, 0.0D, new int[0]); -+ } -+ ++ protected SoundEffect G() { ++ return SoundEffects.fW; + } + -+ protected double m() { -+ return 0.2D; ++ protected SoundEffect bR() { ++ return SoundEffects.fY; + } + -+ public void a(DamageSource damagesource) { -+ super.a(damagesource); -+ if (!damagesource.isExplosion() && this.world.getGameRules().getBoolean("doEntityDrops")) { -+ this.a(new ItemStack(Blocks.FURNACE, 1), 0.0F); -+ } -+ ++ protected SoundEffect bS() { ++ return SoundEffects.fX; + } + -+ protected void a(BlockPosition blockposition, IBlockData iblockdata) { -+ super.a(blockposition, iblockdata); -+ double d0 = this.a * this.a + this.b * this.b; ++ protected float cd() { ++ return 0.4F; ++ } + -+ if (d0 > 1.0E-4D && this.motX * this.motX + this.motZ * this.motZ > 0.001D) { -+ d0 = (double) MathHelper.sqrt(d0); -+ this.a /= d0; -+ this.b /= d0; -+ if (this.a * this.motX + this.b * this.motZ < 0.0D) { -+ this.a = 0.0D; -+ this.b = 0.0D; ++ protected boolean playStepSound() { ++ return false; ++ } ++ ++ protected MinecraftKey J() { ++ return LootTables.af; ++ } ++ ++ public boolean isInWater() { ++ return super.isInWater(); ++ } ++ ++ public void n() { ++ super.n(); ++ this.b = this.a; ++ this.bt = this.c; ++ this.bv = this.bu; ++ this.bx = this.bw; ++ this.bu += this.bz; ++ if ((double) this.bu > 6.283185307179586D) { ++ if (this.world.isClientSide) { ++ this.bu = 6.2831855F; + } else { -+ double d1 = d0 / this.m(); ++ this.bu = (float) ((double) this.bu - 6.283185307179586D); ++ if (this.random.nextInt(10) == 0) { ++ this.bz = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F; ++ } + -+ this.a *= d1; -+ this.b *= d1; ++ this.world.broadcastEntityEffect(this, (byte) 19); + } + } + -+ } ++ if (this.inWater) { ++ float f; + -+ protected void o() { -+ double d0 = this.a * this.a + this.b * this.b; -+ -+ if (d0 > 1.0E-4D) { -+ d0 = (double) MathHelper.sqrt(d0); -+ this.a /= d0; -+ this.b /= d0; -+ double d1 = 1.0D; -+ -+ this.motX *= 0.800000011920929D; -+ this.motY *= 0.0D; -+ this.motZ *= 0.800000011920929D; -+ this.motX += this.a * d1; -+ this.motZ += this.b * d1; -+ } else { -+ this.motX *= 0.9800000190734863D; -+ this.motY *= 0.0D; -+ this.motZ *= 0.9800000190734863D; -+ } -+ -+ super.o(); -+ } -+ -+ public boolean e(EntityHuman entityhuman) { -+ ItemStack itemstack = entityhuman.inventory.getItemInHand(); -+ -+ if (itemstack != null && itemstack.getItem() == Items.COAL) { -+ if (!entityhuman.abilities.canInstantlyBuild && --itemstack.count == 0) { -+ entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null); ++ if (this.bu < 3.1415927F) { ++ f = this.bu / 3.1415927F; ++ this.bw = MathHelper.sin(f * f * 3.1415927F) * 3.1415927F * 0.25F; ++ if ((double) f > 0.75D) { ++ this.by = 1.0F; ++ this.bA = 1.0F; ++ } else { ++ this.bA *= 0.8F; ++ } ++ } else { ++ this.bw = 0.0F; ++ this.by *= 0.9F; ++ this.bA *= 0.99F; + } + -+ this.c += 3600; -+ } ++ if (!this.world.isClientSide) { ++ this.motX = (double) (this.bB * this.by); ++ this.motY = (double) (this.bC * this.by); ++ this.motZ = (double) (this.bD * this.by); ++ } + -+ this.a = this.locX - entityhuman.locX; -+ this.b = this.locZ - entityhuman.locZ; -+ return true; -+ } -+ -+ protected void b(NBTTagCompound nbttagcompound) { -+ super.b(nbttagcompound); -+ nbttagcompound.setDouble("PushX", this.a); -+ nbttagcompound.setDouble("PushZ", this.b); -+ nbttagcompound.setShort("Fuel", (short) this.c); -+ } -+ -+ protected void a(NBTTagCompound nbttagcompound) { -+ super.a(nbttagcompound); -+ this.a = nbttagcompound.getDouble("PushX"); -+ this.b = nbttagcompound.getDouble("PushZ"); -+ this.c = nbttagcompound.getShort("Fuel"); -+ } -+ -+ protected boolean j() { -+ return (this.datawatcher.getByte(16) & 1) != 0; -+ } -+ -+ protected void i(boolean flag) { -+ if (flag) { -+ this.datawatcher.watch(16, Byte.valueOf((byte) (this.datawatcher.getByte(16) | 1))); ++ f = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ); ++ this.aM += (-((float) MathHelper.b(this.motX, this.motZ)) * 57.295776F - this.aM) * 0.1F; ++ this.yaw = this.aM; ++ this.c = (float) ((double) this.c + 3.141592653589793D * (double) this.bA * 1.5D); ++ this.a += (-((float) MathHelper.b((double) f, this.motY)) * 57.295776F - this.a) * 0.1F; + } else { -+ this.datawatcher.watch(16, Byte.valueOf((byte) (this.datawatcher.getByte(16) & -2))); ++ this.bw = MathHelper.e(MathHelper.sin(this.bu)) * 3.1415927F * 0.25F; ++ if (!this.world.isClientSide) { ++ this.motX = 0.0D; ++ this.motZ = 0.0D; ++ if (this.hasEffect(MobEffects.LEVITATION)) { ++ this.motY += 0.05D * (double) (this.getEffect(MobEffects.LEVITATION).getAmplifier() + 1) - this.motY; ++ } else { ++ this.motY -= 0.08D; ++ } ++ ++ this.motY *= 0.9800000190734863D; ++ } ++ ++ this.a = (float) ((double) this.a + (double) (-90.0F - this.a) * 0.02D); + } + + } + -+ public IBlockData u() { -+ return (this.j() ? Blocks.LIT_FURNACE : Blocks.FURNACE).getBlockData().set(BlockFurnace.FACING, EnumDirection.NORTH); ++ public void g(float f, float f1) { ++ this.move(this.motX, this.motY, this.motZ); ++ } ++ ++ public boolean cF() { ++ return this.locY > 45.0D && this.locY < (double) this.world.K() && super.cF(); ++ } ++ ++ public void b(float f, float f1, float f2) { ++ this.bB = f; ++ this.bC = f1; ++ this.bD = f2; ++ } ++ ++ public boolean o() { ++ return this.bB != 0.0F || this.bC != 0.0F || this.bD != 0.0F; ++ } ++ ++ static class PathfinderGoalSquid extends PathfinderGoal { ++ ++ private EntitySquid a; ++ ++ public PathfinderGoalSquid(EntitySquid entitysquid) { ++ this.a = entitysquid; ++ } ++ ++ public boolean a() { ++ return true; ++ } ++ ++ public void e() { ++ int i = this.a.bK(); ++ ++ if (i > 100) { ++ this.a.b(0.0F, 0.0F, 0.0F); ++ } else if (this.a.getRandom().nextInt(50) == 0 || !this.a.inWater || !this.a.o()) { ++ float f = this.a.getRandom().nextFloat() * 6.2831855F; ++ float f1 = MathHelper.cos(f) * 0.2F; ++ float f2 = -0.1F + this.a.getRandom().nextFloat() * 0.2F; ++ float f3 = MathHelper.sin(f) * 0.2F; ++ ++ this.a.b(f1, f2, f3); ++ } ++ ++ } + } +} diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java new file mode 100644 -index 0000000..57b3d9d +index 0000000..300573a --- /dev/null +++ b/src/main/java/net/minecraft/server/ItemBlock.java -@@ -0,0 +1,100 @@ +@@ -0,0 +1,98 @@ +package net.minecraft.server; + +public class ItemBlock extends Item { @@ -3185,41 +2759,39 @@ index 0000000..57b3d9d + return this; + } + -+ public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, BlockPosition blockposition, EnumDirection enumdirection, float f, float f1, float f2) { ++ public EnumInteractionResult a(ItemStack itemstack, EntityHuman entityhuman, World world, BlockPosition blockposition, EnumHand enumhand, EnumDirection enumdirection, float f, float f1, float f2) { + IBlockData iblockdata = world.getType(blockposition); + Block block = iblockdata.getBlock(); + -+ if (!block.a(world, blockposition)) { ++ if (!block.a((IBlockAccess) world, blockposition)) { + blockposition = blockposition.shift(enumdirection); + } + -+ if (itemstack.count == 0) { -+ return false; -+ } else if (!entityhuman.a(blockposition, enumdirection, itemstack)) { -+ return false; -+ } else if (world.a(this.a, blockposition, false, enumdirection, (Entity) null, itemstack)) { ++ if (itemstack.count != 0 && entityhuman.a(blockposition, enumdirection, itemstack) && world.a(this.a, blockposition, false, enumdirection, (Entity) null, itemstack)) { + int i = this.filterData(itemstack.getData()); + IBlockData iblockdata1 = this.a.getPlacedState(world, blockposition, enumdirection, f, f1, f2, i, entityhuman); + -+ if (world.setTypeAndData(blockposition, iblockdata1, 3)) { ++ if (world.setTypeAndData(blockposition, iblockdata1, 11)) { + iblockdata1 = world.getType(blockposition); + if (iblockdata1.getBlock() == this.a) { + a(world, entityhuman, blockposition, itemstack); + this.a.postPlace(world, blockposition, iblockdata1, entityhuman, itemstack); + } + -+ world.makeSound((double) ((float) blockposition.getX() + 0.5F), (double) ((float) blockposition.getY() + 0.5F), (double) ((float) blockposition.getZ() + 0.5F), this.a.stepSound.getPlaceSound(), (this.a.stepSound.getVolume1() + 1.0F) / 2.0F, this.a.stepSound.getVolume2() * 0.8F); ++ SoundEffectType soundeffecttype = this.a.w(); ++ ++ world.a(entityhuman, blockposition, soundeffecttype.e(), SoundCategory.BLOCKS, (soundeffecttype.a() + 1.0F) / 2.0F, soundeffecttype.b() * 0.8F); + --itemstack.count; + } + -+ return true; ++ return EnumInteractionResult.SUCCESS; + } else { -+ return false; ++ return EnumInteractionResult.FAIL; + } + } + + public static boolean a(World world, EntityHuman entityhuman, BlockPosition blockposition, ItemStack itemstack) { -+ MinecraftServer minecraftserver = MinecraftServer.getServer(); ++ MinecraftServer minecraftserver = world.getMinecraftServer(); + + if (minecraftserver == null) { + return false; @@ -3228,14 +2800,14 @@ index 0000000..57b3d9d + TileEntity tileentity = world.getTileEntity(blockposition); + + if (tileentity != null) { -+ if (!world.isClientSide && tileentity.F() && !minecraftserver.getPlayerList().isOp(entityhuman.getProfile())) { ++ if (!world.isClientSide && tileentity.isFilteredNBT() && (entityhuman == null || !minecraftserver.getPlayerList().isOp(entityhuman.getProfile()))) { + return false; + } + + NBTTagCompound nbttagcompound = new NBTTagCompound(); + NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttagcompound.clone(); + -+ tileentity.b(nbttagcompound); ++ tileentity.save(nbttagcompound); + NBTTagCompound nbttagcompound2 = (NBTTagCompound) itemstack.getTag().get("BlockEntityTag"); + + nbttagcompound.a(nbttagcompound2); @@ -3254,7 +2826,7 @@ index 0000000..57b3d9d + } + } + -+ public String e_(ItemStack itemstack) { ++ public String f_(ItemStack itemstack) { + return this.a.a(); + } + @@ -3270,104 +2842,75 @@ index 0000000..57b3d9d + return this.b(s); + } +} -diff --git a/src/main/java/net/minecraft/server/ItemMilkBucket.java b/src/main/java/net/minecraft/server/ItemMilkBucket.java -new file mode 100644 -index 0000000..91ea70d ---- /dev/null -+++ b/src/main/java/net/minecraft/server/ItemMilkBucket.java -@@ -0,0 +1,35 @@ -+package net.minecraft.server; -+ -+public class ItemMilkBucket extends Item { -+ -+ public ItemMilkBucket() { -+ this.c(1); -+ this.a(CreativeModeTab.f); -+ } -+ -+ public ItemStack b(ItemStack itemstack, World world, EntityHuman entityhuman) { -+ if (!entityhuman.abilities.canInstantlyBuild) { -+ --itemstack.count; -+ } -+ -+ if (!world.isClientSide) { -+ entityhuman.removeAllEffects(); -+ } -+ -+ entityhuman.b(StatisticList.USE_ITEM_COUNT[Item.getId(this)]); -+ return itemstack.count <= 0 ? new ItemStack(Items.BUCKET) : itemstack; -+ } -+ -+ public int d(ItemStack itemstack) { -+ return 32; -+ } -+ -+ public EnumAnimation e(ItemStack itemstack) { -+ return EnumAnimation.DRINK; -+ } -+ -+ public ItemStack a(ItemStack itemstack, World world, EntityHuman entityhuman) { -+ entityhuman.a(itemstack, this.d(itemstack)); -+ return itemstack; -+ } -+} -diff --git a/src/main/java/net/minecraft/server/MobEffectAttackDamage.java b/src/main/java/net/minecraft/server/MobEffectAttackDamage.java -new file mode 100644 -index 0000000..620685a ---- /dev/null -+++ b/src/main/java/net/minecraft/server/MobEffectAttackDamage.java -@@ -0,0 +1,12 @@ -+package net.minecraft.server; -+ -+public class MobEffectAttackDamage extends MobEffectList { -+ -+ protected MobEffectAttackDamage(int i, MinecraftKey minecraftkey, boolean flag, int j) { -+ super(i, minecraftkey, flag, j); -+ } -+ -+ public double a(int i, AttributeModifier attributemodifier) { -+ return this.id == MobEffectList.WEAKNESS.id ? (double) (-0.5F * (float) (i + 1)) : 1.3D * (double) (i + 1); -+ } -+} diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java new file mode 100644 -index 0000000..d5eaa24 +index 0000000..2f4265a --- /dev/null +++ b/src/main/java/net/minecraft/server/NavigationAbstract.java -@@ -0,0 +1,222 @@ +@@ -0,0 +1,275 @@ +package net.minecraft.server; + -+import java.util.Iterator; -+import java.util.List; -+ +public abstract class NavigationAbstract { + -+ protected EntityInsentient b; -+ protected World c; -+ protected PathEntity d; -+ protected double e; -+ private final AttributeInstance a; -+ private int f; -+ private int g; -+ private Vec3D h = new Vec3D(0.0D, 0.0D, 0.0D); -+ private float i = 1.0F; -+ private final Pathfinder j; ++ private static int f = 20; ++ protected EntityInsentient a; ++ protected World b; ++ protected PathEntity c; ++ protected double d; ++ private final AttributeInstance g; ++ private int h; ++ private int i; ++ private Vec3D j; ++ private Vec3D k; ++ private long l; ++ private long m; ++ private double n; ++ private float o; ++ private boolean p; ++ private long q; ++ protected PathfinderAbstract e; ++ private BlockPosition r; ++ private final Pathfinder s; + + public NavigationAbstract(EntityInsentient entityinsentient, World world) { -+ this.b = entityinsentient; -+ this.c = world; -+ this.a = entityinsentient.getAttributeInstance(GenericAttributes.FOLLOW_RANGE); -+ this.j = this.a(); ++ this.j = Vec3D.a; ++ this.k = Vec3D.a; ++ this.l = 0L; ++ this.m = 0L; ++ this.o = 0.5F; ++ this.a = entityinsentient; ++ this.b = world; ++ this.g = entityinsentient.getAttributeInstance(GenericAttributes.FOLLOW_RANGE); ++ this.s = this.a(); ++ this.b.C().a(this); + } + + protected abstract Pathfinder a(); + + public void a(double d0) { -+ this.e = d0; ++ this.d = d0; + } + -+ public float i() { -+ return (float) this.a.getValue(); ++ public float h() { ++ return (float) this.g.getValue(); ++ } ++ ++ public boolean i() { ++ return this.p; ++ } ++ ++ public void j() { ++ if (this.b.getTime() - this.q > (long) NavigationAbstract.f) { ++ if (this.r != null) { ++ this.c = null; ++ this.c = this.a(this.r); ++ this.q = this.b.getTime(); ++ this.p = false; ++ } ++ } else { ++ this.p = true; ++ } ++ + } + + public final PathEntity a(double d0, double d1, double d2) { @@ -3377,47 +2920,53 @@ index 0000000..d5eaa24 + public PathEntity a(BlockPosition blockposition) { + if (!this.b()) { + return null; ++ } else if (this.c != null && !this.c.b() && blockposition.equals(this.r)) { ++ return this.c; + } else { -+ float f = this.i(); ++ this.r = blockposition; ++ float f = this.h(); + -+ this.c.methodProfiler.a("pathfind"); -+ BlockPosition blockposition1 = new BlockPosition(this.b); ++ this.b.methodProfiler.a("pathfind"); ++ BlockPosition blockposition1 = new BlockPosition(this.a); + int i = (int) (f + 8.0F); -+ ChunkCache chunkcache = new ChunkCache(this.c, blockposition1.a(-i, -i, -i), blockposition1.a(i, i, i), 0); -+ PathEntity pathentity = this.j.a((IBlockAccess) chunkcache, (Entity) this.b, blockposition, f); ++ ChunkCache chunkcache = new ChunkCache(this.b, blockposition1.a(-i, -i, -i), blockposition1.a(i, i, i), 0); ++ PathEntity pathentity = this.s.a(chunkcache, this.a, this.r, f); + -+ this.c.methodProfiler.b(); ++ this.b.methodProfiler.b(); + return pathentity; + } + } + ++ public PathEntity a(Entity entity) { ++ if (!this.b()) { ++ return null; ++ } else { ++ BlockPosition blockposition = new BlockPosition(entity); ++ ++ if (this.c != null && !this.c.b() && blockposition.equals(this.r)) { ++ return this.c; ++ } else { ++ this.r = blockposition; ++ float f = this.h(); ++ ++ this.b.methodProfiler.a("pathfind"); ++ BlockPosition blockposition1 = (new BlockPosition(this.a)).up(); ++ int i = (int) (f + 16.0F); ++ ChunkCache chunkcache = new ChunkCache(this.b, blockposition1.a(-i, -i, -i), blockposition1.a(i, i, i), 0); ++ PathEntity pathentity = this.s.a(chunkcache, this.a, entity, f); ++ ++ this.b.methodProfiler.b(); ++ return pathentity; ++ } ++ } ++ } ++ + public boolean a(double d0, double d1, double d2, double d3) { + PathEntity pathentity = this.a((double) MathHelper.floor(d0), (double) ((int) d1), (double) MathHelper.floor(d2)); + + return this.a(pathentity, d3); + } + -+ public void a(float f) { -+ this.i = f; -+ } -+ -+ public PathEntity a(Entity entity) { -+ if (!this.b()) { -+ return null; -+ } else { -+ float f = this.i(); -+ -+ this.c.methodProfiler.a("pathfind"); -+ BlockPosition blockposition = (new BlockPosition(this.b)).up(); -+ int i = (int) (f + 16.0F); -+ ChunkCache chunkcache = new ChunkCache(this.c, blockposition.a(-i, -i, -i), blockposition.a(i, i, i), 0); -+ PathEntity pathentity = this.j.a((IBlockAccess) chunkcache, (Entity) this.b, entity, f); -+ -+ this.c.methodProfiler.b(); -+ return pathentity; -+ } -+ } -+ + public boolean a(Entity entity, double d0) { + PathEntity pathentity = this.a(entity); + @@ -3426,98 +2975,89 @@ index 0000000..d5eaa24 + + public boolean a(PathEntity pathentity, double d0) { + if (pathentity == null) { -+ this.d = null; ++ this.c = null; + return false; + } else { -+ if (!pathentity.a(this.d)) { -+ this.d = pathentity; ++ if (!pathentity.a(this.c)) { ++ this.c = pathentity; + } + + this.d(); -+ if (this.d.d() == 0) { ++ if (this.c.d() == 0) { + return false; + } else { -+ this.e = d0; ++ this.d = d0; + Vec3D vec3d = this.c(); + -+ this.g = this.f; -+ this.h = vec3d; ++ this.i = this.h; ++ this.j = vec3d; + return true; + } + } + } + -+ public PathEntity j() { -+ return this.d; ++ public PathEntity k() { ++ return this.c; + } + -+ public void k() { -+ ++this.f; -+ if (!this.m()) { ++ public void l() { ++ ++this.h; ++ if (this.p) { ++ this.j(); ++ } ++ ++ if (!this.n()) { + Vec3D vec3d; + + if (this.b()) { -+ this.l(); -+ } else if (this.d != null && this.d.e() < this.d.d()) { ++ this.m(); ++ } else if (this.c != null && this.c.e() < this.c.d()) { + vec3d = this.c(); -+ Vec3D vec3d1 = this.d.a(this.b, this.d.e()); ++ Vec3D vec3d1 = this.c.a(this.a, this.c.e()); + -+ if (vec3d.b > vec3d1.b && !this.b.onGround && MathHelper.floor(vec3d.a) == MathHelper.floor(vec3d1.a) && MathHelper.floor(vec3d.c) == MathHelper.floor(vec3d1.c)) { -+ this.d.c(this.d.e() + 1); ++ if (vec3d.y > vec3d1.y && !this.a.onGround && MathHelper.floor(vec3d.x) == MathHelper.floor(vec3d1.x) && MathHelper.floor(vec3d.z) == MathHelper.floor(vec3d1.z)) { ++ this.c.c(this.c.e() + 1); + } + } + -+ if (!this.m()) { -+ vec3d = this.d.a((Entity) this.b); ++ if (!this.n()) { ++ vec3d = this.c.a((Entity) this.a); + if (vec3d != null) { -+ AxisAlignedBB axisalignedbb = (new AxisAlignedBB(vec3d.a, vec3d.b, vec3d.c, vec3d.a, vec3d.b, vec3d.c)).grow(0.5D, 0.5D, 0.5D); -+ List list = this.c.getCubes(this.b, axisalignedbb.a(0.0D, -1.0D, 0.0D)); -+ double d0 = -1.0D; ++ BlockPosition blockposition = (new BlockPosition(vec3d)).down(); ++ AxisAlignedBB axisalignedbb = this.b.getType(blockposition).c(this.b, blockposition); + -+ axisalignedbb = axisalignedbb.c(0.0D, 1.0D, 0.0D); -+ -+ AxisAlignedBB axisalignedbb1; -+ -+ for (Iterator iterator = list.iterator(); iterator.hasNext(); d0 = axisalignedbb1.b(axisalignedbb, d0)) { -+ axisalignedbb1 = (AxisAlignedBB) iterator.next(); -+ } -+ -+ this.b.getControllerMove().a(vec3d.a, vec3d.b + d0, vec3d.c, this.e); ++ vec3d = vec3d.a(0.0D, 1.0D - axisalignedbb.e, 0.0D); ++ this.a.getControllerMove().a(vec3d.x, vec3d.y, vec3d.z, this.d); + } + } + } + } + -+ protected void l() { ++ protected void m() { + Vec3D vec3d = this.c(); -+ int i = this.d.d(); ++ int i = this.c.d(); + -+ for (int j = this.d.e(); j < this.d.d(); ++j) { -+ if (this.d.a(j).b != (int) vec3d.b) { ++ for (int j = this.c.e(); j < this.c.d(); ++j) { ++ if ((double) this.c.a(j).b != Math.floor(vec3d.y)) { + i = j; + break; + } + } + -+ float f = this.b.width * this.b.width * this.i; ++ this.o = this.a.width > 0.75F ? this.a.width / 2.0F : 0.75F - this.a.width / 2.0F; ++ Vec3D vec3d1 = this.c.f(); + -+ int k; -+ -+ for (k = this.d.e(); k < i; ++k) { -+ Vec3D vec3d1 = this.d.a(this.b, k); -+ -+ if (vec3d.distanceSquared(vec3d1) < (double) f) { -+ this.d.c(k + 1); -+ } ++ if (MathHelper.e((float) (this.a.locX - (vec3d1.x + 0.5D))) < this.o && MathHelper.e((float) (this.a.locZ - (vec3d1.z + 0.5D))) < this.o) { ++ this.c.c(this.c.e() + 1); + } + -+ k = MathHelper.f(this.b.width); -+ int l = (int) this.b.length + 1; ++ int k = MathHelper.f(this.a.width); ++ int l = (int) this.a.length + 1; + int i1 = k; + -+ for (int j1 = i - 1; j1 >= this.d.e(); --j1) { -+ if (this.a(vec3d, this.d.a(this.b, j1), k, l, i1)) { -+ this.d.c(j1); ++ for (int j1 = i - 1; j1 >= this.c.e(); --j1) { ++ if (this.a(vec3d, this.c.a(this.a, j1), k, l, i1)) { ++ this.c.c(j1); + break; + } + } @@ -3526,188 +3066,66 @@ index 0000000..d5eaa24 + } + + protected void a(Vec3D vec3d) { -+ if (this.f - this.g > 100) { -+ if (vec3d.distanceSquared(this.h) < 2.25D) { -+ this.n(); ++ if (this.h - this.i > 100) { ++ if (vec3d.distanceSquared(this.j) < 2.25D) { ++ this.o(); + } + -+ this.g = this.f; -+ this.h = vec3d; ++ this.i = this.h; ++ this.j = vec3d; ++ } ++ ++ if (this.c != null && !this.c.b()) { ++ Vec3D vec3d1 = this.c.f(); ++ ++ if (!vec3d1.equals(this.k)) { ++ this.k = vec3d1; ++ double d0 = vec3d.f(this.k); ++ ++ this.n = this.a.ck() > 0.0F ? d0 / (double) this.a.ck() * 1000.0D : 0.0D; ++ } else { ++ this.l += System.currentTimeMillis() - this.m; ++ } ++ ++ if (this.n > 0.0D && (double) this.l > this.n * 3.0D) { ++ this.k = Vec3D.a; ++ this.l = 0L; ++ this.n = 0.0D; ++ this.o(); ++ } ++ ++ this.m = System.currentTimeMillis(); + } + + } + -+ public boolean m() { -+ return this.d == null || this.d.b(); ++ public boolean n() { ++ return this.c == null || this.c.b(); + } + -+ public void n() { -+ this.d = null; ++ public void o() { ++ this.c = null; + } + + protected abstract Vec3D c(); + + protected abstract boolean b(); + -+ protected boolean o() { -+ return this.b.V() || this.b.ab(); ++ protected boolean p() { ++ return this.a.isInWater() || this.a.an(); + } + + protected void d() {} + + protected abstract boolean a(Vec3D vec3d, Vec3D vec3d1, int i, int j, int k); -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutPlayerListHeaderFooter.java b/src/main/java/net/minecraft/server/PacketPlayOutPlayerListHeaderFooter.java -new file mode 100644 -index 0000000..1606d6d ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutPlayerListHeaderFooter.java -@@ -0,0 +1,33 @@ -+package net.minecraft.server; + -+import java.io.IOException; -+ -+public class PacketPlayOutPlayerListHeaderFooter implements Packet { -+ -+ private IChatBaseComponent a; -+ private IChatBaseComponent b; -+ -+ public PacketPlayOutPlayerListHeaderFooter() {} -+ -+ public PacketPlayOutPlayerListHeaderFooter(IChatBaseComponent ichatbasecomponent) { -+ this.a = ichatbasecomponent; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) throws IOException { -+ this.a = packetdataserializer.d(); -+ this.b = packetdataserializer.d(); -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) throws IOException { -+ packetdataserializer.a(this.a); -+ packetdataserializer.a(this.b); -+ } -+ -+ public void a(PacketListenerPlayOut packetlistenerplayout) { -+ packetlistenerplayout.a(this); -+ } -+ -+ public void a(PacketListener packetlistener) { -+ this.a((PacketListenerPlayOut) packetlistener); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutTitle.java b/src/main/java/net/minecraft/server/PacketPlayOutTitle.java -new file mode 100644 -index 0000000..2711298 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutTitle.java -@@ -0,0 +1,103 @@ -+package net.minecraft.server; -+ -+import java.io.IOException; -+ -+public class PacketPlayOutTitle implements Packet { -+ -+ private EnumTitleAction a; -+ private IChatBaseComponent b; -+ private int c; -+ private int d; -+ private int e; -+ -+ public PacketPlayOutTitle() {} -+ -+ public PacketPlayOutTitle(EnumTitleAction packetplayouttitle_enumtitleaction, IChatBaseComponent ichatbasecomponent) { -+ this(packetplayouttitle_enumtitleaction, ichatbasecomponent, -1, -1, -1); -+ } -+ -+ public PacketPlayOutTitle(int i, int j, int k) { -+ this(EnumTitleAction.TIMES, (IChatBaseComponent) null, i, j, k); -+ } -+ -+ public PacketPlayOutTitle(EnumTitleAction packetplayouttitle_enumtitleaction, IChatBaseComponent ichatbasecomponent, int i, int j, int k) { -+ this.a = packetplayouttitle_enumtitleaction; -+ this.b = ichatbasecomponent; -+ this.c = i; -+ this.d = j; -+ this.e = k; -+ } -+ -+ public void a(PacketDataSerializer packetdataserializer) throws IOException { -+ this.a = (EnumTitleAction) packetdataserializer.a(EnumTitleAction.class); -+ if (this.a == EnumTitleAction.TITLE || this.a == EnumTitleAction.SUBTITLE) { -+ this.b = packetdataserializer.d(); -+ } -+ -+ if (this.a == EnumTitleAction.TIMES) { -+ this.c = packetdataserializer.readInt(); -+ this.d = packetdataserializer.readInt(); -+ this.e = packetdataserializer.readInt(); -+ } -+ -+ } -+ -+ public void b(PacketDataSerializer packetdataserializer) throws IOException { -+ packetdataserializer.a((Enum) this.a); -+ if (this.a == EnumTitleAction.TITLE || this.a == EnumTitleAction.SUBTITLE) { -+ packetdataserializer.a(this.b); -+ } -+ -+ if (this.a == EnumTitleAction.TIMES) { -+ packetdataserializer.writeInt(this.c); -+ packetdataserializer.writeInt(this.d); -+ packetdataserializer.writeInt(this.e); -+ } -+ -+ } -+ -+ public void a(PacketListenerPlayOut packetlistenerplayout) { -+ packetlistenerplayout.a(this); -+ } -+ -+ public void a(PacketListener packetlistener) { -+ this.a((PacketListenerPlayOut) packetlistener); -+ } -+ -+ public static enum EnumTitleAction { -+ -+ TITLE, SUBTITLE, TIMES, CLEAR, RESET; -+ -+ private EnumTitleAction() {} -+ -+ public static EnumTitleAction a(String s) { -+ EnumTitleAction[] apacketplayouttitle_enumtitleaction = values(); -+ int i = apacketplayouttitle_enumtitleaction.length; -+ -+ for (int j = 0; j < i; ++j) { -+ EnumTitleAction packetplayouttitle_enumtitleaction = apacketplayouttitle_enumtitleaction[j]; -+ -+ if (packetplayouttitle_enumtitleaction.name().equalsIgnoreCase(s)) { -+ return packetplayouttitle_enumtitleaction; -+ } -+ } -+ -+ return EnumTitleAction.TITLE; -+ } -+ -+ public static String[] a() { -+ String[] astring = new String[values().length]; -+ int i = 0; -+ EnumTitleAction[] apacketplayouttitle_enumtitleaction = values(); -+ int j = apacketplayouttitle_enumtitleaction.length; -+ -+ for (int k = 0; k < j; ++k) { -+ EnumTitleAction packetplayouttitle_enumtitleaction = apacketplayouttitle_enumtitleaction[k]; -+ -+ astring[i++] = packetplayouttitle_enumtitleaction.name().toLowerCase(); -+ } -+ -+ return astring; -+ } ++ public boolean b(BlockPosition blockposition) { ++ return this.b.getType(blockposition.down()).b(); + } +} diff --git a/src/main/java/net/minecraft/server/PathfinderGoalFloat.java b/src/main/java/net/minecraft/server/PathfinderGoalFloat.java new file mode 100644 -index 0000000..6014b09 +index 0000000..1a20dbf --- /dev/null +++ b/src/main/java/net/minecraft/server/PathfinderGoalFloat.java @@ -0,0 +1,23 @@ @@ -3720,254 +3138,29 @@ index 0000000..6014b09 + public PathfinderGoalFloat(EntityInsentient entityinsentient) { + this.a = entityinsentient; + this.a(4); -+ ((Navigation) entityinsentient.getNavigation()).d(true); ++ ((Navigation) entityinsentient.getNavigation()).c(true); + } + + public boolean a() { -+ return this.a.V() || this.a.ab(); ++ return this.a.isInWater() || this.a.an(); + } + + public void e() { -+ if (this.a.bc().nextFloat() < 0.8F) { ++ if (this.a.getRandom().nextFloat() < 0.8F) { + this.a.getControllerJump().a(); + } + + } +} -diff --git a/src/main/java/net/minecraft/server/PathfinderNormal.java b/src/main/java/net/minecraft/server/PathfinderNormal.java -new file mode 100644 -index 0000000..0a14c9d ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PathfinderNormal.java -@@ -0,0 +1,219 @@ -+package net.minecraft.server; -+ -+public class PathfinderNormal extends PathfinderAbstract { -+ -+ private boolean f; -+ private boolean g; -+ private boolean h; -+ private boolean i; -+ private boolean j; -+ -+ public PathfinderNormal() {} -+ -+ public void a(IBlockAccess iblockaccess, Entity entity) { -+ super.a(iblockaccess, entity); -+ this.j = this.h; -+ } -+ -+ public void a() { -+ super.a(); -+ this.h = this.j; -+ } -+ -+ public PathPoint a(Entity entity) { -+ int i; -+ -+ if (this.i && entity.V()) { -+ i = (int) entity.getBoundingBox().b; -+ BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition(MathHelper.floor(entity.locX), i, MathHelper.floor(entity.locZ)); -+ -+ for (Block block = this.a.getType(blockposition_mutableblockposition).getBlock(); block == Blocks.FLOWING_WATER || block == Blocks.WATER; block = this.a.getType(blockposition_mutableblockposition).getBlock()) { -+ ++i; -+ blockposition_mutableblockposition.c(MathHelper.floor(entity.locX), i, MathHelper.floor(entity.locZ)); -+ } -+ -+ this.h = false; -+ } else { -+ i = MathHelper.floor(entity.getBoundingBox().b + 0.5D); -+ } -+ -+ return this.a(MathHelper.floor(entity.getBoundingBox().a), i, MathHelper.floor(entity.getBoundingBox().c)); -+ } -+ -+ public PathPoint a(Entity entity, double d0, double d1, double d2) { -+ return this.a(MathHelper.floor(d0 - (double) (entity.width / 2.0F)), MathHelper.floor(d1), MathHelper.floor(d2 - (double) (entity.width / 2.0F))); -+ } -+ -+ public int a(PathPoint[] apathpoint, Entity entity, PathPoint pathpoint, PathPoint pathpoint1, float f) { -+ int i = 0; -+ byte b0 = 0; -+ -+ if (this.a(entity, pathpoint.a, pathpoint.b + 1, pathpoint.c) == 1) { -+ b0 = 1; -+ } -+ -+ PathPoint pathpoint2 = this.a(entity, pathpoint.a, pathpoint.b, pathpoint.c + 1, b0); -+ PathPoint pathpoint3 = this.a(entity, pathpoint.a - 1, pathpoint.b, pathpoint.c, b0); -+ PathPoint pathpoint4 = this.a(entity, pathpoint.a + 1, pathpoint.b, pathpoint.c, b0); -+ PathPoint pathpoint5 = this.a(entity, pathpoint.a, pathpoint.b, pathpoint.c - 1, b0); -+ -+ if (pathpoint2 != null && !pathpoint2.i && pathpoint2.a(pathpoint1) < f) { -+ apathpoint[i++] = pathpoint2; -+ } -+ -+ if (pathpoint3 != null && !pathpoint3.i && pathpoint3.a(pathpoint1) < f) { -+ apathpoint[i++] = pathpoint3; -+ } -+ -+ if (pathpoint4 != null && !pathpoint4.i && pathpoint4.a(pathpoint1) < f) { -+ apathpoint[i++] = pathpoint4; -+ } -+ -+ if (pathpoint5 != null && !pathpoint5.i && pathpoint5.a(pathpoint1) < f) { -+ apathpoint[i++] = pathpoint5; -+ } -+ -+ return i; -+ } -+ -+ private PathPoint a(Entity entity, int i, int j, int k, int l) { -+ PathPoint pathpoint = null; -+ int i1 = this.a(entity, i, j, k); -+ -+ if (i1 == 2) { -+ return this.a(i, j, k); -+ } else { -+ if (i1 == 1) { -+ pathpoint = this.a(i, j, k); -+ } -+ -+ if (pathpoint == null && l > 0 && i1 != -3 && i1 != -4 && this.a(entity, i, j + l, k) == 1) { -+ pathpoint = this.a(i, j + l, k); -+ j += l; -+ } -+ -+ if (pathpoint != null) { -+ int j1 = 0; -+ -+ int k1; -+ -+ for (k1 = 0; j > 0; pathpoint = this.a(i, j, k)) { -+ k1 = this.a(entity, i, j - 1, k); -+ if (this.h && k1 == -1) { -+ return null; -+ } -+ -+ if (k1 != 1) { -+ break; -+ } -+ -+ if (j1++ >= entity.aE()) { -+ return null; -+ } -+ -+ --j; -+ if (j <= 0) { -+ return null; -+ } -+ } -+ -+ if (k1 == -2) { -+ return null; -+ } -+ } -+ -+ return pathpoint; -+ } -+ } -+ -+ private int a(Entity entity, int i, int j, int k) { -+ return a(this.a, entity, i, j, k, this.c, this.d, this.e, this.h, this.g, this.f); -+ } -+ -+ public static int a(IBlockAccess iblockaccess, Entity entity, int i, int j, int k, int l, int i1, int j1, boolean flag, boolean flag1, boolean flag2) { -+ boolean flag3 = false; -+ BlockPosition blockposition = new BlockPosition(entity); -+ BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition(); -+ -+ for (int k1 = i; k1 < i + l; ++k1) { -+ for (int l1 = j; l1 < j + i1; ++l1) { -+ for (int i2 = k; i2 < k + j1; ++i2) { -+ blockposition_mutableblockposition.c(k1, l1, i2); -+ Block block = iblockaccess.getType(blockposition_mutableblockposition).getBlock(); -+ -+ if (block.getMaterial() != Material.AIR) { -+ if (block != Blocks.TRAPDOOR && block != Blocks.IRON_TRAPDOOR) { -+ if (block != Blocks.FLOWING_WATER && block != Blocks.WATER) { -+ if (!flag2 && block instanceof BlockDoor && block.getMaterial() == Material.WOOD) { -+ return 0; -+ } -+ } else { -+ if (flag) { -+ return -1; -+ } -+ -+ flag3 = true; -+ } -+ } else { -+ flag3 = true; -+ } -+ -+ if (entity.world.getType(blockposition_mutableblockposition).getBlock() instanceof BlockMinecartTrackAbstract) { -+ if (!(entity.world.getType(blockposition).getBlock() instanceof BlockMinecartTrackAbstract) && !(entity.world.getType(blockposition.down()).getBlock() instanceof BlockMinecartTrackAbstract)) { -+ return -3; -+ } -+ } else if (!block.b(iblockaccess, blockposition_mutableblockposition) && (!flag1 || !(block instanceof BlockDoor) || block.getMaterial() != Material.WOOD)) { -+ if (block instanceof BlockFence || block instanceof BlockFenceGate || block instanceof BlockCobbleWall) { -+ return -3; -+ } -+ -+ if (block == Blocks.TRAPDOOR || block == Blocks.IRON_TRAPDOOR) { -+ return -4; -+ } -+ -+ Material material = block.getMaterial(); -+ -+ if (material != Material.LAVA) { -+ return 0; -+ } -+ -+ if (!entity.ab()) { -+ return -2; -+ } -+ } -+ } -+ } -+ } -+ } -+ -+ return flag3 ? 2 : 1; -+ } -+ -+ public void a(boolean flag) { -+ this.f = flag; -+ } -+ -+ public void b(boolean flag) { -+ this.g = flag; -+ } -+ -+ public void c(boolean flag) { -+ this.h = flag; -+ } -+ -+ public void d(boolean flag) { -+ this.i = flag; -+ } -+ -+ public boolean b() { -+ return this.f; -+ } -+ -+ public boolean d() { -+ return this.i; -+ } -+ -+ public boolean e() { -+ return this.h; -+ } -+} diff --git a/src/main/java/net/minecraft/server/TileEntityEnderChest.java b/src/main/java/net/minecraft/server/TileEntityEnderChest.java new file mode 100644 -index 0000000..794cdc8 +index 0000000..e454622 --- /dev/null +++ b/src/main/java/net/minecraft/server/TileEntityEnderChest.java @@ -0,0 +1,87 @@ +package net.minecraft.server; + -+public class TileEntityEnderChest extends TileEntity implements IUpdatePlayerListBox { ++public class TileEntityEnderChest extends TileEntity implements ITickable { + + public float a; + public float f; @@ -3992,7 +3185,7 @@ index 0000000..794cdc8 + double d1 = (double) i + 0.5D; + + d0 = (double) k + 0.5D; -+ this.world.makeSound(d1, (double) j + 0.5D, d0, "random.chestopen", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); ++ this.world.a((EntityHuman) null, d1, (double) j + 0.5D, d0, SoundEffects.aL, SoundCategory.BLOCKS, 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); + } + + if (this.g == 0 && this.a > 0.0F || this.g > 0 && this.a < 1.0F) { @@ -4014,7 +3207,7 @@ index 0000000..794cdc8 + d0 = (double) i + 0.5D; + double d2 = (double) k + 0.5D; + -+ this.world.makeSound(d0, (double) j + 0.5D, d2, "random.chestclosed", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); ++ this.world.a((EntityHuman) null, d0, (double) j + 0.5D, d2, SoundEffects.aK, SoundCategory.BLOCKS, 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); + } + + if (this.a < 0.0F) { @@ -4034,7 +3227,7 @@ index 0000000..794cdc8 + } + + public void y() { -+ this.E(); ++ this.invalidateBlockCache(); + super.y(); + } + @@ -4052,28 +3245,151 @@ index 0000000..794cdc8 + return this.world.getTileEntity(this.position) != this ? false : entityhuman.e((double) this.position.getX() + 0.5D, (double) this.position.getY() + 0.5D, (double) this.position.getZ() + 0.5D) <= 64.0D; + } +} -diff --git a/src/main/java/net/minecraft/server/TileEntityLightDetector.java b/src/main/java/net/minecraft/server/TileEntityLightDetector.java +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/PacketPlayOutPlayerListHeaderFooter.java b/src/main/java/org/bukkit/craftbukkit/entity/PacketPlayOutPlayerListHeaderFooter.java new file mode 100644 -index 0000000..f75e2de +index 0000000..842db1d --- /dev/null -+++ b/src/main/java/net/minecraft/server/TileEntityLightDetector.java -@@ -0,0 +1,16 @@ ++++ b/src/main/java/org/bukkit/craftbukkit/entity/PacketPlayOutPlayerListHeaderFooter.java +@@ -0,0 +1,34 @@ ++package org.bukkit.craftbukkit.entity; ++ ++import net.minecraft.server.IChatBaseComponent; ++import net.minecraft.server.Packet; ++import net.minecraft.server.PacketDataSerializer; ++import net.minecraft.server.PacketListenerPlayOut; ++ ++import java.io.IOException; ++ ++public class PacketPlayOutPlayerListHeaderFooter implements Packet { ++ ++ private IChatBaseComponent a; ++ private IChatBaseComponent b; ++ ++ public PacketPlayOutPlayerListHeaderFooter() {} ++ ++ public PacketPlayOutPlayerListHeaderFooter(IChatBaseComponent ichatbasecomponent) { ++ this.a = ichatbasecomponent; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ this.a = packetdataserializer.f(); ++ this.b = packetdataserializer.f(); ++ } ++ ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ packetdataserializer.a(this.a); ++ packetdataserializer.a(this.b); ++ } ++ ++ public void a(PacketListenerPlayOut packetlistenerplayout) { ++ packetlistenerplayout.a(this); ++ } ++} +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/PacketPlayOutTitle.java b/src/main/java/org/bukkit/craftbukkit/entity/PacketPlayOutTitle.java +new file mode 100644 +index 0000000..2286c9e +--- /dev/null ++++ b/src/main/java/org/bukkit/craftbukkit/entity/PacketPlayOutTitle.java +@@ -0,0 +1,99 @@ +package net.minecraft.server; + -+public class TileEntityLightDetector extends TileEntity implements IUpdatePlayerListBox { ++import java.io.IOException; + -+ public TileEntityLightDetector() {} ++public class PacketPlayOutTitle implements Packet { + -+ public void c() { -+ if (this.world != null && !this.world.isClientSide && this.world.getTime() % 20L == 0L) { -+ this.e = this.w(); -+ if (this.e instanceof BlockDaylightDetector) { -+ ((BlockDaylightDetector) this.e).f(this.world, this.position); -+ } ++ private PacketPlayOutTitle.EnumTitleAction a; ++ private IChatBaseComponent b; ++ private int c; ++ private int d; ++ private int e; ++ ++ public PacketPlayOutTitle() {} ++ ++ public PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction packetplayouttitle_enumtitleaction, IChatBaseComponent ichatbasecomponent) { ++ this(packetplayouttitle_enumtitleaction, ichatbasecomponent, -1, -1, -1); ++ } ++ ++ public PacketPlayOutTitle(int i, int j, int k) { ++ this(PacketPlayOutTitle.EnumTitleAction.TIMES, (IChatBaseComponent) null, i, j, k); ++ } ++ ++ public PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction packetplayouttitle_enumtitleaction, IChatBaseComponent ichatbasecomponent, int i, int j, int k) { ++ this.a = packetplayouttitle_enumtitleaction; ++ this.b = ichatbasecomponent; ++ this.c = i; ++ this.d = j; ++ this.e = k; ++ } ++ ++ public void a(PacketDataSerializer packetdataserializer) throws IOException { ++ this.a = (PacketPlayOutTitle.EnumTitleAction) packetdataserializer.a(PacketPlayOutTitle.EnumTitleAction.class); ++ if (this.a == PacketPlayOutTitle.EnumTitleAction.TITLE || this.a == PacketPlayOutTitle.EnumTitleAction.SUBTITLE) { ++ this.b = packetdataserializer.f(); ++ } ++ ++ if (this.a == PacketPlayOutTitle.EnumTitleAction.TIMES) { ++ this.c = packetdataserializer.readInt(); ++ this.d = packetdataserializer.readInt(); ++ this.e = packetdataserializer.readInt(); + } + + } ++ ++ public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ packetdataserializer.a((Enum) this.a); ++ if (this.a == PacketPlayOutTitle.EnumTitleAction.TITLE || this.a == PacketPlayOutTitle.EnumTitleAction.SUBTITLE) { ++ packetdataserializer.a(this.b); ++ } ++ ++ if (this.a == PacketPlayOutTitle.EnumTitleAction.TIMES) { ++ packetdataserializer.writeInt(this.c); ++ packetdataserializer.writeInt(this.d); ++ packetdataserializer.writeInt(this.e); ++ } ++ ++ } ++ ++ public void a(PacketListenerPlayOut packetlistenerplayout) { ++ packetlistenerplayout.a(this); ++ } ++ ++ public static enum EnumTitleAction { ++ ++ TITLE, SUBTITLE, TIMES, CLEAR, RESET; ++ ++ private EnumTitleAction() {} ++ ++ public static PacketPlayOutTitle.EnumTitleAction a(String s) { ++ PacketPlayOutTitle.EnumTitleAction[] apacketplayouttitle_enumtitleaction = values(); ++ int i = apacketplayouttitle_enumtitleaction.length; ++ ++ for (int j = 0; j < i; ++j) { ++ PacketPlayOutTitle.EnumTitleAction packetplayouttitle_enumtitleaction = apacketplayouttitle_enumtitleaction[j]; ++ ++ if (packetplayouttitle_enumtitleaction.name().equalsIgnoreCase(s)) { ++ return packetplayouttitle_enumtitleaction; ++ } ++ } ++ ++ return PacketPlayOutTitle.EnumTitleAction.TITLE; ++ } ++ ++ public static String[] a() { ++ String[] astring = new String[values().length]; ++ int i = 0; ++ PacketPlayOutTitle.EnumTitleAction[] apacketplayouttitle_enumtitleaction = values(); ++ int j = apacketplayouttitle_enumtitleaction.length; ++ ++ for (int k = 0; k < j; ++k) { ++ PacketPlayOutTitle.EnumTitleAction packetplayouttitle_enumtitleaction = apacketplayouttitle_enumtitleaction[k]; ++ ++ astring[i++] = packetplayouttitle_enumtitleaction.name().toLowerCase(); ++ } ++ ++ return astring; ++ } ++ } +} -- -2.7.1 +2.7.2 diff --git a/Spigot-Server-Patches/0004-Vanished-players-don-t-have-rights.patch b/Spigot-Server-Patches/0004-Vanished-players-don-t-have-rights.patch index 6f743b5f5a..7edbb142dc 100644 --- a/Spigot-Server-Patches/0004-Vanished-players-don-t-have-rights.patch +++ b/Spigot-Server-Patches/0004-Vanished-players-don-t-have-rights.patch @@ -1,97 +1,98 @@ -From 4c8e5bf4bb19ffc86e578b04deaa1ec1746a0201 Mon Sep 17 00:00:00 2001 +From de4a6a9e00d7de06c75df36b7b96ee4d3750a430 Mon Sep 17 00:00:00 2001 From: Zach Brown -Date: Sat, 7 Mar 2015 19:50:01 -0600 +Date: Mon, 29 Feb 2016 21:20:21 -0600 Subject: [PATCH] Vanished players don't have rights diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java -index 3a80776..eac0363 100644 +index e40642f..5ccdb88 100644 --- a/src/main/java/net/minecraft/server/EntityArrow.java +++ b/src/main/java/net/minecraft/server/EntityArrow.java -@@ -220,6 +220,14 @@ public class EntityArrow extends Entity implements IProjectile { - float f2; - float f3; +@@ -184,6 +184,14 @@ public abstract class EntityArrow extends Entity implements IProjectile { + } + } -+ // PaperSpigot start - Allow arrows to fly through vanished players the shooter can't see ++ // Paper start - Allow arrows to fly through vanished players the shooter can't see + if (movingobjectposition != null && movingobjectposition.entity instanceof EntityPlayer && shooter != null && shooter instanceof EntityPlayer) { + if (!((EntityPlayer) shooter).getBukkitEntity().canSee(((EntityPlayer) movingobjectposition.entity).getBukkitEntity())) { + movingobjectposition = null; + } + } -+ // PaperSpigot end ++ // Paper end + if (movingobjectposition != null) { - org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this); // CraftBukkit - Call event - if (movingobjectposition.entity != null) { + this.a(movingobjectposition); + } diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java -index 503e78a..00ffff0 100644 +index a07e55e..2751b92 100644 --- a/src/main/java/net/minecraft/server/EntityFishingHook.java +++ b/src/main/java/net/minecraft/server/EntityFishingHook.java -@@ -187,6 +187,14 @@ public class EntityFishingHook extends Entity { - movingobjectposition = new MovingObjectPosition(entity); - } +@@ -198,6 +198,14 @@ public class EntityFishingHook extends Entity { + movingobjectposition = new MovingObjectPosition(entity); + } -+ // PaperSpigot start - Allow fishing hooks to fly through vanished players the shooter can't see -+ if (movingobjectposition != null && movingobjectposition.entity instanceof EntityPlayer && owner != null && owner instanceof EntityPlayer) { -+ if (!((EntityPlayer) owner).getBukkitEntity().canSee(((EntityPlayer) movingobjectposition.entity).getBukkitEntity())) { -+ movingobjectposition = null; ++ // Paper start - Allow fishing hooks to fly through vanished players the shooter can't see ++ if (movingobjectposition != null && movingobjectposition.entity instanceof EntityPlayer && owner != null && owner instanceof EntityPlayer) { ++ if (!((EntityPlayer) owner).getBukkitEntity().canSee(((EntityPlayer) movingobjectposition.entity).getBukkitEntity())) { ++ movingobjectposition = null; ++ } + } -+ } -+ // PaperSpigot end ++ // Paper end + - if (movingobjectposition != null) { - org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this); // Craftbukkit - Call event - if (movingobjectposition.entity != null) { + if (movingobjectposition != null) { + org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this); // Craftbukkit - Call event + if (movingobjectposition.entity != null) { diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java -index 72478be..e7cca3c 100644 +index 93014a4..e0fc22b 100644 --- a/src/main/java/net/minecraft/server/EntityProjectile.java +++ b/src/main/java/net/minecraft/server/EntityProjectile.java -@@ -147,6 +147,14 @@ public abstract class EntityProjectile extends Entity implements IProjectile { - } +@@ -157,6 +157,14 @@ public abstract class EntityProjectile extends Entity implements IProjectile { + movingobjectposition = new MovingObjectPosition(entity); } -+ // PaperSpigot start - Allow projectiles to fly through vanished players the shooter can't see ++ // Paper start - Allow projectiles to fly through vanished players the shooter can't see + if (movingobjectposition != null && movingobjectposition.entity instanceof EntityPlayer && shooter != null && shooter instanceof EntityPlayer) { + if (!((EntityPlayer) shooter).getBukkitEntity().canSee(((EntityPlayer) movingobjectposition.entity).getBukkitEntity())) { + movingobjectposition = null; + } + } -+ // PaperSpigot end ++ // Paper end + if (movingobjectposition != null) { if (movingobjectposition.type == MovingObjectPosition.EnumMovingObjectType.BLOCK && this.world.getType(movingobjectposition.a()).getBlock() == Blocks.PORTAL) { - this.d(movingobjectposition.a()); + this.e(movingobjectposition.a()); diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java -index 57b3d9d..0cd4175 100644 +index 300573a..6eeb03b 100644 --- a/src/main/java/net/minecraft/server/ItemBlock.java +++ b/src/main/java/net/minecraft/server/ItemBlock.java -@@ -25,7 +25,7 @@ public class ItemBlock extends Item { - return false; - } else if (!entityhuman.a(blockposition, enumdirection, itemstack)) { - return false; -- } else if (world.a(this.a, blockposition, false, enumdirection, (Entity) null, itemstack)) { -+ } else if (world.a(this.a, blockposition, false, enumdirection, entityhuman, itemstack)) { // PaperSpigot - Pass entityhuman instead of null +@@ -21,7 +21,7 @@ public class ItemBlock extends Item { + blockposition = blockposition.shift(enumdirection); + } + +- if (itemstack.count != 0 && entityhuman.a(blockposition, enumdirection, itemstack) && world.a(this.a, blockposition, false, enumdirection, (Entity) null, itemstack)) { ++ if (itemstack.count != 0 && entityhuman.a(blockposition, enumdirection, itemstack) && world.a(this.a, blockposition, false, enumdirection, entityhuman, itemstack)) { // Paper - Pass entityhuman instead of null int i = this.filterData(itemstack.getData()); IBlockData iblockdata1 = this.a.getPlacedState(world, blockposition, enumdirection, f, f1, f2, i, entityhuman); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index bb46799..d184f8a 100644 +index 92f9e3d..93dbc9c 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -1673,6 +1673,13 @@ public abstract class World implements IBlockAccess { +@@ -1646,6 +1646,14 @@ public abstract class World implements IBlockAccess { for (int i = 0; i < list.size(); ++i) { Entity entity1 = (Entity) list.get(i); -+ // PaperSpigot start - Allow block placement if the placer cannot see the vanished blocker ++ // Paper start - Allow block placement if the placer cannot see the vanished blocker + if (entity instanceof EntityPlayer && entity1 instanceof EntityPlayer) { + if (!((EntityPlayer) entity).getBukkitEntity().canSee(((EntityPlayer) entity1).getBukkitEntity())) { + continue; + } + } ++ // Paper end + - if (!entity1.dead && entity1.k && entity1 != entity && (entity == null || entity.vehicle != entity1 && entity.passenger != entity1)) { + if (!entity1.dead && entity1.i && entity1 != entity && (entity == null || entity1.x(entity))) { return false; } -- -2.6.3.windows.1 +2.7.2 diff --git a/Spigot-Server-Patches/0005-Allow-undead-horse-types-to-be-leashed.patch b/Spigot-Server-Patches/0005-Allow-undead-horse-types-to-be-leashed.patch deleted file mode 100644 index 2257536ae4..0000000000 --- a/Spigot-Server-Patches/0005-Allow-undead-horse-types-to-be-leashed.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 0105ce07d38b5554882c5c8293218219baf01c74 Mon Sep 17 00:00:00 2001 -From: Zach Brown -Date: Sat, 7 Mar 2015 19:57:50 -0600 -Subject: [PATCH] Allow undead horse types to be leashed - - -diff --git a/src/main/java/net/minecraft/server/EntityHorse.java b/src/main/java/net/minecraft/server/EntityHorse.java -index 688099f..d1d45b6 100644 ---- a/src/main/java/net/minecraft/server/EntityHorse.java -+++ b/src/main/java/net/minecraft/server/EntityHorse.java -@@ -179,6 +179,11 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { - } - - public boolean cb() { -+ // PaperSpigot start - Configurable undead horse leashing -+ if (this.world.paperSpigotConfig.allowUndeadHorseLeashing) { -+ return super.cb(); -+ } -+ // PaperSpigot end - return !this.cR() && super.cb(); - } - -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index f3bc3aa..0b47234 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -74,4 +74,11 @@ public class PaperSpigotWorldConfig - config.addDefault( "world-settings.default." + path, def ); - return config.getString( "world-settings." + worldName + "." + path, config.getString( "world-settings.default." + path ) ); - } -+ -+ public boolean allowUndeadHorseLeashing; -+ private void allowUndeadHorseLeashing() -+ { -+ allowUndeadHorseLeashing = getBoolean( "allow-undead-horse-leashing", false ); -+ log( "Allow undead horse types to be leashed: " + allowUndeadHorseLeashing ); -+ } - } --- -1.9.1 - diff --git a/Spigot-Server-Patches/0005-Configurable-squid-spawn-ranges.patch b/Spigot-Server-Patches/0005-Configurable-squid-spawn-ranges.patch new file mode 100644 index 0000000000..fbcbc65b9d --- /dev/null +++ b/Spigot-Server-Patches/0005-Configurable-squid-spawn-ranges.patch @@ -0,0 +1,40 @@ +From f07fd6b18c525b635c99a3390a5f83361cb640fa Mon Sep 17 00:00:00 2001 +From: Zach Brown +Date: Tue, 1 Mar 2016 12:45:11 -0600 +Subject: [PATCH] Configurable squid spawn ranges + + +diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index ca6d1a2..ac7a176 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -63,4 +63,12 @@ public class PaperWorldConfig { + config.addDefault("world-settings.default." + path, def); + return config.getString("world-settings." + worldName + "." + path, config.getString("world-settings.default." + path)); + } ++ ++ public double squidMinSpawnHeight; ++ public double squidMaxSpawnHeight; ++ private void squidSpawnHeights() { ++ squidMinSpawnHeight = getDouble("squid-spawn-height.minimum", 45.0D); ++ squidMaxSpawnHeight = getDouble("squid-spawn-height.maximum", 63.0D); ++ log("Squids will spawn between Y: " + squidMinSpawnHeight + " and Y: " + squidMaxSpawnHeight); ++ } + } +diff --git a/src/main/java/net/minecraft/server/EntitySquid.java b/src/main/java/net/minecraft/server/EntitySquid.java +index b94444d..9f1a50e 100644 +--- a/src/main/java/net/minecraft/server/EntitySquid.java ++++ b/src/main/java/net/minecraft/server/EntitySquid.java +@@ -138,7 +138,8 @@ public class EntitySquid extends EntityWaterAnimal { + } + + public boolean cF() { +- return this.locY > 45.0D && this.locY < (double) this.world.K() && super.cF(); ++ // Paper - Configurable squid spawn height range ++ return this.locY > world.paperConfig.squidMinSpawnHeight && this.locY < world.paperConfig.squidMaxSpawnHeight && super.cF(); + } + + public void b(float f, float f1, float f2) { +-- +2.7.2 + diff --git a/Spigot-Server-Patches/0006-Configurable-cactus-and-reed-natural-growth-heights.patch b/Spigot-Server-Patches/0006-Configurable-cactus-and-reed-natural-growth-heights.patch new file mode 100644 index 0000000000..a25621b6be --- /dev/null +++ b/Spigot-Server-Patches/0006-Configurable-cactus-and-reed-natural-growth-heights.patch @@ -0,0 +1,53 @@ +From ac2539c743cbcce559a561db94f7afef9d6260d8 Mon Sep 17 00:00:00 2001 +From: Zach Brown +Date: Tue, 1 Mar 2016 13:02:51 -0600 +Subject: [PATCH] Configurable cactus and reed natural growth heights + + +diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index ac7a176..ca0c9f0 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -71,4 +71,13 @@ public class PaperWorldConfig { + squidMaxSpawnHeight = getDouble("squid-spawn-height.maximum", 63.0D); + log("Squids will spawn between Y: " + squidMinSpawnHeight + " and Y: " + squidMaxSpawnHeight); + } ++ ++ public int cactusMaxHeight; ++ public int reedMaxHeight; ++ private void blowGrowthHeight() { ++ cactusMaxHeight = getInt("max-growth-height.cactus", 3); ++ reedMaxHeight = getInt("max-growth-height.reeds", 3); ++ log("Max height for cactus growth " + cactusMaxHeight + ". Max height for reed growth " + reedMaxHeight); ++ ++ } + } +diff --git a/src/main/java/net/minecraft/server/BlockCactus.java b/src/main/java/net/minecraft/server/BlockCactus.java +index 862075d..b615f18 100644 +--- a/src/main/java/net/minecraft/server/BlockCactus.java ++++ b/src/main/java/net/minecraft/server/BlockCactus.java +@@ -28,7 +28,7 @@ public class BlockCactus extends Block { + ; + } + +- if (i < 3) { ++ if (i < world.paperConfig.cactusMaxHeight) { // Paper - Configurable growth height + int j = ((Integer) iblockdata.get(BlockCactus.AGE)).intValue(); + + if (j >= (byte) range(3, (world.spigotConfig.cactusModifier / 100 * 15) + 0.5F, 15)) { // Spigot +diff --git a/src/main/java/net/minecraft/server/BlockReed.java b/src/main/java/net/minecraft/server/BlockReed.java +index b8c36a7..1e5e9b8 100644 +--- a/src/main/java/net/minecraft/server/BlockReed.java ++++ b/src/main/java/net/minecraft/server/BlockReed.java +@@ -27,7 +27,7 @@ public class BlockReed extends Block { + ; + } + +- if (i < 3) { ++ if (i < world.paperConfig.reedMaxHeight) { // Paper - Configurable growth height + int j = ((Integer) iblockdata.get(BlockReed.AGE)).intValue(); + + if (j >= (byte) range(3, (world.spigotConfig.caneModifier /100 * 15) + 0.5F, 15)) { // Spigot +-- +2.7.2 + diff --git a/Spigot-Server-Patches/0006-Configurable-squid-spawn-ranges.patch b/Spigot-Server-Patches/0006-Configurable-squid-spawn-ranges.patch deleted file mode 100644 index e50b0e3f95..0000000000 --- a/Spigot-Server-Patches/0006-Configurable-squid-spawn-ranges.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 6b5d69ae84764c2a11f03c5fd257486181017987 Mon Sep 17 00:00:00 2001 -From: Zach Brown -Date: Sat, 7 Mar 2015 20:20:29 -0600 -Subject: [PATCH] Configurable squid spawn ranges - - -diff --git a/src/main/java/net/minecraft/server/EntitySquid.java b/src/main/java/net/minecraft/server/EntitySquid.java -index 511bec7..31996b4 100644 ---- a/src/main/java/net/minecraft/server/EntitySquid.java -+++ b/src/main/java/net/minecraft/server/EntitySquid.java -@@ -141,7 +141,8 @@ public class EntitySquid extends EntityWaterAnimal { - } - - public boolean bR() { -- return this.locY > 45.0D && this.locY < (double) this.world.F() && super.bR(); -+ // PaperSpigot - Configurable squid spawn range -+ return this.locY > this.world.paperSpigotConfig.squidMinSpawnHeight && this.locY < (double) this.world.paperSpigotConfig.squidMaxSpawnHeight && super.bR(); - } - - public void b(float f, float f1, float f2) { -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index 0b47234..f3bbac8 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -81,4 +81,13 @@ public class PaperSpigotWorldConfig - allowUndeadHorseLeashing = getBoolean( "allow-undead-horse-leashing", false ); - log( "Allow undead horse types to be leashed: " + allowUndeadHorseLeashing ); - } -+ -+ public double squidMinSpawnHeight; -+ public double squidMaxSpawnHeight; -+ private void squidSpawnHeight() -+ { -+ squidMinSpawnHeight = getDouble( "squid-spawn-height.minimum", 45.0D ); -+ squidMaxSpawnHeight = getDouble( "squid-spawn-height.maximum", 63.0D ); -+ log( "Squids will spawn between Y: " + squidMinSpawnHeight + " and Y: " + squidMaxSpawnHeight ); -+ } - } --- -1.9.1 - diff --git a/Spigot-Server-Patches/0007-Configurable-baby-zombie-movement-speed.patch b/Spigot-Server-Patches/0007-Configurable-baby-zombie-movement-speed.patch new file mode 100644 index 0000000000..d7244f08c3 --- /dev/null +++ b/Spigot-Server-Patches/0007-Configurable-baby-zombie-movement-speed.patch @@ -0,0 +1,49 @@ +From de2a0128b959a312b8568680540decf3bf9af46e Mon Sep 17 00:00:00 2001 +From: Zach Brown +Date: Tue, 1 Mar 2016 13:09:16 -0600 +Subject: [PATCH] Configurable baby zombie movement speed + + +diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index ca0c9f0..852a5bd 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -80,4 +80,10 @@ public class PaperWorldConfig { + log("Max height for cactus growth " + cactusMaxHeight + ". Max height for reed growth " + reedMaxHeight); + + } ++ ++ public double babyZombieMovementSpeed; ++ private void babyZombieMovementSpeed() { ++ babyZombieMovementSpeed = getDouble("baby-zombie-movement-speed", 0.5D); // Player moves at 0.1F, for reference ++ log("Baby zombies will move at the speed of " + babyZombieMovementSpeed); ++ } + } +diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java +index ba2f12f..24e5863 100644 +--- a/src/main/java/net/minecraft/server/EntityZombie.java ++++ b/src/main/java/net/minecraft/server/EntityZombie.java +@@ -15,7 +15,7 @@ public class EntityZombie extends EntityMonster { + + protected static final IAttribute a = (new AttributeRanged((IAttribute) null, "zombie.spawnReinforcements", 0.0D, 0.0D, 1.0D)).a("Spawn Reinforcements Chance"); + private static final UUID b = UUID.fromString("B9766B59-9566-4402-BC1F-2EE2A276D836"); +- private static final AttributeModifier c = new AttributeModifier(EntityZombie.b, "Baby speed boost", 0.5D, 1); ++ private final AttributeModifier c = new AttributeModifier(EntityZombie.b, "Baby speed boost", world.paperConfig.babyZombieMovementSpeed, 1); // Paper - Remove static - Make baby speed configurable + private static final DataWatcherObject bv = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.h); + private static final DataWatcherObject bw = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.b); + private static final DataWatcherObject bx = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.h); +@@ -105,9 +105,9 @@ public class EntityZombie extends EntityMonster { + if (this.world != null && !this.world.isClientSide) { + AttributeInstance attributeinstance = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED); + +- attributeinstance.c(EntityZombie.c); ++ attributeinstance.c(this.c); + if (flag) { +- attributeinstance.b(EntityZombie.c); ++ attributeinstance.b(this.c); + } + } + +-- +2.7.2 + diff --git a/Spigot-Server-Patches/0007-Configurable-damage-multiplier-for-PvP-blocking.patch b/Spigot-Server-Patches/0007-Configurable-damage-multiplier-for-PvP-blocking.patch deleted file mode 100644 index ea3e48f31a..0000000000 --- a/Spigot-Server-Patches/0007-Configurable-damage-multiplier-for-PvP-blocking.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 9b9c2851ddafd52f5e631de7ec1be02a35ad64e1 Mon Sep 17 00:00:00 2001 -From: Zach Brown -Date: Sat, 7 Mar 2015 20:27:02 -0600 -Subject: [PATCH] Configurable damage multiplier for PvP blocking - - -diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index d73395a..9dce3ac 100644 ---- a/src/main/java/net/minecraft/server/EntityHuman.java -+++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -861,7 +861,7 @@ public abstract class EntityHuman extends EntityLiving { - // CraftBukkit end - if (!this.isInvulnerable(damagesource)) { - if (!damagesource.ignoresArmor() && this.isBlocking() && f > 0.0F) { -- f = (1.0F + f) * 0.5F; -+ f = (1.0F + f) * this.world.paperSpigotConfig.playerBlockingDamageMultiplier; // PaperSpigot - Configurable damage multiplier for blocking; - } - - f = this.applyArmorModifier(damagesource, f); -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index f3bbac8..2a84879 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -90,4 +90,11 @@ public class PaperSpigotWorldConfig - squidMaxSpawnHeight = getDouble( "squid-spawn-height.maximum", 63.0D ); - log( "Squids will spawn between Y: " + squidMinSpawnHeight + " and Y: " + squidMaxSpawnHeight ); - } -+ -+ public float playerBlockingDamageMultiplier; -+ private void playerBlockingDamageMultiplier() -+ { -+ playerBlockingDamageMultiplier = getFloat( "player-blocking-damage-multiplier", 0.5F ); -+ log( "Player blocking damage multiplier set to " + playerBlockingDamageMultiplier ); -+ } - } --- -1.9.1 - diff --git a/Spigot-Server-Patches/0008-Configurable-cactus-and-reed-natural-growth-heights.patch b/Spigot-Server-Patches/0008-Configurable-cactus-and-reed-natural-growth-heights.patch deleted file mode 100644 index dee5ac53d2..0000000000 --- a/Spigot-Server-Patches/0008-Configurable-cactus-and-reed-natural-growth-heights.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 5ac0e55838b5e0bf667cc3759af1e2744eea2a2a Mon Sep 17 00:00:00 2001 -From: Zach Brown -Date: Sat, 7 Mar 2015 20:32:13 -0600 -Subject: [PATCH] Configurable cactus and reed natural growth heights - - -diff --git a/src/main/java/net/minecraft/server/BlockCactus.java b/src/main/java/net/minecraft/server/BlockCactus.java -index 488e5c2..ddc2135 100644 ---- a/src/main/java/net/minecraft/server/BlockCactus.java -+++ b/src/main/java/net/minecraft/server/BlockCactus.java -@@ -26,7 +26,7 @@ public class BlockCactus extends Block { - ; - } - -- if (i < 3) { -+ if (i < world.paperSpigotConfig.cactusMaxHeight) { // PaperSpigot - Configurable max growth height for cactus blocks) { - int j = ((Integer) iblockdata.get(BlockCactus.AGE)).intValue(); - - if (j >= (byte) range(3, (world.growthOdds / world.spigotConfig.cactusModifier * 15) + 0.5F, 15)) { // Spigot -diff --git a/src/main/java/net/minecraft/server/BlockReed.java b/src/main/java/net/minecraft/server/BlockReed.java -index d00067d..337f2c4 100644 ---- a/src/main/java/net/minecraft/server/BlockReed.java -+++ b/src/main/java/net/minecraft/server/BlockReed.java -@@ -25,7 +25,7 @@ public class BlockReed extends Block { - ; - } - -- if (i < 3) { -+ if (i < world.paperSpigotConfig.reedMaxHeight) { // PaperSpigot - Configurable max growth height for reed blocks) { - int j = ((Integer) iblockdata.get(BlockReed.AGE)).intValue(); - - if (j >= (byte) range(3, (world.growthOdds / world.spigotConfig.caneModifier * 15) + 0.5F, 15)) { // Spigot -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index 2a84879..c8b428c 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -97,4 +97,13 @@ public class PaperSpigotWorldConfig - playerBlockingDamageMultiplier = getFloat( "player-blocking-damage-multiplier", 0.5F ); - log( "Player blocking damage multiplier set to " + playerBlockingDamageMultiplier ); - } -+ -+ public int cactusMaxHeight; -+ public int reedMaxHeight; -+ private void blockGrowthHeight() -+ { -+ cactusMaxHeight = getInt( "max-growth-height.cactus", 3 ); -+ reedMaxHeight = getInt( "max-growth-height.reeds", 3 ); -+ log( "Max height for cactus growth " + cactusMaxHeight + ". Max height for reed growth " + reedMaxHeight ); -+ } - } --- -1.9.1 - diff --git a/Spigot-Server-Patches/0008-Configurable-fishing-time-ranges.patch b/Spigot-Server-Patches/0008-Configurable-fishing-time-ranges.patch new file mode 100644 index 0000000000..54c7560894 --- /dev/null +++ b/Spigot-Server-Patches/0008-Configurable-fishing-time-ranges.patch @@ -0,0 +1,39 @@ +From b88a07a3dffa0b0742869f430b392b3696251239 Mon Sep 17 00:00:00 2001 +From: Zach Brown +Date: Tue, 1 Mar 2016 13:14:11 -0600 +Subject: [PATCH] Configurable fishing time ranges + + +diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index 852a5bd..2f30b66 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -86,4 +86,12 @@ public class PaperWorldConfig { + babyZombieMovementSpeed = getDouble("baby-zombie-movement-speed", 0.5D); // Player moves at 0.1F, for reference + log("Baby zombies will move at the speed of " + babyZombieMovementSpeed); + } ++ ++ public int fishingMinTicks; ++ public int fishingMaxTicks; ++ private void fishingTickRange() { ++ fishingMinTicks = getInt("fishing-time-range.MinimumTicks", 100); ++ fishingMaxTicks = getInt("fishing-time-range.MaximumTicks", 900); ++ log("Fishing time ranges are between " + fishingMinTicks +" and " + fishingMaxTicks + " ticks"); ++ } + } +diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java +index 2751b92..a38898c 100644 +--- a/src/main/java/net/minecraft/server/EntityFishingHook.java ++++ b/src/main/java/net/minecraft/server/EntityFishingHook.java +@@ -359,7 +359,7 @@ public class EntityFishingHook extends Entity { + this.aw = MathHelper.nextInt(this.random, 20, 80); + } + } else { +- this.av = MathHelper.nextInt(this.random, 100, 900); ++ this.av = MathHelper.nextInt(this.random, world.paperConfig.fishingMinTicks, world.paperConfig.fishingMaxTicks); // Paper - Configurable fishing time range + this.av -= EnchantmentManager.g(this.owner) * 20 * 5; + } + } +-- +2.7.2 + diff --git a/Spigot-Server-Patches/0011-Allow-nerfed-mobs-to-jump.patch b/Spigot-Server-Patches/0009-Allow-nerfed-mobs-to-jump.patch similarity index 64% rename from Spigot-Server-Patches/0011-Allow-nerfed-mobs-to-jump.patch rename to Spigot-Server-Patches/0009-Allow-nerfed-mobs-to-jump.patch index afa47a1bf7..dd5d90e7e9 100644 --- a/Spigot-Server-Patches/0011-Allow-nerfed-mobs-to-jump.patch +++ b/Spigot-Server-Patches/0009-Allow-nerfed-mobs-to-jump.patch @@ -1,46 +1,46 @@ -From 3a9f1ad42ef76caca5fcfc663e91f27d9c963833 Mon Sep 17 00:00:00 2001 +From f7cca8a66999ab5b254908f7da834e66e0b6bfa3 Mon Sep 17 00:00:00 2001 From: Zach Brown -Date: Sat, 7 Mar 2015 21:03:06 -0600 +Date: Tue, 1 Mar 2016 13:24:16 -0600 Subject: [PATCH] Allow nerfed mobs to jump diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index a8a327d..aa38fe6 100644 +index 7d4bb9f..a45e87c 100644 --- a/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java -@@ -33,6 +33,7 @@ public abstract class EntityInsentient extends EntityLiving { - private boolean bo; - private Entity bp; - private NBTTagCompound bq; -+ public PathfinderGoalFloat goalFloat; // PaperSpigot +@@ -43,6 +43,7 @@ public abstract class EntityInsentient extends EntityLiving { + private boolean bC; + private Entity leashHolder; + private NBTTagCompound bE; ++ public PathfinderGoalFloat goalFloat; // Paper public EntityInsentient(World world) { super(world); -@@ -460,6 +461,12 @@ public abstract class EntityInsentient extends EntityLiving { +@@ -629,6 +630,12 @@ public abstract class EntityInsentient extends EntityLiving { // Spigot Start if ( this.fromMobSpawner ) { -+ // PaperSpigot start - Allow nerfed mobs to jump ++ // Paper start - Allow nerfed mobs to jump and float + if (goalFloat != null) { + if (goalFloat.a()) goalFloat.e(); + this.g.b(); + } -+ // PaperSpigot end ++ // Paper end return; } // Spigot End diff --git a/src/main/java/net/minecraft/server/PathfinderGoalFloat.java b/src/main/java/net/minecraft/server/PathfinderGoalFloat.java -index 6014b09..da019c1 100644 +index 1a20dbf..e385148 100644 --- a/src/main/java/net/minecraft/server/PathfinderGoalFloat.java +++ b/src/main/java/net/minecraft/server/PathfinderGoalFloat.java @@ -6,6 +6,7 @@ public class PathfinderGoalFloat extends PathfinderGoal { public PathfinderGoalFloat(EntityInsentient entityinsentient) { this.a = entityinsentient; -+ entityinsentient.goalFloat = this; // PaperSpigot ++ entityinsentient.goalFloat = this; // Paper this.a(4); - ((Navigation) entityinsentient.getNavigation()).d(true); + ((Navigation) entityinsentient.getNavigation()).c(true); } -- -2.5.1 +2.7.2 diff --git a/Spigot-Server-Patches/0009-Configurable-baby-zombie-movement-speed.patch b/Spigot-Server-Patches/0009-Configurable-baby-zombie-movement-speed.patch deleted file mode 100644 index 916a119614..0000000000 --- a/Spigot-Server-Patches/0009-Configurable-baby-zombie-movement-speed.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 0b4987d924c62805d99df5922954b2cce6a3a81f Mon Sep 17 00:00:00 2001 -From: Zach Brown -Date: Sat, 7 Mar 2015 20:41:55 -0600 -Subject: [PATCH] Configurable baby zombie movement speed - - -diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java -index 1a8d3d8..6d3b002 100644 ---- a/src/main/java/net/minecraft/server/EntityZombie.java -+++ b/src/main/java/net/minecraft/server/EntityZombie.java -@@ -16,7 +16,7 @@ public class EntityZombie extends EntityMonster { - - protected static final IAttribute a = (new AttributeRanged((IAttribute) null, "zombie.spawnReinforcements", 0.0D, 0.0D, 1.0D)).a("Spawn Reinforcements Chance"); - private static final UUID b = UUID.fromString("B9766B59-9566-4402-BC1F-2EE2A276D836"); -- private static final AttributeModifier c = new AttributeModifier(EntityZombie.b, "Baby speed boost", 0.5D, 1); -+ private static final AttributeModifier c = new AttributeModifier(EntityZombie.b, "Baby speed boost", org.github.paperspigot.PaperSpigotConfig.babyZombieMovementSpeed, 1); // PaperSpigot - Configurable baby zombie movement speed - private final PathfinderGoalBreakDoor bm = new PathfinderGoalBreakDoor(this); - private int bn; - private boolean bo = false; -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java -index eef9722..0e9d57f 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java -@@ -138,4 +138,10 @@ public class PaperSpigotConfig - config.addDefault( path, def ); - return config.getString( path, config.getString( path ) ); - } -+ -+ public static double babyZombieMovementSpeed; -+ private static void babyZombieMovementSpeed() -+ { -+ babyZombieMovementSpeed = getDouble( "settings.baby-zombie-movement-speed", 0.5D ); // Player moves at 0.1F, for reference -+ } - } --- -2.4.1.windows.1 - diff --git a/Spigot-Server-Patches/0010-Configurable-fishing-time-ranges.patch b/Spigot-Server-Patches/0010-Configurable-fishing-time-ranges.patch deleted file mode 100644 index bbc8baff4e..0000000000 --- a/Spigot-Server-Patches/0010-Configurable-fishing-time-ranges.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 212022045788f038265c3d8e51e5858e17b56f05 Mon Sep 17 00:00:00 2001 -From: Zach Brown -Date: Sat, 7 Mar 2015 21:00:13 -0600 -Subject: [PATCH] Configurable fishing time ranges - - -diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java -index 00ffff0..df6ce0d 100644 ---- a/src/main/java/net/minecraft/server/EntityFishingHook.java -+++ b/src/main/java/net/minecraft/server/EntityFishingHook.java -@@ -339,7 +339,7 @@ public class EntityFishingHook extends Entity { - this.ax = MathHelper.nextInt(this.random, 20, 80); - } - } else { -- this.aw = MathHelper.nextInt(this.random, 100, 900); -+ this.aw = MathHelper.nextInt(this.random, this.world.paperSpigotConfig.fishingMinTicks, this.world.paperSpigotConfig.fishingMaxTicks); // PaperSpigot - Configurable fishing tick range - this.aw -= EnchantmentManager.h(this.owner) * 20 * 5; - } - } -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index db40fb8..5ae9afb 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -106,4 +106,12 @@ public class PaperSpigotWorldConfig - reedMaxHeight = getInt( "max-growth-height.reeds", 3 ); - log( "Max height for cactus growth " + cactusMaxHeight + ". Max height for reed growth " + reedMaxHeight ); - } -+ -+ public int fishingMinTicks; -+ public int fishingMaxTicks; -+ private void fishingTickRange() -+ { -+ fishingMinTicks = getInt( "fishing-time-range.MinimumTicks", 100 ); -+ fishingMaxTicks = getInt( "fishing-time-range.MaximumTicks", 900 ); -+ } - } --- -2.6.3.windows.1 - diff --git a/Spigot-Server-Patches/0010-Toggle-for-player-interact-limiter.patch b/Spigot-Server-Patches/0010-Toggle-for-player-interact-limiter.patch new file mode 100644 index 0000000000..f8d0f5e59c --- /dev/null +++ b/Spigot-Server-Patches/0010-Toggle-for-player-interact-limiter.patch @@ -0,0 +1,40 @@ +From 6b7626be9f683f5e31323cdd56e10546437785c4 Mon Sep 17 00:00:00 2001 +From: Zach Brown +Date: Tue, 1 Mar 2016 13:31:05 -0600 +Subject: [PATCH] Toggle for player interact limiter + + +diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java +index 881e989..c8638a8 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java +@@ -119,4 +119,12 @@ public class PaperConfig { + config.addDefault(path, def); + return config.getString(path, config.getString(path)); + } ++ ++ public static boolean useInteractLimiter; ++ private static void useInteractLimiter() { ++ useInteractLimiter = getBoolean("settings.limit-player-interactions", true); ++ if (!useInteractLimiter) { ++ Bukkit.getLogger().log(Level.INFO, "Disabling player interaction limiter, your server may be more vulnerable to malicious users"); ++ } ++ } + } +diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +index 0f873ae..b7db9b6 100644 +--- a/src/main/java/net/minecraft/server/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/PlayerConnection.java +@@ -864,7 +864,8 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { + this.player.resetIdleTimer(); + // Spigot start + boolean throttled = false; +- if (lastPlace != -1 && packetplayinblockplace.timestamp - lastPlace < 30 && packets++ >= 4) { ++ // Paper - Allow disabling interact limiter ++ if (com.destroystokyo.paper.PaperConfig.useInteractLimiter && lastPlace != -1 && packetplayinblockplace.timestamp - lastPlace < 30 && packets++ >= 4) { + throttled = true; + } else if ( packetplayinblockplace.timestamp - lastPlace >= 30 || lastPlace == -1 ) + { +-- +2.7.2 + diff --git a/Spigot-Server-Patches/0011-Player-Exhaustion-Multipliers.patch b/Spigot-Server-Patches/0011-Player-Exhaustion-Multipliers.patch new file mode 100644 index 0000000000..53c043cfe7 --- /dev/null +++ b/Spigot-Server-Patches/0011-Player-Exhaustion-Multipliers.patch @@ -0,0 +1,60 @@ +From d5804afa686172f201f7d7f7cef178f54ba4a4f3 Mon Sep 17 00:00:00 2001 +From: gsand +Date: Tue, 1 Mar 2016 13:43:16 -0600 +Subject: [PATCH] Player Exhaustion Multipliers + + +diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index 2f30b66..d5b4756 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -94,4 +94,13 @@ public class PaperWorldConfig { + fishingMaxTicks = getInt("fishing-time-range.MaximumTicks", 900); + log("Fishing time ranges are between " + fishingMinTicks +" and " + fishingMaxTicks + " ticks"); + } ++ ++ public float blockBreakExhaustion; ++ public float playerSwimmingExhaustion; ++ public void exhaustionValues() { ++ blockBreakExhaustion = getFloat("player-exhaustion.block-break", 0.025F); ++ playerSwimmingExhaustion = getFloat("player-exhaustion.swimming", 0.015F); ++ log("Player exhaustion penalty for breaking blocks is " + blockBreakExhaustion); ++ log("Player exhaustion penalty for swimming is " + playerSwimmingExhaustion); ++ } + } +diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java +index 1d2f580..bed5577 100644 +--- a/src/main/java/net/minecraft/server/Block.java ++++ b/src/main/java/net/minecraft/server/Block.java +@@ -409,7 +409,7 @@ public class Block { + + public void a(World world, EntityHuman entityhuman, BlockPosition blockposition, IBlockData iblockdata, TileEntity tileentity, ItemStack itemstack) { + entityhuman.b(StatisticList.a(this)); +- entityhuman.applyExhaustion(0.025F); ++ entityhuman.applyExhaustion(world.paperConfig.blockBreakExhaustion); // Paper - Configurable block break exhaustion + if (this.o() && EnchantmentManager.getEnchantmentLevel(Enchantments.SILK_TOUCH, itemstack) > 0) { + ItemStack itemstack1 = this.u(iblockdata); + +diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java +index 53936de..d8161a8 100644 +--- a/src/main/java/net/minecraft/server/EntityHuman.java ++++ b/src/main/java/net/minecraft/server/EntityHuman.java +@@ -1446,13 +1446,13 @@ public abstract class EntityHuman extends EntityLiving { + i = Math.round(MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F); + if (i > 0) { + this.a(StatisticList.q, i); +- this.applyExhaustion(0.015F * (float) i * 0.01F); ++ this.applyExhaustion(world.paperConfig.playerSwimmingExhaustion); // Paper - Configurable swimming exhaustion + } + } else if (this.isInWater()) { + i = Math.round(MathHelper.sqrt(d0 * d0 + d2 * d2) * 100.0F); + if (i > 0) { + this.a(StatisticList.m, i); +- this.applyExhaustion(0.015F * (float) i * 0.01F); ++ this.applyExhaustion(world.paperConfig.playerSwimmingExhaustion); // Paper - Configurable swimming exhaustion + } + } else if (this.n_()) { + if (d1 > 0.0D) { +-- +2.7.2 + diff --git a/Spigot-Server-Patches/0012-Add-configurable-despawn-distances-for-living-entiti.patch b/Spigot-Server-Patches/0012-Add-configurable-despawn-distances-for-living-entiti.patch new file mode 100644 index 0000000000..ef7c2162e1 --- /dev/null +++ b/Spigot-Server-Patches/0012-Add-configurable-despawn-distances-for-living-entiti.patch @@ -0,0 +1,55 @@ +From ba115e8f3764ef9162fba23d75154d9d5bb0054e Mon Sep 17 00:00:00 2001 +From: Suddenly +Date: Tue, 1 Mar 2016 13:51:54 -0600 +Subject: [PATCH] Add configurable despawn distances for living entities + + +diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index d5b4756..a662f26 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -103,4 +103,20 @@ public class PaperWorldConfig { + log("Player exhaustion penalty for breaking blocks is " + blockBreakExhaustion); + log("Player exhaustion penalty for swimming is " + playerSwimmingExhaustion); + } ++ ++ public int softDespawnDistance; ++ public int hardDespawnDistance; ++ private void despawnDistances() { ++ softDespawnDistance = getInt("despawn-ranges.soft", 32); // 32^2 = 1024, Minecraft Default ++ hardDespawnDistance = getInt("despawn-ranges.hard", 128); // 128^2 = 16384, Minecraft Default ++ ++ if (softDespawnDistance > hardDespawnDistance) { ++ softDespawnDistance = hardDespawnDistance; ++ } ++ ++ log("Living Entity Despawn Ranges: Soft: " + softDespawnDistance + " Hard: " + hardDespawnDistance); ++ ++ softDespawnDistance = softDespawnDistance*softDespawnDistance; ++ hardDespawnDistance = hardDespawnDistance*hardDespawnDistance; ++ } + } +diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java +index a45e87c..916c913 100644 +--- a/src/main/java/net/minecraft/server/EntityInsentient.java ++++ b/src/main/java/net/minecraft/server/EntityInsentient.java +@@ -608,13 +608,13 @@ public abstract class EntityInsentient extends EntityLiving { + double d2 = entityhuman.locZ - this.locZ; + double d3 = d0 * d0 + d1 * d1 + d2 * d2; + +- if (d3 > 16384.0D) { // CraftBukkit - remove isTypeNotPersistent() check ++ if (d3 > world.paperConfig.hardDespawnDistance) { // CraftBukkit - remove isTypeNotPersistent() check // Paper - custom despawn distances + this.die(); + } + +- if (this.ticksFarFromPlayer > 600 && this.random.nextInt(800) == 0 && d3 > 1024.0D) { // CraftBukkit - remove isTypeNotPersistent() check ++ if (this.ticksFarFromPlayer > 600 && this.random.nextInt(800) == 0 && d3 > world.paperConfig.softDespawnDistance) { // CraftBukkit - remove isTypeNotPersistent() check // Paper - custom despawn distances + this.die(); +- } else if (d3 < 1024.0D) { ++ } else if (d3 < world.paperConfig.softDespawnDistance) { // Paper - custom despawn distances + this.ticksFarFromPlayer = 0; + } + } +-- +2.7.2 + diff --git a/Spigot-Server-Patches/0012-Toggle-for-player-interact-limiter.patch b/Spigot-Server-Patches/0012-Toggle-for-player-interact-limiter.patch deleted file mode 100644 index 4db51ee3b9..0000000000 --- a/Spigot-Server-Patches/0012-Toggle-for-player-interact-limiter.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 0c1371c36a93de12180683ee8c33bb9fb8d61cec Mon Sep 17 00:00:00 2001 -From: Zach Brown -Date: Sat, 7 Mar 2015 21:07:10 -0600 -Subject: [PATCH] Toggle for player interact limiter - - -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 68358e9..7ea74c0 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -661,7 +661,8 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList - PlayerConnectionUtils.ensureMainThread(packetplayinblockplace, this, this.player.u()); - WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); - boolean throttled = false; -- if (lastPlace != -1 && packetplayinblockplace.timestamp - lastPlace < 30 && packets++ >= 4) { -+ // PaperSpigot - Allow disabling the player interaction limiter -+ if (org.github.paperspigot.PaperSpigotConfig.interactLimitEnabled && lastPlace != -1 && packetplayinblockplace.timestamp - lastPlace < 30 && packets++ >= 4) { - throttled = true; - } else if ( packetplayinblockplace.timestamp - lastPlace >= 30 || lastPlace == -1 ) - { -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java -index 85ee51b..b0dd5b0 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java -@@ -144,4 +144,14 @@ public class PaperSpigotConfig - { - babyZombieMovementSpeed = getDouble( "settings.baby-zombie-movement-speed", 0.5D ); // Player moves at 0.1F, for reference - } -+ -+ public static boolean interactLimitEnabled; -+ private static void interactLimitEnabled() -+ { -+ interactLimitEnabled = getBoolean( "settings.limit-player-interactions", true ); -+ if ( !interactLimitEnabled ) -+ { -+ Bukkit.getLogger().log( Level.INFO, "Disabling player interaction limiter, your server may be more vulnerable to malicious users" ); -+ } -+ } - } --- -2.5.1 - diff --git a/Spigot-Server-Patches/0013-Allow-for-toggling-of-spawn-chunks.patch b/Spigot-Server-Patches/0013-Allow-for-toggling-of-spawn-chunks.patch new file mode 100644 index 0000000000..d3f7fa1770 --- /dev/null +++ b/Spigot-Server-Patches/0013-Allow-for-toggling-of-spawn-chunks.patch @@ -0,0 +1,36 @@ +From 44d08ff1133630f18994c477b7408a9bca02da16 Mon Sep 17 00:00:00 2001 +From: Dmck2b +Date: Tue, 1 Mar 2016 13:59:50 -0600 +Subject: [PATCH] Allow for toggling of spawn chunks + + +diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index a662f26..41747bd 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -119,4 +119,10 @@ public class PaperWorldConfig { + softDespawnDistance = softDespawnDistance*softDespawnDistance; + hardDespawnDistance = hardDespawnDistance*hardDespawnDistance; + } ++ ++ public boolean keepSpawnInMemory; ++ private void keepSpawnInMemory() { ++ keepSpawnInMemory = getBoolean("keep-spawn-loaded", true); ++ log("Keep spawn chunk loaded: " + keepSpawnInMemory); ++ } + } +diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java +index 93dbc9c..d3d92a3 100644 +--- a/src/main/java/net/minecraft/server/World.java ++++ b/src/main/java/net/minecraft/server/World.java +@@ -168,6 +168,7 @@ public abstract class World implements IBlockAccess { + this.isClientSide = flag; + this.N = worldprovider.getWorldBorder(); + this.getServer().addWorld(this.world); // CraftBukkit ++ this.keepSpawnInMemory = this.paperConfig.keepSpawnInMemory; // Paper + timings = new SpigotTimings.WorldTimingsHandler(this); // Spigot - code below can generate new world and access timings + this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime); + this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime); +-- +2.7.2 + diff --git a/Spigot-Server-Patches/0013-Player-Exhaustion-Multipliers.patch b/Spigot-Server-Patches/0013-Player-Exhaustion-Multipliers.patch deleted file mode 100644 index d1441904fd..0000000000 --- a/Spigot-Server-Patches/0013-Player-Exhaustion-Multipliers.patch +++ /dev/null @@ -1,59 +0,0 @@ -From fbdc8216d9f45a2c13cdf26343f5306ccc73664b Mon Sep 17 00:00:00 2001 -From: gsand -Date: Sat, 7 Mar 2015 21:35:14 -0600 -Subject: [PATCH] Player Exhaustion Multipliers - - -diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java -index 5e91e82..c26975a 100644 ---- a/src/main/java/net/minecraft/server/Block.java -+++ b/src/main/java/net/minecraft/server/Block.java -@@ -566,7 +566,7 @@ public class Block { - - public void a(World world, EntityHuman entityhuman, BlockPosition blockposition, IBlockData iblockdata, TileEntity tileentity) { - entityhuman.b(StatisticList.MINE_BLOCK_COUNT[getId(this)]); -- entityhuman.applyExhaustion(0.025F); -+ entityhuman.applyExhaustion(world.paperSpigotConfig.blockBreakExhaustion); // PaperSpigot - Configurable block break exhaustion - if (this.I() && EnchantmentManager.hasSilkTouchEnchantment(entityhuman)) { - ItemStack itemstack = this.i(iblockdata); - -diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index e705b86..ae2c44e 100644 ---- a/src/main/java/net/minecraft/server/EntityHuman.java -+++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -1370,13 +1370,13 @@ public abstract class EntityHuman extends EntityLiving { - i = Math.round(MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F); - if (i > 0) { - this.a(StatisticList.p, i); -- this.applyExhaustion(0.015F * (float) i * 0.01F); -+ this.applyExhaustion(world.paperSpigotConfig.playerSwimmingExhaustion * (float) i * 0.01F); // PaperSpigot - Configurable swimming exhaustion - } - } else if (this.V()) { - i = Math.round(MathHelper.sqrt(d0 * d0 + d2 * d2) * 100.0F); - if (i > 0) { - this.a(StatisticList.l, i); -- this.applyExhaustion(0.015F * (float) i * 0.01F); -+ this.applyExhaustion(world.paperSpigotConfig.playerSwimmingExhaustion * (float) i * 0.01F); // PaperSpigot - Configurable swimming (diving) exhaustion - } - } else if (this.k_()) { - if (d1 > 0.0D) { -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index 5ae9afb..23a2a96 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -114,4 +114,12 @@ public class PaperSpigotWorldConfig - fishingMinTicks = getInt( "fishing-time-range.MinimumTicks", 100 ); - fishingMaxTicks = getInt( "fishing-time-range.MaximumTicks", 900 ); - } -+ -+ public float blockBreakExhaustion; -+ public float playerSwimmingExhaustion; -+ private void exhaustionValues() -+ { -+ blockBreakExhaustion = getFloat( "player-exhaustion.block-break", 0.025F ); -+ playerSwimmingExhaustion = getFloat( "player-exhaustion.swimming", 0.015F ); -+ } - } --- -2.5.1 - diff --git a/Spigot-Server-Patches/0014-Add-configurable-despawn-distances-for-living-entiti.patch b/Spigot-Server-Patches/0014-Add-configurable-despawn-distances-for-living-entiti.patch deleted file mode 100644 index 9289764800..0000000000 --- a/Spigot-Server-Patches/0014-Add-configurable-despawn-distances-for-living-entiti.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 38ac29dbbda20d4ba78b51249c311026d597a50d Mon Sep 17 00:00:00 2001 -From: Suddenly -Date: Sat, 7 Mar 2015 21:40:48 -0600 -Subject: [PATCH] Add configurable despawn distances for living entities - - -diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index aa38fe6..2d4d34c 100644 ---- a/src/main/java/net/minecraft/server/EntityInsentient.java -+++ b/src/main/java/net/minecraft/server/EntityInsentient.java -@@ -439,13 +439,13 @@ public abstract class EntityInsentient extends EntityLiving { - double d2 = entityhuman.locZ - this.locZ; - double d3 = d0 * d0 + d1 * d1 + d2 * d2; - -- if (d3 > 16384.0D) { // CraftBukkit - remove isTypeNotPersistent() check -+ if (d3 > this.world.paperSpigotConfig.hardDespawnDistance) { // CraftBukkit - remove isTypeNotPersistent() check // PaperSpigot - custom despawn distances - this.die(); - } - -- if (this.ticksFarFromPlayer > 600 && this.random.nextInt(800) == 0 && d3 > 1024.0D) { // CraftBukkit - remove isTypeNotPersistent() check -+ if (this.ticksFarFromPlayer > 600 && this.random.nextInt(800) == 0 && d3 > this.world.paperSpigotConfig.softDespawnDistance) { // CraftBukkit - remove isTypeNotPersistent() check // PaperSpigot - custom despawn distance - this.die(); -- } else if (d3 < 1024.0D) { -+ } else if (d3 < this.world.paperSpigotConfig.softDespawnDistance) { // PaperSpigot - custom despawn distances - this.ticksFarFromPlayer = 0; - } - } -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index 23a2a96..1164186 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -122,4 +122,21 @@ public class PaperSpigotWorldConfig - blockBreakExhaustion = getFloat( "player-exhaustion.block-break", 0.025F ); - playerSwimmingExhaustion = getFloat( "player-exhaustion.swimming", 0.015F ); - } -+ -+ public int softDespawnDistance; -+ public int hardDespawnDistance; -+ private void despawnDistances() -+ { -+ softDespawnDistance = getInt( "despawn-ranges.soft", 32 ); // 32^2 = 1024, Minecraft Default -+ hardDespawnDistance = getInt( "despawn-ranges.hard", 128 ); // 128^2 = 16384, Minecraft Default; -+ -+ if ( softDespawnDistance > hardDespawnDistance ) { -+ softDespawnDistance = hardDespawnDistance; -+ } -+ -+ log( "Living Entity Despawn Ranges: Soft: " + softDespawnDistance + " Hard: " + hardDespawnDistance ); -+ -+ softDespawnDistance = softDespawnDistance*softDespawnDistance; -+ hardDespawnDistance = hardDespawnDistance*hardDespawnDistance; -+ } - } --- -2.5.1 - diff --git a/Spigot-Server-Patches/0014-Drop-falling-block-and-tnt-entities-at-the-specified.patch b/Spigot-Server-Patches/0014-Drop-falling-block-and-tnt-entities-at-the-specified.patch new file mode 100644 index 0000000000..01c083e620 --- /dev/null +++ b/Spigot-Server-Patches/0014-Drop-falling-block-and-tnt-entities-at-the-specified.patch @@ -0,0 +1,68 @@ +From e29729e0e0500cc46e355b654b01114a03605c96 Mon Sep 17 00:00:00 2001 +From: Byteflux +Date: Tue, 1 Mar 2016 14:14:15 -0600 +Subject: [PATCH] Drop falling block and tnt entities at the specified height + + +diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index 41747bd..0d0cca5 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -125,4 +125,14 @@ public class PaperWorldConfig { + keepSpawnInMemory = getBoolean("keep-spawn-loaded", true); + log("Keep spawn chunk loaded: " + keepSpawnInMemory); + } ++ ++ public int fallingBlockHeightNerf; ++ public int entityTNTHeightNerf; ++ private void heightNerfs() { ++ fallingBlockHeightNerf = getInt("falling-block-height-nerf", 0); ++ entityTNTHeightNerf = getInt("tnt-entity-height-nerf", 0); ++ ++ if (fallingBlockHeightNerf != 0) log("Falling Block Height Limit set to Y: " + fallingBlockHeightNerf); ++ if (entityTNTHeightNerf != 0) log("TNT Entity Height Limit set to Y: " + entityTNTHeightNerf); ++ } + } +diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java +index 86cb592..9c506ed 100644 +--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java ++++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java +@@ -76,6 +76,17 @@ public class EntityFallingBlock extends Entity { + + this.motY -= 0.03999999910593033D; + this.move(this.motX, this.motY, this.motZ); ++ ++ // Paper start - Configurable EntityFallingBlock height nerf ++ if (this.world.paperConfig.fallingBlockHeightNerf != 0 && this.locY > this.world.paperConfig.fallingBlockHeightNerf) { ++ if (this.dropItem) { ++ this.a(new ItemStack(block, 1, block.getDropData(this.block)), 0.0F); ++ } ++ ++ this.die(); ++ } ++ // Paper end ++ + this.motX *= 0.9800000190734863D; + this.motY *= 0.9800000190734863D; + this.motZ *= 0.9800000190734863D; +diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java +index 35ed2a6..564ea37 100644 +--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java ++++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java +@@ -51,6 +51,13 @@ public class EntityTNTPrimed extends Entity { + this.lastZ = this.locZ; + this.motY -= 0.03999999910593033D; + this.move(this.motX, this.motY, this.motZ); ++ ++ // Paper start - Configurable TNT entity height nerf ++ if (this.world.paperConfig.entityTNTHeightNerf != 0 && this.locY > this.world.paperConfig.entityTNTHeightNerf) { ++ this.die(); ++ } ++ // Paper end ++ + this.motX *= 0.9800000190734863D; + this.motY *= 0.9800000190734863D; + this.motZ *= 0.9800000190734863D; +-- +2.7.2 + diff --git a/Spigot-Server-Patches/0015-Allow-for-toggling-of-spawn-chunks.patch b/Spigot-Server-Patches/0015-Allow-for-toggling-of-spawn-chunks.patch deleted file mode 100644 index 7c580731c2..0000000000 --- a/Spigot-Server-Patches/0015-Allow-for-toggling-of-spawn-chunks.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 3688509ebd26b57e70a5d28caa24be2d44e3f387 Mon Sep 17 00:00:00 2001 -From: Dmck2b -Date: Sat, 7 Mar 2015 21:50:40 -0600 -Subject: [PATCH] Allow for toggling of spawn chunks - - -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index af60059..03eb5f2 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -230,6 +230,7 @@ public abstract class World implements IBlockAccess { - }); - this.getServer().addWorld(this.world); - // CraftBukkit end -+ this.keepSpawnInMemory = this.paperSpigotConfig.keepSpawnInMemory; // PaperSpigot - timings = new SpigotTimings.WorldTimingsHandler(this); // Spigot - code below can generate new world and access timings - this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime); - this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime); -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index 1164186..b7703a0 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -139,4 +139,11 @@ public class PaperSpigotWorldConfig - softDespawnDistance = softDespawnDistance*softDespawnDistance; - hardDespawnDistance = hardDespawnDistance*hardDespawnDistance; - } -+ -+ public boolean keepSpawnInMemory; -+ private void keepSpawnInMemory() -+ { -+ keepSpawnInMemory = getBoolean( "keep-spawn-loaded", true ); -+ log( "Keep spawn chunk loaded: " + keepSpawnInMemory ); -+ } - } --- -2.5.1 - diff --git a/Spigot-Server-Patches/0017-Configurable-speed-for-water-flowing-over-lava.patch b/Spigot-Server-Patches/0015-Configurable-speed-for-water-flowing-over-lava.patch similarity index 50% rename from Spigot-Server-Patches/0017-Configurable-speed-for-water-flowing-over-lava.patch rename to Spigot-Server-Patches/0015-Configurable-speed-for-water-flowing-over-lava.patch index 695f7d052d..01ece2b5d2 100644 --- a/Spigot-Server-Patches/0017-Configurable-speed-for-water-flowing-over-lava.patch +++ b/Spigot-Server-Patches/0015-Configurable-speed-for-water-flowing-over-lava.patch @@ -1,11 +1,26 @@ -From 89acd9868cbace41415af5c22266009e9e7b8764 Mon Sep 17 00:00:00 2001 +From dffc7e903b5996c39b84fca2262852fa7f13f24b Mon Sep 17 00:00:00 2001 From: Byteflux -Date: Sat, 7 Mar 2015 22:17:03 -0600 +Date: Tue, 1 Mar 2016 14:27:13 -0600 Subject: [PATCH] Configurable speed for water flowing over lava +diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index 0d0cca5..6ccd700 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -135,4 +135,10 @@ public class PaperWorldConfig { + if (fallingBlockHeightNerf != 0) log("Falling Block Height Limit set to Y: " + fallingBlockHeightNerf); + if (entityTNTHeightNerf != 0) log("TNT Entity Height Limit set to Y: " + entityTNTHeightNerf); + } ++ ++ public int waterOverLavaFlowSpeed; ++ private void waterOverLawFlowSpeed() { ++ waterOverLavaFlowSpeed = getInt("water-over-lava-flow-speed", 5); ++ log("Water over lava flow speed: " + waterOverLavaFlowSpeed); ++ } + } diff --git a/src/main/java/net/minecraft/server/BlockFlowing.java b/src/main/java/net/minecraft/server/BlockFlowing.java -index 5d36af3..de1dddb 100644 +index 800ffdc..036e861 100644 --- a/src/main/java/net/minecraft/server/BlockFlowing.java +++ b/src/main/java/net/minecraft/server/BlockFlowing.java @@ -35,7 +35,7 @@ public class BlockFlowing extends BlockFluids { @@ -13,50 +28,34 @@ index 5d36af3..de1dddb 100644 } - int j = this.a(world); -+ int j = this.getFlowSpeed(world, blockposition); // PaperSpigot ++ int j = this.getFlowSpeed(world, blockposition); // Paper int k; if (i > 0) { -@@ -259,8 +259,22 @@ public class BlockFlowing extends BlockFluids { +@@ -263,8 +263,22 @@ public class BlockFlowing extends BlockFluids { public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata) { if (!this.e(world, blockposition, iblockdata)) { - world.a(blockposition, (Block) this, this.a(world)); -+ world.a(blockposition, (Block) this, this.getFlowSpeed(world, blockposition)); // PaperSpigot ++ world.a(blockposition, (Block) this, this.getFlowSpeed(world, blockposition)); // Paper } } + + /** -+ * PaperSpigot - Get flow speed. Throttle if its water and flowing adjacent to lava ++ * Paper - Get flow speed. Throttle if its water and flowing adjacent to lava + */ + public int getFlowSpeed(World world, BlockPosition blockposition) { -+ if (this.getMaterial() == Material.WATER && ( -+ world.getType(blockposition.north(1)).getBlock().getMaterial() == Material.LAVA || -+ world.getType(blockposition.south(1)).getBlock().getMaterial() == Material.LAVA || -+ world.getType(blockposition.west(1)).getBlock().getMaterial() == Material.LAVA || -+ world.getType(blockposition.east(1)).getBlock().getMaterial() == Material.LAVA)) { -+ return world.paperSpigotConfig.waterOverLavaFlowSpeed; ++ if (this.material == Material.WATER && ( ++ world.getType(blockposition.north(1)).getBlock().material == Material.LAVA || ++ world.getType(blockposition.south(1)).getBlock().material == Material.LAVA || ++ world.getType(blockposition.west(1)).getBlock().material == Material.LAVA || ++ world.getType(blockposition.east(1)).getBlock().material == Material.LAVA)) { ++ return world.paperConfig.waterOverLavaFlowSpeed; + } + return super.a(world); -+ } - } -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index 52c05a8..781cf75 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -166,4 +166,11 @@ public class PaperSpigotWorldConfig - log( "TNT Entity Height Limit set to Y: " + tntEntityHeightNerf ); - } - } -+ -+ public int waterOverLavaFlowSpeed; -+ private void waterOverLavaFlowSpeed() -+ { -+ waterOverLavaFlowSpeed = getInt( "water-over-lava-flow-speed", 5 ); -+ log( "Water over lava flow speed: " + waterOverLavaFlowSpeed ); + } } -- -2.7.0 +2.7.2 diff --git a/Spigot-Server-Patches/0016-Drop-falling-block-and-tnt-entities-at-the-specified.patch b/Spigot-Server-Patches/0016-Drop-falling-block-and-tnt-entities-at-the-specified.patch deleted file mode 100644 index 8a62448e58..0000000000 --- a/Spigot-Server-Patches/0016-Drop-falling-block-and-tnt-entities-at-the-specified.patch +++ /dev/null @@ -1,78 +0,0 @@ -From 19a21a3299d8e33e9d2e74f2ec7216689a03c8e5 Mon Sep 17 00:00:00 2001 -From: Byteflux -Date: Sat, 7 Mar 2015 22:03:47 -0600 -Subject: [PATCH] Drop falling block and tnt entities at the specified height - - -diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java -index 7a42040..95c188b 100644 ---- a/src/main/java/net/minecraft/server/EntityFallingBlock.java -+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java -@@ -69,6 +69,17 @@ public class EntityFallingBlock extends Entity { - - this.motY -= 0.03999999910593033D; - this.move(this.motX, this.motY, this.motZ); -+ -+ // PaperSpigot start - Drop falling blocks above the specified height -+ if (this.world.paperSpigotConfig.fallingBlockHeightNerf != 0 && this.locY > this.world.paperSpigotConfig.fallingBlockHeightNerf) { -+ if (this.dropItem) { -+ this.a(new ItemStack(block, 1, block.getDropData(this.block)), 0.0F); -+ } -+ -+ this.die(); -+ } -+ // PaperSpigot end -+ - this.motX *= 0.9800000190734863D; - this.motY *= 0.9800000190734863D; - this.motZ *= 0.9800000190734863D; -diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java -index 2d22327..d2d94d7 100644 ---- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java -+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java -@@ -47,6 +47,13 @@ public class EntityTNTPrimed extends Entity { - this.lastZ = this.locZ; - this.motY -= 0.03999999910593033D; - this.move(this.motX, this.motY, this.motZ); -+ -+ // PaperSpigot start - Drop TNT entities above the specified height -+ if (this.world.paperSpigotConfig.tntEntityHeightNerf != 0 && this.locY > this.world.paperSpigotConfig.tntEntityHeightNerf) { -+ this.die(); -+ } -+ // PaperSpigot end -+ - this.motX *= 0.9800000190734863D; - this.motY *= 0.9800000190734863D; - this.motZ *= 0.9800000190734863D; -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index b7703a0..52c05a8 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -146,4 +146,24 @@ public class PaperSpigotWorldConfig - keepSpawnInMemory = getBoolean( "keep-spawn-loaded", true ); - log( "Keep spawn chunk loaded: " + keepSpawnInMemory ); - } -+ -+ public int fallingBlockHeightNerf; -+ private void fallingBlockheightNerf() -+ { -+ fallingBlockHeightNerf = getInt( "falling-block-height-nerf", 0 ); -+ if ( fallingBlockHeightNerf != 0 ) -+ { -+ log( "Falling Block Height Limit set to Y: " + fallingBlockHeightNerf ); -+ } -+ } -+ -+ public int tntEntityHeightNerf; -+ private void tntEntityHeightNerf() -+ { -+ tntEntityHeightNerf = getInt( "tnt-entity-height-nerf", 0 ); -+ if ( tntEntityHeightNerf != 0 ) -+ { -+ log( "TNT Entity Height Limit set to Y: " + tntEntityHeightNerf ); -+ } -+ } - } --- -2.7.0 - diff --git a/Spigot-Server-Patches/0019-Show-PaperSpigot-in-client-crashes-server-lists-and-.patch b/Spigot-Server-Patches/0016-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch similarity index 61% rename from Spigot-Server-Patches/0019-Show-PaperSpigot-in-client-crashes-server-lists-and-.patch rename to Spigot-Server-Patches/0016-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch index 7490217af1..1f00bd43a5 100644 --- a/Spigot-Server-Patches/0019-Show-PaperSpigot-in-client-crashes-server-lists-and-.patch +++ b/Spigot-Server-Patches/0016-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch @@ -1,25 +1,38 @@ -From 98de4059bdb6cc1443c58be63c829dfea29d11cb Mon Sep 17 00:00:00 2001 +From 61ede748726903b893c445653d8efe03a567607d Mon Sep 17 00:00:00 2001 From: Zach Brown -Date: Sat, 7 Mar 2015 22:55:25 -0600 -Subject: [PATCH] Show 'PaperSpigot' in client crashes, server lists, and - Mojang stats +Date: Tue, 1 Mar 2016 14:32:43 -0600 +Subject: [PATCH] Show 'Paper' in client crashes, server lists, and Mojang + stats diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 1d29ae7..9fc2cfa 100644 +index 89e6ad3..7b99c2f 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1023,7 +1023,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs +@@ -1017,7 +1017,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs } public String getServerModName() { - return "Spigot"; // Spigot - Spigot > // CraftBukkit - cb > vanilla! -+ return "PaperSpigot"; // PaperSpigot - PaperSpigot > // Spigot - Spigot > // CraftBukkit - cb > vanilla! ++ return "Paper"; //Paper - Paper > // Spigot - Spigot > // CraftBukkit - cb > vanilla! } public CrashReport b(CrashReport crashreport) { +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +index 7e5870f..40998cf 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +@@ -130,7 +130,7 @@ import net.md_5.bungee.api.chat.BaseComponent; + + public final class CraftServer implements Server { + private static final Player[] EMPTY_PLAYER_ARRAY = new Player[0]; +- private final String serverName = "CraftBukkit"; ++ private final String serverName = "Paper"; + private final String serverVersion; + private final String bukkitVersion = Versioning.getBukkitVersion(); + private final Logger logger = Logger.getLogger("Minecraft"); diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java -index 94a3d42..c8f619a 100644 +index 94a3d42..3ed983c 100644 --- a/src/main/java/org/spigotmc/WatchdogThread.java +++ b/src/main/java/org/spigotmc/WatchdogThread.java @@ -19,7 +19,7 @@ public class WatchdogThread extends Thread @@ -27,7 +40,7 @@ index 94a3d42..c8f619a 100644 private WatchdogThread(long timeoutTime, boolean restart) { - super( "Spigot Watchdog Thread" ); -+ super( "PaperSpigot Watchdog Thread" ); ++ super( "Paper Watchdog Thread" ); this.timeoutTime = timeoutTime; this.restart = restart; } @@ -36,10 +49,10 @@ index 94a3d42..c8f619a 100644 Logger log = Bukkit.getServer().getLogger(); log.log( Level.SEVERE, "The server has stopped responding!" ); - log.log( Level.SEVERE, "Please report this to http://www.spigotmc.org/" ); -+ log.log( Level.SEVERE, "Please report this to PaperSpigot directly!" ); ++ log.log( Level.SEVERE, "Please report this to https://aquifermc.org/" ); log.log( Level.SEVERE, "Be sure to include ALL relevant console errors and Minecraft crash reports" ); - log.log( Level.SEVERE, "Spigot version: " + Bukkit.getServer().getVersion() ); -+ log.log( Level.SEVERE, "PaperSpigot version: " + Bukkit.getServer().getVersion() ); ++ log.log( Level.SEVERE, "Paper version: " + Bukkit.getServer().getVersion() ); // if(net.minecraft.server.World.haveWeSilencedAPhysicsCrash) { @@ -48,10 +61,10 @@ index 94a3d42..c8f619a 100644 // log.log( Level.SEVERE, "------------------------------" ); - log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Spigot!):" ); -+ log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to PaperSpigot!):" ); ++ log.log( Level.SEVERE, "Server thread dump (Look for plugins here before reporting to Paper!):" ); dumpThread( ManagementFactory.getThreadMXBean().getThreadInfo( MinecraftServer.getServer().primaryThread.getId(), Integer.MAX_VALUE ), log ); log.log( Level.SEVERE, "------------------------------" ); // -- -2.6.1.windows.1 +2.7.2 diff --git a/Spigot-Server-Patches/0018-Player-affects-spawning-API.patch b/Spigot-Server-Patches/0017-Player-affects-spawning-API.patch similarity index 57% rename from Spigot-Server-Patches/0018-Player-affects-spawning-API.patch rename to Spigot-Server-Patches/0017-Player-affects-spawning-API.patch index 604d066316..94b4ec3bb1 100644 --- a/Spigot-Server-Patches/0018-Player-affects-spawning-API.patch +++ b/Spigot-Server-Patches/0017-Player-affects-spawning-API.patch @@ -1,122 +1,78 @@ -From afaf20bf4d69579819800ee7daa8c9a677ebe318 Mon Sep 17 00:00:00 2001 +From 068300d37fa5f1d5782feaf840b64294e69bd72e Mon Sep 17 00:00:00 2001 From: Jedediah Smith -Date: Mon, 18 May 2015 17:52:45 -0500 +Date: Tue, 1 Mar 2016 14:47:52 -0600 Subject: [PATCH] Player affects spawning API diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index ae2c44e..b901c69 100644 +index d8161a8..5fcd6b8 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -60,6 +60,7 @@ public abstract class EntityHuman extends EntityLiving { - private final GameProfile bH; - private boolean bI = false; +@@ -63,6 +63,7 @@ public abstract class EntityHuman extends EntityLiving { + private ItemStack bT = null; + private final ItemCooldown bU = this.l(); public EntityFishingHook hookedFish; -+ public boolean affectsSpawning = true; // PaperSpigot ++ public boolean affectsSpawning = true; // Paper // CraftBukkit start public boolean fauxSleeping; diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index 2d4d34c..b82b984 100644 +index 916c913..c04490a 100644 --- a/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java -@@ -431,7 +431,7 @@ public abstract class EntityInsentient extends EntityLiving { +@@ -600,7 +600,7 @@ public abstract class EntityInsentient extends EntityLiving { if (this.persistent) { this.ticksFarFromPlayer = 0; } else { - EntityHuman entityhuman = this.world.findNearbyPlayer(this, -1.0D); -+ EntityHuman entityhuman = this.world.findNearbyPlayerWhoAffectsSpawning(this, -1.0D); // PaperSpigot - Affects Spawning API ++ EntityHuman entityhuman = this.world.findNearbyPlayerWhoAffectsSpawning(this, -1.0D); // Paper - Affects Spawning API if (entityhuman != null) { double d0 = entityhuman.locX - this.locX; diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -index 6004e23..ebd1e36 100644 +index efe792b..917b626 100644 --- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -@@ -52,7 +52,7 @@ public abstract class MobSpawnerAbstract { - private boolean g() { +@@ -32,7 +32,7 @@ public abstract class MobSpawnerAbstract { + private boolean h() { BlockPosition blockposition = this.b(); - return this.a().isPlayerNearby((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, (double) this.requiredPlayerRange); -+ return this.a().isPlayerNearbyWhoAffectsSpawning((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, (double) this.requiredPlayerRange); // PaperSpigot - Affects Spawning API ++ return this.a().isPlayerNearbyWhoAffectsSpawning((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, (double) this.requiredPlayerRange); // Paper - Affects spawning API } public void c() { diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java -index 3964e3f..611b8fd 100644 +index 9e19dfd..b724586 100644 --- a/src/main/java/net/minecraft/server/SpawnerCreature.java +++ b/src/main/java/net/minecraft/server/SpawnerCreature.java -@@ -52,7 +52,7 @@ public final class SpawnerCreature { +@@ -50,7 +50,7 @@ public final class SpawnerCreature { while (iterator.hasNext()) { EntityHuman entityhuman = (EntityHuman) iterator.next(); - if (!entityhuman.isSpectator()) { -+ if (!entityhuman.isSpectator() || !entityhuman.affectsSpawning) { // PaperSpigot ++ if (!entityhuman.isSpectator() || !entityhuman.affectsSpawning) { int l = MathHelper.floor(entityhuman.locX / 16.0D); j = MathHelper.floor(entityhuman.locZ / 16.0D); -@@ -156,7 +156,7 @@ public final class SpawnerCreature { +@@ -160,7 +160,7 @@ public final class SpawnerCreature { float f = (float) j3 + 0.5F; float f1 = (float) l3 + 0.5F; -- if (!worldserver.isPlayerNearby((double) f, (double) k3, (double) f1, 24.0D) && blockposition.c((double) f, (double) k3, (double) f1) >= 576.0D) { -+ if (!worldserver.isPlayerNearbyWhoAffectsSpawning((double) f, (double) k3, (double) f1, 24.0D) && blockposition.c((double) f, (double) k3, (double) f1) >= 576.0D) { // PaperSpigot - Affects Spawning API +- if (!worldserver.isPlayerNearby((double) f, (double) k3, (double) f1, 24.0D) && blockposition.distanceSquared((double) f, (double) k3, (double) f1) >= 576.0D) { ++ if (!worldserver.isPlayerNearbyWhoAffectsSpawning((double) f, (double) k3, (double) f1, 24.0D) && blockposition.distanceSquared((double) f, (double) k3, (double) f1) >= 576.0D) { if (biomebase_biomemeta == null) { - biomebase_biomemeta = worldserver.a(enumcreaturetype, blockposition2); + biomebase_biomemeta = worldserver.a(enumcreaturetype, (BlockPosition) blockposition_mutableblockposition); if (biomebase_biomemeta == null) { diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 03eb5f2..641db2a 100644 +index 9bee723..1c5718e 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -2,35 +2,23 @@ package net.minecraft.server; - - import com.google.common.base.Predicate; - import com.google.common.collect.Lists; --import com.google.common.collect.Sets; --import java.util.ArrayList; --import java.util.Calendar; --import java.util.Collection; --import java.util.Iterator; --import java.util.List; --import java.util.Random; --import java.util.Set; --import java.util.UUID; --import java.util.concurrent.Callable; -- --// CraftBukkit start - import com.google.common.collect.Maps; --import java.util.Map; -- - import org.bukkit.Bukkit; - import org.bukkit.block.BlockState; --import org.bukkit.craftbukkit.util.CraftMagicNumbers; --import org.bukkit.craftbukkit.util.LongHashSet; --import org.bukkit.craftbukkit.SpigotTimings; // Spigot --import org.bukkit.generator.ChunkGenerator; - import org.bukkit.craftbukkit.CraftServer; - import org.bukkit.craftbukkit.CraftWorld; -+import org.bukkit.craftbukkit.SpigotTimings; - import org.bukkit.craftbukkit.event.CraftEventFactory; -+import org.bukkit.craftbukkit.util.CraftMagicNumbers; - import org.bukkit.event.block.BlockCanBuildEvent; - import org.bukkit.event.block.BlockPhysicsEvent; - import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; --import org.bukkit.event.weather.WeatherChangeEvent; --import org.bukkit.event.weather.ThunderChangeEvent; -+import org.bukkit.generator.ChunkGenerator; -+ -+import java.util.*; -+import java.util.concurrent.Callable; -+ -+// CraftBukkit start - // CraftBukkit end - - public abstract class World implements IBlockAccess { -@@ -2807,6 +2795,53 @@ public abstract class World implements IBlockAccess { - return false; +@@ -2650,6 +2650,53 @@ public abstract class World implements IBlockAccess { + return i; } -+ // PaperSpigot start - Modified methods for affects spawning ++ // Paper start - Modified methods for affects spawning + public EntityHuman findNearbyPlayerWhoAffectsSpawning(Entity entity, double d0) { + return this.findNearbyPlayerWhoAffectsSpawning(entity.locX, entity.locY, entity.locZ, d0); + } @@ -161,42 +117,34 @@ index 03eb5f2..641db2a 100644 + + return false; + } -+ // PaperSpigot end ++ // Paper end + - public EntityHuman a(String s) { - for (int i = 0; i < this.players.size(); ++i) { - EntityHuman entityhuman = (EntityHuman) this.players.get(i); + public EntityHuman findNearbyPlayer(Entity entity, double d0) { + return this.a(entity.locX, entity.locY, entity.locZ, d0, false); + } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 35608b7..a9b4160 100644 +index 9298344..a9f55ac 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -7,6 +7,7 @@ import io.netty.buffer.Unpooled; +@@ -1416,6 +1416,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - import java.io.ByteArrayOutputStream; - import java.io.IOException; -+import java.lang.Override; - import java.net.InetSocketAddress; - import java.net.SocketAddress; - import java.util.ArrayList; -@@ -1470,6 +1471,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - packet.components = components; - getHandle().playerConnection.sendPacket(packet); - } -+ -+ // PaperSpigot start - Implement affects spawning API -+ @Override -+ public boolean getAffectsSpawning() { -+ return getHandle().affectsSpawning; -+ } -+ -+ @Override -+ public void setAffectsSpawning(boolean affects) { -+ getHandle().affectsSpawning = affects; -+ } -+ // PaperSpigot end - }; + } - public Player.Spigot spigot() ++ // Paper start ++ @Override ++ public boolean getAffectsSpawning() { ++ return getHandle().affectsSpawning; ++ } ++ ++ @Override ++ public void setAffectsSpawning(boolean affects) { ++ getHandle().affectsSpawning = affects; ++ } ++ // Paper end ++ + // Spigot start + private final Player.Spigot spigot = new Player.Spigot() + { -- -2.5.1 +2.7.2 diff --git a/Spigot-Server-Patches/0020-Metrics.patch b/Spigot-Server-Patches/0018-Metrics.patch similarity index 78% rename from Spigot-Server-Patches/0020-Metrics.patch rename to Spigot-Server-Patches/0018-Metrics.patch index 78d9e7ed1c..7a922f7802 100644 --- a/Spigot-Server-Patches/0020-Metrics.patch +++ b/Spigot-Server-Patches/0018-Metrics.patch @@ -1,11 +1,11 @@ -From a7cb1698f46a168af727798e55ef5116bf8ddde2 Mon Sep 17 00:00:00 2001 +From f137764bcd4a87ce47c095d5cb18eafc33d93949 Mon Sep 17 00:00:00 2001 From: Zach Brown -Date: Wed, 18 Mar 2015 22:55:25 -0600 +Date: Tue, 1 Mar 2016 14:54:32 -0600 Subject: [PATCH] Metrics diff --git a/src/main/java/org/spigotmc/Metrics.java b/src/main/java/org/spigotmc/Metrics.java -index a5fd59d..558989c 100644 +index a5fd59d..680283c 100644 --- a/src/main/java/org/spigotmc/Metrics.java +++ b/src/main/java/org/spigotmc/Metrics.java @@ -344,7 +344,7 @@ public class Metrics { @@ -13,10 +13,10 @@ index a5fd59d..558989c 100644 private void postPlugin(final boolean isPing) throws IOException { // Server software specific section - String pluginName = "Spigot"; -+ String pluginName = "PaperSpigot"; // PaperSpigot - We need some usage data ++ String pluginName = "PaperSpigot"; // Paper - Keep old name for legacy data boolean onlineMode = Bukkit.getServer().getOnlineMode(); // TRUE if online mode is enabled String pluginVersion = (Metrics.class.getPackage().getImplementationVersion() != null) ? Metrics.class.getPackage().getImplementationVersion() : "unknown"; String serverVersion = Bukkit.getVersion(); -- -2.6.0 +2.7.2 diff --git a/Spigot-Server-Patches/0019-Remove-invalid-mob-spawner-tile-entities.patch b/Spigot-Server-Patches/0019-Remove-invalid-mob-spawner-tile-entities.patch new file mode 100644 index 0000000000..550123aaad --- /dev/null +++ b/Spigot-Server-Patches/0019-Remove-invalid-mob-spawner-tile-entities.patch @@ -0,0 +1,24 @@ +From c17ea8cfc18f7783044c50d9fc4bdb528ce2e83d Mon Sep 17 00:00:00 2001 +From: Byteflux +Date: Tue, 1 Mar 2016 15:08:03 -0600 +Subject: [PATCH] Remove invalid mob spawner tile entities + + +diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java +index f2bb134..2f37957 100644 +--- a/src/main/java/net/minecraft/server/Chunk.java ++++ b/src/main/java/net/minecraft/server/Chunk.java +@@ -717,6 +717,10 @@ public class Chunk { + tileentity.z(); + this.tileEntities.put(blockposition, tileentity); + // CraftBukkit start ++ // Paper start - Remove invalid mob spawner tile entities ++ } else if (tileentity instanceof TileEntityMobSpawner && org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(getBlockData(blockposition).getBlock()) != org.bukkit.Material.MOB_SPAWNER) { ++ this.tileEntities.remove(blockposition); ++ // Paper end + } else { + System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ() + + " (" + org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(getBlockData(blockposition).getBlock()) + ") where there was no entity tile!"); +-- +2.7.2 + diff --git a/Spigot-Server-Patches/0020-Optimize-TileEntity-Ticking.patch b/Spigot-Server-Patches/0020-Optimize-TileEntity-Ticking.patch new file mode 100644 index 0000000000..2a4cf88120 --- /dev/null +++ b/Spigot-Server-Patches/0020-Optimize-TileEntity-Ticking.patch @@ -0,0 +1,238 @@ +From 9d63918c050e6ef7fd07581bc6563a8076c62424 Mon Sep 17 00:00:00 2001 +From: Zach Brown +Date: Tue, 1 Mar 2016 22:01:19 -0600 +Subject: [PATCH] Optimize TileEntity Ticking + + +diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/java/net/minecraft/server/TileEntityChest.java +index 8f988c3..e7829c5 100644 +--- a/src/main/java/net/minecraft/server/TileEntityChest.java ++++ b/src/main/java/net/minecraft/server/TileEntityChest.java +@@ -8,17 +8,17 @@ import org.bukkit.craftbukkit.entity.CraftHumanEntity; + import org.bukkit.entity.HumanEntity; + // CraftBukkit end + +-public class TileEntityChest extends TileEntityLootable implements ITickable, IInventory { ++public class TileEntityChest extends TileEntityLootable implements IInventory { // Paper - Remove ITickable + + private ItemStack[] items = new ItemStack[27]; + public boolean a; +- public TileEntityChest f; +- public TileEntityChest g; +- public TileEntityChest h; +- public TileEntityChest i; +- public float j; ++ public TileEntityChest f; // Paper - Adjacent Chest Z Neg ++ public TileEntityChest g; // Paper - Adjacent Chest X Pos ++ public TileEntityChest h; // Paper - Adjacent Chest X Neg ++ public TileEntityChest i; // Paper - Adjacent Chest Z Pos ++ public float j; // Paper - lid angle + public float k; +- public int l; ++ public int l; // Paper - Number of viewers + private int p; + private BlockChest.Type q; + private String r; +@@ -231,6 +231,8 @@ public class TileEntityChest extends TileEntityLootable implements ITickable, II + } + + public void c() { ++ // Paper - Disable all of this, just in case this does get ticked ++ /* + this.m(); + int i = this.position.getX(); + int j = this.position.getY(); +@@ -311,7 +313,8 @@ public class TileEntityChest extends TileEntityLootable implements ITickable, II + this.j = 0.0F; + } + } +- ++ */ ++ // Paper end + } + + public boolean c(int i, int j) { +@@ -331,6 +334,28 @@ public class TileEntityChest extends TileEntityLootable implements ITickable, II + int oldPower = Math.max(0, Math.min(15, this.l)); // CraftBukkit - Get power before new viewer is added + + ++this.l; ++ ++ // Paper start - Move chest open sound out of the tick loop ++ this.m(); ++ ++ if (this.l > 0 && this.j == 0.0F && this.f == null && this.h == null) { ++ this.j = 0.7F; ++ ++ double d0 = (double) this.position.getZ() + 0.5D; ++ double d1 = (double) this.position.getX() + 0.5D; ++ ++ if (this.i != null) { ++ d0 += 0.5D; ++ } ++ ++ if (this.g != null) { ++ d1 += 0.5D; ++ } ++ ++ this.world.a((EntityHuman) null, d1, (double) j + 0.5D, d0, SoundEffects.X, SoundCategory.BLOCKS, 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); ++ } ++ // Paper end ++ + if (this.world == null) return; // CraftBukkit + this.world.playBlockAction(this.position, this.getBlock(), 1, this.l); + +@@ -354,6 +379,33 @@ public class TileEntityChest extends TileEntityLootable implements ITickable, II + int oldPower = Math.max(0, Math.min(15, this.l)); // CraftBukkit - Get power before new viewer is added + --this.l; + if (this.world == null) return; // CraftBukkit ++ ++ // Paper start - Move chest close sound out of the tick loop ++ if (this.l == 0 && this.j > 0.0F || this.l > 0 && this.j < 1.0F) { ++ float f = 0.1F; ++ ++ if (this.l > 0) { ++ this.j += f; ++ } else { ++ this.j -= f; ++ } ++ ++ double d0 = (double) this.getPosition().getX() + 0.5D; ++ double d2 = (double) this.getPosition().getZ() + 0.5D; ++ ++ if (this.i != null) { ++ d2 += 0.5D; ++ } ++ ++ if (this.g != null) { ++ d0 += 0.5D; ++ } ++ ++ this.world.a((EntityHuman) null, d0, (double) j + 0.5D, d2, SoundEffects.V, SoundCategory.BLOCKS, 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); ++ this.j = 0.0F; ++ } ++ // Paper end ++ + this.world.playBlockAction(this.position, this.getBlock(), 1, this.l); + + // CraftBukkit start - Call redstone event +diff --git a/src/main/java/net/minecraft/server/TileEntityEnderChest.java b/src/main/java/net/minecraft/server/TileEntityEnderChest.java +index e454622..d01b65a 100644 +--- a/src/main/java/net/minecraft/server/TileEntityEnderChest.java ++++ b/src/main/java/net/minecraft/server/TileEntityEnderChest.java +@@ -1,15 +1,17 @@ + package net.minecraft.server; + +-public class TileEntityEnderChest extends TileEntity implements ITickable { ++public class TileEntityEnderChest extends TileEntity { // Paper - Remove ITickable + +- public float a; ++ public float a; // Paper - lid angle + public float f; +- public int g; ++ public int g; // Paper - Number of viewers + private int h; + + public TileEntityEnderChest() {} + + public void c() { ++ // Paper start - Disable all of this, just in case this does get ticked ++ /* + if (++this.h % 20 * 4 == 0) { + this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g); + } +@@ -54,6 +56,8 @@ public class TileEntityEnderChest extends TileEntity implements ITickable { + this.a = 0.0F; + } + } ++ */ ++ // Paper end + + } + +@@ -73,11 +77,34 @@ public class TileEntityEnderChest extends TileEntity implements ITickable { + + public void b() { + ++this.g; ++ ++ // Paper start - Move enderchest open sounds out of the tick loop ++ if (this.g > 0 && this.a == 0.0F) { ++ this.a = 0.7F; ++ ++ double d1 = (double) this.getPosition().getX() + 0.5D; ++ double d0 = (double) this.getPosition().getZ() + 0.5D; ++ ++ this.world.a((EntityHuman) null, d1, (double) this.getPosition().getY() + 0.5D, d0, SoundEffects.aL, SoundCategory.BLOCKS, 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); ++ } ++ // Paper end ++ + this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g); + } + + public void d() { + --this.g; ++ ++ // Paper start - Move enderchest close sounds out of the tick loop ++ if (this.g == 0 && this.a > 0.0F || this.g > 0 && this.a < 1.0F) { ++ double d0 = (double) this.getPosition().getX() + 0.5D; ++ double d2 = (double) this.getPosition().getZ() + 0.5D; ++ ++ this.world.a((EntityHuman) null, d0, (double) this.getPosition().getY() + 0.5D, d2, SoundEffects.aK, SoundCategory.BLOCKS, 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); ++ this.a = 0.0F; ++ } ++ // Paper end ++ + this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g); + } + +diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java +index f0988fa..d9a84b6 100644 +--- a/src/main/java/net/minecraft/server/World.java ++++ b/src/main/java/net/minecraft/server/World.java +@@ -60,7 +60,7 @@ public abstract class World implements IBlockAccess { + }; + // Spigot end + protected final List f = Lists.newArrayList(); +- public final List tileEntityList = Lists.newArrayList(); ++ //public final List tileEntityList = Lists.newArrayList(); // Paper - Remove unused list + public final List tileEntityListTick = Lists.newArrayList(); + private final List b = Lists.newArrayList(); + private final List tileEntityListUnload = Lists.newArrayList(); +@@ -1428,7 +1428,7 @@ public abstract class World implements IBlockAccess { + // CraftBukkit start - From below, clean up tile entities before ticking them + if (!this.tileEntityListUnload.isEmpty()) { + this.tileEntityListTick.removeAll(this.tileEntityListUnload); +- this.tileEntityList.removeAll(this.tileEntityListUnload); ++ //this.tileEntityList.removeAll(this.tileEntityListUnload); // Paper - Remove unused list + this.tileEntityListUnload.clear(); + } + // CraftBukkit end +@@ -1476,7 +1476,7 @@ public abstract class World implements IBlockAccess { + if (tileentity.x()) { + tilesThisCycle--; + this.tileEntityListTick.remove(tileTickPosition--); +- this.tileEntityList.remove(tileentity); ++ //this.tileEntityList.remove(tileentity); // Paper - Remove unused list + if (this.isLoaded(tileentity.getPosition())) { + this.getChunkAtWorldCoords(tileentity.getPosition()).d(tileentity.getPosition()); + } +@@ -1527,7 +1527,7 @@ public abstract class World implements IBlockAccess { + protected void l() {} + + public boolean a(TileEntity tileentity) { +- boolean flag = this.tileEntityList.add(tileentity); ++ boolean flag = true; // Paper - Remove unused list + + if (flag && tileentity instanceof ITickable) { + this.tileEntityListTick.add(tileentity); +@@ -2000,7 +2000,7 @@ public abstract class World implements IBlockAccess { + } else { + if (tileentity != null) { + this.b.remove(tileentity); +- this.tileEntityList.remove(tileentity); ++ //this.tileEntityList.remove(tileentity); // Paper - Remove unused list + this.tileEntityListTick.remove(tileentity); + } + +-- +2.7.2 + diff --git a/Spigot-Server-Patches/0025-Further-improve-server-tick-loop.patch b/Spigot-Server-Patches/0021-Further-improve-server-tick-loop.patch similarity index 79% rename from Spigot-Server-Patches/0025-Further-improve-server-tick-loop.patch rename to Spigot-Server-Patches/0021-Further-improve-server-tick-loop.patch index e47706b7a2..fcebb12d5a 100644 --- a/Spigot-Server-Patches/0025-Further-improve-server-tick-loop.patch +++ b/Spigot-Server-Patches/0021-Further-improve-server-tick-loop.patch @@ -1,6 +1,6 @@ -From 8cae5d46b1afced146412ba40e28ac7e08d61d83 Mon Sep 17 00:00:00 2001 +From b5989dbd8369d267021623b3426053f1e020a2e3 Mon Sep 17 00:00:00 2001 From: Aikar -Date: Sun, 8 Mar 2015 03:47:32 -0500 +Date: Tue, 1 Mar 2016 23:09:29 -0600 Subject: [PATCH] Further improve server tick loop Improves how the catchup buffer is handled, allowing it to roll both ways @@ -12,15 +12,15 @@ Previous implementation did not calculate TPS correctly. Switch to a realistic rolling average and factor in std deviation as an extra reporting variable diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 9fc2cfa..06ae3fc 100644 +index 7b99c2f..0a23d2a 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -111,17 +111,11 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs +@@ -109,17 +109,11 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs public org.bukkit.command.ConsoleCommandSender console; public org.bukkit.command.RemoteConsoleCommandSender remoteConsole; public ConsoleReader reader; - public static int currentTick = (int) (System.currentTimeMillis() / 50); -+ public static int currentTick = 0; // PaperSpigot - Further improve tick loop ++ public static int currentTick = 0; // Paper - Further improve tick loop public final Thread primaryThread; public java.util.Queue processQueue = new java.util.concurrent.ConcurrentLinkedQueue(); public int autosavePeriod; @@ -32,9 +32,9 @@ index 9fc2cfa..06ae3fc 100644 - public final double[] recentTps = new double[ 3 ]; - // Spigot end - public MinecraftServer(OptionSet options, Proxy proxy, File file1) { + public MinecraftServer(OptionSet options, Proxy proxy, DataConverterManager dataconvertermanager, YggdrasilAuthenticationService yggdrasilauthenticationservice, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache) { io.netty.util.ResourceLeakDetector.setEnabled( false ); // Spigot - disable -@@ -513,12 +507,54 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs +@@ -510,12 +504,54 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs this.isRunning = false; } @@ -42,7 +42,7 @@ index 9fc2cfa..06ae3fc 100644 - private static double calcTps(double avg, double exp, double tps) - { - return ( avg * exp ) + ( tps * ( 1 - exp ) ); -+ // PaperSpigot start - Further improve tick loop ++ // Paper start - Further improve server tick loop + private static final int TPS = 20; + private static final long SEC_IN_NANO = 1000000000; + private static final long TICK_TIME = SEC_IN_NANO / TPS; @@ -51,7 +51,7 @@ index 9fc2cfa..06ae3fc 100644 + public final RollingAverage tps1 = new RollingAverage(60); + public final RollingAverage tps5 = new RollingAverage(60 * 5); + public final RollingAverage tps15 = new RollingAverage(60 * 15); -+ public double[] recentTps = new double[ 3 ]; // PaperSpigot - Fine have your darn compat with bad plugins ++ public double[] recentTps = new double[3]; // Paper - Fine have your darn compat with bad plugins + + public static class RollingAverage { + private final int size; @@ -90,24 +90,20 @@ index 9fc2cfa..06ae3fc 100644 + } } - // Spigot End -+ // PaperSpigot End ++ // Paper End public void run() { try { -@@ -531,26 +567,47 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs - this.a(this.r); +@@ -529,24 +565,41 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs // Spigot start -+ // PaperSpigot start - Further improve tick loop Arrays.fill( recentTps, 20 ); - long lastTick = System.nanoTime(), catchupTime = 0, curTime, wait, tickSection = lastTick; -+ //long lastTick = System.nanoTime(), catchupTime = 0, curTime, wait, tickSection = lastTick; -+ long start = System.nanoTime(), lastTick = start - TICK_TIME, catchupTime = 0, curTime, wait, tickSection = start; -+ // PaperSpigot end ++ long start = System.nanoTime(), lastTick = start - TICK_TIME, catchupTime = 0, curTime, wait, tickSection = start; // Paper - Further improve server tick loop while (this.isRunning) { curTime = System.nanoTime(); - wait = TICK_TIME - (curTime - lastTick) - catchupTime; -+ // PaperSpigot start - Further improve tick loop ++ // Paper start - Further improve server tick loop + wait = TICK_TIME - (curTime - lastTick); + if (wait > 0) { + if (catchupTime < 2E6) { @@ -132,7 +128,6 @@ index 9fc2cfa..06ae3fc 100644 - if ( MinecraftServer.currentTick++ % SAMPLE_INTERVAL == 0 ) + catchupTime = Math.min(MAX_CATCHUP_BUFFER, catchupTime - wait); -+ + if ( ++MinecraftServer.currentTick % SAMPLE_INTERVAL == 0 ) { - double currentTps = 1E9 / ( curTime - tickSection ) * SAMPLE_INTERVAL; @@ -148,35 +143,34 @@ index 9fc2cfa..06ae3fc 100644 + recentTps[0] = tps1.getAverage(); + recentTps[1] = tps5.getAverage(); + recentTps[2] = tps15.getAverage(); ++ // Paper end tickSection = curTime; -+ // PaperSpigot end } lastTick = curTime; - diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 5ce0d50..97a53d3 100644 +index 40998cf..4654a4b 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1704,6 +1704,17 @@ public final class CraftServer implements Server { +@@ -1712,6 +1712,17 @@ public final class CraftServer implements Server { + return CraftMagicNumbers.INSTANCE; + } + ++ // Paper - Add getTPS API - Further improve tick loop ++ @Override ++ public double[] getTPS() { ++ return new double[] { ++ MinecraftServer.getServer().tps1.getAverage(), ++ MinecraftServer.getServer().tps5.getAverage(), ++ MinecraftServer.getServer().tps15.getAverage() ++ }; ++ } ++ // Paper end ++ private final Spigot spigot = new Spigot() { -+ // PaperSpigot start - Add getTPS (Further improve tick loop) -+ @Override -+ public double[] getTPS() { -+ return new double[] { -+ MinecraftServer.getServer().tps1.getAverage(), -+ MinecraftServer.getServer().tps5.getAverage(), -+ MinecraftServer.getServer().tps15.getAverage() -+ }; -+ } -+ // PaperSpigot end -+ - @Override - public YamlConfiguration getConfig() - { diff --git a/src/main/java/org/spigotmc/TicksPerSecondCommand.java b/src/main/java/org/spigotmc/TicksPerSecondCommand.java -index be2e31d..21fd7ef 100644 +index be2e31d..6d21c32 100644 --- a/src/main/java/org/spigotmc/TicksPerSecondCommand.java +++ b/src/main/java/org/spigotmc/TicksPerSecondCommand.java @@ -1,8 +1,5 @@ @@ -188,7 +182,7 @@ index be2e31d..21fd7ef 100644 import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; -@@ -26,18 +23,19 @@ public class TicksPerSecondCommand extends Command +@@ -26,18 +23,20 @@ public class TicksPerSecondCommand extends Command return true; } @@ -197,24 +191,25 @@ index be2e31d..21fd7ef 100644 - { - sb.append( format( tps ) ); - sb.append( ", " ); -+ // PaperSpigot start - Further improve tick handling -+ double[] tps = org.bukkit.Bukkit.spigot().getTPS(); ++ // Paper start - Further improve tick handling ++ double[] tps = org.bukkit.Bukkit.getTPS(); + String[] tpsAvg = new String[tps.length]; + -+ for ( int i = 0; i < tps.length; i++) { -+ tpsAvg[i] = format( tps[i] ); ++ for ( int i = 0; i < tps.length; i++) { ++ tpsAvg[i] = format( tps[i] ); } - sender.sendMessage( sb.substring( 0, sb.length() - 2 ) ); + sender.sendMessage( ChatColor.GOLD + "TPS from last 1m, 5m, 15m: " + org.apache.commons.lang.StringUtils.join(tpsAvg, ", ")); ++ // Paper end return true; } - private String format(double tps) -+ private static String format(double tps) // PaperSpigot - made static ++ private static String format(double tps) // Paper - Made static { return ( ( tps > 18.0 ) ? ChatColor.GREEN : ( tps > 16.0 ) ? ChatColor.YELLOW : ChatColor.RED ).toString() + ( ( tps > 20.0 ) ? "*" : "" ) + Math.min( Math.round( tps * 100.0 ) / 100.0, 20.0 ); -- -2.5.2 +2.7.2 diff --git a/Spigot-Server-Patches/0021-Remove-invalid-mob-spawner-tile-entities.patch b/Spigot-Server-Patches/0021-Remove-invalid-mob-spawner-tile-entities.patch deleted file mode 100644 index f2a68ad13f..0000000000 --- a/Spigot-Server-Patches/0021-Remove-invalid-mob-spawner-tile-entities.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 1f32bbad70c29f4636c376fa8dac5e579e3e4865 Mon Sep 17 00:00:00 2001 -From: Byteflux -Date: Sun, 8 Mar 2015 22:55:25 -0600 -Subject: [PATCH] Remove invalid mob spawner tile entities - - -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 022ba31..7242d45 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -784,6 +784,11 @@ public class Chunk { - tileentity.D(); - this.tileEntities.put(blockposition, tileentity); - // CraftBukkit start -+ // PaperSpigot start - Remove invalid mob spawner tile entities -+ } else if (this.world.paperSpigotConfig.removeInvalidMobSpawnerTEs && tileentity instanceof TileEntityMobSpawner && -+ org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(getType(blockposition)) != org.bukkit.Material.MOB_SPAWNER) { -+ this.tileEntities.remove(blockposition); -+ // PaperSpigot end - } else { - System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ() - + " (" + org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(getType(blockposition)) + ") where there was no entity tile!"); -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index 781cf75..af53220 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -173,4 +173,11 @@ public class PaperSpigotWorldConfig - waterOverLavaFlowSpeed = getInt( "water-over-lava-flow-speed", 5 ); - log( "Water over lava flow speed: " + waterOverLavaFlowSpeed ); - } -+ -+ public boolean removeInvalidMobSpawnerTEs; -+ private void removeInvalidMobSpawnerTEs() -+ { -+ removeInvalidMobSpawnerTEs = getBoolean( "remove-invalid-mob-spawner-tile-entities", true ); -+ log( "Remove invalid mob spawner tile entities: " + removeInvalidMobSpawnerTEs ); -+ } - } --- -2.7.0 - diff --git a/Spigot-Server-Patches/0026-Only-refresh-abilities-if-needed.patch b/Spigot-Server-Patches/0022-Only-refresh-abilities-if-needed.patch similarity index 76% rename from Spigot-Server-Patches/0026-Only-refresh-abilities-if-needed.patch rename to Spigot-Server-Patches/0022-Only-refresh-abilities-if-needed.patch index e489912050..de9a305c51 100644 --- a/Spigot-Server-Patches/0026-Only-refresh-abilities-if-needed.patch +++ b/Spigot-Server-Patches/0022-Only-refresh-abilities-if-needed.patch @@ -1,28 +1,28 @@ -From dbcd027da8be15f1eb656da2f13bf0cbba8fa583 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Fri, 28 Nov 2014 13:20:22 -0600 +From 43233efe6e6330c3c626f395b56b566db354b57f Mon Sep 17 00:00:00 2001 +From: Zach Brown +Date: Tue, 1 Mar 2016 23:12:03 -0600 Subject: [PATCH] Only refresh abilities if needed diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index a9b4160..506a03c 100644 +index 9298344..039a170 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1143,12 +1143,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public void setFlying(boolean value) { -+ boolean needsUpdate = getHandle().abilities.canFly != value; // PaperSpigot - Only refresh abilities if needed ++ boolean needsUpdate = getHandle().abilities.canFly != value; // Paper - Only refresh abilities if needed if (!getAllowFlight() && value) { throw new IllegalArgumentException("Cannot make player fly if getAllowFlight() is false"); } getHandle().abilities.isFlying = value; - getHandle().updateAbilities(); -+ if (needsUpdate) getHandle().updateAbilities(); // PaperSpigot - Only refresh abilities if needed ++ if (needsUpdate) getHandle().updateAbilities(); // Paper - Only refresh abilities if needed } @Override -- -2.5.2 +2.7.2 diff --git a/Spigot-Server-Patches/0022-Optimize-TileEntity-Ticking.patch b/Spigot-Server-Patches/0022-Optimize-TileEntity-Ticking.patch deleted file mode 100644 index 903fa2f12a..0000000000 --- a/Spigot-Server-Patches/0022-Optimize-TileEntity-Ticking.patch +++ /dev/null @@ -1,248 +0,0 @@ -From 107454d78a44a4dd3d04fc0f68cce6b476ae6274 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sun, 8 Mar 2015 22:55:25 -0600 -Subject: [PATCH] Optimize TileEntity Ticking - - -diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/java/net/minecraft/server/TileEntityChest.java -index 5eb55e5..5192d95 100644 ---- a/src/main/java/net/minecraft/server/TileEntityChest.java -+++ b/src/main/java/net/minecraft/server/TileEntityChest.java -@@ -8,17 +8,17 @@ import org.bukkit.craftbukkit.entity.CraftHumanEntity; - import org.bukkit.entity.HumanEntity; - // CraftBukkit end - --public class TileEntityChest extends TileEntityContainer implements IUpdatePlayerListBox, IInventory { -+public class TileEntityChest extends TileEntityContainer implements IInventory { // PaperSpigot - remove IUpdatePlayerListBox - - private ItemStack[] items = new ItemStack[27]; - public boolean a; -- public TileEntityChest f; -- public TileEntityChest g; -- public TileEntityChest h; -- public TileEntityChest i; -- public float j; -+ public TileEntityChest f; // PaperSpigot - adjacentChestZNeg -+ public TileEntityChest g; // PaperSpigot - adjacentChestXPos -+ public TileEntityChest h; // PaperSpigot - adjacentChestXNeg -+ public TileEntityChest i; // PaperSpigot - adjacentChestZPos -+ public float j; // PaperSpigot - lidAngle - public float k; -- public int l; -+ public int l; // PaperSpigot - numPlayersUsing - private int n; - private int o = -1; - private String p; -@@ -238,6 +238,8 @@ public class TileEntityChest extends TileEntityContainer implements IUpdatePlaye - } - - public void c() { -+ // PaperSpigot - Move chest sounds out of the tick loop -+ /* - this.m(); - int i = this.position.getX(); - int j = this.position.getY(); -@@ -318,7 +320,8 @@ public class TileEntityChest extends TileEntityContainer implements IUpdatePlaye - this.j = 0.0F; - } - } -- -+ */ -+ // PaperSpigot end - } - - public boolean c(int i, int j) { -@@ -339,6 +342,28 @@ public class TileEntityChest extends TileEntityContainer implements IUpdatePlaye - - ++this.l; - if (this.world == null) return; // CraftBukkit -+ -+ // PaperSpigot start - Move chest open sound out of the tick loop -+ this.m(); -+ -+ if (this.l > 0 && this.j == 0.0F && this.f == null && this.h == null) { -+ this.j = 0.7F; -+ -+ double d0 = (double) this.position.getZ() + 0.5D; -+ double d1 = (double) this.position.getX() + 0.5D; -+ -+ if (this.i != null) { -+ d0 += 0.5D; -+ } -+ -+ if (this.g != null) { -+ d1 += 0.5D; -+ } -+ -+ this.world.makeSound(d1, (double) this.position.getY() + 0.5D, d0, "random.chestopen", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); -+ } -+ // PaperSpigot end -+ - this.world.playBlockAction(this.position, this.w(), 1, this.l); - - // CraftBukkit start - Call redstone event -@@ -361,6 +386,33 @@ public class TileEntityChest extends TileEntityContainer implements IUpdatePlaye - int oldPower = Math.max(0, Math.min(15, this.l)); // CraftBukkit - Get power before new viewer is added - --this.l; - if (this.world == null) return; // CraftBukkit -+ -+ // PaperSpigot start - Move chest close sound handling out of the tick loop -+ if (this.l == 0 && this.j > 0.0F || this.l > 0 && this.j < 1.0F) { -+ float f = 0.1F; -+ -+ if (this.l > 0) { -+ this.j += f; -+ } else { -+ this.j -= f; -+ } -+ -+ double d0 = (double) this.getPosition().getX() + 0.5D; -+ double d2 = (double) this.getPosition().getZ() + 0.5D; -+ -+ if (this.i != null) { -+ d2 += 0.5D; -+ } -+ -+ if (this.g != null) { -+ d0 += 0.5D; -+ } -+ -+ this.world.makeSound(d0, (double) this.getPosition().getY() + 0.5D, d2, "random.chestclosed", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); -+ this.j = 0.0F; -+ } -+ // PaperSpigot end -+ - this.world.playBlockAction(this.position, this.w(), 1, this.l); - - // CraftBukkit start - Call redstone event -diff --git a/src/main/java/net/minecraft/server/TileEntityEnderChest.java b/src/main/java/net/minecraft/server/TileEntityEnderChest.java -index 794cdc8..00fceda 100644 ---- a/src/main/java/net/minecraft/server/TileEntityEnderChest.java -+++ b/src/main/java/net/minecraft/server/TileEntityEnderChest.java -@@ -1,15 +1,17 @@ - package net.minecraft.server; - --public class TileEntityEnderChest extends TileEntity implements IUpdatePlayerListBox { -+public class TileEntityEnderChest extends TileEntity { // PaperSpigot - remove IUpdatePlayerListBox - -- public float a; -+ public float a; // PaperSpigot - lidAngle - public float f; -- public int g; -+ public int g; // PaperSpigot - numPlayersUsing - private int h; - - public TileEntityEnderChest() {} - - public void c() { -+ // PaperSpigot start - Move enderchest sound handling out of the tick loop -+ /* - if (++this.h % 20 * 4 == 0) { - this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g); - } -@@ -54,7 +56,8 @@ public class TileEntityEnderChest extends TileEntity implements IUpdatePlayerLis - this.a = 0.0F; - } - } -- -+ */ -+ // PaperSpigot end - } - - public boolean c(int i, int j) { -@@ -73,11 +76,34 @@ public class TileEntityEnderChest extends TileEntity implements IUpdatePlayerLis - - public void b() { - ++this.g; -+ -+ // PaperSpigot start - Move enderchest open sounds out of the tick loop -+ if (this.g > 0 && this.a == 0.0F) { -+ this.a = 0.7F; -+ -+ double d1 = (double) this.getPosition().getX() + 0.5D; -+ double d0 = (double) this.getPosition().getZ() + 0.5D; -+ -+ this.world.makeSound(d1, (double) this.getPosition().getY() + 0.5D, d0, "random.chestopen", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); -+ } -+ // PaperSpigot end -+ - this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g); - } - - public void d() { - --this.g; -+ -+ // PaperSpigot start - Move enderchest close sounds out of the tick loop -+ if (this.g == 0 && this.a > 0.0F || this.g > 0 && this.a < 1.0F) { -+ double d0 = (double) this.getPosition().getX() + 0.5D; -+ double d2 = (double) this.getPosition().getZ() + 0.5D; -+ -+ this.world.makeSound(d0, (double) this.getPosition().getY() + 0.5D, d2, "random.chestclosed", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); -+ this.a = 0.0F; -+ } -+ // PaperSpigot end -+ - this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g); - } - -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index acfceb8..4b642ba 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -52,7 +52,7 @@ public abstract class World implements IBlockAccess { - }; - // Spigot end - protected final List g = Lists.newArrayList(); -- public final List h = Lists.newArrayList(); -+ //public final List h = Lists.newArrayList(); // PaperSpigot - Remove unused list - public final List tileEntityList = Lists.newArrayList(); - private final List b = Lists.newArrayList(); - private final List c = Lists.newArrayList(); -@@ -1450,7 +1450,7 @@ public abstract class World implements IBlockAccess { - // CraftBukkit start - From below, clean up tile entities before ticking them - if (!this.c.isEmpty()) { - this.tileEntityList.removeAll(this.c); -- this.h.removeAll(this.c); -+ //this.h.removeAll(this.c); // PaperSpigot - Remove unused list - this.c.clear(); - } - // CraftBukkit end -@@ -1496,7 +1496,7 @@ public abstract class World implements IBlockAccess { - if (tileentity.x()) { - tilesThisCycle--; - this.tileEntityList.remove(tileTickPosition--); -- this.h.remove(tileentity); -+ //this.h.remove(tileentity); // PaperSpigot - Remove unused list - if (this.isLoaded(tileentity.getPosition())) { - this.getChunkAtWorldCoords(tileentity.getPosition()).e(tileentity.getPosition()); - } -@@ -1543,7 +1543,7 @@ public abstract class World implements IBlockAccess { - } - - public boolean a(TileEntity tileentity) { -- boolean flag = this.h.add(tileentity); -+ boolean flag = true; // PaperSpigot - Remove unused list - - if (flag && tileentity instanceof IUpdatePlayerListBox) { - this.tileEntityList.add(tileentity); -@@ -1561,7 +1561,7 @@ public abstract class World implements IBlockAccess { - while (iterator.hasNext()) { - TileEntity tileentity = (TileEntity) iterator.next(); - -- this.h.add(tileentity); -+ //this.h.add(tileentity); // PaperSpigot - Remove unused list - if (tileentity instanceof IUpdatePlayerListBox) { - this.tileEntityList.add(tileentity); - } -@@ -1997,7 +1997,7 @@ public abstract class World implements IBlockAccess { - } else { - if (tileentity != null) { - this.b.remove(tileentity); -- this.h.remove(tileentity); -+ //this.h.remove(tileentity); // PaperSpigot - Remove unused list - this.tileEntityList.remove(tileentity); - } - --- -2.6.1.windows.1 - diff --git a/Spigot-Server-Patches/0028-Add-async-chunk-load-API.patch b/Spigot-Server-Patches/0023-Add-async-chunk-load-API.patch similarity index 67% rename from Spigot-Server-Patches/0028-Add-async-chunk-load-API.patch rename to Spigot-Server-Patches/0023-Add-async-chunk-load-API.patch index 2518ac7cea..be7db7cab7 100644 --- a/Spigot-Server-Patches/0028-Add-async-chunk-load-API.patch +++ b/Spigot-Server-Patches/0023-Add-async-chunk-load-API.patch @@ -1,20 +1,20 @@ -From 33a53bb028aadbb40a503e0f4087cb6718bfc420 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Thu, 6 Nov 2014 18:29:20 -0600 +From e15513a2c62039f36abc3db23fed7f193bfffc15 Mon Sep 17 00:00:00 2001 +From: Zach Brown +Date: Tue, 1 Mar 2016 23:19:01 -0600 Subject: [PATCH] Add async chunk load API diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 17f2c0a..552f5c3 100644 +index c0d7ac5..173f1c5 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -122,6 +122,24 @@ public class CraftWorld implements World { +@@ -121,6 +121,26 @@ public class CraftWorld implements World { } } -+ // PaperSpigot start - Async chunk load API ++ // Paper start - Async chunk load API + public void getChunkAtAsync(final int x, final int z, final ChunkLoadCallback callback) { -+ final ChunkProviderServer cps = this.world.chunkProviderServer; ++ final ChunkProviderServer cps = this.world.getChunkProviderServer(); + cps.getChunkAt(x, z, new Runnable() { + @Override + public void run() { @@ -22,17 +22,19 @@ index 17f2c0a..552f5c3 100644 + } + }); + } ++ + public void getChunkAtAsync(Block block, ChunkLoadCallback callback) { + getChunkAtAsync(block.getX() >> 4, block.getZ() >> 4, callback); + } ++ + public void getChunkAtAsync(Location location, ChunkLoadCallback callback) { + getChunkAtAsync(location.getBlockX() >> 4, location.getBlockZ() >> 4, callback); + } -+ // PaperSpigot end ++ // Paper end + public Chunk getChunkAt(int x, int z) { - return this.world.chunkProviderServer.getChunkAt(x, z).bukkitChunk; + return this.world.getChunkProviderServer().getChunkAt(x, z).bukkitChunk; } -- -2.5.2 +2.7.2 diff --git a/Spigot-Server-Patches/0023-Remove-certain-entities-that-fly-through-unloaded-ch.patch b/Spigot-Server-Patches/0023-Remove-certain-entities-that-fly-through-unloaded-ch.patch deleted file mode 100644 index 75cadd3d32..0000000000 --- a/Spigot-Server-Patches/0023-Remove-certain-entities-that-fly-through-unloaded-ch.patch +++ /dev/null @@ -1,119 +0,0 @@ -From ac3f20717a8488391789eefd180e54977a436842 Mon Sep 17 00:00:00 2001 -From: Iceee -Date: Sun, 8 Mar 2015 03:34:15 -0500 -Subject: [PATCH] Remove certain entities that fly through unloaded chunks - - -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index e345dd7..3e89aa9 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -115,6 +115,7 @@ public abstract class Entity implements ICommandListener { - public boolean valid; // CraftBukkit - public org.bukkit.projectiles.ProjectileSource projectileSource; // CraftBukkit - For projectiles only - public boolean forceExplosionKnockback; // CraftBukkit - SPIGOT-949 -+ public boolean inUnloadedChunk = false; // PaperSpigot - Remove entities in unloaded chunks - - // Spigot start - public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getEntityTimings(this); // Spigot -diff --git a/src/main/java/net/minecraft/server/EntityEnderPearl.java b/src/main/java/net/minecraft/server/EntityEnderPearl.java -index 48ada4d..f4b5032 100644 ---- a/src/main/java/net/minecraft/server/EntityEnderPearl.java -+++ b/src/main/java/net/minecraft/server/EntityEnderPearl.java -@@ -30,6 +30,12 @@ public class EntityEnderPearl extends EntityProjectile { - movingobjectposition.entity.damageEntity(DamageSource.projectile(this, entityliving), 0.0F); - } - -+ // PaperSpigot start - Remove entities in unloaded chunks -+ if (this.inUnloadedChunk && world.paperSpigotConfig.removeUnloadedEnderPearls) { -+ this.die(); -+ } -+ // PaperSpigot end -+ - for (int i = 0; i < 32; ++i) { - this.world.addParticle(EnumParticle.PORTAL, this.locX, this.locY + this.random.nextDouble() * 2.0D, this.locZ, this.random.nextGaussian(), 0.0D, this.random.nextGaussian(), new int[0]); - } -diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java -index 95c188b..86556cd 100644 ---- a/src/main/java/net/minecraft/server/EntityFallingBlock.java -+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java -@@ -70,6 +70,12 @@ public class EntityFallingBlock extends Entity { - this.motY -= 0.03999999910593033D; - this.move(this.motX, this.motY, this.motZ); - -+ // PaperSpigot start - Remove entities in unloaded chunks -+ if (this.inUnloadedChunk && world.paperSpigotConfig.removeUnloadedFallingBlocks) { -+ this.die(); -+ } -+ // PaperSpigot end -+ - // PaperSpigot start - Drop falling blocks above the specified height - if (this.world.paperSpigotConfig.fallingBlockHeightNerf != 0 && this.locY > this.world.paperSpigotConfig.fallingBlockHeightNerf) { - if (this.dropItem) { -diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java -index d2d94d7..ebc4b85 100644 ---- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java -+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java -@@ -54,6 +54,13 @@ public class EntityTNTPrimed extends Entity { - } - // PaperSpigot end - -+ // PaperSpigot start - Remove entities in unloaded chunks -+ if (this.inUnloadedChunk && world.paperSpigotConfig.removeUnloadedTNTEntities) { -+ this.die(); -+ this.fuseTicks = 2; -+ } -+ // PaperSpigot end -+ - this.motX *= 0.9800000190734863D; - this.motY *= 0.9800000190734863D; - this.motZ *= 0.9800000190734863D; -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 4b642ba..46e39f2 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -1160,6 +1160,7 @@ public abstract class World implements IBlockAccess { - { - if ( !this.isChunkLoaded( chunkx, chunkz, true ) ) - { -+ entity.inUnloadedChunk = true; // PaperSpigot - Remove entities in unloaded chunks - continue; - } - int cz = chunkz << 4; -@@ -1583,6 +1584,14 @@ public abstract class World implements IBlockAccess { - if (!org.spigotmc.ActivationRange.checkIfActive(entity)) { - entity.ticksLived++; - entity.inactiveTick(); -+ // PaperSpigot start - Remove entities in unloaded chunks -+ if (!this.isChunkLoaded(i, j, true) && ((entity instanceof EntityEnderPearl && this.paperSpigotConfig.removeUnloadedEnderPearls) || -+ (entity instanceof EntityFallingBlock && this.paperSpigotConfig.removeUnloadedFallingBlocks) || -+ (entity instanceof EntityTNTPrimed && this.paperSpigotConfig.removeUnloadedTNTEntities))) { -+ entity.inUnloadedChunk = true; -+ entity.die(); -+ } -+ // PaperSpigot end - } else { - entity.tickTimer.startTiming(); // Spigot - // CraftBukkit end -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index af53220..4596616 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -180,4 +180,14 @@ public class PaperSpigotWorldConfig - removeInvalidMobSpawnerTEs = getBoolean( "remove-invalid-mob-spawner-tile-entities", true ); - log( "Remove invalid mob spawner tile entities: " + removeInvalidMobSpawnerTEs ); - } -+ -+ public boolean removeUnloadedEnderPearls; -+ public boolean removeUnloadedTNTEntities; -+ public boolean removeUnloadedFallingBlocks; -+ private void removeUnloaded() -+ { -+ removeUnloadedEnderPearls = getBoolean( "remove-unloaded.enderpearls", true ); -+ removeUnloadedTNTEntities = getBoolean( "remove-unloaded.tnt-entities", true ); -+ removeUnloadedFallingBlocks = getBoolean( "remove-unloaded.falling-blocks", true ); -+ } - } --- -2.7.0 - diff --git a/Spigot-Server-Patches/0024-Configurable-strength-and-weakness-effect-modifiers.patch b/Spigot-Server-Patches/0024-Configurable-strength-and-weakness-effect-modifiers.patch deleted file mode 100644 index b35c471633..0000000000 --- a/Spigot-Server-Patches/0024-Configurable-strength-and-weakness-effect-modifiers.patch +++ /dev/null @@ -1,39 +0,0 @@ -From f4bb4188db4477614faec7dcfb84f67496cdde11 Mon Sep 17 00:00:00 2001 -From: gsand -Date: Sun, 8 Mar 2015 03:41:33 -0500 -Subject: [PATCH] Configurable strength and weakness effect modifiers - - -diff --git a/src/main/java/net/minecraft/server/MobEffectAttackDamage.java b/src/main/java/net/minecraft/server/MobEffectAttackDamage.java -index 620685a..175503b 100644 ---- a/src/main/java/net/minecraft/server/MobEffectAttackDamage.java -+++ b/src/main/java/net/minecraft/server/MobEffectAttackDamage.java -@@ -7,6 +7,7 @@ public class MobEffectAttackDamage extends MobEffectList { - } - - public double a(int i, AttributeModifier attributemodifier) { -- return this.id == MobEffectList.WEAKNESS.id ? (double) (-0.5F * (float) (i + 1)) : 1.3D * (double) (i + 1); -+ // PaperSpigot - Configurable modifiers for strength and weakness effects -+ return this.id == MobEffectList.WEAKNESS.id ? (double) (org.github.paperspigot.PaperSpigotConfig.weaknessEffectModifier * (float) (i + 1)) : org.github.paperspigot.PaperSpigotConfig.strengthEffectModifier * (double) (i + 1); - } - } -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java -index b0dd5b0..5df90f9 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java -@@ -154,4 +154,12 @@ public class PaperSpigotConfig - Bukkit.getLogger().log( Level.INFO, "Disabling player interaction limiter, your server may be more vulnerable to malicious users" ); - } - } -+ -+ public static double strengthEffectModifier; -+ public static double weaknessEffectModifier; -+ private static void effectModifiers() -+ { -+ strengthEffectModifier = getDouble( "effect-modifiers.strength", 1.3D ); -+ weaknessEffectModifier = getDouble( "effect-modifiers.weakness", -0.5D ); -+ } - } --- -2.5.2 - diff --git a/Spigot-Server-Patches/0024-FallingBlock-and-TNTPrimed-source-location-API.patch b/Spigot-Server-Patches/0024-FallingBlock-and-TNTPrimed-source-location-API.patch new file mode 100644 index 0000000000..74f9a2f751 --- /dev/null +++ b/Spigot-Server-Patches/0024-FallingBlock-and-TNTPrimed-source-location-API.patch @@ -0,0 +1,267 @@ +From e235a4f67d0e1b770147f4666b04193a91e05314 Mon Sep 17 00:00:00 2001 +From: Zach Brown +Date: Tue, 1 Mar 2016 23:45:08 -0600 +Subject: [PATCH] FallingBlock and TNTPrimed source location API + + +diff --git a/src/main/java/net/minecraft/server/BlockDragonEgg.java b/src/main/java/net/minecraft/server/BlockDragonEgg.java +index f6095af..5c12227 100644 +--- a/src/main/java/net/minecraft/server/BlockDragonEgg.java ++++ b/src/main/java/net/minecraft/server/BlockDragonEgg.java +@@ -33,7 +33,10 @@ public class BlockDragonEgg extends Block { + byte b0 = 32; + + if (!BlockFalling.instaFall && world.areChunksLoadedBetween(blockposition.a(-b0, -b0, -b0), blockposition.a(b0, b0, b0))) { +- world.addEntity(new EntityFallingBlock(world, (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F), this.getBlockData())); ++ // Paper start - Add FallingBlock source location API ++ org.bukkit.Location loc = new org.bukkit.Location(world.getWorld(), (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F)); ++ world.addEntity(new EntityFallingBlock(loc, world, (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F), this.getBlockData())); ++ // Paper end + } else { + world.setAir(blockposition); + +diff --git a/src/main/java/net/minecraft/server/BlockFalling.java b/src/main/java/net/minecraft/server/BlockFalling.java +index 6654240..936a754 100644 +--- a/src/main/java/net/minecraft/server/BlockFalling.java ++++ b/src/main/java/net/minecraft/server/BlockFalling.java +@@ -36,7 +36,10 @@ public class BlockFalling extends Block { + + if (!BlockFalling.instaFall && world.areChunksLoadedBetween(blockposition.a(-b0, -b0, -b0), blockposition.a(b0, b0, b0))) { + if (!world.isClientSide) { +- EntityFallingBlock entityfallingblock = new EntityFallingBlock(world, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, world.getType(blockposition)); ++ // Paper start - Add FallingBlock source location ++ org.bukkit.Location loc = new org.bukkit.Location(world.getWorld(), (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F)); ++ EntityFallingBlock entityfallingblock = new EntityFallingBlock(loc, world, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, world.getType(blockposition)); ++ // Paper end + + this.a(entityfallingblock); + world.addEntity(entityfallingblock); +diff --git a/src/main/java/net/minecraft/server/BlockTNT.java b/src/main/java/net/minecraft/server/BlockTNT.java +index f794167..09d5f7b 100644 +--- a/src/main/java/net/minecraft/server/BlockTNT.java ++++ b/src/main/java/net/minecraft/server/BlockTNT.java +@@ -29,7 +29,8 @@ public class BlockTNT extends Block { + + public void wasExploded(World world, BlockPosition blockposition, Explosion explosion) { + if (!world.isClientSide) { +- EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F), explosion.getSource()); ++ org.bukkit.Location loc = explosion.source instanceof EntityTNTPrimed ? ((EntityTNTPrimed) explosion.source).sourceLoc : new org.bukkit.Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()); // Paper ++ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(loc, world, (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F), explosion.getSource()); // Paper - Add loc + + entitytntprimed.setFuseTicks((short) (world.random.nextInt(entitytntprimed.getFuseTicks() / 4) + entitytntprimed.getFuseTicks() / 8)); + world.addEntity(entitytntprimed); +@@ -43,7 +44,8 @@ public class BlockTNT extends Block { + public void a(World world, BlockPosition blockposition, IBlockData iblockdata, EntityLiving entityliving) { + if (!world.isClientSide) { + if (((Boolean) iblockdata.get(BlockTNT.EXPLODE)).booleanValue()) { +- EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F), entityliving); ++ org.bukkit.Location loc = new org.bukkit.Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()); // Paper ++ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(loc, world, (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F), entityliving); // Paper - Add loc + + world.addEntity(entitytntprimed); + world.a((EntityHuman) null, entitytntprimed.locX, entitytntprimed.locY, entitytntprimed.locZ, SoundEffects.gj, SoundCategory.BLOCKS, 1.0F, 1.0F); +diff --git a/src/main/java/net/minecraft/server/DispenserRegistry.java b/src/main/java/net/minecraft/server/DispenserRegistry.java +index d7bea3d..c1c0c7c 100644 +--- a/src/main/java/net/minecraft/server/DispenserRegistry.java ++++ b/src/main/java/net/minecraft/server/DispenserRegistry.java +@@ -519,7 +519,7 @@ public class DispenserRegistry { + } + } + +- EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), (EntityLiving) null); ++ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(block.getLocation(), world, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), (EntityLiving) null); // Paper - Add source loc + // CraftBukkit end + + world.addEntity(entitytntprimed); +diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java +index 9c506ed..500163b 100644 +--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java ++++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java +@@ -17,13 +17,25 @@ public class EntityFallingBlock extends Entity { + private float fallHurtAmount = 2.0F; + public NBTTagCompound tileEntityData; + protected static final DataWatcherObject d = DataWatcher.a(EntityFallingBlock.class, DataWatcherRegistry.j); ++ public org.bukkit.Location sourceLoc; // Paper + ++ // Paper start - FallingBlock source location API + public EntityFallingBlock(World world) { ++ this(null, world); ++ } ++ ++ public EntityFallingBlock(org.bukkit.Location loc, World world) { + super(world); + } + + public EntityFallingBlock(World world, double d0, double d1, double d2, IBlockData iblockdata) { ++ this(null, world, d0, d1, d2, iblockdata); ++ } ++ ++ public EntityFallingBlock(org.bukkit.Location loc, World world, double d0, double d1, double d2, IBlockData iblockdata) { + super(world); ++ sourceLoc = loc; ++ // Paper end + this.block = iblockdata; + this.i = true; + this.setSize(0.98F, 0.98F); +@@ -206,6 +218,13 @@ public class EntityFallingBlock extends Entity { + nbttagcompound.set("TileEntityData", this.tileEntityData); + } + ++ // Paper start - Add FallingBlock source location API ++ if (sourceLoc != null) { ++ nbttagcompound.setInt("SourceLoc_x", sourceLoc.getBlockX()); ++ nbttagcompound.setInt("SourceLoc_y", sourceLoc.getBlockY()); ++ nbttagcompound.setInt("SourceLoc_z", sourceLoc.getBlockZ()); ++ } ++ // Paper end + } + + protected void a(NBTTagCompound nbttagcompound) { +@@ -242,6 +261,14 @@ public class EntityFallingBlock extends Entity { + this.block = Blocks.SAND.getBlockData(); + } + ++ // Paper start - Add FallingBlock source location API ++ if (nbttagcompound.hasKey("SourceLoc_x")) { ++ int srcX = nbttagcompound.getInt("SourceLoc_x"); ++ int srcY = nbttagcompound.getInt("SourceLoc_y"); ++ int srcZ = nbttagcompound.getInt("SourceLoc_z"); ++ sourceLoc = new org.bukkit.Location(world.getWorld(), srcX, srcY, srcZ); ++ } ++ // Paper end + } + + public void a(boolean flag) { +diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java +index 564ea37..1820c7b 100644 +--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java ++++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java +@@ -9,16 +9,28 @@ public class EntityTNTPrimed extends Entity { + private int c; + public float yield = 4; // CraftBukkit - add field + public boolean isIncendiary = false; // CraftBukkit - add field ++ public org.bukkit.Location sourceLoc; // Paper - TNT soure location API + ++ // Paper start - TNT source location API + public EntityTNTPrimed(World world) { ++ this(null, world); ++ } ++ ++ public EntityTNTPrimed(org.bukkit.Location loc, World world) { + super(world); ++ sourceLoc = loc; ++ // Paper end + this.c = 80; + this.i = true; + this.setSize(0.98F, 0.98F); + } + + public EntityTNTPrimed(World world, double d0, double d1, double d2, EntityLiving entityliving) { +- this(world); ++ this(null, world, d0, d1, d2, entityliving); ++ } ++ ++ public EntityTNTPrimed(org.bukkit.Location loc, World world, double d0, double d1, double d2, EntityLiving entityliving) { ++ this(loc, world); + this.setPosition(d0, d1, d2); + float f = (float) (Math.random() * 6.2831854820251465D); + +@@ -100,10 +112,25 @@ public class EntityTNTPrimed extends Entity { + + protected void b(NBTTagCompound nbttagcompound) { + nbttagcompound.setShort("Fuse", (short) this.getFuseTicks()); ++ // Paper start - TNT source location API ++ if (sourceLoc != null) { ++ nbttagcompound.setInt("SourceLoc_x", sourceLoc.getBlockX()); ++ nbttagcompound.setInt("SourceLoc_y", sourceLoc.getBlockY()); ++ nbttagcompound.setInt("SourceLoc_z", sourceLoc.getBlockZ()); ++ } ++ // Paper end + } + + protected void a(NBTTagCompound nbttagcompound) { + this.setFuseTicks(nbttagcompound.getShort("Fuse")); ++ // Paper start - TNT source location API ++ if (nbttagcompound.hasKey("SourceLoc_x")) { ++ int srcX = nbttagcompound.getInt("SourceLoc_x"); ++ int srcY = nbttagcompound.getInt("SourceLoc_y"); ++ int srcZ = nbttagcompound.getInt("SourceLoc_z"); ++ sourceLoc = new org.bukkit.Location(world.getWorld(), srcX, srcY, srcZ); ++ } ++ // Paper end + } + + public EntityLiving getSource() { +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +index 173f1c5..24ecfae 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +@@ -880,7 +880,10 @@ public class CraftWorld implements World { + double y = location.getBlockY() + 0.5; + double z = location.getBlockZ() + 0.5; + +- EntityFallingBlock entity = new EntityFallingBlock(world, x, y, z, net.minecraft.server.Block.getById(material.getId()).fromLegacyData(data)); ++ // Paper start - Add FallingBlock source location API ++ location = location.clone(); ++ EntityFallingBlock entity = new EntityFallingBlock(location, world, x, y, z, net.minecraft.server.Block.getById(material.getId()).fromLegacyData(data)); ++ // Paper end + entity.ticksLived = 1; + + world.addEntity(entity, SpawnReason.CUSTOM); +@@ -916,7 +919,10 @@ public class CraftWorld implements World { + int type = CraftMagicNumbers.getId(blockData.getBlock()); + int data = blockData.getBlock().toLegacyData(blockData); + +- entity = new EntityFallingBlock(world, x + 0.5, y + 0.5, z + 0.5, net.minecraft.server.Block.getById(type).fromLegacyData(data)); ++ // Paper start - Add FallingBlock source location API ++ location = location.clone(); ++ entity = new EntityFallingBlock(location, world, x + 0.5, y + 0.5, z + 0.5, net.minecraft.server.Block.getById(type).fromLegacyData(data)); ++ // Paper end + } else if (Projectile.class.isAssignableFrom(clazz)) { + if (Snowball.class.isAssignableFrom(clazz)) { + entity = new EntitySnowball(world, x, y, z); +@@ -1111,7 +1117,8 @@ public class CraftWorld implements World { + throw new IllegalArgumentException("Cannot spawn hanging entity for " + clazz.getName() + " at " + location); + } + } else if (TNTPrimed.class.isAssignableFrom(clazz)) { +- entity = new EntityTNTPrimed(world, x, y, z, null); ++ org.bukkit.Location loc = new org.bukkit.Location(world.getWorld(), x, y, z); // Paper ++ entity = new EntityTNTPrimed(loc, world, x, y, z, null); + } else if (ExperienceOrb.class.isAssignableFrom(clazz)) { + entity = new EntityExperienceOrb(world, x, y, z, 0); + } else if (Weather.class.isAssignableFrom(clazz)) { +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingSand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingSand.java +index 75eed48..9e6ed0c 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingSand.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingSand.java +@@ -57,4 +57,11 @@ public class CraftFallingSand extends CraftEntity implements FallingSand { + public void setHurtEntities(boolean hurtEntities) { + getHandle().hurtEntities = hurtEntities; + } ++ ++ // Paper start - Add FallingBlock source location API ++ @Override ++ public org.bukkit.Location getSourceLoc() { ++ return getHandle().sourceLoc; ++ } ++ // Paper end + } +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java +index c493c9c..eea3238 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java +@@ -65,4 +65,11 @@ public class CraftTNTPrimed extends CraftEntity implements TNTPrimed { + + return null; + } ++ ++ // Paper start ++ @Override ++ public org.bukkit.Location getSourceLoc() { ++ return getHandle().sourceLoc; ++ } ++ // Paper end + } +-- +2.7.2 + diff --git a/Spigot-Server-Patches/0031-Prevent-tile-entity-and-entity-crashes.patch b/Spigot-Server-Patches/0025-Prevent-tile-entity-and-entity-crashes.patch similarity index 60% rename from Spigot-Server-Patches/0031-Prevent-tile-entity-and-entity-crashes.patch rename to Spigot-Server-Patches/0025-Prevent-tile-entity-and-entity-crashes.patch index cfecd47d75..25a274e973 100644 --- a/Spigot-Server-Patches/0031-Prevent-tile-entity-and-entity-crashes.patch +++ b/Spigot-Server-Patches/0025-Prevent-tile-entity-and-entity-crashes.patch @@ -1,69 +1,68 @@ -From a68057fa44ba44de92cdaf84ed4a047960c9e1bd Mon Sep 17 00:00:00 2001 +From 45a92c6e251d7281edc48b071e4371b9467cd4a6 Mon Sep 17 00:00:00 2001 From: Aikar -Date: Sun, 8 Mar 2015 04:37:23 -0500 +Date: Tue, 1 Mar 2016 23:52:34 -0600 Subject: [PATCH] Prevent tile entity and entity crashes diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index c268a40..3fc6450 100644 +index e6524e9..d898428 100644 --- a/src/main/java/net/minecraft/server/TileEntity.java +++ b/src/main/java/net/minecraft/server/TileEntity.java -@@ -157,7 +157,12 @@ public abstract class TileEntity { +@@ -163,7 +163,12 @@ public abstract class TileEntity { } }); if (this.world != null) { -- CrashReportSystemDetails.a(crashreportsystemdetails, this.position, this.w(), this.u()); -+ // PaperSpigot start - Prevent tile entity and entity crashes -+ Block block = this.w(); +- CrashReportSystemDetails.a(crashreportsystemdetails, this.position, this.getBlock(), this.u()); ++ // Paper start - Prevent TileEntity and Entity crashes ++ Block block = this.getBlock(); + if (block != null) { -+ CrashReportSystemDetails.a(crashreportsystemdetails, this.position, this.w(), this.u()); ++ CrashReportSystemDetails.a(crashreportsystemdetails, this.position, this.getBlock(), this.u()); + } -+ // PaperSpigot end ++ // Paper end crashreportsystemdetails.a("Actual block type", new Callable() { public String a() throws Exception { int i = Block.getId(TileEntity.this.world.getType(TileEntity.this.position).getBlock()); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 46e39f2..c50536e 100644 +index d9a84b6..2406541 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -1418,10 +1418,13 @@ public abstract class World implements IBlockAccess { +@@ -1395,10 +1395,13 @@ public abstract class World implements IBlockAccess { this.g(entity); SpigotTimings.tickEntityTimer.stopTiming(); // Spigot } catch (Throwable throwable1) { -- crashreport = CrashReport.a(throwable1, "Ticking entity"); -- crashreportsystemdetails = crashreport.a("Entity being ticked"); -- entity.appendEntityCrashDetails(crashreportsystemdetails); -- throw new ReportedException(crashreport); -+ // PaperSpigot start - Prevent tile entity and entity crashes +- crashreport1 = CrashReport.a(throwable1, "Ticking entity"); +- crashreportsystemdetails1 = crashreport1.a("Entity being ticked"); +- entity.appendEntityCrashDetails(crashreportsystemdetails1); +- throw new ReportedException(crashreport1); ++ // Paper start - Prevent tile entity and entity crashes + SpigotTimings.tickEntityTimer.stopTiming(); + System.err.println("Entity threw exception at " + entity.world.getWorld().getName() + ":" + entity.locX + "," + entity.locY + "," + entity.locZ); + throwable1.printStackTrace(); + entity.dead = true; + continue; -+ // PaperSpigot end ++ // Paper end } } -@@ -1480,11 +1483,14 @@ public abstract class World implements IBlockAccess { - tileentity.tickTimer.startTiming(); // Spigot - ((IUpdatePlayerListBox) tileentity).c(); +@@ -1460,10 +1463,14 @@ public abstract class World implements IBlockAccess { + ((ITickable) tileentity).c(); + this.methodProfiler.b(); } catch (Throwable throwable2) { -- CrashReport crashreport1 = CrashReport.a(throwable2, "Ticking block entity"); -- CrashReportSystemDetails crashreportsystemdetails1 = crashreport1.a("Block entity being ticked"); -- +- crashreport1 = CrashReport.a(throwable2, "Ticking block entity"); +- crashreportsystemdetails1 = crashreport1.a("Block entity being ticked"); - tileentity.a(crashreportsystemdetails1); - throw new ReportedException(crashreport1); -+ // PaperSpigot start - Prevent tile entity and entity crashes ++ // Paper start - Prevent tile entity and entity crashes + tileentity.tickTimer.stopTiming(); + System.err.println("TileEntity threw exception at " + tileentity.world.getWorld().getName() + ":" + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ()); + throwable2.printStackTrace(); + tilesThisCycle--; -+ this.tileEntityList.remove(tileTickPosition--); ++ this.tileEntityListTick.remove(tileTickPosition--); + continue; -+ // PaperSpigot end ++ // Paper end } // Spigot start finally { -- -2.6.1.windows.1 +2.7.2 diff --git a/Spigot-Server-Patches/0026-Configurable-top-of-nether-void-damage.patch b/Spigot-Server-Patches/0026-Configurable-top-of-nether-void-damage.patch new file mode 100644 index 0000000000..6d49cd98b5 --- /dev/null +++ b/Spigot-Server-Patches/0026-Configurable-top-of-nether-void-damage.patch @@ -0,0 +1,51 @@ +From b957945130e1dcd74a709f8335efee886512b17c Mon Sep 17 00:00:00 2001 +From: Zach Brown +Date: Tue, 1 Mar 2016 23:58:50 -0600 +Subject: [PATCH] Configurable top of nether void damage + + +diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index 6ccd700..a45bb02 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -141,4 +141,10 @@ public class PaperWorldConfig { + waterOverLavaFlowSpeed = getInt("water-over-lava-flow-speed", 5); + log("Water over lava flow speed: " + waterOverLavaFlowSpeed); + } ++ ++ public boolean netherVoidTopDamage; ++ private void netherVoidTopDamage() { ++ netherVoidTopDamage = getBoolean( "nether-ceiling-void-damage", false ); ++ log("Top of the nether void damage: " + netherVoidTopDamage); ++ } + } +diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +index a4a6352..b0834dc 100644 +--- a/src/main/java/net/minecraft/server/Entity.java ++++ b/src/main/java/net/minecraft/server/Entity.java +@@ -299,6 +299,13 @@ public abstract class Entity implements ICommandListener { + this.U(); + } + ++ /** ++ * Paper - Checks if the feature is enabled and the entity is above the nether world bedrock height ++ */ ++ private boolean paperNetherCheck() { ++ return this.world.paperConfig.netherVoidTopDamage && this.world.getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER && this.locY >= 128.0D; ++ } ++ + public void U() { + this.world.methodProfiler.a("entityBaseTick"); + if (this.isPassenger() && this.by().dead) { +@@ -379,7 +386,7 @@ public abstract class Entity implements ICommandListener { + this.fallDistance *= 0.5F; + } + +- if (this.locY < -64.0D) { ++ if (this.locY < -64.0D || paperNetherCheck()) { // Paper - Configurable top-of-nether void damage) + this.Y(); + } + +-- +2.7.2 + diff --git a/Spigot-Server-Patches/0034-Check-online-mode-before-converting-and-renaming-pla.patch b/Spigot-Server-Patches/0027-Check-online-mode-before-converting-and-renaming-pla.patch similarity index 78% rename from Spigot-Server-Patches/0034-Check-online-mode-before-converting-and-renaming-pla.patch rename to Spigot-Server-Patches/0027-Check-online-mode-before-converting-and-renaming-pla.patch index dccfc6e72b..4ddaa8513c 100644 --- a/Spigot-Server-Patches/0034-Check-online-mode-before-converting-and-renaming-pla.patch +++ b/Spigot-Server-Patches/0027-Check-online-mode-before-converting-and-renaming-pla.patch @@ -1,22 +1,22 @@ -From b667634876a8af5cfc59125dffafebc1c8d5b685 Mon Sep 17 00:00:00 2001 +From dc64ce3540b084ffcf8b87f0fa9d7fe71d830fac Mon Sep 17 00:00:00 2001 From: Zach Brown -Date: Thu, 5 Mar 2015 15:30:06 -0600 +Date: Wed, 2 Mar 2016 00:03:55 -0600 Subject: [PATCH] Check online mode before converting and renaming player data diff --git a/src/main/java/net/minecraft/server/WorldNBTStorage.java b/src/main/java/net/minecraft/server/WorldNBTStorage.java -index 7c51750..e5124af 100644 +index df82c14..c2d384c 100644 --- a/src/main/java/net/minecraft/server/WorldNBTStorage.java +++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java -@@ -202,7 +202,7 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData { +@@ -166,7 +166,7 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData { File file = new File(this.playerDir, entityhuman.getUniqueID().toString() + ".dat"); // Spigot Start boolean usingWrongFile = false; - if ( !file.exists() ) -+ if ( org.bukkit.Bukkit.getOnlineMode() && !file.exists() ) // PaperSpigot - Check online mode first ++ if ( org.bukkit.Bukkit.getOnlineMode() && !file.exists() ) // Paper - Check online mode first { file = new File( this.playerDir, UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + entityhuman.getName() ).getBytes( "UTF-8" ) ).toString() + ".dat"); if ( file.exists() ) -- -2.5.2 +2.7.2 diff --git a/Spigot-Server-Patches/0027-Configurable-game-mechanics-changes.patch b/Spigot-Server-Patches/0027-Configurable-game-mechanics-changes.patch deleted file mode 100644 index 1d5a8b1e53..0000000000 --- a/Spigot-Server-Patches/0027-Configurable-game-mechanics-changes.patch +++ /dev/null @@ -1,82 +0,0 @@ -From b550c3d13b8fec67ae07928e772475624ccf31be Mon Sep 17 00:00:00 2001 -From: gsand -Date: Sun, 8 Mar 2015 04:10:02 -0500 -Subject: [PATCH] Configurable game mechanics changes - - -diff --git a/src/main/java/net/minecraft/server/EntityBoat.java b/src/main/java/net/minecraft/server/EntityBoat.java -index f6a43c0..0e6f8c0 100644 ---- a/src/main/java/net/minecraft/server/EntityBoat.java -+++ b/src/main/java/net/minecraft/server/EntityBoat.java -@@ -340,13 +340,7 @@ public class EntityBoat extends Entity { - if (!destroyEvent.isCancelled()) { - this.die(); - if (this.world.getGameRules().getBoolean("doEntityDrops")) { -- for (k = 0; k < 3; ++k) { -- this.a(Item.getItemOf(Blocks.PLANKS), 1, 0.0F); -- } -- -- for (k = 0; k < 2; ++k) { -- this.a(Items.STICK, 1, 0.0F); -- } -+ breakNaturally(); // PaperSpigot - } - } // CraftBukkit end - } -@@ -451,15 +445,7 @@ public class EntityBoat extends Entity { - if (!destroyEvent.isCancelled()) { - this.die(); - if (this.world.getGameRules().getBoolean("doEntityDrops")) { -- int i; -- -- for (i = 0; i < 3; ++i) { -- this.a(Item.getItemOf(Blocks.PLANKS), 1, 0.0F); -- } -- -- for (i = 0; i < 2; ++i) { -- this.a(Items.STICK, 1, 0.0F); -- } -+ breakNaturally(); // PaperSpigot - } - } // CraftBukkit end - } -@@ -495,4 +481,21 @@ public class EntityBoat extends Entity { - public int m() { - return this.datawatcher.getInt(18); - } -+ -+ /** -+ * PaperSpigot - Handles boat drops depending on the user's config setting -+ */ -+ public void breakNaturally() { -+ if (this.world.paperSpigotConfig.boatsDropBoats) { -+ this.a(Items.BOAT, 1, 0.0F); -+ } else { -+ for (int k = 0; k < 3; ++k) { -+ this.a(Item.getItemOf(Blocks.PLANKS), 1, 0.0F); -+ } -+ -+ for (int k = 0; k < 2; ++k) { -+ this.a(Items.STICK, 1, 0.0F); -+ } -+ } -+ } - } -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index 4596616..a6d444b 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -190,4 +190,10 @@ public class PaperSpigotWorldConfig - removeUnloadedTNTEntities = getBoolean( "remove-unloaded.tnt-entities", true ); - removeUnloadedFallingBlocks = getBoolean( "remove-unloaded.falling-blocks", true ); - } -+ -+ public boolean boatsDropBoats; -+ private void mechanicsChanges() -+ { -+ boatsDropBoats = getBoolean( "game-mechanics.boats-drop-boats", false ); -+ } - } --- -2.7.0 - diff --git a/Spigot-Server-Patches/0028-Fix-redstone-lag-issues.patch b/Spigot-Server-Patches/0028-Fix-redstone-lag-issues.patch new file mode 100644 index 0000000000..9968dbfe77 --- /dev/null +++ b/Spigot-Server-Patches/0028-Fix-redstone-lag-issues.patch @@ -0,0 +1,79 @@ +From aad4d45a696b28cd81f39fdcadea59802c9b08d7 Mon Sep 17 00:00:00 2001 +From: Zach Brown +Date: Wed, 2 Mar 2016 00:21:24 -0600 +Subject: [PATCH] Fix redstone lag issues + + +diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index a45bb02..3ac2edd 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -147,4 +147,15 @@ public class PaperWorldConfig { + netherVoidTopDamage = getBoolean( "nether-ceiling-void-damage", false ); + log("Top of the nether void damage: " + netherVoidTopDamage); + } ++ ++ public int tickNextTickCap; ++ public boolean tickNextTickListCapIgnoresRedstone; ++ private void tickNextTickCap() { ++ tickNextTickCap = getInt("tick-next-tick-list-cap", 1000); // Higher values will be friendlier to vanilla style mechanics (to a point) but may hurt performance ++ tickNextTickListCapIgnoresRedstone = getBoolean("tick-next-tick-list-cap-ignores-redstone", false); // Redstone TickNextTicks will always bypass the preceding cap ++ log("WorldServer TickNextTick cap set at " + tickNextTickCap); ++ log("WorldServer TickNextTickList cap always processes redstone: " + tickNextTickListCapIgnoresRedstone); ++ ++ } ++ + } +diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java +index c2ca2df..1c8f6a1 100644 +--- a/src/main/java/net/minecraft/server/WorldServer.java ++++ b/src/main/java/net/minecraft/server/WorldServer.java +@@ -689,6 +689,8 @@ public class WorldServer extends World implements IAsyncTaskHandler { + if (false) { // CraftBukkit + throw new IllegalStateException("TickNextTick list out of synch"); + } else { ++ // Paper start - No, stop doing this, it affects things like redstone ++ /* + if (i > 1000) { + // CraftBukkit start - If the server has too much to process over time, try to alleviate that + if (i > 20 * 1000) { +@@ -698,6 +700,11 @@ public class WorldServer extends World implements IAsyncTaskHandler { + } + // CraftBukkit end + } ++ */ ++ if (i > paperConfig.tickNextTickCap) { ++ i = paperConfig.tickNextTickCap; ++ } ++ // Paper end + + this.methodProfiler.a("cleaning"); + +@@ -715,6 +722,24 @@ public class WorldServer extends World implements IAsyncTaskHandler { + this.U.add(nextticklistentry); + } + ++ // Paper start - Allow redstone ticks to bypass the tickNextTickListCap ++ if (paperConfig.tickNextTickListCapIgnoresRedstone) { ++ Iterator iterator = this.nextTickList.iterator(); ++ while (iterator.hasNext()) { ++ NextTickListEntry next = iterator.next(); ++ if (!flag && next.b > this.worldData.getTime()) { ++ break; ++ } ++ ++ IBlockData data = next.a().getBlockData(); ++ if (next.a().isPowerSource(data) || next.a() instanceof IInventory) { ++ iterator.remove(); ++ this.U.add(next); ++ } ++ } ++ } ++ // Paper end ++ + this.methodProfiler.b(); + this.methodProfiler.a("ticking"); + Iterator iterator = this.U.iterator(); +-- +2.7.2 + diff --git a/Spigot-Server-Patches/0029-Allow-specified-ItemStacks-to-retain-their-invalid-d.patch b/Spigot-Server-Patches/0029-Allow-specified-ItemStacks-to-retain-their-invalid-d.patch deleted file mode 100644 index 916390e362..0000000000 --- a/Spigot-Server-Patches/0029-Allow-specified-ItemStacks-to-retain-their-invalid-d.patch +++ /dev/null @@ -1,68 +0,0 @@ -From 6a96486151df3e2561efe99e284926b68531aef0 Mon Sep 17 00:00:00 2001 -From: Byteflux -Date: Sun, 30 Nov 2014 18:58:07 -0600 -Subject: [PATCH] Allow specified ItemStacks to retain their invalid data - - -diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java -index 5496805..015ce28 100644 ---- a/src/main/java/net/minecraft/server/ItemStack.java -+++ b/src/main/java/net/minecraft/server/ItemStack.java -@@ -18,6 +18,8 @@ import org.bukkit.entity.Player; - import org.bukkit.event.world.StructureGrowEvent; - // CraftBukkit end - -+import org.github.paperspigot.PaperSpigotConfig; // PaperSpigot -+ - public final class ItemStack { - - public static final DecimalFormat a = new DecimalFormat("#.###"); -@@ -321,9 +323,13 @@ public final class ItemStack { - } - - // Is this a block? -- if (CraftMagicNumbers.getBlock(CraftMagicNumbers.getId(this.getItem())) != Blocks.AIR) { -+ // PaperSpigot start - Allow specific blocks to retain their data values -+ int id = CraftMagicNumbers.getId(this.getItem()); -+ if (CraftMagicNumbers.getBlock(id) != Blocks.AIR) { - // If vanilla doesn't use data on it don't allow any -- if (!(this.usesData() || this.getItem().usesDurability())) { -+ if ((PaperSpigotConfig.dataValueAllowedItems == null || !PaperSpigotConfig.dataValueAllowedItems.contains(id)) && -+ (!(this.usesData() || this.getItem().usesDurability()))) { -+ // PaperSpigot end - i = 0; - } - } -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java -index 5df90f9..744773d 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java -@@ -6,11 +6,10 @@ import java.io.IOException; - import java.lang.reflect.InvocationTargetException; - import java.lang.reflect.Method; - import java.lang.reflect.Modifier; --import java.util.HashMap; --import java.util.List; --import java.util.Map; -+import java.util.*; - import java.util.logging.Level; - import net.minecraft.server.MinecraftServer; -+import org.apache.commons.lang.StringUtils; - import org.bukkit.Bukkit; - import org.bukkit.command.Command; - import org.bukkit.configuration.InvalidConfigurationException; -@@ -162,4 +161,11 @@ public class PaperSpigotConfig - strengthEffectModifier = getDouble( "effect-modifiers.strength", 1.3D ); - weaknessEffectModifier = getDouble( "effect-modifiers.weakness", -0.5D ); - } -+ -+ public static Set dataValueAllowedItems; -+ private static void dataValueAllowedItems() -+ { -+ dataValueAllowedItems = new HashSet( getList( "data-value-allowed-items", Collections.emptyList() ) ); -+ Bukkit.getLogger().info( "Data value allowed items: " + StringUtils.join(dataValueAllowedItems, ", ") ); -+ } - } --- -2.5.2 - diff --git a/Spigot-Server-Patches/0029-Always-tick-falling-blocks.patch b/Spigot-Server-Patches/0029-Always-tick-falling-blocks.patch new file mode 100644 index 0000000000..39977af58b --- /dev/null +++ b/Spigot-Server-Patches/0029-Always-tick-falling-blocks.patch @@ -0,0 +1,57 @@ +From 168fdae3cde0d895e3ac002c11c988c09069a28b Mon Sep 17 00:00:00 2001 +From: Zach Brown +Date: Wed, 2 Mar 2016 00:32:25 -0600 +Subject: [PATCH] Always tick falling blocks + + +diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java +index d88f1b1..97fbd95 100644 +--- a/src/main/java/org/spigotmc/ActivationRange.java ++++ b/src/main/java/org/spigotmc/ActivationRange.java +@@ -2,33 +2,8 @@ package org.spigotmc; + + import java.util.List; + import java.util.Set; +-import net.minecraft.server.AxisAlignedBB; +-import net.minecraft.server.Chunk; +-import net.minecraft.server.Entity; +-import net.minecraft.server.EntityAmbient; +-import net.minecraft.server.EntityAnimal; +-import net.minecraft.server.EntityArrow; +-import net.minecraft.server.EntityComplexPart; +-import net.minecraft.server.EntityCreature; +-import net.minecraft.server.EntityCreeper; +-import net.minecraft.server.EntityEnderCrystal; +-import net.minecraft.server.EntityEnderDragon; +-import net.minecraft.server.EntityFireball; +-import net.minecraft.server.EntityFireworks; +-import net.minecraft.server.EntityHuman; +-import net.minecraft.server.EntityLiving; +-import net.minecraft.server.EntityMonster; +-import net.minecraft.server.EntityProjectile; +-import net.minecraft.server.EntitySheep; +-import net.minecraft.server.EntitySlice; +-import net.minecraft.server.EntitySlime; +-import net.minecraft.server.EntityTNTPrimed; +-import net.minecraft.server.EntityVillager; +-import net.minecraft.server.EntityWeather; +-import net.minecraft.server.EntityWither; +-import net.minecraft.server.MathHelper; +-import net.minecraft.server.MinecraftServer; +-import net.minecraft.server.World; ++ ++import net.minecraft.server.*; + import org.bukkit.craftbukkit.SpigotTimings; + + public class ActivationRange +@@ -80,6 +55,7 @@ public class ActivationRange + || entity instanceof EntityFireball + || entity instanceof EntityWeather + || entity instanceof EntityTNTPrimed ++ || entity instanceof EntityFallingBlock // Paper - Always tick falling blocks + || entity instanceof EntityEnderCrystal + || entity instanceof EntityFireworks ) + { +-- +2.7.2 + diff --git a/Spigot-Server-Patches/0030-Add-TNT-source-location-API.patch b/Spigot-Server-Patches/0030-Add-TNT-source-location-API.patch deleted file mode 100644 index d02b3a099b..0000000000 --- a/Spigot-Server-Patches/0030-Add-TNT-source-location-API.patch +++ /dev/null @@ -1,132 +0,0 @@ -From caf326d2691e94f197820555136aac73ef7cee29 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sun, 8 Mar 2015 04:23:41 -0500 -Subject: [PATCH] Add TNT source location API - - -diff --git a/src/main/java/net/minecraft/server/BlockTNT.java b/src/main/java/net/minecraft/server/BlockTNT.java -index e151bc5..27ce179 100644 ---- a/src/main/java/net/minecraft/server/BlockTNT.java -+++ b/src/main/java/net/minecraft/server/BlockTNT.java -@@ -29,7 +29,8 @@ public class BlockTNT extends Block { - - public void wasExploded(World world, BlockPosition blockposition, Explosion explosion) { - if (!world.isClientSide) { -- EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F), explosion.getSource()); -+ org.bukkit.Location loc = explosion.source instanceof EntityTNTPrimed ? ((EntityTNTPrimed) explosion.source).sourceLoc : new org.bukkit.Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()); // PaperSpigot -+ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(loc, world, (double) ((float) blockposition.getX() + 0.5F), (double) ((float) blockposition.getY() + 0.5F), (double) ((float) blockposition.getZ() + 0.5F), explosion.getSource()); // PaperSpigot - add loc - - entitytntprimed.fuseTicks = world.random.nextInt(entitytntprimed.fuseTicks / 4) + entitytntprimed.fuseTicks / 8; - world.addEntity(entitytntprimed); -@@ -43,7 +44,8 @@ public class BlockTNT extends Block { - public void a(World world, BlockPosition blockposition, IBlockData iblockdata, EntityLiving entityliving) { - if (!world.isClientSide) { - if (((Boolean) iblockdata.get(BlockTNT.EXPLODE)).booleanValue()) { -- EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F), entityliving); -+ org.bukkit.Location loc = new org.bukkit.Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()); // PaperSpigot -+ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(loc, world, (double) ((float) blockposition.getX() + 0.5F), (double) ((float) blockposition.getY() + 0.5F), (double) ((float) blockposition.getZ() + 0.5F), entityliving); // PaperSpigot - add loc - - world.addEntity(entitytntprimed); - world.makeSound(entitytntprimed, "game.tnt.primed", 1.0F, 1.0F); -diff --git a/src/main/java/net/minecraft/server/DispenserRegistry.java b/src/main/java/net/minecraft/server/DispenserRegistry.java -index f2c78f3..bc07d3d 100644 ---- a/src/main/java/net/minecraft/server/DispenserRegistry.java -+++ b/src/main/java/net/minecraft/server/DispenserRegistry.java -@@ -541,7 +541,7 @@ public class DispenserRegistry { - } - } - -- EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), (EntityLiving) null); -+ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(block.getLocation(), world, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), (EntityLiving) null); // PaperSpigot - // CraftBukkit end - - world.addEntity(entitytntprimed); -diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java -index 2eeea05..7f82c4a 100644 ---- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java -+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java -@@ -8,15 +8,23 @@ public class EntityTNTPrimed extends Entity { - private EntityLiving source; - public float yield = 4; // CraftBukkit - add field - public boolean isIncendiary = false; // CraftBukkit - add field -+ public org.bukkit.Location sourceLoc; // PaperSpigot - -+ // PaperSpigot start - TNT source location API - public EntityTNTPrimed(World world) { -+ this(null, world); -+ } -+ -+ public EntityTNTPrimed(org.bukkit.Location loc, World world) { - super(world); -+ sourceLoc = loc; -+ // PaperSpigot end - this.k = true; - this.setSize(0.98F, 0.98F); - } - -- public EntityTNTPrimed(World world, double d0, double d1, double d2, EntityLiving entityliving) { -- this(world); -+ public EntityTNTPrimed(org.bukkit.Location loc, World world, double d0, double d1, double d2, EntityLiving entityliving) { -+ this(loc, world); - this.setPosition(d0, d1, d2); - float f = (float) (Math.random() * 3.1415927410125732D * 2.0D); - -@@ -102,10 +110,25 @@ public class EntityTNTPrimed extends Entity { - - protected void b(NBTTagCompound nbttagcompound) { - nbttagcompound.setByte("Fuse", (byte) this.fuseTicks); -+ // PaperSpigot start - TNT source location API -+ if (sourceLoc != null) { -+ nbttagcompound.setInt("SourceLoc_x", sourceLoc.getBlockX()); -+ nbttagcompound.setInt("SourceLoc_y", sourceLoc.getBlockY()); -+ nbttagcompound.setInt("SourceLoc_z", sourceLoc.getBlockZ()); -+ } -+ // PaperSpigot end - } - - protected void a(NBTTagCompound nbttagcompound) { - this.fuseTicks = nbttagcompound.getByte("Fuse"); -+ // PaperSpigot start - TNT source location API -+ if (nbttagcompound.hasKey("SourceLoc_x")) { -+ int srcX = nbttagcompound.getInt("SourceLoc_x"); -+ int srcY = nbttagcompound.getInt("SourceLoc_y"); -+ int srcZ = nbttagcompound.getInt("SourceLoc_z"); -+ sourceLoc = new org.bukkit.Location(world.getWorld(), srcX, srcY, srcZ); -+ } -+ // PaperSpigot end - } - - public EntityLiving getSource() { -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 89e78ab..d8417c9 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -1110,7 +1110,8 @@ public class CraftWorld implements World { - throw new IllegalArgumentException("Cannot spawn hanging entity for " + clazz.getName() + " at " + location); - } - } else if (TNTPrimed.class.isAssignableFrom(clazz)) { -- entity = new EntityTNTPrimed(world, x, y, z, null); -+ org.bukkit.Location loc = new org.bukkit.Location(world.getWorld(), x, y, z); // PaperSpigot -+ entity = new EntityTNTPrimed(loc, world, x, y, z, null); - } else if (ExperienceOrb.class.isAssignableFrom(clazz)) { - entity = new EntityExperienceOrb(world, x, y, z, 0); - } else if (Weather.class.isAssignableFrom(clazz)) { -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java -index e08ad47..b7e8b4d 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java -@@ -65,4 +65,11 @@ public class CraftTNTPrimed extends CraftEntity implements TNTPrimed { - - return null; - } -+ -+ // PaperSpigot start -+ @Override -+ public org.bukkit.Location getSourceLoc() { -+ return getHandle().sourceLoc; -+ } -+ // PaperSpigot end - } --- -2.7.0 - diff --git a/Spigot-Server-Patches/0038-Configurable-async-light-updates.patch b/Spigot-Server-Patches/0030-Configurable-async-light-updates.patch similarity index 64% rename from Spigot-Server-Patches/0038-Configurable-async-light-updates.patch rename to Spigot-Server-Patches/0030-Configurable-async-light-updates.patch index 0f55babef5..0daf619a6c 100644 --- a/Spigot-Server-Patches/0038-Configurable-async-light-updates.patch +++ b/Spigot-Server-Patches/0030-Configurable-async-light-updates.patch @@ -1,61 +1,75 @@ -From 887a1070709897069646cb85cb7c86813926d695 Mon Sep 17 00:00:00 2001 +From be968a89c4fbd89664c97deeeeaacbc8b004209b Mon Sep 17 00:00:00 2001 From: Byteflux -Date: Wed, 1 Jul 2015 00:18:10 -0700 +Date: Wed, 2 Mar 2016 00:52:31 -0600 Subject: [PATCH] Configurable async light updates +diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index 3ac2edd..3506b1b 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -158,4 +158,9 @@ public class PaperWorldConfig { + + } + ++ public boolean useAsyncLighting; ++ private void useAsyncLighting() { ++ useAsyncLighting = getBoolean( "use-async-lighting", false ); ++ log("World async lighting: " + useAsyncLighting); ++ } + } diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 7242d45..5a3b22a 100644 +index 2f37957..3e9b26f 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -11,6 +11,8 @@ import java.util.Map; import java.util.Random; import java.util.concurrent.Callable; import java.util.concurrent.ConcurrentLinkedQueue; -+import java.util.concurrent.atomic.AtomicInteger; // PaperSpigot ++import java.util.concurrent.atomic.AtomicInteger; // Paper + import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -@@ -43,6 +45,10 @@ public class Chunk { - private int v; - private ConcurrentLinkedQueue w; +@@ -44,6 +46,10 @@ public class Chunk { + private int w; + private ConcurrentLinkedQueue x; protected gnu.trove.map.hash.TObjectIntHashMap entityCount = new gnu.trove.map.hash.TObjectIntHashMap(); // Spigot -+ // PaperSpigot start - Asynchronous light updates ++ // Paper start - Asynchronous light updates + public AtomicInteger pendingLightUpdates = new AtomicInteger(); + public long lightUpdateTime; -+ // PaperSpigot end ++ // Paper end // CraftBukkit start - Neighbor loaded cache for chunk lighting and entity ticking private int neighbors = 0x1 << 12; -@@ -274,7 +280,7 @@ public class Chunk { +@@ -278,7 +284,7 @@ public class Chunk { private void a(int i, int j, int k, int l) { if (l > k && this.world.areChunksLoaded(new BlockPosition(i, 0, j), 16)) { for (int i1 = k; i1 < l; ++i1) { - this.world.c(EnumSkyBlock.SKY, new BlockPosition(i, i1, j)); -+ this.world.updateLight(EnumSkyBlock.SKY, new BlockPosition(i, i1, j)); // PaperSpigot - Asynchronous lighting updates ++ this.world.updateLight(EnumSkyBlock.SKY, new BlockPosition(i, i1, j)); } - this.q = true; -@@ -1044,7 +1050,7 @@ public class Chunk { + this.r = true; +@@ -991,7 +997,7 @@ public class Chunk { public void b(boolean flag) { - if (this.k && !this.world.worldProvider.o() && !flag) { + if (this.l && !this.world.worldProvider.m() && !flag) { - this.h(this.world.isClientSide); -+ this.recheckGaps(this.world.isClientSide); // PaperSpigot - Asynchronous lighting updates ++ this.recheckGaps(this.world.isClientSide); // Paper - Asynchronous lighting updates } - this.p = true; -@@ -1065,6 +1071,23 @@ public class Chunk { + this.q = true; +@@ -1012,6 +1018,23 @@ public class Chunk { } + /** -+ * PaperSpigot - Recheck gaps asynchronously. ++ * Paper- Recheck gaps asynchronously + */ + public void recheckGaps(final boolean isClientSide) { -+ if (!world.paperSpigotConfig.useAsyncLighting) { -+ this.h(isClientSide); ++ if (!world.paperConfig.useAsyncLighting) { ++ this.h(this.world.isClientSide); + return; + } + @@ -71,75 +85,79 @@ index 7242d45..5a3b22a 100644 // Spigot Start /* diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 975d666..ae0f276 100644 +index fd3f457..72c1fc7 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -53,6 +53,12 @@ public class ChunkProviderServer implements IChunkProvider { +@@ -46,6 +46,12 @@ public class ChunkProviderServer implements IChunkProvider { } public void queueUnload(int i, int j) { -+ // PaperSpigot start - Asynchronous lighting updates ++ // Paper start - Asynchronous lighting updates + Chunk chunk = chunks.get(LongHash.toLong(i, j)); -+ if (chunk != null && chunk.world.paperSpigotConfig.useAsyncLighting && (chunk.pendingLightUpdates.get() > 0 || chunk.world.getTime() - chunk.lightUpdateTime < 20)) { ++ if (chunk != null && chunk.world.paperConfig.useAsyncLighting && (chunk.pendingLightUpdates.get() > 0 || chunk.world.getTime() - chunk.lightUpdateTime < 20)) { + return; + } -+ // PaperSpigot end - if (this.world.worldProvider.e()) { - if (!this.world.c(i, j)) { - // CraftBukkit start ++ // Paper end + if (this.world.worldProvider.c(i, j)) { + // CraftBukkit start + this.unloadQueue.add(i, j); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index c50536e..82c43e3 100644 +index 180eccb..79cd94d 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -18,6 +18,12 @@ import org.bukkit.generator.ChunkGenerator; - import java.util.*; - import java.util.concurrent.Callable; +@@ -29,6 +29,12 @@ import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; + import org.bukkit.generator.ChunkGenerator; + // CraftBukkit end -+// PaperSpigot start ++// Paper start +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import com.google.common.util.concurrent.ThreadFactoryBuilder; -+// PaperSpigot end ++// Paper end + - // CraftBukkit start - // CraftBukkit end + public abstract class World implements IBlockAccess { -@@ -128,6 +134,7 @@ public abstract class World implements IBlockAccess { + private int a = 63; +@@ -134,6 +140,7 @@ public abstract class World implements IBlockAccess { private org.spigotmc.TickLimiter entityLimiter; private org.spigotmc.TickLimiter tileLimiter; private int tileTickPosition; -+ public ExecutorService lightingExecutor = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder().setNameFormat("PaperSpigot - Lighting Thread").build()); // PaperSpigot - Asynchronous lighting updates ++ public ExecutorService lightingExecutor = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder().setNameFormat("Paper - Lighting Thread").build()); // Paper - Asynchronous lighting updates - public static long chunkToKey(int x, int z) - { -@@ -497,7 +504,7 @@ public abstract class World implements IBlockAccess { + public CraftWorld getWorld() { + return this.world; +@@ -447,7 +454,7 @@ public abstract class World implements IBlockAccess { - if (!this.worldProvider.o()) { + if (!this.worldProvider.m()) { for (i1 = k; i1 <= l; ++i1) { - this.c(EnumSkyBlock.SKY, new BlockPosition(i, i1, j)); -+ this.updateLight(EnumSkyBlock.SKY, new BlockPosition(i, i1, j)); // PaperSpigot - Asynchronous lighting updates ++ this.updateLight(EnumSkyBlock.SKY, new BlockPosition(i, i1, j)); // Paper - Asynchronous lighting updates } } -@@ -2325,10 +2332,10 @@ public abstract class World implements IBlockAccess { +@@ -2215,10 +2222,10 @@ public abstract class World implements IBlockAccess { boolean flag = false; - if (!this.worldProvider.o()) { + if (!this.worldProvider.m()) { - flag |= this.c(EnumSkyBlock.SKY, blockposition); -+ flag |= this.updateLight(EnumSkyBlock.SKY, blockposition); // PaperSpigot - Asynchronous lighting updates ++ flag |= this.updateLight(EnumSkyBlock.SKY, blockposition); // Paper - Asynchronous lighting updates } - flag |= this.c(EnumSkyBlock.BLOCK, blockposition); -+ flag |= this.updateLight(EnumSkyBlock.BLOCK, blockposition); // PaperSpigot - Asynchronous lighting updates ++ flag |= this.updateLight(EnumSkyBlock.BLOCK, blockposition); // Paper - Asynchronous lighting updates return flag; } -@@ -2375,10 +2382,10 @@ public abstract class World implements IBlockAccess { +@@ -2268,10 +2275,15 @@ public abstract class World implements IBlockAccess { } } -- public boolean c(EnumSkyBlock enumskyblock, BlockPosition blockposition) { -+ public boolean c(EnumSkyBlock enumskyblock, BlockPosition blockposition, Chunk chunk, List neighbors) { // PaperSpigot ++ // Paper start - Asynchronous lighting updates + public boolean c(EnumSkyBlock enumskyblock, BlockPosition blockposition) { ++ return this.c(enumskyblock, blockposition, null, null); ++ } ++ ++ public boolean c(EnumSkyBlock enumskyblock, BlockPosition blockposition, Chunk chunk, List neighbors) { // Paper // CraftBukkit start - Use neighbor cache instead of looking up - Chunk chunk = this.getChunkIfLoaded(blockposition.getX() >> 4, blockposition.getZ() >> 4); - if (chunk == null || !chunk.areNeighborsLoaded(1) /*!this.areChunksLoaded(blockposition, 17, false)*/) { @@ -148,12 +166,12 @@ index c50536e..82c43e3 100644 // CraftBukkit end return false; } else { -@@ -2496,11 +2503,66 @@ public abstract class World implements IBlockAccess { - } +@@ -2342,6 +2354,17 @@ public abstract class World implements IBlockAccess { + i = 0; } -+ // PaperSpigot start - Asynchronous light updates -+ if (chunk.world.paperSpigotConfig.useAsyncLighting) { ++ // Paper start - Asynchronous light updates ++ if (chunk.world.paperConfig.useAsyncLighting) { + chunk.pendingLightUpdates.decrementAndGet(); + if (neighbors != null) { + for (Chunk neighbor : neighbors) { @@ -161,14 +179,17 @@ index c50536e..82c43e3 100644 + } + } + } -+ // PaperSpigot end ++ // Paper end ++ this.methodProfiler.b(); - return true; + this.methodProfiler.a("checkedPosition < toCheckCount"); + +@@ -2396,6 +2419,52 @@ public abstract class World implements IBlockAccess { } } + /** -+ * PaperSpigot - Asynchronous lighting updates ++ * Paper - Asynchronous lighting updates + */ + public boolean updateLight(final EnumSkyBlock enumskyblock, final BlockPosition position) { + int x = position.getX(); @@ -178,7 +199,7 @@ index c50536e..82c43e3 100644 + return false; + } + -+ if (!chunk.world.paperSpigotConfig.useAsyncLighting) { ++ if (!chunk.world.paperConfig.useAsyncLighting) { + return this.c(enumskyblock, position, chunk, null); + } + @@ -186,6 +207,7 @@ index c50536e..82c43e3 100644 + chunk.lightUpdateTime = chunk.world.getTime(); + + final List neighbors = new ArrayList(); ++ + for (int cx = (x >> 4) - 1; cx <= (x >> 4) + 1; ++cx) { + for (int cz = (z >> 4) - 1; cz <= (z >> 4) + 1; ++cz) { + if (cx != x >> 4 && cz != z >> 4) { @@ -215,22 +237,6 @@ index c50536e..82c43e3 100644 public boolean a(boolean flag) { return false; } -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index c8971d1..9ad53fa 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -212,4 +212,11 @@ public class PaperSpigotWorldConfig - log( "WorldServer TickNextTick cap set at " + tickNextTickCap ); - log( "WorldServer TickNextTickList cap always processes redstone: " + tickNextTickListCapIgnoresRedstone ); - } -+ -+ public boolean useAsyncLighting; -+ private void useAsyncLighting() -+ { -+ useAsyncLighting = getBoolean( "use-async-lighting", false ); -+ log( "World async lighting: " + useAsyncLighting ); -+ } - } -- -2.7.0 +2.7.2 diff --git a/Spigot-Server-Patches/0031-Optimize-draining.patch b/Spigot-Server-Patches/0031-Optimize-draining.patch new file mode 100644 index 0000000000..086987b5b7 --- /dev/null +++ b/Spigot-Server-Patches/0031-Optimize-draining.patch @@ -0,0 +1,28 @@ +From 114d4ec98f8118bca7faf64c5d7a0eeac6b2bebf Mon Sep 17 00:00:00 2001 +From: Byteflux +Date: Wed, 2 Mar 2016 00:55:24 -0600 +Subject: [PATCH] Optimize draining + + +diff --git a/src/main/java/net/minecraft/server/BlockFlowing.java b/src/main/java/net/minecraft/server/BlockFlowing.java +index 328615c..ec04cd8 100644 +--- a/src/main/java/net/minecraft/server/BlockFlowing.java ++++ b/src/main/java/net/minecraft/server/BlockFlowing.java +@@ -88,7 +88,13 @@ public class BlockFlowing extends BlockFluids { + iblockdata = iblockdata.set(BlockFlowing.LEVEL, Integer.valueOf(i1)); + world.setTypeAndData(blockposition, iblockdata, 2); + world.a(blockposition, (Block) this, j); +- world.applyPhysics(blockposition, this); ++ // Paper start - Optimize draining ++ world.e(blockposition.west(), this); ++ world.e(blockposition.east(), this); ++ world.e(blockposition.up(), this); ++ world.e(blockposition.north(), this); ++ world.e(blockposition.south(), this); ++ // Paper end + } + } + } else { +-- +2.7.2 + diff --git a/Spigot-Server-Patches/0032-Configurable-end-credits-when-leaving-the-end.patch b/Spigot-Server-Patches/0032-Configurable-end-credits-when-leaving-the-end.patch new file mode 100644 index 0000000000..1acb88c64c --- /dev/null +++ b/Spigot-Server-Patches/0032-Configurable-end-credits-when-leaving-the-end.patch @@ -0,0 +1,75 @@ +From b65a790b6121f108f31a54f98e6cee3368e00807 Mon Sep 17 00:00:00 2001 +From: DoctorDark +Date: Wed, 2 Mar 2016 01:17:06 -0600 +Subject: [PATCH] Configurable end credits when leaving the end + + +diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index 3506b1b..e68595b 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -163,4 +163,10 @@ public class PaperWorldConfig { + useAsyncLighting = getBoolean( "use-async-lighting", false ); + log("World async lighting: " + useAsyncLighting); + } ++ ++ public boolean disableEndCredits; ++ private void disableEndCredits() { ++ disableEndCredits = getBoolean("game-mechanics.disable-end-credits", false); ++ log("End credits disabled: " + disableEndCredits); ++ } + } +diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java +index 2f1d95b..b32617b 100644 +--- a/src/main/java/net/minecraft/server/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/EntityPlayer.java +@@ -526,9 +526,11 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + + public Entity c(int i) { + this.cj = true; ++ // Paper start - Allow configurable end portal credits + if (this.dimension == 1 && i == 1) { +- this.world.kill(this); +- if (!this.viewingCredits) { ++ if (!this.viewingCredits && !world.paperConfig.disableEndCredits) { ++ this.world.kill(this); ++ // Paper end + this.viewingCredits = true; + if (this.a(AchievementList.D)) { + this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(4, 0.0F)); +@@ -546,7 +548,9 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + } else { + this.b((Statistic) AchievementList.y); + } ++ } + ++ if (!(this.dimension == 1 && i == 1) || world.paperConfig.disableEndCredits) { // Paper - Allow configurable end portal credits + // CraftBukkit start + TeleportCause cause = (this.dimension == 1 || i == 1) ? TeleportCause.END_PORTAL : TeleportCause.NETHER_PORTAL; + this.server.getPlayerList().changeDimension(this, i, cause); // PAIL: check all this +@@ -557,6 +561,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + this.cb = -1; + return this; + } ++ ++ return null; // Paper - Theoretically it should never make it here + } + + public boolean a(EntityPlayer entityplayer) { +diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java +index 50add77..38d20b7 100644 +--- a/src/main/java/net/minecraft/server/PlayerList.java ++++ b/src/main/java/net/minecraft/server/PlayerList.java +@@ -730,7 +730,8 @@ public abstract class PlayerList { + return; + } + +- exit = event.useTravelAgent() ? event.getPortalTravelAgent().findOrCreate(event.getTo()) : event.getTo(); ++ // Paper - Configurable end credits, if a plugin sets to use a travel agent even if the cause is an end portal, ignore it ++ exit = cause != TeleportCause.END_PORTAL && event.useTravelAgent() ? event.getPortalTravelAgent().findOrCreate(event.getTo()) : event.getTo(); + if (exit == null) { + return; + } +-- +2.7.2 + diff --git a/Spigot-Server-Patches/0032-Configurable-top-of-nether-void-damage.patch b/Spigot-Server-Patches/0032-Configurable-top-of-nether-void-damage.patch deleted file mode 100644 index 9eafb350ed..0000000000 --- a/Spigot-Server-Patches/0032-Configurable-top-of-nether-void-damage.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 61dc85a7666c14d6599771c6fe971920efd40fb9 Mon Sep 17 00:00:00 2001 -From: Zach Brown -Date: Mon, 23 Feb 2015 14:57:28 -0600 -Subject: [PATCH] Configurable top of nether void damage - - -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 3e89aa9..a3b4cdb 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -248,6 +248,13 @@ public abstract class Entity implements ICommandListener { - this.K(); - } - -+ /** -+ * PaperSpigot - Checks if the feature is enabled and the entity is above the nether world bedrock height -+ */ -+ private boolean paperNetherCheck() { -+ return this.world.paperSpigotConfig.netherVoidTopDamage && this.world.getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER && this.locY >= 128.0D; -+ } -+ - public void K() { - this.world.methodProfiler.a("entityBaseTick"); - if (this.vehicle != null && this.vehicle.dead) { -@@ -324,7 +331,7 @@ public abstract class Entity implements ICommandListener { - this.fallDistance *= 0.5F; - } - -- if (this.locY < -64.0D) { -+ if (this.locY < -64.0D || paperNetherCheck()) { // PaperSpigot - Configurable top-of-nether void damage - this.O(); - } - -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index a6d444b..b2f9a8e 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -196,4 +196,10 @@ public class PaperSpigotWorldConfig - { - boatsDropBoats = getBoolean( "game-mechanics.boats-drop-boats", false ); - } -+ -+ public boolean netherVoidTopDamage; -+ private void nethervoidTopDamage() -+ { -+ netherVoidTopDamage = getBoolean( "nether-ceiling-void-damage", false ); -+ } - } --- -2.7.0 - diff --git a/Spigot-Server-Patches/0033-Enderman-drop-the-block-they-re-holding-when-they-di.patch b/Spigot-Server-Patches/0033-Enderman-drop-the-block-they-re-holding-when-they-di.patch deleted file mode 100644 index 1ed254baa8..0000000000 --- a/Spigot-Server-Patches/0033-Enderman-drop-the-block-they-re-holding-when-they-di.patch +++ /dev/null @@ -1,27 +0,0 @@ -From addd766578b634af56ba6ceef98ea1d74426f9f1 Mon Sep 17 00:00:00 2001 -From: Zach -Date: Fri, 13 Feb 2015 14:49:30 -0600 -Subject: [PATCH] Enderman drop the block they're holding when they die - - -diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java -index a250062..f3afbbd 100644 ---- a/src/main/java/net/minecraft/server/EntityEnderman.java -+++ b/src/main/java/net/minecraft/server/EntityEnderman.java -@@ -251,6 +251,13 @@ public class EntityEnderman extends EntityMonster { - } - } - -+ // PaperSpigot start - Drop the block the entity is holding when it dies -+ Item carriedItem = Item.getItemOf(getCarried().getBlock()); -+ if (carriedItem != null) { -+ this.a(carriedItem, 1); -+ } -+ // PaperSpigot end -+ - } - - public void setCarried(IBlockData iblockdata) { --- -2.5.2 - diff --git a/Spigot-Server-Patches/0046-Fix-lag-from-explosions-processing-dead-entities.patch b/Spigot-Server-Patches/0033-Fix-lag-from-explosions-processing-dead-entities.patch similarity index 83% rename from Spigot-Server-Patches/0046-Fix-lag-from-explosions-processing-dead-entities.patch rename to Spigot-Server-Patches/0033-Fix-lag-from-explosions-processing-dead-entities.patch index 2b70aa5faf..562656e96e 100644 --- a/Spigot-Server-Patches/0046-Fix-lag-from-explosions-processing-dead-entities.patch +++ b/Spigot-Server-Patches/0033-Fix-lag-from-explosions-processing-dead-entities.patch @@ -1,11 +1,11 @@ -From ddac02b42300698b7bff62fc5dc572ecb91cac5f Mon Sep 17 00:00:00 2001 +From cd20fd6624aa3ff40de2ce1e5219743c289bf2e7 Mon Sep 17 00:00:00 2001 From: Iceee -Date: Mon, 1 Jun 2015 22:54:18 -0700 +Date: Wed, 2 Mar 2016 01:39:52 -0600 Subject: [PATCH] Fix lag from explosions processing dead entities diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java -index c41b911..78e3a7d 100644 +index 2d8d862..87e123c 100644 --- a/src/main/java/net/minecraft/server/Explosion.java +++ b/src/main/java/net/minecraft/server/Explosion.java @@ -103,7 +103,14 @@ public class Explosion { @@ -13,17 +13,17 @@ index c41b911..78e3a7d 100644 int j1 = MathHelper.floor(this.posZ - (double) f3 - 1.0D); int k1 = MathHelper.floor(this.posZ + (double) f3 + 1.0D); - List list = this.world.getEntities(this.source, new AxisAlignedBB((double) i, (double) l, (double) j1, (double) j, (double) i1, (double) k1)); -+ // PaperSpigot start - Fix lag from explosions processing dead entities ++ // Paper start - Fix lag from explosions processing dead entities + List list = this.world.a(this.source, new AxisAlignedBB((double) i, (double) l, (double) j1, (double) j, (double) i1, (double) k1), new com.google.common.base.Predicate() { + @Override + public boolean apply(Entity entity) { + return IEntitySelector.d.apply(entity) && !entity.dead; + } + }); -+ // PaperSpigot end ++ // Paper end Vec3D vec3d = new Vec3D(this.posX, this.posY, this.posZ); for (int l1 = 0; l1 < list.size(); ++l1) { -- -2.5.2 +2.7.2 diff --git a/Spigot-Server-Patches/0034-Generator-Settings.patch b/Spigot-Server-Patches/0034-Generator-Settings.patch new file mode 100644 index 0000000000..b98813daff --- /dev/null +++ b/Spigot-Server-Patches/0034-Generator-Settings.patch @@ -0,0 +1,278 @@ +From 546984cc7a32e0532b0d9732b4c77a3332a4994e Mon Sep 17 00:00:00 2001 +From: Byteflux +Date: Wed, 2 Mar 2016 02:17:54 -0600 +Subject: [PATCH] Generator Settings + + +diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index e68595b..3cde5fd 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -169,4 +169,28 @@ public class PaperWorldConfig { + disableEndCredits = getBoolean("game-mechanics.disable-end-credits", false); + log("End credits disabled: " + disableEndCredits); + } ++ ++ public boolean generateCanyon; ++ public boolean generateCaves; ++ public boolean generateDungeon; ++ public boolean generateFortress; ++ public boolean generateMineshaft; ++ public boolean generateMonument; ++ public boolean generateStronghold; ++ public boolean generateTemple; ++ public boolean generateVillage; ++ public boolean generateFlatBedrock; ++ ++ private void generatorSettings() { ++ generateCanyon = getBoolean("generator-settings.canyon", true); ++ generateCaves = getBoolean("generator-settings.caves", true); ++ generateDungeon = getBoolean("generator-settings.dungeon", true); ++ generateFortress = getBoolean("generator-settings.fortress", true); ++ generateMineshaft = getBoolean("generator-settings.mineshaft", true); ++ generateMonument = getBoolean("generator-settings.monument", true); ++ generateStronghold = getBoolean("generator-settings.stronghold", true); ++ generateTemple = getBoolean("generator-settings.temple", true); ++ generateVillage = getBoolean("generator-settings.village", true); ++ generateFlatBedrock = getBoolean("generator-settings.flat-bedrock", false); ++ } + } +diff --git a/src/main/java/net/minecraft/server/BiomeBase.java b/src/main/java/net/minecraft/server/BiomeBase.java +index be4b871..854bbb4 100644 +--- a/src/main/java/net/minecraft/server/BiomeBase.java ++++ b/src/main/java/net/minecraft/server/BiomeBase.java +@@ -47,7 +47,7 @@ public abstract class BiomeBase { + protected List x; + + public static int a(BiomeBase biomebase) { +- return BiomeBase.REGISTRY_ID.a((Object) biomebase); ++ return BiomeBase.REGISTRY_ID.a(biomebase); // Paper - Fix compile + } + + public static BiomeBase a(int i) { +@@ -174,7 +174,7 @@ public abstract class BiomeBase { + BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition(); + + for (int l1 = 255; l1 >= 0; --l1) { +- if (l1 <= random.nextInt(5)) { ++ if (l1 <= (world.paperConfig.generateFlatBedrock ? 0 : random.nextInt(5))) { // Paper - Configurable flat bedrock + chunksnapshot.a(k1, l1, j1, BiomeBase.c); + } else { + IBlockData iblockdata2 = chunksnapshot.a(k1, l1, j1); +diff --git a/src/main/java/net/minecraft/server/BiomeMesa.java b/src/main/java/net/minecraft/server/BiomeMesa.java +index 3ce22aa..336fa16 100644 +--- a/src/main/java/net/minecraft/server/BiomeMesa.java ++++ b/src/main/java/net/minecraft/server/BiomeMesa.java +@@ -98,7 +98,7 @@ public class BiomeMesa extends BiomeBase { + chunksnapshot.a(l, l1, k, BiomeMesa.a); + } + +- if (l1 <= random.nextInt(5)) { ++ if (l1 <= (world.paperConfig.generateFlatBedrock ? 0 : random.nextInt(5))) { // Paper - Configurable flat bedrock + chunksnapshot.a(l, l1, k, BiomeMesa.c); + } else { + IBlockData iblockdata2 = chunksnapshot.a(l, l1, k); +diff --git a/src/main/java/net/minecraft/server/ChunkProviderFlat.java b/src/main/java/net/minecraft/server/ChunkProviderFlat.java +index 17e0b8e..89a33fd 100644 +--- a/src/main/java/net/minecraft/server/ChunkProviderFlat.java ++++ b/src/main/java/net/minecraft/server/ChunkProviderFlat.java +@@ -25,7 +25,7 @@ public class ChunkProviderFlat implements ChunkGenerator { + if (flag) { + Map map = this.d.b(); + +- if (map.containsKey("village")) { ++ if (map.containsKey("village") && world.paperConfig.generateVillage) { // Paper + Map map1 = (Map) map.get("village"); + + if (!map1.containsKey("size")) { +@@ -35,19 +35,19 @@ public class ChunkProviderFlat implements ChunkGenerator { + this.e.add(new WorldGenVillage(map1)); + } + +- if (map.containsKey("biome_1")) { ++ if (map.containsKey("biome_1") && world.paperConfig.generateTemple) { // Paper + this.e.add(new WorldGenLargeFeature((Map) map.get("biome_1"))); + } + +- if (map.containsKey("mineshaft")) { ++ if (map.containsKey("mineshaft") && world.paperConfig.generateMineshaft) { // Paper + this.e.add(new WorldGenMineshaft((Map) map.get("mineshaft"))); + } + +- if (map.containsKey("stronghold")) { ++ if (map.containsKey("stronghold") && world.paperConfig.generateStronghold) { // Paper + this.e.add(new WorldGenStronghold((Map) map.get("stronghold"))); + } + +- if (map.containsKey("oceanmonument")) { ++ if (map.containsKey("oceanmonument") && world.paperConfig.generateMonument) { // Paper + this.e.add(new WorldGenMonument((Map) map.get("oceanmonument"))); + } + } +@@ -60,7 +60,7 @@ public class ChunkProviderFlat implements ChunkGenerator { + this.i = new WorldGenLakes(Blocks.LAVA); + } + +- this.g = this.d.b().containsKey("dungeon"); ++ this.g = world.paperConfig.generateDungeon && this.d.b().containsKey("dungeon"); // Paper + int j = 0; + int k = 0; + boolean flag1 = true; +diff --git a/src/main/java/net/minecraft/server/ChunkProviderGenerate.java b/src/main/java/net/minecraft/server/ChunkProviderGenerate.java +index 88d0374..168d071 100644 +--- a/src/main/java/net/minecraft/server/ChunkProviderGenerate.java ++++ b/src/main/java/net/minecraft/server/ChunkProviderGenerate.java +@@ -157,32 +157,32 @@ public class ChunkProviderGenerate implements ChunkGenerator { + this.a(i, j, chunksnapshot); + this.C = this.n.getWorldChunkManager().getBiomeBlock(this.C, i * 16, j * 16, 16, 16); + this.a(i, j, chunksnapshot, this.C); +- if (this.s.r) { ++ if (this.s.r && this.n.paperConfig.generateCaves) { // Paper + this.v.a(this.n, i, j, chunksnapshot); + } + +- if (this.s.z) { ++ if (this.s.z && this.n.paperConfig.generateCanyon) { // Paper + this.A.a(this.n, i, j, chunksnapshot); + } + + if (this.o) { +- if (this.s.w) { ++ if (this.s.w && this.n.paperConfig.generateMineshaft) { // Paper + this.y.a(this.n, i, j, chunksnapshot); + } + +- if (this.s.v) { ++ if (this.s.v&& this.n.paperConfig.generateVillage) { // Paper + this.x.a(this.n, i, j, chunksnapshot); + } + +- if (this.s.u) { ++ if (this.s.u && this.n.paperConfig.generateStronghold) { // Paper + this.w.a(this.n, i, j, chunksnapshot); + } + +- if (this.s.x) { ++ if (this.s.x && this.n.paperConfig.generateTemple) { // Paper + this.z.a(this.n, i, j, chunksnapshot); + } + +- if (this.s.y) { ++ if (this.s.y && this.n.paperConfig.generateMonument) { // Paper + this.B.a(this.n, i, j, chunksnapshot); + } + } +@@ -319,23 +319,23 @@ public class ChunkProviderGenerate implements ChunkGenerator { + ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i, j); + + if (this.o) { +- if (this.s.w) { ++ if (this.s.w && this.n.paperConfig.generateMineshaft) { // Paper + this.y.a(this.n, this.i, chunkcoordintpair); + } + +- if (this.s.v) { ++ if (this.s.v && this.n.paperConfig.generateVillage) { // Paper + flag = this.x.a(this.n, this.i, chunkcoordintpair); + } + +- if (this.s.u) { ++ if (this.s.u && this.n.paperConfig.generateStronghold) { // Paper + this.w.a(this.n, this.i, chunkcoordintpair); + } + +- if (this.s.x) { ++ if (this.s.x && this.n.paperConfig.generateTemple) { // Paper + this.z.a(this.n, this.i, chunkcoordintpair); + } + +- if (this.s.y) { ++ if (this.s.y && this.n.paperConfig.generateMonument) { // Paper + this.B.a(this.n, this.i, chunkcoordintpair); + } + } +@@ -360,7 +360,7 @@ public class ChunkProviderGenerate implements ChunkGenerator { + } + } + +- if (this.s.s) { ++ if (this.s.s && this.n.paperConfig.generateDungeon) { // Paper + for (k1 = 0; k1 < this.s.t; ++k1) { + l1 = this.i.nextInt(16) + 8; + i2 = this.i.nextInt(256); +@@ -424,23 +424,23 @@ public class ChunkProviderGenerate implements ChunkGenerator { + + public void recreateStructures(Chunk chunk, int i, int j) { + if (this.o) { +- if (this.s.w) { ++ if (this.s.w && this.n.paperConfig.generateMineshaft) { // Paper + this.y.a(this.n, i, j, (ChunkSnapshot) null); + } + +- if (this.s.v) { ++ if (this.s.v && this.n.paperConfig.generateVillage) { // Paper + this.x.a(this.n, i, j, (ChunkSnapshot) null); + } + +- if (this.s.u) { ++ if (this.s.u && this.n.paperConfig.generateStronghold) { // Paper + this.w.a(this.n, i, j, (ChunkSnapshot) null); + } + +- if (this.s.x) { ++ if (this.s.x && this.n.paperConfig.generateTemple) { // Paper + this.z.a(this.n, i, j, (ChunkSnapshot) null); + } + +- if (this.s.y) { ++ if (this.s.y && this.n.paperConfig.generateMonument) { // Paper + this.B.a(this.n, i, j, (ChunkSnapshot) null); + } + } +diff --git a/src/main/java/net/minecraft/server/ChunkProviderHell.java b/src/main/java/net/minecraft/server/ChunkProviderHell.java +index 0150efd..d17a6fd 100644 +--- a/src/main/java/net/minecraft/server/ChunkProviderHell.java ++++ b/src/main/java/net/minecraft/server/ChunkProviderHell.java +@@ -148,7 +148,10 @@ public class ChunkProviderHell implements ChunkGenerator { + IBlockData iblockdata1 = ChunkProviderHell.b; + + for (int l1 = 127; l1 >= 0; --l1) { +- if (l1 < 127 - this.p.nextInt(5) && l1 > this.p.nextInt(5)) { ++ // Paper start - Configurable flat bedrock worldgen ++ if (l1 < 127 - (n.paperConfig.generateFlatBedrock ? 0 : this.p.nextInt(5)) && ++ l1 > (n.paperConfig.generateFlatBedrock ? 0 : this.p.nextInt(5))) { ++ // Paper end + IBlockData iblockdata2 = chunksnapshot.a(i1, l1, l); + + if (iblockdata2.getBlock() != null && iblockdata2.getMaterial() != Material.AIR) { +@@ -364,6 +367,6 @@ public class ChunkProviderHell implements ChunkGenerator { + } + + public void recreateStructures(Chunk chunk, int i, int j) { +- this.H.a(this.n, i, j, (ChunkSnapshot) null); ++ if (this.n.paperConfig.generateFortress) this.H.a(this.n, i, j, (ChunkSnapshot) null); // Paper + } + } +diff --git a/src/main/java/net/minecraft/server/StructureGenerator.java b/src/main/java/net/minecraft/server/StructureGenerator.java +index 22d96e9..83d9509 100644 +--- a/src/main/java/net/minecraft/server/StructureGenerator.java ++++ b/src/main/java/net/minecraft/server/StructureGenerator.java +@@ -90,6 +90,7 @@ public abstract class StructureGenerator extends WorldGenBase { + } + + public boolean b(BlockPosition blockposition) { ++ if (this.g == null) return false; // Paper + this.a(this.g); + return this.c(blockposition) != null; + } +@@ -117,6 +118,7 @@ public abstract class StructureGenerator extends WorldGenBase { + } + + public boolean b(World world, BlockPosition blockposition) { ++ if (this.g == null) return false; // Paper + this.a(world); + Iterator iterator = this.c.values().iterator(); + +-- +2.7.2 + diff --git a/Spigot-Server-Patches/0035-Fix-redstone-lag-issues.patch b/Spigot-Server-Patches/0035-Fix-redstone-lag-issues.patch deleted file mode 100644 index 246f68a4c2..0000000000 --- a/Spigot-Server-Patches/0035-Fix-redstone-lag-issues.patch +++ /dev/null @@ -1,77 +0,0 @@ -From d3fbc65d48a954e502579dccb29442db086fa363 Mon Sep 17 00:00:00 2001 -From: Zach Brown -Date: Mon, 13 Apr 2015 15:47:15 -0500 -Subject: [PATCH] Fix redstone lag issues - - -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index bf7c876..9829ff0 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -611,6 +611,8 @@ public class WorldServer extends World implements IAsyncTaskHandler { - if (false) { // CraftBukkit - throw new IllegalStateException("TickNextTick list out of synch"); - } else { -+ // PaperSpigot start - No, stop doing this, it affects things like redstone -+ /* - if (i > 1000) { - // CraftBukkit start - If the server has too much to process over time, try to alleviate that - if (i > 20 * 1000) { -@@ -619,7 +621,11 @@ public class WorldServer extends World implements IAsyncTaskHandler { - i = 1000; - } - // CraftBukkit end -+ */ -+ if (i > paperSpigotConfig.tickNextTickCap) { -+ i = paperSpigotConfig.tickNextTickCap; - } -+ // PaperSpigot end - - this.methodProfiler.a("cleaning"); - -@@ -636,6 +642,23 @@ public class WorldServer extends World implements IAsyncTaskHandler { - this.V.add(nextticklistentry); - } - -+ // PaperSpigot start - Allow redstone ticks to bypass the tickNextTickListCap -+ if (paperSpigotConfig.tickNextTickListCapIgnoresRedstone) { -+ Iterator iterator = this.M.iterator(); -+ while (iterator.hasNext()) { -+ NextTickListEntry next = iterator.next(); -+ if (!flag && next.b > this.worldData.getTime()) { -+ break; -+ } -+ -+ if (next.a().isPowerSource() || next.a() instanceof IContainer) { -+ iterator.remove(); -+ this.V.add(next); -+ } -+ } -+ } -+ // PaperSpigot end -+ - this.methodProfiler.b(); - this.methodProfiler.a("ticking"); - Iterator iterator = this.V.iterator(); -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index b2f9a8e..c8971d1 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -202,4 +202,14 @@ public class PaperSpigotWorldConfig - { - netherVoidTopDamage = getBoolean( "nether-ceiling-void-damage", false ); - } -+ -+ public int tickNextTickCap; -+ public boolean tickNextTickListCapIgnoresRedstone; -+ private void tickNextTickCap() -+ { -+ tickNextTickCap = getInt( "tick-next-tick-list-cap", 10000 ); // Higher values will be friendlier to vanilla style mechanics (to a point) but may hurt performance -+ tickNextTickListCapIgnoresRedstone = getBoolean( "tick-next-tick-list-cap-ignores-redstone", false ); // Redstone TickNextTicks will always bypass the preceding cap. -+ log( "WorldServer TickNextTick cap set at " + tickNextTickCap ); -+ log( "WorldServer TickNextTickList cap always processes redstone: " + tickNextTickListCapIgnoresRedstone ); -+ } - } --- -2.7.0 - diff --git a/Spigot-Server-Patches/0050-Optimize-explosions.patch b/Spigot-Server-Patches/0035-Optimize-explosions.patch similarity index 75% rename from Spigot-Server-Patches/0050-Optimize-explosions.patch rename to Spigot-Server-Patches/0035-Optimize-explosions.patch index ccef0328b0..e088f85883 100644 --- a/Spigot-Server-Patches/0050-Optimize-explosions.patch +++ b/Spigot-Server-Patches/0035-Optimize-explosions.patch @@ -1,6 +1,6 @@ -From d5ef4de366d7f65280dd0466a92f71a09b1120fd Mon Sep 17 00:00:00 2001 +From d173d8966a5f250a5aac7191b46b297e26d72f3b Mon Sep 17 00:00:00 2001 From: Byteflux -Date: Tue, 16 Jun 2015 00:43:17 -0700 +Date: Wed, 2 Mar 2016 11:59:48 -0600 Subject: [PATCH] Optimize explosions The process of determining an entity's exposure from explosions can be @@ -9,8 +9,23 @@ expensive when there are hundreds or more entities in range. This patch adds a per-tick cache that is used for storing and retrieving an entity's exposure during an explosion. +diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index 3cde5fd..ee50493 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -193,4 +193,10 @@ public class PaperWorldConfig { + generateVillage = getBoolean("generator-settings.village", true); + generateFlatBedrock = getBoolean("generator-settings.flat-bedrock", false); + } ++ ++ public boolean optimizeExplosions; ++ private void optimizeExplosions() { ++ optimizeExplosions = getBoolean("optimize-explosions", false); ++ log("Optimize explosions: " + optimizeExplosions); ++ } + } diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java -index 0e8af2e..f6067ce 100644 +index 87e123c..afe402e 100644 --- a/src/main/java/net/minecraft/server/Explosion.java +++ b/src/main/java/net/minecraft/server/Explosion.java @@ -129,7 +129,7 @@ public class Explosion { @@ -18,21 +33,20 @@ index 0e8af2e..f6067ce 100644 d9 /= d11; d10 /= d11; - double d12 = (double) this.world.a(vec3d, entity.getBoundingBox()); -+ double d12 = this.getBlockDensity(vec3d, entity.getBoundingBox()); // PaperSpigot - Optimize explosions ++ double d12 = this.getBlockDensity(vec3d, entity.getBoundingBox()); // Paper - Optimize explosions double d13 = (1.0D - d7) * d12; - // entity.damageEntity(DamageSource.explosion(this), (float) ((int) ((d13 * d13 + d13) / 2.0D * 8.0D * (double) f3 + 1.0D)));+ // CraftBukkit start -@@ -294,4 +294,86 @@ public class Explosion { + // CraftBukkit start +@@ -296,4 +296,85 @@ public class Explosion { public List getBlocks() { return this.blocks; } + -+ // PaperSpigot start - Optimize explosions ++ // Paper start - Optimize explosions + private float getBlockDensity(Vec3D vec3d, AxisAlignedBB aabb) { -+ if (!this.world.paperSpigotConfig.optimizeExplosions) { ++ if (!this.world.paperConfig.optimizeExplosions) { + return this.world.a(vec3d, aabb); + } -+ + CacheKey key = new CacheKey(this, aabb); + Float blockDensity = this.world.explosionDensityCache.get(key); + if (blockDensity == null) { @@ -107,47 +121,40 @@ index 0e8af2e..f6067ce 100644 + return result; + } + } -+ // PaperSpigot end ++ // Paper end } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 06ae3fc..eac71e8 100644 +index 0a23d2a..ac1bec6 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -861,6 +861,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs +@@ -858,6 +858,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs worldserver.timings.tracker.stopTiming(); // Spigot this.methodProfiler.b(); this.methodProfiler.b(); -+ worldserver.explosionDensityCache.clear(); // PaperSpigot - Optimize explosions ++ worldserver.explosionDensityCache.clear(); // Paper - Optimize explosions // } // CraftBukkit // this.i[i][this.ticks % 100] = System.nanoTime() - j; // CraftBukkit diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 7660356..68cb798 100644 +index 79cd94d..8925c67 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -135,6 +135,7 @@ public abstract class World implements IBlockAccess { +@@ -32,6 +32,7 @@ import org.bukkit.generator.ChunkGenerator; + // Paper start + import java.util.concurrent.ExecutorService; + import java.util.concurrent.Executors; ++import java.util.HashMap; + import com.google.common.util.concurrent.ThreadFactoryBuilder; + // Paper end + +@@ -141,6 +142,7 @@ public abstract class World implements IBlockAccess { private org.spigotmc.TickLimiter tileLimiter; private int tileTickPosition; - public ExecutorService lightingExecutor = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder().setNameFormat("PaperSpigot - Lighting Thread").build()); // PaperSpigot - Asynchronous lighting updates -+ public final Map explosionDensityCache = new HashMap(); // PaperSpigot - Optimize explosions + public ExecutorService lightingExecutor = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder().setNameFormat("Paper - Lighting Thread").build()); // Paper - Asynchronous lighting updates ++ public final Map explosionDensityCache = new HashMap(); // Paper - Optimize explosions - public static long chunkToKey(int x, int z) - { -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index ef59074..e42b574 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -306,4 +306,10 @@ public class PaperSpigotWorldConfig - { - fallingBlocksCollideWithSigns = getBoolean( "falling-blocks-collide-with-signs", false ); - } -+ -+ public boolean optimizeExplosions; -+ private void optimizeExplosions() -+ { -+ optimizeExplosions = getBoolean( "optimize-explosions", false ); -+ } - } + public CraftWorld getWorld() { + return this.world; -- -2.7.0 +2.7.2 diff --git a/Spigot-Server-Patches/0036-Always-tick-falling-blocks.patch b/Spigot-Server-Patches/0036-Always-tick-falling-blocks.patch deleted file mode 100644 index ef7fed7dab..0000000000 --- a/Spigot-Server-Patches/0036-Always-tick-falling-blocks.patch +++ /dev/null @@ -1,29 +0,0 @@ -From d983745c2061cbee37aa5a1ed042ae595b75dfbe Mon Sep 17 00:00:00 2001 -From: Zach Brown -Date: Fri, 10 Apr 2015 18:07:36 -0500 -Subject: [PATCH] Always tick falling blocks - - -diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java -index d8d54bd..d6311bd 100644 ---- a/src/main/java/org/spigotmc/ActivationRange.java -+++ b/src/main/java/org/spigotmc/ActivationRange.java -@@ -14,6 +14,7 @@ import net.minecraft.server.EntityCreature; - import net.minecraft.server.EntityCreeper; - import net.minecraft.server.EntityEnderCrystal; - import net.minecraft.server.EntityEnderDragon; -+import net.minecraft.server.EntityFallingBlock; - import net.minecraft.server.EntityFireball; - import net.minecraft.server.EntityFireworks; - import net.minecraft.server.EntityHuman; -@@ -82,6 +83,7 @@ public class ActivationRange - || entity instanceof EntityFireball - || entity instanceof EntityWeather - || entity instanceof EntityTNTPrimed -+ || entity instanceof EntityFallingBlock // PaperSpigot - Always tick falling blocks - || entity instanceof EntityEnderCrystal - || entity instanceof EntityFireworks ) - { --- -2.6.0 - diff --git a/Spigot-Server-Patches/0051-Stop-updating-flowing-block-if-material-has-changed.patch b/Spigot-Server-Patches/0036-Stop-updating-flowing-block-if-material-has-changed.patch similarity index 60% rename from Spigot-Server-Patches/0051-Stop-updating-flowing-block-if-material-has-changed.patch rename to Spigot-Server-Patches/0036-Stop-updating-flowing-block-if-material-has-changed.patch index 3ba862630b..8c1f88134f 100644 --- a/Spigot-Server-Patches/0051-Stop-updating-flowing-block-if-material-has-changed.patch +++ b/Spigot-Server-Patches/0036-Stop-updating-flowing-block-if-material-has-changed.patch @@ -1,21 +1,21 @@ -From adb1d170502e3b0e44d08399ec31c0633f411c1c Mon Sep 17 00:00:00 2001 +From f78ee3cdf59990c2d828a298c6bf4c06bcd82dc0 Mon Sep 17 00:00:00 2001 From: Iceee -Date: Tue, 30 Jun 2015 19:31:02 -0700 +Date: Wed, 2 Mar 2016 12:03:23 -0600 Subject: [PATCH] Stop updating flowing block if material has changed diff --git a/src/main/java/net/minecraft/server/BlockFlowing.java b/src/main/java/net/minecraft/server/BlockFlowing.java -index ff18f63..ab2e43f 100644 +index f35f30c..1f07f82 100644 --- a/src/main/java/net/minecraft/server/BlockFlowing.java +++ b/src/main/java/net/minecraft/server/BlockFlowing.java -@@ -102,6 +102,7 @@ public class BlockFlowing extends BlockFluids { +@@ -101,6 +101,7 @@ public class BlockFlowing extends BlockFluids { this.f(world, blockposition, iblockdata); } -+ if (world.getType(blockposition).getBlock().getMaterial() != material) return; // PaperSpigot - Stop updating flowing block if material has changed ++ if (world.getType(blockposition).getBlock().getBlockData().getMaterial() != material) return; // Paper - Stop updating flowing block if material has changed IBlockData iblockdata2 = world.getType(blockposition.down()); if (this.h(world, blockposition.down(), iblockdata2)) { -- -2.5.2 +2.7.2 diff --git a/Spigot-Server-Patches/0037-Add-FallingBlock-source-location-API.patch b/Spigot-Server-Patches/0037-Add-FallingBlock-source-location-API.patch deleted file mode 100644 index 96e0c385fd..0000000000 --- a/Spigot-Server-Patches/0037-Add-FallingBlock-source-location-API.patch +++ /dev/null @@ -1,148 +0,0 @@ -From 70501efcdaf3ca00782b429d7ec5d50aef96db37 Mon Sep 17 00:00:00 2001 -From: Byteflux -Date: Fri, 17 Apr 2015 02:26:14 -0700 -Subject: [PATCH] Add FallingBlock source location API - - -diff --git a/src/main/java/net/minecraft/server/BlockDragonEgg.java b/src/main/java/net/minecraft/server/BlockDragonEgg.java -index de7ac6f..76a6272 100644 ---- a/src/main/java/net/minecraft/server/BlockDragonEgg.java -+++ b/src/main/java/net/minecraft/server/BlockDragonEgg.java -@@ -28,7 +28,10 @@ public class BlockDragonEgg extends Block { - byte b0 = 32; - - if (!BlockFalling.instaFall && world.areChunksLoadedBetween(blockposition.a(-b0, -b0, -b0), blockposition.a(b0, b0, b0))) { -- world.addEntity(new EntityFallingBlock(world, (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F), this.getBlockData())); -+ // PaperSpigot start - Add FallingBlock source location API -+ org.bukkit.Location loc = new org.bukkit.Location(world.getWorld(), (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F)); -+ world.addEntity(new EntityFallingBlock(loc, world, (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F), this.getBlockData())); -+ // PaperSpigot end - } else { - world.setAir(blockposition); - -diff --git a/src/main/java/net/minecraft/server/BlockFalling.java b/src/main/java/net/minecraft/server/BlockFalling.java -index 29f8554..1d952b8 100644 ---- a/src/main/java/net/minecraft/server/BlockFalling.java -+++ b/src/main/java/net/minecraft/server/BlockFalling.java -@@ -36,7 +36,10 @@ public class BlockFalling extends Block { - - if (!BlockFalling.instaFall && world.areChunksLoadedBetween(blockposition.a(-b0, -b0, -b0), blockposition.a(b0, b0, b0))) { - if (!world.isClientSide) { -- EntityFallingBlock entityfallingblock = new EntityFallingBlock(world, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, world.getType(blockposition)); -+ // PaperSpigot start - Add FallingBlock source location API -+ org.bukkit.Location loc = new org.bukkit.Location(world.getWorld(), (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F)); -+ EntityFallingBlock entityfallingblock = new EntityFallingBlock(loc, world, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, world.getType(blockposition)); -+ // PaperSpigot end - - this.a(entityfallingblock); - world.addEntity(entityfallingblock); -diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java -index 86556cd..b34e93c 100644 ---- a/src/main/java/net/minecraft/server/EntityFallingBlock.java -+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java -@@ -16,13 +16,26 @@ public class EntityFallingBlock extends Entity { - private int fallHurtMax = 40; - private float fallHurtAmount = 2.0F; - public NBTTagCompound tileEntityData; -+ public org.bukkit.Location sourceLoc; // PaperSpigot - -+ // PaperSpigot start - Add FallingBlock source location API - public EntityFallingBlock(World world) { -+ this(null, world); -+ } -+ -+ public EntityFallingBlock(org.bukkit.Location loc, World world) { - super(world); -+ sourceLoc = loc; - } - - public EntityFallingBlock(World world, double d0, double d1, double d2, IBlockData iblockdata) { -+ this(null, world, d0, d1, d2, iblockdata); -+ } -+ -+ public EntityFallingBlock(org.bukkit.Location loc, World world, double d0, double d1, double d2, IBlockData iblockdata) { - super(world); -+ sourceLoc = loc; -+ // PaperSpigot end - this.block = iblockdata; - this.k = true; - this.setSize(0.98F, 0.98F); -@@ -197,7 +210,13 @@ public class EntityFallingBlock extends Entity { - if (this.tileEntityData != null) { - nbttagcompound.set("TileEntityData", this.tileEntityData); - } -- -+ // PaperSpigot start - Add FallingBlock source location API -+ if (sourceLoc != null) { -+ nbttagcompound.setInt("SourceLoc_x", sourceLoc.getBlockX()); -+ nbttagcompound.setInt("SourceLoc_y", sourceLoc.getBlockY()); -+ nbttagcompound.setInt("SourceLoc_z", sourceLoc.getBlockZ()); -+ } -+ // PaperSpigot end - } - - protected void a(NBTTagCompound nbttagcompound) { -@@ -233,7 +252,14 @@ public class EntityFallingBlock extends Entity { - if (block == null || block.getMaterial() == Material.AIR) { - this.block = Blocks.SAND.getBlockData(); - } -- -+ // PaperSpigot start - Add FallingBlock source location API -+ if (nbttagcompound.hasKey("SourceLoc_x")) { -+ int srcX = nbttagcompound.getInt("SourceLoc_x"); -+ int srcY = nbttagcompound.getInt("SourceLoc_y"); -+ int srcZ = nbttagcompound.getInt("SourceLoc_z"); -+ sourceLoc = new org.bukkit.Location(world.getWorld(), srcX, srcY, srcZ); -+ } -+ // PaperSpigot end - } - - public void a(boolean flag) { -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index d8417c9..c15a0ba 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -886,7 +886,10 @@ public class CraftWorld implements World { - double y = location.getBlockY() + 0.5; - double z = location.getBlockZ() + 0.5; - -- EntityFallingBlock entity = new EntityFallingBlock(world, x, y, z, net.minecraft.server.Block.getById(material.getId()).fromLegacyData(data)); -+ // PaperSpigot start - Add FallingBlock source location API -+ location = location.clone(); -+ EntityFallingBlock entity = new EntityFallingBlock(location, world, x, y, z, net.minecraft.server.Block.getById(material.getId()).fromLegacyData(data)); -+ // PaperSpigot end - entity.ticksLived = 1; - - world.addEntity(entity, SpawnReason.CUSTOM); -@@ -921,8 +924,10 @@ public class CraftWorld implements World { - IBlockData blockData = world.getType(new BlockPosition(x, y, z)); - int type = CraftMagicNumbers.getId(blockData.getBlock()); - int data = blockData.getBlock().toLegacyData(blockData); -- -- entity = new EntityFallingBlock(world, x + 0.5, y + 0.5, z + 0.5, net.minecraft.server.Block.getById(type).fromLegacyData(data)); -+ // PaperSpigot start - Add FallingBlock source location API -+ location = location.clone(); -+ entity = new EntityFallingBlock(location, world, x + 0.5, y + 0.5, z + 0.5, net.minecraft.server.Block.getById(type).fromLegacyData(data)); -+ // PaperSpigot end - } else if (Projectile.class.isAssignableFrom(clazz)) { - if (Snowball.class.isAssignableFrom(clazz)) { - entity = new EntitySnowball(world, x, y, z); -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingSand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingSand.java -index 75eed48..eedb66f 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingSand.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingSand.java -@@ -57,4 +57,11 @@ public class CraftFallingSand extends CraftEntity implements FallingSand { - public void setHurtEntities(boolean hurtEntities) { - getHandle().hurtEntities = hurtEntities; - } -+ -+ // PaperSpigot start - Add FallingBlock source location API -+ @Override -+ public org.bukkit.Location getSourceLoc() { -+ return getHandle().sourceLoc; -+ } -+ // PaperSpigot end - } --- -2.6.3 - diff --git a/Spigot-Server-Patches/0052-Fast-draining.patch b/Spigot-Server-Patches/0037-Fast-draining.patch similarity index 55% rename from Spigot-Server-Patches/0052-Fast-draining.patch rename to Spigot-Server-Patches/0037-Fast-draining.patch index 888868aff8..518a9921a5 100644 --- a/Spigot-Server-Patches/0052-Fast-draining.patch +++ b/Spigot-Server-Patches/0037-Fast-draining.patch @@ -1,11 +1,27 @@ -From 0400a17ebc786a5b92448a24fb891814519d2fd3 Mon Sep 17 00:00:00 2001 +From 60647fcd622bf436128c3f5d98e953ec0530a013 Mon Sep 17 00:00:00 2001 From: Byteflux -Date: Tue, 30 Jun 2015 19:31:02 -0700 +Date: Wed, 2 Mar 2016 12:20:52 -0600 Subject: [PATCH] Fast draining +diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index d022513..269d373 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -199,4 +199,11 @@ public class PaperWorldConfig { + optimizeExplosions = getBoolean("optimize-explosions", false); + log("Optimize explosions: " + optimizeExplosions); + } ++ ++ public boolean fastDrainLava; ++ public boolean fastDrainWater; ++ private void fastDrain() { ++ fastDrainLava = getBoolean("fast-drain.lava", false); ++ fastDrainWater = getBoolean("fast-drain.water", false); ++ } + } diff --git a/src/main/java/net/minecraft/server/BlockFlowing.java b/src/main/java/net/minecraft/server/BlockFlowing.java -index ab2e43f..fc3fc48 100644 +index 1f07f82..517c1e8 100644 --- a/src/main/java/net/minecraft/server/BlockFlowing.java +++ b/src/main/java/net/minecraft/server/BlockFlowing.java @@ -74,7 +74,7 @@ public class BlockFlowing extends BlockFluids { @@ -13,7 +29,7 @@ index ab2e43f..fc3fc48 100644 } - if (this.material == Material.LAVA && i < 8 && i1 < 8 && i1 > i && random.nextInt(4) != 0) { -+ if (!world.paperSpigotConfig.fastDrainLava && this.material == Material.LAVA && i < 8 && i1 < 8 && i1 > i && random.nextInt(4) != 0) { // PaperSpigot ++ if (!world.paperConfig.fastDrainLava && this.material == Material.LAVA && i < 8 && i1 < 8 && i1 > i && random.nextInt(4) != 0) { // Paper j *= 4; } @@ -22,80 +38,63 @@ index ab2e43f..fc3fc48 100644 } else { i = i1; - if (i1 < 0) { -+ if (i1 < 0 || canFastDrain(world, blockposition)) { // PaperSpigot - Fast draining ++ if (i1 < 0 || canFastDrain(world, blockposition)) { // Paper - Fast draining world.setAir(blockposition); } else { iblockdata = iblockdata.set(BlockFlowing.LEVEL, Integer.valueOf(i1)); -@@ -285,4 +285,52 @@ public class BlockFlowing extends BlockFluids { +@@ -288,4 +288,52 @@ public class BlockFlowing extends BlockFluids { } return super.a(world); } + + /** -+ * PaperSpigot - Data check method for fast draining ++ * Paper - Data check method for fast draining + */ + public int getData(World world, BlockPosition position) { -+ int data = this.e(world, position); ++ int data = this.c((IBlockAccess) world, position); + return data < 8 ? data : 0; + } + + /** -+ * PaperSpigot - Checks surrounding blocks to determine if block can be fast drained ++ * Paper - Checks surrounding blocks to determine if block can be fast drained + */ + public boolean canFastDrain(World world, BlockPosition position) { + boolean result = false; + int data = getData(world, position); + if (this.material == Material.WATER) { -+ if (world.paperSpigotConfig.fastDrainWater) { ++ if (world.paperConfig.fastDrainWater) { + result = true; + if (getData(world, position.down()) < 0) { + result = false; -+ } else if (world.getType(position.north()).getBlock().getMaterial() == Material.WATER && getData(world, position.north()) < data) { ++ } else if (world.getType(position.north()).getBlock().getBlockData().getMaterial() == Material.WATER && getData(world, position.north()) < data) { + result = false; -+ } else if (world.getType(position.south()).getBlock().getMaterial() == Material.WATER && getData(world, position.south()) < data) { ++ } else if (world.getType(position.south()).getBlock().getBlockData().getMaterial() == Material.WATER && getData(world, position.south()) < data) { + result = false; -+ } else if (world.getType(position.west()).getBlock().getMaterial() == Material.WATER && getData(world, position.west()) < data) { ++ } else if (world.getType(position.west()).getBlock().getBlockData().getMaterial() == Material.WATER && getData(world, position.west()) < data) { + result = false; -+ } else if (world.getType(position.east()).getBlock().getMaterial() == Material.WATER && getData(world, position.east()) < data) { ++ } else if (world.getType(position.east()).getBlock().getBlockData().getMaterial() == Material.WATER && getData(world, position.east()) < data) { + result = false; + } + } + } else if (this.material == Material.LAVA) { -+ if (world.paperSpigotConfig.fastDrainLava) { ++ if (world.paperConfig.fastDrainLava) { + result = true; -+ if (getData(world, position.down()) < 0 || world.getType(position.up()).getBlock().getMaterial() != Material.AIR) { ++ if (getData(world, position.down()) < 0 || world.getType(position.up()).getBlock().getBlockData().getMaterial() != Material.AIR) { + result = false; -+ } else if (world.getType(position.north()).getBlock().getMaterial() == Material.LAVA && getData(world, position.north()) < data) { ++ } else if (world.getType(position.north()).getBlock().getBlockData().getMaterial() == Material.LAVA && getData(world, position.north()) < data) { + result = false; -+ } else if (world.getType(position.south()).getBlock().getMaterial() == Material.LAVA && getData(world, position.south()) < data) { ++ } else if (world.getType(position.south()).getBlock().getBlockData().getMaterial() == Material.LAVA && getData(world, position.south()) < data) { + result = false; -+ } else if (world.getType(position.west()).getBlock().getMaterial() == Material.LAVA && getData(world, position.west()) < data) { ++ } else if (world.getType(position.west()).getBlock().getBlockData().getMaterial() == Material.LAVA && getData(world, position.west()) < data) { + result = false; -+ } else if (world.getType(position.east()).getBlock().getMaterial() == Material.LAVA && getData(world, position.east()) < data) { ++ } else if (world.getType(position.east()).getBlock().getBlockData().getMaterial() == Material.LAVA && getData(world, position.east()) < data) { + result = false; + } + } + } + return result; -+ } - } -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index e42b574..56c8433 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -312,4 +312,12 @@ public class PaperSpigotWorldConfig - { - optimizeExplosions = getBoolean( "optimize-explosions", false ); - } -+ -+ public boolean fastDrainLava; -+ public boolean fastDrainWater; -+ private void fastDraining() -+ { -+ fastDrainLava = getBoolean( "fast-drain.lava", false ); -+ fastDrainWater = getBoolean( "fast-drain.water", false ); + } } -- -2.7.0 +2.7.2 diff --git a/Spigot-Server-Patches/0038-Configurable-lava-flow-speed.patch b/Spigot-Server-Patches/0038-Configurable-lava-flow-speed.patch new file mode 100644 index 0000000000..2ec828555d --- /dev/null +++ b/Spigot-Server-Patches/0038-Configurable-lava-flow-speed.patch @@ -0,0 +1,39 @@ +From 38052c7fb6cc2f5ee6bd889f908747a44b99f400 Mon Sep 17 00:00:00 2001 +From: Byteflux +Date: Wed, 2 Mar 2016 12:27:07 -0600 +Subject: [PATCH] Configurable lava flow speed + + +diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index dad5a95..72f1000 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -206,4 +206,11 @@ public class PaperWorldConfig { + fastDrainLava = getBoolean("fast-drain.lava", false); + fastDrainWater = getBoolean("fast-drain.water", false); + } ++ ++ public int lavaFlowSpeedNormal; ++ public int lavaFlowSpeedNether; ++ private void lavaFlowSpeeds() { ++ lavaFlowSpeedNormal = getInt("lava-flow-speed.normal", 30); ++ lavaFlowSpeedNether = getInt("lava-flow-speed.nether", 10); ++ } + } +diff --git a/src/main/java/net/minecraft/server/BlockFlowing.java b/src/main/java/net/minecraft/server/BlockFlowing.java +index 141765e..2ca998b 100644 +--- a/src/main/java/net/minecraft/server/BlockFlowing.java ++++ b/src/main/java/net/minecraft/server/BlockFlowing.java +@@ -279,6 +279,9 @@ public class BlockFlowing extends BlockFluids { + * Paper - Get flow speed. Throttle if its water and flowing adjacent to lava + */ + public int getFlowSpeed(World world, BlockPosition blockposition) { ++ if (this.material == Material.LAVA) { ++ return world.worldProvider.m() ? world.paperConfig.lavaFlowSpeedNether : world.paperConfig.lavaFlowSpeedNormal; ++ } + if (this.material == Material.WATER && ( + world.getType(blockposition.north(1)).getBlock().material == Material.LAVA || + world.getType(blockposition.south(1)).getBlock().material == Material.LAVA || +-- +2.7.2 + diff --git a/Spigot-Server-Patches/0039-Add-player-view-distance-API.patch b/Spigot-Server-Patches/0039-Add-player-view-distance-API.patch new file mode 100644 index 0000000000..0484f2825a --- /dev/null +++ b/Spigot-Server-Patches/0039-Add-player-view-distance-API.patch @@ -0,0 +1,113 @@ +From 69fe942c444ac6c117ed54c4d8729cf2a70c7bdc Mon Sep 17 00:00:00 2001 +From: Byteflux +Date: Wed, 2 Mar 2016 14:35:27 -0600 +Subject: [PATCH] Add player view distance API + + +diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java +index b32617b..8be847d 100644 +--- a/src/main/java/net/minecraft/server/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/EntityPlayer.java +@@ -53,6 +53,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + public boolean f; + public int ping; + public boolean viewingCredits; ++ public int viewDistance; // Paper - Player view distance API + + // CraftBukkit start + public String displayName; +@@ -83,6 +84,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + + public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) { + super(worldserver, gameprofile); ++ this.viewDistance = world.spigotConfig.viewDistance; // Paper - Player view distance API + playerinteractmanager.player = this; + this.playerInteractManager = playerinteractmanager; + BlockPosition blockposition = worldserver.getSpawn(); +diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java +index 8ef7eb2..5421026 100644 +--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java +@@ -284,8 +284,10 @@ public class PlayerChunkMap { + int i = (int) entityplayer.d >> 4; + int j = (int) entityplayer.e >> 4; + +- for (int k = i - this.j; k <= i + this.j; ++k) { +- for (int l = j - this.j; l <= j + this.j; ++l) { ++ // Paper start - Player view distance API ++ for (int k = i - entityplayer.viewDistance; k <= i + entityplayer.viewDistance; ++k) { ++ for (int l = j - entityplayer.viewDistance; l <= j + entityplayer.viewDistance; ++l) { ++ // Paper end + PlayerChunk playerchunk = this.b(k, l); + + if (playerchunk != null) { +@@ -315,7 +317,7 @@ public class PlayerChunkMap { + if (d2 >= 64.0D) { + int k = (int) entityplayer.d >> 4; + int l = (int) entityplayer.e >> 4; +- int i1 = this.j; ++ int i1 = entityplayer.viewDistance; // Paper - Player view distance API + int j1 = i - k; + int k1 = j - l; + +@@ -471,4 +473,36 @@ public class PlayerChunkMap { + } + } + // CraftBukkit end ++ ++ // Paper start - Player view distance API ++ public void updateViewDistance(EntityPlayer player, int viewDistance) { ++ viewDistance = MathHelper.clamp(viewDistance, 3, 32); ++ if (viewDistance != player.viewDistance) { ++ int cx = (int) player.locX >> 4; ++ int cz = (int) player.locZ >> 4; ++ ++ if (viewDistance - player.viewDistance > 0) { ++ for (int x = cx - viewDistance; x <= cx + viewDistance; ++x) { ++ for (int z = cz - viewDistance; z <= cz + viewDistance; ++z) { ++ PlayerChunk playerchunkmap_playerchunk = this.c(x, z); ++ ++ if (!playerchunkmap_playerchunk.c.contains(player)) { ++ playerchunkmap_playerchunk.a(player); ++ } ++ } ++ } ++ } else { ++ for (int x = cx - player.viewDistance; x <= cx + player.viewDistance; ++x) { ++ for (int z = cz - player.viewDistance; z <= cz + player.viewDistance; ++z) { ++ if (!this.a(x, z, cx, cz, viewDistance)) { ++ this.c(x, z).b(player); ++ } ++ } ++ } ++ } ++ ++ player.viewDistance = viewDistance; ++ } ++ } ++ // Paper end + } +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +index 8fcbba3..6fb4fb0 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +@@ -1427,6 +1427,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + public void setAffectsSpawning(boolean affects) { + getHandle().affectsSpawning = affects; + } ++ ++ @Override ++ public int getViewDistance() { ++ return getHandle().viewDistance; ++ } ++ ++ @Override ++ public void setViewDistance(int viewDistance) { ++ ((WorldServer) getHandle().world).getPlayerChunkMap().updateViewDistance(getHandle(), viewDistance); ++ } + // Paper end + + // Spigot start +-- +2.7.2 + diff --git a/Spigot-Server-Patches/0039-Optimize-draining.patch b/Spigot-Server-Patches/0039-Optimize-draining.patch deleted file mode 100644 index 0d6579b4d1..0000000000 --- a/Spigot-Server-Patches/0039-Optimize-draining.patch +++ /dev/null @@ -1,29 +0,0 @@ -From e930fc7dbc68671274199b2268d34bb3d8179990 Mon Sep 17 00:00:00 2001 -From: Byteflux -Date: Fri, 10 Apr 2015 02:24:20 -0700 -Subject: [PATCH] Optimize draining - - -diff --git a/src/main/java/net/minecraft/server/BlockFlowing.java b/src/main/java/net/minecraft/server/BlockFlowing.java -index de1dddb..ff18f63 100644 ---- a/src/main/java/net/minecraft/server/BlockFlowing.java -+++ b/src/main/java/net/minecraft/server/BlockFlowing.java -@@ -88,7 +88,14 @@ public class BlockFlowing extends BlockFluids { - iblockdata = iblockdata.set(BlockFlowing.LEVEL, Integer.valueOf(i1)); - world.setTypeAndData(blockposition, iblockdata, 2); - world.a(blockposition, (Block) this, j); -- world.applyPhysics(blockposition, this); -+ // PaperSpigot start - Optimize draining -+ world.d(blockposition.west(), this); -+ world.d(blockposition.east(), this); -+ world.d(blockposition.up(), this); -+ world.d(blockposition.north(), this); -+ world.d(blockposition.south(), this); -+ world.spigotConfig.antiXrayInstance.updateNearbyBlocks(world, blockposition); // Spigot -+ // PaperSpigot end - } - } - } else { --- -2.5.2 - diff --git a/Spigot-Server-Patches/0040-Disable-explosion-knockback.patch b/Spigot-Server-Patches/0040-Disable-explosion-knockback.patch new file mode 100644 index 0000000000..113581e90a --- /dev/null +++ b/Spigot-Server-Patches/0040-Disable-explosion-knockback.patch @@ -0,0 +1,73 @@ +From 8720ceb09eaf96052ee087a76ecb1782fbda6d27 Mon Sep 17 00:00:00 2001 +From: Sudzzy +Date: Wed, 2 Mar 2016 14:48:03 -0600 +Subject: [PATCH] Disable explosion knockback + + +diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index 8d6e0a2..6b5067a 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -213,4 +213,9 @@ public class PaperWorldConfig { + lavaFlowSpeedNormal = getInt("lava-flow-speed.normal", 30); + lavaFlowSpeedNether = getInt("lava-flow-speed.nether", 10); + } ++ ++ public boolean disableExplosionKnockback; ++ private void disableExplosionKnockback(){ ++ disableExplosionKnockback = getBoolean("disable-explosion-knockback", false); ++ } + } +diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java +index b410f3b..8d91f7c 100644 +--- a/src/main/java/net/minecraft/server/EntityLiving.java ++++ b/src/main/java/net/minecraft/server/EntityLiving.java +@@ -851,12 +851,14 @@ public abstract class EntityLiving extends Entity { + } + } + ++ boolean knockbackCancelled = world.paperConfig.disableExplosionKnockback && damagesource.isExplosion() && this instanceof EntityHuman; // Paper - Disable explosion knockback + if (flag1) { + if (flag) { + this.world.broadcastEntityEffect(this, (byte) 29); + } else if (damagesource instanceof EntityDamageSource && ((EntityDamageSource) damagesource).x()) { + this.world.broadcastEntityEffect(this, (byte) 33); + } else { ++ if (!knockbackCancelled) // Paper - Disable explosion knockback + this.world.broadcastEntityEffect(this, (byte) 2); + } + +@@ -880,6 +882,8 @@ public abstract class EntityLiving extends Entity { + } + } + ++ if (knockbackCancelled) this.world.broadcastEntityEffect(this, (byte) 2); // Paper - Disable explosion knockback ++ + if (this.getHealth() <= 0.0F) { + SoundEffect soundeffect = this.bS(); + +diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java +index afe402e..cd2fb14 100644 +--- a/src/main/java/net/minecraft/server/Explosion.java ++++ b/src/main/java/net/minecraft/server/Explosion.java +@@ -145,7 +145,7 @@ public class Explosion { + double d14 = 1.0D; + + if (entity instanceof EntityLiving) { +- d14 = EnchantmentProtection.a((EntityLiving) entity, d13); ++ d14 = entity instanceof EntityHuman && world.paperConfig.disableExplosionKnockback ? 0 : EnchantmentProtection.a((EntityLiving) entity, d13); // Paper - Disable explosion knockback + } + + entity.motX += d8 * d14; +@@ -154,7 +154,7 @@ public class Explosion { + if (entity instanceof EntityHuman) { + EntityHuman entityhuman = (EntityHuman) entity; + +- if (!entityhuman.isSpectator() && (!entityhuman.l_() || !entityhuman.abilities.isFlying)) { ++ if (!entityhuman.isSpectator() && (!entityhuman.l_() && !world.paperConfig.disableExplosionKnockback|| !entityhuman.abilities.isFlying)) { // Paper - Disable explosion knockback + this.k.put(entityhuman, new Vec3D(d8 * d13, d9 * d13, d10 * d13)); + } + } +-- +2.7.2 + diff --git a/Spigot-Server-Patches/0040-Toggleable-player-crits-helps-mitigate-hacked-client.patch b/Spigot-Server-Patches/0040-Toggleable-player-crits-helps-mitigate-hacked-client.patch deleted file mode 100644 index d7a6864dd5..0000000000 --- a/Spigot-Server-Patches/0040-Toggleable-player-crits-helps-mitigate-hacked-client.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 75816e95b1a72dabba47e22901bff5c9ce7d89cc Mon Sep 17 00:00:00 2001 -From: Roman Alexander -Date: Fri, 27 Mar 2015 00:52:24 -0400 -Subject: [PATCH] Toggleable player crits, helps mitigate hacked clients. - - -diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index b901c69..cc1e33c 100644 ---- a/src/main/java/net/minecraft/server/EntityHuman.java -+++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -974,7 +974,7 @@ public abstract class EntityHuman extends EntityLiving { - } - - if (f > 0.0F || f1 > 0.0F) { -- boolean flag = this.fallDistance > 0.0F && !this.onGround && !this.k_() && !this.V() && !this.hasEffect(MobEffectList.BLINDNESS) && this.vehicle == null && entity instanceof EntityLiving; -+ boolean flag = !world.paperSpigotConfig.disablePlayerCrits && this.fallDistance > 0.0F && !this.onGround && !this.k_() && !this.V() && !this.hasEffect(MobEffectList.BLINDNESS) && this.vehicle == null && entity instanceof EntityLiving; // PaperSpigot - - if (flag && f > 0.0F) { - f *= 1.5F; -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index 9ad53fa..1a4a9af 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -192,9 +192,11 @@ public class PaperSpigotWorldConfig - } - - public boolean boatsDropBoats; -+ public boolean disablePlayerCrits; - private void mechanicsChanges() - { - boatsDropBoats = getBoolean( "game-mechanics.boats-drop-boats", false ); -+ disablePlayerCrits = getBoolean( "game-mechanics.disable-player-crits", false ); - } - - public boolean netherVoidTopDamage; --- -2.7.0 - diff --git a/Spigot-Server-Patches/0041-Add-PlayerLocaleChangeEvent.patch b/Spigot-Server-Patches/0041-Add-PlayerLocaleChangeEvent.patch deleted file mode 100644 index b4ca003803..0000000000 --- a/Spigot-Server-Patches/0041-Add-PlayerLocaleChangeEvent.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 8dff59c6bbe54bad21324805a3302cf346c987c9 Mon Sep 17 00:00:00 2001 -From: Isaac Moore -Date: Fri, 27 Mar 2015 00:52:24 -0400 -Subject: [PATCH] Add PlayerLocaleChangeEvent - - -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 3810f86..be50b55 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -995,7 +995,13 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - } - - public void a(PacketPlayInSettings packetplayinsettings) { -+ // PaperSpigot start - Add PlayerLocaleChangeEvent -+ String oldLocale = this.locale; - this.locale = packetplayinsettings.a(); -+ if (!this.locale.equals(oldLocale)) { -+ CraftEventFactory.callPlayerLocaleChangeEvent(this, oldLocale, this.locale); -+ } -+ // PaperSpigot end - this.bR = packetplayinsettings.c(); - this.bS = packetplayinsettings.d(); - this.getDataWatcher().watch(10, Byte.valueOf((byte) packetplayinsettings.e())); -diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 147b928..db91503 100644 ---- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -970,4 +970,13 @@ public class CraftEventFactory { - firework.world.getServer().getPluginManager().callEvent(event); - return event; - } -+ -+ // PaperSpigot start - Add PlayerLocaleChangeEvent -+ public static PlayerLocaleChangeEvent callPlayerLocaleChangeEvent(EntityHuman who, String oldLocale, String newLocale) { -+ Player player = (Player) who.getBukkitEntity(); -+ PlayerLocaleChangeEvent event = new PlayerLocaleChangeEvent(player, oldLocale, newLocale); -+ Bukkit.getPluginManager().callEvent(event); -+ return event; -+ } -+ // PaperSpigot end - } --- -2.6.0 - diff --git a/Spigot-Server-Patches/0041-Disable-thunder.patch b/Spigot-Server-Patches/0041-Disable-thunder.patch new file mode 100644 index 0000000000..f28ec39b51 --- /dev/null +++ b/Spigot-Server-Patches/0041-Disable-thunder.patch @@ -0,0 +1,37 @@ +From 6ebaa01ec3801936dddbffe7fa626d99bb9bac5b Mon Sep 17 00:00:00 2001 +From: Sudzzy +Date: Wed, 2 Mar 2016 14:52:43 -0600 +Subject: [PATCH] Disable thunder + + +diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index 6b5067a..b8262fc 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -218,4 +218,9 @@ public class PaperWorldConfig { + private void disableExplosionKnockback(){ + disableExplosionKnockback = getBoolean("disable-explosion-knockback", false); + } ++ ++ public boolean disableThunder; ++ private void disableThunder() { ++ disableThunder = getBoolean("disable-thunder", false); ++ } + } +diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java +index 1c8f6a1..5afc655 100644 +--- a/src/main/java/net/minecraft/server/WorldServer.java ++++ b/src/main/java/net/minecraft/server/WorldServer.java +@@ -416,7 +416,8 @@ public class WorldServer extends World implements IAsyncTaskHandler { + int l; + BlockPosition blockposition; + +- if (flag && flag1 && this.random.nextInt(100000) == 0) { ++ // Paper - Disable thunder ++ if (!this.paperConfig.disableThunder && flag && flag1 && this.random.nextInt(100000) == 0) { + this.l = this.l * 3 + 1013904223; + l = this.l >> 2; + blockposition = this.a(new BlockPosition(j + (l & 15), 0, k + (l >> 8 & 15))); +-- +2.7.2 + diff --git a/Spigot-Server-Patches/0042-Disable-ice-and-snow.patch b/Spigot-Server-Patches/0042-Disable-ice-and-snow.patch new file mode 100644 index 0000000000..1aa739f657 --- /dev/null +++ b/Spigot-Server-Patches/0042-Disable-ice-and-snow.patch @@ -0,0 +1,36 @@ +From 848f1ede210fd27e9b0177c78d6a620ce78f89a0 Mon Sep 17 00:00:00 2001 +From: Sudzzy +Date: Wed, 2 Mar 2016 14:57:24 -0600 +Subject: [PATCH] Disable ice and snow + + +diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index b8262fc..cd67b7d 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -223,4 +223,9 @@ public class PaperWorldConfig { + private void disableThunder() { + disableThunder = getBoolean("disable-thunder", false); + } ++ ++ public boolean disableIceAndSnow; ++ private void disableIceAndSnow(){ ++ disableIceAndSnow = getBoolean("disable-ice-and-snow", false); ++ } + } +diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java +index 5afc655..6cc8d28 100644 +--- a/src/main/java/net/minecraft/server/WorldServer.java ++++ b/src/main/java/net/minecraft/server/WorldServer.java +@@ -440,7 +440,7 @@ public class WorldServer extends World implements IAsyncTaskHandler { + } + + this.methodProfiler.c("iceandsnow"); +- if (this.random.nextInt(16) == 0) { ++ if (!this.paperConfig.disableIceAndSnow && this.random.nextInt(16) == 0) { // Paper - Disable ice and snow + this.l = this.l * 3 + 1013904223; + l = this.l >> 2; + blockposition = this.p(new BlockPosition(j + (l & 15), 0, k + (l >> 8 & 15))); +-- +2.7.2 + diff --git a/Spigot-Server-Patches/0042-Fix-jar-being-shaded-multiple-times.patch b/Spigot-Server-Patches/0042-Fix-jar-being-shaded-multiple-times.patch deleted file mode 100644 index 5c5a8d22b2..0000000000 --- a/Spigot-Server-Patches/0042-Fix-jar-being-shaded-multiple-times.patch +++ /dev/null @@ -1,21 +0,0 @@ -From d50dae836a3d3f52e9c5be6089246adadbb71628 Mon Sep 17 00:00:00 2001 -From: Jedediah Smith -Date: Thu, 30 Apr 2015 22:42:34 -0400 -Subject: [PATCH] Fix jar being shaded multiple times - - -diff --git a/pom.xml b/pom.xml -index 19e47f4..68073c0 100644 ---- a/pom.xml -+++ b/pom.xml -@@ -130,6 +130,7 @@ - maven-jar-plugin - 2.5 - -+ true - - - org.bukkit.craftbukkit.Main --- -2.7.1 - diff --git a/Spigot-Server-Patches/0043-Configurable-end-credits-when-leaving-the-end.patch b/Spigot-Server-Patches/0043-Configurable-end-credits-when-leaving-the-end.patch deleted file mode 100644 index d17772d409..0000000000 --- a/Spigot-Server-Patches/0043-Configurable-end-credits-when-leaving-the-end.patch +++ /dev/null @@ -1,93 +0,0 @@ -From 49ec7288782b79ced596646469a118e5885a6aaa Mon Sep 17 00:00:00 2001 -From: DoctorDark -Date: Thu, 28 May 2015 20:12:38 -0500 -Subject: [PATCH] Configurable end credits when leaving the end - - -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index be50b55..161b191 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -508,11 +508,16 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - } - - public void c(int i) { -- if (this.dimension == 1 && i == 1) { -+ // PaperSpigot start - Allow configurable end portal credits -+ boolean endPortal = this.dimension == 1 && i == 1; -+ if (endPortal) { - this.b((Statistic) AchievementList.D); -- this.world.kill(this); -- this.viewingCredits = true; -- this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(4, 0.0F)); -+ if (!world.paperSpigotConfig.disableEndCredits) { -+ this.world.kill(this); -+ this.viewingCredits = true; -+ this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(4, 0.0F)); -+ } -+ // PaperSpigot end - } else { - if (this.dimension == 0 && i == 1) { - this.b((Statistic) AchievementList.C); -@@ -530,15 +535,19 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - } else { - this.b((Statistic) AchievementList.y); - } -+ } - -+ // PaperSpigot start - Allow configurable end portal credits -+ if (!endPortal || world.paperSpigotConfig.disableEndCredits) { - // CraftBukkit start -- TeleportCause cause = (this.dimension == 1 || i == 1) ? TeleportCause.END_PORTAL : TeleportCause.NETHER_PORTAL; -+ TeleportCause cause = (endPortal || (this.dimension == 1 || i == 1)) ? TeleportCause.END_PORTAL : TeleportCause.NETHER_PORTAL; - this.server.getPlayerList().changeDimension(this, i, cause); - // CraftBukkit end - this.lastSentExp = -1; - this.bM = -1.0F; - this.bN = -1; - } -+ // PaperSpigot end - - } - -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index d3d19dd..deb0b82 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -666,6 +666,8 @@ public abstract class PlayerList { - } - - TravelAgent agent = exit != null ? (TravelAgent) ((CraftWorld) exit.getWorld()).getHandle().getTravelAgent() : org.bukkit.craftbukkit.CraftTravelAgent.DEFAULT; // return arbitrary TA to compensate for implementation dependent plugins -+ agent.setCanCreatePortal(cause != TeleportCause.END_PORTAL); // PaperSpigot - Configurable end credits, don't allow End Portals to create portals -+ - PlayerPortalEvent event = new PlayerPortalEvent(entityplayer.getBukkitEntity(), enter, exit, agent, cause); - event.useTravelAgent(useTravelAgent); - Bukkit.getServer().getPluginManager().callEvent(event); -@@ -673,7 +675,8 @@ public abstract class PlayerList { - return; - } - -- exit = event.useTravelAgent() ? event.getPortalTravelAgent().findOrCreate(event.getTo()) : event.getTo(); -+ // PaperSpigot - Configurable end credits, if a plugin sets to use a travel agent even if the cause is an end portal, ignore it -+ exit = cause != TeleportCause.END_PORTAL && event.useTravelAgent() ? event.getPortalTravelAgent().findOrCreate(event.getTo()) : event.getTo(); - if (exit == null) { - return; - } -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index 1a4a9af..00ca118 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -221,4 +221,10 @@ public class PaperSpigotWorldConfig - useAsyncLighting = getBoolean( "use-async-lighting", false ); - log( "World async lighting: " + useAsyncLighting ); - } -+ -+ public boolean disableEndCredits; -+ private void disableEndCredits() -+ { -+ disableEndCredits = getBoolean( "game-mechanics.disable-end-credits", false ); -+ } - } --- -2.7.0 - diff --git a/Spigot-Server-Patches/0043-Configurable-mob-spawner-tick-rate.patch b/Spigot-Server-Patches/0043-Configurable-mob-spawner-tick-rate.patch new file mode 100644 index 0000000000..0621a2a51d --- /dev/null +++ b/Spigot-Server-Patches/0043-Configurable-mob-spawner-tick-rate.patch @@ -0,0 +1,68 @@ +From 10a3de48d2915d09a0b0401afa5bcfe9680d8f7f Mon Sep 17 00:00:00 2001 +From: Sudzzy +Date: Wed, 2 Mar 2016 15:03:53 -0600 +Subject: [PATCH] Configurable mob spawner tick rate + + +diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index cd67b7d..ca71b03 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -228,4 +228,9 @@ public class PaperWorldConfig { + private void disableIceAndSnow(){ + disableIceAndSnow = getBoolean("disable-ice-and-snow", false); + } ++ ++ public int mobSpawnerTickRate; ++ private void mobSpawnerTickRate() { ++ mobSpawnerTickRate = getInt("mob-spawner-tick-rate", 1); ++ } + } +diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +index 917b626..98f0e07 100644 +--- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java ++++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +@@ -18,6 +18,7 @@ public abstract class MobSpawnerAbstract { + private int maxNearbyEntities = 6; + private int requiredPlayerRange = 16; + private int spawnRange = 4; ++ private int tickDelay = 0; // Paper + + public MobSpawnerAbstract() {} + +@@ -36,6 +37,10 @@ public abstract class MobSpawnerAbstract { + } + + public void c() { ++ // Paper start - Configurable mob spawner tick rate ++ if (spawnDelay > 0 && --tickDelay > 0) return; ++ tickDelay = this.a().paperConfig.mobSpawnerTickRate; ++ // Paper end + if (!this.h()) { + this.e = this.d; + } else { +@@ -49,18 +54,18 @@ public abstract class MobSpawnerAbstract { + this.a().addParticle(EnumParticle.SMOKE_NORMAL, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]); + this.a().addParticle(EnumParticle.FLAME, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]); + if (this.spawnDelay > 0) { +- --this.spawnDelay; ++ this.spawnDelay -= tickDelay; // Paper + } + + this.e = this.d; + this.d = (this.d + (double) (1000.0F / ((float) this.spawnDelay + 200.0F))) % 360.0D; + } else { +- if (this.spawnDelay == -1) { ++ if (this.spawnDelay < -tickDelay) { // Paper + this.i(); + } + + if (this.spawnDelay > 0) { +- --this.spawnDelay; ++ this.spawnDelay -= tickDelay; // Paper + return; + } + +-- +2.7.2 + diff --git a/Spigot-Server-Patches/0048-Configurable-TNT-cannon-fix.patch b/Spigot-Server-Patches/0044-Configurable-TNT-cannon-fix.patch similarity index 59% rename from Spigot-Server-Patches/0048-Configurable-TNT-cannon-fix.patch rename to Spigot-Server-Patches/0044-Configurable-TNT-cannon-fix.patch index fb7a17df36..136212fabb 100644 --- a/Spigot-Server-Patches/0048-Configurable-TNT-cannon-fix.patch +++ b/Spigot-Server-Patches/0044-Configurable-TNT-cannon-fix.patch @@ -1,19 +1,34 @@ -From 5585f2e02d7ba71ddff799e36040d6e154263525 Mon Sep 17 00:00:00 2001 +From ce5b8ed7434fe0a2dcfc073f617b4479123602ed Mon Sep 17 00:00:00 2001 From: Iceee -Date: Thu, 4 Jun 2015 13:55:02 -0700 +Date: Wed, 2 Mar 2016 23:00:53 -0600 Subject: [PATCH] Configurable TNT cannon fix +diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index ca71b03..38d7dfc 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -233,4 +233,10 @@ public class PaperWorldConfig { + private void mobSpawnerTickRate() { + mobSpawnerTickRate = getInt("mob-spawner-tick-rate", 1); + } ++ ++ public boolean fixCannons; ++ private void fixCannons() { ++ fixCannons = getBoolean("fix-cannons", false); ++ log("Fix TNT cannons: " + fixCannons); ++ } + } diff --git a/src/main/java/net/minecraft/server/BlockDiodeAbstract.java b/src/main/java/net/minecraft/server/BlockDiodeAbstract.java -index ee49839..eaf9154 100644 +index ffc07cd..64aaba4 100644 --- a/src/main/java/net/minecraft/server/BlockDiodeAbstract.java +++ b/src/main/java/net/minecraft/server/BlockDiodeAbstract.java -@@ -72,6 +72,17 @@ public abstract class BlockDiodeAbstract extends BlockDirectional { +@@ -76,6 +76,17 @@ public abstract class BlockDiodeAbstract extends BlockFacingHorizontal { } else { this.b(world, blockposition, iblockdata, 0); world.setAir(blockposition); -+ // PaperSpigot start - Fix cannons -+ if (world.paperSpigotConfig.fixCannons) { ++ // Paper start - Fix cannons ++ if (world.paperConfig.fixCannons) { + world.applyPhysics(blockposition.shift(EnumDirection.EAST), this); + world.applyPhysics(blockposition.shift(EnumDirection.WEST), this); + world.applyPhysics(blockposition.shift(EnumDirection.SOUTH), this); @@ -22,16 +37,16 @@ index ee49839..eaf9154 100644 + world.applyPhysics(blockposition.shift(EnumDirection.UP), this); + return; + } -+ // PaperSpigot end ++ // Paper end EnumDirection[] aenumdirection = EnumDirection.values(); int i = aenumdirection.length; -@@ -169,6 +180,17 @@ public abstract class BlockDiodeAbstract extends BlockDirectional { +@@ -173,6 +184,17 @@ public abstract class BlockDiodeAbstract extends BlockFacingHorizontal { public void postBreak(World world, BlockPosition blockposition, IBlockData iblockdata) { - if (this.N) { -+ // PaperSpigot start - Fix cannons -+ if (world.paperSpigotConfig.fixCannons) { + if (this.d) { ++ // Paper start - Fix cannons ++ if (world.paperConfig.fixCannons) { + world.applyPhysics(blockposition.shift(EnumDirection.EAST), this); + world.applyPhysics(blockposition.shift(EnumDirection.WEST), this); + world.applyPhysics(blockposition.shift(EnumDirection.NORTH), this); @@ -40,20 +55,20 @@ index ee49839..eaf9154 100644 + world.applyPhysics(blockposition.shift(EnumDirection.UP), this); + return; + } -+ // PaperSpigot end ++ // Paper end EnumDirection[] aenumdirection = EnumDirection.values(); int i = aenumdirection.length; diff --git a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java -index 6a7e7b3..78c6d19 100644 +index b4d1741..257bbbb 100644 --- a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java +++ b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java @@ -52,6 +52,17 @@ public class BlockRedstoneTorch extends BlockTorch { public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata) { if (this.isOn) { -+ // PaperSpigot start - Fix cannons -+ if (world.paperSpigotConfig.fixCannons) { ++ // Paper start - Fix cannons ++ if (world.paperConfig.fixCannons) { + world.applyPhysics(blockposition.shift(EnumDirection.DOWN), this); + world.applyPhysics(blockposition.shift(EnumDirection.UP), this); + world.applyPhysics(blockposition.shift(EnumDirection.WEST), this); @@ -62,7 +77,7 @@ index 6a7e7b3..78c6d19 100644 + world.applyPhysics(blockposition.shift(EnumDirection.NORTH), this); + return; + } -+ // PaperSpigot end ++ // Paper end EnumDirection[] aenumdirection = EnumDirection.values(); int i = aenumdirection.length; @@ -70,8 +85,8 @@ index 6a7e7b3..78c6d19 100644 public void remove(World world, BlockPosition blockposition, IBlockData iblockdata) { if (this.isOn) { -+ // PaperSpigot start - Fix cannons -+ if (world.paperSpigotConfig.fixCannons) { ++ // Paper start - Fix cannons ++ if (world.paperConfig.fixCannons) { + world.applyPhysics(blockposition.shift(EnumDirection.DOWN), this); + world.applyPhysics(blockposition.shift(EnumDirection.UP), this); + world.applyPhysics(blockposition.shift(EnumDirection.WEST), this); @@ -80,38 +95,38 @@ index 6a7e7b3..78c6d19 100644 + world.applyPhysics(blockposition.shift(EnumDirection.NORTH), this); + return; + } -+ // PaperSpigot end ++ // Paper end EnumDirection[] aenumdirection = EnumDirection.values(); int i = aenumdirection.length; diff --git a/src/main/java/net/minecraft/server/BlockRedstoneWire.java b/src/main/java/net/minecraft/server/BlockRedstoneWire.java -index e5c675e..532188e 100644 +index 1a133d9..f4f9be6 100644 --- a/src/main/java/net/minecraft/server/BlockRedstoneWire.java +++ b/src/main/java/net/minecraft/server/BlockRedstoneWire.java -@@ -142,6 +142,17 @@ public class BlockRedstoneWire extends Block { +@@ -184,6 +184,17 @@ public class BlockRedstoneWire extends Block { } - this.R.add(blockposition); -+ // PaperSpigot start - Fix cannons -+ if (world.paperSpigotConfig.fixCannons) { -+ this.R.add(blockposition.shift(EnumDirection.WEST)); -+ this.R.add(blockposition.shift(EnumDirection.EAST)); -+ this.R.add(blockposition.shift(EnumDirection.DOWN)); -+ this.R.add(blockposition.shift(EnumDirection.UP)); -+ this.R.add(blockposition.shift(EnumDirection.NORTH)); -+ this.R.add(blockposition.shift(EnumDirection.SOUTH)); + this.B.add(blockposition); ++ // Paper start - Fix cannons ++ if (world.paperConfig.fixCannons) { ++ this.B.add(blockposition.shift(EnumDirection.WEST)); ++ this.B.add(blockposition.shift(EnumDirection.EAST)); ++ this.B.add(blockposition.shift(EnumDirection.DOWN)); ++ this.B.add(blockposition.shift(EnumDirection.UP)); ++ this.B.add(blockposition.shift(EnumDirection.NORTH)); ++ this.B.add(blockposition.shift(EnumDirection.SOUTH)); + return iblockdata; + } -+ // PaperSpigot end ++ // Paper end EnumDirection[] aenumdirection = EnumDirection.values(); int i1 = aenumdirection.length; -@@ -158,6 +169,17 @@ public class BlockRedstoneWire extends Block { - private void e(World world, BlockPosition blockposition) { +@@ -200,6 +211,17 @@ public class BlockRedstoneWire extends Block { + private void b(World world, BlockPosition blockposition) { if (world.getType(blockposition).getBlock() == this) { world.applyPhysics(blockposition, this); -+ // PaperSpigot start - Fix cannons -+ if (world.paperSpigotConfig.fixCannons) { ++ // Paper start - Fix cannons ++ if (world.paperConfig.fixCannons) { + world.applyPhysics(blockposition.shift(EnumDirection.WEST), this); + world.applyPhysics(blockposition.shift(EnumDirection.EAST), this); + world.applyPhysics(blockposition.shift(EnumDirection.NORTH), this); @@ -120,70 +135,70 @@ index e5c675e..532188e 100644 + world.applyPhysics(blockposition.shift(EnumDirection.UP), this); + return; + } -+ // PaperSpigot end ++ // Paper end EnumDirection[] aenumdirection = EnumDirection.values(); int i = aenumdirection.length; diff --git a/src/main/java/net/minecraft/server/BlockTNT.java b/src/main/java/net/minecraft/server/BlockTNT.java -index 27ce179..3d1e583 100644 +index 09d5f7b..a3c0315 100644 --- a/src/main/java/net/minecraft/server/BlockTNT.java +++ b/src/main/java/net/minecraft/server/BlockTNT.java @@ -30,7 +30,11 @@ public class BlockTNT extends Block { public void wasExploded(World world, BlockPosition blockposition, Explosion explosion) { if (!world.isClientSide) { - org.bukkit.Location loc = explosion.source instanceof EntityTNTPrimed ? ((EntityTNTPrimed) explosion.source).sourceLoc : new org.bukkit.Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()); // PaperSpigot -- EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(loc, world, (double) ((float) blockposition.getX() + 0.5F), (double) ((float) blockposition.getY() + 0.5F), (double) ((float) blockposition.getZ() + 0.5F), explosion.getSource()); // PaperSpigot - add loc -+ // PaperSpigot start - Fix cannons + org.bukkit.Location loc = explosion.source instanceof EntityTNTPrimed ? ((EntityTNTPrimed) explosion.source).sourceLoc : new org.bukkit.Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()); // Paper +- EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(loc, world, (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F), explosion.getSource()); // Paper - Add loc ++ // Paper start - Fix cannons + double y = blockposition.getY(); -+ if (!world.paperSpigotConfig.fixCannons) y += 0.5; -+ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(loc, world, (double) ((float) blockposition.getX() + 0.5F), y, (double) ((float) blockposition.getZ() + 0.5F), explosion.getSource()); // PaperSpigot - add loc -+ // PaperSpigot end ++ if (!world.paperConfig.fixCannons) y += 0.5; ++ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(loc, world, (double) ((float) blockposition.getX() + 0.5F), y, (double) ((float) blockposition.getZ() + 0.5F), explosion.getSource()); // Paper - Add loc ++ // Paper end - entitytntprimed.fuseTicks = world.random.nextInt(entitytntprimed.fuseTicks / 4) + entitytntprimed.fuseTicks / 8; + entitytntprimed.setFuseTicks((short) (world.random.nextInt(entitytntprimed.getFuseTicks() / 4) + entitytntprimed.getFuseTicks() / 8)); world.addEntity(entitytntprimed); @@ -45,7 +49,11 @@ public class BlockTNT extends Block { if (!world.isClientSide) { if (((Boolean) iblockdata.get(BlockTNT.EXPLODE)).booleanValue()) { - org.bukkit.Location loc = new org.bukkit.Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()); // PaperSpigot -- EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(loc, world, (double) ((float) blockposition.getX() + 0.5F), (double) ((float) blockposition.getY() + 0.5F), (double) ((float) blockposition.getZ() + 0.5F), entityliving); // PaperSpigot - add loc -+ // PaperSpigot start - Fix cannons + org.bukkit.Location loc = new org.bukkit.Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()); // Paper +- EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(loc, world, (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F), entityliving); // Paper - Add loc ++ // Paper start - Fix cannons + double y = blockposition.getY(); -+ if (!world.paperSpigotConfig.fixCannons) y += 0.5; -+ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(loc, world, (double) ((float) blockposition.getX() + 0.5F), y, (double) ((float) blockposition.getZ() + 0.5F), entityliving); // PaperSpigot - add loc -+ // PaperSpigot end ++ if (!world.paperConfig.fixCannons) y += 0.5; ++ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(loc, world, (double) ((float) blockposition.getX() + 0.5F), y, (double) ((float) blockposition.getZ() + 0.5F), entityliving); // Paper - Add loc ++ // Paper end world.addEntity(entitytntprimed); - world.makeSound(entitytntprimed, "game.tnt.primed", 1.0F, 1.0F); + world.a((EntityHuman) null, entitytntprimed.locX, entitytntprimed.locY, entitytntprimed.locZ, SoundEffects.gj, SoundCategory.BLOCKS, 1.0F, 1.0F); diff --git a/src/main/java/net/minecraft/server/DispenserRegistry.java b/src/main/java/net/minecraft/server/DispenserRegistry.java -index bc07d3d..cc7a1e3 100644 +index c1c0c7c..e2eb620 100644 --- a/src/main/java/net/minecraft/server/DispenserRegistry.java +++ b/src/main/java/net/minecraft/server/DispenserRegistry.java -@@ -520,7 +520,11 @@ public class DispenserRegistry { +@@ -498,7 +498,11 @@ public class DispenserRegistry { org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ()); CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); -- BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX() + 0.5, blockposition.getY() + 0.5, blockposition.getZ() + 0.5)); -+ // PaperSpigot start - Fix cannons +- BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector((double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D)); ++ // Paper start - Fix cannons + double y = blockposition.getY(); -+ if (!world.paperSpigotConfig.fixCannons) y += 0.5; -+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX() + 0.5, y, blockposition.getZ() + 0.5)); -+ // PaperSpigot end ++ if (!world.paperConfig.fixCannons) y += 0.5; ++ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector((double) blockposition.getX() + 0.5D, y, (double) blockposition.getZ() + 0.5D)); ++ // Paper end if (!BlockDispenser.eventFired) { world.getServer().getPluginManager().callEvent(event); } diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java -index f2d0eee..36c384e 100644 +index 500163b..5b6f300 100644 --- a/src/main/java/net/minecraft/server/EntityFallingBlock.java +++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java -@@ -282,4 +282,22 @@ public class EntityFallingBlock extends Entity { - public IBlockData getBlock() { - return this.block; +@@ -293,4 +293,22 @@ public class EntityFallingBlock extends Entity { + public boolean br() { + return true; } + -+ // PaperSpigot start - Fix cannons ++ // Paper start - Fix cannons + @Override + public double f(double d0, double d1, double d2) { -+ if (!world.paperSpigotConfig.fixCannons) return super.f(d0, d1, d2); ++ if (!world.paperConfig.fixCannons) return super.f(d0, d1, d2); + + double d3 = this.locX - d0; + double d4 = this.locY + this.getHeadHeight() - d1; @@ -194,30 +209,30 @@ index f2d0eee..36c384e 100644 + + @Override + public float getHeadHeight() { -+ return world.paperSpigotConfig.fixCannons ? this.length / 2 : super.getHeadHeight(); ++ return world.paperConfig.fixCannons ? this.length / 2 : super.getHeadHeight(); + } -+ // PaperSpigot end ++ // Paper end } diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java -index 7a5fb2a..872d965 100644 +index 1820c7b..ca3bfd5 100644 --- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java +++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java -@@ -37,6 +37,7 @@ public class EntityTNTPrimed extends Entity { +@@ -42,6 +42,7 @@ public class EntityTNTPrimed extends Entity { this.lastY = d1; this.lastZ = d2; this.source = entityliving; -+ if (world.paperSpigotConfig.fixCannons) this.motX = this.motZ = 0.0F; // PaperSpigot - Fix cannons ++ if (world.paperConfig.fixCannons) this.motX = this.motZ = 0.0F; // Paper - Fix cannons } - protected void h() {} -@@ -150,7 +151,64 @@ public class EntityTNTPrimed extends Entity { + protected void i() { +@@ -137,9 +138,66 @@ public class EntityTNTPrimed extends Entity { return this.source; } -+ // PaperSpigot start - Fix cannons ++ // Paper start - Fix cannons + @Override + public double f(double d0, double d1, double d2) { -+ if (!world.paperSpigotConfig.fixCannons) return super.f(d0, d1, d2); ++ if (!world.paperConfig.fixCannons) return super.f(d0, d1, d2); + + double d3 = this.locX - d0; + double d4 = this.locY + this.getHeadHeight() - d1; @@ -227,29 +242,29 @@ index 7a5fb2a..872d965 100644 + } + + @Override -+ public boolean aL() { -+ return !world.paperSpigotConfig.fixCannons && super.aL(); ++ public boolean bd() { ++ return !world.paperConfig.fixCannons && super.bd(); + } + + @Override public float getHeadHeight() { - return 0.0F; -+ return world.paperSpigotConfig.fixCannons ? this.length / 2 : 0.0F; - } ++ return world.paperConfig.fixCannons ? this.length / 2 : 0.0F; ++ } + + /** + * Author: Jedediah Smith + */ + @Override -+ public boolean W() { -+ if (!world.paperSpigotConfig.fixCannons) return super.W(); ++ public boolean aj() { ++ if (!world.paperConfig.fixCannons) return super.aj(); + + // Preserve velocity while calling the super method + double oldMotX = this.motX; + double oldMotY = this.motY; + double oldMotZ = this.motZ; + -+ super.W(); ++ super.aj(); + + this.motX = oldMotX; + this.motY = oldMotY; @@ -273,18 +288,20 @@ index 7a5fb2a..872d965 100644 + } + + return this.inWater; -+ } -+ // PaperSpigot end - } + } ++ // Paper end + + public void setFuseTicks(int i) { + this.datawatcher.set(EntityTNTPrimed.FUSE_TICKS, Integer.valueOf(i)); diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java -index 78e3a7d..0e8af2e 100644 +index cd2fb14..678ce44 100644 --- a/src/main/java/net/minecraft/server/Explosion.java +++ b/src/main/java/net/minecraft/server/Explosion.java -@@ -143,9 +143,16 @@ public class Explosion { - // CraftBukkit end - double d14 = EnchantmentProtection.a(entity, d13); +@@ -148,9 +148,16 @@ public class Explosion { + d14 = entity instanceof EntityHuman && world.paperConfig.disableExplosionKnockback ? 0 : EnchantmentProtection.a((EntityLiving) entity, d13); // Paper - Disable explosion knockback + } -+ // PaperSpigot start - Fix cannons ++ // Paper start - Fix cannons + /* entity.motX += d8 * d14; entity.motY += d9 * d14; @@ -292,59 +309,11 @@ index 78e3a7d..0e8af2e 100644 + */ + // This impulse method sets the dirty flag, so clients will get an immediate velocity update + entity.g(d8 * d14, d9 * d14, d10 * d14); -+ // PaperSpigot end ++ // Paper end + - if (entity instanceof EntityHuman && !((EntityHuman) entity).abilities.isInvulnerable) { - this.k.put((EntityHuman) entity, new Vec3D(d8 * d13, d9 * d13, d10 * d13)); - } -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index cffb5f0..180158b 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -261,4 +261,43 @@ public class PaperSpigotWorldConfig - generateVillage = getBoolean( "generator-settings.village", true ); - generateFlatBedrock = getBoolean( "generator-settings.flat-bedrock", false ); - } -+ -+ public boolean fixCannons; -+ private void fixCannons() -+ { -+ // TODO: Remove migrations after most users have upgraded. -+ if ( PaperSpigotConfig.version < 9 ) -+ { -+ // Migrate default value -+ -+ boolean value = config.getBoolean( "world-settings.default.fix-cannons", false ); -+ if ( !value ) value = config.getBoolean( "world-settings.default.tnt-gameplay.fix-directional-bias", false ); -+ if ( !value ) value = !config.getBoolean( "world-settings.default.tnt-gameplay.moves-in-water", true ); -+ if ( !value ) value = config.getBoolean( "world-settings.default.tnt-gameplay.legacy-explosion-height", false ); -+ if ( value ) config.set( "world-settings.default.fix-cannons", true ); -+ -+ if ( config.contains( "world-settings.default.tnt-gameplay" ) ) -+ { -+ config.getDefaults().set( "world-settings.default.tnt-gameplay", null); -+ config.set( "world-settings.default.tnt-gameplay", null ); -+ } -+ -+ // Migrate world setting -+ -+ value = config.getBoolean( "world-settings." + worldName + ".fix-cannons", false ); -+ if ( !value ) value = config.getBoolean( "world-settings." + worldName + ".tnt-gameplay.fix-directional-bias", false ); -+ if ( !value ) value = !config.getBoolean( "world-settings." + worldName + ".tnt-gameplay.moves-in-water", true ); -+ if ( !value ) value = config.getBoolean( "world-settings." + worldName + ".tnt-gameplay.legacy-explosion-height", false ); -+ if ( value ) config.set( "world-settings." + worldName + ".fix-cannons", true ); -+ -+ if ( config.contains( "world-settings." + worldName + ".tnt-gameplay" ) ) -+ { -+ config.getDefaults().set( "world-settings." + worldName + ".tnt-gameplay", null); -+ config.set( "world-settings." + worldName + ".tnt-gameplay", null ); -+ } -+ } -+ -+ fixCannons = getBoolean( "fix-cannons", false ); -+ log( "Fix TNT cannons: " + fixCannons ); -+ } - } + if (entity instanceof EntityHuman) { + EntityHuman entityhuman = (EntityHuman) entity; + -- -2.7.0 +2.7.2 diff --git a/Spigot-Server-Patches/0044-Force-load-chunks-for-specific-entities-that-fly-thr.patch b/Spigot-Server-Patches/0044-Force-load-chunks-for-specific-entities-that-fly-thr.patch deleted file mode 100644 index 8d1beb7783..0000000000 --- a/Spigot-Server-Patches/0044-Force-load-chunks-for-specific-entities-that-fly-thr.patch +++ /dev/null @@ -1,206 +0,0 @@ -From a4fdf33885e7cc6ab538e1bc98e867fa74c33956 Mon Sep 17 00:00:00 2001 -From: Byteflux -Date: Tue, 30 Jun 2015 20:45:24 -0700 -Subject: [PATCH] Force load chunks for specific entities that fly through - - -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index ae0f276..0e6a37f 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -59,6 +59,17 @@ public class ChunkProviderServer implements IChunkProvider { - return; - } - // PaperSpigot end -+ // PaperSpigot start - Don't unload chunk if it contains an entity that loads chunks -+ if (chunk != null) { -+ for (List entities : chunk.entitySlices) { -+ for (Entity entity : entities) { -+ if (entity.loadChunks) { -+ return; -+ } -+ } -+ } -+ } -+ // PaperSpigot end - if (this.world.worldProvider.e()) { - if (!this.world.c(i, j)) { - // CraftBukkit start -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index a3b4cdb..68126c4 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -116,6 +116,7 @@ public abstract class Entity implements ICommandListener { - public org.bukkit.projectiles.ProjectileSource projectileSource; // CraftBukkit - For projectiles only - public boolean forceExplosionKnockback; // CraftBukkit - SPIGOT-949 - public boolean inUnloadedChunk = false; // PaperSpigot - Remove entities in unloaded chunks -+ public boolean loadChunks = false; // PaperSpigot - Entities can load chunks they move through and keep them loaded - - // Spigot start - public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getEntityTimings(this); // Spigot -@@ -403,8 +404,21 @@ public abstract class Entity implements ICommandListener { - return this.world.getCubes(this, axisalignedbb).isEmpty() && !this.world.containsLiquid(axisalignedbb); - } - -+ /** -+ * PaperSpigot - Load surrounding chunks the entity is moving through -+ */ -+ public void loadChunks() { -+ for (int cx = (int) locX >> 4; cx <= (int) (locX + motX) >> 4; ++cx) { -+ for (int cz = (int) locZ >> 4; cz <= (int) (locZ + motZ) >> 4; ++cz) { -+ ((ChunkProviderServer) world.chunkProvider).getChunkAt(cx, cz); -+ } -+ } -+ } -+ -+ - public void move(double d0, double d1, double d2) { - org.bukkit.craftbukkit.SpigotTimings.entityMoveTimer.startTiming(); // Spigot -+ if (this.loadChunks) loadChunks(); // PaperSpigot - Load chunks - if (this.noclip) { - this.a(this.getBoundingBox().c(d0, d1, d2)); - this.recalcPosition(); -diff --git a/src/main/java/net/minecraft/server/EntityEnderPearl.java b/src/main/java/net/minecraft/server/EntityEnderPearl.java -index f4b5032..319c0bc 100644 ---- a/src/main/java/net/minecraft/server/EntityEnderPearl.java -+++ b/src/main/java/net/minecraft/server/EntityEnderPearl.java -@@ -12,11 +12,13 @@ public class EntityEnderPearl extends EntityProjectile { - - public EntityEnderPearl(World world) { - super(world); -+ this.loadChunks = world.paperSpigotConfig.loadUnloadedEnderPearls; // PaperSpigot - } - - public EntityEnderPearl(World world, EntityLiving entityliving) { - super(world, entityliving); - this.c = entityliving; -+ this.loadChunks = world.paperSpigotConfig.loadUnloadedEnderPearls; // PaperSpigot - } - - protected void a(MovingObjectPosition movingobjectposition) { -diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java -index b34e93c..f2d0eee 100644 ---- a/src/main/java/net/minecraft/server/EntityFallingBlock.java -+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java -@@ -26,6 +26,7 @@ public class EntityFallingBlock extends Entity { - public EntityFallingBlock(org.bukkit.Location loc, World world) { - super(world); - sourceLoc = loc; -+ this.loadChunks = world.paperSpigotConfig.loadUnloadedFallingBlocks; // PaperSpigot - } - - public EntityFallingBlock(World world, double d0, double d1, double d2, IBlockData iblockdata) { -@@ -46,6 +47,7 @@ public class EntityFallingBlock extends Entity { - this.lastX = d0; - this.lastY = d1; - this.lastZ = d2; -+ this.loadChunks = world.paperSpigotConfig.loadUnloadedFallingBlocks; // PaperSpigot - } - - protected boolean s_() { -diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java -index f415248..7a5fb2a 100644 ---- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java -+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java -@@ -21,6 +21,7 @@ public class EntityTNTPrimed extends Entity { - // PaperSpigot end - this.k = true; - this.setSize(0.98F, 0.98F); -+ this.loadChunks = world.paperSpigotConfig.loadUnloadedTNTEntities; // PaperSpigot - } - - public EntityTNTPrimed(org.bukkit.Location loc, World world, double d0, double d1, double d2, EntityLiving entityliving) { -@@ -96,7 +97,15 @@ public class EntityTNTPrimed extends Entity { - private void explode() { - // CraftBukkit start - // float f = 4.0F; -- -+ -+ // PaperSpigot start - Force load chunks during TNT explosions -+ ChunkProviderServer chunkProviderServer = ((ChunkProviderServer) world.chunkProvider); -+ boolean forceChunkLoad = chunkProviderServer.forceChunkLoad; -+ if (world.paperSpigotConfig.loadUnloadedTNTEntities) { -+ chunkProviderServer.forceChunkLoad = true; -+ } -+ // PaperSpigot end -+ - org.bukkit.craftbukkit.CraftServer server = this.world.getServer(); - - ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) org.bukkit.craftbukkit.entity.CraftEntity.getEntity(server, this)); -@@ -106,6 +115,12 @@ public class EntityTNTPrimed extends Entity { - this.world.createExplosion(this, this.locX, this.locY + (double) (this.length / 2.0F), this.locZ, event.getRadius(), event.getFire(), true); - } - // CraftBukkit end -+ -+ // PaperSpigot start - Force load chunks during TNT explosions -+ if (world.paperSpigotConfig.loadUnloadedTNTEntities) { -+ chunkProviderServer.forceChunkLoad = forceChunkLoad; -+ } -+ // PaperSpigot end - } - - protected void b(NBTTagCompound nbttagcompound) { -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 82c43e3..d2cb1f1 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -1167,8 +1167,14 @@ public abstract class World implements IBlockAccess { - { - if ( !this.isChunkLoaded( chunkx, chunkz, true ) ) - { -- entity.inUnloadedChunk = true; // PaperSpigot - Remove entities in unloaded chunks -- continue; -+ // PaperSpigot start -+ if (entity.loadChunks) { -+ ((ChunkProviderServer) entity.world.chunkProvider).getChunkAt(chunkx, chunkz); -+ } else { -+ entity.inUnloadedChunk = true; // PaperSpigot - Remove entities in unloaded chunks -+ continue; -+ } -+ // PaperSpigot end - } - int cz = chunkz << 4; - Chunk chunk = this.getChunkAt( chunkx, chunkz ); -@@ -1648,6 +1654,7 @@ public abstract class World implements IBlockAccess { - int i1 = MathHelper.floor(entity.locZ / 16.0D); - - if (!entity.ad || entity.ae != k || entity.af != l || entity.ag != i1) { -+ if (entity.loadChunks) entity.loadChunks(); // PaperSpigot - Force load chunks - if (entity.ad && this.isChunkLoaded(entity.ae, entity.ag, true)) { - this.getChunkAt(entity.ae, entity.ag).a(entity, entity.af); - } -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index 00ca118..65e0f12 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -227,4 +227,14 @@ public class PaperSpigotWorldConfig - { - disableEndCredits = getBoolean( "game-mechanics.disable-end-credits", false ); - } -+ -+ public boolean loadUnloadedEnderPearls; -+ public boolean loadUnloadedTNTEntities; -+ public boolean loadUnloadedFallingBlocks; -+ private void loadUnloaded() -+ { -+ loadUnloadedEnderPearls = getBoolean( "load-chunks.enderpearls", false ); -+ loadUnloadedTNTEntities = getBoolean( "load-chunks.tnt-entities", false ); -+ loadUnloadedFallingBlocks = getBoolean( "load-chunks.falling-blocks", false ); -+ } - } -diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java -index d6311bd..5b0c64d 100644 ---- a/src/main/java/org/spigotmc/ActivationRange.java -+++ b/src/main/java/org/spigotmc/ActivationRange.java -@@ -252,7 +252,7 @@ public class ActivationRange - { - SpigotTimings.checkIfActiveTimer.startTiming(); - // Never safe to skip fireworks or entities not yet added to chunk -- if ( !entity.isAddedToChunk() || entity instanceof EntityFireworks ) { -+ if ( !entity.isAddedToChunk() || entity instanceof EntityFireworks || entity.loadChunks ) { // PaperSpigot - SpigotTimings.checkIfActiveTimer.stopTiming(); - return true; - } --- -2.7.0 - diff --git a/Spigot-Server-Patches/0062-Send-absolute-position-the-first-time-an-entity-is-s.patch b/Spigot-Server-Patches/0045-Send-absolute-position-the-first-time-an-entity-is-s.patch similarity index 61% rename from Spigot-Server-Patches/0062-Send-absolute-position-the-first-time-an-entity-is-s.patch rename to Spigot-Server-Patches/0045-Send-absolute-position-the-first-time-an-entity-is-s.patch index da07e91b93..4d2b9ff6a4 100644 --- a/Spigot-Server-Patches/0062-Send-absolute-position-the-first-time-an-entity-is-s.patch +++ b/Spigot-Server-Patches/0045-Send-absolute-position-the-first-time-an-entity-is-s.patch @@ -1,66 +1,66 @@ -From 601b8ccd9ffc815477f336e6c54610f478726e44 Mon Sep 17 00:00:00 2001 +From 1bb4693646197a671146dc8d34a8275ac43d8308 Mon Sep 17 00:00:00 2001 From: Jedediah Smith -Date: Fri, 3 Apr 2015 17:26:21 -0400 +Date: Wed, 2 Mar 2016 23:13:07 -0600 Subject: [PATCH] Send absolute position the first time an entity is seen diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -index f0149bf..1fc2388 100644 +index f8570a8..1602dff 100644 --- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java +++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -@@ -39,7 +39,12 @@ public class EntityTrackerEntry { +@@ -41,7 +41,12 @@ public class EntityTrackerEntry { private boolean x; private boolean y; - public boolean n; + public boolean b; - public Set trackedPlayers = Sets.newHashSet(); -+ // PaperSpigot start ++ // Paper start + // Replace trackedPlayers Set with a Map. The value is true until the player receives + // their first update (which is forced to have absolute coordinates), false afterward. + public java.util.Map trackedPlayerMap = new java.util.HashMap(); + public Set trackedPlayers = trackedPlayerMap.keySet(); -+ // PaperSpigot end ++ // Paper end - public EntityTrackerEntry(Entity entity, int i, int j, boolean flag) { + public EntityTrackerEntry(Entity entity, int i, int j, int k, boolean flag) { this.tracker = entity; -@@ -121,20 +126,20 @@ public class EntityTrackerEntry { - boolean flag = Math.abs(j1) >= 4 || Math.abs(k1) >= 4 || Math.abs(l1) >= 4 || this.m % 60 == 0; - boolean flag1 = Math.abs(l - this.yRot) >= 4 || Math.abs(i1 - this.xRot) >= 4; +@@ -126,20 +131,22 @@ public class EntityTrackerEntry { + boolean flag = k1 * k1 + l1 * l1 + i2 * i2 >= 128L || this.a % 60 == 0; + boolean flag1 = Math.abs(i1 - this.yRot) >= 1 || Math.abs(j1 - this.xRot) >= 1; - // CraftBukkit start - Code moved from below - if (flag) { -- this.xLoc = i; -- this.yLoc = j; -- this.zLoc = k; +- this.xLoc = j; +- this.yLoc = k; +- this.zLoc = l; - } -+ if (this.m > 0 || this.tracker instanceof EntityArrow) { // PaperSpigot - Moved up ++ if (this.a > 0 || this.tracker instanceof EntityArrow) { // Paper - Moved up + // CraftBukkit start - Code moved from below + if (flag) { -+ this.xLoc = i; -+ this.yLoc = j; -+ this.zLoc = k; ++ this.xLoc = j; ++ this.yLoc = k; ++ this.zLoc = l; + } - if (flag1) { -- this.yRot = l; -- this.xRot = i1; -- } -- // CraftBukkit end + if (flag1) { -+ this.yRot = l; -+ this.xRot = i1; ++ this.yRot = i1; ++ this.xRot = j1; + } + // CraftBukkit end - -- if (this.m > 0 || this.tracker instanceof EntityArrow) { - if (j1 >= -128 && j1 < 128 && k1 >= -128 && k1 < 128 && l1 >= -128 && l1 < 128 && this.v <= 400 && !this.x && this.y == this.tracker.onGround) { + this.yRot = i1; + this.xRot = j1; +- } + // CraftBukkit end +- +- if (this.a > 0 || this.tracker instanceof EntityArrow) { + if (k1 >= -32768L && k1 < 32768L && l1 >= -32768L && l1 < 32768L && i2 >= -32768L && i2 < 32768L && this.v <= 400 && !this.x && this.y == this.tracker.onGround) { if ((!flag || !flag1) && !(this.tracker instanceof EntityArrow)) { if (flag) { -@@ -173,7 +178,26 @@ public class EntityTrackerEntry { +@@ -185,7 +192,26 @@ public class EntityTrackerEntry { } if (object != null) { - this.broadcast((Packet) object); -+ // PaperSpigot start - ensure fresh viewers get an absolute position on their first update, ++ // Paper start - ensure fresh viewers get an absolute position on their first update, + // since we can't be certain what position they received in the spawn packet. + if (object instanceof PacketPlayOutEntityTeleport) { + this.broadcast((Packet) object); @@ -71,7 +71,7 @@ index f0149bf..1fc2388 100644 + if (viewer.getValue()) { + viewer.setValue(false); + if (teleportPacket == null) { -+ teleportPacket = new PacketPlayOutEntityTeleport(this.tracker.getId(), i, j, k, (byte) l, (byte) i1, this.tracker.onGround); ++ teleportPacket = new PacketPlayOutEntityTeleport(this.tracker); + } + viewer.getKey().playerConnection.sendPacket(teleportPacket); + } else { @@ -79,19 +79,19 @@ index f0149bf..1fc2388 100644 + } + } + } -+ // PaperSpigot end ++ // Paper end } - this.b(); -@@ -324,7 +348,7 @@ public class EntityTrackerEntry { + this.d(); +@@ -338,7 +364,7 @@ public class EntityTrackerEntry { entityplayer.removeQueue.remove(Integer.valueOf(this.tracker.getId())); // CraftBukkit end - this.trackedPlayers.add(entityplayer); -+ this.trackedPlayerMap.put(entityplayer, true); // PaperBukkit - Packet packet = this.c(); ++ this.trackedPlayerMap.put(entityplayer, true); // Paper + Packet packet = this.e(); entityplayer.playerConnection.sendPacket(packet); -- -2.6.4 +2.7.2 diff --git a/Spigot-Server-Patches/0045-Stackable-Buckets.patch b/Spigot-Server-Patches/0045-Stackable-Buckets.patch deleted file mode 100644 index cdc4337111..0000000000 --- a/Spigot-Server-Patches/0045-Stackable-Buckets.patch +++ /dev/null @@ -1,174 +0,0 @@ -From afb88d4d332f4496e7dafe36d397e4156df10b4d Mon Sep 17 00:00:00 2001 -From: Byteflux -Date: Mon, 1 Jun 2015 20:45:24 -0700 -Subject: [PATCH] Stackable Buckets - - -diff --git a/src/main/java/net/minecraft/server/ItemBucket.java b/src/main/java/net/minecraft/server/ItemBucket.java -index 4d362ae..b62ea42 100644 ---- a/src/main/java/net/minecraft/server/ItemBucket.java -+++ b/src/main/java/net/minecraft/server/ItemBucket.java -@@ -7,6 +7,8 @@ import org.bukkit.event.player.PlayerBucketEmptyEvent; - import org.bukkit.event.player.PlayerBucketFillEvent; - // CraftBukkit end - -+import org.github.paperspigot.PaperSpigotConfig; // PaperSpigot -+ - public class ItemBucket extends Item { - - private Block a; -@@ -93,6 +95,18 @@ public class ItemBucket extends Item { - - if (this.a(world, blockposition1) && !entityhuman.abilities.canInstantlyBuild) { - entityhuman.b(StatisticList.USE_ITEM_COUNT[Item.getId(this)]); -+ // PaperSpigot start - Stackable Buckets -+ if ((this == Items.LAVA_BUCKET && PaperSpigotConfig.stackableLavaBuckets) || -+ (this == Items.WATER_BUCKET && PaperSpigotConfig.stackableWaterBuckets)) { -+ if (--itemstack.count <= 0) { -+ return CraftItemStack.asNMSCopy(event.getItemStack()); -+ } -+ if (!entityhuman.inventory.pickup(CraftItemStack.asNMSCopy(event.getItemStack()))) { -+ entityhuman.drop(CraftItemStack.asNMSCopy(event.getItemStack()), false); -+ } -+ return itemstack; -+ } -+ // PaperSpigot end - return CraftItemStack.asNMSCopy(event.getItemStack()); // CraftBukkit - } - } -diff --git a/src/main/java/net/minecraft/server/ItemMilkBucket.java b/src/main/java/net/minecraft/server/ItemMilkBucket.java -index 91ea70d..8e3d77e 100644 ---- a/src/main/java/net/minecraft/server/ItemMilkBucket.java -+++ b/src/main/java/net/minecraft/server/ItemMilkBucket.java -@@ -1,5 +1,7 @@ - package net.minecraft.server; - -+import org.github.paperspigot.PaperSpigotConfig; // PaperSpigot -+ - public class ItemMilkBucket extends Item { - - public ItemMilkBucket() { -@@ -17,6 +19,15 @@ public class ItemMilkBucket extends Item { - } - - entityhuman.b(StatisticList.USE_ITEM_COUNT[Item.getId(this)]); -+ // PaperSpigot start - Stackable Buckets -+ if (PaperSpigotConfig.stackableMilkBuckets) { -+ if (itemstack.count <= 0) { -+ return new ItemStack(Items.BUCKET); -+ } else if (!entityhuman.inventory.pickup(new ItemStack(Items.BUCKET))) { -+ entityhuman.drop(new ItemStack(Items.BUCKET), false); -+ } -+ } -+ // PaperSpigot end - return itemstack.count <= 0 ? new ItemStack(Items.BUCKET) : itemstack; - } - -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 7ea74c0..18d8d2d 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -62,6 +62,8 @@ import org.bukkit.inventory.InventoryView; - import org.bukkit.util.NumberConversions; - // CraftBukkit end - -+import org.github.paperspigot.PaperSpigotConfig; // PaperSpigot -+ - public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerListBox { - - private static final Logger c = LogManager.getLogger(); -@@ -1634,6 +1636,19 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList - case ALLOW: - case DEFAULT: - itemstack = this.player.activeContainer.clickItem(packetplayinwindowclick.b(), packetplayinwindowclick.c(), packetplayinwindowclick.f(), this.player); -+ // PaperSpigot start - Stackable Buckets -+ if (itemstack != null && -+ ((itemstack.getItem() == Items.LAVA_BUCKET && PaperSpigotConfig.stackableLavaBuckets) || -+ (itemstack.getItem() == Items.WATER_BUCKET && PaperSpigotConfig.stackableWaterBuckets) || -+ (itemstack.getItem() == Items.MILK_BUCKET && PaperSpigotConfig.stackableMilkBuckets))) { -+ if (action == InventoryAction.MOVE_TO_OTHER_INVENTORY) { -+ this.player.updateInventory(this.player.activeContainer); -+ } else { -+ this.player.playerConnection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.player.inventory.getCarried())); -+ this.player.playerConnection.sendPacket(new PacketPlayOutSetSlot(this.player.activeContainer.windowId, packetplayinwindowclick.b(), this.player.activeContainer.getSlot(packetplayinwindowclick.b()).getItem())); -+ } -+ } -+ // PaperSpigot end - break; - case DENY: - /* Needs enum constructor in InventoryAction -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java -index 744773d..31c4cf8 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java -@@ -3,14 +3,19 @@ package org.github.paperspigot; - import com.google.common.base.Throwables; - import java.io.File; - import java.io.IOException; -+import java.lang.reflect.Field; - import java.lang.reflect.InvocationTargetException; - import java.lang.reflect.Method; - import java.lang.reflect.Modifier; - import java.util.*; - import java.util.logging.Level; -+ -+import net.minecraft.server.Item; -+import net.minecraft.server.Items; - import net.minecraft.server.MinecraftServer; - import org.apache.commons.lang.StringUtils; - import org.bukkit.Bukkit; -+import org.bukkit.Material; - import org.bukkit.command.Command; - import org.bukkit.configuration.InvalidConfigurationException; - import org.bukkit.configuration.file.YamlConfiguration; -@@ -168,4 +173,47 @@ public class PaperSpigotConfig - dataValueAllowedItems = new HashSet( getList( "data-value-allowed-items", Collections.emptyList() ) ); - Bukkit.getLogger().info( "Data value allowed items: " + StringUtils.join(dataValueAllowedItems, ", ") ); - } -+ -+ public static boolean stackableLavaBuckets; -+ public static boolean stackableWaterBuckets; -+ public static boolean stackableMilkBuckets; -+ private static void stackableBuckets() -+ { -+ stackableLavaBuckets = getBoolean( "stackable-buckets.lava", false ); -+ stackableWaterBuckets = getBoolean( "stackable-buckets.water", false ); -+ stackableMilkBuckets = getBoolean( "stackable-buckets.milk", false ); -+ -+ Field maxStack; -+ -+ try { -+ maxStack = Material.class.getDeclaredField("maxStack"); -+ maxStack.setAccessible(true); -+ -+ Field modifiers = Field.class.getDeclaredField("modifiers"); -+ modifiers.setAccessible(true); -+ modifiers.setInt(maxStack, maxStack.getModifiers() & ~Modifier.FINAL); -+ } catch (Exception e) { -+ e.printStackTrace(); -+ return; -+ } -+ -+ try { -+ if (stackableLavaBuckets) { -+ maxStack.set(Material.LAVA_BUCKET, Material.BUCKET.getMaxStackSize()); -+ Items.LAVA_BUCKET.c(Material.BUCKET.getMaxStackSize()); -+ } -+ -+ if (stackableWaterBuckets) { -+ maxStack.set(Material.WATER_BUCKET, Material.BUCKET.getMaxStackSize()); -+ Items.WATER_BUCKET.c(Material.BUCKET.getMaxStackSize()); -+ } -+ -+ if (stackableMilkBuckets) { -+ maxStack.set(Material.MILK_BUCKET, Material.BUCKET.getMaxStackSize()); -+ Items.MILK_BUCKET.c(Material.BUCKET.getMaxStackSize()); -+ } -+ } catch (Exception e) { -+ e.printStackTrace(); -+ } -+ } - } --- -2.6.0 - diff --git a/Spigot-Server-Patches/0046-Add-BeaconEffectEvent.patch b/Spigot-Server-Patches/0046-Add-BeaconEffectEvent.patch new file mode 100644 index 0000000000..1571cee90c --- /dev/null +++ b/Spigot-Server-Patches/0046-Add-BeaconEffectEvent.patch @@ -0,0 +1,77 @@ +From dc65a8bcffb8c2767d4907e60d516b57f401730e Mon Sep 17 00:00:00 2001 +From: Byteflux +Date: Wed, 2 Mar 2016 23:30:53 -0600 +Subject: [PATCH] Add BeaconEffectEvent + + +diff --git a/src/main/java/net/minecraft/server/MobEffectList.java b/src/main/java/net/minecraft/server/MobEffectList.java +index 24ae8e2..a5cbda5 100644 +--- a/src/main/java/net/minecraft/server/MobEffectList.java ++++ b/src/main/java/net/minecraft/server/MobEffectList.java +@@ -17,7 +17,7 @@ public class MobEffectList { + private final Map a = Maps.newHashMap(); + private final boolean c; + private final int d; +- private String e = ""; ++ public String e = ""; // Paper - private -> public + private int f = -1; + public double durationModifier; + private boolean h; +diff --git a/src/main/java/net/minecraft/server/TileEntityBeacon.java b/src/main/java/net/minecraft/server/TileEntityBeacon.java +index ed5b374..6615890 100644 +--- a/src/main/java/net/minecraft/server/TileEntityBeacon.java ++++ b/src/main/java/net/minecraft/server/TileEntityBeacon.java +@@ -13,6 +13,14 @@ import org.bukkit.craftbukkit.entity.CraftHumanEntity; + import org.bukkit.entity.HumanEntity; + // CraftBukkit end + ++// Paper start ++import org.bukkit.craftbukkit.event.CraftEventFactory; ++import org.bukkit.entity.Player; ++import org.bukkit.potion.PotionEffect; ++import org.bukkit.potion.PotionEffectType; ++import com.destroystokyo.paper.event.block.BeaconEffectEvent; ++// Paper end ++ + public class TileEntityBeacon extends TileEntityContainer implements ITickable, IWorldInventory { + + public static final MobEffectList[][] a = new MobEffectList[][] { { MobEffects.FASTER_MOVEMENT, MobEffects.FASTER_DIG}, { MobEffects.RESISTANCE, MobEffects.JUMP}, { MobEffects.INCREASE_DAMAGE}, { MobEffects.REGENERATION}}; +@@ -85,17 +93,33 @@ public class TileEntityBeacon extends TileEntityContainer implements ITickable, + + EntityHuman entityhuman; + ++ // Paper start ++ org.bukkit.block.Block block = world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ()); ++ PotionEffect primaryEffect = new PotionEffect(PotionEffectType.getByName(this.l.e), 180, b0, true, true); ++ // Paper end ++ + while (iterator.hasNext()) { + entityhuman = (EntityHuman) iterator.next(); +- entityhuman.addEffect(new MobEffect(this.l, i, b0, true, true)); ++ // Paper start - BeaconEffectEvent ++ BeaconEffectEvent event = new BeaconEffectEvent(block, primaryEffect, (Player) entityhuman.getBukkitEntity(), true); ++ if (CraftEventFactory.callEvent(event).isCancelled()) continue; ++ PotionEffect effect = event.getEffect(); ++ entityhuman.addEffect(new MobEffect(MobEffectList.fromId(effect.getType().getId()), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles())); ++ // Paper end + } + + if (this.k >= 4 && this.l != this.m && this.m != null) { + iterator = list.iterator(); ++ PotionEffect secondaryEffect = new PotionEffect(PotionEffectType.getByName(this.m.e), 180, 0, true, true); // Paper + + while (iterator.hasNext()) { + entityhuman = (EntityHuman) iterator.next(); +- entityhuman.addEffect(new MobEffect(this.m, i, 0, true, true)); ++ // Paper start - BeaconEffectEvent ++ BeaconEffectEvent event = new BeaconEffectEvent(block, secondaryEffect, (Player) entityhuman.getBukkitEntity(), false); ++ if (CraftEventFactory.callEvent(event).isCancelled()) continue; ++ PotionEffect effect = event.getEffect(); ++ entityhuman.addEffect(new MobEffect(MobEffectList.fromId(effect.getType().getId()), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles())); ++ // Paper end + } + } + } +-- +2.7.2 + diff --git a/Spigot-Server-Patches/0047-Configurable-container-update-tick-rate.patch b/Spigot-Server-Patches/0047-Configurable-container-update-tick-rate.patch new file mode 100644 index 0000000000..4459d769f5 --- /dev/null +++ b/Spigot-Server-Patches/0047-Configurable-container-update-tick-rate.patch @@ -0,0 +1,49 @@ +From d05593f669edf99cc8593a8a1149700bebd1c8b9 Mon Sep 17 00:00:00 2001 +From: Sudzzy +Date: Wed, 2 Mar 2016 23:34:44 -0600 +Subject: [PATCH] Configurable container update tick rate + + +diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index 38d7dfc..6ab8d0e 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -239,4 +239,9 @@ public class PaperWorldConfig { + fixCannons = getBoolean("fix-cannons", false); + log("Fix TNT cannons: " + fixCannons); + } ++ ++ public int containerUpdateTickRate; ++ private void containerUpdateTickRate() { ++ containerUpdateTickRate = getInt("container-update-tick-rate", 1); ++ } + } +diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java +index 8be847d..9e7c607 100644 +--- a/src/main/java/net/minecraft/server/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/EntityPlayer.java +@@ -54,6 +54,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + public int ping; + public boolean viewingCredits; + public int viewDistance; // Paper - Player view distance API ++ private int containerUpdateDelay; // Paper + + // CraftBukkit start + public String displayName; +@@ -215,7 +216,12 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + --this.noDamageTicks; + } + +- this.activeContainer.b(); ++ // Paper start - Configurable container update tick rate ++ if (--containerUpdateDelay <= 0) { ++ this.activeContainer.b(); ++ containerUpdateDelay = world.paperConfig.containerUpdateTickRate; ++ } ++ // Paper end + if (!this.world.isClientSide && !this.activeContainer.a((EntityHuman) this)) { + this.closeInventory(); + this.activeContainer = this.defaultContainer; +-- +2.7.2 + diff --git a/Spigot-Server-Patches/0047-Generator-Settings.patch b/Spigot-Server-Patches/0047-Generator-Settings.patch deleted file mode 100644 index 70c19a11ba..0000000000 --- a/Spigot-Server-Patches/0047-Generator-Settings.patch +++ /dev/null @@ -1,280 +0,0 @@ -From d4c583643d602b2740c1c919eceeb624997b69a2 Mon Sep 17 00:00:00 2001 -From: Byteflux -Date: Tue, 2 Jun 2015 00:41:23 -0700 -Subject: [PATCH] Generator Settings - - -diff --git a/src/main/java/net/minecraft/server/BiomeBase.java b/src/main/java/net/minecraft/server/BiomeBase.java -index b1ae67a..28da136 100644 ---- a/src/main/java/net/minecraft/server/BiomeBase.java -+++ b/src/main/java/net/minecraft/server/BiomeBase.java -@@ -278,7 +278,7 @@ public abstract class BiomeBase { - BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition(); - - for (int l1 = 255; l1 >= 0; --l1) { -- if (l1 <= random.nextInt(5)) { -+ if (l1 <= (world.paperSpigotConfig.generateFlatBedrock ? 0 : random.nextInt(5))) { // PaperSpigot - Configurable flat bedrock - chunksnapshot.a(k1, l1, j1, Blocks.BEDROCK.getBlockData()); - } else { - IBlockData iblockdata2 = chunksnapshot.a(k1, l1, j1); -diff --git a/src/main/java/net/minecraft/server/BiomeMesa.java b/src/main/java/net/minecraft/server/BiomeMesa.java -index fd827f2..65cd706 100644 ---- a/src/main/java/net/minecraft/server/BiomeMesa.java -+++ b/src/main/java/net/minecraft/server/BiomeMesa.java -@@ -94,7 +94,7 @@ public class BiomeMesa extends BiomeBase { - chunksnapshot.a(l, l1, k, Blocks.STONE.getBlockData()); - } - -- if (l1 <= random.nextInt(5)) { -+ if (l1 <= (world.paperSpigotConfig.generateFlatBedrock ? 0 : random.nextInt(5))) { // PaperSpigot - Configurable flat bedrock - chunksnapshot.a(l, l1, k, Blocks.BEDROCK.getBlockData()); - } else { - IBlockData iblockdata2 = chunksnapshot.a(l, l1, k); -diff --git a/src/main/java/net/minecraft/server/ChunkProviderFlat.java b/src/main/java/net/minecraft/server/ChunkProviderFlat.java -index d1e10c6..b939f47 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderFlat.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderFlat.java -@@ -25,7 +25,7 @@ public class ChunkProviderFlat implements IChunkProvider { - if (flag) { - Map map = this.d.b(); - -- if (map.containsKey("village")) { -+ if (map.containsKey("village") && world.paperSpigotConfig.generateVillage) { // PaperSpigot - Map map1 = (Map) map.get("village"); - - if (!map1.containsKey("size")) { -@@ -35,19 +35,19 @@ public class ChunkProviderFlat implements IChunkProvider { - this.e.add(new WorldGenVillage(map1)); - } - -- if (map.containsKey("biome_1")) { -+ if (map.containsKey("biome_1") && world.paperSpigotConfig.generateTemple) { // PaperSpigot - this.e.add(new WorldGenLargeFeature((Map) map.get("biome_1"))); - } - -- if (map.containsKey("mineshaft")) { -+ if (map.containsKey("mineshaft") && world.paperSpigotConfig.generateMineshaft) { // PaperSpigot - this.e.add(new WorldGenMineshaft((Map) map.get("mineshaft"))); - } - -- if (map.containsKey("stronghold")) { -+ if (map.containsKey("stronghold") && world.paperSpigotConfig.generateStronghold) { // PaperSpigot - this.e.add(new WorldGenStronghold((Map) map.get("stronghold"))); - } - -- if (map.containsKey("oceanmonument")) { -+ if (map.containsKey("oceanmonument") && world.paperSpigotConfig.generateMonument) { // PaperSpigot - this.e.add(new WorldGenMonument((Map) map.get("oceanmonument"))); - } - } -@@ -60,7 +60,7 @@ public class ChunkProviderFlat implements IChunkProvider { - this.i = new WorldGenLakes(Blocks.LAVA); - } - -- this.g = this.d.b().containsKey("dungeon"); -+ this.g = world.paperSpigotConfig.generateDungeon && this.d.b().containsKey("dungeon"); // PaperSpigot - int j = 0; - int k = 0; - boolean flag1 = true; -diff --git a/src/main/java/net/minecraft/server/ChunkProviderGenerate.java b/src/main/java/net/minecraft/server/ChunkProviderGenerate.java -index e0be3c1..ad464d3 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderGenerate.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderGenerate.java -@@ -156,31 +156,31 @@ public class ChunkProviderGenerate implements IChunkProvider { - this.a(i, j, chunksnapshot); - this.B = this.m.getWorldChunkManager().getBiomeBlock(this.B, i * 16, j * 16, 16, 16); - this.a(i, j, chunksnapshot, this.B); -- if (this.r.r) { -+ if (this.r.r && this.m.paperSpigotConfig.generateCaves) { // PaperSpigot - this.u.a(this, this.m, i, j, chunksnapshot); - } - -- if (this.r.z) { -+ if (this.r.z && this.m.paperSpigotConfig.generateCanyon) { // PaperSpigot - this.z.a(this, this.m, i, j, chunksnapshot); - } - -- if (this.r.w && this.n) { -+ if (this.r.w && this.n && this.m.paperSpigotConfig.generateMineshaft) { // PaperSpigot - this.x.a(this, this.m, i, j, chunksnapshot); - } - -- if (this.r.v && this.n) { -+ if (this.r.v && this.n && this.m.paperSpigotConfig.generateVillage) { // PaperSpigot - this.w.a(this, this.m, i, j, chunksnapshot); - } - -- if (this.r.u && this.n) { -+ if (this.r.u && this.n && this.m.paperSpigotConfig.generateStronghold) { // PaperSpigot - this.v.a(this, this.m, i, j, chunksnapshot); - } - -- if (this.r.x && this.n) { -+ if (this.r.x && this.n && this.m.paperSpigotConfig.generateTemple) { // PaperSpigot - this.y.a(this, this.m, i, j, chunksnapshot); - } - -- if (this.r.y && this.n) { -+ if (this.r.y && this.n && this.m.paperSpigotConfig.generateMonument) { // PaperSpigot - this.A.a(this, this.m, i, j, chunksnapshot); - } - -@@ -319,23 +319,23 @@ public class ChunkProviderGenerate implements IChunkProvider { - boolean flag = false; - ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i, j); - -- if (this.r.w && this.n) { -+ if (this.r.w && this.n && this.m.paperSpigotConfig.generateMineshaft) { // PaperSpigot - this.x.a(this.m, this.h, chunkcoordintpair); - } - -- if (this.r.v && this.n) { -+ if (this.r.v && this.n && this.m.paperSpigotConfig.generateVillage) { // PaperSpigot - flag = this.w.a(this.m, this.h, chunkcoordintpair); - } - -- if (this.r.u && this.n) { -+ if (this.r.u && this.n && this.m.paperSpigotConfig.generateStronghold) { // PaperSpigot - this.v.a(this.m, this.h, chunkcoordintpair); - } - -- if (this.r.x && this.n) { -+ if (this.r.x && this.n && this.m.paperSpigotConfig.generateTemple) { // PaperSpigot - this.y.a(this.m, this.h, chunkcoordintpair); - } - -- if (this.r.y && this.n) { -+ if (this.r.y && this.n && this.m.paperSpigotConfig.generateMonument) { // PaperSpigot - this.A.a(this.m, this.h, chunkcoordintpair); - } - -@@ -359,7 +359,7 @@ public class ChunkProviderGenerate implements IChunkProvider { - } - } - -- if (this.r.s) { -+ if (this.r.s && this.m.paperSpigotConfig.generateDungeon) { // PaperSpigot - for (k1 = 0; k1 < this.r.t; ++k1) { - l1 = this.h.nextInt(16) + 8; - i2 = this.h.nextInt(256); -@@ -444,23 +444,23 @@ public class ChunkProviderGenerate implements IChunkProvider { - } - - public void recreateStructures(Chunk chunk, int i, int j) { -- if (this.r.w && this.n) { -+ if (this.r.w && this.n && this.m.paperSpigotConfig.generateMineshaft) { // PaperSpigot - this.x.a(this, this.m, i, j, (ChunkSnapshot) null); - } - -- if (this.r.v && this.n) { -+ if (this.r.v && this.n && this.m.paperSpigotConfig.generateVillage) { // PaperSpigot - this.w.a(this, this.m, i, j, (ChunkSnapshot) null); - } - -- if (this.r.u && this.n) { -+ if (this.r.u && this.n && this.m.paperSpigotConfig.generateStronghold) { // PaperSpigot - this.v.a(this, this.m, i, j, (ChunkSnapshot) null); - } - -- if (this.r.x && this.n) { -+ if (this.r.x && this.n && this.m.paperSpigotConfig.generateTemple) { // PaperSpigot - this.y.a(this, this.m, i, j, (ChunkSnapshot) null); - } - -- if (this.r.y && this.n) { -+ if (this.r.y && this.n && this.m.paperSpigotConfig.generateMonument) { // PaperSpigot - this.A.a(this, this.m, i, j, (ChunkSnapshot) null); - } - -diff --git a/src/main/java/net/minecraft/server/ChunkProviderHell.java b/src/main/java/net/minecraft/server/ChunkProviderHell.java -index 2f01bbf..0156892 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderHell.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderHell.java -@@ -142,7 +142,10 @@ public class ChunkProviderHell implements IChunkProvider { - IBlockData iblockdata1 = Blocks.NETHERRACK.getBlockData(); - - for (int l1 = 127; l1 >= 0; --l1) { -- if (l1 < 127 - this.j.nextInt(5) && l1 > this.j.nextInt(5)) { -+ // PaperSpigot start - Configurable flat bedrock worldgen -+ if (l1 < 127 - (h.paperSpigotConfig.generateFlatBedrock ? 0 : this.j.nextInt(5)) && -+ l1 > (h.paperSpigotConfig.generateFlatBedrock ? 0 : this.j.nextInt(5))) { -+ // PaperSpigot end - IBlockData iblockdata2 = chunksnapshot.a(i1, l1, l); - - if (iblockdata2.getBlock() != null && iblockdata2.getBlock().getMaterial() != Material.AIR) { -@@ -198,8 +201,8 @@ public class ChunkProviderHell implements IChunkProvider { - - this.a(i, j, chunksnapshot); - this.b(i, j, chunksnapshot); -- this.C.a(this, this.h, i, j, chunksnapshot); -- if (this.i) { -+ if (this.h.paperSpigotConfig.generateCaves) this.C.a(this, this.h, i, j, chunksnapshot); // PaperSpigot -+ if (this.i && this.h.paperSpigotConfig.generateFortress) { // PaperSpigot - this.B.a(this, this.h, i, j, chunksnapshot); - } - -@@ -384,7 +387,7 @@ public class ChunkProviderHell implements IChunkProvider { - } - - public void recreateStructures(Chunk chunk, int i, int j) { -- this.B.a(this, this.h, i, j, (ChunkSnapshot) null); -+ if (this.h.paperSpigotConfig.generateFortress) this.B.a(this, this.h, i, j, (ChunkSnapshot) null); // PaperSpigot - } - - public Chunk getChunkAt(BlockPosition blockposition) { -diff --git a/src/main/java/net/minecraft/server/StructureGenerator.java b/src/main/java/net/minecraft/server/StructureGenerator.java -index 0f8211a..e76acfc 100644 ---- a/src/main/java/net/minecraft/server/StructureGenerator.java -+++ b/src/main/java/net/minecraft/server/StructureGenerator.java -@@ -88,6 +88,7 @@ public abstract class StructureGenerator extends WorldGenBase { - } - - public boolean b(BlockPosition blockposition) { -+ if (this.c == null) return false; // PaperSpigot - this.a(this.c); - return this.c(blockposition) != null; - } -@@ -115,6 +116,7 @@ public abstract class StructureGenerator extends WorldGenBase { - } - - public boolean a(World world, BlockPosition blockposition) { -+ if (this.c == null) return false; // PaperSpigot - this.a(world); - Iterator iterator = this.e.values().iterator(); - -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index 65e0f12..cffb5f0 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -237,4 +237,28 @@ public class PaperSpigotWorldConfig - loadUnloadedTNTEntities = getBoolean( "load-chunks.tnt-entities", false ); - loadUnloadedFallingBlocks = getBoolean( "load-chunks.falling-blocks", false ); - } -+ -+ public boolean generateCanyon; -+ public boolean generateCaves; -+ public boolean generateDungeon; -+ public boolean generateFortress; -+ public boolean generateMineshaft; -+ public boolean generateMonument; -+ public boolean generateStronghold; -+ public boolean generateTemple; -+ public boolean generateVillage; -+ public boolean generateFlatBedrock; -+ private void generatorSettings() -+ { -+ generateCanyon = getBoolean( "generator-settings.canyon", true ); -+ generateCaves = getBoolean( "generator-settings.caves", true ); -+ generateDungeon = getBoolean( "generator-settings.dungeon", true ); -+ generateFortress = getBoolean( "generator-settings.fortress", true ); -+ generateMineshaft = getBoolean( "generator-settings.mineshaft", true ); -+ generateMonument = getBoolean( "generator-settings.monument", true ); -+ generateStronghold = getBoolean( "generator-settings.stronghold", true ); -+ generateTemple = getBoolean( "generator-settings.temple", true ); -+ generateVillage = getBoolean( "generator-settings.village", true ); -+ generateFlatBedrock = getBoolean( "generator-settings.flat-bedrock", false ); -+ } - } --- -2.7.0 - diff --git a/Spigot-Server-Patches/0067-Fix-lava-water-some-times-creating-air-instead-of-co.patch b/Spigot-Server-Patches/0048-Fix-lava-water-some-times-creating-air-instead-of-co.patch similarity index 71% rename from Spigot-Server-Patches/0067-Fix-lava-water-some-times-creating-air-instead-of-co.patch rename to Spigot-Server-Patches/0048-Fix-lava-water-some-times-creating-air-instead-of-co.patch index 485355ad50..48b4306aee 100644 --- a/Spigot-Server-Patches/0067-Fix-lava-water-some-times-creating-air-instead-of-co.patch +++ b/Spigot-Server-Patches/0048-Fix-lava-water-some-times-creating-air-instead-of-co.patch @@ -1,22 +1,22 @@ -From 7a75bfc6005068781daff4e13863ad30ed28a60f Mon Sep 17 00:00:00 2001 +From c27f4a49443bdcc97e65def804bf401ce75d5612 Mon Sep 17 00:00:00 2001 From: Iceee -Date: Tue, 4 Aug 2015 18:15:05 -0700 +Date: Wed, 2 Mar 2016 23:38:52 -0600 Subject: [PATCH] Fix lava/water some times creating air instead of cobblestone diff --git a/src/main/java/net/minecraft/server/BlockFluids.java b/src/main/java/net/minecraft/server/BlockFluids.java -index b610450..db73f5d 100644 +index 675cdc0..8c23ce3 100644 --- a/src/main/java/net/minecraft/server/BlockFluids.java +++ b/src/main/java/net/minecraft/server/BlockFluids.java -@@ -154,7 +154,7 @@ public abstract class BlockFluids extends Block { +@@ -166,7 +166,7 @@ public abstract class BlockFluids extends Block { return true; } - if (integer.intValue() <= 4) { -+ if (integer.intValue() > 0) { // PaperSpigot ++ if (integer.intValue() > 0) { // Paper world.setTypeUpdate(blockposition, Blocks.COBBLESTONE.getBlockData()); this.fizz(world, blockposition); return true; -- -2.5.2 +2.7.2 diff --git a/Spigot-Server-Patches/0049-FallingBlock-and-TNT-entities-collide-with-specific-.patch b/Spigot-Server-Patches/0049-FallingBlock-and-TNT-entities-collide-with-specific-.patch deleted file mode 100644 index e5eb36fe05..0000000000 --- a/Spigot-Server-Patches/0049-FallingBlock-and-TNT-entities-collide-with-specific-.patch +++ /dev/null @@ -1,45 +0,0 @@ -From b492b9f378575d22dba8aa0c1766c5c1b06133b4 Mon Sep 17 00:00:00 2001 -From: Byteflux -Date: Fri, 5 Jun 2015 00:43:17 -0700 -Subject: [PATCH] FallingBlock and TNT entities collide with specific blocks - - -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index d2cb1f1..7660356 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -1207,7 +1207,15 @@ public abstract class World implements IBlockAccess { - } - if ( block != null ) - { -- block.getBlock().a(this, blockposition, block, axisalignedbb, arraylist, entity); -+ // PaperSpigot start - FallingBlocks and TNT collide with specific non-collidable blocks -+ Block b = block.getBlock(); -+ if (entity.world.paperSpigotConfig.fallingBlocksCollideWithSigns && (entity instanceof EntityTNTPrimed || entity instanceof EntityFallingBlock) && (b instanceof BlockSign || b instanceof BlockFenceGate || b instanceof BlockTorch || b instanceof BlockButtonAbstract || b instanceof BlockLever || b instanceof BlockTripwireHook || b instanceof BlockTripwire || b instanceof BlockChest || b instanceof BlockSlowSand || b instanceof BlockBed || b instanceof BlockEnderChest || b instanceof BlockEnchantmentTable || b instanceof BlockBrewingStand)) { -+ AxisAlignedBB aabb = AxisAlignedBB.a(x, y, z, x + 1.0, y + 1.0, z + 1.0); -+ if (axisalignedbb.b(aabb)) arraylist.add(aabb); -+ } else { -+ b.a(this, blockposition, block, axisalignedbb, arraylist, entity); -+ } -+ // PaperSpigot end - } - } - } -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index 180158b..ef59074 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -300,4 +300,10 @@ public class PaperSpigotWorldConfig - fixCannons = getBoolean( "fix-cannons", false ); - log( "Fix TNT cannons: " + fixCannons ); - } -+ -+ public boolean fallingBlocksCollideWithSigns; -+ private void fallingBlocksCollideWithSigns() -+ { -+ fallingBlocksCollideWithSigns = getBoolean( "falling-blocks-collide-with-signs", false ); -+ } - } --- -2.7.0 - diff --git a/Spigot-Server-Patches/0068-Use-UserCache-for-player-heads.patch b/Spigot-Server-Patches/0049-Use-UserCache-for-player-heads.patch similarity index 56% rename from Spigot-Server-Patches/0068-Use-UserCache-for-player-heads.patch rename to Spigot-Server-Patches/0049-Use-UserCache-for-player-heads.patch index ac71a19c91..1362c5c4ca 100644 --- a/Spigot-Server-Patches/0068-Use-UserCache-for-player-heads.patch +++ b/Spigot-Server-Patches/0049-Use-UserCache-for-player-heads.patch @@ -1,37 +1,36 @@ -From eb37d0158909779aa56c6a6c67ec300a80b07796 Mon Sep 17 00:00:00 2001 +From aff65cb72004775ae5ed89ad16d4a761481aa23f Mon Sep 17 00:00:00 2001 From: Techcable -Date: Fri, 7 Aug 2015 19:31:31 -0700 +Date: Wed, 2 Mar 2016 23:42:37 -0600 Subject: [PATCH] Use UserCache for player heads diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java -index ce5425f..25e32a0 100644 +index 2abca0c..7d83bbe 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java -@@ -6,6 +6,11 @@ import net.minecraft.server.GameProfileSerializer; - import net.minecraft.server.NBTBase; - import net.minecraft.server.NBTTagCompound; +@@ -2,9 +2,7 @@ package org.bukkit.craftbukkit.inventory; + + import java.util.Map; + +-import net.minecraft.server.GameProfileSerializer; +-import net.minecraft.server.NBTBase; +-import net.minecraft.server.NBTTagCompound; ++import net.minecraft.server.*; -+// PaperSpigot start -+import net.minecraft.server.EntityPlayer; -+import net.minecraft.server.MinecraftServer; -+// PaperSpigot end -+ import org.bukkit.Material; import org.bukkit.configuration.serialization.DelegateDeserialization; - import org.bukkit.craftbukkit.inventory.CraftMetaItem.SerializableMeta; -@@ -132,7 +137,10 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta { +@@ -132,7 +130,10 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta { if (name == null) { profile = null; } else { - profile = new GameProfile(null, name); -+ // PaperSpigot start - Check usercache if the player is online ++ // Paper start - Check usercache if the player is online + EntityPlayer player = MinecraftServer.getServer().getPlayerList().getPlayer(name); + profile = player != null ? player.getProfile() : new GameProfile(null, name); -+ // PaperSpigot end ++ // Paper end } return true; -- -2.5.2 +2.7.2 diff --git a/Spigot-Server-Patches/0070-Disable-spigot-tick-limiters.patch b/Spigot-Server-Patches/0050-Disable-spigot-tick-limiters.patch similarity index 68% rename from Spigot-Server-Patches/0070-Disable-spigot-tick-limiters.patch rename to Spigot-Server-Patches/0050-Disable-spigot-tick-limiters.patch index 713ea431d9..3ac6d31267 100644 --- a/Spigot-Server-Patches/0070-Disable-spigot-tick-limiters.patch +++ b/Spigot-Server-Patches/0050-Disable-spigot-tick-limiters.patch @@ -1,14 +1,14 @@ -From 8caf8aefb286bf37fa35d968607d09dc5d5691dc Mon Sep 17 00:00:00 2001 +From ee0074f3f7228f1a8975526964f30bfc917ddd2b Mon Sep 17 00:00:00 2001 From: Zach Brown -Date: Sat, 24 Oct 2015 01:16:22 -0500 +Date: Wed, 2 Mar 2016 23:45:17 -0600 Subject: [PATCH] Disable spigot tick limiters diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 08041af..13ab789 100644 +index 8925c67..6e021c6 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -1419,10 +1419,10 @@ public abstract class World implements IBlockAccess { +@@ -1380,10 +1380,10 @@ public abstract class World implements IBlockAccess { guardEntityList = true; // Spigot // CraftBukkit start - Use field for loop variable int entitiesThisCycle = 0; @@ -16,24 +16,24 @@ index 08041af..13ab789 100644 - for (entityLimiter.initTick(); - entitiesThisCycle < entityList.size() && (entitiesThisCycle % 10 != 0 || entityLimiter.shouldContinue()); - tickPosition++, entitiesThisCycle++) { -+ // PaperSpigot start - Disable tick limiters ++ // Paper start - Disable tick limiters + //if (tickPosition < 0) tickPosition = 0; + for (tickPosition = 0; tickPosition < entityList.size(); tickPosition++) { -+ // PaperSpigot end ++ // Paper end tickPosition = (tickPosition < entityList.size()) ? tickPosition : 0; entity = (Entity) this.entityList.get(this.tickPosition); // CraftBukkit end -@@ -1485,9 +1485,7 @@ public abstract class World implements IBlockAccess { - +@@ -1448,9 +1448,7 @@ public abstract class World implements IBlockAccess { // Spigot start + // Iterator iterator = this.tileEntityListTick.iterator(); int tilesThisCycle = 0; - for (tileLimiter.initTick(); -- tilesThisCycle < tileEntityList.size() && (tilesThisCycle % 10 != 0 || tileLimiter.shouldContinue()); +- tilesThisCycle < tileEntityListTick.size() && (tilesThisCycle % 10 != 0 || tileLimiter.shouldContinue()); - tileTickPosition++, tilesThisCycle++) { -+ for (tileTickPosition = 0; tileTickPosition < tileEntityList.size(); tileTickPosition++) { // PaperSpigot - Disable tick limiters - tileTickPosition = (tileTickPosition < tileEntityList.size()) ? tileTickPosition : 0; - TileEntity tileentity = (TileEntity) this.tileEntityList.get(tileTickPosition); ++ for (tileTickPosition = 0; tileTickPosition < tileEntityListTick.size(); tileTickPosition++) { // Paper - Disable tick limiters + tileTickPosition = (tileTickPosition < tileEntityListTick.size()) ? tileTickPosition : 0; + TileEntity tileentity = (TileEntity) this.tileEntityListTick.get(tileTickPosition); // Spigot start -- -2.6.2 +2.7.2 diff --git a/Spigot-Server-Patches/0072-Bump-thread-count-for-chunk-loading.patch b/Spigot-Server-Patches/0051-Bump-thread-count-for-chunk-loading.patch similarity index 76% rename from Spigot-Server-Patches/0072-Bump-thread-count-for-chunk-loading.patch rename to Spigot-Server-Patches/0051-Bump-thread-count-for-chunk-loading.patch index c3abe4d6ad..065347b3e4 100644 --- a/Spigot-Server-Patches/0072-Bump-thread-count-for-chunk-loading.patch +++ b/Spigot-Server-Patches/0051-Bump-thread-count-for-chunk-loading.patch @@ -1,11 +1,11 @@ -From c128310e73948cd22b1912eff4f5fc234427a681 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sun, 15 Nov 2015 19:36:37 -0600 +From 07e14ab88a3b94f74a84552027c7398ac76de9ca Mon Sep 17 00:00:00 2001 +From: Zach Brown +Date: Wed, 2 Mar 2016 23:46:57 -0600 Subject: [PATCH] Bump thread count for chunk loading diff --git a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOExecutor.java b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOExecutor.java -index e4fd9bc..69e5da4 100644 +index e4fd9bc..729641e 100644 --- a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOExecutor.java +++ b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOExecutor.java @@ -7,7 +7,7 @@ import net.minecraft.server.World; @@ -13,10 +13,10 @@ index e4fd9bc..69e5da4 100644 public class ChunkIOExecutor { - static final int BASE_THREADS = 1; -+ static final int BASE_THREADS = 2; // PaperSpigot - Bumped value ++ static final int BASE_THREADS = 2; // Paper - Bumped value static final int PLAYERS_PER_THREAD = 50; private static final AsynchronousExecutor instance = new AsynchronousExecutor(new ChunkIOProvider(), BASE_THREADS); -- -2.6.3 +2.7.2 diff --git a/Spigot-Server-Patches/0073-Don-t-create-Region-File-s-when-checking-if-chunk-ex.patch b/Spigot-Server-Patches/0052-Don-t-create-Region-File-s-when-checking-if-chunk-ex.patch similarity index 73% rename from Spigot-Server-Patches/0073-Don-t-create-Region-File-s-when-checking-if-chunk-ex.patch rename to Spigot-Server-Patches/0052-Don-t-create-Region-File-s-when-checking-if-chunk-ex.patch index 6cd9524cd0..d83eb43d13 100644 --- a/Spigot-Server-Patches/0073-Don-t-create-Region-File-s-when-checking-if-chunk-ex.patch +++ b/Spigot-Server-Patches/0052-Don-t-create-Region-File-s-when-checking-if-chunk-ex.patch @@ -1,50 +1,53 @@ -From 4110f43983a26695d465396b2a0d5af28b47f9c7 Mon Sep 17 00:00:00 2001 +From 4cd757e040deffa801cd18a673ab0960313e001a Mon Sep 17 00:00:00 2001 From: Aikar -Date: Tue, 3 Nov 2015 21:05:41 -0500 +Date: Wed, 2 Mar 2016 23:51:51 -0600 Subject: [PATCH] Don't create Region File's when checking if chunk exists -Plugins like Dynap can end up creating tons of emtpy Region Files +Plugins like Dynmap can end up creating tons of emtpy Region Files when using chunkExists. diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index 206e3aa..6b24490 100644 +index 53b5296..5bd6ce0 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -@@ -36,7 +36,8 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { +@@ -38,7 +38,10 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver { } } - return RegionFileCache.a(this.d, i, j).chunkExists(i & 31, j & 31); -+ final RegionFile region = RegionFileCache.a(this.d, i, j, false); // PaperSpigot -+ return region != null && region.chunkExists(i & 31, j & 31); // PaperSpigot ++ // Paper start - Don't create region files when checking that they exist ++ final RegionFile region = RegionFileCache.a(this.d, i, j, false); ++ return region != null && region.chunkExists(i & 31, j & 31); ++ // Paper end } // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java -index 5528019..5b000c4 100644 +index 5528019..01a08d4 100644 --- a/src/main/java/net/minecraft/server/RegionFileCache.java +++ b/src/main/java/net/minecraft/server/RegionFileCache.java -@@ -12,7 +12,12 @@ public class RegionFileCache { +@@ -12,7 +12,13 @@ public class RegionFileCache { public static final Map a = Maps.newHashMap(); // Spigot - private -> public -+ // PaperSpigot start ++ // Paper start public static synchronized RegionFile a(File file, int i, int j) { + return a(file, i, j, true); + } ++ + public static synchronized RegionFile a(File file, int i, int j, boolean create) { -+ // PaperSpigot end ++ // Paper end File file1 = new File(file, "region"); File file2 = new File(file1, "r." + (i >> 5) + "." + (j >> 5) + ".mca"); RegionFile regionfile = (RegionFile) RegionFileCache.a.get(file2); -@@ -20,6 +25,7 @@ public class RegionFileCache { +@@ -20,6 +26,7 @@ public class RegionFileCache { if (regionfile != null) { return regionfile; } else { -+ if (!create && !file2.exists()) { return null; } // PaperSpigot ++ if (!create && !file2.exists()) { return null; } // Paper if (!file1.exists()) { file1.mkdirs(); } -- -2.6.3 +2.7.2 diff --git a/Spigot-Server-Patches/0053-Configurable-lava-flow-speed.patch b/Spigot-Server-Patches/0053-Configurable-lava-flow-speed.patch deleted file mode 100644 index 5a3acc5732..0000000000 --- a/Spigot-Server-Patches/0053-Configurable-lava-flow-speed.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 70a6bd60d4c817a5d2420fdefcc6ad1d4afe869a Mon Sep 17 00:00:00 2001 -From: Byteflux -Date: Wed, 1 Jul 2015 00:38:10 -0700 -Subject: [PATCH] Configurable lava flow speed - - -diff --git a/src/main/java/net/minecraft/server/BlockFlowing.java b/src/main/java/net/minecraft/server/BlockFlowing.java -index fc3fc48..23130ba 100644 ---- a/src/main/java/net/minecraft/server/BlockFlowing.java -+++ b/src/main/java/net/minecraft/server/BlockFlowing.java -@@ -276,6 +276,9 @@ public class BlockFlowing extends BlockFluids { - * PaperSpigot - Get flow speed. Throttle if its water and flowing adjacent to lava - */ - public int getFlowSpeed(World world, BlockPosition blockposition) { -+ if (this.getMaterial() == Material.LAVA) { -+ return world.worldProvider.o() ? world.paperSpigotConfig.lavaFlowSpeedNether : world.paperSpigotConfig.lavaFlowSpeedNormal; -+ } - if (this.getMaterial() == Material.WATER && ( - world.getType(blockposition.north(1)).getBlock().getMaterial() == Material.LAVA || - world.getType(blockposition.south(1)).getBlock().getMaterial() == Material.LAVA || -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index 56c8433..349f77a 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -320,4 +320,12 @@ public class PaperSpigotWorldConfig - fastDrainLava = getBoolean( "fast-drain.lava", false ); - fastDrainWater = getBoolean( "fast-drain.water", false ); - } -+ -+ public int lavaFlowSpeedNormal; -+ public int lavaFlowSpeedNether; -+ private void lavaFlowSpeed() -+ { -+ lavaFlowSpeedNormal = getInt( "lava-flow-speed.normal", 30 ); -+ lavaFlowSpeedNether = getInt( "lava-flow-speed.nether", 10 ); -+ } - } --- -2.7.0 - diff --git a/Spigot-Server-Patches/0074-Don-t-create-a-chunk-just-to-unload-it.patch b/Spigot-Server-Patches/0053-Don-t-create-a-chunk-just-to-unload-it.patch similarity index 55% rename from Spigot-Server-Patches/0074-Don-t-create-a-chunk-just-to-unload-it.patch rename to Spigot-Server-Patches/0053-Don-t-create-a-chunk-just-to-unload-it.patch index 24c52de60a..a3be6cff13 100644 --- a/Spigot-Server-Patches/0074-Don-t-create-a-chunk-just-to-unload-it.patch +++ b/Spigot-Server-Patches/0053-Don-t-create-a-chunk-just-to-unload-it.patch @@ -1,27 +1,27 @@ -From 97ec86b24834b3e21c8a76022f31964f3befdb7f Mon Sep 17 00:00:00 2001 +From b78df4d225b0a403b0359704388c686283d4983e Mon Sep 17 00:00:00 2001 From: Aikar -Date: Sun, 15 Nov 2015 19:46:07 -0600 +Date: Wed, 2 Mar 2016 23:55:20 -0600 Subject: [PATCH] Don't create a chunk just to unload it diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index c15a0ba..72c0b17 100644 +index 24ecfae..68b4c6c 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -201,7 +201,12 @@ public class CraftWorld implements World { +@@ -202,7 +202,12 @@ public class CraftWorld implements World { return false; } -- net.minecraft.server.Chunk chunk = world.chunkProviderServer.getOrCreateChunk(x, z); -+ net.minecraft.server.Chunk chunk = world.chunkProviderServer.getChunkIfLoaded(x, z); -+ // PaperSpigot start - Don't create a chunk just to unload it +- net.minecraft.server.Chunk chunk = world.getChunkProviderServer().getChunkAt(x, z); ++ // Paper start - Don't create a chunk just to unload it ++ net.minecraft.server.Chunk chunk = world.getChunkProviderServer().getChunkIfLoaded(x, z); + if (chunk == null) { + return false; + } -+ // PaperSpigot end ++ // Paper end if (chunk.mustSave) { // If chunk had previously been queued to save, must do save to avoid loss of that data save = true; } -- -2.6.3 +2.7.2 diff --git a/Spigot-Server-Patches/0054-Add-player-view-distance-API.patch b/Spigot-Server-Patches/0054-Add-player-view-distance-API.patch deleted file mode 100644 index 662e22e343..0000000000 --- a/Spigot-Server-Patches/0054-Add-player-view-distance-API.patch +++ /dev/null @@ -1,139 +0,0 @@ -From b4ecfa2c2bc253d8f2f91efab37cffd7c2f7d9a0 Mon Sep 17 00:00:00 2001 -From: Byteflux -Date: Wed, 1 Jul 2015 00:59:06 -0700 -Subject: [PATCH] Add player view distance API - - -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 161b191..3e4869b 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -64,6 +64,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - // CraftBukkit end - // Spigot start - public boolean collidesWithEntities = true; -+ public int viewDistance; // PaperSpigot - Player view distance API - - @Override - public boolean ad() -@@ -80,6 +81,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - - public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) { - super(worldserver, gameprofile); -+ this.viewDistance = world.spigotConfig.viewDistance; // PaperSpigot - Player view distance API - playerinteractmanager.player = this; - this.playerInteractManager = playerinteractmanager; - BlockPosition blockposition = worldserver.getSpawn(); -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index abb24c8..38586aa 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -129,8 +129,10 @@ public class PlayerChunkMap { - // CraftBukkit start - Load nearby chunks first - List chunkList = new LinkedList(); - -- for (int k = i - this.g; k <= i + this.g; ++k) { -- for (int l = j - this.g; l <= j + this.g; ++l) { -+ // PaperSpigot start - Player view distance API -+ for (int k = i - entityplayer.viewDistance; k <= i + entityplayer.viewDistance; ++k) { -+ for (int l = j - entityplayer.viewDistance; l <= j + entityplayer.viewDistance; ++l) { -+ // PaperSpigot end - chunkList.add(new ChunkCoordIntPair(k, l)); - } - } -@@ -148,7 +150,7 @@ public class PlayerChunkMap { - public void b(EntityPlayer entityplayer) { - ArrayList arraylist = Lists.newArrayList(entityplayer.chunkCoordIntPairQueue); - int i = 0; -- int j = this.g; -+ int j = entityplayer.viewDistance; // PaperSpigot - Player view distance API - int k = (int) entityplayer.locX >> 4; - int l = (int) entityplayer.locZ >> 4; - int i1 = 0; -@@ -194,8 +196,10 @@ public class PlayerChunkMap { - int i = (int) entityplayer.d >> 4; - int j = (int) entityplayer.e >> 4; - -- for (int k = i - this.g; k <= i + this.g; ++k) { -- for (int l = j - this.g; l <= j + this.g; ++l) { -+ // PaperSpigot start - Player view distance API -+ for (int k = i - entityplayer.viewDistance; k <= i + entityplayer.viewDistance; ++k) { -+ for (int l = j - entityplayer.viewDistance; l <= j + entityplayer.viewDistance; ++l) { -+ // PaperSpigot end - PlayerChunkMap.PlayerChunk playerchunkmap_playerchunk = this.a(k, l, false); - - if (playerchunkmap_playerchunk != null) { -@@ -224,7 +228,7 @@ public class PlayerChunkMap { - if (d2 >= 64.0D) { - int k = (int) entityplayer.d >> 4; - int l = (int) entityplayer.e >> 4; -- int i1 = this.g; -+ int i1 = entityplayer.viewDistance; // PaperSpigot - Player view distance API - int j1 = i - k; - int k1 = j - l; - List chunksToLoad = new LinkedList(); // CraftBukkit -@@ -309,6 +313,38 @@ public class PlayerChunkMap { - } - } - -+ // PaperSpigot start - Player view distance API -+ public void updateViewDistance(EntityPlayer player, int viewDistance) { -+ viewDistance = MathHelper.clamp(viewDistance, 3, 32); -+ if (viewDistance != player.viewDistance) { -+ int cx = (int) player.locX >> 4; -+ int cz = (int) player.locZ >> 4; -+ -+ if (viewDistance - player.viewDistance > 0) { -+ for (int x = cx - viewDistance; x <= cx + viewDistance; ++x) { -+ for (int z = cz - viewDistance; z <= cz + viewDistance; ++z) { -+ PlayerChunkMap.PlayerChunk playerchunkmap_playerchunk = this.a(x, z, true); -+ -+ if (!playerchunkmap_playerchunk.b.contains(player)) { -+ playerchunkmap_playerchunk.a(player); -+ } -+ } -+ } -+ } else { -+ for (int x = cx - player.viewDistance; x <= cx + player.viewDistance; ++x) { -+ for (int z = cz - player.viewDistance; z <= cz + player.viewDistance; ++z) { -+ if (!this.a(x, z, cx, cz, viewDistance)) { -+ this.a(x, z, true).b(player); -+ } -+ } -+ } -+ } -+ -+ player.viewDistance = viewDistance; -+ } -+ } -+ // PaperSpigot end -+ - public static int getFurthestViewableBlock(int i) { - return i * 16 - 16; - } -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 506a03c..e318072 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1484,6 +1484,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - getHandle().affectsSpawning = affects; - } - // PaperSpigot end -+ -+ // PaperSpigot start - Player view distance API -+ @Override -+ public int getViewDistance() { -+ return getHandle().viewDistance; -+ } -+ -+ @Override -+ public void setViewDistance(int viewDistance) { -+ ((WorldServer) getHandle().world).getPlayerChunkMap().updateViewDistance(getHandle(), viewDistance); -+ } -+ // PaperSpigot end - }; - - public Player.Spigot spigot() --- -2.5.2 - diff --git a/Spigot-Server-Patches/0054-Don-t-sleep-between-chunk-saves.patch b/Spigot-Server-Patches/0054-Don-t-sleep-between-chunk-saves.patch new file mode 100644 index 0000000000..03d39edfc1 --- /dev/null +++ b/Spigot-Server-Patches/0054-Don-t-sleep-between-chunk-saves.patch @@ -0,0 +1,41 @@ +From fb3e3db9d19ad2ba0f09063e00af66182e2b7134 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Wed, 2 Mar 2016 23:58:29 -0600 +Subject: [PATCH] Don't sleep between chunk saves + +For some unknown reason, Minecraft is sleeping 10ms between every single chunk being saved to disk. +Under high chunk load/unload activity (lots of movement / teleporting), this causes the chunk unload queue +to build up in size. + +This has multiple impacts: +1) Performance of the unload queue itself - The save thread is pretty ineffecient for how it accesses it + By letting the queue get larger, checking and popping work off the queue can get less performant. +2) Performance of chunk loading - As with #1, chunk loads also have to check this queue when loading + chunk data so that it doesn't load stale data if new data is pending write to disk. +3) Memory Usage - The entire chunk has been serialized to NBT, and now sits in this queue. This leads to + elevated memory usage, and then the objects used in the serialization sit around longer than needed, + resulting in promotion to Old Generation instead of dying young. + +If there is work to do, then the thread should be doing its work, and only sleep when it is done. + +diff --git a/src/main/java/net/minecraft/server/FileIOThread.java b/src/main/java/net/minecraft/server/FileIOThread.java +index 198b00f..07072ba 100644 +--- a/src/main/java/net/minecraft/server/FileIOThread.java ++++ b/src/main/java/net/minecraft/server/FileIOThread.java +@@ -39,11 +39,12 @@ public class FileIOThread implements Runnable { + ++this.d; + } + ++ /* // Paper start - don't sleep in between chunks so we unload faster. + try { + Thread.sleep(this.e ? 0L : 10L); + } catch (InterruptedException interruptedexception) { + interruptedexception.printStackTrace(); +- } ++ } */ // Paper end + } + + if (this.b.isEmpty()) { +-- +2.7.2 + diff --git a/Spigot-Server-Patches/0055-Disable-explosion-knockback.patch b/Spigot-Server-Patches/0055-Disable-explosion-knockback.patch deleted file mode 100644 index 94c08b561a..0000000000 --- a/Spigot-Server-Patches/0055-Disable-explosion-knockback.patch +++ /dev/null @@ -1,71 +0,0 @@ -From b3a5cb356f485d1408532c223268045d25a76112 Mon Sep 17 00:00:00 2001 -From: Sudzzy -Date: Tue, 14 Jul 2015 09:20:44 -0700 -Subject: [PATCH] Disable explosion knockback - - -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index f643b29..0de13bb 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -779,7 +779,10 @@ public abstract class EntityLiving extends Entity { - } - } - -- if (flag) { -+ // PaperSpigot start - Disable explosion knockback -+ boolean knockbackCancelled = false; -+ if (flag && !(knockbackCancelled = world.paperSpigotConfig.disableExplosionKnockback && damagesource.isExplosion() && this instanceof EntityHuman)) { -+ // PaperSpigot end - this.world.broadcastEntityEffect(this, (byte) 2); - if (damagesource != DamageSource.DROWN) { - this.ac(); -@@ -801,6 +804,8 @@ public abstract class EntityLiving extends Entity { - } - } - -+ if (knockbackCancelled) this.world.broadcastEntityEffect(this, (byte) 2); // PaperSpigot -+ - String s; - - if (this.getHealth() <= 0.0F) { -diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java -index f6067ce..a60d3dd 100644 ---- a/src/main/java/net/minecraft/server/Explosion.java -+++ b/src/main/java/net/minecraft/server/Explosion.java -@@ -141,7 +141,7 @@ public class Explosion { - continue; - } - // CraftBukkit end -- double d14 = EnchantmentProtection.a(entity, d13); -+ double d14 = entity instanceof EntityHuman && world.paperSpigotConfig.disableExplosionKnockback ? 0 : EnchantmentProtection.a(entity, d13); // PaperSpigot - - // PaperSpigot start - Fix cannons - /* -@@ -153,7 +153,7 @@ public class Explosion { - entity.g(d8 * d14, d9 * d14, d10 * d14); - // PaperSpigot end - -- if (entity instanceof EntityHuman && !((EntityHuman) entity).abilities.isInvulnerable) { -+ if (entity instanceof EntityHuman && !((EntityHuman) entity).abilities.isInvulnerable && !world.paperSpigotConfig.disableExplosionKnockback) { // PaperSpigot - this.k.put((EntityHuman) entity, new Vec3D(d8 * d13, d9 * d13, d10 * d13)); - } - } -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index 349f77a..eaf1eda 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -328,4 +328,10 @@ public class PaperSpigotWorldConfig - lavaFlowSpeedNormal = getInt( "lava-flow-speed.normal", 30 ); - lavaFlowSpeedNether = getInt( "lava-flow-speed.nether", 10 ); - } -+ -+ public boolean disableExplosionKnockback; -+ private void disableExplosionKnockback() -+ { -+ disableExplosionKnockback = getBoolean( "disable-explosion-knockback", false ); -+ } - } --- -2.7.0 - diff --git a/Spigot-Server-Patches/0055-EAR-Fix-bug-with-teleporting-entities.patch b/Spigot-Server-Patches/0055-EAR-Fix-bug-with-teleporting-entities.patch new file mode 100644 index 0000000000..48c8b33fff --- /dev/null +++ b/Spigot-Server-Patches/0055-EAR-Fix-bug-with-teleporting-entities.patch @@ -0,0 +1,49 @@ +From a45c3b27afcf811da685d0fc12d9f1f9fc337b1f Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Thu, 3 Mar 2016 00:07:23 -0600 +Subject: [PATCH] EAR: Fix bug with teleporting entities + +[17:53:15] had a reproduceable issue of losing entities on teleport, now resolved +https://hub.spigotmc.org/stash/projects/SPIGOT/repos/spigot/pull-requests/52/overview + +diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +index b0834dc..7fa5440 100644 +--- a/src/main/java/net/minecraft/server/Entity.java ++++ b/src/main/java/net/minecraft/server/Entity.java +@@ -118,9 +118,17 @@ public abstract class Entity implements ICommandListener { + private static final DataWatcherObject aA = DataWatcher.a(Entity.class, DataWatcherRegistry.h); + private static final DataWatcherObject aB = DataWatcher.a(Entity.class, DataWatcherRegistry.h); + public boolean aa; +- public int ab; +- public int ac; +- public int ad; ++ // Paper start - EAR: Fix bug with teleporting entities ++ public boolean isAddedToChunk() { ++ int chunkX = MathHelper.floor(locX / 16.0D); ++ int chunkY = MathHelper.floor(locY / 16.0D); ++ int chunkZ = MathHelper.floor(locZ / 16.0D); ++ return aa && getChunkX() == chunkX && getChunkY() == chunkY || getChunkZ() == chunkZ; ++ } ++ public int ab; public int getChunkX() { return ab; } ++ public int ac; public int getChunkY() { return ac; } ++ public int ad; public int getChunkZ() { return ad; } ++ // Paper end + public boolean ah; + public boolean impulse; + public int portalCooldown; +diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java +index 97fbd95..df2fce7 100644 +--- a/src/main/java/org/spigotmc/ActivationRange.java ++++ b/src/main/java/org/spigotmc/ActivationRange.java +@@ -224,7 +224,7 @@ public class ActivationRange + SpigotTimings.checkIfActiveTimer.startTiming(); + // Never safe to skip fireworks or entities not yet added to chunk + // PAIL: inChunk +- if ( !entity.aa || entity instanceof EntityFireworks ) { ++ if ( !entity.isAddedToChunk() || entity instanceof EntityFireworks ) { // Paper - EAR: Fix bug with teleporting entities + SpigotTimings.checkIfActiveTimer.stopTiming(); + return true; + } +-- +2.7.2 + diff --git a/Spigot-Server-Patches/0076-Add-PlayerInitialSpawnEvent.patch b/Spigot-Server-Patches/0056-Add-PlayerInitialSpawnEvent.patch similarity index 78% rename from Spigot-Server-Patches/0076-Add-PlayerInitialSpawnEvent.patch rename to Spigot-Server-Patches/0056-Add-PlayerInitialSpawnEvent.patch index 9326df2c63..918872d0c2 100644 --- a/Spigot-Server-Patches/0076-Add-PlayerInitialSpawnEvent.patch +++ b/Spigot-Server-Patches/0056-Add-PlayerInitialSpawnEvent.patch @@ -1,21 +1,21 @@ -From c63a19607dba02582a3e2f7ec98d9e16402ea885 Mon Sep 17 00:00:00 2001 +From 07d4710b337e7a009b56999284d222c70132389f Mon Sep 17 00:00:00 2001 From: Steve Anton -Date: Tue, 22 Dec 2015 22:04:15 -0600 +Date: Thu, 3 Mar 2016 00:09:38 -0600 Subject: [PATCH] Add PlayerInitialSpawnEvent For modifying a player's initial spawn location as they join the server diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index deb0b82..c33915e 100644 +index 38d20b7..1fb083b 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java @@ -99,6 +99,22 @@ public abstract class PlayerList { } // CraftBukkit end -+ // PaperSpigot start - support PlayerInitialSpawnEvent ++ // Paper start - support PlayerInitialSpawnEvent + Location originalLoc = new Location(entityplayer.world.getWorld(), entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch); -+ org.bukkit.event.player.PlayerInitialSpawnEvent event = new org.bukkit.event.player.PlayerInitialSpawnEvent(entityplayer.getBukkitEntity(), originalLoc); ++ com.destroystokyo.paper.event.player.PlayerInitialSpawnEvent event = new com.destroystokyo.paper.event.player.PlayerInitialSpawnEvent(entityplayer.getBukkitEntity(), originalLoc); + this.server.server.getPluginManager().callEvent(event); + + Location newLoc = event.getSpawnLocation(); @@ -27,11 +27,11 @@ index deb0b82..c33915e 100644 + entityplayer.pitch = newLoc.getPitch(); + entityplayer.dimension = ((CraftWorld) newLoc.getWorld()).getHandle().dimension; + entityplayer.spawnWorld = entityplayer.world.worldData.getName(); -+ // PaperSpigot end ++ // Paper end + entityplayer.spawnIn(this.server.getWorldServer(entityplayer.dimension)); entityplayer.playerInteractManager.a((WorldServer) entityplayer.world); String s1 = "local"; -- -2.6.4 +2.7.2 diff --git a/Spigot-Server-Patches/0056-Disable-thunder.patch b/Spigot-Server-Patches/0056-Disable-thunder.patch deleted file mode 100644 index c47d58fb23..0000000000 --- a/Spigot-Server-Patches/0056-Disable-thunder.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 1fac37952e90156a79e01dc1ae40d02b31c7fd6c Mon Sep 17 00:00:00 2001 -From: Sudzzy -Date: Tue, 14 Jul 2015 09:26:41 -0700 -Subject: [PATCH] Disable thunder - - -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 9829ff0..6cf3157 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -422,7 +422,7 @@ public class WorldServer extends World implements IAsyncTaskHandler { - int i1; - BlockPosition blockposition; - -- if (this.random.nextInt(100000) == 0 && this.S() && this.R()) { -+ if (!this.paperSpigotConfig.disableThunder && this.random.nextInt(100000) == 0 && this.S() && this.R()) { // PaperSpigot - Disable thunder - this.m = this.m * 3 + 1013904223; - i1 = this.m >> 2; - blockposition = this.a(new BlockPosition(k + (i1 & 15), 0, l + (i1 >> 8 & 15))); -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index eaf1eda..a29f042 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -334,4 +334,10 @@ public class PaperSpigotWorldConfig - { - disableExplosionKnockback = getBoolean( "disable-explosion-knockback", false ); - } -+ -+ public boolean disableThunder; -+ private void disableThunder() -+ { -+ disableThunder = getBoolean( "disable-thunder", false ); -+ } - } --- -2.7.0 - diff --git a/Spigot-Server-Patches/0057-Disable-ice-and-snow.patch b/Spigot-Server-Patches/0057-Disable-ice-and-snow.patch deleted file mode 100644 index 94048a422f..0000000000 --- a/Spigot-Server-Patches/0057-Disable-ice-and-snow.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 3825558644345b19345fde32b2c8de71a19ef36e Mon Sep 17 00:00:00 2001 -From: Sudzzy -Date: Tue, 14 Jul 2015 09:28:31 -0700 -Subject: [PATCH] Disable ice and snow - - -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 6cf3157..392896b 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -432,7 +432,7 @@ public class WorldServer extends World implements IAsyncTaskHandler { - } - - this.methodProfiler.c("iceandsnow"); -- if (this.random.nextInt(16) == 0) { -+ if (!this.paperSpigotConfig.disableIceAndSnow && this.random.nextInt(16) == 0) { // PaperSpigot - Disable ice and snow - this.m = this.m * 3 + 1013904223; - i1 = this.m >> 2; - blockposition = this.q(new BlockPosition(k + (i1 & 15), 0, l + (i1 >> 8 & 15))); -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index a29f042..da5030a 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -340,4 +340,10 @@ public class PaperSpigotWorldConfig - { - disableThunder = getBoolean( "disable-thunder", false ); - } -+ -+ public boolean disableIceAndSnow; -+ private void disableIceAndSnow() -+ { -+ disableIceAndSnow = getBoolean( "disable-ice-and-snow", false ); -+ } - } --- -2.7.0 - diff --git a/Spigot-Server-Patches/0077-Process-Entity-Chunk-Registration-on-Teleport.patch b/Spigot-Server-Patches/0057-Process-Entity-Chunk-Registration-on-Teleport.patch similarity index 75% rename from Spigot-Server-Patches/0077-Process-Entity-Chunk-Registration-on-Teleport.patch rename to Spigot-Server-Patches/0057-Process-Entity-Chunk-Registration-on-Teleport.patch index fb176cffd0..62d9aa1cd0 100644 --- a/Spigot-Server-Patches/0077-Process-Entity-Chunk-Registration-on-Teleport.patch +++ b/Spigot-Server-Patches/0057-Process-Entity-Chunk-Registration-on-Teleport.patch @@ -1,22 +1,22 @@ -From d847896561ec7e88530d2561b353c5d181349115 Mon Sep 17 00:00:00 2001 +From 28b2d3c901c653dc89f87fc1d1c70547a9ba3bd4 Mon Sep 17 00:00:00 2001 From: Aikar -Date: Mon, 4 Jan 2016 00:16:08 -0600 +Date: Thu, 3 Mar 2016 00:12:23 -0600 Subject: [PATCH] Process Entity Chunk Registration on Teleport Fixes many issues with entities not being properly "switched" to their new chunk on teleport diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index efbf1a8..5df3476 100644 +index 9a1c9f0..4cc45f6 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -243,6 +243,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { +@@ -245,6 +245,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { // entity.world = ((CraftWorld) location.getWorld()).getHandle(); // Spigot end entity.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); -+ entity.world.entityJoinedWorld(entity, false); // PaperSpigot - Fix issues with entities not being switched to their new chunk ++ entity.world.entityJoinedWorld(entity, false); // Paper - Fix issues with entities not being switched to their new chunk // entity.setLocation() throws no event, and so cannot be cancelled return true; } -- -2.7.0.windows.2 +2.7.2 diff --git a/Spigot-Server-Patches/0058-Disable-mood-sounds.patch b/Spigot-Server-Patches/0058-Disable-mood-sounds.patch deleted file mode 100644 index db4856a906..0000000000 --- a/Spigot-Server-Patches/0058-Disable-mood-sounds.patch +++ /dev/null @@ -1,37 +0,0 @@ -From d7b725f84544da3633918ede5a0d708504bb80c8 Mon Sep 17 00:00:00 2001 -From: Sudzzy -Date: Tue, 14 Jul 2015 09:30:28 -0700 -Subject: [PATCH] Disable mood sounds - - -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 68cb798..64713bd 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -2248,7 +2248,7 @@ public abstract class World implements IBlockAccess { - - protected void a(int i, int j, Chunk chunk) { - this.methodProfiler.c("moodSound"); -- if (this.L == 0 && !this.isClientSide) { -+ if (!this.paperSpigotConfig.disableMoodSounds && this.L == 0 && !this.isClientSide) { // PaperSpigot - Disable mood sounds - this.m = this.m * 3 + 1013904223; - int k = this.m >> 2; - int l = k & 15; -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index da5030a..469b620 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -346,4 +346,10 @@ public class PaperSpigotWorldConfig - { - disableIceAndSnow = getBoolean( "disable-ice-and-snow", false ); - } -+ -+ public boolean disableMoodSounds; -+ private void disableMoodSounds() -+ { -+ disableMoodSounds = getBoolean( "disable-mood-sounds", false ); -+ } - } --- -2.7.0 - diff --git a/Spigot-Server-Patches/0079-Timings-v2.patch b/Spigot-Server-Patches/0058-Timings-v2.patch similarity index 73% rename from Spigot-Server-Patches/0079-Timings-v2.patch rename to Spigot-Server-Patches/0058-Timings-v2.patch index db50473570..d9bc332d4a 100644 --- a/Spigot-Server-Patches/0079-Timings-v2.patch +++ b/Spigot-Server-Patches/0058-Timings-v2.patch @@ -1,6 +1,6 @@ -From b031dee22afe4021b96e86b434dad0c2b8892429 Mon Sep 17 00:00:00 2001 +From fa5b865733cbba448c5bfb411c1de56bae085cca Mon Sep 17 00:00:00 2001 From: Aikar -Date: Fri, 8 Jan 2016 23:36:39 -0600 +Date: Thu, 3 Mar 2016 01:03:42 -0600 Subject: [PATCH] Timings v2 @@ -196,15 +196,75 @@ index 0000000..9ebc710 + tickEntities = Timings.ofSafe(name + "tickEntities"); + } +} +diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java +index 0ffa733..62f4631 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java +@@ -10,13 +10,17 @@ import java.lang.reflect.Modifier; + import java.util.HashMap; + import java.util.List; + import java.util.Map; ++import java.util.concurrent.TimeUnit; + import java.util.logging.Level; + ++import com.google.common.collect.Lists; + import net.minecraft.server.MinecraftServer; + import org.bukkit.Bukkit; + import org.bukkit.command.Command; + import org.bukkit.configuration.InvalidConfigurationException; + import org.bukkit.configuration.file.YamlConfiguration; ++import co.aikar.timings.Timings; ++import co.aikar.timings.TimingsManager; + + public class PaperConfig { + +@@ -127,4 +131,37 @@ public class PaperConfig { + Bukkit.getLogger().log(Level.INFO, "Disabling player interaction limiter, your server may be more vulnerable to malicious users"); + } + } ++ ++ private static void timings() { ++ boolean timings = getBoolean("timings.enabled", true); ++ boolean verboseTimings = getBoolean("timings.verbose", true); ++ TimingsManager.privacy = getBoolean("timings.server-name-privacy", false); ++ TimingsManager.hiddenConfigs = getList("timings.hidden-config-entries", Lists.newArrayList("database", "settings.bungeecord-addresses")); ++ int timingHistoryInterval = getInt("timings.history-interval", 300); ++ int timingHistoryLength = getInt("timings.history-length", 3600); ++ ++ ++ Timings.setVerboseTimingsEnabled(verboseTimings); ++ Timings.setTimingsEnabled(timings); ++ Timings.setHistoryInterval(timingHistoryInterval * 20); ++ Timings.setHistoryLength(timingHistoryLength * 20); ++ ++ Bukkit.getLogger().log(Level.INFO, "Spigot Timings: " + timings + ++ " - Verbose: " + verboseTimings + ++ " - Interval: " + timeSummary(Timings.getHistoryInterval() / 20) + ++ " - Length: " + timeSummary(Timings.getHistoryLength() / 20)); ++ } ++ ++ protected static String timeSummary(int seconds) { ++ String time = ""; ++ if (seconds > 60 * 60) { ++ time += TimeUnit.SECONDS.toHours(seconds) + "h"; ++ seconds /= 60; ++ } ++ ++ if (seconds > 0) { ++ time += TimeUnit.SECONDS.toMinutes(seconds) + "m"; ++ } ++ return time; ++ } + } diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java -index c26975a..a784e04 100644 +index bed5577..0f71013 100644 --- a/src/main/java/net/minecraft/server/Block.java +++ b/src/main/java/net/minecraft/server/Block.java -@@ -65,6 +65,16 @@ public class Block { - protected boolean y; - protected boolean z; - protected boolean isTileEntity; -+ // Spigot start +@@ -32,6 +32,15 @@ public class Block { + protected final BlockStateList blockStateList; + private IBlockData blockData; + private String name; ++ // Paper start + public co.aikar.timings.Timing timing; + public co.aikar.timings.Timing getTiming() { + if (timing == null) { @@ -212,111 +272,111 @@ index c26975a..a784e04 100644 + } + return timing; + } -+ // Spigot end -+ - protected double minX; - protected double minY; - protected double minZ; ++ // Paper end + + public static int getId(Block block) { + return Block.REGISTRY.a(block); // CraftBukkit - decompile error diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index 45cea14..088beb2 100644 +index 45680ed..a06ea85 100644 --- a/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java -@@ -20,7 +20,7 @@ import java.io.PrintStream; +@@ -22,7 +22,7 @@ import java.io.PrintStream; import org.apache.logging.log4j.Level; import org.bukkit.craftbukkit.LoggerOutputStream; -import org.bukkit.craftbukkit.SpigotTimings; // Spigot -+import co.aikar.timings.SpigotTimings; // Spigot ++import co.aikar.timings.SpigotTimings; // Paper import org.bukkit.event.server.ServerCommandEvent; import org.bukkit.craftbukkit.util.Waitable; import org.bukkit.event.server.RemoteServerCommandEvent; diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 20cc946..ef59b40 100644 +index 7fa5440..d10fd67 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -16,7 +16,8 @@ import org.bukkit.entity.Hanging; +@@ -24,7 +24,8 @@ import org.bukkit.block.BlockFace; + import org.bukkit.entity.Hanging; import org.bukkit.entity.LivingEntity; - import org.bukkit.entity.Painting; import org.bukkit.entity.Vehicle; -import org.spigotmc.CustomTimingsHandler; // Spigot -+import co.aikar.timings.SpigotTimings; // Spigot -+import co.aikar.timings.Timing; // Spigot ++import co.aikar.timings.SpigotTimings; // Paper ++import co.aikar.timings.Timing; // Paper import org.bukkit.event.entity.EntityCombustByEntityEvent; import org.bukkit.event.hanging.HangingBreakByEntityEvent; - import org.bukkit.event.painting.PaintingBreakByEntityEvent; -@@ -128,7 +129,7 @@ public abstract class Entity implements ICommandListener { - public boolean loadChunks = false; // PaperSpigot - Entities can load chunks they move through and keep them loaded - - // Spigot start + import org.bukkit.event.vehicle.VehicleBlockCollisionEvent; +@@ -148,7 +149,7 @@ public abstract class Entity implements ICommandListener { + public boolean valid; // CraftBukkit + public org.bukkit.projectiles.ProjectileSource projectileSource; // CraftBukkit - For projectiles only + public boolean forceExplosionKnockback; // CraftBukkit - SPIGOT-949 - public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getEntityTimings(this); // Spigot -+ public Timing tickTimer = SpigotTimings.getEntityTimings(this); // Spigot ++ public Timing tickTimer = SpigotTimings.getEntityTimings(this); // Paper + // Spigot start public final byte activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this); public final boolean defaultActivationState; - public long activatedTick = Integer.MIN_VALUE; -@@ -426,7 +427,6 @@ public abstract class Entity implements ICommandListener { - +@@ -477,7 +478,6 @@ public abstract class Entity implements ICommandListener { + } public void move(double d0, double d1, double d2) { - org.bukkit.craftbukkit.SpigotTimings.entityMoveTimer.startTiming(); // Spigot - if (this.loadChunks) loadChunks(); // PaperSpigot - Load chunks if (this.noclip) { this.a(this.getBoundingBox().c(d0, d1, d2)); -@@ -764,7 +764,6 @@ public abstract class Entity implements ICommandListener { + this.recalcPosition(); +@@ -818,7 +818,6 @@ public abstract class Entity implements ICommandListener { this.world.methodProfiler.b(); } - org.bukkit.craftbukkit.SpigotTimings.entityMoveTimer.stopTiming(); // Spigot } - private void recalcPosition() { + public void recalcPosition() { diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 0de13bb..19a743c 100644 +index 8d91f7c..a8e8557 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -23,7 +23,7 @@ import org.bukkit.event.entity.EntityRegainHealthEvent; - import org.bukkit.event.vehicle.VehicleExitEvent; + import org.bukkit.event.player.PlayerItemConsumeEvent; // CraftBukkit end -import org.bukkit.craftbukkit.SpigotTimings; // Spigot -+import co.aikar.timings.SpigotTimings; // Spigot ++import co.aikar.timings.SpigotTimings; // Paper public abstract class EntityLiving extends Entity { -@@ -1449,7 +1449,6 @@ public abstract class EntityLiving extends Entity { +@@ -1686,7 +1686,6 @@ public abstract class EntityLiving extends Entity { } - public void t_() { + public void m() { - SpigotTimings.timerEntityBaseTick.startTiming(); // Spigot - super.t_(); + super.m(); + this.cu(); if (!this.world.isClientSide) { - int i = this.bv(); -@@ -1488,9 +1487,7 @@ public abstract class EntityLiving extends Entity { +@@ -1759,9 +1758,7 @@ public abstract class EntityLiving extends Entity { } } - SpigotTimings.timerEntityBaseTick.stopTiming(); // Spigot - this.m(); + this.n(); - SpigotTimings.timerEntityTickRest.startTiming(); // Spigot double d0 = this.locX - this.lastX; double d1 = this.locZ - this.lastZ; float f = (float) (d0 * d0 + d1 * d1); -@@ -1555,7 +1552,6 @@ public abstract class EntityLiving extends Entity { - - this.world.methodProfiler.b(); - this.aT += f2; +@@ -1830,8 +1827,6 @@ public abstract class EntityLiving extends Entity { + } else { + this.bo = 0; + } +- - SpigotTimings.timerEntityTickRest.stopTiming(); // Spigot } protected float h(float f, float f1) { -@@ -1620,7 +1616,6 @@ public abstract class EntityLiving extends Entity { +@@ -1896,7 +1891,6 @@ public abstract class EntityLiving extends Entity { } this.world.methodProfiler.a("ai"); - SpigotTimings.timerEntityAI.startTiming(); // Spigot - if (this.bD()) { - this.aY = false; - this.aZ = 0.0F; -@@ -1631,7 +1626,6 @@ public abstract class EntityLiving extends Entity { + if (this.cf()) { + this.bc = false; + this.bd = 0.0F; +@@ -1907,7 +1901,6 @@ public abstract class EntityLiving extends Entity { this.doTick(); this.world.methodProfiler.b(); } @@ -324,134 +384,132 @@ index 0de13bb..19a743c 100644 this.world.methodProfiler.b(); this.world.methodProfiler.a("jump"); -@@ -1653,15 +1647,11 @@ public abstract class EntityLiving extends Entity { - this.aZ *= 0.98F; - this.ba *= 0.98F; - this.bb *= 0.9F; +@@ -1930,14 +1923,10 @@ public abstract class EntityLiving extends Entity { + this.be *= 0.98F; + this.bf *= 0.9F; + this.r(); - SpigotTimings.timerEntityAIMove.startTiming(); // Spigot - this.g(this.aZ, this.ba); + this.g(this.bd, this.be); - SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot this.world.methodProfiler.b(); this.world.methodProfiler.a("push"); - if (!this.world.isClientSide) { -- SpigotTimings.timerEntityAICollision.startTiming(); // Spigot - this.bL(); -- SpigotTimings.timerEntityAICollision.stopTiming(); // Spigot - } - +- SpigotTimings.timerEntityAICollision.startTiming(); // Spigot + this.cn(); +- SpigotTimings.timerEntityAICollision.stopTiming(); // Spigot this.world.methodProfiler.b(); + } + diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index eac71e8..ee09922 100644 +index ac1bec6..cf5dbd5 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -45,7 +45,7 @@ import jline.console.ConsoleReader; - import joptsimple.OptionSet; +@@ -45,7 +45,7 @@ import org.bukkit.craftbukkit.CraftServer; - import org.bukkit.craftbukkit.Main; --import org.bukkit.craftbukkit.SpigotTimings; // Spigot -+import co.aikar.timings.SpigotTimings; // Spigot + // CraftBukkit start // CraftBukkit end +-import org.bukkit.craftbukkit.SpigotTimings; // Spigot ++import co.aikar.timings.SpigotTimings; // Paper public abstract class MinecraftServer implements Runnable, ICommandListener, IAsyncTaskHandler, IMojangStatistics { -@@ -449,6 +449,8 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs - // CraftBukkit end - if (!this.N) { - MinecraftServer.LOGGER.info("Stopping server"); -+ SpigotTimings.stopServer(); // Spigot -+ - // CraftBukkit start - if (this.server != null) { - this.server.disablePlugins(); -@@ -697,7 +699,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs - protected void z() {} - protected void A() throws ExceptionWorldConflict { // CraftBukkit - added throws +@@ -443,6 +443,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs + } + // CraftBukkit end + MinecraftServer.LOGGER.info("Stopping server"); ++ SpigotTimings.stopServer(); // Paper + if (this.am() != null) { + this.am().b(); + } +@@ -694,7 +695,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs + protected void B() {} + + protected void C() throws ExceptionWorldConflict { // CraftBukkit - added throws - SpigotTimings.serverTickTimer.startTiming(); // Spigot -+ co.aikar.timings.TimingsManager.FULL_SERVER_TICK.startTiming(); // Spigot ++ co.aikar.timings.TimingsManager.FULL_SERVER_TICK.startTiming(); // Paper long i = System.nanoTime(); ++this.ticks; -@@ -757,11 +759,11 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs +@@ -754,11 +755,11 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs this.methodProfiler.b(); this.methodProfiler.b(); org.spigotmc.WatchdogThread.tick(); // Spigot - SpigotTimings.serverTickTimer.stopTiming(); // Spigot - org.spigotmc.CustomTimingsHandler.tick(); // Spigot -+ co.aikar.timings.TimingsManager.FULL_SERVER_TICK.stopTiming(); // Spigot ++ co.aikar.timings.TimingsManager.FULL_SERVER_TICK.stopTiming(); // Paper } - public void B() { -+ SpigotTimings.minecraftSchedulerTimer.startTiming(); // Spigot + public void D() { ++ SpigotTimings.minecraftSchedulerTimer.startTiming(); // Paper this.methodProfiler.a("jobs"); Queue queue = this.j; -@@ -772,13 +774,14 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs +@@ -769,13 +770,14 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs SystemUtils.a(entry, MinecraftServer.LOGGER); } // Spigot end -+ SpigotTimings.minecraftSchedulerTimer.stopTiming(); // Spigot ++ SpigotTimings.minecraftSchedulerTimer.stopTiming(); // Paper this.methodProfiler.c("levels"); - SpigotTimings.schedulerTimer.startTiming(); // Spigot -+ SpigotTimings.bukkitSchedulerTimer.startTiming(); // Spigot ++ SpigotTimings.bukkitSchedulerTimer.startTiming(); // Paper // CraftBukkit start this.server.getScheduler().mainThreadHeartbeat(this.ticks); - SpigotTimings.schedulerTimer.stopTiming(); // Spigot -+ SpigotTimings.bukkitSchedulerTimer.stopTiming(); // Spigot ++ SpigotTimings.bukkitSchedulerTimer.stopTiming(); // Paper // Run tasks that are waiting on processing SpigotTimings.processQueueTimer.startTiming(); // Spigot diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 2ab01a1..1138042 100644 +index b7db9b6..0388f6d 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -60,6 +60,7 @@ import org.bukkit.event.player.PlayerToggleSprintEvent; +@@ -56,6 +56,7 @@ import org.bukkit.event.player.PlayerToggleSprintEvent; import org.bukkit.inventory.CraftingInventory; import org.bukkit.inventory.InventoryView; import org.bukkit.util.NumberConversions; -+import co.aikar.timings.SpigotTimings; // Spigot ++import co.aikar.timings.SpigotTimings; // Paper // CraftBukkit end - import org.github.paperspigot.PaperSpigotConfig; // PaperSpigot -@@ -1146,7 +1147,7 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList + public class PlayerConnection implements PacketListenerPlayIn, ITickable { +@@ -1284,7 +1285,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { // CraftBukkit end private void handleCommand(String s) { - org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.startTiming(); // Spigot -+ SpigotTimings.playerCommandTimer.startTiming(); // Spigot ++ SpigotTimings.playerCommandTimer.startTiming(); // Paper // CraftBukkit start - whole method if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot - this.c.info(this.player.getName() + " issued server command: " + s); -@@ -1157,22 +1158,22 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList + this.LOGGER.info(this.player.getName() + " issued server command: " + s); +@@ -1295,22 +1296,22 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { this.server.getPluginManager().callEvent(event); if (event.isCancelled()) { - org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.stopTiming(); // Spigot -+ SpigotTimings.playerCommandTimer.stopTiming(); // Spigot ++ SpigotTimings.playerCommandTimer.stopTiming(); // Paper return; } try { if (this.server.dispatchCommand(event.getPlayer(), event.getMessage().substring(1))) { - org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.stopTiming(); // Spigot -+ SpigotTimings.playerCommandTimer.stopTiming(); // Spigot ++ SpigotTimings.playerCommandTimer.stopTiming(); // Paper return; } } catch (org.bukkit.command.CommandException ex) { player.sendMessage(org.bukkit.ChatColor.RED + "An internal error occurred while attempting to perform this command"); java.util.logging.Logger.getLogger(PlayerConnection.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); - org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.stopTiming(); // Spigot -+ SpigotTimings.playerCommandTimer.stopTiming(); // Spigot ++ SpigotTimings.playerCommandTimer.stopTiming(); // Paper return; } - org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.stopTiming(); // Spigot -+ SpigotTimings.playerCommandTimer.stopTiming(); // Spigot ++ SpigotTimings.playerCommandTimer.stopTiming(); // Paper // this.minecraftServer.getCommandHandler().a(this.player, s); // CraftBukkit end } diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index 3fc6450..fdcbf44 100644 +index d898428..f579d28 100644 --- a/src/main/java/net/minecraft/server/TileEntity.java +++ b/src/main/java/net/minecraft/server/TileEntity.java @@ -6,12 +6,13 @@ import java.util.concurrent.Callable; @@ -459,235 +517,226 @@ index 3fc6450..fdcbf44 100644 import org.apache.logging.log4j.Logger; -import org.spigotmc.CustomTimingsHandler; // Spigot -+import co.aikar.timings.SpigotTimings; // Spigot -+import co.aikar.timings.Timing; // Spigot ++import co.aikar.timings.SpigotTimings; // Paper ++import co.aikar.timings.Timing; // Paper import org.bukkit.inventory.InventoryHolder; // CraftBukkit public abstract class TileEntity { - public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getTileEntityTimings(this); // Spigot -+ public Timing tickTimer = SpigotTimings.getTileEntityTimings(this); // Spigot ++ public Timing tickTimer = SpigotTimings.getTileEntityTimings(this); // Paper private static final Logger a = LogManager.getLogger(); private static Map> f = Maps.newHashMap(); private static Map, String> g = Maps.newHashMap(); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index b957bd2..a76d83c 100644 +index 6e021c6..a1cdef6 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -7,13 +7,14 @@ import org.bukkit.Bukkit; +@@ -18,11 +18,11 @@ import com.google.common.collect.Maps; + import java.util.Map; + import org.bukkit.Bukkit; import org.bukkit.block.BlockState; +-import org.bukkit.craftbukkit.SpigotTimings; // Spigot import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftWorld; --import org.bukkit.craftbukkit.SpigotTimings; import org.bukkit.craftbukkit.event.CraftEventFactory; import org.bukkit.craftbukkit.util.CraftMagicNumbers; -+import org.bukkit.craftbukkit.util.LongHashSet; ++import org.bukkit.craftbukkit.util.LongHashSet; // Paper import org.bukkit.event.block.BlockCanBuildEvent; import org.bukkit.event.block.BlockPhysicsEvent; import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; - import org.bukkit.generator.ChunkGenerator; -+import co.aikar.timings.SpigotTimings; +@@ -134,7 +134,7 @@ public abstract class World implements IBlockAccess { - import java.util.*; - import java.util.concurrent.Callable; -@@ -159,7 +160,7 @@ public abstract class World implements IBlockAccess { - - public final org.github.paperspigot.PaperSpigotWorldConfig paperSpigotConfig; // PaperSpigot + public final com.destroystokyo.paper.PaperWorldConfig paperConfig; // Paper - public final SpigotTimings.WorldTimingsHandler timings; // Spigot -+ public final co.aikar.timings.WorldTimingsHandler timings; // Spigot - - public CraftWorld getWorld() { - return this.world; -@@ -227,7 +228,7 @@ public abstract class World implements IBlockAccess { - this.getServer().addWorld(this.world); - // CraftBukkit end - this.keepSpawnInMemory = this.paperSpigotConfig.keepSpawnInMemory; // PaperSpigot -- timings = new SpigotTimings.WorldTimingsHandler(this); // Spigot - code below can generate new world and access timings -+ timings = new co.aikar.timings.WorldTimingsHandler(this); // Spigot - code below can generate new world and access timings - this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime); ++ public final co.aikar.timings.WorldTimingsHandler timings; // Paper + private boolean guardEntityList; // Spigot + public static boolean haveWeSilencedAPhysicsCrash; + public static String blockLocation; +@@ -178,7 +178,7 @@ public abstract class World implements IBlockAccess { + this.N = worldprovider.getWorldBorder(); + this.getServer().addWorld(this.world); // CraftBukkit + this.keepSpawnInMemory = this.paperConfig.keepSpawnInMemory; // Paper +- timings = new SpigotTimings.WorldTimingsHandler(this); // Spigot - code below can generate new world and access timings ++ timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings + this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime); this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime); } -@@ -1393,6 +1394,7 @@ public abstract class World implements IBlockAccess { +@@ -1350,6 +1350,7 @@ public abstract class World implements IBlockAccess { } this.methodProfiler.c("remove"); -+ timings.entityRemoval.startTiming(); // Spigot - this.entityList.removeAll(this.g); ++ timings.entityRemoval.startTiming(); // Paper + this.entityList.removeAll(this.f); int j; -@@ -1412,12 +1414,14 @@ public abstract class World implements IBlockAccess { - } +@@ -1370,6 +1371,7 @@ public abstract class World implements IBlockAccess { - this.g.clear(); -+ timings.entityRemoval.stopTiming(); // Spigot + this.f.clear(); + this.l(); ++ timings.entityRemoval.stopTiming(); // Paper this.methodProfiler.c("regular"); - org.spigotmc.ActivationRange.activateEntities(this); // Spigot + CrashReportSystemDetails crashreportsystemdetails1; +@@ -1379,6 +1381,7 @@ public abstract class World implements IBlockAccess { timings.entityTick.startTiming(); // Spigot guardEntityList = true; // Spigot // CraftBukkit start - Use field for loop variable -+ co.aikar.timings.TimingHistory.entityTicks += this.entityList.size(); // Spigot ++ co.aikar.timings.TimingHistory.entityTicks += this.entityList.size(); // Paper int entitiesThisCycle = 0; - // PaperSpigot start - Disable tick limiters + // Paper start - Disable tick limiters //if (tickPosition < 0) tickPosition = 0; -@@ -1438,12 +1442,12 @@ public abstract class World implements IBlockAccess { +@@ -1400,12 +1403,12 @@ public abstract class World implements IBlockAccess { this.methodProfiler.a("tick"); - if (!entity.dead) { + if (!entity.dead && !(entity instanceof EntityPlayer)) { try { - SpigotTimings.tickEntityTimer.startTiming(); // Spigot -+ entity.tickTimer.startTiming(); // Spigot ++ entity.tickTimer.startTiming(); // Paper this.g(entity); - SpigotTimings.tickEntityTimer.stopTiming(); // Spigot -+ entity.tickTimer.stopTiming(); // Spigot ++ entity.tickTimer.stopTiming(); // Paper } catch (Throwable throwable1) { - // PaperSpigot start - Prevent tile entity and entity crashes + // Paper start - Prevent tile entity and entity crashes - SpigotTimings.tickEntityTimer.stopTiming(); + entity.tickTimer.stopTiming(); System.err.println("Entity threw exception at " + entity.world.getWorld().getName() + ":" + entity.locX + "," + entity.locY + "," + entity.locZ); throwable1.printStackTrace(); entity.dead = true; -@@ -1567,6 +1571,8 @@ public abstract class World implements IBlockAccess { +@@ -1534,6 +1537,7 @@ public abstract class World implements IBlockAccess { } timings.tileEntityPending.stopTiming(); // Spigot -+ co.aikar.timings.TimingHistory.tileEntityTicks += this.tileEntityList.size(); // Spigot -+ ++ co.aikar.timings.TimingHistory.tileEntityTicks += this.tileEntityListTick.size(); // Paper this.methodProfiler.b(); this.methodProfiler.b(); } -@@ -1621,7 +1627,6 @@ public abstract class World implements IBlockAccess { - } - // PaperSpigot end +@@ -1579,7 +1583,6 @@ public abstract class World implements IBlockAccess { + entity.ticksLived++; + entity.inactiveTick(); } else { - entity.tickTimer.startTiming(); // Spigot // CraftBukkit end - entity.P = entity.locX; - entity.Q = entity.locY; -@@ -1630,6 +1635,7 @@ public abstract class World implements IBlockAccess { + entity.M = entity.locX; + entity.N = entity.locY; +@@ -1588,6 +1591,7 @@ public abstract class World implements IBlockAccess { entity.lastPitch = entity.pitch; - if (flag && entity.ad) { + if (flag && entity.aa) { ++entity.ticksLived; -+ ++co.aikar.timings.TimingHistory.activatedEntityTicks; // Spigot - if (entity.vehicle != null) { - entity.ak(); ++ ++co.aikar.timings.TimingHistory.activatedEntityTicks; // Paper + if (entity.isPassenger()) { + entity.aw(); } else { -@@ -1686,7 +1692,6 @@ public abstract class World implements IBlockAccess { +@@ -1646,8 +1650,6 @@ public abstract class World implements IBlockAccess { + } } } - +- - entity.tickTimer.stopTiming(); // Spigot } } diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index fb16a8a..3a2ca89 100644 +index 6cc8d28..3567133 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -245,13 +245,13 @@ public class WorldServer extends World implements IAsyncTaskHandler { +@@ -241,13 +241,13 @@ public class WorldServer extends World implements IAsyncTaskHandler { timings.doChunkUnload.stopTiming(); // Spigot this.methodProfiler.c("tickPending"); - timings.doTickPending.startTiming(); // Spigot -+ timings.scheduledBlocks.startTiming(); // Spigot ++ timings.scheduledBlocks.startTiming(); // Paper this.a(false); - timings.doTickPending.stopTiming(); // Spigot -+ timings.scheduledBlocks.stopTiming(); // Spigot ++ timings.scheduledBlocks.stopTiming(); // Paper this.methodProfiler.c("tickBlocks"); - timings.doTickTiles.startTiming(); // Spigot -+ timings.chunkTicks.startTiming(); // Spigot - this.h(); ++ timings.chunkTicks.startTiming(); // Paper + this.j(); - timings.doTickTiles.stopTiming(); // Spigot -+ timings.chunkTicks.stopTiming(); // Spigot - spigotConfig.antiXrayInstance.flushUpdates(this); // PaperSpigot ++ timings.chunkTicks.stopTiming(); // Paper this.methodProfiler.c("chunkMap"); timings.doChunkMap.startTiming(); // Spigot -@@ -471,6 +471,7 @@ public class WorldServer extends World implements IAsyncTaskHandler { + this.manager.flush(); +@@ -477,7 +477,7 @@ public class WorldServer extends World implements IAsyncTaskHandler { + } } - this.methodProfiler.c("tickBlocks"); -+ timings.chunkTicksBlocks.startTiming(); // Spigot - i1 = this.getGameRules().c("randomTickSpeed"); - if (i1 > 0) { +- this.methodProfiler.c("tickBlocks"); ++ timings.chunkTicksBlocks.startTiming(); // Paper + if (i > 0) { ChunkSection[] achunksection = chunk.getSections(); -@@ -499,6 +500,7 @@ public class WorldServer extends World implements IAsyncTaskHandler { + int i1 = achunksection.length; +@@ -505,6 +505,7 @@ public class WorldServer extends World implements IAsyncTaskHandler { } } } -+ timings.chunkTicksBlocks.stopTiming(); // Spigot ++ timings.chunkTicksBlocks.stopTiming(); // Paper } - } -@@ -630,6 +632,7 @@ public class WorldServer extends World implements IAsyncTaskHandler { + this.methodProfiler.b(); +@@ -709,6 +710,7 @@ public class WorldServer extends World implements IAsyncTaskHandler { this.methodProfiler.a("cleaning"); -+ timings.scheduledBlocksCleanup.startTiming(); // Spigot ++ timings.scheduledBlocksCleanup.startTiming(); // Paper NextTickListEntry nextticklistentry; for (int j = 0; j < i; ++j) { -@@ -642,6 +645,7 @@ public class WorldServer extends World implements IAsyncTaskHandler { - this.M.remove(nextticklistentry); - this.V.add(nextticklistentry); +@@ -722,6 +724,7 @@ public class WorldServer extends World implements IAsyncTaskHandler { + // this.nextTickListHash.remove(nextticklistentry); + this.U.add(nextticklistentry); } -+ timings.scheduledBlocksCleanup.stopTiming(); // Spigot ++ timings.scheduledBlocksCleanup.stopTiming(); // Paper - // PaperSpigot start - Allow redstone ticks to bypass the tickNextTickListCap - if (paperSpigotConfig.tickNextTickListCapIgnoresRedstone) { -@@ -662,6 +666,7 @@ public class WorldServer extends World implements IAsyncTaskHandler { + // Paper start - Allow redstone ticks to bypass the tickNextTickListCap + if (paperConfig.tickNextTickListCapIgnoresRedstone) { +@@ -743,6 +746,7 @@ public class WorldServer extends World implements IAsyncTaskHandler { this.methodProfiler.b(); this.methodProfiler.a("ticking"); -+ timings.scheduledBlocksTicking.startTiming(); // Spigot - Iterator iterator = this.V.iterator(); ++ timings.scheduledBlocksTicking.startTiming(); // Paper + Iterator iterator = this.U.iterator(); while (iterator.hasNext()) { -@@ -671,6 +676,8 @@ public class WorldServer extends World implements IAsyncTaskHandler { +@@ -752,6 +756,8 @@ public class WorldServer extends World implements IAsyncTaskHandler { if (this.areChunksLoadedBetween(nextticklistentry.a.a(-b0, -b0, -b0), nextticklistentry.a.a(b0, b0, b0))) { IBlockData iblockdata = this.getType(nextticklistentry.a); -+ co.aikar.timings.Timing timing = iblockdata.getBlock().getTiming(); // Spigot -+ timing.startTiming(); // Spigot ++ co.aikar.timings.Timing timing = iblockdata.getBlock().getTiming(); // Paper ++ timing.startTiming(); // Paper - if (iblockdata.getBlock().getMaterial() != Material.AIR && Block.a(iblockdata.getBlock(), nextticklistentry.a())) { + if (iblockdata.getMaterial() != Material.AIR && Block.a(iblockdata.getBlock(), nextticklistentry.a())) { try { -@@ -683,10 +690,12 @@ public class WorldServer extends World implements IAsyncTaskHandler { +@@ -764,10 +770,12 @@ public class WorldServer extends World implements IAsyncTaskHandler { throw new ReportedException(crashreport); } } -+ timing.stopTiming(); // Spigot ++ timing.stopTiming(); // Paper } else { this.a(nextticklistentry.a, nextticklistentry.a(), 0); } } -+ timings.scheduledBlocksTicking.stopTiming(); // Spigot ++ timings.scheduledBlocksTicking.stopTiming(); // Paper this.methodProfiler.b(); - this.V.clear(); + this.U.clear(); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 7da8d67..97f9f96 100644 +index 4654a4b..b27d95a 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -329,6 +329,7 @@ public final class CraftServer implements Server { - DefaultPermissions.registerCorePermissions(); - CraftDefaultPermissions.registerCorePermissions(); - helpMap.initializeCommands(); -+ co.aikar.timings.Timings.reset(); // Spigot - } - } - -@@ -1715,13 +1716,32 @@ public final class CraftServer implements Server { - } - // PaperSpigot end +@@ -1726,6 +1726,7 @@ public final class CraftServer implements Server { + private final Spigot spigot = new Spigot() + { + @Deprecated @Override public YamlConfiguration getConfig() { -+ return getBukkitConfig(); -+ } -+ -+ @Override +@@ -1733,6 +1734,24 @@ public final class CraftServer implements Server { + } + + @Override + public YamlConfiguration getBukkitConfig() + { + return configuration; @@ -696,13 +745,13 @@ index 7da8d67..97f9f96 100644 + @Override + public YamlConfiguration getSpigotConfig() + { - return org.spigotmc.SpigotConfig.config; - } - - @Override -+ public YamlConfiguration getPaperSpigotConfig() ++ return org.spigotmc.SpigotConfig.config; ++ } ++ ++ @Override ++ public YamlConfiguration getPaperConfig() + { -+ return org.github.paperspigot.PaperSpigotConfig.config; ++ return com.destroystokyo.paper.PaperConfig.config; + } + + @Override @@ -889,13 +938,30 @@ index 41d2d87..0000000 - } -} diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 1135f83..e8c6d5e 100644 +index 6fb4fb0..a2f2b8e 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1496,6 +1496,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - ((WorldServer) getHandle().world).getPlayerChunkMap().updateViewDistance(getHandle(), viewDistance); +@@ -37,15 +37,9 @@ import org.bukkit.configuration.serialization.DelegateDeserialization; + import org.bukkit.conversations.Conversation; + import org.bukkit.conversations.ConversationAbandonedEvent; + import org.bukkit.conversations.ManuallyAbandonedConversationCanceller; +-import org.bukkit.craftbukkit.CraftParticle; ++import org.bukkit.craftbukkit.*; + import org.bukkit.craftbukkit.block.CraftSign; + import org.bukkit.craftbukkit.conversations.ConversationTracker; +-import org.bukkit.craftbukkit.CraftEffect; +-import org.bukkit.craftbukkit.CraftOfflinePlayer; +-import org.bukkit.craftbukkit.CraftServer; +-import org.bukkit.craftbukkit.CraftSound; +-import org.bukkit.craftbukkit.CraftStatistic; +-import org.bukkit.craftbukkit.CraftWorld; + import org.bukkit.craftbukkit.map.CraftMapView; + import org.bukkit.craftbukkit.map.RenderData; + import org.bukkit.craftbukkit.scoreboard.CraftScoreboard; +@@ -1559,6 +1553,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + packet.components = components; + getHandle().playerConnection.sendPacket(packet); } - // PaperSpigot end + + @Override + public int getPing() @@ -906,7 +972,7 @@ index 1135f83..e8c6d5e 100644 public Player.Spigot spigot() diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java -index 93d8d42..d76ec40 100644 +index 93d8d42..44e057c 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java @@ -186,7 +186,7 @@ public class CraftScheduler implements BukkitScheduler { @@ -914,7 +980,7 @@ index 93d8d42..d76ec40 100644 } return false; - }}); -+ }}){{this.timings=co.aikar.timings.SpigotTimings.getCancelTasksTimer();}}; // Spigot ++ }}){{this.timings=co.aikar.timings.SpigotTimings.getCancelTasksTimer();}}; // Paper handle(task, 0l); for (CraftTask taskPending = head.getNext(); taskPending != null; taskPending = taskPending.getNext()) { if (taskPending == task) { @@ -923,7 +989,7 @@ index 93d8d42..d76ec40 100644 } } - }); -+ }){{this.timings=co.aikar.timings.SpigotTimings.getCancelTasksTimer(plugin);}}; // Spigot ++ }){{this.timings=co.aikar.timings.SpigotTimings.getCancelTasksTimer(plugin);}}; // Paper handle(task, 0l); for (CraftTask taskPending = head.getNext(); taskPending != null; taskPending = taskPending.getNext()) { if (taskPending == task) { @@ -932,7 +998,7 @@ index 93d8d42..d76ec40 100644 CraftScheduler.this.temp.clear(); } - }); -+ }){{this.timings=co.aikar.timings.SpigotTimings.getCancelTasksTimer();}}; // Spigot ++ }){{this.timings=co.aikar.timings.SpigotTimings.getCancelTasksTimer();}}; // Paper handle(task, 0l); for (CraftTask taskPending = head.getNext(); taskPending != null; taskPending = taskPending.getNext()) { if (taskPending == task) { @@ -947,7 +1013,7 @@ index 93d8d42..d76ec40 100644 task.getOwner().getLogger().log( Level.WARNING, diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java -index 220e39a..4b1e352 100644 +index 220e39a..ecbb0e5 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java @@ -1,8 +1,8 @@ @@ -956,8 +1022,8 @@ index 220e39a..4b1e352 100644 import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.SpigotTimings; // Spigot -import org.spigotmc.CustomTimingsHandler; // Spigot -+import co.aikar.timings.SpigotTimings; // Spigot -+import co.aikar.timings.Timing; // Spigot ++import co.aikar.timings.SpigotTimings; // Paper ++import co.aikar.timings.Timing; // Paper import org.bukkit.plugin.Plugin; import org.bukkit.scheduler.BukkitTask; @@ -966,8 +1032,8 @@ index 220e39a..4b1e352 100644 private volatile long period; private long nextRun; - private final Runnable task; -+ public final Runnable task; //Spigot -+ public Timing timings; // Spigot ++ public final Runnable task; // Paper ++ public Timing timings; // Paper private final Plugin plugin; private final int id; @@ -975,10 +1041,11 @@ index 220e39a..4b1e352 100644 CraftTask() { this(null, null, -1, -1); } -@@ -34,25 +34,12 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot +@@ -33,26 +33,12 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot + this(null, task, -1, -1); } - // Spigot start +- // Spigot start - public String timingName = null; - CraftTask(String timingName) { - this(timingName, null, null, -1, -1); @@ -987,7 +1054,7 @@ index 220e39a..4b1e352 100644 - this(timingName, null, task, -1, -1); - } - CraftTask(String timingName, final Plugin plugin, final Runnable task, final int id, final long period) { -+ CraftTask(final Plugin plugin, final Runnable task, final int id, final long period) { ++ CraftTask(final Plugin plugin, final Runnable task, final int id, final long period) { // Paper this.plugin = plugin; this.task = task; this.id = id; @@ -999,24 +1066,25 @@ index 220e39a..4b1e352 100644 - CraftTask(final Plugin plugin, final Runnable task, final int id, final long period) { - this(null, plugin, task, id, period); - // Spigot end -+ timings = task != null ? SpigotTimings.getPluginTaskTimings(this, period) : null; // Spigot ++ timings = task != null ? SpigotTimings.getPluginTaskTimings(this, period) : null; // Paper } public final int getTaskId() { -@@ -68,7 +55,9 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot +@@ -68,7 +54,9 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot } public void run() { -+ if (timings != null && isSync()) timings.startTiming(); // Spigot ++ if (timings != null && isSync()) timings.startTiming(); // Paper task.run(); -+ if (timings != null && isSync()) timings.stopTiming(); // Spigot ++ if (timings != null && isSync()) timings.stopTiming(); // Paper } long getPeriod() { -@@ -113,12 +102,4 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot +@@ -112,13 +100,4 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot + setPeriod(-2l); return true; } - +- - // Spigot start - public String getTaskName() { - if (timingName != null) { @@ -1027,142 +1095,30 @@ index 220e39a..4b1e352 100644 - // Spigot end } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftIconCache.java b/src/main/java/org/bukkit/craftbukkit/util/CraftIconCache.java -index e52ef47..bd0b887 100644 +index e52ef47..3d90b34 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftIconCache.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftIconCache.java @@ -5,6 +5,7 @@ import org.bukkit.util.CachedServerIcon; public class CraftIconCache implements CachedServerIcon { public final String value; -+ public String getData() { return value; } // Spigot ++ public String getData() { return value; } // Paper public CraftIconCache(final String value) { this.value = value; } diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java -index 5b0c64d..d3767d2 100644 +index df2fce7..4032dcb 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java -@@ -31,8 +31,8 @@ import net.minecraft.server.EntityWither; - import net.minecraft.server.MathHelper; - import net.minecraft.server.MinecraftServer; - import net.minecraft.server.World; +@@ -4,7 +4,7 @@ import java.util.List; + import java.util.Set; + + import net.minecraft.server.*; -import org.bukkit.craftbukkit.SpigotTimings; --import org.bukkit.entity.Creeper; +import co.aikar.timings.SpigotTimings; -+ public class ActivationRange { -diff --git a/src/main/java/org/spigotmc/AntiXray.java b/src/main/java/org/spigotmc/AntiXray.java -index 5466a61..c2ad90c 100644 ---- a/src/main/java/org/spigotmc/AntiXray.java -+++ b/src/main/java/org/spigotmc/AntiXray.java -@@ -7,6 +7,7 @@ import net.minecraft.server.BlockPosition; - import net.minecraft.server.Blocks; - import net.minecraft.server.World; - import org.bukkit.craftbukkit.util.CraftMagicNumbers; -+import co.aikar.timings.SpigotTimings; - - // PaperSpigot start - import java.util.HashSet; -@@ -16,9 +17,6 @@ import java.util.Set; - public class AntiXray - { - -- private static final CustomTimingsHandler update = new CustomTimingsHandler( "xray - update" ); -- private static final CustomTimingsHandler obfuscate = new CustomTimingsHandler( "xray - obfuscate" ); -- /*========================================================================*/ - // Used to keep track of which blocks to obfuscate - private final boolean[] obfuscateBlocks = new boolean[ Short.MAX_VALUE ]; - // Used to select a random replacement ore -@@ -86,9 +84,9 @@ public class AntiXray - return; - } - // PaperSpigot end -- update.startTiming(); -+ SpigotTimings.antiXrayUpdateTimer.startTiming(); - updateNearbyBlocks( world, position, 2, false ); // 2 is the radius, we shouldn't change it as that would make it exponentially slower -- update.stopTiming(); -+ SpigotTimings.antiXrayUpdateTimer.stopTiming(); - } - } - -@@ -100,9 +98,9 @@ public class AntiXray - { - if ( world.spigotConfig.antiXray ) - { -- obfuscate.startTiming(); -+ SpigotTimings.antiXrayObfuscateTimer.startTiming(); - obfuscate( chunkX, chunkY, bitmask, buffer, world ); -- obfuscate.stopTiming(); -+ SpigotTimings.antiXrayObfuscateTimer.stopTiming(); - } - } - -diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index f6a67d6..b9d185d 100644 ---- a/src/main/java/org/spigotmc/SpigotConfig.java -+++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -12,8 +12,10 @@ import java.util.HashSet; - import java.util.List; - import java.util.Map; - import java.util.Set; -+import java.util.concurrent.TimeUnit; - import java.util.logging.Level; - import gnu.trove.map.hash.TObjectIntHashMap; -+import com.google.common.collect.Lists; - import net.minecraft.server.AttributeRanged; - import net.minecraft.server.GenericAttributes; - import net.minecraft.server.MinecraftServer; -@@ -26,6 +28,8 @@ import org.bukkit.command.Command; - import org.bukkit.configuration.ConfigurationSection; - import org.bukkit.configuration.InvalidConfigurationException; - import org.bukkit.configuration.file.YamlConfiguration; -+import co.aikar.timings.Timings; -+import co.aikar.timings.TimingsManager; - - public class SpigotConfig - { -@@ -232,6 +236,39 @@ public class SpigotConfig - bungee = getBoolean( "settings.bungeecord", false ); - } - -+ private static void timings() -+ { -+ boolean timings = getBoolean( "timings.enabled", true ); -+ boolean verboseTimings = getBoolean( "timings.verbose", true ); -+ TimingsManager.privacy = getBoolean( "timings.server-name-privacy", false ); -+ TimingsManager.hiddenConfigs = getList( "timings.hidden-config-entries", Lists.newArrayList("database", "settings.bungeecord-addresses")); -+ int timingHistoryInterval = getInt( "timings.history-interval", 300 ); -+ int timingHistoryLength = getInt( "timings.history-length", 3600 ); -+ -+ -+ Timings.setVerboseTimingsEnabled( verboseTimings ); -+ Timings.setTimingsEnabled( timings ); -+ Timings.setHistoryInterval( timingHistoryInterval * 20 ); -+ Timings.setHistoryLength( timingHistoryLength * 20 ); -+ -+ Bukkit.getLogger().log( Level.INFO, "Spigot Timings: " + timings + -+ " - Verbose: " + verboseTimings + -+ " - Interval: " + timeSummary(Timings.getHistoryInterval() / 20) + -+ " - Length: " + timeSummary(Timings.getHistoryLength() / 20)); -+ } -+ protected static String timeSummary(int seconds) { -+ String time = ""; -+ if (seconds > 60*60) { -+ time += TimeUnit.SECONDS.toHours(seconds) + "h"; -+ seconds /= 60; -+ } -+ -+ if (seconds > 0) { -+ time += TimeUnit.SECONDS.toMinutes(seconds) + "m"; -+ } -+ return time; -+ } -+ - private static void nettyThreads() - { - int count = getInt( "settings.netty-threads", 4 ); -- -2.7.1 +2.7.2 diff --git a/Spigot-Server-Patches/0059-Configurable-mob-spawner-tick-rate.patch b/Spigot-Server-Patches/0059-Configurable-mob-spawner-tick-rate.patch deleted file mode 100644 index 942bdc1a77..0000000000 --- a/Spigot-Server-Patches/0059-Configurable-mob-spawner-tick-rate.patch +++ /dev/null @@ -1,69 +0,0 @@ -From faf83e8f660a77386fd15533e3031bf6734ad1b3 Mon Sep 17 00:00:00 2001 -From: Sudzzy -Date: Tue, 14 Jul 2015 09:58:15 -0700 -Subject: [PATCH] Configurable mob spawner tick rate - - -diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -index ebd1e36..d4674dc 100644 ---- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -@@ -25,6 +25,7 @@ public abstract class MobSpawnerAbstract { - private int maxNearbyEntities = 6; - private int requiredPlayerRange = 16; - private int spawnRange = 4; -+ private int tickDelay = 0; // PaperSpigot - - public MobSpawnerAbstract() {} - -@@ -56,6 +57,10 @@ public abstract class MobSpawnerAbstract { - } - - public void c() { -+ // PaperSpigot start - Configurable mob spawner tick rate -+ if (spawnDelay > 0 && --tickDelay > 0) return; -+ tickDelay = this.a().paperSpigotConfig.mobSpawnerTickRate; -+ // PaperSpigot end - if (this.g()) { - BlockPosition blockposition = this.b(); - double d0; -@@ -68,18 +73,18 @@ public abstract class MobSpawnerAbstract { - this.a().addParticle(EnumParticle.SMOKE_NORMAL, d1, d2, d0, 0.0D, 0.0D, 0.0D, new int[0]); - this.a().addParticle(EnumParticle.FLAME, d1, d2, d0, 0.0D, 0.0D, 0.0D, new int[0]); - if (this.spawnDelay > 0) { -- --this.spawnDelay; -+ this.spawnDelay -= tickDelay; // PaperSpigot - } - - this.f = this.e; - this.e = (this.e + (double) (1000.0F / ((float) this.spawnDelay + 200.0F))) % 360.0D; - } else { -- if (this.spawnDelay == -1) { -+ if (this.spawnDelay < -tickDelay) { // PaperSpigot - this.h(); - } - - if (this.spawnDelay > 0) { -- --this.spawnDelay; -+ this.spawnDelay -= tickDelay; // PaperSpigot - return; - } - -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index 469b620..8247aef 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -352,4 +352,10 @@ public class PaperSpigotWorldConfig - { - disableMoodSounds = getBoolean( "disable-mood-sounds", false ); - } -+ -+ public int mobSpawnerTickRate; -+ private void mobSpawnerTickRate() -+ { -+ mobSpawnerTickRate = getInt( "mob-spawner-tick-rate", 1 ); -+ } - } --- -2.7.0 - diff --git a/Spigot-Server-Patches/0059-Disable-chest-cat-detection.patch b/Spigot-Server-Patches/0059-Disable-chest-cat-detection.patch new file mode 100644 index 0000000000..2c4463afd1 --- /dev/null +++ b/Spigot-Server-Patches/0059-Disable-chest-cat-detection.patch @@ -0,0 +1,39 @@ +From 85d076e03a5d9c6f725fed6d4e519d826bc953cd Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Thu, 3 Mar 2016 01:13:45 -0600 +Subject: [PATCH] Disable chest cat detection + + +diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index 6ab8d0e..d862fd9 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -244,4 +244,9 @@ public class PaperWorldConfig { + private void containerUpdateTickRate() { + containerUpdateTickRate = getInt("container-update-tick-rate", 1); + } ++ ++ public boolean disableChestCatDetection; ++ private void disableChestCatDetection() { ++ disableChestCatDetection = getBoolean("game-mechanics.disable-chest-cat-detection", false); ++ } + } +diff --git a/src/main/java/net/minecraft/server/BlockChest.java b/src/main/java/net/minecraft/server/BlockChest.java +index 7d27317..ed8d1df 100644 +--- a/src/main/java/net/minecraft/server/BlockChest.java ++++ b/src/main/java/net/minecraft/server/BlockChest.java +@@ -392,6 +392,11 @@ public class BlockChest extends BlockTileEntity { + } + + private boolean j(World world, BlockPosition blockposition) { ++ // Paper start - Option ti dsiable chest cat detection ++ if (world.paperConfig.disableChestCatDetection) { ++ return false; ++ } ++ // Paper end + Iterator iterator = world.a(EntityOcelot.class, new AxisAlignedBB((double) blockposition.getX(), (double) (blockposition.getY() + 1), (double) blockposition.getZ(), (double) (blockposition.getX() + 1), (double) (blockposition.getY() + 2), (double) (blockposition.getZ() + 1))).iterator(); + + EntityOcelot entityocelot; +-- +2.7.2 + diff --git a/Spigot-Server-Patches/0081-Ensure-commands-are-not-ran-async.patch b/Spigot-Server-Patches/0060-Ensure-commands-are-not-ran-async.patch similarity index 89% rename from Spigot-Server-Patches/0081-Ensure-commands-are-not-ran-async.patch rename to Spigot-Server-Patches/0060-Ensure-commands-are-not-ran-async.patch index 250bb600e0..e566fcf038 100644 --- a/Spigot-Server-Patches/0081-Ensure-commands-are-not-ran-async.patch +++ b/Spigot-Server-Patches/0060-Ensure-commands-are-not-ran-async.patch @@ -1,6 +1,6 @@ -From 3228daa638da4a8f5f70ad49d57ab2c84f555e10 Mon Sep 17 00:00:00 2001 +From 8fbd7be5a61295bdb939a4a5f6eb8b7f9d0ba349 Mon Sep 17 00:00:00 2001 From: Aikar -Date: Wed, 8 Oct 2014 19:51:28 -0400 +Date: Thu, 3 Mar 2016 01:17:12 -0600 Subject: [PATCH] Ensure commands are not ran async Plugins calling Player.chat("/foo") or Server.dispatchCommand() could @@ -14,14 +14,14 @@ big slowdown in execution but throwing an exception at same time to raise awaren that it is happening so that plugin authors can fix their code to stop executing commands async. diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 1138042..4391ad7 100644 +index 0388f6d..15c9827 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1079,6 +1079,29 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList +@@ -1217,6 +1217,29 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { } if (!async && s.startsWith("/")) { -+ // PaperSpigot Start ++ // Paper Start + if (!org.bukkit.Bukkit.isPrimaryThread()) { + final String fCommandLine = s; + MinecraftServer.LOGGER.log(org.apache.logging.log4j.Level.ERROR, "Command Dispatched Async: " + fCommandLine); @@ -43,19 +43,19 @@ index 1138042..4391ad7 100644 + throw new RuntimeException("Exception processing chat command", e.getCause()); + } + } -+ // PaperSpigot End ++ // Paper End this.handleCommand(s); } else if (this.player.getChatFlags() == EntityHuman.EnumChatVisibility.SYSTEM) { // Do nothing, this is coming from a plugin diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 97f9f96..a54b3e8 100644 +index b27d95a..5a24d38 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -639,6 +639,29 @@ public final class CraftServer implements Server { +@@ -642,6 +642,29 @@ public final class CraftServer implements Server { Validate.notNull(sender, "Sender cannot be null"); Validate.notNull(commandLine, "CommandLine cannot be null"); -+ // PaperSpigot Start ++ // Paper Start + if (!Bukkit.isPrimaryThread()) { + final CommandSender fSender = sender; + final String fCommandLine = commandLine; @@ -76,11 +76,11 @@ index 97f9f96..a54b3e8 100644 + throw new RuntimeException("Exception processing dispatch command", e.getCause()); + } + } -+ // PaperSpigot End ++ // Paper End + if (commandMap.dispatch(sender, commandLine)) { return true; } -- -2.7.0.windows.2 +2.7.2 diff --git a/Spigot-Server-Patches/0060-Optimize-getCubes.patch b/Spigot-Server-Patches/0060-Optimize-getCubes.patch deleted file mode 100644 index 783505ca39..0000000000 --- a/Spigot-Server-Patches/0060-Optimize-getCubes.patch +++ /dev/null @@ -1,45 +0,0 @@ -From ad9631fe4ee824d1e2443306f6df0d782aea44cb Mon Sep 17 00:00:00 2001 -From: Byteflux -Date: Tue, 14 Jul 2015 10:03:45 -0700 -Subject: [PATCH] Optimize getCubes() - - -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 64713bd..08041af 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -1166,11 +1166,12 @@ public abstract class World implements IBlockAccess { - int cx = chunkx << 4; - for ( int chunkz = ( i1 >> 4 ); chunkz <= ( ( j1 - 1 ) >> 4 ); chunkz++ ) - { -- if ( !this.isChunkLoaded( chunkx, chunkz, true ) ) -+ Chunk chunk = this.getChunkIfLoaded( chunkx, chunkz ); -+ if ( chunk == null ) - { - // PaperSpigot start - if (entity.loadChunks) { -- ((ChunkProviderServer) entity.world.chunkProvider).getChunkAt(chunkx, chunkz); -+ chunk = ((ChunkProviderServer) entity.world.chunkProvider).getChunkAt(chunkx, chunkz); - } else { - entity.inUnloadedChunk = true; // PaperSpigot - Remove entities in unloaded chunks - continue; -@@ -1178,7 +1179,6 @@ public abstract class World implements IBlockAccess { - // PaperSpigot end - } - int cz = chunkz << 4; -- Chunk chunk = this.getChunkAt( chunkx, chunkz ); - // Compute ranges within chunk - int xstart = ( i < cx ) ? cx : i; - int xend = ( j < ( cx + 16 ) ) ? j : ( cx + 16 ); -@@ -1225,6 +1225,8 @@ public abstract class World implements IBlockAccess { - } - // Spigot end - -+ if (entity instanceof EntityItem) return arraylist; // PaperSpigot - Optimize item movement -+ - double d0 = 0.25D; - List list = this.getEntities(entity, axisalignedbb.grow(d0, d0, d0)); - --- -2.6.1.windows.1 - diff --git a/Spigot-Server-Patches/0061-All-chunks-are-slime-spawn-chunks-toggle.patch b/Spigot-Server-Patches/0061-All-chunks-are-slime-spawn-chunks-toggle.patch new file mode 100644 index 0000000000..bf03464023 --- /dev/null +++ b/Spigot-Server-Patches/0061-All-chunks-are-slime-spawn-chunks-toggle.patch @@ -0,0 +1,37 @@ +From b2383cbb3d8efca11ce977cc2d13cb8826279af1 Mon Sep 17 00:00:00 2001 +From: vemacs +Date: Thu, 3 Mar 2016 01:19:22 -0600 +Subject: [PATCH] All chunks are slime spawn chunks toggle + + +diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index d862fd9..ed520d0 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -249,4 +249,9 @@ public class PaperWorldConfig { + private void disableChestCatDetection() { + disableChestCatDetection = getBoolean("game-mechanics.disable-chest-cat-detection", false); + } ++ ++ public boolean allChunksAreSlimeChunks; ++ private void allChunksAreSlimeChunks() { ++ allChunksAreSlimeChunks = getBoolean("all-chunks-are-slime-chunks", false); ++ } + } +diff --git a/src/main/java/net/minecraft/server/EntitySlime.java b/src/main/java/net/minecraft/server/EntitySlime.java +index cb92686..645082d 100644 +--- a/src/main/java/net/minecraft/server/EntitySlime.java ++++ b/src/main/java/net/minecraft/server/EntitySlime.java +@@ -243,7 +243,8 @@ public class EntitySlime extends EntityInsentient implements IMonster { + return super.cF(); + } + +- if (this.random.nextInt(10) == 0 && chunk.a(987234911L).nextInt(10) == 0 && this.locY < 40.0D) { ++ boolean isSlimeChunk = world.paperConfig.allChunksAreSlimeChunks || chunk.a(987234911L).nextInt(10) == 0; ++ if (this.random.nextInt(10) == 0 && isSlimeChunk && this.locY < 40.0D) { + return super.cF(); + } + } +-- +2.7.2 + diff --git a/Spigot-Server-Patches/0061-ChunkMap-caching.patch b/Spigot-Server-Patches/0061-ChunkMap-caching.patch deleted file mode 100644 index 1f93ece43b..0000000000 --- a/Spigot-Server-Patches/0061-ChunkMap-caching.patch +++ /dev/null @@ -1,140 +0,0 @@ -From 915587ce38bd3ddc6843111678206ccc2bce8e25 Mon Sep 17 00:00:00 2001 -From: Iceee -Date: Wed, 15 Jul 2015 02:41:12 -0700 -Subject: [PATCH] ChunkMap caching - - -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 5a3b22a..7efacfa 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -50,6 +50,49 @@ public class Chunk { - public long lightUpdateTime; - // PaperSpigot end - -+ // PaperSpigot start - ChunkMap caching -+ private PacketPlayOutMapChunk.ChunkMap chunkMap; -+ private int emptySectionBits; -+ -+ public PacketPlayOutMapChunk.ChunkMap getChunkMap(boolean groundUpContinuous, int primaryBitMask) { -+ if (!world.paperSpigotConfig.cacheChunkMaps || !groundUpContinuous || (primaryBitMask != 0 && primaryBitMask != '\uffff')) { -+ return PacketPlayOutMapChunk.a(this, groundUpContinuous, !world.worldProvider.o(), primaryBitMask); -+ } -+ -+ if (primaryBitMask == 0) { -+ PacketPlayOutMapChunk.ChunkMap chunkMap = new PacketPlayOutMapChunk.ChunkMap(); -+ chunkMap.a = new byte[0]; -+ return chunkMap; -+ } -+ -+ boolean isDirty = false; -+ for (int i = 0; i < sections.length; ++i) { -+ ChunkSection section = sections[i]; -+ if (section == null) { -+ if ((emptySectionBits & (1 << i)) == 0) { -+ isDirty = true; -+ emptySectionBits |= (1 << i); -+ } -+ } else { -+ if ((emptySectionBits & (1 << i)) == 1) { -+ isDirty = true; -+ emptySectionBits &= ~(1 << i); -+ section.isDirty = false; -+ } else if (section.isDirty) { -+ isDirty = true; -+ section.isDirty = false; -+ } -+ } -+ } -+ -+ if (isDirty || chunkMap == null) { -+ chunkMap = PacketPlayOutMapChunk.a(this, true, !world.worldProvider.o(), '\uffff'); -+ } -+ -+ return chunkMap; -+ } -+ // PaperSpigot end -+ - // CraftBukkit start - Neighbor loaded cache for chunk lighting and entity ticking - private int neighbors = 0x1 << 12; - -diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java -index f734ab0..907c57b 100644 ---- a/src/main/java/net/minecraft/server/ChunkSection.java -+++ b/src/main/java/net/minecraft/server/ChunkSection.java -@@ -8,6 +8,7 @@ public class ChunkSection { - private char[] blockIds; - private NibbleArray emittedLight; - private NibbleArray skyLight; -+ boolean isDirty; // PaperSpigot - - public ChunkSection(int i, boolean flag) { - this.yPos = i; -@@ -57,6 +58,7 @@ public class ChunkSection { - } - - this.blockIds[j << 8 | k << 4 | i] = (char) Block.d.b(iblockdata); -+ isDirty = true; // PaperSpigot - } - - public Block b(int i, int j, int k) { -@@ -83,6 +85,7 @@ public class ChunkSection { - - public void a(int i, int j, int k, int l) { - this.skyLight.a(i, j, k, l); -+ isDirty = true; // PaperSpigot - } - - public int d(int i, int j, int k) { -@@ -91,6 +94,7 @@ public class ChunkSection { - - public void b(int i, int j, int k, int l) { - this.emittedLight.a(i, j, k, l); -+ isDirty = true; // PaperSpigot - } - - public int e(int i, int j, int k) { -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -index 58c0275..a0021fb 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -@@ -18,7 +18,7 @@ public class PacketPlayOutMapChunk implements Packet { - this.a = chunk.locX; - this.b = chunk.locZ; - this.d = flag; -- this.c = a(chunk, flag, !chunk.getWorld().worldProvider.o(), i); -+ this.c = chunk.getChunkMap(flag, i); // PaperSpigot - chunk.world.spigotConfig.antiXrayInstance.obfuscateSync(chunk.locX, chunk.locZ, c.b, c.a, chunk.world); - } - -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java -index 10c0e34..00c0538 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java -@@ -23,7 +23,7 @@ public class PacketPlayOutMapChunkBulk implements Packet - - for (int j = 0; j < i; ++j) { - Chunk chunk = (Chunk) list.get(j); -- PacketPlayOutMapChunk.ChunkMap packetplayoutmapchunk_chunkmap = PacketPlayOutMapChunk.a(chunk, true, this.d, '\uffff'); -+ PacketPlayOutMapChunk.ChunkMap packetplayoutmapchunk_chunkmap = chunk.getChunkMap(true, '\uffff'); // PaperSpigot - - this.a[j] = chunk.locX; - this.b[j] = chunk.locZ; -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index 8247aef..54f432d 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -358,4 +358,10 @@ public class PaperSpigotWorldConfig - { - mobSpawnerTickRate = getInt( "mob-spawner-tick-rate", 1 ); - } -+ -+ public boolean cacheChunkMaps; -+ private void cacheChunkMaps() -+ { -+ cacheChunkMaps = getBoolean( "cache-chunk-maps", false ); -+ } - } --- -2.7.0 - diff --git a/Spigot-Server-Patches/0085-Add-Location-support-to-tab-completers-vanilla-featu.patch b/Spigot-Server-Patches/0062-Add-Location-support-to-tab-completers-vanilla-featu.patch similarity index 58% rename from Spigot-Server-Patches/0085-Add-Location-support-to-tab-completers-vanilla-featu.patch rename to Spigot-Server-Patches/0062-Add-Location-support-to-tab-completers-vanilla-featu.patch index 3b985f896a..4d25af51a2 100644 --- a/Spigot-Server-Patches/0085-Add-Location-support-to-tab-completers-vanilla-featu.patch +++ b/Spigot-Server-Patches/0062-Add-Location-support-to-tab-completers-vanilla-featu.patch @@ -1,45 +1,71 @@ -From 80b20092e304d27660bf79623f9187c93cf28984 Mon Sep 17 00:00:00 2001 +From b55b954c4db1cb750cc40bb2d84b6e104d8fdec4 Mon Sep 17 00:00:00 2001 From: DemonWav -Date: Sat, 30 Jan 2016 19:17:19 -0600 +Date: Thu, 3 Mar 2016 01:44:39 -0600 Subject: [PATCH] Add Location support to tab completers (vanilla feature missing in CraftBukkit) +diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index ed520d0..50fc4a0 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -254,4 +254,9 @@ public class PaperWorldConfig { + private void allChunksAreSlimeChunks() { + allChunksAreSlimeChunks = getBoolean("all-chunks-are-slime-chunks", false); + } ++ ++ public boolean allowBlockLocationTabCompletion; ++ private void allowBlockLocationTabCompletion() { ++ allowBlockLocationTabCompletion = getBoolean("allow-block-location-tab-completion", true); ++ } + } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index ee09922..b400ce0 100644 +index cf5dbd5..1f9d56f 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1153,7 +1153,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs +@@ -1146,7 +1146,7 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs return arraylist; } */ -- return server.tabComplete(icommandlistener, s); -+ return server.tabComplete(icommandlistener, s, blockposition); // PaperSpigot - add Location argument +- return server.tabComplete(icommandlistener, s); // PAIL : todo args ++ return server.tabComplete(icommandlistener, s, blockposition); // PAIL : todo args // Paper - add Location arg // CraftBukkit end } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index a54b3e8..642880e 100644 +index 5a24d38..8073c20 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -29,6 +29,7 @@ import org.bukkit.BanList; - import org.bukkit.Bukkit; - import org.bukkit.ChatColor; - import org.bukkit.GameMode; -+import org.bukkit.Location; - import org.bukkit.OfflinePlayer; - import org.bukkit.Server; - import org.bukkit.UnsafeValues; -@@ -1597,21 +1598,38 @@ public final class CraftServer implements Server { +@@ -25,17 +25,11 @@ import javax.imageio.ImageIO; + + import net.minecraft.server.*; + +-import org.bukkit.BanList; +-import org.bukkit.Bukkit; +-import org.bukkit.ChatColor; +-import org.bukkit.GameMode; +-import org.bukkit.OfflinePlayer; +-import org.bukkit.Server; +-import org.bukkit.UnsafeValues; ++import net.minecraft.server.WorldType; ++import org.bukkit.*; + import org.bukkit.Warning.WarningState; + import org.bukkit.World; + import org.bukkit.World.Environment; +-import org.bukkit.WorldCreator; + import org.bukkit.boss.BarColor; + import org.bukkit.boss.BarFlag; + import org.bukkit.boss.BarStyle; +@@ -1602,21 +1596,38 @@ public final class CraftServer implements Server { } public List tabComplete(net.minecraft.server.ICommandListener sender, String message) { -+ return tabComplete(sender, message, null); // PaperSpigot - location tab-completes. Original code here moved below ++ return tabComplete(sender, message, null); // Paper - location tab-completes. Original code here moved below + } + -+ // PaperSpigot start - add BlockPosition support ++ // Paper start - add BlockPosition support + /* -+ this code is copied, except for the noted change, from the original tabComplete(net.minecraft.server.ICommandListener sender, String message) method ++ this code is copied, except for the noted change, from the original tabComplete(net.minecraft.server.ICommandListener sender, String message) method + */ + public List tabComplete(net.minecraft.server.ICommandListener sender, String message, BlockPosition blockPosition) { if (!(sender instanceof EntityPlayer)) { @@ -53,16 +79,16 @@ index a54b3e8..642880e 100644 } else { return tabCompleteChat(player, message); } ++ // Paper end } -+ // PaperSpigot end public List tabCompleteCommand(Player player, String message) { -+ return tabCompleteCommand(player, message, null); // PaperSpigot - location tab-completes. Original code here moved below ++ return tabCompleteCommand(player, message, null); // Paper - location tab-completes. Original code here moved below + } + -+ // PaperSpigot start - add BlockPosition support ++ // Paper start - add BlockPosition support + /* -+ this code is copied, except for the noted change, from the original tabCompleteCommand(Player player, String message) method ++ this code is copied, except for the noted change, from the original tabComplete(net.minecraft.server.ICommandListener sender, String message) method + */ + public List tabCompleteCommand(Player player, String message, BlockPosition blockPosition) { // Spigot Start @@ -71,31 +97,24 @@ index a54b3e8..642880e 100644 { return ImmutableList.of(); } -@@ -1619,7 +1637,13 @@ public final class CraftServer implements Server { +@@ -1624,7 +1635,14 @@ public final class CraftServer implements Server { List completions = null; try { - completions = getCommandMap().tabComplete(player, message.substring(1)); -+ // send location info if present ++ // send location info if presen + // completions = getCommandMap().tabComplete(player, message.substring(1)); -+ if (blockPosition == null || !((CraftWorld) player.getWorld()).getHandle().paperSpigotConfig.allowBlockLocationTabCompletion) { ++ if (blockPosition == null || !((CraftWorld) player.getWorld()).getHandle().paperConfig.allowBlockLocationTabCompletion) { + completions = getCommandMap().tabComplete(player, message.substring(1)); + } else { + completions = getCommandMap().tabComplete(player, message.substring(1), new Location(player.getWorld(), blockPosition.getX(), blockPosition.getY(), blockPosition.getZ())); + } ++ // Paper end } catch (CommandException ex) { player.sendMessage(ChatColor.RED + "An internal error occurred while attempting to tab-complete this command"); getLogger().log(Level.SEVERE, "Exception when " + player.getName() + " attempted to tab complete " + message, ex); -@@ -1627,6 +1651,7 @@ public final class CraftServer implements Server { - - return completions == null ? ImmutableList.of() : completions; - } -+ // PaperSpigot end - - public List tabCompleteChat(Player player, String message) { - List completions = new ArrayList(); diff --git a/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java b/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java -index de788d6..db46eb0 100644 +index 100d84a..a40218c 100644 --- a/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java +++ b/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java @@ -7,6 +7,7 @@ import net.minecraft.server.*; @@ -106,48 +125,31 @@ index de788d6..db46eb0 100644 import org.bukkit.command.BlockCommandSender; import org.bukkit.command.CommandSender; import org.bukkit.command.ConsoleCommandSender; -@@ -46,11 +47,25 @@ public final class VanillaCommandWrapper extends VanillaCommand { +@@ -46,10 +47,23 @@ public final class VanillaCommandWrapper extends VanillaCommand { @Override public List tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException { -+ return tabComplete(sender, alias, args, null); // PaperSpigot - location tab-completes. Original code moved below ++ return tabComplete(sender, alias, args, null); // Paper - location tab-completes. Original code moved below + } + -+ // PaperSpigot start - location tab-completes ++ // Paper start - location tab-completes + /* -+ this code is copied, except for the noted change, from the original tabComplete(CommandSender sender, String alias, String[] args) method ++ this code is copied, except for the noted change, from the original tabComplete(CommandSender sender, String alias, String[] args) method + */ + @Override + public List tabComplete(CommandSender sender, String alias, String[] args, Location location) throws IllegalArgumentException { Validate.notNull(sender, "Sender cannot be null"); Validate.notNull(args, "Arguments cannot be null"); Validate.notNull(alias, "Alias cannot be null"); -- return (List) vanillaCommand.tabComplete(getListener(sender), args, new BlockPosition(0, 0, 0)); +- return (List) vanillaCommand.tabComplete(MinecraftServer.getServer(), getListener(sender), args, new BlockPosition(0, 0, 0)); + if (location == null) { // PaperSpigot use location information if available -+ return (List) vanillaCommand.tabComplete(getListener(sender), args, new BlockPosition(0, 0, 0)); ++ return (List) vanillaCommand.tabComplete(MinecraftServer.getServer(), getListener(sender), args, new BlockPosition(0, 0, 0)); + } else { -+ return (List) vanillaCommand.tabComplete(getListener(sender), args, new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ())); ++ return (List) vanillaCommand.tabComplete(MinecraftServer.getServer(), getListener(sender), args, new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ())); + } } -+ // PaperSpigot end public static CommandSender lastSender = null; // Nasty :( - -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index 00057a1..c3c374d 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -390,4 +390,10 @@ public class PaperSpigotWorldConfig - { - allChunksAreSlimeChunks = getBoolean( "all-chunks-are-slime-chunks", false ); - } -+ -+ public boolean allowBlockLocationTabCompletion; -+ private void allowBlockLocationTabCompletion() -+ { -+ allowBlockLocationTabCompletion = getBoolean( "allow-block-location-tab-completion", true ); -+ } - } -- -2.7.1 +2.7.2 diff --git a/Spigot-Server-Patches/0063-Made-EntityDismountEvent-Cancellable.patch b/Spigot-Server-Patches/0063-Made-EntityDismountEvent-Cancellable.patch new file mode 100644 index 0000000000..d88d7d68ed --- /dev/null +++ b/Spigot-Server-Patches/0063-Made-EntityDismountEvent-Cancellable.patch @@ -0,0 +1,34 @@ +From 5c18f5c1534e3aa5152cbc64360cabecd1797e66 Mon Sep 17 00:00:00 2001 +From: Nik Gil +Date: Thu, 3 Mar 2016 01:50:54 -0600 +Subject: [PATCH] Made EntityDismountEvent Cancellable + + +diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +index d10fd67..4b66c59 100644 +--- a/src/main/java/net/minecraft/server/Entity.java ++++ b/src/main/java/net/minecraft/server/Entity.java +@@ -38,6 +38,7 @@ import org.bukkit.craftbukkit.event.CraftEventFactory; + import org.bukkit.event.entity.EntityCombustEvent; + import org.bukkit.event.entity.EntityPortalEvent; + import org.bukkit.plugin.PluginManager; ++import org.spigotmc.event.entity.EntityDismountEvent; + // CraftBukkit end + + public abstract class Entity implements ICommandListener { +@@ -1734,7 +1735,11 @@ public abstract class Entity implements ICommandListener { + } + } + // CraftBukkit end +- Bukkit.getPluginManager().callEvent( new org.spigotmc.event.entity.EntityDismountEvent( this.getBukkitEntity(), entity.getBukkitEntity() ) ); // Spigot ++ // Paper start - make EntityDismountEvent cancellable ++ EntityDismountEvent dismountEvent = new EntityDismountEvent(this.getBukkitEntity(), entity.getBukkitEntity()); // Spigot ++ Bukkit.getPluginManager().callEvent(dismountEvent); ++ if (dismountEvent.isCancelled()) return; ++ // Paper end + this.passengers.remove(entity); + entity.j = 60; + } +-- +2.7.2 + diff --git a/Spigot-Server-Patches/0063-Optimize-Spigot-s-Anti-X-Ray.patch b/Spigot-Server-Patches/0063-Optimize-Spigot-s-Anti-X-Ray.patch deleted file mode 100644 index c43c2cc5d2..0000000000 --- a/Spigot-Server-Patches/0063-Optimize-Spigot-s-Anti-X-Ray.patch +++ /dev/null @@ -1,88 +0,0 @@ -From 90cfceb6acf7723815e95fee4f9f6a24277bae50 Mon Sep 17 00:00:00 2001 -From: Iceee -Date: Thu, 23 Apr 2015 17:26:21 -0400 -Subject: [PATCH] Optimize Spigot's Anti X-Ray - - -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 06c7057..fb16a8a 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -252,6 +252,7 @@ public class WorldServer extends World implements IAsyncTaskHandler { - timings.doTickTiles.startTiming(); // Spigot - this.h(); - timings.doTickTiles.stopTiming(); // Spigot -+ spigotConfig.antiXrayInstance.flushUpdates(this); // PaperSpigot - this.methodProfiler.c("chunkMap"); - timings.doChunkMap.startTiming(); // Spigot - this.manager.flush(); -diff --git a/src/main/java/org/spigotmc/AntiXray.java b/src/main/java/org/spigotmc/AntiXray.java -index 7221b50..5466a61 100644 ---- a/src/main/java/org/spigotmc/AntiXray.java -+++ b/src/main/java/org/spigotmc/AntiXray.java -@@ -8,6 +8,11 @@ import net.minecraft.server.Blocks; - import net.minecraft.server.World; - import org.bukkit.craftbukkit.util.CraftMagicNumbers; - -+// PaperSpigot start -+import java.util.HashSet; -+import java.util.Set; -+// PaperSpigot end -+ - public class AntiXray - { - -@@ -18,6 +23,10 @@ public class AntiXray - private final boolean[] obfuscateBlocks = new boolean[ Short.MAX_VALUE ]; - // Used to select a random replacement ore - private final byte[] replacementOres; -+ // PaperSpigot start -+ public boolean queueUpdates = true; -+ public final Set pendingUpdates = new HashSet(); -+ // PaperSpigot end - - public AntiXray(SpigotWorldConfig config) - { -@@ -44,6 +53,25 @@ public class AntiXray - } - - /** -+ * PaperSpigot - Flush queued block updates for world. -+ */ -+ public void flushUpdates(World world) -+ { -+ if ( world.spigotConfig.antiXray && !pendingUpdates.isEmpty() ) -+ { -+ queueUpdates = false; -+ -+ for ( BlockPosition position : pendingUpdates ) -+ { -+ updateNearbyBlocks( world, position ); -+ } -+ -+ pendingUpdates.clear(); -+ queueUpdates = true; -+ } -+ } -+ -+ /** - * Starts the timings handler, then updates all blocks within the set radius - * of the given coordinate, revealing them if they are hidden ores. - */ -@@ -51,6 +79,13 @@ public class AntiXray - { - if ( world.spigotConfig.antiXray ) - { -+ // PaperSpigot start -+ if ( queueUpdates ) -+ { -+ pendingUpdates.add( position ); -+ return; -+ } -+ // PaperSpigot end - update.startTiming(); - updateNearbyBlocks( world, position, 2, false ); // 2 is the radius, we shouldn't change it as that would make it exponentially slower - update.stopTiming(); --- -2.6.0 - diff --git a/Spigot-Server-Patches/0064-Add-BeaconEffectEvent.patch b/Spigot-Server-Patches/0064-Add-BeaconEffectEvent.patch deleted file mode 100644 index 17365a6455..0000000000 --- a/Spigot-Server-Patches/0064-Add-BeaconEffectEvent.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 6acc3fe86bba094e83297ba49c93452aa01cd4d1 Mon Sep 17 00:00:00 2001 -From: Byteflux -Date: Thu, 23 Apr 2015 17:26:21 -0400 -Subject: [PATCH] Add BeaconEffectEvent - - -diff --git a/src/main/java/net/minecraft/server/TileEntityBeacon.java b/src/main/java/net/minecraft/server/TileEntityBeacon.java -index 4f280dd..f4717af 100644 ---- a/src/main/java/net/minecraft/server/TileEntityBeacon.java -+++ b/src/main/java/net/minecraft/server/TileEntityBeacon.java -@@ -10,6 +10,14 @@ import org.bukkit.craftbukkit.entity.CraftHumanEntity; - import org.bukkit.entity.HumanEntity; - // CraftBukkit end - -+// PaperSpigot start -+import org.bukkit.craftbukkit.event.CraftEventFactory; -+import org.bukkit.entity.Player; -+import org.bukkit.potion.PotionEffect; -+import org.bukkit.potion.PotionEffectType; -+import org.github.paperspigot.event.block.BeaconEffectEvent; -+// PaperSpigot end -+ - public class TileEntityBeacon extends TileEntityContainer implements IUpdatePlayerListBox, IInventory { - - public static final MobEffectList[][] a = new MobEffectList[][] { { MobEffectList.FASTER_MOVEMENT, MobEffectList.FASTER_DIG}, { MobEffectList.RESISTANCE, MobEffectList.JUMP}, { MobEffectList.INCREASE_DAMAGE}, { MobEffectList.REGENERATION}}; -@@ -76,18 +84,35 @@ public class TileEntityBeacon extends TileEntityContainer implements IUpdatePlay - Iterator iterator = list.iterator(); - - EntityHuman entityhuman; -+ // PaperSpigot start -+ org.bukkit.block.Block block = world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ()); -+ PotionEffect primaryEffect = new PotionEffect(PotionEffectType.getById(this.k), 180, b0, true, true); -+ // PaperSpigot end - - while (iterator.hasNext()) { - entityhuman = (EntityHuman) iterator.next(); -- entityhuman.addEffect(new MobEffect(this.k, 180, b0, true, true)); -+ // PaperSpigot start - BeaconEffectEvent -+ BeaconEffectEvent event = new BeaconEffectEvent(block, primaryEffect, (Player) entityhuman.getBukkitEntity(), true); -+ if (CraftEventFactory.callEvent(event).isCancelled()) continue; -+ -+ PotionEffect effect = event.getEffect(); -+ entityhuman.addEffect(new MobEffect(effect.getType().getId(), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles())); -+ // PaperSpigot end - } - - if (this.j >= 4 && this.k != this.l && this.l > 0) { - iterator = list.iterator(); -+ PotionEffect secondaryEffect = new PotionEffect(PotionEffectType.getById(this.l), 180, 0, true, true); // PaperSpigot - - while (iterator.hasNext()) { - entityhuman = (EntityHuman) iterator.next(); -- entityhuman.addEffect(new MobEffect(this.l, 180, 0, true, true)); -+ // PaperSpigot start - BeaconEffectEvent -+ BeaconEffectEvent event = new BeaconEffectEvent(block, secondaryEffect, (Player) entityhuman.getBukkitEntity(), false); -+ if (CraftEventFactory.callEvent(event).isCancelled()) continue; -+ -+ PotionEffect effect = event.getEffect(); -+ entityhuman.addEffect(new MobEffect(effect.getType().getId(), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles())); -+ // PaperSpigot end - } - } - } --- -2.6.0 - diff --git a/Spigot-Server-Patches/0064-Optimize-Pathfinding.patch b/Spigot-Server-Patches/0064-Optimize-Pathfinding.patch new file mode 100644 index 0000000000..9cc1226f85 --- /dev/null +++ b/Spigot-Server-Patches/0064-Optimize-Pathfinding.patch @@ -0,0 +1,51 @@ +From 256441becb43b3929f3c9eb8c4f74853e3540465 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Thu, 3 Mar 2016 02:02:07 -0600 +Subject: [PATCH] Optimize Pathfinding + +Prevents pathfinding from spamming failures for things such as +arrow attacks. + +diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java +index 2f4265a..7d794b9 100644 +--- a/src/main/java/net/minecraft/server/NavigationAbstract.java ++++ b/src/main/java/net/minecraft/server/NavigationAbstract.java +@@ -118,10 +118,26 @@ public abstract class NavigationAbstract { + } + + public boolean a(Entity entity, double d0) { ++ // Paper start - Pathfinding optimizations ++ if (this.pathfindFailures > 10 && this.c == null && MinecraftServer.currentTick < this.lastFailure + 40) { ++ return false; ++ } ++ + PathEntity pathentity = this.a(entity); + +- return pathentity != null ? this.a(pathentity, d0) : false; ++ if (pathentity != null && this.a(pathentity, d0)) { ++ this.lastFailure = 0; ++ this.pathfindFailures = 0; ++ return true; ++ } else { ++ this.pathfindFailures++; ++ this.lastFailure = MinecraftServer.currentTick; ++ return false; ++ } + } ++ private int lastFailure = 0; ++ private int pathfindFailures = 0; ++ // Paper end + + public boolean a(PathEntity pathentity, double d0) { + if (pathentity == null) { +@@ -254,6 +270,7 @@ public abstract class NavigationAbstract { + } + + public void o() { ++ this.pathfindFailures = 0; this.lastFailure = 0; // Paper - Pathfinding optimizations + this.c = null; + } + +-- +2.7.2 + diff --git a/Spigot-Server-Patches/0065-Configurable-container-update-tick-rate.patch b/Spigot-Server-Patches/0065-Configurable-container-update-tick-rate.patch deleted file mode 100644 index ffb264671d..0000000000 --- a/Spigot-Server-Patches/0065-Configurable-container-update-tick-rate.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 54a6f2217b848ae8f4a01a8315e5266feac87dc8 Mon Sep 17 00:00:00 2001 -From: Sudzzy -Date: Thu, 23 Jul 2015 22:05:22 -0700 -Subject: [PATCH] Configurable container update tick rate - - -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 3e4869b..0c49a25 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -65,6 +65,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - // Spigot start - public boolean collidesWithEntities = true; - public int viewDistance; // PaperSpigot - Player view distance API -+ private int containerUpdateDelay; // PaperSpigot - - @Override - public boolean ad() -@@ -197,8 +198,13 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - if (this.noDamageTicks > 0) { - --this.noDamageTicks; - } -- -- this.activeContainer.b(); -+ -+ // PaperSpigot start - Configurable container update tick rate -+ if (--containerUpdateDelay <= 0) { -+ this.activeContainer.b(); -+ containerUpdateDelay = world.paperSpigotConfig.containerUpdateTickRate; -+ } -+ // PaperSpigot end - if (!this.world.isClientSide && !this.activeContainer.a((EntityHuman) this)) { - this.closeInventory(); - this.activeContainer = this.defaultContainer; -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index 54f432d..f1409cf 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -364,4 +364,10 @@ public class PaperSpigotWorldConfig - { - cacheChunkMaps = getBoolean( "cache-chunk-maps", false ); - } -+ -+ public int containerUpdateTickRate; -+ private void containerUpdateTickRate() -+ { -+ containerUpdateTickRate = getInt( "container-update-tick-rate", 1 ); -+ } - } --- -2.7.0 - diff --git a/Spigot-Server-Patches/0088-Optimize-getBlockData.patch b/Spigot-Server-Patches/0065-Optimize-getBlockData.patch similarity index 59% rename from Spigot-Server-Patches/0088-Optimize-getBlockData.patch rename to Spigot-Server-Patches/0065-Optimize-getBlockData.patch index 7986e5b944..99858c97ed 100644 --- a/Spigot-Server-Patches/0088-Optimize-getBlockData.patch +++ b/Spigot-Server-Patches/0065-Optimize-getBlockData.patch @@ -1,20 +1,21 @@ -From 114866a0d3665b3f45a5e3e5b95d9ba34ec895fa Mon Sep 17 00:00:00 2001 +From cb40c347cc1e86c85969dcb35f78a8a2e2787e24 Mon Sep 17 00:00:00 2001 From: Aikar -Date: Sat, 13 Feb 2016 19:28:50 -0600 +Date: Thu, 3 Mar 2016 02:07:55 -0600 Subject: [PATCH] Optimize getBlockData Hot method, so reduce # of instructions for the method. diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 7efacfa..c636da3 100644 +index 3e9b26f..9369b69 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -489,7 +489,18 @@ public class Chunk { - } +@@ -392,8 +392,15 @@ public class Chunk { + return this.a(i, j, k).c(); } -+ // PaperSpigot start - Optimize getBlockData - public IBlockData getBlockData(final BlockPosition blockposition) { ++ // Paper - Optimize getBlockData + public IBlockData getBlockData(BlockPosition blockposition) { +- return this.a(blockposition.getX(), blockposition.getY(), blockposition.getZ()); + if (blockposition.getY() >= 0 && blockposition.getY() >> 4 < this.sections.length) { + ChunkSection chunksection = this.sections[blockposition.getY() >> 4]; + if (chunksection != null) { @@ -22,12 +23,9 @@ index 7efacfa..c636da3 100644 + } + } + return Blocks.AIR.getBlockData(); -+ } -+ public IBlockData getBlockDataSlow(final BlockPosition blockposition) { -+ // PaperSpigot end - if (this.world.G() == WorldType.DEBUG_ALL_BLOCK_STATES) { - IBlockData iblockdata = null; + } + public IBlockData a(final int i, final int j, final int k) { -- -2.7.1 +2.7.2 diff --git a/Spigot-Server-Patches/0089-Avoid-hopper-searches-if-there-are-no-items.patch b/Spigot-Server-Patches/0066-Avoid-hopper-searches-if-there-are-no-items.patch similarity index 64% rename from Spigot-Server-Patches/0089-Avoid-hopper-searches-if-there-are-no-items.patch rename to Spigot-Server-Patches/0066-Avoid-hopper-searches-if-there-are-no-items.patch index 2da90d63a1..00c73e775f 100644 --- a/Spigot-Server-Patches/0089-Avoid-hopper-searches-if-there-are-no-items.patch +++ b/Spigot-Server-Patches/0066-Avoid-hopper-searches-if-there-are-no-items.patch @@ -1,6 +1,6 @@ -From 779c16a7b1360256e47ea557c27bdab3f6543a58 Mon Sep 17 00:00:00 2001 +From cbecbf14837ed3904880ad65134d0e0563f8e0c8 Mon Sep 17 00:00:00 2001 From: CullanP -Date: Thu, 11 Feb 2016 21:43:17 -0700 +Date: Thu, 3 Mar 2016 02:13:38 -0600 Subject: [PATCH] Avoid hopper searches if there are no items Hoppers searching for items and minecarts is the most expensive part of hopper ticking. @@ -14,71 +14,69 @@ And since minecart hoppers are used _very_ rarely near we can avoid alot of sear Combined, this adds up a lot. diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index c636da3..aa555f5 100644 +index 9369b69..f0c464b 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -34,6 +34,11 @@ public class Chunk { - private boolean k; - public final Map tileEntities; - public final List[] entitySlices; // Spigot -+ // PaperSpigot start - track the number of minecarts and items +@@ -49,6 +49,10 @@ public class Chunk { + // Paper start - Asynchronous light updates + public AtomicInteger pendingLightUpdates = new AtomicInteger(); + public long lightUpdateTime; ++ // Track the number of minecarts and items + // Keep this synced with entitySlices.add() and entitySlices.remove() + private final int[] itemCounts = new int[16]; + private final int[] inventoryEntityCounts = new int[16]; -+ // PaperSpigot end - private boolean done; - private boolean lit; - private boolean p; -@@ -735,6 +740,13 @@ public class Chunk { - entity.af = k; - entity.ag = this.locZ; + // Paper end + + // CraftBukkit start - Neighbor loaded cache for chunk lighting and entity ticking +@@ -620,6 +624,13 @@ public class Chunk { + entity.ac = k; + entity.ad = this.locZ; this.entitySlices[k].add(entity); -+ // PaperSpigot start - update counts ++ // Paper start - update count + if (entity instanceof EntityItem) { + itemCounts[k]++; + } else if (entity instanceof IInventory) { + inventoryEntityCounts[k]++; + } -+ // PaperSpigot end ++ // Paper end // Spigot start - increment creature type count // Keep this synced up with World.a(Class) if (entity instanceof EntityInsentient) { -@@ -767,6 +779,13 @@ public class Chunk { +@@ -652,6 +663,13 @@ public class Chunk { } this.entitySlices[i].remove(entity); -+ // PaperSpigot start - update counts ++ // Paper start - update counts + if (entity instanceof EntityItem) { + itemCounts[i]--; + } else if (entity instanceof IInventory) { + inventoryEntityCounts[i]--; + } -+ // PaperSpigot end ++ // Paper end // Spigot start - decrement creature type count // Keep this synced up with World.a(Class) if (entity instanceof EntityInsentient) { -@@ -955,7 +974,15 @@ public class Chunk { - for (int k = i; k <= j; ++k) { +@@ -841,6 +859,15 @@ public class Chunk { if (!this.entitySlices[k].isEmpty()) { Iterator iterator = this.entitySlices[k].iterator(); -- -+ // PaperSpigot start - Don't search for inventories if we have none, and that is all we want + ++ // Paper start - Don't search for inventories if we have none, and that is all we want + /* -+ * We check if they want inventories by seeing if it is the static `IEntitySelector.c` -+ * -+ * Make sure the inventory selector stays in sync. -+ * It should be the one that checks `var1 instanceof IInventory && var1.isAlive()` -+ */ ++ * We check if they want inventories by seeing if it is the static `IEntitySelector.c` ++ * ++ * Make sure the inventory selector stays in sync. ++ * It should be the one that checks `var1 instanceof IInventory && var1.isAlive()` ++ */ + if (predicate == IEntitySelector.c && inventoryEntityCounts[k] <= 0) continue; -+ // PaperSpigot end ++ // Paper end while (iterator.hasNext()) { Entity entity1 = (Entity) iterator.next(); -@@ -988,7 +1015,18 @@ public class Chunk { +@@ -873,7 +900,18 @@ public class Chunk { i = MathHelper.clamp(i, 0, this.entitySlices.length - 1); j = MathHelper.clamp(j, 0, this.entitySlices.length - 1); -+ // PaperSpigot start ++ // Paper start + int[] counts; + if (ItemStack.class.isAssignableFrom(oclass)) { + counts = itemCounts; @@ -87,12 +85,12 @@ index c636da3..aa555f5 100644 + } else { + counts = null; + } -+ // PaperSpigot end ++ // Paper end for (int k = i; k <= j; ++k) { -+ if (counts != null && counts[k] <= 0) continue; // PaperSpigot - Don't check a chunk if it doesn't have the type we are looking for ++ if (counts != null && counts[k] <= 0) continue; // Paper - Don't check a chunk if it doesn't have the type we are looking for Iterator iterator = this.entitySlices[k].iterator(); // Spigot while (iterator.hasNext()) { -- -2.7.1 +2.7.2 diff --git a/Spigot-Server-Patches/0066-Configurable-TNT-explosion-volume.patch b/Spigot-Server-Patches/0066-Configurable-TNT-explosion-volume.patch deleted file mode 100644 index 24fb571d4d..0000000000 --- a/Spigot-Server-Patches/0066-Configurable-TNT-explosion-volume.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 1fb1f1763f84d9861eed6b1f1b0d9a4b77c01e4a Mon Sep 17 00:00:00 2001 -From: Byteflux -Date: Tue, 4 Aug 2015 17:45:00 -0700 -Subject: [PATCH] Configurable TNT explosion volume - - -diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java -index a60d3dd..b7d410e 100644 ---- a/src/main/java/net/minecraft/server/Explosion.java -+++ b/src/main/java/net/minecraft/server/Explosion.java -@@ -164,7 +164,10 @@ public class Explosion { - } - - public void a(boolean flag) { -- this.world.makeSound(this.posX, this.posY, this.posZ, "random.explode", 4.0F, (1.0F + (this.world.random.nextFloat() - this.world.random.nextFloat()) * 0.2F) * 0.7F); -+ // PaperSpigot start - Configurable TNT explosion volume. -+ float volume = source instanceof EntityTNTPrimed ? world.paperSpigotConfig.tntExplosionVolume : 4.0F; -+ this.world.makeSound(this.posX, this.posY, this.posZ, "random.explode", volume, (1.0F + (this.world.random.nextFloat() - this.world.random.nextFloat()) * 0.2F) * 0.7F); -+ // PaperSpigot end - if (this.size >= 2.0F && this.b) { - this.world.addParticle(EnumParticle.EXPLOSION_HUGE, this.posX, this.posY, this.posZ, 1.0D, 0.0D, 0.0D, new int[0]); - } else { -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index f1409cf..346e3f9 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -370,4 +370,10 @@ public class PaperSpigotWorldConfig - { - containerUpdateTickRate = getInt( "container-update-tick-rate", 1 ); - } -+ -+ public float tntExplosionVolume; -+ private void tntExplosionVolume() -+ { -+ tntExplosionVolume = getFloat( "tnt-explosion-volume", 4.0F ); -+ } - } --- -2.7.0 - diff --git a/Spigot-Server-Patches/0090-Expose-server-CommandMap.patch b/Spigot-Server-Patches/0067-Expose-server-CommandMap.patch similarity index 69% rename from Spigot-Server-Patches/0090-Expose-server-CommandMap.patch rename to Spigot-Server-Patches/0067-Expose-server-CommandMap.patch index efac49231f..525862c47d 100644 --- a/Spigot-Server-Patches/0090-Expose-server-CommandMap.patch +++ b/Spigot-Server-Patches/0067-Expose-server-CommandMap.patch @@ -1,14 +1,14 @@ -From db26b15a3200ab4d0306f0879bb88887938493df Mon Sep 17 00:00:00 2001 +From 8bd701f289231b752207b68ef72b9b48d4bfb57f Mon Sep 17 00:00:00 2001 From: kashike -Date: Mon, 15 Feb 2016 07:11:28 -0800 +Date: Thu, 3 Mar 2016 02:15:57 -0600 Subject: [PATCH] Expose server CommandMap diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 642880e..7b8fdc3 100644 +index 8073c20..76f50ae 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1558,6 +1558,7 @@ public final class CraftServer implements Server { +@@ -1556,6 +1556,7 @@ public final class CraftServer implements Server { return helpMap; } @@ -17,5 +17,5 @@ index 642880e..7b8fdc3 100644 return commandMap; } -- -2.7.0.rc0.20.g4b9ab0e +2.7.2 diff --git a/Spigot-Server-Patches/0092-Be-a-bit-more-informative-in-maxHealth-exception.patch b/Spigot-Server-Patches/0068-Be-a-bit-more-informative-in-maxHealth-exception.patch similarity index 61% rename from Spigot-Server-Patches/0092-Be-a-bit-more-informative-in-maxHealth-exception.patch rename to Spigot-Server-Patches/0068-Be-a-bit-more-informative-in-maxHealth-exception.patch index 0b5b3efcd0..6c6654b901 100644 --- a/Spigot-Server-Patches/0092-Be-a-bit-more-informative-in-maxHealth-exception.patch +++ b/Spigot-Server-Patches/0068-Be-a-bit-more-informative-in-maxHealth-exception.patch @@ -1,24 +1,25 @@ -From b2ef1030ddd6d746537b351980967f188a8dd582 Mon Sep 17 00:00:00 2001 +From 2409601a3a2f0aeec28e4b2cbc03447b42e16d66 Mon Sep 17 00:00:00 2001 From: kashike -Date: Tue, 16 Feb 2016 13:36:04 -0800 +Date: Thu, 3 Mar 2016 02:18:39 -0600 Subject: [PATCH] Be a bit more informative in maxHealth exception diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 5317cff..3e3a048 100644 +index 2895628..4b67dbe 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -80,7 +80,9 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -83,7 +83,10 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { public void setHealth(double health) { if ((health < 0) || (health > getMaxHealth())) { - throw new IllegalArgumentException("Health must be between 0 and " + getMaxHealth()); ++ // Paper - Be more informative + throw new IllegalArgumentException("Health must be between 0 and " + getMaxHealth() + ", but was " + health -+ + ". (attribute base value: " + this.getHandle().getAttributeInstance(GenericAttributes.maxHealth).b() -+ + (this instanceof CraftPlayer ? ", player: " + this.getName() + ')' : ')')); ++ + ". (attribute base value: " + this.getHandle().getAttributeInstance(GenericAttributes.maxHealth).b() ++ + (this instanceof CraftPlayer ? ", player: " + this.getName() + ')' : ')')); } if (entity instanceof EntityPlayer && health == 0) { -- -2.7.0.rc0.20.g4b9ab0e +2.7.2 diff --git a/Spigot-Server-Patches/0093-Graduate-bungeecord-chat-API-from-spigot-subclasses.patch b/Spigot-Server-Patches/0069-Graduate-bungeecord-chat-API-from-spigot-subclasses.patch similarity index 85% rename from Spigot-Server-Patches/0093-Graduate-bungeecord-chat-API-from-spigot-subclasses.patch rename to Spigot-Server-Patches/0069-Graduate-bungeecord-chat-API-from-spigot-subclasses.patch index 6c3f302207..cf4b6f7532 100644 --- a/Spigot-Server-Patches/0093-Graduate-bungeecord-chat-API-from-spigot-subclasses.patch +++ b/Spigot-Server-Patches/0069-Graduate-bungeecord-chat-API-from-spigot-subclasses.patch @@ -1,14 +1,14 @@ -From 028031b3dbc859705ebe333feaf5e955448fcaa8 Mon Sep 17 00:00:00 2001 +From 32bd67a83257d049363c34c5ab7bbf3ce08937f8 Mon Sep 17 00:00:00 2001 From: Zach Brown -Date: Tue, 16 Feb 2016 19:15:30 -0600 +Date: Thu, 3 Mar 2016 02:21:58 -0600 Subject: [PATCH] Graduate bungeecord chat API from spigot subclasses diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 7b8fdc3..69485fa 100644 +index 76f50ae..cb9906a 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1311,6 +1311,22 @@ public final class CraftServer implements Server { +@@ -1309,6 +1309,22 @@ public final class CraftServer implements Server { return count; } @@ -32,10 +32,10 @@ index 7b8fdc3..69485fa 100644 @Deprecated public OfflinePlayer getOfflinePlayer(String name) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index e8c6d5e..dba0520 100644 +index a2f2b8e..c37ad0e 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -162,6 +162,22 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -156,6 +156,22 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } } @@ -59,5 +59,5 @@ index e8c6d5e..dba0520 100644 public String getDisplayName() { return getHandle().displayName; -- -2.7.1 +2.7.2 diff --git a/Spigot-Server-Patches/0069-Re-add-Spigot-s-hopper-check-feature.patch b/Spigot-Server-Patches/0069-Re-add-Spigot-s-hopper-check-feature.patch deleted file mode 100644 index e2072e73d6..0000000000 --- a/Spigot-Server-Patches/0069-Re-add-Spigot-s-hopper-check-feature.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 246f9b49c79068ca061b938ab2824c8bffa6eb7c Mon Sep 17 00:00:00 2001 -From: Byteflux -Date: Thu, 13 Aug 2015 10:33:34 -0700 -Subject: [PATCH] Re-add Spigot's hopper-check feature - - -diff --git a/src/main/java/net/minecraft/server/TileEntityHopper.java b/src/main/java/net/minecraft/server/TileEntityHopper.java -index cab636a..760a076 100644 ---- a/src/main/java/net/minecraft/server/TileEntityHopper.java -+++ b/src/main/java/net/minecraft/server/TileEntityHopper.java -@@ -199,6 +199,11 @@ public class TileEntityHopper extends TileEntityContainer implements IHopper, IU - return true; - } - } -+ // PaperSpigot start -+ if (world.paperSpigotConfig.useHopperCheck && !this.n()) { -+ this.d(world.spigotConfig.hopperCheck); -+ } -+ // PaperSpigot end - return false; - } else { - return false; -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index 346e3f9..7eb3463 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -376,4 +376,10 @@ public class PaperSpigotWorldConfig - { - tntExplosionVolume = getFloat( "tnt-explosion-volume", 4.0F ); - } -+ -+ public boolean useHopperCheck; -+ private void useHopperCheck() -+ { -+ useHopperCheck = getBoolean( "use-hopper-check", false ); -+ } - } --- -2.7.0 - diff --git a/Spigot-Server-Patches/0070-Player-Tab-List-and-Title-APIs.patch b/Spigot-Server-Patches/0070-Player-Tab-List-and-Title-APIs.patch new file mode 100644 index 0000000000..7187f2a71c --- /dev/null +++ b/Spigot-Server-Patches/0070-Player-Tab-List-and-Title-APIs.patch @@ -0,0 +1,310 @@ +From 6a8586923dd65b1afc26798d8f69a14a3a4c4d00 Mon Sep 17 00:00:00 2001 +From: Techcable +Date: Thu, 3 Mar 2016 02:32:10 -0600 +Subject: [PATCH] Player Tab List and Title APIs + + +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +index c37ad0e..e360757 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +@@ -1,5 +1,6 @@ + package org.bukkit.craftbukkit.entity; + ++import com.destroystokyo.paper.Title; + import com.google.common.base.Preconditions; + import com.google.common.collect.ImmutableSet; + import com.mojang.authlib.GameProfile; +@@ -170,6 +171,83 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + packet.components = components; + getHandle().playerConnection.sendPacket(packet); + } ++ ++ @Override ++ public void setPlayerListHeaderFooter(BaseComponent[] header, BaseComponent[] footer) { ++ PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter(); ++ packet.header = header; ++ packet.footer = footer; ++ getHandle().playerConnection.sendPacket(packet); ++ } ++ ++ @Override ++ public void setPlayerListHeaderFooter(BaseComponent header, BaseComponent footer) { ++ this.setPlayerListHeaderFooter(header == null ? null : new BaseComponent[]{header}, ++ footer == null ? null : new BaseComponent[]{footer}); ++ } ++ ++ ++ @Override ++ public void setTitleTimes(int fadeInTicks, int stayTicks, int fadeOutTicks) { ++ getHandle().playerConnection.sendPacket(new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.TIMES, (BaseComponent[]) null, fadeInTicks, stayTicks, fadeOutTicks)); ++ } ++ ++ @Override ++ public void setSubtitle(BaseComponent[] subtitle) { ++ getHandle().playerConnection.sendPacket(new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.SUBTITLE, subtitle, 0, 0, 0)); ++ } ++ ++ @Override ++ public void setSubtitle(BaseComponent subtitle) { ++ setSubtitle(new BaseComponent[]{subtitle}); ++ } ++ ++ @Override ++ public void showTitle(BaseComponent[] title) { ++ getHandle().playerConnection.sendPacket(new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.TITLE, title, 0, 0, 0)); ++ } ++ ++ @Override ++ public void showTitle(BaseComponent title) { ++ showTitle(new BaseComponent[]{title}); ++ } ++ ++ @Override ++ public void showTitle(BaseComponent[] title, BaseComponent[] subtitle, int fadeInTicks, int stayTicks, int fadeOutTicks) { ++ setTitleTimes(fadeInTicks, stayTicks, fadeOutTicks); ++ setSubtitle(subtitle); ++ showTitle(title); ++ } ++ ++ @Override ++ public void showTitle(BaseComponent title, BaseComponent subtitle, int fadeInTicks, int stayTicks, int fadeOutTicks) { ++ setTitleTimes(fadeInTicks, stayTicks, fadeOutTicks); ++ setSubtitle(subtitle); ++ showTitle(title); ++ } ++ ++ @Override ++ public void sendTitle(Title title) { ++ Preconditions.checkNotNull(title, "Title is null"); ++ setTitleTimes(title.getFadeIn(), title.getStay(), title.getFadeOut()); ++ setSubtitle(title.getSubtitle() == null ? new BaseComponent[0] : title.getSubtitle()); ++ showTitle(title.getTitle()); ++ } ++ ++ @Override ++ public void updateTitle(Title title) { ++ Preconditions.checkNotNull(title, "Title is null"); ++ setTitleTimes(title.getFadeIn(), title.getStay(), title.getFadeOut()); ++ if (title.getSubtitle() != null) { ++ setSubtitle(title.getSubtitle()); ++ } ++ showTitle(title.getTitle()); ++ } ++ ++ @Override ++ public void hideTitle() { ++ getHandle().playerConnection.sendPacket(new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.CLEAR, (BaseComponent[]) null, 0, 0, 0)); ++ } + // Paper end + + @Override +@@ -1346,20 +1424,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + @Override + public void sendTitle(String title, String subtitle) { + if (title != null) { +- PacketPlayOutTitle packetTitle = new PacketPlayOutTitle(EnumTitleAction.TITLE, CraftChatMessage.fromString(title)[0]); +- getHandle().playerConnection.sendPacket(packetTitle); ++ this.sendTitle(new Title(title)); // TODO: Paper - Double check these + } + + if (subtitle != null) { +- PacketPlayOutTitle packetSubtitle = new PacketPlayOutTitle(EnumTitleAction.SUBTITLE, CraftChatMessage.fromString(subtitle)[0]); +- getHandle().playerConnection.sendPacket(packetSubtitle); ++ this.sendTitle(new Title(null, subtitle)); // TODO: Paper - Double check these + } + } + + @Override + public void resetTitle() { +- PacketPlayOutTitle packetReset = new PacketPlayOutTitle(EnumTitleAction.RESET, null); +- getHandle().playerConnection.sendPacket(packetReset); ++ this.hideTitle(); // TODO: Paper - Double check these + } + + @Override +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/PacketPlayOutPlayerListHeaderFooter.java b/src/main/java/org/bukkit/craftbukkit/entity/PacketPlayOutPlayerListHeaderFooter.java +index 842db1d..2d1bc58 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/PacketPlayOutPlayerListHeaderFooter.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/PacketPlayOutPlayerListHeaderFooter.java +@@ -9,6 +9,8 @@ import java.io.IOException; + + public class PacketPlayOutPlayerListHeaderFooter implements Packet { + ++ public net.md_5.bungee.api.chat.BaseComponent[] header, footer; // Paper ++ + private IChatBaseComponent a; + private IChatBaseComponent b; + +@@ -19,8 +21,19 @@ public class PacketPlayOutPlayerListHeaderFooter implements Packet { + +- private PacketPlayOutTitle.EnumTitleAction a; ++ private EnumTitleAction a; + private IChatBaseComponent b; + private int c; + private int d; + private int e; + ++ // Paper start ++ public net.md_5.bungee.api.chat.BaseComponent[] components; ++ ++ public PacketPlayOutTitle(EnumTitleAction action, net.md_5.bungee.api.chat.BaseComponent[] components, int fadeIn, int stay, int fadeOut) { ++ this.a = action; ++ this.components = components; ++ this.c = fadeIn; ++ this.d = stay; ++ this.e = fadeOut; ++ } ++ // Paper end ++ + public PacketPlayOutTitle() {} + +- public PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction packetplayouttitle_enumtitleaction, IChatBaseComponent ichatbasecomponent) { ++ public PacketPlayOutTitle(EnumTitleAction packetplayouttitle_enumtitleaction, IChatBaseComponent ichatbasecomponent) { + this(packetplayouttitle_enumtitleaction, ichatbasecomponent, -1, -1, -1); + } + + public PacketPlayOutTitle(int i, int j, int k) { +- this(PacketPlayOutTitle.EnumTitleAction.TIMES, (IChatBaseComponent) null, i, j, k); ++ this(EnumTitleAction.TIMES, (IChatBaseComponent) null, i, j, k); + } + +- public PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction packetplayouttitle_enumtitleaction, IChatBaseComponent ichatbasecomponent, int i, int j, int k) { ++ public PacketPlayOutTitle(EnumTitleAction packetplayouttitle_enumtitleaction, IChatBaseComponent ichatbasecomponent, int i, int j, int k) { + this.a = packetplayouttitle_enumtitleaction; + this.b = ichatbasecomponent; + this.c = i; +@@ -29,12 +46,12 @@ public class PacketPlayOutTitle implements Packet { + } + + public void a(PacketDataSerializer packetdataserializer) throws IOException { +- this.a = (PacketPlayOutTitle.EnumTitleAction) packetdataserializer.a(PacketPlayOutTitle.EnumTitleAction.class); +- if (this.a == PacketPlayOutTitle.EnumTitleAction.TITLE || this.a == PacketPlayOutTitle.EnumTitleAction.SUBTITLE) { ++ this.a = (EnumTitleAction) packetdataserializer.a(EnumTitleAction.class); ++ if (this.a == EnumTitleAction.TITLE || this.a == EnumTitleAction.SUBTITLE) { + this.b = packetdataserializer.f(); + } + +- if (this.a == PacketPlayOutTitle.EnumTitleAction.TIMES) { ++ if (this.a == EnumTitleAction.TIMES) { + this.c = packetdataserializer.readInt(); + this.d = packetdataserializer.readInt(); + this.e = packetdataserializer.readInt(); +@@ -44,11 +61,17 @@ public class PacketPlayOutTitle implements Packet { + + public void b(PacketDataSerializer packetdataserializer) throws IOException { + packetdataserializer.a((Enum) this.a); +- if (this.a == PacketPlayOutTitle.EnumTitleAction.TITLE || this.a == PacketPlayOutTitle.EnumTitleAction.SUBTITLE) { +- packetdataserializer.a(this.b); ++ if (this.a == EnumTitleAction.TITLE || this.a == EnumTitleAction.SUBTITLE) { ++ // Paper start ++ if (this.components != null) { ++ packetdataserializer.a(net.md_5.bungee.chat.ComponentSerializer.toString(components)); ++ } else { ++ packetdataserializer.a(this.b); ++ } ++ // Paper end + } + +- if (this.a == PacketPlayOutTitle.EnumTitleAction.TIMES) { ++ if (this.a == EnumTitleAction.TIMES) { + packetdataserializer.writeInt(this.c); + packetdataserializer.writeInt(this.d); + packetdataserializer.writeInt(this.e); +@@ -56,8 +79,9 @@ public class PacketPlayOutTitle implements Packet { + + } + ++ // Paper - Fix compile error + public void a(PacketListenerPlayOut packetlistenerplayout) { +- packetlistenerplayout.a(this); ++ packetlistenerplayout.a((IChatBaseComponent) this); + } + + public static enum EnumTitleAction { +@@ -66,29 +90,29 @@ public class PacketPlayOutTitle implements Packet { + + private EnumTitleAction() {} + +- public static PacketPlayOutTitle.EnumTitleAction a(String s) { +- PacketPlayOutTitle.EnumTitleAction[] apacketplayouttitle_enumtitleaction = values(); ++ public static EnumTitleAction a(String s) { ++ EnumTitleAction[] apacketplayouttitle_enumtitleaction = values(); + int i = apacketplayouttitle_enumtitleaction.length; + + for (int j = 0; j < i; ++j) { +- PacketPlayOutTitle.EnumTitleAction packetplayouttitle_enumtitleaction = apacketplayouttitle_enumtitleaction[j]; ++ EnumTitleAction packetplayouttitle_enumtitleaction = apacketplayouttitle_enumtitleaction[j]; + + if (packetplayouttitle_enumtitleaction.name().equalsIgnoreCase(s)) { + return packetplayouttitle_enumtitleaction; + } + } + +- return PacketPlayOutTitle.EnumTitleAction.TITLE; ++ return EnumTitleAction.TITLE; + } + + public static String[] a() { + String[] astring = new String[values().length]; + int i = 0; +- PacketPlayOutTitle.EnumTitleAction[] apacketplayouttitle_enumtitleaction = values(); ++ EnumTitleAction[] apacketplayouttitle_enumtitleaction = values(); + int j = apacketplayouttitle_enumtitleaction.length; + + for (int k = 0; k < j; ++k) { +- PacketPlayOutTitle.EnumTitleAction packetplayouttitle_enumtitleaction = apacketplayouttitle_enumtitleaction[k]; ++ EnumTitleAction packetplayouttitle_enumtitleaction = apacketplayouttitle_enumtitleaction[k]; + + astring[i++] = packetplayouttitle_enumtitleaction.name().toLowerCase(); + } +-- +2.7.2 + diff --git a/Spigot-Server-Patches/0071-Don-t-damage-already-dead-ArmorStands.patch b/Spigot-Server-Patches/0071-Don-t-damage-already-dead-ArmorStands.patch deleted file mode 100644 index b77304dea4..0000000000 --- a/Spigot-Server-Patches/0071-Don-t-damage-already-dead-ArmorStands.patch +++ /dev/null @@ -1,25 +0,0 @@ -From e9deaf4147f5d5cff346d3af8e68a91e67682322 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sun, 15 Nov 2015 19:35:31 -0600 -Subject: [PATCH] Don't damage already dead ArmorStands - - -diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java -index cd57d69..2ea4a5f 100644 ---- a/src/main/java/net/minecraft/server/EntityArmorStand.java -+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java -@@ -382,9 +382,9 @@ public class EntityArmorStand extends EntityLiving { - return false; - } - // CraftBukkit end -- if (this.world.isClientSide) { -+ if (this.world.isClientSide || this.dead) { - return false; -- } else if (DamageSource.OUT_OF_WORLD.equals(damagesource)) { -+ } else if (DamageSource.OUT_OF_WORLD.equals(damagesource)) { // PaperSpigot - this.die(); - return false; - } else if (!this.isInvulnerable(damagesource) && !this.h && !this.s()) { --- -2.6.3 - diff --git a/Spigot-Server-Patches/0071-Ensure-inv-drag-is-in-bounds.patch b/Spigot-Server-Patches/0071-Ensure-inv-drag-is-in-bounds.patch new file mode 100644 index 0000000000..aa65e1b56b --- /dev/null +++ b/Spigot-Server-Patches/0071-Ensure-inv-drag-is-in-bounds.patch @@ -0,0 +1,22 @@ +From 29ce8dbfe8bfe2f0a8c99ad9613ea903615f36cf Mon Sep 17 00:00:00 2001 +From: Joseph Hirschfeld +Date: Thu, 3 Mar 2016 02:33:53 -0600 +Subject: [PATCH] Ensure inv drag is in bounds + + +diff --git a/src/main/java/net/minecraft/server/Container.java b/src/main/java/net/minecraft/server/Container.java +index 000b4db..e72eac4 100644 +--- a/src/main/java/net/minecraft/server/Container.java ++++ b/src/main/java/net/minecraft/server/Container.java +@@ -110,7 +110,7 @@ public abstract class Container { + } + + public ItemStack b(EntityHuman entityhuman, int i) { +- Slot slot = (Slot) this.c.get(i); ++ Slot slot = i < this.c.size() ? this.c.get(i) : null; // Paper - Ensure drag in bounds + + return slot != null ? slot.getItem() : null; + } +-- +2.7.2 + diff --git a/Spigot-Server-Patches/0072-Change-implementation-of-tile-entity-removal-list.patch b/Spigot-Server-Patches/0072-Change-implementation-of-tile-entity-removal-list.patch new file mode 100644 index 0000000000..159ec5ddee --- /dev/null +++ b/Spigot-Server-Patches/0072-Change-implementation-of-tile-entity-removal-list.patch @@ -0,0 +1,65 @@ +From 7c6aa404106093661e0c94a50910b7e076aba750 Mon Sep 17 00:00:00 2001 +From: Joseph Hirschfeld +Date: Thu, 3 Mar 2016 02:39:54 -0600 +Subject: [PATCH] Change implementation of (tile)entity removal list + + +diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java +index a1cdef6..05f3e45 100644 +--- a/src/main/java/net/minecraft/server/World.java ++++ b/src/main/java/net/minecraft/server/World.java +@@ -33,6 +33,8 @@ import org.bukkit.generator.ChunkGenerator; + import java.util.concurrent.ExecutorService; + import java.util.concurrent.Executors; + import java.util.HashMap; ++import java.util.Set; ++import com.google.common.collect.Sets; + import com.google.common.util.concurrent.ThreadFactoryBuilder; + // Paper end + +@@ -66,11 +68,11 @@ public abstract class World implements IBlockAccess { + } + }; + // Spigot end +- protected final List f = Lists.newArrayList(); ++ protected final Set f = Sets.newHashSet(); // Paper + //public final List tileEntityList = Lists.newArrayList(); // Paper - Remove unused list + public final List tileEntityListTick = Lists.newArrayList(); + private final List b = Lists.newArrayList(); +- private final List tileEntityListUnload = Lists.newArrayList(); ++ private final Set tileEntityListUnload = Sets.newHashSet(); // Paper + public final List players = Lists.newArrayList(); + public final List j = Lists.newArrayList(); + protected final IntHashMap entitiesById = new IntHashMap(); +@@ -1355,19 +1357,20 @@ public abstract class World implements IBlockAccess { + + int j; + +- for (i = 0; i < this.f.size(); ++i) { +- entity = (Entity) this.f.get(i); +- int k = entity.ab; ++ // Paper start - Set based removal lists ++ for (Entity e : this.f) { ++ j = e.getChunkX(); ++ int k = e.getChunkZ(); + +- j = entity.ad; +- if (entity.aa && this.isChunkLoaded(k, j, true)) { +- this.getChunkAt(k, j).b(entity); ++ if (e.aa && this.isChunkLoaded(k, j, true)) { ++ this.getChunkAt(k, j).b(e); + } + } + +- for (i = 0; i < this.f.size(); ++i) { +- this.c((Entity) this.f.get(i)); ++ for (Entity e : this.f) { ++ this.c(e); + } ++ // Paper end + + this.f.clear(); + this.l(); +-- +2.7.2 + diff --git a/Spigot-Server-Patches/0073-Add-configurable-portal-search-radius.patch b/Spigot-Server-Patches/0073-Add-configurable-portal-search-radius.patch new file mode 100644 index 0000000000..f981f1f17b --- /dev/null +++ b/Spigot-Server-Patches/0073-Add-configurable-portal-search-radius.patch @@ -0,0 +1,62 @@ +From 3c621cdd6f9b2d60e89eaa913d9463294df3af1e Mon Sep 17 00:00:00 2001 +From: Joseph Hirschfeld +Date: Thu, 3 Mar 2016 02:46:17 -0600 +Subject: [PATCH] Add configurable portal search radius + + +diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index 50fc4a0..f42efe7 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -259,4 +259,9 @@ public class PaperWorldConfig { + private void allowBlockLocationTabCompletion() { + allowBlockLocationTabCompletion = getBoolean("allow-block-location-tab-completion", true); + } ++ ++ public int portalSearchRadius; ++ private void portalSearchRadius() { ++ portalSearchRadius = getInt("portal-search-radius", 128); ++ } + } +diff --git a/src/main/java/net/minecraft/server/PortalTravelAgent.java b/src/main/java/net/minecraft/server/PortalTravelAgent.java +index 7c8df40..22c94d1 100644 +--- a/src/main/java/net/minecraft/server/PortalTravelAgent.java ++++ b/src/main/java/net/minecraft/server/PortalTravelAgent.java +@@ -107,7 +107,7 @@ public class PortalTravelAgent { + return true; + } + +- public BlockPosition findPortal(double x, double y, double z, int short1) { ++ public BlockPosition findPortal(double x, double y, double z, int searchRadius) { // Paper - short1 -> searchRadius + if (this.world.getWorld().getEnvironment() == org.bukkit.World.Environment.THE_END) { + return this.findEndPortal(this.world.worldProvider.h()); + } +@@ -131,10 +131,10 @@ public class PortalTravelAgent { + } else { + BlockPosition blockposition = new BlockPosition(x, y, z); // CraftBukkit + +- for (int l = -128; l <= 128; ++l) { ++ for (int l = -searchRadius; l <= searchRadius; ++l) { // Paper - actually use search radiusfor (int l = -128; l <= 128; ++l) { + BlockPosition blockposition1; + +- for (int i1 = -128; i1 <= 128; ++i1) { ++ for (int i1 = -searchRadius; i1 <= searchRadius; ++i1) { // Paper - actually use search radius + for (BlockPosition blockposition2 = blockposition.a(l, this.world.Z() - 1 - blockposition.getY(), i1); blockposition2.getY() >= 0; blockposition2 = blockposition1) { + blockposition1 = blockposition2.down(); + if (this.world.getType(blockposition2).getBlock() == Blocks.PORTAL) { +diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java +index 3567133..9da5719 100644 +--- a/src/main/java/net/minecraft/server/WorldServer.java ++++ b/src/main/java/net/minecraft/server/WorldServer.java +@@ -60,7 +60,7 @@ public class WorldServer extends World implements IAsyncTaskHandler { + this.manager = new PlayerChunkMap(this, spigotConfig.viewDistance); // Spigot + this.worldProvider.a((World) this); + this.chunkProvider = this.n(); +- this.portalTravelAgent = new org.bukkit.craftbukkit.CraftTravelAgent(this); // CraftBukkit ++ this.portalTravelAgent = ((org.bukkit.craftbukkit.CraftTravelAgent) new org.bukkit.craftbukkit.CraftTravelAgent(this).setSearchRadius(paperConfig.portalSearchRadius)); // CraftBukkit // Paper - configurable search radius + this.H(); + this.I(); + this.getWorldBorder().a(minecraftserver.aD()); +-- +2.7.2 + diff --git a/Spigot-Server-Patches/0074-Add-velocity-warnings.patch b/Spigot-Server-Patches/0074-Add-velocity-warnings.patch new file mode 100644 index 0000000000..1262e11830 --- /dev/null +++ b/Spigot-Server-Patches/0074-Add-velocity-warnings.patch @@ -0,0 +1,26 @@ +From bce742ca6f95614f70210094ec75efaa1b49d13c Mon Sep 17 00:00:00 2001 +From: Joseph Hirschfeld +Date: Thu, 3 Mar 2016 02:48:12 -0600 +Subject: [PATCH] Add velocity warnings + + +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +index 4cc45f6..c988e93 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +@@ -207,6 +207,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { + } + + public void setVelocity(Vector vel) { ++ // Paper start - Warn server owners when plugins try to set super high velocities ++ if (vel.getX() > 4 || vel.getX() < -4 || vel.getY() > 4 || vel.getY() < -4 || vel.getZ() > 4 || vel.getZ() < -4) { ++ getServer().getLogger().warning("Excessive velocity set detected: tried to set velocity of entity #"+getEntityId()+" to ("+vel.getX()+","+vel.getY()+","+vel.getZ()+")."); ++ Thread.dumpStack(); ++ } ++ // Paper end + entity.motX = vel.getX(); + entity.motY = vel.getY(); + entity.motZ = vel.getZ(); +-- +2.7.2 + diff --git a/Spigot-Server-Patches/0075-EAR-Fix-bug-with-teleporting-entities.patch b/Spigot-Server-Patches/0075-EAR-Fix-bug-with-teleporting-entities.patch deleted file mode 100644 index ba5a94d4d2..0000000000 --- a/Spigot-Server-Patches/0075-EAR-Fix-bug-with-teleporting-entities.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 9a4310cbb356279870135af7e2c69828cc462a90 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Tue, 22 Dec 2015 18:16:11 -0600 -Subject: [PATCH] EAR: Fix bug with teleporting entities - -[17:53:15] had a reproduceable issue of losing entities on teleport, now resolved -https://hub.spigotmc.org/stash/projects/SPIGOT/repos/spigot/pull-requests/52/overview - -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 68126c4..20cc946 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -96,10 +96,19 @@ public abstract class Entity implements ICommandListener { - protected DataWatcher datawatcher; - private double ar; - private double as; -- public boolean ad; public boolean isAddedToChunk() { return ad; } // Spigot // PAIL -- public int ae; -- public int af; -- public int ag; -+ public boolean ad; -+ // PaperSpigot start - EAR: Fix bug with teleporting entities -+ public boolean isAddedToChunk() { -+ int chunkX = MathHelper.floor(locX / 16.0D); -+ int chunkY = MathHelper.floor(locY / 16.0D); -+ int chunkZ = MathHelper.floor(locZ / 16.0D); -+ -+ return ad && getChunkX() == chunkX && getChunkY() == chunkY || getChunkZ() == chunkZ; -+ } -+ public int ae; public int getChunkX() { return ae; } // PAIL -+ public int af; public int getChunkY() { return af; } // PAIL -+ public int ag; public int getChunkZ() { return ag; } // PAIL -+ // PaperSpigot end - public boolean ah; - public boolean ai; - public int portalCooldown; --- -2.6.4 - diff --git a/Spigot-Server-Patches/0099-Fix-inter-world-teleportation-glitches.patch b/Spigot-Server-Patches/0075-Fix-inter-world-teleportation-glitches.patch similarity index 69% rename from Spigot-Server-Patches/0099-Fix-inter-world-teleportation-glitches.patch rename to Spigot-Server-Patches/0075-Fix-inter-world-teleportation-glitches.patch index 55201645e4..a171b33f32 100644 --- a/Spigot-Server-Patches/0099-Fix-inter-world-teleportation-glitches.patch +++ b/Spigot-Server-Patches/0075-Fix-inter-world-teleportation-glitches.patch @@ -1,6 +1,6 @@ -From bb89655d63addb4ee096d8cec88b4c54e2a2d383 Mon Sep 17 00:00:00 2001 +From f770b75020f976e76e313a997d49cc32dd37e37b Mon Sep 17 00:00:00 2001 From: Sudzzy -Date: Sun, 28 Feb 2016 18:33:06 +0000 +Date: Thu, 3 Mar 2016 02:50:31 -0600 Subject: [PATCH] Fix inter-world teleportation glitches People are able to abuse the way Bukkit handles teleportation across worlds since it provides a built in teleportation safety check. @@ -10,34 +10,34 @@ To abuse the safety check, players are required to get into a location deemed un Example setup to perform the glitch: http://puu.sh/ng3PC/cf072dcbdb.png The wanted destination was on top of the emerald block however the player ended on top of the diamond block. This only is the case if the player is teleporting between worlds. -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 3075076..b7b3bd6 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -565,7 +565,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - if (fromWorld == toWorld) { - entity.playerConnection.teleport(to); - } else { -- server.getHandle().moveToWorld(entity, toWorld.dimension, true, to, true); -+ server.getHandle().moveToWorld(entity, toWorld.dimension, true, to, !toWorld.paperSpigotConfig.disableTeleportationSuffocationCheck); - } - return true; - } -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index 6ad8e81..3539c90 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -402,4 +402,10 @@ public class PaperSpigotWorldConfig - { +diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index f42efe7..c5c49bf 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -264,4 +264,9 @@ public class PaperWorldConfig { + private void portalSearchRadius() { portalSearchRadius = getInt("portal-search-radius", 128); } + + public boolean disableTeleportationSuffocationCheck; -+ private void disableTeleportationSuffocationCheck() -+ { ++ private void disableTeleportationSuffocationCheck() { + disableTeleportationSuffocationCheck = getBoolean("disable-teleportation-suffocation-check", false); + } } +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +index d8b4316..b5c9e04 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +@@ -557,7 +557,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + if (fromWorld == toWorld) { + entity.playerConnection.teleport(to); + } else { +- server.getHandle().moveToWorld(entity, toWorld.dimension, true, to, true); ++ // Paper - Configurable suffocation check ++ server.getHandle().moveToWorld(entity, toWorld.dimension, true, to, !toWorld.paperConfig.disableTeleportationSuffocationCheck); + } + return true; + } -- 2.7.2 diff --git a/Spigot-Server-Patches/0100-Add-exception-reporting-event.patch b/Spigot-Server-Patches/0076-Add-exception-reporting-event.patch similarity index 55% rename from Spigot-Server-Patches/0100-Add-exception-reporting-event.patch rename to Spigot-Server-Patches/0076-Add-exception-reporting-event.patch index e75377a013..3ce53bb9ee 100644 --- a/Spigot-Server-Patches/0100-Add-exception-reporting-event.patch +++ b/Spigot-Server-Patches/0076-Add-exception-reporting-event.patch @@ -1,434 +1,21 @@ -From 3222d65f280871d3cc7b9a3d0250934dcc5f456c Mon Sep 17 00:00:00 2001 +From 2dc6b2c55d255fd4cbd996f7f01244739691260a Mon Sep 17 00:00:00 2001 From: Joseph Hirschfeld -Date: Sat, 20 Feb 2016 20:07:46 -0500 +Date: Thu, 3 Mar 2016 03:15:41 -0600 Subject: [PATCH] Add exception reporting event -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index aa555f5..ab0d41c 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -18,6 +18,9 @@ import org.apache.logging.log4j.Logger; - - import com.google.common.collect.Lists; // CraftBukkit - import org.bukkit.Bukkit; // CraftBukkit -+import org.bukkit.craftbukkit.util.CraftMagicNumbers; -+import org.github.paperspigot.event.ServerExceptionEvent; -+import org.github.paperspigot.exception.ServerInternalException; - - public class Chunk { - -@@ -869,10 +872,15 @@ public class Chunk { - this.tileEntities.remove(blockposition); - // PaperSpigot end - } else { -- System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ() -- + " (" + org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(getType(blockposition)) + ") where there was no entity tile!"); -- System.out.println("Chunk coordinates: " + (this.locX * 16) + "," + (this.locZ * 16)); -- new Exception().printStackTrace(); -+ // Paper start -+ ServerInternalException e = new ServerInternalException( -+ "Attempted to place a tile entity (" + tileentity + ") at " + tileentity.position.getX() + "," -+ + tileentity.position.getY() + "," + tileentity.position.getZ() -+ + " (" + CraftMagicNumbers.getMaterial(getType(blockposition)) + ") where there was no entity tile!\n" + -+ "Chunk coordinates: " + (this.locX * 16) + "," + (this.locZ * 16)); -+ e.printStackTrace(); -+ ServerInternalException.reportInternalException(e); -+ // Paper end - // CraftBukkit end - } - } -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 0e6a37f..c4dab42 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -15,12 +15,15 @@ import org.apache.logging.log4j.Logger; - import java.util.Random; - import java.util.logging.Level; - -+import org.bukkit.Bukkit; - import org.bukkit.Server; - import org.bukkit.craftbukkit.chunkio.ChunkIOExecutor; - import org.bukkit.craftbukkit.util.LongHash; - import org.bukkit.craftbukkit.util.LongHashSet; - import org.bukkit.craftbukkit.util.LongObjectHashMap; - import org.bukkit.event.world.ChunkUnloadEvent; -+import org.github.paperspigot.event.ServerExceptionEvent; -+import org.github.paperspigot.exception.ServerInternalException; - // CraftBukkit end - - public class ChunkProviderServer implements IChunkProvider { -@@ -215,11 +218,14 @@ public class ChunkProviderServer implements IChunkProvider { - - if (chunk == emptyChunk) return chunk; - if (i != chunk.locX || j != chunk.locZ) { -- b.error("Chunk (" + chunk.locX + ", " + chunk.locZ + ") stored at (" + i + ", " + j + ") in world '" + world.getWorld().getName() + "'"); -+ // Paper start -+ String msg = "Chunk (" + chunk.locX + ", " + chunk.locZ + ") stored at (" + i + ", " + j + ") in world '" + world.getWorld().getName() + "'"; -+ b.error(msg); - b.error(chunk.getClass().getName()); -- Throwable ex = new Throwable(); -- ex.fillInStackTrace(); -+ ServerInternalException ex = new ServerInternalException(msg); - ex.printStackTrace(); -+ Bukkit.getPluginManager().callEvent(new ServerExceptionEvent(ex)); -+ // Paper end - } - - return chunk; -@@ -244,7 +250,11 @@ public class ChunkProviderServer implements IChunkProvider { - - return chunk; - } catch (Exception exception) { -- ChunkProviderServer.b.error("Couldn\'t load chunk", exception); -+ // Paper start -+ String msg = "Couldn\'t load chunk"; -+ ChunkProviderServer.b.error(msg, exception); -+ ServerInternalException.reportInternalException(exception); -+ // Paper end - return null; - } - } -diff --git a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java -index d67539c..4029109 100644 ---- a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java -+++ b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java -@@ -25,6 +25,9 @@ import java.util.Map; - import java.util.UUID; - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; -+import org.bukkit.Bukkit; -+import org.github.paperspigot.event.ServerExceptionEvent; -+import org.github.paperspigot.exception.ServerInternalException; - - public class NameReferencingFileConverter { - -@@ -361,6 +364,7 @@ public class NameReferencingFileConverter { - root = NBTCompressedStreamTools.a(new java.io.FileInputStream(file1)); - } catch (Exception exception) { - exception.printStackTrace(); -+ ServerInternalException.reportInternalException(exception); // Paper - } - - if (root != null) { -@@ -374,8 +378,9 @@ public class NameReferencingFileConverter { - NBTCompressedStreamTools.a(root, new java.io.FileOutputStream(file2)); - } catch (Exception exception) { - exception.printStackTrace(); -+ ServerInternalException.reportInternalException(exception); // Paper - } -- } -+ } - // CraftBukkit end - - NameReferencingFileConverter.b(file); -diff --git a/src/main/java/net/minecraft/server/PersistentCollection.java b/src/main/java/net/minecraft/server/PersistentCollection.java -index 451f481..6459594 100644 ---- a/src/main/java/net/minecraft/server/PersistentCollection.java -+++ b/src/main/java/net/minecraft/server/PersistentCollection.java -@@ -2,6 +2,10 @@ package net.minecraft.server; - - import com.google.common.collect.Lists; - import com.google.common.collect.Maps; -+import org.bukkit.Bukkit; -+import org.github.paperspigot.event.ServerExceptionEvent; -+import org.github.paperspigot.exception.ServerInternalException; -+ - import java.io.DataInputStream; - import java.io.DataOutput; - import java.io.DataOutputStream; -@@ -103,6 +107,7 @@ public class PersistentCollection { - } - } catch (Exception exception) { - exception.printStackTrace(); -+ ServerInternalException.reportInternalException(exception); - } - - } -@@ -176,6 +181,7 @@ public class PersistentCollection { - } - } catch (Exception exception) { - exception.printStackTrace(); -+ ServerInternalException.reportInternalException(exception); // Paper - } - - return oshort.shortValue(); -diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java -index 348706f..8165a50 100644 ---- a/src/main/java/net/minecraft/server/RegionFile.java -+++ b/src/main/java/net/minecraft/server/RegionFile.java -@@ -1,6 +1,8 @@ - package net.minecraft.server; - - import com.google.common.collect.Lists; -+import org.github.paperspigot.exception.ServerInternalException; -+ - import java.io.BufferedInputStream; - import java.io.ByteArrayInputStream; - import java.io.ByteArrayOutputStream; -@@ -82,6 +84,7 @@ public class RegionFile { - } - } catch (IOException ioexception) { - ioexception.printStackTrace(); -+ ServerInternalException.reportInternalException(ioexception); // Paper - } - - } -@@ -247,6 +250,7 @@ public class RegionFile { - this.b(i, j, (int) (MinecraftServer.az() / 1000L)); - } catch (IOException ioexception) { - ioexception.printStackTrace(); -+ ServerInternalException.reportInternalException(ioexception); // Paper - } - - } -diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java -index 5b000c4..4cfaf30 100644 ---- a/src/main/java/net/minecraft/server/RegionFileCache.java -+++ b/src/main/java/net/minecraft/server/RegionFileCache.java -@@ -1,6 +1,8 @@ - package net.minecraft.server; - - import com.google.common.collect.Maps; -+import org.github.paperspigot.exception.ServerInternalException; -+ - import java.io.DataInputStream; - import java.io.DataOutputStream; - import java.io.File; -@@ -53,6 +55,7 @@ public class RegionFileCache { - } - } catch (IOException ioexception) { - ioexception.printStackTrace(); -+ ServerInternalException.reportInternalException(ioexception); // Paper - } - } - -diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java -index 611b8fd..284f4bf 100644 ---- a/src/main/java/net/minecraft/server/SpawnerCreature.java -+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java -@@ -10,6 +10,7 @@ import java.util.Set; - import org.bukkit.craftbukkit.util.LongHash; - import org.bukkit.craftbukkit.util.LongHashSet; - import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; -+import org.github.paperspigot.exception.ServerInternalException; - // CraftBukkit end - - public final class SpawnerCreature { -@@ -171,6 +172,7 @@ public final class SpawnerCreature { - entityinsentient = (EntityInsentient) biomebase_biomemeta.b.getConstructor(new Class[] { World.class}).newInstance(new Object[] { worldserver}); - } catch (Exception exception) { - exception.printStackTrace(); -+ ServerInternalException.reportInternalException(exception); // Paper - return j1; - } - -@@ -276,6 +278,7 @@ public final class SpawnerCreature { - entityinsentient = (EntityInsentient) biomebase_biomemeta.b.getConstructor(new Class[] { World.class}).newInstance(new Object[] { world}); - } catch (Exception exception) { - exception.printStackTrace(); -+ ServerInternalException.reportInternalException(exception); // Paper - continue; - } - -diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index fdcbf44..f68b132 100644 ---- a/src/main/java/net/minecraft/server/TileEntity.java -+++ b/src/main/java/net/minecraft/server/TileEntity.java -@@ -9,6 +9,7 @@ import org.apache.logging.log4j.Logger; - import co.aikar.timings.SpigotTimings; // Spigot - import co.aikar.timings.Timing; // Spigot - import org.bukkit.inventory.InventoryHolder; // CraftBukkit -+import org.github.paperspigot.exception.ServerInternalException; - - public abstract class TileEntity { - -@@ -76,6 +77,7 @@ public abstract class TileEntity { - } - } catch (Exception exception) { - exception.printStackTrace(); -+ ServerInternalException.reportInternalException(exception); // Paper - } - - if (tileentity != null) { -diff --git a/src/main/java/net/minecraft/server/VillageSiege.java b/src/main/java/net/minecraft/server/VillageSiege.java -index 42d6737..01dbc98 100644 ---- a/src/main/java/net/minecraft/server/VillageSiege.java -+++ b/src/main/java/net/minecraft/server/VillageSiege.java -@@ -1,5 +1,7 @@ - package net.minecraft.server; - -+import org.github.paperspigot.exception.ServerInternalException; -+ - import java.util.Iterator; - import java.util.List; - -@@ -136,6 +138,7 @@ public class VillageSiege { - entityzombie.setVillager(false); - } catch (Exception exception) { - exception.printStackTrace(); -+ ServerInternalException.reportInternalException(exception); // Paper - return false; - } - -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index f0cd810..8f3511f 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -24,6 +24,8 @@ import java.util.concurrent.Callable; - import java.util.concurrent.ExecutorService; - import java.util.concurrent.Executors; - import com.google.common.util.concurrent.ThreadFactoryBuilder; -+import org.github.paperspigot.event.ServerExceptionEvent; -+import org.github.paperspigot.exception.ServerInternalException; - // PaperSpigot end - - // CraftBukkit start -@@ -1450,8 +1452,10 @@ public abstract class World implements IBlockAccess { - } catch (Throwable throwable1) { - // PaperSpigot start - Prevent tile entity and entity crashes - entity.tickTimer.stopTiming(); -- System.err.println("Entity threw exception at " + entity.world.getWorld().getName() + ":" + entity.locX + "," + entity.locY + "," + entity.locZ); -+ String msg = "Entity threw exception at " + entity.world.getWorld().getName() + ":" + entity.locX + "," + entity.locY + "," + entity.locZ; -+ System.err.println(msg); - throwable1.printStackTrace(); -+ getServer().getPluginManager().callEvent(new ServerExceptionEvent(new ServerInternalException(msg, throwable1))); - entity.dead = true; - continue; - // PaperSpigot end -@@ -1513,8 +1517,10 @@ public abstract class World implements IBlockAccess { - } catch (Throwable throwable2) { - // PaperSpigot start - Prevent tile entity and entity crashes - tileentity.tickTimer.stopTiming(); -- System.err.println("TileEntity threw exception at " + tileentity.world.getWorld().getName() + ":" + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ()); -+ String msg = "TileEntity threw exception at " + tileentity.world.getWorld().getName() + ":" + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ(); -+ System.err.println(msg); - throwable2.printStackTrace(); -+ getServer().getPluginManager().callEvent(new ServerExceptionEvent(new ServerInternalException(msg, throwable2))); - tilesThisCycle--; - this.tileEntityList.remove(tileTickPosition--); - continue; -diff --git a/src/main/java/net/minecraft/server/WorldNBTStorage.java b/src/main/java/net/minecraft/server/WorldNBTStorage.java -index e5124af..b4056a2 100644 ---- a/src/main/java/net/minecraft/server/WorldNBTStorage.java -+++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java -@@ -15,6 +15,7 @@ import org.apache.logging.log4j.Logger; - import java.util.UUID; - - import org.bukkit.craftbukkit.entity.CraftPlayer; -+import org.github.paperspigot.exception.ServerInternalException; - // CraftBukkit end - - public class WorldNBTStorage implements IDataManager, IPlayerFileData { -@@ -96,6 +97,7 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData { - return new WorldData(nbttagcompound1); - } catch (Exception exception) { - exception.printStackTrace(); -+ ServerInternalException.reportInternalException(exception); // Paper - } - } - -@@ -107,6 +109,7 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData { - return new WorldData(nbttagcompound1); - } catch (Exception exception1) { - exception1.printStackTrace(); -+ ServerInternalException.reportInternalException(exception1); // Paper - } - } - -@@ -140,6 +143,7 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData { - } - } catch (Exception exception) { - exception.printStackTrace(); -+ ServerInternalException.reportInternalException(exception); // Paper - } - - } -@@ -171,6 +175,7 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData { - } - } catch (Exception exception) { - exception.printStackTrace(); -+ ServerInternalException.reportInternalException(exception); // Paper - } - - } -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 72c0b17..7640070 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -55,6 +55,7 @@ import org.bukkit.metadata.MetadataValue; - import org.bukkit.plugin.Plugin; - import org.bukkit.plugin.messaging.StandardMessenger; - import org.bukkit.util.Vector; -+import org.github.paperspigot.exception.ServerInternalException; - - public class CraftWorld implements World { - public static final int CUSTOM_DIMENSION_OFFSET = 10; -@@ -778,6 +779,7 @@ public class CraftWorld implements World { - world.savingDisabled = oldSave; - } catch (ExceptionWorldConflict ex) { - ex.printStackTrace(); -+ ServerInternalException.reportInternalException(ex); // Paper - } - } - -diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java -index d76ec40..f036709 100644 ---- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java -+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java -@@ -21,6 +21,9 @@ import org.bukkit.scheduler.BukkitRunnable; - import org.bukkit.scheduler.BukkitScheduler; - import org.bukkit.scheduler.BukkitTask; - import org.bukkit.scheduler.BukkitWorker; -+import org.github.paperspigot.ServerSchedulerReportingWrapper; -+import org.github.paperspigot.event.ServerExceptionEvent; -+import org.github.paperspigot.exception.ServerSchedulerException; - - /** - * The fundamental concepts for this implementation: -@@ -348,18 +351,24 @@ public class CraftScheduler implements BukkitScheduler { - try { - task.run(); - } catch (final Throwable throwable) { -+ // Paper start -+ String msg = String.format( -+ "Task #%s for %s generated an exception", -+ task.getTaskId(), -+ task.getOwner().getDescription().getFullName()); - task.getOwner().getLogger().log( - Level.WARNING, -- String.format( -- "Task #%s for %s generated an exception", -- task.getTaskId(), -- task.getOwner().getDescription().getFullName()), -+ msg, - throwable); -+ task.getOwner().getServer().getPluginManager().callEvent( -+ new ServerExceptionEvent(new ServerSchedulerException(msg, throwable, task)) -+ ); -+ // Paper end - } - parsePending(); - } else { - debugTail = debugTail.setNext(new CraftAsyncDebugger(currentTick + RECENT_TICKS, task.getOwner(), task.getTaskClass())); -- executor.execute(task); -+ executor.execute(new ServerSchedulerReportingWrapper(task)); // Paper - // We don't need to parse pending - // (async tasks must live with race-conditions if they attempt to cancel between these few lines of code) - } -diff --git a/src/main/java/org/github/paperspigot/ServerSchedulerReportingWrapper.java b/src/main/java/org/github/paperspigot/ServerSchedulerReportingWrapper.java +diff --git a/src/main/java/com/destroystokyo/paper/ServerSchedulerReportingWrapper.java b/src/main/java/com/destroystokyo/paper/ServerSchedulerReportingWrapper.java new file mode 100644 -index 0000000..6499373 +index 0000000..9339718 --- /dev/null -+++ b/src/main/java/org/github/paperspigot/ServerSchedulerReportingWrapper.java -@@ -0,0 +1,39 @@ -+package org.github.paperspigot; ++++ b/src/main/java/com/destroystokyo/paper/ServerSchedulerReportingWrapper.java +@@ -0,0 +1,38 @@ ++package com.destroystokyo.paper; + +import com.google.common.base.Preconditions; -+import org.apache.commons.lang.Validate; +import org.bukkit.craftbukkit.scheduler.CraftTask; -+import org.github.paperspigot.event.ServerExceptionEvent; -+import org.github.paperspigot.exception.ServerSchedulerException; ++import com.destroystokyo.paper.event.server.ServerExceptionEvent; ++import com.destroystokyo.paper.exception.ServerSchedulerException; + +/** + * Reporting wrapper to catch exceptions not natively @@ -461,6 +48,329 @@ index 0000000..6499373 + return internalTask; + } +} +\ No newline at end of file +diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java +index f0c464b..e0c0a26 100644 +--- a/src/main/java/net/minecraft/server/Chunk.java ++++ b/src/main/java/net/minecraft/server/Chunk.java +@@ -1,5 +1,6 @@ + package net.minecraft.server; + ++import com.destroystokyo.paper.exception.ServerInternalException; + import com.google.common.base.Predicate; + import com.google.common.collect.Maps; + import com.google.common.collect.Queues; +@@ -18,6 +19,7 @@ import org.apache.logging.log4j.Logger; + + import com.google.common.collect.Lists; // CraftBukkit + import org.bukkit.Bukkit; // CraftBukkit ++import org.bukkit.craftbukkit.util.CraftMagicNumbers; + + public class Chunk { + +@@ -753,10 +755,15 @@ public class Chunk { + this.tileEntities.remove(blockposition); + // Paper end + } else { +- System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ() +- + " (" + org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(getBlockData(blockposition).getBlock()) + ") where there was no entity tile!"); +- System.out.println("Chunk coordinates: " + (this.locX * 16) + "," + (this.locZ * 16)); +- new Exception().printStackTrace(); ++ // Paper start ++ ServerInternalException e = new ServerInternalException( ++ "Attempted to place a tile entity (" + tileentity + ") at " + tileentity.position.getX() + "," ++ + tileentity.position.getY() + "," + tileentity.position.getZ() ++ + " (" + CraftMagicNumbers.getMaterial(getBlockData(blockposition).getBlock()) + ") where there was no entity tile!\n" + ++ "Chunk coordinates: " + (this.locX * 16) + "," + (this.locZ * 16)); ++ e.printStackTrace(); ++ ServerInternalException.reportInternalException(e); ++ // Paper end + // CraftBukkit end + } + } +diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java +index 72c1fc7..aaf844a 100644 +--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java +@@ -4,6 +4,7 @@ import java.io.IOException; + import java.util.Iterator; + import java.util.List; + ++import com.destroystokyo.paper.exception.ServerInternalException; + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; + +@@ -220,7 +221,11 @@ public class ChunkProviderServer implements IChunkProvider { + + return chunk; + } catch (Exception exception) { +- ChunkProviderServer.a.error("Couldn\'t load chunk", exception); ++ // Paper start ++ String msg = "Couldn\'t load chunk"; ++ ChunkProviderServer.a.error(msg, exception); ++ ServerInternalException.reportInternalException(exception); ++ // Paper end + return null; + } + } +@@ -229,7 +234,11 @@ public class ChunkProviderServer implements IChunkProvider { + try { + this.chunkLoader.b(this.world, chunk); + } catch (Exception exception) { +- ChunkProviderServer.a.error("Couldn\'t save entities", exception); ++ // Paper start ++ String msg = "Couldn\'t save entities"; ++ ChunkProviderServer.a.error(msg, exception); ++ ServerInternalException.reportInternalException(exception); ++ // Paper end + } + + } +@@ -239,9 +248,14 @@ public class ChunkProviderServer implements IChunkProvider { + chunk.setLastSaved(this.world.getTime()); + this.chunkLoader.a(this.world, chunk); + } catch (IOException ioexception) { +- ChunkProviderServer.a.error("Couldn\'t save chunk", ioexception); ++ // Paper start ++ String msg = "Couldn\'t save chunk"; ++ ChunkProviderServer.a.error(msg, ioexception); ++ ServerInternalException.reportInternalException(ioexception); + } catch (ExceptionWorldConflict exceptionworldconflict) { +- ChunkProviderServer.a.error("Couldn\'t save chunk; already in use by another instance of Minecraft?", exceptionworldconflict); ++ String msg = "Couldn\'t save chunk; already in use by another instance of Minecraft?"; ++ ChunkProviderServer.a.error(msg, exceptionworldconflict); ++ ServerInternalException.reportInternalException(exceptionworldconflict); + } + + } +diff --git a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java +index c527b3f..6aad092 100644 +--- a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java ++++ b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java +@@ -1,5 +1,6 @@ + package net.minecraft.server; + ++import com.destroystokyo.paper.exception.ServerInternalException; + import com.google.common.base.Charsets; + import com.google.common.base.Predicate; + import com.google.common.collect.Iterators; +@@ -360,6 +361,7 @@ public class NameReferencingFileConverter { + root = NBTCompressedStreamTools.a(new java.io.FileInputStream(file1)); + } catch (Exception exception) { + exception.printStackTrace(); ++ ServerInternalException.reportInternalException(exception); // Paper + } + + if (root != null) { +@@ -373,6 +375,7 @@ public class NameReferencingFileConverter { + NBTCompressedStreamTools.a(root, new java.io.FileOutputStream(file2)); + } catch (Exception exception) { + exception.printStackTrace(); ++ ServerInternalException.reportInternalException(exception); // Paper + } + } + // CraftBukkit end +diff --git a/src/main/java/net/minecraft/server/PersistentCollection.java b/src/main/java/net/minecraft/server/PersistentCollection.java +index 6f013eb..054cf63 100644 +--- a/src/main/java/net/minecraft/server/PersistentCollection.java ++++ b/src/main/java/net/minecraft/server/PersistentCollection.java +@@ -1,5 +1,6 @@ + package net.minecraft.server; + ++import com.destroystokyo.paper.exception.ServerInternalException; + import com.google.common.collect.Lists; + import com.google.common.collect.Maps; + import java.io.DataInputStream; +@@ -51,6 +52,7 @@ public class PersistentCollection { + } + } catch (Exception exception1) { + exception1.printStackTrace(); ++ ServerInternalException.reportInternalException(exception1); // Paper + } + } + +@@ -103,6 +105,7 @@ public class PersistentCollection { + } + } catch (Exception exception) { + exception.printStackTrace(); ++ ServerInternalException.reportInternalException(exception); // Paper + } + + } +diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java +index 4c39b54..aa74c87 100644 +--- a/src/main/java/net/minecraft/server/RegionFile.java ++++ b/src/main/java/net/minecraft/server/RegionFile.java +@@ -1,5 +1,6 @@ + package net.minecraft.server; + ++import com.destroystokyo.paper.exception.ServerInternalException; + import com.google.common.collect.Lists; + import java.io.BufferedInputStream; + import java.io.BufferedOutputStream; +@@ -82,6 +83,7 @@ public class RegionFile { + } + } catch (IOException ioexception) { + ioexception.printStackTrace(); ++ ServerInternalException.reportInternalException(ioexception); // Paper + } + + } +@@ -247,6 +249,7 @@ public class RegionFile { + this.b(i, j, (int) (MinecraftServer.av() / 1000L)); + } catch (IOException ioexception) { + ioexception.printStackTrace(); ++ ServerInternalException.reportInternalException(ioexception); // Paper + } + + } +diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java +index 01a08d4..5eb01c3 100644 +--- a/src/main/java/net/minecraft/server/RegionFileCache.java ++++ b/src/main/java/net/minecraft/server/RegionFileCache.java +@@ -1,5 +1,6 @@ + package net.minecraft.server; + ++import com.destroystokyo.paper.exception.ServerInternalException; + import com.google.common.collect.Maps; + import java.io.DataInputStream; + import java.io.DataOutputStream; +@@ -54,6 +55,7 @@ public class RegionFileCache { + } + } catch (IOException ioexception) { + ioexception.printStackTrace(); ++ ServerInternalException.reportInternalException(ioexception); // Paper + } + } + +diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java +index b724586..63e118d 100644 +--- a/src/main/java/net/minecraft/server/SpawnerCreature.java ++++ b/src/main/java/net/minecraft/server/SpawnerCreature.java +@@ -5,6 +5,7 @@ import java.util.List; + import java.util.Random; + + // CraftBukkit start ++import com.destroystokyo.paper.exception.ServerInternalException; + import org.bukkit.craftbukkit.util.LongHash; + import org.bukkit.craftbukkit.util.LongHashSet; + import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; +@@ -175,6 +176,7 @@ public final class SpawnerCreature { + entityinsentient = (EntityInsentient) biomebase_biomemeta.b.getConstructor(new Class[] { World.class}).newInstance(new Object[] { worldserver}); + } catch (Exception exception) { + exception.printStackTrace(); ++ ServerInternalException.reportInternalException(exception); // Paper + return j1; + } + +@@ -282,6 +284,7 @@ public final class SpawnerCreature { + entityinsentient = (EntityInsentient) biomebase_biomemeta.b.getConstructor(new Class[] { World.class}).newInstance(new Object[] { world}); + } catch (Exception exception) { + exception.printStackTrace(); ++ ServerInternalException.reportInternalException(exception); // Paper + continue; + } + +diff --git a/src/main/java/net/minecraft/server/VillageSiege.java b/src/main/java/net/minecraft/server/VillageSiege.java +index 320e52e..d40257f 100644 +--- a/src/main/java/net/minecraft/server/VillageSiege.java ++++ b/src/main/java/net/minecraft/server/VillageSiege.java +@@ -1,5 +1,7 @@ + package net.minecraft.server; + ++import com.destroystokyo.paper.exception.ServerInternalException; ++ + import java.util.Iterator; + import java.util.List; + +@@ -136,6 +138,7 @@ public class VillageSiege { + entityzombie.clearVillagerType(); + } catch (Exception exception) { + exception.printStackTrace(); ++ ServerInternalException.reportInternalException(exception); // Paper + return false; + } + +diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java +index 05f3e45..2b22762 100644 +--- a/src/main/java/net/minecraft/server/World.java ++++ b/src/main/java/net/minecraft/server/World.java +@@ -1,5 +1,7 @@ + package net.minecraft.server; + ++import com.destroystokyo.paper.event.server.ServerExceptionEvent; ++import com.destroystokyo.paper.exception.ServerInternalException; + import com.google.common.base.Function; + import com.google.common.base.Objects; + import com.google.common.base.Predicate; +@@ -1412,8 +1414,10 @@ public abstract class World implements IBlockAccess { + } catch (Throwable throwable1) { + // Paper start - Prevent tile entity and entity crashes + entity.tickTimer.stopTiming(); +- System.err.println("Entity threw exception at " + entity.world.getWorld().getName() + ":" + entity.locX + "," + entity.locY + "," + entity.locZ); ++ String msg = "Entity threw exception at " + entity.world.getWorld().getName() + ":" + entity.locX + "," + entity.locY + "," + entity.locZ; ++ System.err.println(msg); + throwable1.printStackTrace(); ++ getServer().getPluginManager().callEvent(new ServerExceptionEvent(new ServerInternalException(msg, throwable1))); + entity.dead = true; + continue; + // Paper end +@@ -1478,8 +1482,10 @@ public abstract class World implements IBlockAccess { + } catch (Throwable throwable2) { + // Paper start - Prevent tile entity and entity crashes + tileentity.tickTimer.stopTiming(); +- System.err.println("TileEntity threw exception at " + tileentity.world.getWorld().getName() + ":" + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ()); ++ String msg = "TileEntity threw exception at " + tileentity.world.getWorld().getName() + ":" + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ(); ++ System.err.println(msg); + throwable2.printStackTrace(); ++ getServer().getPluginManager().callEvent(new ServerExceptionEvent(new ServerInternalException(msg, throwable2))); + tilesThisCycle--; + this.tileEntityListTick.remove(tileTickPosition--); + continue; +diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java +index 44e057c..cf0bd0c 100644 +--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java ++++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java +@@ -14,6 +14,9 @@ import java.util.concurrent.atomic.AtomicInteger; + import java.util.concurrent.atomic.AtomicReference; + import java.util.logging.Level; + ++import com.destroystokyo.paper.ServerSchedulerReportingWrapper; ++import com.destroystokyo.paper.event.server.ServerExceptionEvent; ++import com.destroystokyo.paper.exception.ServerSchedulerException; + import org.apache.commons.lang.Validate; + import org.bukkit.plugin.IllegalPluginAccessException; + import org.bukkit.plugin.Plugin; +@@ -348,18 +351,24 @@ public class CraftScheduler implements BukkitScheduler { + try { + task.run(); + } catch (final Throwable throwable) { ++ // Paper start ++ String msg = String.format( ++ "Task #%s for %s generated an exception", ++ task.getTaskId(), ++ task.getOwner().getDescription().getFullName()); + task.getOwner().getLogger().log( + Level.WARNING, +- String.format( +- "Task #%s for %s generated an exception", +- task.getTaskId(), +- task.getOwner().getDescription().getFullName()), ++ msg, + throwable); ++ task.getOwner().getServer().getPluginManager().callEvent( ++ new ServerExceptionEvent(new ServerSchedulerException(msg, throwable, task)) ++ ); ++ // Paper end + } + parsePending(); + } else { + debugTail = debugTail.setNext(new CraftAsyncDebugger(currentTick + RECENT_TICKS, task.getOwner(), task.getTaskClass())); +- executor.execute(task); ++ executor.execute(new ServerSchedulerReportingWrapper(task)); // Paper + // We don't need to parse pending + // (async tasks must live with race-conditions if they attempt to cancel between these few lines of code) + } -- -2.5.0 +2.7.2 diff --git a/Spigot-Server-Patches/0078-SPIGOT-1387-Resolve-bed-issues-on-unloaded-chunks.patch b/Spigot-Server-Patches/0078-SPIGOT-1387-Resolve-bed-issues-on-unloaded-chunks.patch deleted file mode 100644 index 570ea1b717..0000000000 --- a/Spigot-Server-Patches/0078-SPIGOT-1387-Resolve-bed-issues-on-unloaded-chunks.patch +++ /dev/null @@ -1,31 +0,0 @@ -From a18b77ffab781c98e48ceea4c21cf68acab350ee Mon Sep 17 00:00:00 2001 -From: chickeneer -Date: Mon, 4 Jan 2016 00:19:32 -0600 -Subject: [PATCH] SPIGOT-1387: Resolve bed issues on unloaded chunks - - -diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index cc1e33c..0ad4edb 100644 ---- a/src/main/java/net/minecraft/server/EntityHuman.java -+++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -1271,7 +1271,17 @@ public abstract class EntityHuman extends EntityLiving { - return this.world.getType(this.bx).getBlock() == Blocks.BED; - } - -+ // PaperSpigot start - SPIGOT-1387: Resolve bed issues on unloaded chunks - public static BlockPosition getBed(World world, BlockPosition blockposition, boolean flag) { -+ boolean before = ((WorldServer) world).chunkProviderServer.forceChunkLoad; -+ ((WorldServer) world).chunkProviderServer.forceChunkLoad = true; -+ final BlockPosition result = getBed0(world, blockposition, flag); -+ ((WorldServer) world).chunkProviderServer.forceChunkLoad = before; -+ return result; -+ } -+ -+ private static BlockPosition getBed0(World world, BlockPosition blockposition, boolean flag) { -+ // PaperSpigot end - ((ChunkProviderServer) world.chunkProvider).getChunkAt(blockposition.getX() >> 4, blockposition.getZ() >> 4); // CraftBukkit - Block block = world.getType(blockposition).getBlock(); - --- -2.7.0.windows.2 - diff --git a/Spigot-Server-Patches/0080-Disable-chest-cat-detection.patch b/Spigot-Server-Patches/0080-Disable-chest-cat-detection.patch deleted file mode 100644 index 246ccc21b8..0000000000 --- a/Spigot-Server-Patches/0080-Disable-chest-cat-detection.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 4848135e06d958fd85b7cda96e131280270fb39c Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sun, 10 Jan 2016 20:40:33 -0600 -Subject: [PATCH] Disable chest cat detection - - -diff --git a/src/main/java/net/minecraft/server/BlockChest.java b/src/main/java/net/minecraft/server/BlockChest.java -index f725aea..eed516e 100644 ---- a/src/main/java/net/minecraft/server/BlockChest.java -+++ b/src/main/java/net/minecraft/server/BlockChest.java -@@ -410,6 +410,11 @@ public class BlockChest extends BlockContainer { - } - - private boolean p(World world, BlockPosition blockposition) { -+ // PaperSpigot start - Option to disable chest's cat detection (Performance++) -+ if (world.paperSpigotConfig.disableChestCatDetection) { -+ return false; -+ } -+ // PaperSpigot end - Iterator iterator = world.a(EntityOcelot.class, new AxisAlignedBB((double) blockposition.getX(), (double) (blockposition.getY() + 1), (double) blockposition.getZ(), (double) (blockposition.getX() + 1), (double) (blockposition.getY() + 2), (double) (blockposition.getZ() + 1))).iterator(); - - EntityOcelot entityocelot; -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index 7eb3463..b6ce3bb 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -193,10 +193,12 @@ public class PaperSpigotWorldConfig - - public boolean boatsDropBoats; - public boolean disablePlayerCrits; -+ public boolean disableChestCatDetection; - private void mechanicsChanges() - { - boatsDropBoats = getBoolean( "game-mechanics.boats-drop-boats", false ); - disablePlayerCrits = getBoolean( "game-mechanics.disable-player-crits", false ); -+ disableChestCatDetection = getBoolean( "game-mechanics.disable-chest-cat-detection", false ); - } - - public boolean netherVoidTopDamage; --- -2.7.0.windows.2 - diff --git a/Spigot-Server-Patches/0082-All-chunks-are-slime-spawn-chunks-toggle.patch b/Spigot-Server-Patches/0082-All-chunks-are-slime-spawn-chunks-toggle.patch deleted file mode 100644 index e1d1616d5a..0000000000 --- a/Spigot-Server-Patches/0082-All-chunks-are-slime-spawn-chunks-toggle.patch +++ /dev/null @@ -1,39 +0,0 @@ -From a5cddf0754b5fada17bb1fa82675b46539fe8560 Mon Sep 17 00:00:00 2001 -From: vemacs -Date: Fri, 29 Jan 2016 02:28:17 -0600 -Subject: [PATCH] All chunks are slime spawn chunks toggle - - -diff --git a/src/main/java/net/minecraft/server/EntitySlime.java b/src/main/java/net/minecraft/server/EntitySlime.java -index d39df07..c927832 100644 ---- a/src/main/java/net/minecraft/server/EntitySlime.java -+++ b/src/main/java/net/minecraft/server/EntitySlime.java -@@ -234,7 +234,9 @@ public class EntitySlime extends EntityInsentient implements IMonster { - return super.bR(); - } - -- if (this.random.nextInt(10) == 0 && chunk.a(987234911L).nextInt(10) == 0 && this.locY < 40.0D) { -+ // PaperSpigot - Toggle to make all chunks spawn chunks -+ boolean isSlimeChunk = world.paperSpigotConfig.allChunksAreSlimeChunks || chunk.a(987234911L).nextInt(10) == 0; -+ if (this.random.nextInt(10) == 0 && isSlimeChunk && this.locY < 40.0D) { - return super.bR(); - } - } -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index b6ce3bb..00057a1 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -384,4 +384,10 @@ public class PaperSpigotWorldConfig - { - useHopperCheck = getBoolean( "use-hopper-check", false ); - } -+ -+ public boolean allChunksAreSlimeChunks; -+ private void allChunksAreSlimeChunks() -+ { -+ allChunksAreSlimeChunks = getBoolean( "all-chunks-are-slime-chunks", false ); -+ } - } --- -2.7.0.windows.2 - diff --git a/Spigot-Server-Patches/0083-Speedup-BlockPos-by-fixing-inlining.patch b/Spigot-Server-Patches/0083-Speedup-BlockPos-by-fixing-inlining.patch deleted file mode 100644 index 3e34118a78..0000000000 --- a/Spigot-Server-Patches/0083-Speedup-BlockPos-by-fixing-inlining.patch +++ /dev/null @@ -1,156 +0,0 @@ -From 08d6547e66d3c8f7ad0fab9e4bde4741c2ca1386 Mon Sep 17 00:00:00 2001 -From: Techcable -Date: Fri, 29 Jan 2016 03:24:21 -0600 -Subject: [PATCH] Speedup BlockPos by fixing inlining - -Normally the JVM can inline virtual getters by having two sets of code, one is the 'optimized' code and the other is the 'deoptimized' code. -If a single type is used 99% of the time, then its worth it to inline, and to revert to 'deoptimized' the 1% of the time we encounter other types. -But if two types are encountered commonly, then the JVM can't inline them both, and the call overhead remains. - -This scenario also occurs with BlockPos and MutableBlockPos. -The variables in BlockPos are final, so MutableBlockPos can't modify them. -MutableBlockPos fixes this by adding custom mutable variables, and overriding the getters to access them. - -This approach with utility methods that operate on MutableBlockPos and BlockPos. -Specific examples are BlockPosition.up(), and World.isValidLocation(). -It makes these simple methods much slower than they need to be. - -This should result in an across the board speedup in anything that accesses blocks or does logic with positions. - -This is based upon conclusions drawn from inspecting the assenmbly generated bythe JIT compiler on my mircorbenchmarks. -They had 'callq' (invoke) instead of 'mov' (get from memory) instructions. - -diff --git a/src/main/java/net/minecraft/server/BaseBlockPosition.java b/src/main/java/net/minecraft/server/BaseBlockPosition.java -index 0b2277c..a685e08 100644 ---- a/src/main/java/net/minecraft/server/BaseBlockPosition.java -+++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java -@@ -5,9 +5,11 @@ import com.google.common.base.Objects; - public class BaseBlockPosition implements Comparable { - - public static final BaseBlockPosition ZERO = new BaseBlockPosition(0, 0, 0); -- private final int a; -- private final int c; -- private final int d; -+ // PaperSpigot start - Make mutable and protected for MutableBlockPos -+ protected int a; -+ protected int c; -+ protected int d; -+ // PaperSpigot end - - public BaseBlockPosition(int i, int j, int k) { - this.a = i; -@@ -39,17 +41,19 @@ public class BaseBlockPosition implements Comparable { - return this.getY() == baseblockposition.getY() ? (this.getZ() == baseblockposition.getZ() ? this.getX() - baseblockposition.getX() : this.getZ() - baseblockposition.getZ()) : this.getY() - baseblockposition.getY(); - } - -- public int getX() { -+ // PaperSpigot start - Only allow one implementation of these methods (make final) -+ public final int getX() { - return this.a; - } - -- public int getY() { -+ public final int getY() { - return this.c; - } - -- public int getZ() { -+ public final int getZ() { - return this.d; - } -+ // PaperSpigot end - - public BaseBlockPosition d(BaseBlockPosition baseblockposition) { - return new BaseBlockPosition(this.getY() * baseblockposition.getZ() - this.getZ() * baseblockposition.getY(), this.getZ() * baseblockposition.getX() - this.getX() * baseblockposition.getZ(), this.getX() * baseblockposition.getY() - this.getY() * baseblockposition.getX()); -@@ -79,7 +83,8 @@ public class BaseBlockPosition implements Comparable { - return Objects.toStringHelper(this).add("x", this.getX()).add("y", this.getY()).add("z", this.getZ()).toString(); - } - -- public int compareTo(Object object) { -+ // Paperspigot - Signature change, Object -> BaseBlockPosition -+ public int compareTo(BaseBlockPosition object) { - return this.g((BaseBlockPosition) object); - } - } -diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java -index 2bd5499..0d0e0ab 100644 ---- a/src/main/java/net/minecraft/server/BlockPosition.java -+++ b/src/main/java/net/minecraft/server/BlockPosition.java -@@ -198,9 +198,11 @@ public class BlockPosition extends BaseBlockPosition { - ++k; - } - -- this.b.c = i; -- this.b.d = j; -- this.b.e = k; -+ // PaperSpigot start -+ this.b.setX(i); -+ this.b.setY(j); -+ this.b.setZ(k); -+ // PaperSpigot stop - return this.b; - } - } -@@ -219,9 +221,25 @@ public class BlockPosition extends BaseBlockPosition { - - public static final class MutableBlockPosition extends BlockPosition { - -+ // PaperSpigot start - remove our overriding variables -+ /* - private int c; - private int d; - private int e; -+ */ -+ -+ public void setX(int x) { -+ ((BaseBlockPosition) this).a = x; -+ } -+ -+ public void setY(int y) { -+ ((BaseBlockPosition) this).c = y; -+ } -+ -+ public void setZ(int z) { -+ ((BaseBlockPosition) this).d = z; -+ } -+ // PaperSpigot end - - public MutableBlockPosition() { - this(0, 0, 0); -@@ -229,11 +247,13 @@ public class BlockPosition extends BaseBlockPosition { - - public MutableBlockPosition(int i, int j, int k) { - super(0, 0, 0); -- this.c = i; -- this.d = j; -- this.e = k; -+ // PaperSpigot start - modify base x,y,z -+ this.setX(i); -+ this.setY(j); -+ this.setZ(k); - } - -+ /* - public int getX() { - return this.c; - } -@@ -245,11 +265,13 @@ public class BlockPosition extends BaseBlockPosition { - public int getZ() { - return this.e; - } -+ */ - - public BlockPosition.MutableBlockPosition c(int i, int j, int k) { -- this.c = i; -- this.d = j; -- this.e = k; -+ setX(i); -+ setY(j); -+ setZ(k); -+ // PaperSpigot end - return this; - } - --- -2.7.0.windows.2 - diff --git a/Spigot-Server-Patches/0084-Remove-completely-invalid-Redstone-event-for-Netherr.patch b/Spigot-Server-Patches/0084-Remove-completely-invalid-Redstone-event-for-Netherr.patch deleted file mode 100644 index cea8652407..0000000000 --- a/Spigot-Server-Patches/0084-Remove-completely-invalid-Redstone-event-for-Netherr.patch +++ /dev/null @@ -1,27 +0,0 @@ -From c01d3012a7608566bf361ca4392cb8c0085ea248 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Fri, 29 Jan 2016 03:39:09 -0600 -Subject: [PATCH] Remove completely invalid Redstone event for Netherrack - -Was added years ago to special case 1 specific plugins needs -at that time, and is now causing heavy redstone lag in the -nether. - -diff --git a/src/main/java/net/minecraft/server/BlockBloodStone.java b/src/main/java/net/minecraft/server/BlockBloodStone.java -index 7daf006..0158497 100644 ---- a/src/main/java/net/minecraft/server/BlockBloodStone.java -+++ b/src/main/java/net/minecraft/server/BlockBloodStone.java -@@ -14,8 +14,8 @@ public class BlockBloodStone extends Block { - } - - // CraftBukkit start -- @Override -- public void doPhysics(World world, BlockPosition position, IBlockData iblockdata, Block block) { -+ //@Override // PaperSpigot - Remove completely invalid Redstone event for Netherrack -+ public void doPhysics_nvmplsdont(World world, BlockPosition position, IBlockData iblockdata, Block block) { - if (block != null && block.isPowerSource()) { - org.bukkit.block.Block bl = world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ()); - int power = bl.getBlockPower(); --- -2.7.0.windows.2 - diff --git a/Spigot-Server-Patches/0086-Made-EntityDismountEvent-Cancellable.patch b/Spigot-Server-Patches/0086-Made-EntityDismountEvent-Cancellable.patch deleted file mode 100644 index 3e38ed9f98..0000000000 --- a/Spigot-Server-Patches/0086-Made-EntityDismountEvent-Cancellable.patch +++ /dev/null @@ -1,68 +0,0 @@ -From b79b958ca82c49a83def1f2f4e8f02fbf7ee7e9d Mon Sep 17 00:00:00 2001 -From: Nik Gil -Date: Mon, 1 Feb 2016 23:47:24 -0700 -Subject: [PATCH] Made EntityDismountEvent Cancellable - - -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index ef59b40..2da303f 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -33,6 +33,10 @@ import org.bukkit.event.entity.EntityPortalEvent; - import org.bukkit.plugin.PluginManager; - // CraftBukkit end - -+// PaperSpigot start -+import org.spigotmc.event.entity.EntityDismountEvent; -+// PaperSpigot end -+ - public abstract class Entity implements ICommandListener { - - // CraftBukkit start -@@ -1576,7 +1580,11 @@ public abstract class Entity implements ICommandListener { - } - } - // CraftBukkit end -- pluginManager.callEvent( new org.spigotmc.event.entity.EntityDismountEvent( this.getBukkitEntity(), this.vehicle.getBukkitEntity() ) ); // Spigot -+ // PaperSpigot start - make EntityDismountEvent cancellable -+ EntityDismountEvent dismountEvent = new EntityDismountEvent(this.getBukkitEntity(), this.vehicle.getBukkitEntity()); // Spigot -+ pluginManager.callEvent(dismountEvent); -+ if (dismountEvent.isCancelled()) return; -+ // PaperSpigot end - this.setPositionRotation(this.vehicle.locX, this.vehicle.getBoundingBox().b + (double) this.vehicle.length, this.vehicle.locZ, this.yaw, this.pitch); - this.vehicle.passenger = null; - } -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 19a743c..c8b4e29 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -25,6 +25,11 @@ import org.bukkit.event.vehicle.VehicleExitEvent; - - import co.aikar.timings.SpigotTimings; // Spigot - -+// PaperSpigot start -+import org.bukkit.Bukkit; -+import org.spigotmc.event.entity.EntityDismountEvent; -+// PaperSpigot end -+ - public abstract class EntityLiving extends Entity { - - private static final UUID a = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D"); -@@ -1709,8 +1714,12 @@ public abstract class EntityLiving extends Entity { - } - } - // CraftBukkit end -- org.bukkit.Bukkit.getPluginManager().callEvent( new org.spigotmc.event.entity.EntityDismountEvent( this.getBukkitEntity(), this.vehicle.getBukkitEntity() ) ); // Spigot -- -+ // PaperSpigot start - make dismountEvent cancellable -+ EntityDismountEvent dismountEvent = new EntityDismountEvent(this.getBukkitEntity(), this.vehicle.getBukkitEntity()); // Spigot -+ Bukkit.getPluginManager().callEvent(dismountEvent); -+ if (dismountEvent.isCancelled()) return; -+ // PaperSpigot end -+ - if (!this.world.isClientSide) { - this.q(this.vehicle); - } --- -2.7.0.windows.2 - diff --git a/Spigot-Server-Patches/0087-Optimize-Pathfinding.patch b/Spigot-Server-Patches/0087-Optimize-Pathfinding.patch deleted file mode 100644 index 4e7420c0bc..0000000000 --- a/Spigot-Server-Patches/0087-Optimize-Pathfinding.patch +++ /dev/null @@ -1,68 +0,0 @@ -From c6cd94e6eaec67e31528ad1c871a473e9415bc61 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Mon, 18 Jan 2016 00:18:43 -0500 -Subject: [PATCH] Optimize Pathfinding - -Prevents pathfinding from spamming failures for things such as -arrow attacks. - -Also remove a duplicate .getType() call and fix .getType() on others -to make them use the chunk cache vs chunk lookups - -diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java -index d5eaa24..8ebe584 100644 ---- a/src/main/java/net/minecraft/server/NavigationAbstract.java -+++ b/src/main/java/net/minecraft/server/NavigationAbstract.java -@@ -82,10 +82,25 @@ public abstract class NavigationAbstract { - } - - public boolean a(Entity entity, double d0) { -+ // PaperSpigot start - Pathfinding optimizations -+ if (this.pathfindFailures > 10 && this.d == null && MinecraftServer.currentTick < this.lastFailure + 40) { -+ return false; -+ } - PathEntity pathentity = this.a(entity); - -- return pathentity != null ? this.a(pathentity, d0) : false; -+ if (pathentity != null && this.a(pathentity, d0)) { -+ this.lastFailure = 0; -+ this.pathfindFailures = 0; -+ return true; -+ } else { -+ this.pathfindFailures++; -+ this.lastFailure = MinecraftServer.currentTick; -+ return false; -+ } - } -+ private int lastFailure = 0; -+ private int pathfindFailures = 0; -+ // PaperSpigot end - - public boolean a(PathEntity pathentity, double d0) { - if (pathentity == null) { -@@ -205,6 +220,7 @@ public abstract class NavigationAbstract { - } - - public void n() { -+ this.pathfindFailures = 0; this.lastFailure = 0; // PaperSpigot - Pathfinding optimizations - this.d = null; - } - -diff --git a/src/main/java/net/minecraft/server/PathfinderNormal.java b/src/main/java/net/minecraft/server/PathfinderNormal.java -index 0a14c9d..629aa16 100644 ---- a/src/main/java/net/minecraft/server/PathfinderNormal.java -+++ b/src/main/java/net/minecraft/server/PathfinderNormal.java -@@ -158,8 +158,8 @@ public class PathfinderNormal extends PathfinderAbstract { - flag3 = true; - } - -- if (entity.world.getType(blockposition_mutableblockposition).getBlock() instanceof BlockMinecartTrackAbstract) { -- if (!(entity.world.getType(blockposition).getBlock() instanceof BlockMinecartTrackAbstract) && !(entity.world.getType(blockposition.down()).getBlock() instanceof BlockMinecartTrackAbstract)) { -+ if (block instanceof BlockMinecartTrackAbstract) { // PaperSpigot - Pathfinder optimizations -+ if (!(iblockaccess.getType(blockposition).getBlock() instanceof BlockMinecartTrackAbstract) && !(iblockaccess.getType(blockposition.down()).getBlock() instanceof BlockMinecartTrackAbstract)) { // PaperSpigot - Pathfinder optimizations - return -3; - } - } else if (!block.b(iblockaccess, blockposition_mutableblockposition) && (!flag1 || !(block instanceof BlockDoor) || block.getMaterial() != Material.WOOD)) { --- -2.7.1 - diff --git a/Spigot-Server-Patches/0091-Fix-FurnaceMinecarts-losing-all-of-their-velocity-on.patch b/Spigot-Server-Patches/0091-Fix-FurnaceMinecarts-losing-all-of-their-velocity-on.patch deleted file mode 100644 index fbe32a3d4e..0000000000 --- a/Spigot-Server-Patches/0091-Fix-FurnaceMinecarts-losing-all-of-their-velocity-on.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 301c9572f887f801b027e43cfc4121e4fd520828 Mon Sep 17 00:00:00 2001 -From: Thinkofdeath -Date: Mon, 15 Feb 2016 23:16:00 -0600 -Subject: [PATCH] Fix FurnaceMinecarts losing all of their velocity on certain - corners - - -diff --git a/src/main/java/net/minecraft/server/EntityMinecartFurnace.java b/src/main/java/net/minecraft/server/EntityMinecartFurnace.java -index 55f04b4..908620d 100644 ---- a/src/main/java/net/minecraft/server/EntityMinecartFurnace.java -+++ b/src/main/java/net/minecraft/server/EntityMinecartFurnace.java -@@ -58,17 +58,12 @@ public class EntityMinecartFurnace extends EntityMinecartAbstract { - - if (d0 > 1.0E-4D && this.motX * this.motX + this.motZ * this.motZ > 0.001D) { - d0 = (double) MathHelper.sqrt(d0); -- this.a /= d0; -- this.b /= d0; -- if (this.a * this.motX + this.b * this.motZ < 0.0D) { -- this.a = 0.0D; -- this.b = 0.0D; -- } else { -- double d1 = d0 / this.m(); -- -- this.a *= d1; -- this.b *= d1; -- } -+ // PaperSpigot - Don't lose all your velocity on corners -+ // https://bugs.mojang.com/browse/MC-51053?focusedCommentId=223854 -+ double d1 = (double) MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ); -+ this.a = (motX / d1) * d0; -+ this.b = (motZ / d1) * d0; -+ // PaperSpigot end - } - - } --- -2.7.1 - diff --git a/Spigot-Server-Patches/0094-Player-Tab-List-and-Title-APIs.patch b/Spigot-Server-Patches/0094-Player-Tab-List-and-Title-APIs.patch deleted file mode 100644 index adc33afbab..0000000000 --- a/Spigot-Server-Patches/0094-Player-Tab-List-and-Title-APIs.patch +++ /dev/null @@ -1,205 +0,0 @@ -From 88944a9edb0263524b98a1f1731831a360de0bd9 Mon Sep 17 00:00:00 2001 -From: Techcable -Date: Tue, 16 Feb 2016 19:45:55 -0600 -Subject: [PATCH] Player Tab List and Title APIs - - -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutPlayerListHeaderFooter.java b/src/main/java/net/minecraft/server/PacketPlayOutPlayerListHeaderFooter.java -index 1606d6d..795e70a 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutPlayerListHeaderFooter.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutPlayerListHeaderFooter.java -@@ -4,6 +4,8 @@ import java.io.IOException; - - public class PacketPlayOutPlayerListHeaderFooter implements Packet { - -+ public net.md_5.bungee.api.chat.BaseComponent[] header, footer; // Paper -+ - private IChatBaseComponent a; - private IChatBaseComponent b; - -@@ -19,15 +21,30 @@ public class PacketPlayOutPlayerListHeaderFooter implements Packet { - private int d; - private int e; - -+ // Paper start -+ public net.md_5.bungee.api.chat.BaseComponent[] components; -+ -+ public PacketPlayOutTitle(EnumTitleAction action, net.md_5.bungee.api.chat.BaseComponent[] components, int fadeIn, int stay, int fadeOut) { -+ this.a = action; -+ this.components = components; -+ this.c = fadeIn; -+ this.d = stay; -+ this.e = fadeOut; -+ } -+ // Paper end -+ - public PacketPlayOutTitle() {} - - public PacketPlayOutTitle(EnumTitleAction packetplayouttitle_enumtitleaction, IChatBaseComponent ichatbasecomponent) { -@@ -45,7 +57,13 @@ public class PacketPlayOutTitle implements Packet { - public void b(PacketDataSerializer packetdataserializer) throws IOException { - packetdataserializer.a((Enum) this.a); - if (this.a == EnumTitleAction.TITLE || this.a == EnumTitleAction.SUBTITLE) { -- packetdataserializer.a(this.b); -+ // Paper start -+ if (this.components != null) { -+ packetdataserializer.a(net.md_5.bungee.chat.ComponentSerializer.toString(components)); -+ } else { -+ packetdataserializer.a(this.b); -+ } -+ // Paper end - } - - if (this.a == EnumTitleAction.TIMES) { -@@ -60,9 +78,13 @@ public class PacketPlayOutTitle implements Packet { - packetlistenerplayout.a(this); - } - -+ // PaperSpigot start - fix compile error -+ /* - public void a(PacketListener packetlistener) { - this.a((PacketListenerPlayOut) packetlistener); - } -+ */ -+ // PaperSpigot end - - public static enum EnumTitleAction { - -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index dba0520..3075076 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -64,6 +64,9 @@ import org.bukkit.metadata.MetadataValue; - import org.bukkit.plugin.Plugin; - import org.bukkit.plugin.messaging.StandardMessenger; - import org.bukkit.scoreboard.Scoreboard; -+// PaperSpigot start -+import org.github.paperspigot.Title; -+// PaperSpigot end - - @DelegateDeserialization(CraftOfflinePlayer.class) - public class CraftPlayer extends CraftHumanEntity implements Player { -@@ -176,6 +179,83 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - packet.components = components; - getHandle().playerConnection.sendPacket(packet); - } -+ -+ @Override -+ public void setPlayerListHeaderFooter(BaseComponent[] header, BaseComponent[] footer) { -+ PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter(); -+ packet.header = header; -+ packet.footer = footer; -+ getHandle().playerConnection.sendPacket(packet); -+ } -+ -+ @Override -+ public void setPlayerListHeaderFooter(BaseComponent header, BaseComponent footer) { -+ this.setPlayerListHeaderFooter(header == null ? null : new BaseComponent[]{header}, -+ footer == null ? null : new BaseComponent[]{footer}); -+ } -+ -+ -+ @Override -+ public void setTitleTimes(int fadeInTicks, int stayTicks, int fadeOutTicks) { -+ getHandle().playerConnection.sendPacket(new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.TIMES, (BaseComponent[]) null, fadeInTicks, stayTicks, fadeOutTicks)); -+ } -+ -+ @Override -+ public void setSubtitle(BaseComponent[] subtitle) { -+ getHandle().playerConnection.sendPacket(new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.SUBTITLE, subtitle, 0, 0, 0)); -+ } -+ -+ @Override -+ public void setSubtitle(BaseComponent subtitle) { -+ setSubtitle(new BaseComponent[]{subtitle}); -+ } -+ -+ @Override -+ public void showTitle(BaseComponent[] title) { -+ getHandle().playerConnection.sendPacket(new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.TITLE, title, 0, 0, 0)); -+ } -+ -+ @Override -+ public void showTitle(BaseComponent title) { -+ showTitle(new BaseComponent[]{title}); -+ } -+ -+ @Override -+ public void showTitle(BaseComponent[] title, BaseComponent[] subtitle, int fadeInTicks, int stayTicks, int fadeOutTicks) { -+ setTitleTimes(fadeInTicks, stayTicks, fadeOutTicks); -+ setSubtitle(subtitle); -+ showTitle(title); -+ } -+ -+ @Override -+ public void showTitle(BaseComponent title, BaseComponent subtitle, int fadeInTicks, int stayTicks, int fadeOutTicks) { -+ setTitleTimes(fadeInTicks, stayTicks, fadeOutTicks); -+ setSubtitle(subtitle); -+ showTitle(title); -+ } -+ -+ @Override -+ public void sendTitle(Title title) { -+ Preconditions.checkNotNull(title, "Title is null"); -+ setTitleTimes(title.getFadeIn(), title.getStay(), title.getFadeOut()); -+ setSubtitle(title.getSubtitle() == null ? new BaseComponent[0] : title.getSubtitle()); -+ showTitle(title.getTitle()); -+ } -+ -+ @Override -+ public void updateTitle(Title title) { -+ Preconditions.checkNotNull(title, "Title is null"); -+ setTitleTimes(title.getFadeIn(), title.getStay(), title.getFadeOut()); -+ if (title.getSubtitle() != null) { -+ setSubtitle(title.getSubtitle()); -+ } -+ showTitle(title.getTitle()); -+ } -+ -+ @Override -+ public void hideTitle() { -+ getHandle().playerConnection.sendPacket(new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.CLEAR, (BaseComponent[]) null, 0, 0, 0)); -+ } - // Paper end - - @Override --- -2.7.1 - diff --git a/Spigot-Server-Patches/0095-Ensure-inv-drag-is-in-bounds.patch b/Spigot-Server-Patches/0095-Ensure-inv-drag-is-in-bounds.patch deleted file mode 100644 index e44fdb9997..0000000000 --- a/Spigot-Server-Patches/0095-Ensure-inv-drag-is-in-bounds.patch +++ /dev/null @@ -1,22 +0,0 @@ -From df382ed55169c36f68183a98494e24277c2b3553 Mon Sep 17 00:00:00 2001 -From: Joseph Hirschfeld -Date: Sat, 20 Feb 2016 02:19:31 -0500 -Subject: [PATCH] Ensure inv drag is in bounds - - -diff --git a/src/main/java/net/minecraft/server/Container.java b/src/main/java/net/minecraft/server/Container.java -index 3cfaa75..7fc4957 100644 ---- a/src/main/java/net/minecraft/server/Container.java -+++ b/src/main/java/net/minecraft/server/Container.java -@@ -138,7 +138,7 @@ public abstract class Container { - this.d(); - } - } else if (this.g == 1) { -- Slot slot = (Slot) this.c.get(i); -+ Slot slot = i < this.c.size() ? this.c.get(i) : null; // Paper - Ensure drag in bounds - - if (slot != null && a(slot, playerinventory.getCarried(), true) && slot.isAllowed(playerinventory.getCarried()) && playerinventory.getCarried().count > this.h.size() && this.b(slot)) { - this.h.add(slot); --- -2.7.1 - diff --git a/Spigot-Server-Patches/0096-Change-implementation-of-tile-entity-removal-list.patch b/Spigot-Server-Patches/0096-Change-implementation-of-tile-entity-removal-list.patch deleted file mode 100644 index 05453cb2d0..0000000000 --- a/Spigot-Server-Patches/0096-Change-implementation-of-tile-entity-removal-list.patch +++ /dev/null @@ -1,65 +0,0 @@ -From 3cd83fe77b1f1c37592895e602d2c4588aa9cbdc Mon Sep 17 00:00:00 2001 -From: Joseph Hirschfeld -Date: Sat, 20 Feb 2016 00:42:18 -0500 -Subject: [PATCH] Change implementation of (tile)entity removal list - -As it stood, the complexity of a ArrayList.removeAll(ArrayList) is -much greater as the argument array list grew than .removeAll(HashSet). - -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index a76d83c..f0cd810 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -3,6 +3,7 @@ package net.minecraft.server; - import com.google.common.base.Predicate; - import com.google.common.collect.Lists; - import com.google.common.collect.Maps; -+import com.google.common.collect.Sets; - import org.bukkit.Bukkit; - import org.bukkit.block.BlockState; - import org.bukkit.craftbukkit.CraftServer; -@@ -58,11 +59,11 @@ public abstract class World implements IBlockAccess { - } - }; - // Spigot end -- protected final List g = Lists.newArrayList(); -+ protected final Set g = Sets.newHashSet(); // Paper - //public final List h = Lists.newArrayList(); // PaperSpigot - Remove unused list - public final List tileEntityList = Lists.newArrayList(); - private final List b = Lists.newArrayList(); -- private final List c = Lists.newArrayList(); -+ private final Set c = Sets.newHashSet(); // Paper - public final List players = Lists.newArrayList(); - public final List k = Lists.newArrayList(); - protected final IntHashMap entitiesById = new IntHashMap(); -@@ -1400,18 +1401,19 @@ public abstract class World implements IBlockAccess { - int j; - int k; - -- for (i = 0; i < this.g.size(); ++i) { -- entity = (Entity) this.g.get(i); -- j = entity.ae; -- k = entity.ag; -- if (entity.ad && this.isChunkLoaded(j, k, true)) { -- this.getChunkAt(j, k).b(entity); -+ // Paper start - Set based removal lists -+ for (Entity e : this.g) { -+ j = e.ae; -+ k = e.ag; -+ if (e.ad && this.isChunkLoaded(j, k, true)) { -+ this.getChunkAt(j, k).b(e); - } - } - -- for (i = 0; i < this.g.size(); ++i) { -- this.b((Entity) this.g.get(i)); -+ for (Entity e : this.g) { -+ this.b(e); - } -+ // Paper end - - this.g.clear(); - timings.entityRemoval.stopTiming(); // Spigot --- -2.7.1 - diff --git a/Spigot-Server-Patches/0097-Add-configurable-portal-search-radius.patch b/Spigot-Server-Patches/0097-Add-configurable-portal-search-radius.patch deleted file mode 100644 index 97599dfdf7..0000000000 --- a/Spigot-Server-Patches/0097-Add-configurable-portal-search-radius.patch +++ /dev/null @@ -1,63 +0,0 @@ -From 5fefb8fed5df6e1200c3119a6fbce019cf19e720 Mon Sep 17 00:00:00 2001 -From: Joseph Hirschfeld -Date: Sat, 20 Feb 2016 23:38:24 -0500 -Subject: [PATCH] Add configurable portal search radius - - -diff --git a/src/main/java/net/minecraft/server/PortalTravelAgent.java b/src/main/java/net/minecraft/server/PortalTravelAgent.java -index 729cb96..72f3735 100644 ---- a/src/main/java/net/minecraft/server/PortalTravelAgent.java -+++ b/src/main/java/net/minecraft/server/PortalTravelAgent.java -@@ -109,7 +109,7 @@ public class PortalTravelAgent { - return true; - } - -- public BlockPosition findPortal(double x, double y, double z, int short1) { -+ public BlockPosition findPortal(double x, double y, double z, int searchRadius) { // Paper - actually use search radius - if (this.a.getWorld().getEnvironment() == org.bukkit.World.Environment.THE_END) { - return this.findEndPortal(this.a.worldProvider.h()); - } -@@ -133,10 +133,10 @@ public class PortalTravelAgent { - } else { - BlockPosition blockposition = new BlockPosition(x, y, z); - -- for (int l = -128; l <= 128; ++l) { -+ for (int l = -searchRadius; l <= searchRadius; ++l) { // Paper - actually use search radius - BlockPosition blockposition1; - -- for (int i1 = -128; i1 <= 128; ++i1) { -+ for (int i1 = -searchRadius; i1 <= searchRadius; ++i1) { // Paper - actually use search radius - for (BlockPosition blockposition2 = blockposition.a(l, this.a.V() - 1 - blockposition.getY(), i1); blockposition2.getY() >= 0; blockposition2 = blockposition1) { - blockposition1 = blockposition2.down(); - if (this.a.getType(blockposition2).getBlock() == Blocks.PORTAL) { -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 3a2ca89..8752955 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -65,7 +65,7 @@ public class WorldServer extends World implements IAsyncTaskHandler { - this.manager = new PlayerChunkMap(this, spigotConfig.viewDistance); // Spigot - this.worldProvider.a(this); - this.chunkProvider = this.k(); -- this.Q = new org.bukkit.craftbukkit.CraftTravelAgent(this); // CraftBukkit -+ this.Q = ((org.bukkit.craftbukkit.CraftTravelAgent) new org.bukkit.craftbukkit.CraftTravelAgent(this).setSearchRadius(paperSpigotConfig.portalSearchRadius)); // CraftBukkit // Paper - configurable search radius - this.B(); - this.C(); - this.getWorldBorder().a(minecraftserver.aI()); -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index c3c374d..6ad8e81 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -396,4 +396,10 @@ public class PaperSpigotWorldConfig - { - allowBlockLocationTabCompletion = getBoolean( "allow-block-location-tab-completion", true ); - } -+ -+ public int portalSearchRadius; -+ private void portalSearchRadius() -+ { -+ portalSearchRadius = getInt("portal-search-radius", 128); -+ } - } --- -2.5.0 - diff --git a/Spigot-Server-Patches/0098-Add-velocity-warnings.patch b/Spigot-Server-Patches/0098-Add-velocity-warnings.patch deleted file mode 100644 index 22366066f3..0000000000 --- a/Spigot-Server-Patches/0098-Add-velocity-warnings.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 34a2d7adb137bd4481b238bc5a80aaf0cbbbc7db Mon Sep 17 00:00:00 2001 -From: Joseph Hirschfeld -Date: Mon, 22 Feb 2016 16:05:32 -0500 -Subject: [PATCH] Add velocity warnings - - -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 5df3476..4f91799 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -25,6 +25,7 @@ import org.bukkit.permissions.PermissionAttachmentInfo; - import org.bukkit.permissions.ServerOperator; - import org.bukkit.plugin.Plugin; - import org.bukkit.util.Vector; -+import org.github.paperspigot.PaperSpigotConfig; - - public abstract class CraftEntity implements org.bukkit.entity.Entity { - private static final PermissibleBase perm = new PermissibleBase(new ServerOperator() { -@@ -205,6 +206,15 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { - } - - public void setVelocity(Vector vel) { -+ // Paper start - warn server owners when plugins try to set super high velocities -+ if (PaperSpigotConfig.warnForExcessiveVelocity) { -+ if(vel.getX() > 4 || vel.getX() < -4 || vel.getY() > 4 || vel.getY() < -4 || vel.getZ() > 4 || vel.getZ() < -4) { -+ getServer().getLogger().warning("Excessive velocity set detected: tried to set velocity of entity #"+getEntityId()+" to ("+vel.getX()+","+vel.getY()+","+vel.getZ()+")."); -+ Thread.dumpStack(); -+ } -+ } -+ // Paper end -+ - entity.motX = vel.getX(); - entity.motY = vel.getY(); - entity.motZ = vel.getZ(); -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java -index ea5a427..d6d9899 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java -@@ -216,4 +216,10 @@ public class PaperSpigotConfig - e.printStackTrace(); - } - } -+ -+ public static boolean warnForExcessiveVelocity; -+ private static void excessiveVelocityWarning() -+ { -+ warnForExcessiveVelocity = getBoolean("warnWhenSettingExcessiveVelocity", true); -+ } - } --- -2.7.1 - diff --git a/applyPatches.sh b/applyPatches.sh index 589a0cc9a7..cf2b3c8041 100755 --- a/applyPatches.sh +++ b/applyPatches.sh @@ -10,23 +10,21 @@ function applyPatch { branch=$3 cd "$basedir/$what" git fetch - git reset --hard "$branch" - git branch -f upstream >/dev/null + git branch -f upstream "$branch" >/dev/null cd "$basedir" if [ ! -d "$basedir/$target" ]; then - git clone $1 $target -b upstream + git clone "$what" "$target" fi cd "$basedir/$target" echo "Resetting $target to $what..." - git remote rm upstream 2>/dev/null 2>&1 - git remote add upstream ../$what >/dev/null 2>&1 + git remote add -f upstream ../$what >/dev/null 2>&1 git checkout master >/dev/null 2>&1 git fetch upstream >/dev/null 2>&1 git reset --hard upstream/upstream echo " Applying patches to $target..." - git am --abort - git am --3way "$basedir/${what}-Patches/"*.patch + git am --abort >/dev/null 2>&1 + git am --3way --ignore-whitespace "$basedir/${what}-Patches/"*.patch if [ "$?" != "0" ]; then echo " Something did not apply cleanly to $target." echo " Please review above details and finish the apply then" @@ -37,14 +35,5 @@ function applyPatch { fi } -echo -echo "Applying SpigotMC patches to CraftBukkit and Bukkit" -echo -cd ../Bukkit -hash=$(git rev-parse HEAD) -git branch -f spigot "$hash" -applyPatch Bukkit Spigot-API origin/spigot && applyPatch CraftBukkit Spigot-Server origin/patched -echo -echo "Applying PaperSpigot patches to Spigot-Server and Spigot-API" -echo -applyPatch Spigot-API PaperSpigot-API && applyPatch Spigot-Server PaperSpigot-Server +applyPatch Bukkit Spigot-API HEAD && applyPatch CraftBukkit Spigot-Server patched +applyPatch Spigot-API Paper-API HEAD && applyPatch Spigot-Server Paper-Server HEAD \ No newline at end of file diff --git a/build.sh b/build.sh index a658f39d99..99e88a2036 100755 --- a/build.sh +++ b/build.sh @@ -1,3 +1,3 @@ #!/bin/bash -git submodule update --init && ./remap.sh && ./decompile.sh && ./init.sh && ./newApplyPatches.sh && mvn clean install && ./paperclip.sh +git submodule update --init && ./remap.sh && ./decompile.sh && ./init.sh && ./applyPatches.sh && mvn clean install && ./paperclip.sh diff --git a/decompile.sh b/decompile.sh index 2489ddf7a7..81947e1c71 100755 --- a/decompile.sh +++ b/decompile.sh @@ -22,7 +22,7 @@ fi echo "Decompiling classes..." if [ ! -d "$decompiledir/net/minecraft/server" ]; then cd "$basedir" - java -jar BuildData/bin/fernflower.jar -dgs=1 -hdc=0 -rbr=0 -asc=1 -udv=0 "$classdir" "$decompiledir" + java -jar BuildData/bin/fernflower.jar -dgs=1 -hdc=0 -asc=1 -udv=0 "$classdir" "$decompiledir" if [ "$?" != "0" ]; then echo "Failed to decompile classes." exit 1 diff --git a/newApplyPatches.sh b/newApplyPatches.sh deleted file mode 100755 index 21a0eb6a59..0000000000 --- a/newApplyPatches.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash - -PS1="$" -basedir=`pwd` -echo "Rebuilding Forked projects.... " - -function applyPatch { - what=$1 - target=$2 - branch=$3 - cd "$basedir/$what" - git fetch - git branch -f upstream "$branch" >/dev/null - - cd "$basedir" - if [ ! -d "$basedir/$target" ]; then - git clone "$what" "$target" - fi - cd "$basedir/$target" - echo "Resetting $target to $what..." - git remote add -f upstream ../$what >/dev/null 2>&1 - git checkout master >/dev/null 2>&1 - git fetch upstream >/dev/null 2>&1 - git reset --hard upstream/upstream - echo " Applying patches to $target..." - git am --abort >/dev/null 2>&1 - git am --3way --ignore-whitespace "$basedir/${what}-Patches/"*.patch - if [ "$?" != "0" ]; then - echo " Something did not apply cleanly to $target." - echo " Please review above details and finish the apply then" - echo " save the changes with rebuildPatches.sh" - exit 1 - else - echo " Patches applied cleanly to $target" - fi -} - -applyPatch Bukkit Spigot-API HEAD && applyPatch CraftBukkit Spigot-Server patched -applyPatch Spigot-API PaperSpigot-API HEAD && applyPatch Spigot-Server PaperSpigot-Server HEAD \ No newline at end of file diff --git a/newRebuildPatches.sh b/newRebuildPatches.sh deleted file mode 100755 index f5b7f8b2fb..0000000000 --- a/newRebuildPatches.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash - -PS1="$" -basedir=`pwd` -echo "Rebuilding patch files from current fork state..." -git config core.safecrlf false - -function cleanupPatches { - cd "$1" - for patch in *.patch; do - echo "$patch" - gitver=$(tail -n 2 $patch | grep -ve "^$" | tail -n 1) - diffs=$(git diff --staged $patch | grep -E "^(\+|\-)" | grep -Ev "(From [a-z0-9]{32,}|\-\-\- a|\+\+\+ b|.index)") - - testver=$(echo "$diffs" | tail -n 2 | grep -ve "^$" | tail -n 1 | grep "$gitver") - if [ "x$testver" != "x" ]; then - diffs=$(echo "$diffs" | sed 'N;$!P;$!D;$d') - fi - - if [ "x$diffs" == "x" ] ; then - git reset HEAD $patch >/dev/null - git checkout -- $patch >/dev/null - fi - done -} - -function savePatches { - what=$1 - target=$2 - echo "Formatting patches for $what..." - cd "$basedir/$target" - git format-patch --no-stat -N -o "$basedir/${what}-Patches/" upstream/upstream >/dev/null - cd "$basedir" - git add -A "$basedir/${what}-Patches" - cleanupPatches "$basedir/${what}-Patches" - echo " Patches saved for $what to $what-Patches/" -} -if [ "$1" == "clean" ]; then - rm -rf Spigot-*-Patches -fi -savePatches Spigot-API PaperSpigot-API -savePatches Spigot-Server PaperSpigot-Server diff --git a/paperclip.sh b/paperclip.sh index 7d720f9eaf..e73e95b721 100755 --- a/paperclip.sh +++ b/paperclip.sh @@ -1,11 +1,11 @@ #!/usr/bin/env bash -cp ./PaperSpigot-Server/target/paperspigot*-SNAPSHOT.jar ./Paperclip/paperspigot-1.8.8.jar -cp ./work/1.8.8/1.8.8.jar ./Paperclip/minecraft_server.1.8.8.jar +cp ./Paper-Server/target/paper*-SNAPSHOT.jar ./Paperclip/paper-1.9.jar +cp ./work/1.9/1.9.jar ./Paperclip/minecraft_server.1.9.jar cd ./Paperclip mvn clean package cd .. -cp ./Paperclip/target/paperclip*-SNAPSHOT.jar ./Paperclip.jar +cp ./Paperclip/target/paperclip*-SNAPSHOT.jar ./paperclip.jar echo "" echo "" diff --git a/pom.xml b/pom.xml index 508f3ab479..1121d4f6df 100644 --- a/pom.xml +++ b/pom.xml @@ -9,18 +9,18 @@ 7 - org.github.paperspigot - paperspigot-parent + com.destroystokyo.paper + paper-parent dev-SNAPSHOT pom - PaperSpigot-Parent - Parent project for all PaperSpigot modules. - https://github.com/PaperSpigot/Spigot + Paper-Parent + Parent project for all Paper modules. + https://github.com/PaperSpigot/Paper - PaperSpigot-Server - PaperSpigot-API + Paper-Server + Paper-API diff --git a/rebuildPatches.sh b/rebuildPatches.sh index 268aef04ae..b64b0ec20c 100755 --- a/rebuildPatches.sh +++ b/rebuildPatches.sh @@ -3,23 +3,19 @@ PS1="$" basedir=`pwd` echo "Rebuilding patch files from current fork state..." +git config core.safecrlf false function cleanupPatches { cd "$1" for patch in *.patch; do + echo "$patch" gitver=$(tail -n 2 $patch | grep -ve "^$" | tail -n 1) diffs=$(git diff --staged $patch | grep -E "^(\+|\-)" | grep -Ev "(From [a-z0-9]{32,}|\-\-\- a|\+\+\+ b|.index)") testver=$(echo "$diffs" | tail -n 2 | grep -ve "^$" | tail -n 1 | grep "$gitver") if [ "x$testver" != "x" ]; then - mingw=$(uname -s | grep "MINGW") - if [ "x$mingw" != "x" ]; then - diffs=$(echo "$diffs" | head -n $(($(echo "$diffs" | wc -l | sed -r 's/^ +//' | cut -d ' ' -f 1) - 2))) - else - diffs=$(echo "$diffs" | head -n -2) - fi + diffs=$(echo "$diffs" | sed 'N;$!P;$!D;$d') fi - if [ "x$diffs" == "x" ] ; then git reset HEAD $patch >/dev/null @@ -31,15 +27,16 @@ function cleanupPatches { function savePatches { what=$1 target=$2 + echo "Formatting patches for $what..." cd "$basedir/$target" - git format-patch --no-stat -N -o "$basedir/${what}-Patches/" upstream/upstream + git format-patch --no-stat -N -o "$basedir/${what}-Patches/" upstream/upstream >/dev/null cd "$basedir" - git add "$basedir/${what}-Patches" + git add -A "$basedir/${what}-Patches" cleanupPatches "$basedir/${what}-Patches" echo " Patches saved for $what to $what-Patches/" } - -#savePatches Bukkit Spigot-API -#savePatches CraftBukkit Spigot-Server -savePatches Spigot-API PaperSpigot-API -savePatches Spigot-Server PaperSpigot-Server +if [ "$1" == "clean" ]; then + rm -rf Spigot-*-Patches +fi +savePatches Spigot-API Paper-API +savePatches Spigot-Server Paper-Server