From 26eb457a39f90b630b15256c34e6b0de9822ee1d Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> 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 +- .../Add-BeaconEffectEvent.patch | 8 +- ...Add-FallingBlock-source-location-API.patch | 23 - ...port-to-tab-completers-vanilla-featu.patch | 49 +- .../Add-PlayerInitialSpawnEvent.patch | 10 +- .../Add-PlayerLocaleChangeEvent.patch | 12 +- .../Add-TNT-source-location-API.patch | 23 - .../Add-async-chunk-load-API.patch | 79 +- .../Add-exception-reporting-event.patch | 972 +++-- .../Add-float-methods-to-configs.patch | 88 - Spigot-API-Patches/Add-getTPS-method.patch | 47 +- .../Add-player-view-distance-API.patch | 50 +- ...ly-disable-plugins-that-fail-to-load.patch | 6 +- ...sions.patch => Check-Paper-versions.patch} | 66 +- .../Expose-server-CommandMap.patch | 61 +- ...ck-and-TNTPrimed-source-location-API.patch | 39 + ...erverListPingEvent-flagging-as-Async.patch | 2 +- ...cord-chat-API-from-spigot-subclasses.patch | 2 +- ...Made-EntityDismountEvent-Cancellable.patch | 20 +- Spigot-API-Patches/POM-changes.patch | 20 +- .../Player-Tab-List-and-Title-APIs.patch | 285 +- .../Player-affects-spawning-API.patch | 52 +- ...p-using-spigot-s-website-for-timings.patch | 29 - Spigot-API-Patches/Timings-v2.patch | 186 +- .../Add-BeaconEffectEvent.patch | 59 +- ...Add-FallingBlock-source-location-API.patch | 146 - ...port-to-tab-completers-vanilla-featu.patch | 104 +- .../Add-PlayerInitialSpawnEvent.patch | 8 +- .../Add-PlayerLocaleChangeEvent.patch | 43 - .../Add-TNT-source-location-API.patch | 130 - .../Add-async-chunk-load-API.patch | 14 +- ...-despawn-distances-for-living-entiti.patch | 59 +- ...dd-configurable-portal-search-radius.patch | 61 +- .../Add-exception-reporting-event.patch | 748 ++-- .../Add-player-view-distance-API.patch | 102 +- .../Add-velocity-warnings.patch | 36 +- ...chunks-are-slime-spawn-chunks-toggle.patch | 38 +- .../Allow-for-toggling-of-spawn-chunks.patch | 41 +- .../Allow-nerfed-mobs-to-jump.patch | 18 +- ...ItemStacks-to-retain-their-invalid-d.patch | 66 - ...low-undead-horse-types-to-be-leashed.patch | 39 - .../Always-tick-falling-blocks.patch | 48 +- ...opper-searches-if-there-are-no-items.patch | 52 +- ...e-informative-in-maxHealth-exception.patch | 11 +- .../Bump-thread-count-for-chunk-loading.patch | 6 +- ...entation-of-tile-entity-removal-list.patch | 72 +- ...e-before-converting-and-renaming-pla.patch | 4 +- Spigot-Server-Patches/ChunkMap-caching.patch | 138 - .../Configurable-TNT-cannon-fix.patch | 217 +- .../Configurable-TNT-explosion-volume.patch | 38 - .../Configurable-async-light-updates.patch | 126 +- ...figurable-baby-zombie-movement-speed.patch | 52 +- ...ctus-and-reed-natural-growth-heights.patch | 46 +- ...figurable-container-update-tick-rate.patch | 53 +- ...e-damage-multiplier-for-PvP-blocking.patch | 36 - ...ble-end-credits-when-leaving-the-end.patch | 90 +- .../Configurable-fishing-time-ranges.patch | 44 +- .../Configurable-game-mechanics-changes.patch | 80 - .../Configurable-lava-flow-speed.patch | 47 +- .../Configurable-mob-spawner-tick-rate.patch | 61 +- ...le-speed-for-water-flowing-over-lava.patch | 51 +- .../Configurable-squid-spawn-ranges.patch | 45 +- ...rength-and-weakness-effect-modifiers.patch | 37 - ...nfigurable-top-of-nether-void-damage.patch | 46 +- .../Disable-chest-cat-detection.patch | 43 +- .../Disable-explosion-knockback.patch | 82 +- .../Disable-ice-and-snow.patch | 39 +- .../Disable-mood-sounds.patch | 35 - .../Disable-spigot-tick-limiters.patch | 16 +- Spigot-Server-Patches/Disable-thunder.patch | 44 +- ...ion-File-s-when-checking-if-chunk-ex.patch | 17 +- ...n-t-create-a-chunk-just-to-unload-it.patch | 10 +- ...on-t-damage-already-dead-ArmorStands.patch | 23 - .../Don-t-sleep-between-chunk-saves.patch | 39 + ...ck-and-tnt-entities-at-the-specified.patch | 62 +- ...AR-Fix-bug-with-teleporting-entities.patch | 44 +- ...e-block-they-re-holding-when-they-di.patch | 25 - .../Ensure-commands-are-not-ran-async.patch | 12 +- .../Ensure-inv-drag-is-in-bounds.patch | 16 +- .../Expose-server-CommandMap.patch | 6 +- ...-TNT-entities-collide-with-specific-.patch | 43 - ...ck-and-TNTPrimed-source-location-API.patch | 265 ++ Spigot-Server-Patches/Fast-draining.patch | 67 +- ...arts-losing-all-of-their-velocity-on.patch | 36 - ...x-inter-world-teleportation-glitches.patch | 34 +- .../Fix-jar-being-shaded-multiple-times.patch | 19 - ...-explosions-processing-dead-entities.patch | 6 +- ...ome-times-creating-air-instead-of-co.patch | 4 +- .../Fix-redstone-lag-issues.patch | 70 +- ...s-for-specific-entities-that-fly-thr.patch | 204 -- .../Further-improve-server-tick-loop.patch | 63 +- .../Generator-Settings.patch | 512 ++- ...cord-chat-API-from-spigot-subclasses.patch | 2 +- ...Made-EntityDismountEvent-Cancellable.patch | 58 +- Spigot-Server-Patches/Metrics.patch | 4 +- .../Only-refresh-abilities-if-needed.patch | 8 +- .../Optimize-Pathfinding.patch | 33 +- .../Optimize-Spigot-s-Anti-X-Ray.patch | 86 - .../Optimize-TileEntity-Ticking.patch | 144 +- Spigot-Server-Patches/Optimize-draining.patch | 17 +- .../Optimize-explosions.patch | 61 +- .../Optimize-getBlockData.patch | 16 +- Spigot-Server-Patches/Optimize-getCubes.patch | 43 - Spigot-Server-Patches/POM-Changes.patch | 131 +- .../Paper-config-files.patch | 289 ++ .../PaperSpigot-config-files.patch | 319 -- .../Player-Exhaustion-Multipliers.patch | 59 +- .../Player-Tab-List-and-Title-APIs.patch | 321 +- .../Player-affects-spawning-API.patch | 120 +- ...event-tile-entity-and-entity-crashes.patch | 39 +- ...ntity-Chunk-Registration-on-Teleport.patch | 4 +- ...Re-add-Spigot-s-hopper-check-feature.patch | 38 - ...ntities-that-fly-through-unloaded-ch.patch | 117 - ...y-invalid-Redstone-event-for-Netherr.patch | 25 - ...ve-invalid-mob-spawner-tile-entities.patch | 29 +- ...esolve-bed-issues-on-unloaded-chunks.patch | 29 - ...sition-the-first-time-an-entity-is-s.patch | 58 +- ...ent-crashes-server-lists-and-Mojang.patch} | 29 +- .../Speedup-BlockPos-by-fixing-inlining.patch | 154 - Spigot-Server-Patches/Stackable-Buckets.patch | 172 - ...lowing-block-if-material-has-changed.patch | 4 +- Spigot-Server-Patches/Timings-v2.patch | 562 ++- .../Toggle-for-player-interact-limiter.patch | 48 +- ...r-crits-helps-mitigate-hacked-client.patch | 36 - .../Use-UserCache-for-player-heads.patch | 23 +- .../Vanished-players-don-t-have-rights.patch | 61 +- Spigot-Server-Patches/mc-dev-imports.patch | 3230 +++++++---------- applyPatches.sh | 25 +- build.sh | 2 +- decompile.sh | 2 +- newApplyPatches.sh | 39 - newRebuildPatches.sh | 42 - paperclip.sh | 6 +- pom.xml | 14 +- rebuildPatches.sh | 25 +- 139 files changed, 5550 insertions(+), 8067 deletions(-) delete mode 100644 Spigot-API-Patches/Add-FallingBlock-source-location-API.patch delete mode 100644 Spigot-API-Patches/Add-TNT-source-location-API.patch delete mode 100644 Spigot-API-Patches/Add-float-methods-to-configs.patch rename Spigot-API-Patches/{Check-PaperSpigot-versions.patch => Check-Paper-versions.patch} (50%) create mode 100644 Spigot-API-Patches/FallingBlock-and-TNTPrimed-source-location-API.patch delete mode 100644 Spigot-API-Patches/Stop-using-spigot-s-website-for-timings.patch delete mode 100644 Spigot-Server-Patches/Add-FallingBlock-source-location-API.patch delete mode 100644 Spigot-Server-Patches/Add-PlayerLocaleChangeEvent.patch delete mode 100644 Spigot-Server-Patches/Add-TNT-source-location-API.patch delete mode 100644 Spigot-Server-Patches/Allow-specified-ItemStacks-to-retain-their-invalid-d.patch delete mode 100644 Spigot-Server-Patches/Allow-undead-horse-types-to-be-leashed.patch delete mode 100644 Spigot-Server-Patches/ChunkMap-caching.patch delete mode 100644 Spigot-Server-Patches/Configurable-TNT-explosion-volume.patch delete mode 100644 Spigot-Server-Patches/Configurable-damage-multiplier-for-PvP-blocking.patch delete mode 100644 Spigot-Server-Patches/Configurable-game-mechanics-changes.patch delete mode 100644 Spigot-Server-Patches/Configurable-strength-and-weakness-effect-modifiers.patch delete mode 100644 Spigot-Server-Patches/Disable-mood-sounds.patch delete mode 100644 Spigot-Server-Patches/Don-t-damage-already-dead-ArmorStands.patch create mode 100644 Spigot-Server-Patches/Don-t-sleep-between-chunk-saves.patch delete mode 100644 Spigot-Server-Patches/Enderman-drop-the-block-they-re-holding-when-they-di.patch delete mode 100644 Spigot-Server-Patches/FallingBlock-and-TNT-entities-collide-with-specific-.patch create mode 100644 Spigot-Server-Patches/FallingBlock-and-TNTPrimed-source-location-API.patch delete mode 100644 Spigot-Server-Patches/Fix-FurnaceMinecarts-losing-all-of-their-velocity-on.patch delete mode 100644 Spigot-Server-Patches/Fix-jar-being-shaded-multiple-times.patch delete mode 100644 Spigot-Server-Patches/Force-load-chunks-for-specific-entities-that-fly-thr.patch delete mode 100644 Spigot-Server-Patches/Optimize-Spigot-s-Anti-X-Ray.patch delete mode 100644 Spigot-Server-Patches/Optimize-getCubes.patch create mode 100644 Spigot-Server-Patches/Paper-config-files.patch delete mode 100644 Spigot-Server-Patches/PaperSpigot-config-files.patch delete mode 100644 Spigot-Server-Patches/Re-add-Spigot-s-hopper-check-feature.patch delete mode 100644 Spigot-Server-Patches/Remove-certain-entities-that-fly-through-unloaded-ch.patch delete mode 100644 Spigot-Server-Patches/Remove-completely-invalid-Redstone-event-for-Netherr.patch delete mode 100644 Spigot-Server-Patches/SPIGOT-1387-Resolve-bed-issues-on-unloaded-chunks.patch rename Spigot-Server-Patches/{Show-PaperSpigot-in-client-crashes-server-lists-and-.patch => Show-Paper-in-client-crashes-server-lists-and-Mojang.patch} (66%) delete mode 100644 Spigot-Server-Patches/Speedup-BlockPos-by-fixing-inlining.patch delete mode 100644 Spigot-Server-Patches/Stackable-Buckets.patch delete mode 100644 Spigot-Server-Patches/Toggleable-player-crits-helps-mitigate-hacked-client.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/Add-BeaconEffectEvent.patch b/Spigot-API-Patches/Add-BeaconEffectEvent.patch index 006b800765..b85d62ab7a 100644 --- a/Spigot-API-Patches/Add-BeaconEffectEvent.patch +++ b/Spigot-API-Patches/Add-BeaconEffectEvent.patch @@ -1,16 +1,16 @@ From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 --- /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 +0,0 @@ -+package org.github.paperspigot.event.block; ++package com.destroystokyo.paper.event.block; + +import org.bukkit.block.Block; +import org.bukkit.entity.Player; diff --git a/Spigot-API-Patches/Add-FallingBlock-source-location-API.patch b/Spigot-API-Patches/Add-FallingBlock-source-location-API.patch deleted file mode 100644 index 82dde57377..0000000000 --- a/Spigot-API-Patches/Add-FallingBlock-source-location-API.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/FallingBlock.java -+++ b/src/main/java/org/bukkit/entity/FallingBlock.java -@@ -0,0 +0,0 @@ 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 - } --- \ No newline at end of file diff --git a/Spigot-API-Patches/Add-Location-support-to-tab-completers-vanilla-featu.patch b/Spigot-API-Patches/Add-Location-support-to-tab-completers-vanilla-featu.patch index 727ea70e82..8312aff916 100644 --- a/Spigot-API-Patches/Add-Location-support-to-tab-completers-vanilla-featu.patch +++ b/Spigot-API-Patches/Add-Location-support-to-tab-completers-vanilla-featu.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 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) @@ -21,7 +21,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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,19 +32,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * 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 @@ -52,25 +53,19 @@ diff --git a/src/main/java/org/bukkit/command/PluginCommand.java b/src/main/java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/command/PluginCommand.java +++ b/src/main/java/org/bukkit/command/PluginCommand.java -@@ -0,0 +0,0 @@ - package org.bukkit.command; +@@ -0,0 +0,0 @@ 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 - */ @@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 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,7 +94,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } return completions; } -+ // PaperSpigot end ++ // Paper end @Override public String toString() { @@ -119,12 +114,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } 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,14 +130,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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()); @@ -163,10 +158,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 */ 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 } -- \ No newline at end of file diff --git a/Spigot-API-Patches/Add-PlayerInitialSpawnEvent.patch b/Spigot-API-Patches/Add-PlayerInitialSpawnEvent.patch index 94f9911b78..c1ca95105f 100644 --- a/Spigot-API-Patches/Add-PlayerInitialSpawnEvent.patch +++ b/Spigot-API-Patches/Add-PlayerInitialSpawnEvent.patch @@ -1,21 +1,22 @@ From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 --- /dev/null -+++ b/src/main/java/org/bukkit/event/player/PlayerInitialSpawnEvent.java ++++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerInitialSpawnEvent.java @@ -0,0 +0,0 @@ -+package org.bukkit.event.player; ++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,5 +54,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return handlers; + } +} -\ No newline at end of file -- \ No newline at end of file diff --git a/Spigot-API-Patches/Add-PlayerLocaleChangeEvent.patch b/Spigot-API-Patches/Add-PlayerLocaleChangeEvent.patch index 38cf2a614f..54fb48e981 100644 --- a/Spigot-API-Patches/Add-PlayerLocaleChangeEvent.patch +++ b/Spigot-API-Patches/Add-PlayerLocaleChangeEvent.patch @@ -1,19 +1,20 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Isaac Moore -Date: Mon, 27 Apr 2015 21:41:39 -0500 +From: Zach Brown <1254957+zachbr@users.noreply.github.com> +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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 --- /dev/null -+++ b/src/main/java/org/bukkit/event/player/PlayerLocaleChangeEvent.java ++++ b/src/main/java/com/destroystokyo/paper/event/player/PlayerLocaleChangeEvent.java @@ -0,0 +0,0 @@ -+package org.bukkit.event.player; ++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,5 +57,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return handlers; + } +} -\ No newline at end of file -- \ No newline at end of file diff --git a/Spigot-API-Patches/Add-TNT-source-location-API.patch b/Spigot-API-Patches/Add-TNT-source-location-API.patch deleted file mode 100644 index 682e1691b9..0000000000 --- a/Spigot-API-Patches/Add-TNT-source-location-API.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/TNTPrimed.java -+++ b/src/main/java/org/bukkit/entity/TNTPrimed.java -@@ -0,0 +0,0 @@ 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(); - } --- \ No newline at end of file diff --git a/Spigot-API-Patches/Add-async-chunk-load-API.patch b/Spigot-API-Patches/Add-async-chunk-load-API.patch index 2dbc0c86b2..c148b35efc 100644 --- a/Spigot-API-Patches/Add-async-chunk-load-API.patch +++ b/Spigot-API-Patches/Add-async-chunk-load-API.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Aikar -Date: Thu, 6 Nov 2014 18:29:20 -0600 +Date: Mon, 29 Feb 2016 17:43:33 -0600 Subject: [PATCH] Add async chunk load API @@ -9,19 +9,82 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -0,0 +0,0 @@ public interface World extends PluginMessageRecipient, Metadatable { - */ public Chunk getChunkAt(Block block); -+ // PaperSpigot start - Async chunk load API + /** ++ * 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); + } -+ 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 + - /** ++ /** ++ * 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 -- \ No newline at end of file diff --git a/Spigot-API-Patches/Add-exception-reporting-event.patch b/Spigot-API-Patches/Add-exception-reporting-event.patch index bf38d765dc..8e20379e74 100644 --- a/Spigot-API-Patches/Add-exception-reporting-event.patch +++ b/Spigot-API-Patches/Add-exception-reporting-event.patch @@ -1,23 +1,476 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Joseph Hirschfeld -Date: Sat, 20 Feb 2016 20:07:46 -0500 +From: Zach Brown <1254957+zachbr@users.noreply.github.com> +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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/event/server/ServerExceptionEvent.java +@@ -0,0 +0,0 @@ ++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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/exception/ServerCommandException.java +@@ -0,0 +0,0 @@ ++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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/exception/ServerEventException.java +@@ -0,0 +0,0 @@ ++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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/exception/ServerException.java +@@ -0,0 +0,0 @@ ++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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/exception/ServerInternalException.java +@@ -0,0 +0,0 @@ ++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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/exception/ServerPluginEnableDisableException.java +@@ -0,0 +0,0 @@ ++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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/exception/ServerPluginException.java +@@ -0,0 +0,0 @@ ++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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/exception/ServerPluginMessageException.java +@@ -0,0 +0,0 @@ ++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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/exception/ServerSchedulerException.java +@@ -0,0 +0,0 @@ ++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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/exception/ServerTabCompleteException.java +@@ -0,0 +0,0 @@ ++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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/command/SimpleCommandMap.java +++ b/src/main/java/org/bukkit/command/SimpleCommandMap.java -@@ -0,0 +0,0 @@ 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; +@@ -0,0 +0,0 @@ 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; @@ -0,0 +0,0 @@ public class SimpleCommandMap implements CommandMap { throw ex; } catch (Throwable ex) { @@ -39,21 +492,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java +++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java -@@ -0,0 +0,0 @@ import org.bukkit.permissions.PermissionDefault; - import org.bukkit.util.FileUtil; +@@ -0,0 +0,0 @@ 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; @@ -0,0 +0,0 @@ public final class SimplePluginManager implements PluginManager { try { plugin.getPluginLoader().enablePlugin(plugin); @@ -133,481 +586,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } } -diff --git a/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java b/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java -+++ b/src/main/java/org/bukkit/plugin/messaging/StandardMessenger.java -@@ -0,0 +0,0 @@ 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} -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/org/github/paperspigot/event/ServerExceptionEvent.java -@@ -0,0 +0,0 @@ -+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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/org/github/paperspigot/exception/ServerCommandException.java -@@ -0,0 +0,0 @@ -+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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/org/github/paperspigot/exception/ServerEventException.java -@@ -0,0 +0,0 @@ -+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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/org/github/paperspigot/exception/ServerException.java -@@ -0,0 +0,0 @@ -+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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/org/github/paperspigot/exception/ServerInternalException.java -@@ -0,0 +0,0 @@ -+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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/org/github/paperspigot/exception/ServerPluginEnableDisableException.java -@@ -0,0 +0,0 @@ -+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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/org/github/paperspigot/exception/ServerPluginException.java -@@ -0,0 +0,0 @@ -+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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/org/github/paperspigot/exception/ServerPluginMessageException.java -@@ -0,0 +0,0 @@ -+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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/org/github/paperspigot/exception/ServerSchedulerException.java -@@ -0,0 +0,0 @@ -+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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/org/github/paperspigot/exception/ServerTabCompleteException.java -@@ -0,0 +0,0 @@ -+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); -+ } -+} -- \ No newline at end of file diff --git a/Spigot-API-Patches/Add-float-methods-to-configs.patch b/Spigot-API-Patches/Add-float-methods-to-configs.patch deleted file mode 100644 index 686fe9403b..0000000000 --- a/Spigot-API-Patches/Add-float-methods-to-configs.patch +++ /dev/null @@ -1,88 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zach Brown <1254957+zachbr@users.noreply.github.com> -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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/configuration/ConfigurationSection.java -+++ b/src/main/java/org/bukkit/configuration/ConfigurationSection.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/configuration/MemorySection.java -+++ b/src/main/java/org/bukkit/configuration/MemorySection.java -@@ -0,0 +0,0 @@ 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); --- \ No newline at end of file diff --git a/Spigot-API-Patches/Add-getTPS-method.patch b/Spigot-API-Patches/Add-getTPS-method.patch index f51dec99d2..7b8fa75009 100644 --- a/Spigot-API-Patches/Add-getTPS-method.patch +++ b/Spigot-API-Patches/Add-getTPS-method.patch @@ -1,25 +1,44 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zach Brown <1254957+zachbr@users.noreply.github.com> -Date: Sun, 19 Oct 2014 18:22:18 -0500 +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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/Bukkit.java ++++ b/src/main/java/org/bukkit/Bukkit.java +@@ -0,0 +0,0 @@ public final class Bukkit { + } + + /** ++ * 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java @@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient { - public void restart() { - throw new UnsupportedOperationException("Not supported yet."); - } -+ -+ // PaperSpigot start - Add getTPS method -+ public double[] getTPS() -+ { -+ throw new UnsupportedOperationException( "Not supported yet." ); -+ } -+ // PaperSpigot end - } + BossBar createBossBar(String title, BarColor color, BarStyle style, BarFlag ...flags); - Spigot spigot(); + /** ++ * 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 + */ -- \ No newline at end of file diff --git a/Spigot-API-Patches/Add-player-view-distance-API.patch b/Spigot-API-Patches/Add-player-view-distance-API.patch index e42c9875f1..592331efc6 100644 --- a/Spigot-API-Patches/Add-player-view-distance-API.patch +++ b/Spigot-API-Patches/Add-player-view-distance-API.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Byteflux -Date: Wed, 1 Jul 2015 00:59:50 -0700 +Date: Mon, 29 Feb 2016 18:05:37 -0600 Subject: [PATCH] Add player view distance API @@ -9,32 +9,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -0,0 +0,0 @@ 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" ); -+ } - } + */ + public void setAffectsSpawning(boolean affects); - Spigot spigot(); --- -1.9.5.msysgit.1 - ++ /** ++ * 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 + { +-- \ No newline at end of file diff --git a/Spigot-API-Patches/Automatically-disable-plugins-that-fail-to-load.patch b/Spigot-API-Patches/Automatically-disable-plugins-that-fail-to-load.patch index f9bfa9c4b0..f5e953382b 100644 --- a/Spigot-API-Patches/Automatically-disable-plugins-that-fail-to-load.patch +++ b/Spigot-API-Patches/Automatically-disable-plugins-that-fail-to-load.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 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 @@ -12,10 +12,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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, diff --git a/Spigot-API-Patches/Check-PaperSpigot-versions.patch b/Spigot-API-Patches/Check-Paper-versions.patch similarity index 50% rename from Spigot-API-Patches/Check-PaperSpigot-versions.patch rename to Spigot-API-Patches/Check-Paper-versions.patch index 0d7152b469..c868aea727 100644 --- a/Spigot-API-Patches/Check-PaperSpigot-versions.patch +++ b/Spigot-API-Patches/Check-Paper-versions.patch @@ -1,7 +1,7 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> -Date: Sun, 28 Dec 2014 16:28:21 -0600 -Subject: [PATCH] Check PaperSpigot versions +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 @@ -13,48 +13,62 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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]); +- 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 { @@ -0,0 +0,0 @@ public class VersionCommand extends BukkitCommand { } } - private static int getDistance(String repo, String hash) { -+ private static int getDistance(String repo, String currentVerInt) { // PaperSpigot ++ 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"), // PaperSpigot ++ 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) { -- ex.printStackTrace(); -+ // PaperSpigot start ++ // Paper start + int newVer = Integer.decode(reader.readLine()); + int currentVer = Integer.decode(currentVerInt); + return newVer - currentVer; + } catch (NumberFormatException ex) { -+ //ex.printStackTrace(); -+ // PaperSpigot end + ex.printStackTrace(); ++ // Paper end return -1; } finally { reader.close(); diff --git a/Spigot-API-Patches/Expose-server-CommandMap.patch b/Spigot-API-Patches/Expose-server-CommandMap.patch index 2c082d1dc6..ef269d83c1 100644 --- a/Spigot-API-Patches/Expose-server-CommandMap.patch +++ b/Spigot-API-Patches/Expose-server-CommandMap.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Riley Park -Date: Mon, 15 Feb 2016 07:11:17 -0800 +Date: Mon, 29 Feb 2016 19:48:59 -0600 Subject: [PATCH] Expose server CommandMap @@ -8,21 +8,25 @@ diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Buk index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java -@@ -0,0 +0,0 @@ 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; +@@ -0,0 +0,0 @@ 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; @@ -0,0 +0,0 @@ public final class Bukkit { return server.getUnsafe(); } + // Paper start + /** -+ * Gets the active {@link CommandMap}. ++ * Gets the active {@link CommandMap} + * + * @return the active command map + */ @@ -38,30 +42,31 @@ diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Ser index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java -@@ -0,0 +0,0 @@ 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; +@@ -0,0 +0,0 @@ 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; @@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient { - @Deprecated - UnsafeValues getUnsafe(); + */ + public double[] getTPS(); + // Paper start + /** -+ * Gets the active {@link CommandMap}. ++ * Gets the active {@link CommandMap} + * + * @return the active command map + */ + CommandMap getCommandMap(); -+ // Paper end + - public class Spigot - { - @Deprecated --- -2.7.0.rc0.20.g4b9ab0e - + /** + * @see UnsafeValues + * @return the unsafe values instance +-- \ No newline at end of file diff --git a/Spigot-API-Patches/FallingBlock-and-TNTPrimed-source-location-API.patch b/Spigot-API-Patches/FallingBlock-and-TNTPrimed-source-location-API.patch new file mode 100644 index 0000000000..43ad6b55d1 --- /dev/null +++ b/Spigot-API-Patches/FallingBlock-and-TNTPrimed-source-location-API.patch @@ -0,0 +1,39 @@ +From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/entity/FallingBlock.java ++++ b/src/main/java/org/bukkit/entity/FallingBlock.java +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/entity/TNTPrimed.java ++++ b/src/main/java/org/bukkit/entity/TNTPrimed.java +@@ -0,0 +0,0 @@ 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(); + } +-- \ No newline at end of file diff --git a/Spigot-API-Patches/Fix-ServerListPingEvent-flagging-as-Async.patch b/Spigot-API-Patches/Fix-ServerListPingEvent-flagging-as-Async.patch index d4d015a511..6b5e009d6d 100644 --- a/Spigot-API-Patches/Fix-ServerListPingEvent-flagging-as-Async.patch +++ b/Spigot-API-Patches/Fix-ServerListPingEvent-flagging-as-Async.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 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 diff --git a/Spigot-API-Patches/Graduate-bungeecord-chat-API-from-spigot-subclasses.patch b/Spigot-API-Patches/Graduate-bungeecord-chat-API-from-spigot-subclasses.patch index c09215a35f..94d0cfa4ab 100644 --- a/Spigot-API-Patches/Graduate-bungeecord-chat-API-from-spigot-subclasses.patch +++ b/Spigot-API-Patches/Graduate-bungeecord-chat-API-from-spigot-subclasses.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> -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/Spigot-API-Patches/Made-EntityDismountEvent-Cancellable.patch b/Spigot-API-Patches/Made-EntityDismountEvent-Cancellable.patch index cffd78409a..587914c188 100644 --- a/Spigot-API-Patches/Made-EntityDismountEvent-Cancellable.patch +++ b/Spigot-API-Patches/Made-EntityDismountEvent-Cancellable.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 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 @@ -8,20 +8,20 @@ diff --git a/src/main/java/org/spigotmc/event/entity/EntityDismountEvent.java b/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/spigotmc/event/entity/EntityDismountEvent.java +++ b/src/main/java/org/spigotmc/event/entity/EntityDismountEvent.java -@@ -0,0 +0,0 @@ import org.bukkit.entity.Entity; +@@ -0,0 +0,0 @@ + 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 -+ - /** +@@ -0,0 +0,0 @@ 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(); @@ -30,7 +30,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return handlers; } + -+ // PaperSpigot start - implement Cancellable methods ++ // Paper start - Implement cancellable methods + @Override + public boolean isCancelled() { + return cancelled; @@ -40,6 +40,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public void setCancelled(boolean cancelled) { + this.cancelled = cancelled; + } -+ // PaperSpigot end ++ // Paper end } -- \ No newline at end of file diff --git a/Spigot-API-Patches/POM-changes.patch b/Spigot-API-Patches/POM-changes.patch index 6664ab5337..2f617d0f06 100644 --- a/Spigot-API-Patches/POM-changes.patch +++ b/Spigot-API-Patches/POM-changes.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> -Date: Tue, 6 Jan 2015 22:12:31 -0600 +Date: Mon, 29 Feb 2016 17:16:08 -0600 Subject: [PATCH] POM changes @@ -15,22 +15,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 - org.codehaus.mojo - animal-sniffer-maven-plugin -- 1.13 +- 1.14 - - - process-classes @@ -85,5 +85,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - org.apache.maven.plugins maven-shade-plugin - 2.3 + 2.4.1 -- \ No newline at end of file diff --git a/Spigot-API-Patches/Player-Tab-List-and-Title-APIs.patch b/Spigot-API-Patches/Player-Tab-List-and-Title-APIs.patch index 1f9cf677fc..56d0ac7b6b 100644 --- a/Spigot-API-Patches/Player-Tab-List-and-Title-APIs.patch +++ b/Spigot-API-Patches/Player-Tab-List-and-Title-APIs.patch @@ -1,154 +1,16 @@ From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/entity/Player.java -+++ b/src/main/java/org/bukkit/entity/Player.java -@@ -0,0 +0,0 @@ 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 -@@ -0,0 +0,0 @@ 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 - - /** -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 --- /dev/null -+++ b/src/main/java/org/github/paperspigot/Title.java ++++ b/src/main/java/com/destroystokyo/paper/Title.java @@ -0,0 +0,0 @@ -+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,5 +368,142 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } +} -\ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/entity/Player.java ++++ b/src/main/java/org/bukkit/entity/Player.java +@@ -0,0 +0,0 @@ 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; +@@ -0,0 +0,0 @@ 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 + + /** +@@ -0,0 +0,0 @@ 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(); + + -- \ No newline at end of file diff --git a/Spigot-API-Patches/Player-affects-spawning-API.patch b/Spigot-API-Patches/Player-affects-spawning-API.patch index 964d582611..63c38d796e 100644 --- a/Spigot-API-Patches/Player-affects-spawning-API.patch +++ b/Spigot-API-Patches/Player-affects-spawning-API.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Jedediah Smith -Date: Fri, 8 Aug 2014 22:51:26 -0500 +Date: Mon, 29 Feb 2016 17:22:34 -0600 Subject: [PATCH] Player affects spawning API @@ -9,34 +9,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -0,0 +0,0 @@ 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" ); -+ } - } + */ + public void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data); - Spigot spigot(); --- -1.9.5.msysgit.1 - ++ /** ++ * 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 + { +-- \ No newline at end of file diff --git a/Spigot-API-Patches/Stop-using-spigot-s-website-for-timings.patch b/Spigot-API-Patches/Stop-using-spigot-s-website-for-timings.patch deleted file mode 100644 index ee3bdb610a..0000000000 --- a/Spigot-API-Patches/Stop-using-spigot-s-website-for-timings.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zach Brown <1254957+zachbr@users.noreply.github.com> -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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/command/defaults/TimingsCommand.java -+++ b/src/main/java/org/bukkit/command/defaults/TimingsCommand.java -@@ -0,0 +0,0 @@ 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 { -@@ -0,0 +0,0 @@ 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" ); --- \ No newline at end of file diff --git a/Spigot-API-Patches/Timings-v2.patch b/Spigot-API-Patches/Timings-v2.patch index b036c1f554..d411bdf0d8 100644 --- a/Spigot-API-Patches/Timings-v2.patch +++ b/Spigot-API-Patches/Timings-v2.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 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 @@ -8,6 +8,11 @@ diff --git a/pom.xml b/pom.xml index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/pom.xml +++ b/pom.xml +@@ -0,0 +0,0 @@ +- + + 4.0.0 @@ -0,0 +0,0 @@ @@ -1709,7 +1714,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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(); @@ -2814,7 +2819,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +deleted file mode 100644 +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 --- a/src/main/java/org/bukkit/command/defaults/TimingsCommand.java -+++ b/src/main/java/org/bukkit/command/defaults/TimingsCommand.java -@@ -0,0 +0,0 @@ import org.spigotmc.CustomTimingsHandler; - // Spigot end - - public class TimingsCommand extends BukkitCommand { ++++ /dev/null +@@ -0,0 +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 0000000000000000000000000000000000000000..00000000000000000000000000000000 - } - - 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 - } - // 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; -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 - - 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 - } - } - // Spigot end - } +-} diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline - { - throw new UnsupportedOperationException( "Not supported yet" ); + public void sendMessage(net.md_5.bungee.api.chat.BaseComponent... components) { + throw new UnsupportedOperationException("Not supported yet."); } + + public int getPing() diff --git a/Spigot-Server-Patches/Add-BeaconEffectEvent.patch b/Spigot-Server-Patches/Add-BeaconEffectEvent.patch index eec41d4c4f..ab02fc20e4 100644 --- a/Spigot-Server-Patches/Add-BeaconEffectEvent.patch +++ b/Spigot-Server-Patches/Add-BeaconEffectEvent.patch @@ -1,9 +1,22 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Byteflux -Date: Thu, 23 Apr 2015 17:26:21 -0400 +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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/MobEffectList.java ++++ b/src/main/java/net/minecraft/server/MobEffectList.java +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/TileEntityBeacon.java @@ -12,52 +25,50 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import org.bukkit.entity.HumanEntity; // CraftBukkit end -+// PaperSpigot start ++// Paper 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 ++import com.destroystokyo.paper.event.block.BeaconEffectEvent; ++// Paper end + - public class TileEntityBeacon extends TileEntityContainer implements IUpdatePlayerListBox, IInventory { + public class TileEntityBeacon extends TileEntityContainer implements ITickable, IWorldInventory { - public static final MobEffectList[][] a = new MobEffectList[][] { { MobEffectList.FASTER_MOVEMENT, MobEffectList.FASTER_DIG}, { MobEffectList.RESISTANCE, MobEffectList.JUMP}, { MobEffectList.INCREASE_DAMAGE}, { MobEffectList.REGENERATION}}; -@@ -0,0 +0,0 @@ public class TileEntityBeacon extends TileEntityContainer implements IUpdatePlay - Iterator iterator = list.iterator(); + public static final MobEffectList[][] a = new MobEffectList[][] { { MobEffects.FASTER_MOVEMENT, MobEffects.FASTER_DIG}, { MobEffects.RESISTANCE, MobEffects.JUMP}, { MobEffects.INCREASE_DAMAGE}, { MobEffects.REGENERATION}}; +@@ -0,0 +0,0 @@ public class TileEntityBeacon extends TileEntityContainer implements ITickable, 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 ++ // 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.k, 180, b0, true, true)); -+ // PaperSpigot start - BeaconEffectEvent +- 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(effect.getType().getId(), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles())); -+ // PaperSpigot end ++ entityhuman.addEffect(new MobEffect(MobEffectList.fromId(effect.getType().getId()), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles())); ++ // Paper end } - if (this.j >= 4 && this.k != this.l && this.l > 0) { + if (this.k >= 4 && this.l != this.m && this.m != null) { iterator = list.iterator(); -+ PotionEffect secondaryEffect = new PotionEffect(PotionEffectType.getById(this.l), 180, 0, true, true); // PaperSpigot ++ 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.l, 180, 0, true, true)); -+ // PaperSpigot start - BeaconEffectEvent +- 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(effect.getType().getId(), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles())); -+ // PaperSpigot end ++ entityhuman.addEffect(new MobEffect(MobEffectList.fromId(effect.getType().getId()), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles())); ++ // Paper end } } } diff --git a/Spigot-Server-Patches/Add-FallingBlock-source-location-API.patch b/Spigot-Server-Patches/Add-FallingBlock-source-location-API.patch deleted file mode 100644 index b7ce50c411..0000000000 --- a/Spigot-Server-Patches/Add-FallingBlock-source-location-API.patch +++ /dev/null @@ -1,146 +0,0 @@ -From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockDragonEgg.java -+++ b/src/main/java/net/minecraft/server/BlockDragonEgg.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockFalling.java -+++ b/src/main/java/net/minecraft/server/BlockFalling.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityFallingBlock.java -+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java -@@ -0,0 +0,0 @@ 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); -@@ -0,0 +0,0 @@ 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) { -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -0,0 +0,0 @@ public class CraftWorld implements World { - 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); -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingSand.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingSand.java -@@ -0,0 +0,0 @@ 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 - } --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Add-Location-support-to-tab-completers-vanilla-featu.patch b/Spigot-Server-Patches/Add-Location-support-to-tab-completers-vanilla-featu.patch index 574fb2a0c4..6f584d0687 100644 --- a/Spigot-Server-Patches/Add-Location-support-to-tab-completers-vanilla-featu.patch +++ b/Spigot-Server-Patches/Add-Location-support-to-tab-completers-vanilla-featu.patch @@ -1,10 +1,24 @@ From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -0,0 +0,0 @@ public class PaperWorldConfig { + private void 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java @@ -13,8 +27,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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 } @@ -22,24 +36,36 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/ja index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -0,0 +0,0 @@ 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; +@@ -0,0 +0,0 @@ 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; @@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 } 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 @@ -76,24 +102,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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); -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java @@ -110,42 +129,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -0,0 +0,0 @@ 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 ); -+ } - } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Add-PlayerInitialSpawnEvent.patch b/Spigot-Server-Patches/Add-PlayerInitialSpawnEvent.patch index 2d630cf8e8..be45faea4b 100644 --- a/Spigot-Server-Patches/Add-PlayerInitialSpawnEvent.patch +++ b/Spigot-Server-Patches/Add-PlayerInitialSpawnEvent.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 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 @@ -13,9 +13,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } // 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,7 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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); diff --git a/Spigot-Server-Patches/Add-PlayerLocaleChangeEvent.patch b/Spigot-Server-Patches/Add-PlayerLocaleChangeEvent.patch deleted file mode 100644 index 5d87c567b5..0000000000 --- a/Spigot-Server-Patches/Add-PlayerLocaleChangeEvent.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - } - - 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -0,0 +0,0 @@ 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 - } --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Add-TNT-source-location-API.patch b/Spigot-Server-Patches/Add-TNT-source-location-API.patch deleted file mode 100644 index 11b09b2ed0..0000000000 --- a/Spigot-Server-Patches/Add-TNT-source-location-API.patch +++ /dev/null @@ -1,130 +0,0 @@ -From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockTNT.java -+++ b/src/main/java/net/minecraft/server/BlockTNT.java -@@ -0,0 +0,0 @@ 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); -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/DispenserRegistry.java -+++ b/src/main/java/net/minecraft/server/DispenserRegistry.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java -+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java -@@ -0,0 +0,0 @@ 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); - -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -0,0 +0,0 @@ public class CraftWorld implements World { - 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java -@@ -0,0 +0,0 @@ public class CraftTNTPrimed extends CraftEntity implements TNTPrimed { - - return null; - } -+ -+ // PaperSpigot start -+ @Override -+ public org.bukkit.Location getSourceLoc() { -+ return getHandle().sourceLoc; -+ } -+ // PaperSpigot end - } --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Add-async-chunk-load-API.patch b/Spigot-Server-Patches/Add-async-chunk-load-API.patch index 1357226929..6c3fa9ae4f 100644 --- a/Spigot-Server-Patches/Add-async-chunk-load-API.patch +++ b/Spigot-Server-Patches/Add-async-chunk-load-API.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Thu, 6 Nov 2014 18:29:20 -0600 +From: Zach Brown <1254957+zachbr@users.noreply.github.com> +Date: Tue, 1 Mar 2016 23:19:01 -0600 Subject: [PATCH] Add async chunk load API @@ -12,9 +12,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } -+ // 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,15 +22,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + }); + } ++ + 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; } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Add-configurable-despawn-distances-for-living-entiti.patch b/Spigot-Server-Patches/Add-configurable-despawn-distances-for-living-entiti.patch index 1acbd48a95..cd9a835760 100644 --- a/Spigot-Server-Patches/Add-configurable-despawn-distances-for-living-entiti.patch +++ b/Spigot-Server-Patches/Add-configurable-despawn-distances-for-living-entiti.patch @@ -1,9 +1,34 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Suddenly -Date: Sat, 7 Mar 2015 21:40:48 -0600 +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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -0,0 +0,0 @@ public class PaperWorldConfig { + 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityInsentient.java @@ -13,42 +38,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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 ++ 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 > this.world.paperSpigotConfig.softDespawnDistance) { // CraftBukkit - remove isTypeNotPersistent() check // PaperSpigot - custom despawn distance ++ 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 < this.world.paperSpigotConfig.softDespawnDistance) { // PaperSpigot - custom despawn distances ++ } else if (d3 < world.paperConfig.softDespawnDistance) { // Paper - 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -0,0 +0,0 @@ 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; -+ } - } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Add-configurable-portal-search-radius.patch b/Spigot-Server-Patches/Add-configurable-portal-search-radius.patch index fe867d586f..acc8283e85 100644 --- a/Spigot-Server-Patches/Add-configurable-portal-search-radius.patch +++ b/Spigot-Server-Patches/Add-configurable-portal-search-radius.patch @@ -1,9 +1,23 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Joseph Hirschfeld -Date: Sat, 20 Feb 2016 23:38:24 -0500 +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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -0,0 +0,0 @@ public class PaperWorldConfig { + private void 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/PortalTravelAgent.java @@ -13,49 +27,34 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } - 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()); ++ 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()); } @@ -0,0 +0,0 @@ public class PortalTravelAgent { } else { - BlockPosition blockposition = new BlockPosition(x, y, z); + 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 radius ++ 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.a.V() - 1 - blockposition.getY(), i1); blockposition2.getY() >= 0; blockposition2 = blockposition1) { ++ 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.a.getType(blockposition2).getBlock() == Blocks.PORTAL) { + 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World implements 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig - { - allowBlockLocationTabCompletion = getBoolean( "allow-block-location-tab-completion", true ); - } -+ -+ public int portalSearchRadius; -+ private void portalSearchRadius() -+ { -+ portalSearchRadius = getInt("portal-search-radius", 128); -+ } - } + 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()); -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Add-exception-reporting-event.patch b/Spigot-Server-Patches/Add-exception-reporting-event.patch index 0f12d2f16c..0102456444 100644 --- a/Spigot-Server-Patches/Add-exception-reporting-event.patch +++ b/Spigot-Server-Patches/Add-exception-reporting-event.patch @@ -1,434 +1,21 @@ From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -0,0 +0,0 @@ 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 { - -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -0,0 +0,0 @@ import 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 { -@@ -0,0 +0,0 @@ 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; -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java -+++ b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java -@@ -0,0 +0,0 @@ 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 { - -@@ -0,0 +0,0 @@ public class NameReferencingFileConverter { - root = NBTCompressedStreamTools.a(new java.io.FileInputStream(file1)); - } catch (Exception exception) { - exception.printStackTrace(); -+ ServerInternalException.reportInternalException(exception); // Paper - } - - if (root != null) { -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PersistentCollection.java -+++ b/src/main/java/net/minecraft/server/PersistentCollection.java -@@ -0,0 +0,0 @@ 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; -@@ -0,0 +0,0 @@ public class PersistentCollection { - } - } catch (Exception exception) { - exception.printStackTrace(); -+ ServerInternalException.reportInternalException(exception); - } - - } -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/RegionFile.java -+++ b/src/main/java/net/minecraft/server/RegionFile.java -@@ -0,0 +0,0 @@ - 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; -@@ -0,0 +0,0 @@ public class RegionFile { - } - } catch (IOException ioexception) { - ioexception.printStackTrace(); -+ ServerInternalException.reportInternalException(ioexception); // Paper - } - - } -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/RegionFileCache.java -+++ b/src/main/java/net/minecraft/server/RegionFileCache.java -@@ -0,0 +0,0 @@ - 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; -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/SpawnerCreature.java -+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java -@@ -0,0 +0,0 @@ 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 { -@@ -0,0 +0,0 @@ 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; - } - -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/TileEntity.java -+++ b/src/main/java/net/minecraft/server/TileEntity.java -@@ -0,0 +0,0 @@ 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 { - -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/VillageSiege.java -+++ b/src/main/java/net/minecraft/server/VillageSiege.java -@@ -0,0 +0,0 @@ - package net.minecraft.server; - -+import org.github.paperspigot.exception.ServerInternalException; -+ - import java.util.Iterator; - import java.util.List; - -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -0,0 +0,0 @@ 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 -@@ -0,0 +0,0 @@ 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 -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldNBTStorage.java -+++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java -@@ -0,0 +0,0 @@ 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 { -@@ -0,0 +0,0 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData { - return new WorldData(nbttagcompound1); - } catch (Exception exception) { - exception.printStackTrace(); -+ ServerInternalException.reportInternalException(exception); // Paper - } - } - -@@ -0,0 +0,0 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData { - return new WorldData(nbttagcompound1); - } catch (Exception exception1) { - exception1.printStackTrace(); -+ ServerInternalException.reportInternalException(exception1); // Paper - } - } - -@@ -0,0 +0,0 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData { - } - } catch (Exception exception) { - exception.printStackTrace(); -+ ServerInternalException.reportInternalException(exception); // Paper - } - - } -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -0,0 +0,0 @@ import 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; -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java -+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java -@@ -0,0 +0,0 @@ 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: -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 --- /dev/null -+++ b/src/main/java/org/github/paperspigot/ServerSchedulerReportingWrapper.java ++++ b/src/main/java/com/destroystokyo/paper/ServerSchedulerReportingWrapper.java @@ -0,0 +0,0 @@ -+package org.github.paperspigot; ++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,4 +48,327 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/Chunk.java ++++ b/src/main/java/net/minecraft/server/Chunk.java +@@ -0,0 +0,0 @@ + 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; +@@ -0,0 +0,0 @@ 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 { + +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java +@@ -0,0 +0,0 @@ import java.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; + +@@ -0,0 +0,0 @@ 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; + } + } +@@ -0,0 +0,0 @@ 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 + } + + } +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java ++++ b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java +@@ -0,0 +0,0 @@ + 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; +@@ -0,0 +0,0 @@ public class NameReferencingFileConverter { + root = NBTCompressedStreamTools.a(new java.io.FileInputStream(file1)); + } catch (Exception exception) { + exception.printStackTrace(); ++ ServerInternalException.reportInternalException(exception); // Paper + } + + if (root != null) { +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/PersistentCollection.java ++++ b/src/main/java/net/minecraft/server/PersistentCollection.java +@@ -0,0 +0,0 @@ + 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; +@@ -0,0 +0,0 @@ public class PersistentCollection { + } + } catch (Exception exception1) { + exception1.printStackTrace(); ++ ServerInternalException.reportInternalException(exception1); // Paper + } + } + +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/RegionFile.java ++++ b/src/main/java/net/minecraft/server/RegionFile.java +@@ -0,0 +0,0 @@ + package net.minecraft.server; + ++import com.destroystokyo.paper.exception.ServerInternalException; + import com.google.common.collect.Lists; + import java.io.BufferedInputStream; + import java.io.BufferedOutputStream; +@@ -0,0 +0,0 @@ public class RegionFile { + } + } catch (IOException ioexception) { + ioexception.printStackTrace(); ++ ServerInternalException.reportInternalException(ioexception); // Paper + } + + } +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/RegionFileCache.java ++++ b/src/main/java/net/minecraft/server/RegionFileCache.java +@@ -0,0 +0,0 @@ + package net.minecraft.server; + ++import com.destroystokyo.paper.exception.ServerInternalException; + import com.google.common.collect.Maps; + import java.io.DataInputStream; + import java.io.DataOutputStream; +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/SpawnerCreature.java ++++ b/src/main/java/net/minecraft/server/SpawnerCreature.java +@@ -0,0 +0,0 @@ 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; +@@ -0,0 +0,0 @@ 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; + } + +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/VillageSiege.java ++++ b/src/main/java/net/minecraft/server/VillageSiege.java +@@ -0,0 +0,0 @@ + package net.minecraft.server; + ++import com.destroystokyo.paper.exception.ServerInternalException; ++ + import java.util.Iterator; + import java.util.List; + +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/World.java ++++ b/src/main/java/net/minecraft/server/World.java +@@ -0,0 +0,0 @@ + 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; +@@ -0,0 +0,0 @@ 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 +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java ++++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java +@@ -0,0 +0,0 @@ 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; +@@ -0,0 +0,0 @@ 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) + } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Add-player-view-distance-API.patch b/Spigot-Server-Patches/Add-player-view-distance-API.patch index 011435a260..b82e052c7e 100644 --- a/Spigot-Server-Patches/Add-player-view-distance-API.patch +++ b/Spigot-Server-Patches/Add-player-view-distance-API.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Byteflux -Date: Wed, 1 Jul 2015 00:59:06 -0700 +Date: Wed, 2 Mar 2016 14:35:27 -0600 Subject: [PATCH] Add player view distance API @@ -9,18 +9,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - // CraftBukkit end - // Spigot start - public boolean collidesWithEntities = true; -+ public int viewDistance; // PaperSpigot - Player view distance API + public boolean f; + public int ping; + public boolean viewingCredits; ++ public int viewDistance; // Paper - Player view distance API - @Override - public boolean ad() + // CraftBukkit start + public String displayName; @@ -0,0 +0,0 @@ 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 ++ this.viewDistance = world.spigotConfig.viewDistance; // Paper - Player view distance API playerinteractmanager.player = this; this.playerInteractManager = playerinteractmanager; BlockPosition blockposition = worldserver.getSpawn(); @@ -28,55 +28,34 @@ diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/j index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -0,0 +0,0 @@ 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)); - } - } -@@ -0,0 +0,0 @@ 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; @@ -0,0 +0,0 @@ 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 - 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) { -+ // PaperSpigot end - PlayerChunkMap.PlayerChunk playerchunkmap_playerchunk = this.a(k, l, false); ++ // Paper end + PlayerChunk playerchunk = this.b(k, l); - if (playerchunkmap_playerchunk != null) { + if (playerchunk != null) { @@ -0,0 +0,0 @@ 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 i1 = this.j; ++ int i1 = entityplayer.viewDistance; // Paper - Player view distance API int j1 = i - k; int k1 = j - l; - List chunksToLoad = new LinkedList(); // CraftBukkit + @@ -0,0 +0,0 @@ public class PlayerChunkMap { } } - -+ // PaperSpigot start - Player view distance API + // 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) { @@ -86,9 +65,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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); ++ PlayerChunk playerchunkmap_playerchunk = this.c(x, z); + -+ if (!playerchunkmap_playerchunk.b.contains(player)) { ++ if (!playerchunkmap_playerchunk.c.contains(player)) { + playerchunkmap_playerchunk.a(player); + } + } @@ -97,7 +76,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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); ++ this.c(x, z).b(player); + } + } + } @@ -106,32 +85,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + player.viewDistance = viewDistance; + } + } -+ // PaperSpigot end -+ - public static int getFurthestViewableBlock(int i) { - return i * 16 - 16; - } ++ // 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - getHandle().affectsSpawning = affects; - } - // PaperSpigot end + public void setAffectsSpawning(boolean affects) { + getHandle().affectsSpawning = affects; + } + -+ // PaperSpigot start - Player view distance API -+ @Override -+ public int getViewDistance() { -+ return getHandle().viewDistance; -+ } ++ @Override ++ public int getViewDistance() { ++ return getHandle().viewDistance; ++ } + -+ @Override -+ public void setViewDistance(int viewDistance) { -+ ((WorldServer) getHandle().world).getPlayerChunkMap().updateViewDistance(getHandle(), viewDistance); -+ } -+ // PaperSpigot end - }; ++ @Override ++ public void setViewDistance(int viewDistance) { ++ ((WorldServer) getHandle().world).getPlayerChunkMap().updateViewDistance(getHandle(), viewDistance); ++ } + // Paper end - public Player.Spigot spigot() + // Spigot start -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Add-velocity-warnings.patch b/Spigot-Server-Patches/Add-velocity-warnings.patch index eeff9397dc..57983cea80 100644 --- a/Spigot-Server-Patches/Add-velocity-warnings.patch +++ b/Spigot-Server-Patches/Add-velocity-warnings.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Joseph Hirschfeld -Date: Mon, 22 Feb 2016 16:05:32 -0500 +Date: Thu, 3 Mar 2016 02:48:12 -0600 Subject: [PATCH] Add velocity warnings @@ -8,43 +8,17 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -0,0 +0,0 @@ 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() { @@ -0,0 +0,0 @@ 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 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(); -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java -@@ -0,0 +0,0 @@ public class PaperSpigotConfig - e.printStackTrace(); - } - } -+ -+ public static boolean warnForExcessiveVelocity; -+ private static void excessiveVelocityWarning() -+ { -+ warnForExcessiveVelocity = getBoolean("warnWhenSettingExcessiveVelocity", true); -+ } - } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/All-chunks-are-slime-spawn-chunks-toggle.patch b/Spigot-Server-Patches/All-chunks-are-slime-spawn-chunks-toggle.patch index 5f88075fc8..0d8630270e 100644 --- a/Spigot-Server-Patches/All-chunks-are-slime-spawn-chunks-toggle.patch +++ b/Spigot-Server-Patches/All-chunks-are-slime-spawn-chunks-toggle.patch @@ -1,37 +1,35 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: vemacs -Date: Fri, 29 Jan 2016 02:28:17 -0600 +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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -0,0 +0,0 @@ public class PaperWorldConfig { + private void 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntitySlime.java +++ b/src/main/java/net/minecraft/server/EntitySlime.java @@ -0,0 +0,0 @@ public class EntitySlime extends EntityInsentient implements IMonster { - return super.bR(); + return super.cF(); } - 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; ++ boolean isSlimeChunk = world.paperConfig.allChunksAreSlimeChunks || chunk.a(987234911L).nextInt(10) == 0; + if (this.random.nextInt(10) == 0 && isSlimeChunk && this.locY < 40.0D) { - return super.bR(); + return super.cF(); } } -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig - { - useHopperCheck = getBoolean( "use-hopper-check", false ); - } -+ -+ public boolean allChunksAreSlimeChunks; -+ private void allChunksAreSlimeChunks() -+ { -+ allChunksAreSlimeChunks = getBoolean( "all-chunks-are-slime-chunks", false ); -+ } - } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Allow-for-toggling-of-spawn-chunks.patch b/Spigot-Server-Patches/Allow-for-toggling-of-spawn-chunks.patch index 1c140bd928..927057b1b9 100644 --- a/Spigot-Server-Patches/Allow-for-toggling-of-spawn-chunks.patch +++ b/Spigot-Server-Patches/Allow-for-toggling-of-spawn-chunks.patch @@ -1,35 +1,34 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Dmck2b -Date: Sat, 7 Mar 2015 21:50:40 -0600 +Date: Tue, 1 Mar 2016 13:59:50 -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 +diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -0,0 +0,0 @@ public class PaperWorldConfig { softDespawnDistance = softDespawnDistance*softDespawnDistance; hardDespawnDistance = hardDespawnDistance*hardDespawnDistance; } + + public boolean keepSpawnInMemory; -+ private void keepSpawnInMemory() -+ { -+ keepSpawnInMemory = getBoolean( "keep-spawn-loaded", true ); -+ log( "Keep spawn chunk loaded: " + 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/World.java ++++ b/src/main/java/net/minecraft/server/World.java +@@ -0,0 +0,0 @@ public abstract class World implements 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); -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Allow-nerfed-mobs-to-jump.patch b/Spigot-Server-Patches/Allow-nerfed-mobs-to-jump.patch index 1b23ffa787..8c5aa65827 100644 --- a/Spigot-Server-Patches/Allow-nerfed-mobs-to-jump.patch +++ b/Spigot-Server-Patches/Allow-nerfed-mobs-to-jump.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> -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 @@ -9,10 +9,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java @@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving { - private boolean bo; - private Entity bp; - private NBTTagCompound bq; -+ public PathfinderGoalFloat goalFloat; // PaperSpigot + private boolean bC; + private Entity leashHolder; + private NBTTagCompound bE; ++ public PathfinderGoalFloat goalFloat; // Paper public EntityInsentient(World world) { super(world); @@ -20,12 +20,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // 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 @@ -37,8 +37,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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); } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Allow-specified-ItemStacks-to-retain-their-invalid-d.patch b/Spigot-Server-Patches/Allow-specified-ItemStacks-to-retain-their-invalid-d.patch deleted file mode 100644 index 381ada0d92..0000000000 --- a/Spigot-Server-Patches/Allow-specified-ItemStacks-to-retain-their-invalid-d.patch +++ /dev/null @@ -1,66 +0,0 @@ -From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ItemStack.java -+++ b/src/main/java/net/minecraft/server/ItemStack.java -@@ -0,0 +0,0 @@ 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("#.###"); -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java -@@ -0,0 +0,0 @@ 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; -@@ -0,0 +0,0 @@ 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, ", ") ); -+ } - } --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Allow-undead-horse-types-to-be-leashed.patch b/Spigot-Server-Patches/Allow-undead-horse-types-to-be-leashed.patch deleted file mode 100644 index 5bc5c17f6c..0000000000 --- a/Spigot-Server-Patches/Allow-undead-horse-types-to-be-leashed.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zach Brown <1254957+zachbr@users.noreply.github.com> -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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityHorse.java -+++ b/src/main/java/net/minecraft/server/EntityHorse.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -0,0 +0,0 @@ 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 ); -+ } - } --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Always-tick-falling-blocks.patch b/Spigot-Server-Patches/Always-tick-falling-blocks.patch index 53f45ed40a..0d10a136d0 100644 --- a/Spigot-Server-Patches/Always-tick-falling-blocks.patch +++ b/Spigot-Server-Patches/Always-tick-falling-blocks.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> -Date: Fri, 10 Apr 2015 18:07:36 -0500 +Date: Wed, 2 Mar 2016 00:32:25 -0600 Subject: [PATCH] Always tick falling blocks @@ -8,19 +8,47 @@ diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java -@@ -0,0 +0,0 @@ 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; +@@ -0,0 +0,0 @@ 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 @@ -0,0 +0,0 @@ public class ActivationRange || entity instanceof EntityFireball || entity instanceof EntityWeather || entity instanceof EntityTNTPrimed -+ || entity instanceof EntityFallingBlock // PaperSpigot - Always tick falling blocks ++ || entity instanceof EntityFallingBlock // Paper - Always tick falling blocks || entity instanceof EntityEnderCrystal || entity instanceof EntityFireworks ) { diff --git a/Spigot-Server-Patches/Avoid-hopper-searches-if-there-are-no-items.patch b/Spigot-Server-Patches/Avoid-hopper-searches-if-there-are-no-items.patch index 78a52d0181..c9f719e9d4 100644 --- a/Spigot-Server-Patches/Avoid-hopper-searches-if-there-are-no-items.patch +++ b/Spigot-Server-Patches/Avoid-hopper-searches-if-there-are-no-items.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 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. @@ -18,28 +18,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -0,0 +0,0 @@ public class Chunk { - private boolean k; - public final Map tileEntities; - public final List[] entitySlices; // Spigot -+ // PaperSpigot start - track the number of minecarts and items + // 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; + // Paper end + + // CraftBukkit start - Neighbor loaded cache for chunk lighting and entity ticking @@ -0,0 +0,0 @@ public class Chunk { - entity.af = k; - entity.ag = this.locZ; + 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) { @@ -47,30 +46,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } 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) { @@ -0,0 +0,0 @@ public class Chunk { - for (int k = i; k <= j; ++k) { 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(); @@ -78,7 +76,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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,9 +85,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } 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()) { diff --git a/Spigot-Server-Patches/Be-a-bit-more-informative-in-maxHealth-exception.patch b/Spigot-Server-Patches/Be-a-bit-more-informative-in-maxHealth-exception.patch index 94309f0b77..5f8073b62f 100644 --- a/Spigot-Server-Patches/Be-a-bit-more-informative-in-maxHealth-exception.patch +++ b/Spigot-Server-Patches/Be-a-bit-more-informative-in-maxHealth-exception.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Riley Park -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 @@ -13,12 +13,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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 - +-- \ No newline at end of file diff --git a/Spigot-Server-Patches/Bump-thread-count-for-chunk-loading.patch b/Spigot-Server-Patches/Bump-thread-count-for-chunk-loading.patch index 32523caa31..fc2382bc2f 100644 --- a/Spigot-Server-Patches/Bump-thread-count-for-chunk-loading.patch +++ b/Spigot-Server-Patches/Bump-thread-count-for-chunk-loading.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sun, 15 Nov 2015 19:36:37 -0600 +From: Zach Brown <1254957+zachbr@users.noreply.github.com> +Date: Wed, 2 Mar 2016 23:46:57 -0600 Subject: [PATCH] Bump thread count for chunk loading @@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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); diff --git a/Spigot-Server-Patches/Change-implementation-of-tile-entity-removal-list.patch b/Spigot-Server-Patches/Change-implementation-of-tile-entity-removal-list.patch index dc17c3a76c..d4148ea254 100644 --- a/Spigot-Server-Patches/Change-implementation-of-tile-entity-removal-list.patch +++ b/Spigot-Server-Patches/Change-implementation-of-tile-entity-removal-list.patch @@ -1,63 +1,63 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Joseph Hirschfeld -Date: Sat, 20 Feb 2016 00:42:18 -0500 +Date: Thu, 3 Mar 2016 02:39:54 -0600 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -0,0 +0,0 @@ package net.minecraft.server; - import com.google.common.base.Predicate; - import com.google.common.collect.Lists; - import com.google.common.collect.Maps; +@@ -0,0 +0,0 @@ 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 org.bukkit.Bukkit; - import org.bukkit.block.BlockState; - import org.bukkit.craftbukkit.CraftServer; + import com.google.common.util.concurrent.ThreadFactoryBuilder; + // Paper end + @@ -0,0 +0,0 @@ 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(); +- 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 c = Lists.newArrayList(); -+ private final Set c = Sets.newHashSet(); // Paper +- private final List tileEntityListUnload = Lists.newArrayList(); ++ private final Set tileEntityListUnload = Sets.newHashSet(); // Paper public final List players = Lists.newArrayList(); - public final List k = Lists.newArrayList(); + public final List j = Lists.newArrayList(); protected final IntHashMap entitiesById = new IntHashMap(); @@ -0,0 +0,0 @@ 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); + 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.g) { -+ j = e.ae; -+ k = e.ag; -+ if (e.ad && this.isChunkLoaded(j, k, true)) { -+ this.getChunkAt(j, k).b(e); ++ 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.g.size(); ++i) { -- this.b((Entity) this.g.get(i)); -+ for (Entity e : this.g) { -+ this.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.g.clear(); - timings.entityRemoval.stopTiming(); // Spigot + this.f.clear(); + this.l(); -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Check-online-mode-before-converting-and-renaming-pla.patch b/Spigot-Server-Patches/Check-online-mode-before-converting-and-renaming-pla.patch index 13f05be0d2..80b88903c0 100644 --- a/Spigot-Server-Patches/Check-online-mode-before-converting-and-renaming-pla.patch +++ b/Spigot-Server-Patches/Check-online-mode-before-converting-and-renaming-pla.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> -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 @@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // 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() ) diff --git a/Spigot-Server-Patches/ChunkMap-caching.patch b/Spigot-Server-Patches/ChunkMap-caching.patch deleted file mode 100644 index 220cc9ac03..0000000000 --- a/Spigot-Server-Patches/ChunkMap-caching.patch +++ /dev/null @@ -1,138 +0,0 @@ -From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -0,0 +0,0 @@ public class Chunk { - 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkSection.java -+++ b/src/main/java/net/minecraft/server/ChunkSection.java -@@ -0,0 +0,0 @@ public class ChunkSection { - private char[] blockIds; - private NibbleArray emittedLight; - private NibbleArray skyLight; -+ boolean isDirty; // PaperSpigot - - public ChunkSection(int i, boolean flag) { - this.yPos = i; -@@ -0,0 +0,0 @@ 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) { -@@ -0,0 +0,0 @@ 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) { -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet { - 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunkBulk.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig - { - mobSpawnerTickRate = getInt( "mob-spawner-tick-rate", 1 ); - } -+ -+ public boolean cacheChunkMaps; -+ private void cacheChunkMaps() -+ { -+ cacheChunkMaps = getBoolean( "cache-chunk-maps", false ); -+ } - } --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Configurable-TNT-cannon-fix.patch b/Spigot-Server-Patches/Configurable-TNT-cannon-fix.patch index fd5d8c550b..6550429f15 100644 --- a/Spigot-Server-Patches/Configurable-TNT-cannon-fix.patch +++ b/Spigot-Server-Patches/Configurable-TNT-cannon-fix.patch @@ -1,19 +1,34 @@ From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -0,0 +0,0 @@ public class PaperWorldConfig { + private void 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/BlockDiodeAbstract.java +++ b/src/main/java/net/minecraft/server/BlockDiodeAbstract.java -@@ -0,0 +0,0 @@ public abstract class BlockDiodeAbstract extends BlockDirectional { +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + world.applyPhysics(blockposition.shift(EnumDirection.UP), this); + return; + } -+ // PaperSpigot end ++ // Paper end EnumDirection[] aenumdirection = EnumDirection.values(); int i = aenumdirection.length; -@@ -0,0 +0,0 @@ public abstract class BlockDiodeAbstract extends BlockDirectional { +@@ -0,0 +0,0 @@ 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,7 +55,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + world.applyPhysics(blockposition.shift(EnumDirection.UP), this); + return; + } -+ // PaperSpigot end ++ // Paper end EnumDirection[] aenumdirection = EnumDirection.values(); int i = aenumdirection.length; @@ -52,8 +67,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 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,7 +95,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + world.applyPhysics(blockposition.shift(EnumDirection.NORTH), this); + return; + } -+ // PaperSpigot end ++ // Paper end EnumDirection[] aenumdirection = EnumDirection.values(); int i = aenumdirection.length; @@ -91,27 +106,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ 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; @@ -0,0 +0,0 @@ public class BlockRedstoneWire extends Block { - private void e(World world, BlockPosition blockposition) { + 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,7 +135,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + world.applyPhysics(blockposition.shift(EnumDirection.UP), this); + return; + } -+ // PaperSpigot end ++ // Paper end EnumDirection[] aenumdirection = EnumDirection.values(); int i = aenumdirection.length; @@ -131,29 +146,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ 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); @@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/DispenserRegistry.java @@ -162,12 +177,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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); } @@ -176,14 +191,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/EntityFallingBlock.java +++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java @@ -0,0 +0,0 @@ public class EntityFallingBlock extends Entity { - public IBlockData getBlock() { - return this.block; + 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,9 +209,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + @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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 @@ -206,18 +221,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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() {} + protected void i() { @@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + @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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/Explosion.java +++ b/src/main/java/net/minecraft/server/Explosion.java @@ -0,0 +0,0 @@ public class Explosion { - // CraftBukkit end - double d14 = EnchantmentProtection.a(entity, d13); + 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,57 +309,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + */ + // 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -0,0 +0,0 @@ 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; + -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Configurable-TNT-explosion-volume.patch b/Spigot-Server-Patches/Configurable-TNT-explosion-volume.patch deleted file mode 100644 index 4df7c1f629..0000000000 --- a/Spigot-Server-Patches/Configurable-TNT-explosion-volume.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Explosion.java -+++ b/src/main/java/net/minecraft/server/Explosion.java -@@ -0,0 +0,0 @@ public class Explosion { - } - - 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig - { - containerUpdateTickRate = getInt( "container-update-tick-rate", 1 ); - } -+ -+ public float tntExplosionVolume; -+ private void tntExplosionVolume() -+ { -+ tntExplosionVolume = getFloat( "tnt-explosion-volume", 4.0F ); -+ } - } --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Configurable-async-light-updates.patch b/Spigot-Server-Patches/Configurable-async-light-updates.patch index 86348317a6..89f42beacd 100644 --- a/Spigot-Server-Patches/Configurable-async-light-updates.patch +++ b/Spigot-Server-Patches/Configurable-async-light-updates.patch @@ -1,9 +1,23 @@ From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -0,0 +0,0 @@ public class PaperWorldConfig { + + } + ++ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/Chunk.java @@ -12,19 +26,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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; @@ -0,0 +0,0 @@ public class Chunk { - private int v; - private ConcurrentLinkedQueue w; + 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; @@ -33,29 +47,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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; + this.r = true; @@ -0,0 +0,0 @@ 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; + this.q = true; @@ -0,0 +0,0 @@ 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; + } + @@ -78,59 +92,59 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -0,0 +0,0 @@ import org.bukkit.generator.ChunkGenerator; - import java.util.*; - import java.util.concurrent.Callable; +@@ -0,0 +0,0 @@ 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 { + private int a = 63; @@ -0,0 +0,0 @@ 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) - { + public CraftWorld getWorld() { + return this.world; @@ -0,0 +0,0 @@ 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 } } @@ -0,0 +0,0 @@ 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; } @@ -138,8 +152,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } -- 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)*/) { @@ -149,11 +167,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return false; } else { @@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } + } -+ // PaperSpigot end ++ // Paper end ++ this.methodProfiler.b(); - return true; + this.methodProfiler.a("checkedPosition < toCheckCount"); + +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return false; + } + -+ if (!chunk.world.paperSpigotConfig.useAsyncLighting) { ++ if (!chunk.world.paperConfig.useAsyncLighting) { + return this.c(enumskyblock, position, chunk, null); + } + @@ -186,6 +207,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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,20 +237,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -0,0 +0,0 @@ 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 ); -+ } - } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Configurable-baby-zombie-movement-speed.patch b/Spigot-Server-Patches/Configurable-baby-zombie-movement-speed.patch index c9008594ba..167c1803b7 100644 --- a/Spigot-Server-Patches/Configurable-baby-zombie-movement-speed.patch +++ b/Spigot-Server-Patches/Configurable-baby-zombie-movement-speed.patch @@ -1,9 +1,24 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> -Date: Sat, 7 Mar 2015 20:41:55 -0600 +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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -0,0 +0,0 @@ public class PaperWorldConfig { + 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityZombie.java @@ -13,23 +28,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java -@@ -0,0 +0,0 @@ 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 -+ } - } ++ 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); +@@ -0,0 +0,0 @@ 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); + } + } + -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Configurable-cactus-and-reed-natural-growth-heights.patch b/Spigot-Server-Patches/Configurable-cactus-and-reed-natural-growth-heights.patch index 80a71454f4..5e8bf55663 100644 --- a/Spigot-Server-Patches/Configurable-cactus-and-reed-natural-growth-heights.patch +++ b/Spigot-Server-Patches/Configurable-cactus-and-reed-natural-growth-heights.patch @@ -1,9 +1,27 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> -Date: Sat, 7 Mar 2015 20:32:13 -0600 +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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -0,0 +0,0 @@ public class PaperWorldConfig { + 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/BlockCactus.java @@ -13,10 +31,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } - if (i < 3) { -+ if (i < world.paperSpigotConfig.cactusMaxHeight) { // PaperSpigot - Configurable max growth height for cactus blocks) { ++ if (i < world.paperConfig.cactusMaxHeight) { // Paper - Configurable growth height int j = ((Integer) iblockdata.get(BlockCactus.AGE)).intValue(); - if (j >= (byte) range(3, (world.growthOdds / world.spigotConfig.cactusModifier * 15) + 0.5F, 15)) { // Spigot + 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/BlockReed.java @@ -26,26 +44,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } - if (i < 3) { -+ if (i < world.paperSpigotConfig.reedMaxHeight) { // PaperSpigot - Configurable max growth height for reed blocks) { ++ if (i < world.paperConfig.reedMaxHeight) { // Paper - Configurable growth height 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -0,0 +0,0 @@ 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 ); -+ } - } + if (j >= (byte) range(3, (world.spigotConfig.caneModifier /100 * 15) + 0.5F, 15)) { // Spigot -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Configurable-container-update-tick-rate.patch b/Spigot-Server-Patches/Configurable-container-update-tick-rate.patch index b953ce6f2c..e7837233ca 100644 --- a/Spigot-Server-Patches/Configurable-container-update-tick-rate.patch +++ b/Spigot-Server-Patches/Configurable-container-update-tick-rate.patch @@ -1,50 +1,47 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Sudzzy -Date: Thu, 23 Jul 2015 22:05:22 -0700 +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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -0,0 +0,0 @@ public class PaperWorldConfig { + 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - // Spigot start - public boolean collidesWithEntities = true; - public int viewDistance; // PaperSpigot - Player view distance API -+ private int containerUpdateDelay; // PaperSpigot + public int ping; + public boolean viewingCredits; + public int viewDistance; // Paper - Player view distance API ++ private int containerUpdateDelay; // Paper - @Override - public boolean ad() + // CraftBukkit start + public String displayName; @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - if (this.noDamageTicks > 0) { --this.noDamageTicks; } -- + - this.activeContainer.b(); -+ -+ // PaperSpigot start - Configurable container update tick rate ++ // Paper start - Configurable container update tick rate + if (--containerUpdateDelay <= 0) { + this.activeContainer.b(); -+ containerUpdateDelay = world.paperSpigotConfig.containerUpdateTickRate; ++ containerUpdateDelay = world.paperConfig.containerUpdateTickRate; + } -+ // PaperSpigot end ++ // Paper 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig - { - cacheChunkMaps = getBoolean( "cache-chunk-maps", false ); - } -+ -+ public int containerUpdateTickRate; -+ private void containerUpdateTickRate() -+ { -+ containerUpdateTickRate = getInt( "container-update-tick-rate", 1 ); -+ } - } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Configurable-damage-multiplier-for-PvP-blocking.patch b/Spigot-Server-Patches/Configurable-damage-multiplier-for-PvP-blocking.patch deleted file mode 100644 index 9eb797f217..0000000000 --- a/Spigot-Server-Patches/Configurable-damage-multiplier-for-PvP-blocking.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zach Brown <1254957+zachbr@users.noreply.github.com> -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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityHuman.java -+++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { - // 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -0,0 +0,0 @@ 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 ); -+ } - } --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Configurable-end-credits-when-leaving-the-end.patch b/Spigot-Server-Patches/Configurable-end-credits-when-leaving-the-end.patch index 64c2cdd9fc..8a4f3e1428 100644 --- a/Spigot-Server-Patches/Configurable-end-credits-when-leaving-the-end.patch +++ b/Spigot-Server-Patches/Configurable-end-credits-when-leaving-the-end.patch @@ -1,91 +1,73 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: DoctorDark -Date: Thu, 28 May 2015 20:12:38 -0500 +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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -0,0 +0,0 @@ public class PaperWorldConfig { + 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - } - 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); + 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); -- this.viewingCredits = true; -- this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(4, 0.0F)); -+ if (!world.paperSpigotConfig.disableEndCredits) { +- if (!this.viewingCredits) { ++ if (!this.viewingCredits && !world.paperConfig.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); ++ // Paper end + this.viewingCredits = true; + if (this.a(AchievementList.D)) { + this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(4, 0.0F)); @@ -0,0 +0,0 @@ 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) { ++ 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; -+ 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; + TeleportCause cause = (this.dimension == 1 || i == 1) ? TeleportCause.END_PORTAL : TeleportCause.NETHER_PORTAL; + this.server.getPlayerList().changeDimension(this, i, cause); // PAIL: check all this +@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + this.cb = -1; + return this; } -+ // PaperSpigot end - ++ ++ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -0,0 +0,0 @@ public abstract class PlayerList { - } - - 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); @@ -0,0 +0,0 @@ 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 ++ // 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; } -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -0,0 +0,0 @@ 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 ); -+ } - } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Configurable-fishing-time-ranges.patch b/Spigot-Server-Patches/Configurable-fishing-time-ranges.patch index a925a039a2..624a2e7837 100644 --- a/Spigot-Server-Patches/Configurable-fishing-time-ranges.patch +++ b/Spigot-Server-Patches/Configurable-fishing-time-ranges.patch @@ -1,37 +1,37 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> -Date: Sat, 7 Mar 2015 21:00:13 -0600 +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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -0,0 +0,0 @@ public class PaperWorldConfig { + 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityFishingHook.java +++ b/src/main/java/net/minecraft/server/EntityFishingHook.java @@ -0,0 +0,0 @@ public class EntityFishingHook extends Entity { - this.ax = MathHelper.nextInt(this.random, 20, 80); + this.aw = 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; +- 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; } } -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -0,0 +0,0 @@ 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 ); -+ } - } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Configurable-game-mechanics-changes.patch b/Spigot-Server-Patches/Configurable-game-mechanics-changes.patch deleted file mode 100644 index 51dfa6d50b..0000000000 --- a/Spigot-Server-Patches/Configurable-game-mechanics-changes.patch +++ /dev/null @@ -1,80 +0,0 @@ -From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityBoat.java -+++ b/src/main/java/net/minecraft/server/EntityBoat.java -@@ -0,0 +0,0 @@ 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 - } -@@ -0,0 +0,0 @@ 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 - } -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -0,0 +0,0 @@ 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 ); -+ } - } --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Configurable-lava-flow-speed.patch b/Spigot-Server-Patches/Configurable-lava-flow-speed.patch index f27d13b422..e524ed3bf4 100644 --- a/Spigot-Server-Patches/Configurable-lava-flow-speed.patch +++ b/Spigot-Server-Patches/Configurable-lava-flow-speed.patch @@ -1,38 +1,37 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Byteflux -Date: Wed, 1 Jul 2015 00:38:10 -0700 +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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -0,0 +0,0 @@ public class PaperWorldConfig { + 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/BlockFlowing.java +++ b/src/main/java/net/minecraft/server/BlockFlowing.java @@ -0,0 +0,0 @@ public class BlockFlowing extends BlockFluids { - * 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.LAVA) { -+ return world.worldProvider.o() ? world.paperSpigotConfig.lavaFlowSpeedNether : world.paperSpigotConfig.lavaFlowSpeedNormal; ++ if (this.material == Material.LAVA) { ++ return world.worldProvider.m() ? world.paperConfig.lavaFlowSpeedNether : world.paperConfig.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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -0,0 +0,0 @@ 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 ); -+ } - } + if (this.material == Material.WATER && ( + world.getType(blockposition.north(1)).getBlock().material == Material.LAVA || + world.getType(blockposition.south(1)).getBlock().material == Material.LAVA || -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Configurable-mob-spawner-tick-rate.patch b/Spigot-Server-Patches/Configurable-mob-spawner-tick-rate.patch index 3e321b243a..49f11d0d9e 100644 --- a/Spigot-Server-Patches/Configurable-mob-spawner-tick-rate.patch +++ b/Spigot-Server-Patches/Configurable-mob-spawner-tick-rate.patch @@ -1,9 +1,23 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Sudzzy -Date: Tue, 14 Jul 2015 09:58:15 -0700 +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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -0,0 +0,0 @@ public class PaperWorldConfig { + private void 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java @@ -12,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private int maxNearbyEntities = 6; private int requiredPlayerRange = 16; private int spawnRange = 4; -+ private int tickDelay = 0; // PaperSpigot ++ private int tickDelay = 0; // Paper public MobSpawnerAbstract() {} @@ -20,48 +34,33 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } public void c() { -+ // PaperSpigot start - Configurable mob spawner tick rate ++ // Paper 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; ++ tickDelay = this.a().paperConfig.mobSpawnerTickRate; ++ // Paper end + if (!this.h()) { + this.e = this.d; + } else { @@ -0,0 +0,0 @@ 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]); + 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; // PaperSpigot ++ this.spawnDelay -= tickDelay; // Paper } - this.f = this.e; - this.e = (this.e + (double) (1000.0F / ((float) this.spawnDelay + 200.0F))) % 360.0D; + 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) { // PaperSpigot - this.h(); ++ if (this.spawnDelay < -tickDelay) { // Paper + this.i(); } if (this.spawnDelay > 0) { - --this.spawnDelay; -+ this.spawnDelay -= tickDelay; // PaperSpigot ++ this.spawnDelay -= tickDelay; // Paper return; } -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig - { - disableMoodSounds = getBoolean( "disable-mood-sounds", false ); - } -+ -+ public int mobSpawnerTickRate; -+ private void mobSpawnerTickRate() -+ { -+ mobSpawnerTickRate = getInt( "mob-spawner-tick-rate", 1 ); -+ } - } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Configurable-speed-for-water-flowing-over-lava.patch b/Spigot-Server-Patches/Configurable-speed-for-water-flowing-over-lava.patch index bec7710628..4fc3e78156 100644 --- a/Spigot-Server-Patches/Configurable-speed-for-water-flowing-over-lava.patch +++ b/Spigot-Server-Patches/Configurable-speed-for-water-flowing-over-lava.patch @@ -1,9 +1,24 @@ From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -0,0 +0,0 @@ public class PaperWorldConfig { + 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/BlockFlowing.java @@ -13,7 +28,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } - int j = this.a(world); -+ int j = this.getFlowSpeed(world, blockposition); // PaperSpigot ++ int j = this.getFlowSpeed(world, blockposition); // Paper int k; if (i > 0) { @@ -22,39 +37,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -0,0 +0,0 @@ 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 ); + } } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Configurable-squid-spawn-ranges.patch b/Spigot-Server-Patches/Configurable-squid-spawn-ranges.patch index fdd5e29583..2d4f5e60a6 100644 --- a/Spigot-Server-Patches/Configurable-squid-spawn-ranges.patch +++ b/Spigot-Server-Patches/Configurable-squid-spawn-ranges.patch @@ -1,9 +1,26 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> -Date: Sat, 7 Mar 2015 20:20:29 -0600 +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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -0,0 +0,0 @@ public class PaperWorldConfig { + 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntitySquid.java @@ -11,29 +28,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ 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 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) { -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -0,0 +0,0 @@ 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 ); -+ } - } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Configurable-strength-and-weakness-effect-modifiers.patch b/Spigot-Server-Patches/Configurable-strength-and-weakness-effect-modifiers.patch deleted file mode 100644 index 353f874320..0000000000 --- a/Spigot-Server-Patches/Configurable-strength-and-weakness-effect-modifiers.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/MobEffectAttackDamage.java -+++ b/src/main/java/net/minecraft/server/MobEffectAttackDamage.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java -@@ -0,0 +0,0 @@ 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 ); -+ } - } --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Configurable-top-of-nether-void-damage.patch b/Spigot-Server-Patches/Configurable-top-of-nether-void-damage.patch index 95de84dc89..d0fd7053cf 100644 --- a/Spigot-Server-Patches/Configurable-top-of-nether-void-damage.patch +++ b/Spigot-Server-Patches/Configurable-top-of-nether-void-damage.patch @@ -1,49 +1,49 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> -Date: Mon, 23 Feb 2015 14:57:28 -0600 +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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -0,0 +0,0 @@ public class PaperWorldConfig { + 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener { - this.K(); + this.U(); } + /** -+ * PaperSpigot - Checks if the feature is enabled and the entity is above the nether world bedrock height ++ * Paper - 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; ++ return this.world.paperConfig.netherVoidTopDamage && this.world.getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER && this.locY >= 128.0D; + } + - public void K() { + public void U() { this.world.methodProfiler.a("entityBaseTick"); - if (this.vehicle != null && this.vehicle.dead) { + if (this.isPassenger() && this.by().dead) { @@ -0,0 +0,0 @@ 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(); ++ if (this.locY < -64.0D || paperNetherCheck()) { // Paper - Configurable top-of-nether void damage) + this.Y(); } -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig - { - boatsDropBoats = getBoolean( "game-mechanics.boats-drop-boats", false ); - } -+ -+ public boolean netherVoidTopDamage; -+ private void nethervoidTopDamage() -+ { -+ netherVoidTopDamage = getBoolean( "nether-ceiling-void-damage", false ); -+ } - } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Disable-chest-cat-detection.patch b/Spigot-Server-Patches/Disable-chest-cat-detection.patch index 1033f86708..4a6230834f 100644 --- a/Spigot-Server-Patches/Disable-chest-cat-detection.patch +++ b/Spigot-Server-Patches/Disable-chest-cat-detection.patch @@ -1,40 +1,37 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Aikar -Date: Sun, 10 Jan 2016 20:40:33 -0600 +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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -0,0 +0,0 @@ public class PaperWorldConfig { + private void 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/BlockChest.java +++ b/src/main/java/net/minecraft/server/BlockChest.java -@@ -0,0 +0,0 @@ public class BlockChest extends BlockContainer { +@@ -0,0 +0,0 @@ public class BlockChest extends BlockTileEntity { } - private boolean p(World world, BlockPosition blockposition) { -+ // PaperSpigot start - Option to disable chest's cat detection (Performance++) -+ if (world.paperSpigotConfig.disableChestCatDetection) { + private boolean j(World world, BlockPosition blockposition) { ++ // Paper start - Option ti dsiable chest cat detection ++ if (world.paperConfig.disableChestCatDetection) { + return false; + } -+ // PaperSpigot end ++ // 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; -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -0,0 +0,0 @@ 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; -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Disable-explosion-knockback.patch b/Spigot-Server-Patches/Disable-explosion-knockback.patch index 08b52f878a..f33881f593 100644 --- a/Spigot-Server-Patches/Disable-explosion-knockback.patch +++ b/Spigot-Server-Patches/Disable-explosion-knockback.patch @@ -1,9 +1,23 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Sudzzy -Date: Tue, 14 Jul 2015 09:20:44 -0700 +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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -0,0 +0,0 @@ public class PaperWorldConfig { + 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java @@ -12,58 +26,46 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } -- 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(); ++ 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); + } + @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { } } -+ if (knockbackCancelled) this.world.broadcastEntityEffect(this, (byte) 2); // PaperSpigot ++ if (knockbackCancelled) this.world.broadcastEntityEffect(this, (byte) 2); // Paper - Disable explosion knockback + - String s; - 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/Explosion.java +++ b/src/main/java/net/minecraft/server/Explosion.java @@ -0,0 +0,0 @@ public class Explosion { - continue; - } - // CraftBukkit end -- double d14 = EnchantmentProtection.a(entity, d13); -+ double d14 = entity instanceof EntityHuman && world.paperSpigotConfig.disableExplosionKnockback ? 0 : EnchantmentProtection.a(entity, d13); // PaperSpigot + double d14 = 1.0D; - // PaperSpigot start - Fix cannons - /* + 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; @@ -0,0 +0,0 @@ public class Explosion { - entity.g(d8 * d14, d9 * d14, d10 * d14); - // PaperSpigot end + if (entity instanceof EntityHuman) { + EntityHuman entityhuman = (EntityHuman) entity; -- 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)); +- 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)); + } } - } -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -0,0 +0,0 @@ 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 ); -+ } - } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Disable-ice-and-snow.patch b/Spigot-Server-Patches/Disable-ice-and-snow.patch index b1dc69e404..a84934d89f 100644 --- a/Spigot-Server-Patches/Disable-ice-and-snow.patch +++ b/Spigot-Server-Patches/Disable-ice-and-snow.patch @@ -1,9 +1,23 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Sudzzy -Date: Tue, 14 Jul 2015 09:28:31 -0700 +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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -0,0 +0,0 @@ public class PaperWorldConfig { + private void 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java @@ -13,23 +27,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig - { - disableThunder = getBoolean( "disable-thunder", false ); - } -+ -+ public boolean disableIceAndSnow; -+ private void disableIceAndSnow() -+ { -+ disableIceAndSnow = getBoolean( "disable-ice-and-snow", false ); -+ } - } ++ 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))); -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Disable-mood-sounds.patch b/Spigot-Server-Patches/Disable-mood-sounds.patch deleted file mode 100644 index 22f2c7286d..0000000000 --- a/Spigot-Server-Patches/Disable-mood-sounds.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -0,0 +0,0 @@ public abstract class World implements 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig - { - disableIceAndSnow = getBoolean( "disable-ice-and-snow", false ); - } -+ -+ public boolean disableMoodSounds; -+ private void disableMoodSounds() -+ { -+ disableMoodSounds = getBoolean( "disable-mood-sounds", false ); -+ } - } --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Disable-spigot-tick-limiters.patch b/Spigot-Server-Patches/Disable-spigot-tick-limiters.patch index 10c84afbd1..2ad4d90d41 100644 --- a/Spigot-Server-Patches/Disable-spigot-tick-limiters.patch +++ b/Spigot-Server-Patches/Disable-spigot-tick-limiters.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> -Date: Sat, 24 Oct 2015 01:16:22 -0500 +Date: Wed, 2 Mar 2016 23:45:17 -0600 Subject: [PATCH] Disable spigot tick limiters @@ -16,22 +16,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - 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 @@ -0,0 +0,0 @@ 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 -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Disable-thunder.patch b/Spigot-Server-Patches/Disable-thunder.patch index 3f2382953d..fe54df58ce 100644 --- a/Spigot-Server-Patches/Disable-thunder.patch +++ b/Spigot-Server-Patches/Disable-thunder.patch @@ -1,35 +1,35 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Sudzzy -Date: Tue, 14 Jul 2015 09:26:41 -0700 +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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -0,0 +0,0 @@ public class PaperWorldConfig { + private void 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler { - int i1; + int l; 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig - { - disableExplosionKnockback = getBoolean( "disable-explosion-knockback", false ); - } -+ -+ public boolean disableThunder; -+ private void disableThunder() -+ { -+ disableThunder = getBoolean( "disable-thunder", false ); -+ } - } +- 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))); -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Don-t-create-Region-File-s-when-checking-if-chunk-ex.patch b/Spigot-Server-Patches/Don-t-create-Region-File-s-when-checking-if-chunk-ex.patch index f54231f24c..f1d3bd83f4 100644 --- a/Spigot-Server-Patches/Don-t-create-Region-File-s-when-checking-if-chunk-ex.patch +++ b/Spigot-Server-Patches/Don-t-create-Region-File-s-when-checking-if-chunk-ex.patch @@ -1,9 +1,9 @@ From 0000000000000000000000000000000000000000 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 @@ -15,8 +15,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } - 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 @@ -28,12 +30,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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); @@ -41,7 +44,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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(); } diff --git a/Spigot-Server-Patches/Don-t-create-a-chunk-just-to-unload-it.patch b/Spigot-Server-Patches/Don-t-create-a-chunk-just-to-unload-it.patch index 052734d563..a25fecb8e9 100644 --- a/Spigot-Server-Patches/Don-t-create-a-chunk-just-to-unload-it.patch +++ b/Spigot-Server-Patches/Don-t-create-a-chunk-just-to-unload-it.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 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 @@ -12,13 +12,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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; } diff --git a/Spigot-Server-Patches/Don-t-damage-already-dead-ArmorStands.patch b/Spigot-Server-Patches/Don-t-damage-already-dead-ArmorStands.patch deleted file mode 100644 index eb89a33895..0000000000 --- a/Spigot-Server-Patches/Don-t-damage-already-dead-ArmorStands.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityArmorStand.java -+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java -@@ -0,0 +0,0 @@ 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()) { --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Don-t-sleep-between-chunk-saves.patch b/Spigot-Server-Patches/Don-t-sleep-between-chunk-saves.patch new file mode 100644 index 0000000000..489d64d16b --- /dev/null +++ b/Spigot-Server-Patches/Don-t-sleep-between-chunk-saves.patch @@ -0,0 +1,39 @@ +From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/FileIOThread.java ++++ b/src/main/java/net/minecraft/server/FileIOThread.java +@@ -0,0 +0,0 @@ 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()) { +-- \ No newline at end of file diff --git a/Spigot-Server-Patches/Drop-falling-block-and-tnt-entities-at-the-specified.patch b/Spigot-Server-Patches/Drop-falling-block-and-tnt-entities-at-the-specified.patch index cb2b77e6f5..2bb92ca605 100644 --- a/Spigot-Server-Patches/Drop-falling-block-and-tnt-entities-at-the-specified.patch +++ b/Spigot-Server-Patches/Drop-falling-block-and-tnt-entities-at-the-specified.patch @@ -1,9 +1,28 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Byteflux -Date: Sat, 7 Mar 2015 22:03:47 -0600 +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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -0,0 +0,0 @@ public class PaperWorldConfig { + 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityFallingBlock.java @@ -13,15 +32,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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) { ++ // 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(); + } -+ // PaperSpigot end ++ // Paper end + this.motX *= 0.9800000190734863D; this.motY *= 0.9800000190734863D; @@ -35,42 +54,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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) { ++ // Paper start - Configurable TNT entity height nerf ++ if (this.world.paperConfig.entityTNTHeightNerf != 0 && this.locY > this.world.paperConfig.entityTNTHeightNerf) { + this.die(); + } -+ // PaperSpigot end ++ // Paper 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -0,0 +0,0 @@ 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 ); -+ } -+ } - } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/EAR-Fix-bug-with-teleporting-entities.patch b/Spigot-Server-Patches/EAR-Fix-bug-with-teleporting-entities.patch index 5f816dd76a..0f0de7d2b8 100644 --- a/Spigot-Server-Patches/EAR-Fix-bug-with-teleporting-entities.patch +++ b/Spigot-Server-Patches/EAR-Fix-bug-with-teleporting-entities.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Aikar -Date: Tue, 22 Dec 2015 18:16:11 -0600 +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 @@ -11,27 +11,37 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -0,0 +0,0 @@ public abstract class Entity implements 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 + 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 ad && getChunkX() == chunkX && getChunkY() == chunkY || getChunkZ() == chunkZ; ++ return aa && 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 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 ai; + 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/spigotmc/ActivationRange.java ++++ b/src/main/java/org/spigotmc/ActivationRange.java +@@ -0,0 +0,0 @@ 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; + } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Enderman-drop-the-block-they-re-holding-when-they-di.patch b/Spigot-Server-Patches/Enderman-drop-the-block-they-re-holding-when-they-di.patch deleted file mode 100644 index f3e243baba..0000000000 --- a/Spigot-Server-Patches/Enderman-drop-the-block-they-re-holding-when-they-di.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zach Brown <1254957+zachbr@users.noreply.github.com> -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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityEnderman.java -+++ b/src/main/java/net/minecraft/server/EntityEnderman.java -@@ -0,0 +0,0 @@ public class EntityEnderman extends EntityMonster { - } - } - -+ // 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) { --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Ensure-commands-are-not-ran-async.patch b/Spigot-Server-Patches/Ensure-commands-are-not-ran-async.patch index 44094e4342..f7c1b16946 100644 --- a/Spigot-Server-Patches/Ensure-commands-are-not-ran-async.patch +++ b/Spigot-Server-Patches/Ensure-commands-are-not-ran-async.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 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 @@ -17,11 +17,11 @@ diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList +@@ -0,0 +0,0 @@ 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,7 +43,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 @@ -55,7 +55,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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,7 +76,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + throw new RuntimeException("Exception processing dispatch command", e.getCause()); + } + } -+ // PaperSpigot End ++ // Paper End + if (commandMap.dispatch(sender, commandLine)) { return true; diff --git a/Spigot-Server-Patches/Ensure-inv-drag-is-in-bounds.patch b/Spigot-Server-Patches/Ensure-inv-drag-is-in-bounds.patch index d5acb0909d..43e198d6c6 100644 --- a/Spigot-Server-Patches/Ensure-inv-drag-is-in-bounds.patch +++ b/Spigot-Server-Patches/Ensure-inv-drag-is-in-bounds.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Joseph Hirschfeld -Date: Sat, 20 Feb 2016 02:19:31 -0500 +Date: Thu, 3 Mar 2016 02:33:53 -0600 Subject: [PATCH] Ensure inv drag is in bounds @@ -9,12 +9,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/Container.java +++ b/src/main/java/net/minecraft/server/Container.java @@ -0,0 +0,0 @@ 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); + 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; + } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Expose-server-CommandMap.patch b/Spigot-Server-Patches/Expose-server-CommandMap.patch index be70751adb..1130293e3d 100644 --- a/Spigot-Server-Patches/Expose-server-CommandMap.patch +++ b/Spigot-Server-Patches/Expose-server-CommandMap.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Riley Park -Date: Mon, 15 Feb 2016 07:11:28 -0800 +Date: Thu, 3 Mar 2016 02:15:57 -0600 Subject: [PATCH] Expose server CommandMap @@ -16,6 +16,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public SimpleCommandMap getCommandMap() { return commandMap; } --- -2.7.0.rc0.20.g4b9ab0e - +-- \ No newline at end of file diff --git a/Spigot-Server-Patches/FallingBlock-and-TNT-entities-collide-with-specific-.patch b/Spigot-Server-Patches/FallingBlock-and-TNT-entities-collide-with-specific-.patch deleted file mode 100644 index 0f5379e787..0000000000 --- a/Spigot-Server-Patches/FallingBlock-and-TNT-entities-collide-with-specific-.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -0,0 +0,0 @@ public abstract class World implements 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -0,0 +0,0 @@ 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 ); -+ } - } --- \ No newline at end of file diff --git a/Spigot-Server-Patches/FallingBlock-and-TNTPrimed-source-location-API.patch b/Spigot-Server-Patches/FallingBlock-and-TNTPrimed-source-location-API.patch new file mode 100644 index 0000000000..bcec791932 --- /dev/null +++ b/Spigot-Server-Patches/FallingBlock-and-TNTPrimed-source-location-API.patch @@ -0,0 +1,265 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Zach Brown <1254957+zachbr@users.noreply.github.com> +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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/BlockDragonEgg.java ++++ b/src/main/java/net/minecraft/server/BlockDragonEgg.java +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/BlockFalling.java ++++ b/src/main/java/net/minecraft/server/BlockFalling.java +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/BlockTNT.java ++++ b/src/main/java/net/minecraft/server/BlockTNT.java +@@ -0,0 +0,0 @@ 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); +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/DispenserRegistry.java ++++ b/src/main/java/net/minecraft/server/DispenserRegistry.java +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java ++++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java +@@ -0,0 +0,0 @@ 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); +@@ -0,0 +0,0 @@ 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) { +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java ++++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java +@@ -0,0 +0,0 @@ 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); + +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +@@ -0,0 +0,0 @@ public class CraftWorld implements World { + 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); +@@ -0,0 +0,0 @@ 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); +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingSand.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingSand.java +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java +@@ -0,0 +0,0 @@ public class CraftTNTPrimed extends CraftEntity implements TNTPrimed { + + return null; + } ++ ++ // Paper start ++ @Override ++ public org.bukkit.Location getSourceLoc() { ++ return getHandle().sourceLoc; ++ } ++ // Paper end + } +-- \ No newline at end of file diff --git a/Spigot-Server-Patches/Fast-draining.patch b/Spigot-Server-Patches/Fast-draining.patch index f3b8989872..d34e071cc2 100644 --- a/Spigot-Server-Patches/Fast-draining.patch +++ b/Spigot-Server-Patches/Fast-draining.patch @@ -1,9 +1,25 @@ From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -0,0 +0,0 @@ public class PaperWorldConfig { + 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/BlockFlowing.java @@ -13,7 +29,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } - 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,7 +38,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } 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)); @@ -32,68 +48,51 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } + + /** -+ * 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -0,0 +0,0 @@ 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 ); + } } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Fix-FurnaceMinecarts-losing-all-of-their-velocity-on.patch b/Spigot-Server-Patches/Fix-FurnaceMinecarts-losing-all-of-their-velocity-on.patch deleted file mode 100644 index 16db8d3693..0000000000 --- a/Spigot-Server-Patches/Fix-FurnaceMinecarts-losing-all-of-their-velocity-on.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityMinecartFurnace.java -+++ b/src/main/java/net/minecraft/server/EntityMinecartFurnace.java -@@ -0,0 +0,0 @@ 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 - } - - } --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Fix-inter-world-teleportation-glitches.patch b/Spigot-Server-Patches/Fix-inter-world-teleportation-glitches.patch index 6843fa37e1..ec02b1dbae 100644 --- a/Spigot-Server-Patches/Fix-inter-world-teleportation-glitches.patch +++ b/Spigot-Server-Patches/Fix-inter-world-teleportation-glitches.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 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,6 +10,20 @@ 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/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -0,0 +0,0 @@ public class PaperWorldConfig { + private void portalSearchRadius() { + portalSearchRadius = getInt("portal-search-radius", 128); + } ++ ++ public boolean 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -19,23 +33,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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); ++ // Paper - Configurable suffocation check ++ server.getHandle().moveToWorld(entity, toWorld.dimension, true, to, !toWorld.paperConfig.disableTeleportationSuffocationCheck); } return true; } -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig - { - portalSearchRadius = getInt("portal-search-radius", 128); - } -+ -+ public boolean disableTeleportationSuffocationCheck; -+ private void disableTeleportationSuffocationCheck() -+ { -+ disableTeleportationSuffocationCheck = getBoolean("disable-teleportation-suffocation-check", false); -+ } - } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Fix-jar-being-shaded-multiple-times.patch b/Spigot-Server-Patches/Fix-jar-being-shaded-multiple-times.patch deleted file mode 100644 index b9e147197a..0000000000 --- a/Spigot-Server-Patches/Fix-jar-being-shaded-multiple-times.patch +++ /dev/null @@ -1,19 +0,0 @@ -From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/pom.xml -+++ b/pom.xml -@@ -0,0 +0,0 @@ - maven-jar-plugin - 2.5 - -+ true - - - org.bukkit.craftbukkit.Main --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Fix-lag-from-explosions-processing-dead-entities.patch b/Spigot-Server-Patches/Fix-lag-from-explosions-processing-dead-entities.patch index 538f200dd2..dccb46063f 100644 --- a/Spigot-Server-Patches/Fix-lag-from-explosions-processing-dead-entities.patch +++ b/Spigot-Server-Patches/Fix-lag-from-explosions-processing-dead-entities.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 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 @@ -13,14 +13,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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) { diff --git a/Spigot-Server-Patches/Fix-lava-water-some-times-creating-air-instead-of-co.patch b/Spigot-Server-Patches/Fix-lava-water-some-times-creating-air-instead-of-co.patch index f8fc7c9960..a56b70454c 100644 --- a/Spigot-Server-Patches/Fix-lava-water-some-times-creating-air-instead-of-co.patch +++ b/Spigot-Server-Patches/Fix-lava-water-some-times-creating-air-instead-of-co.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 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 @@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } - 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; diff --git a/Spigot-Server-Patches/Fix-redstone-lag-issues.patch b/Spigot-Server-Patches/Fix-redstone-lag-issues.patch index 5a76b1967f..7274f40da9 100644 --- a/Spigot-Server-Patches/Fix-redstone-lag-issues.patch +++ b/Spigot-Server-Patches/Fix-redstone-lag-issues.patch @@ -1,9 +1,29 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> -Date: Mon, 13 Apr 2015 15:47:15 -0500 +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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -0,0 +0,0 @@ public class PaperWorldConfig { + 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java @@ -12,64 +32,46 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (false) { // CraftBukkit throw new IllegalStateException("TickNextTick list out of synch"); } else { -+ // PaperSpigot start - No, stop doing this, it affects things like redstone ++ // 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) { @@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler { - i = 1000; } // CraftBukkit end -+ */ -+ if (i > paperSpigotConfig.tickNextTickCap) { -+ i = paperSpigotConfig.tickNextTickCap; } -+ // PaperSpigot end ++ */ ++ if (i > paperConfig.tickNextTickCap) { ++ i = paperConfig.tickNextTickCap; ++ } ++ // Paper end this.methodProfiler.a("cleaning"); @@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler { - this.V.add(nextticklistentry); + this.U.add(nextticklistentry); } -+ // PaperSpigot start - Allow redstone ticks to bypass the tickNextTickListCap -+ if (paperSpigotConfig.tickNextTickListCapIgnoresRedstone) { -+ Iterator iterator = this.M.iterator(); ++ // 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; + } + -+ if (next.a().isPowerSource() || next.a() instanceof IContainer) { ++ IBlockData data = next.a().getBlockData(); ++ if (next.a().isPowerSource(data) || next.a() instanceof IInventory) { + iterator.remove(); -+ this.V.add(next); ++ this.U.add(next); + } + } + } -+ // PaperSpigot end ++ // Paper 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -0,0 +0,0 @@ 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 ); -+ } - } + Iterator iterator = this.U.iterator(); -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Force-load-chunks-for-specific-entities-that-fly-thr.patch b/Spigot-Server-Patches/Force-load-chunks-for-specific-entities-that-fly-thr.patch deleted file mode 100644 index d2ec6b62bb..0000000000 --- a/Spigot-Server-Patches/Force-load-chunks-for-specific-entities-that-fly-thr.patch +++ /dev/null @@ -1,204 +0,0 @@ -From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity implements 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 -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityEnderPearl.java -+++ b/src/main/java/net/minecraft/server/EntityEnderPearl.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityFallingBlock.java -+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java -@@ -0,0 +0,0 @@ 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) { -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java -+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java -@@ -0,0 +0,0 @@ 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) { -@@ -0,0 +0,0 @@ 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)); -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -0,0 +0,0 @@ public abstract class World implements 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 ); -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/spigotmc/ActivationRange.java -+++ b/src/main/java/org/spigotmc/ActivationRange.java -@@ -0,0 +0,0 @@ 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; - } --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Further-improve-server-tick-loop.patch b/Spigot-Server-Patches/Further-improve-server-tick-loop.patch index 7176ff7c1d..f463c13f8d 100644 --- a/Spigot-Server-Patches/Further-improve-server-tick-loop.patch +++ b/Spigot-Server-Patches/Further-improve-server-tick-loop.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 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 @@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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,7 +32,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - 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 @@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs this.isRunning = false; @@ -42,7 +42,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } } - // Spigot End -+ // PaperSpigot End ++ // Paper End public void run() { try { @@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs - this.a(this.r); // 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 - 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,33 +143,32 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -0,0 +0,0 @@ public final class CraftServer implements Server { + return 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/spigotmc/TicksPerSecondCommand.java @@ -197,21 +191,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - { - 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 ); diff --git a/Spigot-Server-Patches/Generator-Settings.patch b/Spigot-Server-Patches/Generator-Settings.patch index 838913f108..3a1eaa64d4 100644 --- a/Spigot-Server-Patches/Generator-Settings.patch +++ b/Spigot-Server-Patches/Generator-Settings.patch @@ -1,254 +1,16 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Byteflux -Date: Tue, 2 Jun 2015 00:41:23 -0700 +Date: Wed, 2 Mar 2016 02:17:54 -0600 Subject: [PATCH] Generator Settings -diff --git a/src/main/java/net/minecraft/server/BiomeBase.java b/src/main/java/net/minecraft/server/BiomeBase.java +diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BiomeBase.java -+++ b/src/main/java/net/minecraft/server/BiomeBase.java -@@ -0,0 +0,0 @@ public 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BiomeMesa.java -+++ b/src/main/java/net/minecraft/server/BiomeMesa.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderFlat.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderFlat.java -@@ -0,0 +0,0 @@ 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")) { -@@ -0,0 +0,0 @@ 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"))); - } - } -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderGenerate.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderGenerate.java -@@ -0,0 +0,0 @@ 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); - } - -@@ -0,0 +0,0 @@ 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); - } - -@@ -0,0 +0,0 @@ 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); -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderHell.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderHell.java -@@ -0,0 +0,0 @@ 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) { -@@ -0,0 +0,0 @@ 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); - } - -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/StructureGenerator.java -+++ b/src/main/java/net/minecraft/server/StructureGenerator.java -@@ -0,0 +0,0 @@ public abstract class StructureGenerator extends WorldGenBase { - } - - public boolean b(BlockPosition blockposition) { -+ if (this.c == null) return false; // PaperSpigot - this.a(this.c); - return this.c(blockposition) != null; - } -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig - loadUnloadedTNTEntities = getBoolean( "load-chunks.tnt-entities", false ); - loadUnloadedFallingBlocks = getBoolean( "load-chunks.falling-blocks", false ); +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -0,0 +0,0 @@ public class PaperWorldConfig { + disableEndCredits = getBoolean("game-mechanics.disable-end-credits", false); + log("End credits disabled: " + disableEndCredits); } + + public boolean generateCanyon; @@ -261,18 +23,254 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 ); ++ ++ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/BiomeBase.java ++++ b/src/main/java/net/minecraft/server/BiomeBase.java +@@ -0,0 +0,0 @@ public 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) { +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/BiomeMesa.java ++++ b/src/main/java/net/minecraft/server/BiomeMesa.java +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/ChunkProviderFlat.java ++++ b/src/main/java/net/minecraft/server/ChunkProviderFlat.java +@@ -0,0 +0,0 @@ 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")) { +@@ -0,0 +0,0 @@ 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"))); + } + } +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/ChunkProviderGenerate.java ++++ b/src/main/java/net/minecraft/server/ChunkProviderGenerate.java +@@ -0,0 +0,0 @@ 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); + } + } +@@ -0,0 +0,0 @@ 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); + } + } +@@ -0,0 +0,0 @@ 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); +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/ChunkProviderHell.java ++++ b/src/main/java/net/minecraft/server/ChunkProviderHell.java +@@ -0,0 +0,0 @@ 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) { +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/StructureGenerator.java ++++ b/src/main/java/net/minecraft/server/StructureGenerator.java +@@ -0,0 +0,0 @@ public abstract class StructureGenerator extends WorldGenBase { + } + + public boolean b(BlockPosition blockposition) { ++ if (this.g == null) return false; // Paper + this.a(this.g); + return this.c(blockposition) != null; + } +@@ -0,0 +0,0 @@ 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(); + -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Graduate-bungeecord-chat-API-from-spigot-subclasses.patch b/Spigot-Server-Patches/Graduate-bungeecord-chat-API-from-spigot-subclasses.patch index 94fced1016..7338c62485 100644 --- a/Spigot-Server-Patches/Graduate-bungeecord-chat-API-from-spigot-subclasses.patch +++ b/Spigot-Server-Patches/Graduate-bungeecord-chat-API-from-spigot-subclasses.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> -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/Spigot-Server-Patches/Made-EntityDismountEvent-Cancellable.patch b/Spigot-Server-Patches/Made-EntityDismountEvent-Cancellable.patch index 65ea1bdb7d..8e5584d571 100644 --- a/Spigot-Server-Patches/Made-EntityDismountEvent-Cancellable.patch +++ b/Spigot-Server-Patches/Made-EntityDismountEvent-Cancellable.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Nik Gil -Date: Mon, 1 Feb 2016 23:47:24 -0700 +Date: Thu, 3 Mar 2016 01:50:54 -0600 Subject: [PATCH] Made EntityDismountEvent Cancellable @@ -8,59 +8,25 @@ diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -0,0 +0,0 @@ import org.bukkit.event.entity.EntityPortalEvent; +@@ -0,0 +0,0 @@ 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 -+// PaperSpigot start -+import org.spigotmc.event.entity.EntityDismountEvent; -+// PaperSpigot end -+ public abstract class Entity implements ICommandListener { - - // CraftBukkit start @@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -0,0 +0,0 @@ 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"); -@@ -0,0 +0,0 @@ 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( 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; -+ // PaperSpigot end -+ - if (!this.world.isClientSide) { - this.q(this.vehicle); - } ++ // Paper end + this.passengers.remove(entity); + entity.j = 60; + } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Metrics.patch b/Spigot-Server-Patches/Metrics.patch index 49f3272eff..2d29db6afe 100644 --- a/Spigot-Server-Patches/Metrics.patch +++ b/Spigot-Server-Patches/Metrics.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> -Date: Wed, 18 Mar 2015 22:55:25 -0600 +Date: Tue, 1 Mar 2016 14:54:32 -0600 Subject: [PATCH] Metrics @@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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(); diff --git a/Spigot-Server-Patches/Only-refresh-abilities-if-needed.patch b/Spigot-Server-Patches/Only-refresh-abilities-if-needed.patch index f9a19daca8..3cf8fe147c 100644 --- a/Spigot-Server-Patches/Only-refresh-abilities-if-needed.patch +++ b/Spigot-Server-Patches/Only-refresh-abilities-if-needed.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Fri, 28 Nov 2014 13:20:22 -0600 +From: Zach Brown <1254957+zachbr@users.noreply.github.com> +Date: Tue, 1 Mar 2016 23:12:03 -0600 Subject: [PATCH] Only refresh abilities if needed @@ -12,14 +12,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @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 diff --git a/Spigot-Server-Patches/Optimize-Pathfinding.patch b/Spigot-Server-Patches/Optimize-Pathfinding.patch index 6c6110654d..ec2976fa87 100644 --- a/Spigot-Server-Patches/Optimize-Pathfinding.patch +++ b/Spigot-Server-Patches/Optimize-Pathfinding.patch @@ -1,14 +1,11 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Aikar -Date: Mon, 18 Jan 2016 00:18:43 -0500 +Date: Thu, 3 Mar 2016 02:02:07 -0600 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/NavigationAbstract.java @@ -17,10 +14,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } public boolean a(Entity entity, double d0) { -+ // PaperSpigot start - Pathfinding optimizations -+ if (this.pathfindFailures > 10 && this.d == null && MinecraftServer.currentTick < this.lastFailure + 40) { ++ // 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; @@ -36,31 +34,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } + private int lastFailure = 0; + private int pathfindFailures = 0; -+ // PaperSpigot end ++ // Paper end public boolean a(PathEntity pathentity, double d0) { if (pathentity == null) { @@ -0,0 +0,0 @@ public abstract class NavigationAbstract { } - public void n() { -+ this.pathfindFailures = 0; this.lastFailure = 0; // PaperSpigot - Pathfinding optimizations - this.d = null; + public void o() { ++ this.pathfindFailures = 0; this.lastFailure = 0; // Paper - Pathfinding optimizations + this.c = null; } -diff --git a/src/main/java/net/minecraft/server/PathfinderNormal.java b/src/main/java/net/minecraft/server/PathfinderNormal.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PathfinderNormal.java -+++ b/src/main/java/net/minecraft/server/PathfinderNormal.java -@@ -0,0 +0,0 @@ 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)) { -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Optimize-Spigot-s-Anti-X-Ray.patch b/Spigot-Server-Patches/Optimize-Spigot-s-Anti-X-Ray.patch deleted file mode 100644 index db4b9300fe..0000000000 --- a/Spigot-Server-Patches/Optimize-Spigot-s-Anti-X-Ray.patch +++ /dev/null @@ -1,86 +0,0 @@ -From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -0,0 +0,0 @@ public class WorldServer extends World implements 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/spigotmc/AntiXray.java -+++ b/src/main/java/org/spigotmc/AntiXray.java -@@ -0,0 +0,0 @@ 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 - { - -@@ -0,0 +0,0 @@ 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) - { -@@ -0,0 +0,0 @@ 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. - */ -@@ -0,0 +0,0 @@ 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(); --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Optimize-TileEntity-Ticking.patch b/Spigot-Server-Patches/Optimize-TileEntity-Ticking.patch index 0eb6359b71..cf9b3425c5 100644 --- a/Spigot-Server-Patches/Optimize-TileEntity-Ticking.patch +++ b/Spigot-Server-Patches/Optimize-TileEntity-Ticking.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sun, 8 Mar 2015 22:55:25 -0600 +From: Zach Brown <1254957+zachbr@users.noreply.github.com> +Date: Tue, 1 Mar 2016 22:01:19 -0600 Subject: [PATCH] Optimize TileEntity Ticking @@ -12,8 +12,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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 +-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; @@ -22,42 +22,42 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - 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 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; // PaperSpigot - numPlayersUsing - private int n; - private int o = -1; - private String p; -@@ -0,0 +0,0 @@ public class TileEntityChest extends TileEntityContainer implements IUpdatePlaye ++ public int l; // Paper - Number of viewers + private int p; + private BlockChest.Type q; + private String r; +@@ -0,0 +0,0 @@ public class TileEntityChest extends TileEntityLootable implements ITickable, II } public void c() { -+ // PaperSpigot - Move chest sounds out of the tick loop ++ // Paper - Disable all of this, just in case this does get ticked + /* this.m(); int i = this.position.getX(); int j = this.position.getY(); -@@ -0,0 +0,0 @@ public class TileEntityChest extends TileEntityContainer implements IUpdatePlaye +@@ -0,0 +0,0 @@ public class TileEntityChest extends TileEntityLootable implements ITickable, II this.j = 0.0F; } } - + */ -+ // PaperSpigot end ++ // Paper end } public boolean c(int i, int j) { -@@ -0,0 +0,0 @@ public class TileEntityChest extends TileEntityContainer implements IUpdatePlaye +@@ -0,0 +0,0 @@ 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 + -+ // PaperSpigot start - Move chest open sound out of the tick loop ++ // 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) { @@ -74,19 +74,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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); ++ 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); + } -+ // PaperSpigot end ++ // Paper end + - this.world.playBlockAction(this.position, this.w(), 1, this.l); + if (this.world == null) return; // CraftBukkit + this.world.playBlockAction(this.position, this.getBlock(), 1, this.l); - // CraftBukkit start - Call redstone event -@@ -0,0 +0,0 @@ public class TileEntityChest extends TileEntityContainer implements IUpdatePlaye +@@ -0,0 +0,0 @@ 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 + -+ // PaperSpigot start - Move chest close sound handling out of the tick loop ++ // 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; + @@ -107,12 +107,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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; ++ 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; + } -+ // PaperSpigot end ++ // Paper end + - this.world.playBlockAction(this.position, this.w(), 1, this.l); + 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 @@ -122,49 +122,48 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ package net.minecraft.server; --public class TileEntityEnderChest extends TileEntity implements IUpdatePlayerListBox { -+public class TileEntityEnderChest extends TileEntity { // PaperSpigot - remove IUpdatePlayerListBox +-public class TileEntityEnderChest extends TileEntity implements ITickable { ++public class TileEntityEnderChest extends TileEntity { // Paper - Remove ITickable - public float a; -+ public float a; // PaperSpigot - lidAngle ++ public float a; // Paper - lid angle public float f; - public int g; -+ public int g; // PaperSpigot - numPlayersUsing ++ public int g; // Paper - Number of viewers private int h; public TileEntityEnderChest() {} public void c() { -+ // PaperSpigot start - Move enderchest sound handling out of the tick loop ++ // 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); } -@@ -0,0 +0,0 @@ public class TileEntityEnderChest extends TileEntity implements IUpdatePlayerLis +@@ -0,0 +0,0 @@ public class TileEntityEnderChest extends TileEntity implements ITickable { this.a = 0.0F; } } -- + */ -+ // PaperSpigot end ++ // Paper end + } - public boolean c(int i, int j) { -@@ -0,0 +0,0 @@ public class TileEntityEnderChest extends TileEntity implements IUpdatePlayerLis +@@ -0,0 +0,0 @@ public class TileEntityEnderChest extends TileEntity implements ITickable { public void b() { ++this.g; + -+ // PaperSpigot start - Move enderchest open sounds out of the tick loop ++ // 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.makeSound(d1, (double) this.getPosition().getY() + 0.5D, d0, "random.chestopen", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); ++ 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); + } -+ // PaperSpigot end ++ // Paper end + this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g); } @@ -172,15 +171,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void d() { --this.g; + -+ // PaperSpigot start - Move enderchest close sounds out of the tick loop ++ // 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.makeSound(d0, (double) this.getPosition().getY() + 0.5D, d2, "random.chestclosed", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); ++ 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; + } -+ // PaperSpigot end ++ // Paper end + this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.g); } @@ -192,55 +191,46 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ 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(); + 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 c = Lists.newArrayList(); + private final List tileEntityListUnload = Lists.newArrayList(); @@ -0,0 +0,0 @@ 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(); + 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 @@ -0,0 +0,0 @@ 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 + 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()).e(tileentity.getPosition()); + this.getChunkAtWorldCoords(tileentity.getPosition()).d(tileentity.getPosition()); } @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - } + protected void l() {} public boolean a(TileEntity tileentity) { -- boolean flag = this.h.add(tileentity); -+ boolean flag = true; // PaperSpigot - Remove unused list +- boolean flag = this.tileEntityList.add(tileentity); ++ boolean flag = true; // Paper - Remove unused list - if (flag && tileentity instanceof IUpdatePlayerListBox) { - this.tileEntityList.add(tileentity); -@@ -0,0 +0,0 @@ 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); - } + if (flag && tileentity instanceof ITickable) { + this.tileEntityListTick.add(tileentity); @@ -0,0 +0,0 @@ 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); +- this.tileEntityList.remove(tileentity); ++ //this.tileEntityList.remove(tileentity); // Paper - Remove unused list + this.tileEntityListTick.remove(tileentity); } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Optimize-draining.patch b/Spigot-Server-Patches/Optimize-draining.patch index 6e0ac70b46..578bd0d048 100644 --- a/Spigot-Server-Patches/Optimize-draining.patch +++ b/Spigot-Server-Patches/Optimize-draining.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Byteflux -Date: Fri, 10 Apr 2015 02:24:20 -0700 +Date: Wed, 2 Mar 2016 00:55:24 -0600 Subject: [PATCH] Optimize draining @@ -13,14 +13,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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 ++ // 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 { diff --git a/Spigot-Server-Patches/Optimize-explosions.patch b/Spigot-Server-Patches/Optimize-explosions.patch index 5906b8569c..cea94c8116 100644 --- a/Spigot-Server-Patches/Optimize-explosions.patch +++ b/Spigot-Server-Patches/Optimize-explosions.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 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,6 +9,21 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -0,0 +0,0 @@ public class PaperWorldConfig { + 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/Explosion.java @@ -18,21 +33,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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 + // CraftBukkit start @@ -0,0 +0,0 @@ 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,7 +121,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 @@ -117,7 +131,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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 @@ -125,27 +139,20 @@ diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/m index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java +@@ -0,0 +0,0 @@ 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 + @@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -0,0 +0,0 @@ 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; -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Optimize-getBlockData.patch b/Spigot-Server-Patches/Optimize-getBlockData.patch index 8aa4629dce..b90165bf27 100644 --- a/Spigot-Server-Patches/Optimize-getBlockData.patch +++ b/Spigot-Server-Patches/Optimize-getBlockData.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 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. @@ -10,11 +10,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -0,0 +0,0 @@ public class Chunk { - } + 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,10 +23,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } + 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) { -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Optimize-getCubes.patch b/Spigot-Server-Patches/Optimize-getCubes.patch deleted file mode 100644 index e9e11f6db8..0000000000 --- a/Spigot-Server-Patches/Optimize-getCubes.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -0,0 +0,0 @@ public abstract class World implements 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; -@@ -0,0 +0,0 @@ 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 ); -@@ -0,0 +0,0 @@ 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)); - --- \ No newline at end of file diff --git a/Spigot-Server-Patches/POM-Changes.patch b/Spigot-Server-Patches/POM-Changes.patch index 457ebbe221..5d3cc37ef3 100644 --- a/Spigot-Server-Patches/POM-Changes.patch +++ b/Spigot-Server-Patches/POM-Changes.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> -Date: Thu, 19 Mar 2015 19:41:15 -0500 +Date: Mon, 29 Feb 2016 20:40:33 -0600 Subject: [PATCH] POM Changes @@ -14,24 +14,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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 @@ -0,0 +0,0 @@ - 1_8_R3 + 1_9_R1 git-Bukkit- - 1.6 - 1.6 -+ ++ + 1.8 + 1.8 @@ -39,43 +39,37 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - org.spigotmc - spigot-parent -+ org.github.paperspigot -+ paperspigot-parent ++ com.destroystokyo.paper ++ paper-parent dev-SNAPSHOT ../pom.xml -@@ -0,0 +0,0 @@ - 3.0.3 - + + - org.spigotmc - spigot-api -+ org.github.paperspigot -+ paperspigot-api ++ com.destroystokyo.paper ++ paper-api ${project.version} - jar compile + @@ -0,0 +0,0 @@ - spigotmc-public - https://hub.spigotmc.org/nexus/content/groups/public/ - -+ -+ -+ destroystokyo -+ https://ci.destroystokyo.com/plugin/repository/everything/ -+ - - - -@@ -0,0 +0,0 @@ - install + - 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 - craftbukkit.desc - - initialize -- ++ compile + - describe -- -- -- -- -+ com.lukegb.mojo -+ gitdescribe-maven-plugin -+ 1.3 -+ -+ git-PaperSpigot- -+ .. -+ -+ -+ -+ compile -+ -+ gitdescribe -+ -+ -+ -+ - - org.apache.maven.plugins - maven-jar-plugin ++ gitdescribe + + + @@ -0,0 +0,0 @@ + maven-jar-plugin + 2.6 + ++ true + org.bukkit.craftbukkit.Main CraftBukkit @@ -135,7 +116,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - org.codehaus.mojo - animal-sniffer-maven-plugin -- 1.13 +- 1.14 - - - process-classes @@ -155,20 +136,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java -+++ b/src/main/java/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java -@@ -0,0 +0,0 @@ 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 +@@ -0,0 +0,0 @@ + 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java @@ -178,7 +167,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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) { diff --git a/Spigot-Server-Patches/Paper-config-files.patch b/Spigot-Server-Patches/Paper-config-files.patch new file mode 100644 index 0000000000..76f0ccc1be --- /dev/null +++ b/Spigot-Server-Patches/Paper-config-files.patch @@ -0,0 +1,289 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Zach Brown <1254957+zachbr@users.noreply.github.com> +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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java +@@ -0,0 +0,0 @@ ++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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 +--- /dev/null ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -0,0 +0,0 @@ ++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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/DedicatedServer.java ++++ b/src/main/java/net/minecraft/server/DedicatedServer.java +@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer + 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/World.java ++++ b/src/main/java/net/minecraft/server/World.java +@@ -0,0 +0,0 @@ public abstract class World implements 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; +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +@@ -0,0 +0,0 @@ public final class CraftServer implements Server { + } + + 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); +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/Main.java ++++ b/src/main/java/org/bukkit/craftbukkit/Main.java +@@ -0,0 +0,0 @@ public class Main { + .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 + } + }; + +-- \ No newline at end of file diff --git a/Spigot-Server-Patches/PaperSpigot-config-files.patch b/Spigot-Server-Patches/PaperSpigot-config-files.patch deleted file mode 100644 index 531416e112..0000000000 --- a/Spigot-Server-Patches/PaperSpigot-config-files.patch +++ /dev/null @@ -1,319 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zach Brown <1254957+zachbr@users.noreply.github.com> -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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/DedicatedServer.java -+++ b/src/main/java/net/minecraft/server/DedicatedServer.java -@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - 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 -@@ -0,0 +0,0 @@ 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() { -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -0,0 +0,0 @@ public final class CraftServer implements Server { - } - - 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); -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/Main.java -+++ b/src/main/java/org/bukkit/craftbukkit/Main.java -@@ -0,0 +0,0 @@ public class Main { - .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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java -@@ -0,0 +0,0 @@ -+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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -0,0 +0,0 @@ -+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 ) ); -+ } -+} --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Player-Exhaustion-Multipliers.patch b/Spigot-Server-Patches/Player-Exhaustion-Multipliers.patch index 186157aa32..43a9de6ba9 100644 --- a/Spigot-Server-Patches/Player-Exhaustion-Multipliers.patch +++ b/Spigot-Server-Patches/Player-Exhaustion-Multipliers.patch @@ -1,21 +1,39 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: gsand -Date: Sat, 7 Mar 2015 21:35:14 -0600 +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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -0,0 +0,0 @@ public class PaperWorldConfig { + 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/Block.java +++ b/src/main/java/net/minecraft/server/Block.java @@ -0,0 +0,0 @@ public class Block { - public void a(World world, EntityHuman entityhuman, BlockPosition blockposition, IBlockData iblockdata, TileEntity tileentity) { - entityhuman.b(StatisticList.MINE_BLOCK_COUNT[getId(this)]); + 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.paperSpigotConfig.blockBreakExhaustion); // PaperSpigot - Configurable block break exhaustion - if (this.I() && EnchantmentManager.hasSilkTouchEnchantment(entityhuman)) { - ItemStack itemstack = this.i(iblockdata); ++ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 @@ -24,34 +42,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ 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.a(StatisticList.q, i); - this.applyExhaustion(0.015F * (float) i * 0.01F); -+ this.applyExhaustion(world.paperSpigotConfig.playerSwimmingExhaustion * (float) i * 0.01F); // PaperSpigot - Configurable swimming exhaustion ++ this.applyExhaustion(world.paperConfig.playerSwimmingExhaustion); // Paper - Configurable swimming exhaustion } - } else if (this.V()) { + } else if (this.isInWater()) { i = Math.round(MathHelper.sqrt(d0 * d0 + d2 * d2) * 100.0F); if (i > 0) { - this.a(StatisticList.l, i); + this.a(StatisticList.m, i); - this.applyExhaustion(0.015F * (float) i * 0.01F); -+ this.applyExhaustion(world.paperSpigotConfig.playerSwimmingExhaustion * (float) i * 0.01F); // PaperSpigot - Configurable swimming (diving) exhaustion ++ this.applyExhaustion(world.paperConfig.playerSwimmingExhaustion); // Paper - Configurable swimming exhaustion } - } else if (this.k_()) { + } else if (this.n_()) { 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -0,0 +0,0 @@ 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 ); -+ } - } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Player-Tab-List-and-Title-APIs.patch b/Spigot-Server-Patches/Player-Tab-List-and-Title-APIs.patch index b41319093b..e874a5060f 100644 --- a/Spigot-Server-Patches/Player-Tab-List-and-Title-APIs.patch +++ b/Spigot-Server-Patches/Player-Tab-List-and-Title-APIs.patch @@ -1,121 +1,20 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Techcable -Date: Tue, 16 Feb 2016 19:45:55 -0600 +Date: Thu, 3 Mar 2016 02:32:10 -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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutPlayerListHeaderFooter.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutPlayerListHeaderFooter.java -@@ -0,0 +0,0 @@ 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; - -@@ -0,0 +0,0 @@ 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) { -@@ -0,0 +0,0 @@ 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) { -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -0,0 +0,0 @@ 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 +@@ -0,0 +0,0 @@ + package org.bukkit.craftbukkit.entity; - @DelegateDeserialization(CraftOfflinePlayer.class) - public class CraftPlayer extends CraftHumanEntity implements Player { ++import com.destroystokyo.paper.Title; + import com.google.common.base.Preconditions; + import com.google.common.collect.ImmutableSet; + import com.mojang.authlib.GameProfile; @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { packet.components = components; getHandle().playerConnection.sendPacket(packet); @@ -200,4 +99,210 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Paper end @Override +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/PacketPlayOutPlayerListHeaderFooter.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/PacketPlayOutPlayerListHeaderFooter.java +@@ -0,0 +0,0 @@ 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; + +@@ -0,0 +0,0 @@ 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; +@@ -0,0 +0,0 @@ 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(); +@@ -0,0 +0,0 @@ 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); +@@ -0,0 +0,0 @@ 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 { +@@ -0,0 +0,0 @@ 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(); + } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Player-affects-spawning-API.patch b/Spigot-Server-Patches/Player-affects-spawning-API.patch index fb12448c50..0f4d2d1d4b 100644 --- a/Spigot-Server-Patches/Player-affects-spawning-API.patch +++ b/Spigot-Server-Patches/Player-affects-spawning-API.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 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 @@ -9,10 +9,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java @@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { - private final GameProfile bH; - private boolean bI = false; + 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; @@ -25,7 +25,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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; @@ -34,11 +34,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java @@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract { - private boolean g() { + 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() { @@ -51,7 +51,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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); @@ -59,64 +59,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -0,0 +0,0 @@ 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 { @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - return false; + 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,40 +117,32 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -0,0 +0,0 @@ import io.netty.buffer.Unpooled; - - import java.io.ByteArrayOutputStream; - import java.io.IOException; -+import java.lang.Override; - import java.net.InetSocketAddress; - import java.net.SocketAddress; - import java.util.ArrayList; @@ -0,0 +0,0 @@ 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() + { -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Prevent-tile-entity-and-entity-crashes.patch b/Spigot-Server-Patches/Prevent-tile-entity-and-entity-crashes.patch index 998fce06c1..179bffb413 100644 --- a/Spigot-Server-Patches/Prevent-tile-entity-and-entity-crashes.patch +++ b/Spigot-Server-Patches/Prevent-tile-entity-and-entity-crashes.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 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 @@ -12,13 +12,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } }); 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()); @@ -30,37 +30,36 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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 } } @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - tileentity.tickTimer.startTiming(); // Spigot - ((IUpdatePlayerListBox) tileentity).c(); + ((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 { diff --git a/Spigot-Server-Patches/Process-Entity-Chunk-Registration-on-Teleport.patch b/Spigot-Server-Patches/Process-Entity-Chunk-Registration-on-Teleport.patch index 87723b7b6d..83c06424ff 100644 --- a/Spigot-Server-Patches/Process-Entity-Chunk-Registration-on-Teleport.patch +++ b/Spigot-Server-Patches/Process-Entity-Chunk-Registration-on-Teleport.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 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 @@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // 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; } diff --git a/Spigot-Server-Patches/Re-add-Spigot-s-hopper-check-feature.patch b/Spigot-Server-Patches/Re-add-Spigot-s-hopper-check-feature.patch deleted file mode 100644 index 513db30b6c..0000000000 --- a/Spigot-Server-Patches/Re-add-Spigot-s-hopper-check-feature.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/TileEntityHopper.java -+++ b/src/main/java/net/minecraft/server/TileEntityHopper.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig - { - tntExplosionVolume = getFloat( "tnt-explosion-volume", 4.0F ); - } -+ -+ public boolean useHopperCheck; -+ private void useHopperCheck() -+ { -+ useHopperCheck = getBoolean( "use-hopper-check", false ); -+ } - } --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Remove-certain-entities-that-fly-through-unloaded-ch.patch b/Spigot-Server-Patches/Remove-certain-entities-that-fly-through-unloaded-ch.patch deleted file mode 100644 index a41d123b67..0000000000 --- a/Spigot-Server-Patches/Remove-certain-entities-that-fly-through-unloaded-ch.patch +++ /dev/null @@ -1,117 +0,0 @@ -From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity implements 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityEnderPearl.java -+++ b/src/main/java/net/minecraft/server/EntityEnderPearl.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityFallingBlock.java -+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java -+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - { - if ( !this.isChunkLoaded( chunkx, chunkz, true ) ) - { -+ entity.inUnloadedChunk = true; // PaperSpigot - Remove entities in unloaded chunks - continue; - } - int cz = chunkz << 4; -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -0,0 +0,0 @@ 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 ); -+ } - } --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Remove-completely-invalid-Redstone-event-for-Netherr.patch b/Spigot-Server-Patches/Remove-completely-invalid-Redstone-event-for-Netherr.patch deleted file mode 100644 index 5ca4ee82ef..0000000000 --- a/Spigot-Server-Patches/Remove-completely-invalid-Redstone-event-for-Netherr.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockBloodStone.java -+++ b/src/main/java/net/minecraft/server/BlockBloodStone.java -@@ -0,0 +0,0 @@ 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(); --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Remove-invalid-mob-spawner-tile-entities.patch b/Spigot-Server-Patches/Remove-invalid-mob-spawner-tile-entities.patch index 1676f3fdfd..27cde96868 100644 --- a/Spigot-Server-Patches/Remove-invalid-mob-spawner-tile-entities.patch +++ b/Spigot-Server-Patches/Remove-invalid-mob-spawner-tile-entities.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Byteflux -Date: Sun, 8 Mar 2015 22:55:25 -0600 +Date: Tue, 1 Mar 2016 15:08:03 -0600 Subject: [PATCH] Remove invalid mob spawner tile entities @@ -9,31 +9,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -0,0 +0,0 @@ public class Chunk { - tileentity.D(); + tileentity.z(); 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) { ++ // 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); -+ // PaperSpigot end ++ // 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(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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -0,0 +0,0 @@ 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 ); -+ } - } + + " (" + org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(getBlockData(blockposition).getBlock()) + ") where there was no entity tile!"); -- \ No newline at end of file diff --git a/Spigot-Server-Patches/SPIGOT-1387-Resolve-bed-issues-on-unloaded-chunks.patch b/Spigot-Server-Patches/SPIGOT-1387-Resolve-bed-issues-on-unloaded-chunks.patch deleted file mode 100644 index 85cd7db445..0000000000 --- a/Spigot-Server-Patches/SPIGOT-1387-Resolve-bed-issues-on-unloaded-chunks.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityHuman.java -+++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { - return 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(); - --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Send-absolute-position-the-first-time-an-entity-is-s.patch b/Spigot-Server-Patches/Send-absolute-position-the-first-time-an-entity-is-s.patch index e9ba4e085a..4684fa027a 100644 --- a/Spigot-Server-Patches/Send-absolute-position-the-first-time-an-entity-is-s.patch +++ b/Spigot-Server-Patches/Send-absolute-position-the-first-time-an-entity-is-s.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 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 @@ -11,48 +11,48 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ 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; @@ -0,0 +0,0 @@ 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; + 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) { @@ -0,0 +0,0 @@ public class EntityTrackerEntry { @@ -60,7 +60,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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,17 +79,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } + } -+ // PaperSpigot end ++ // Paper end } - this.b(); + this.d(); @@ -0,0 +0,0 @@ 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); -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Show-PaperSpigot-in-client-crashes-server-lists-and-.patch b/Spigot-Server-Patches/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch similarity index 66% rename from Spigot-Server-Patches/Show-PaperSpigot-in-client-crashes-server-lists-and-.patch rename to Spigot-Server-Patches/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch index c2f91b1276..f574cf5516 100644 --- a/Spigot-Server-Patches/Show-PaperSpigot-in-client-crashes-server-lists-and-.patch +++ b/Spigot-Server-Patches/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch @@ -1,8 +1,8 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> -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 @@ -14,10 +14,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/spigotmc/WatchdogThread.java @@ -27,7 +40,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 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,7 +61,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // 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, "------------------------------" ); // diff --git a/Spigot-Server-Patches/Speedup-BlockPos-by-fixing-inlining.patch b/Spigot-Server-Patches/Speedup-BlockPos-by-fixing-inlining.patch deleted file mode 100644 index ad879aa1b3..0000000000 --- a/Spigot-Server-Patches/Speedup-BlockPos-by-fixing-inlining.patch +++ /dev/null @@ -1,154 +0,0 @@ -From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BaseBlockPosition.java -+++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java -@@ -0,0 +0,0 @@ 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; -@@ -0,0 +0,0 @@ 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()); -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockPosition.java -+++ b/src/main/java/net/minecraft/server/BlockPosition.java -@@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition { - ++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; - } - } -@@ -0,0 +0,0 @@ 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); -@@ -0,0 +0,0 @@ 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; - } -@@ -0,0 +0,0 @@ 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; - } - --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Stackable-Buckets.patch b/Spigot-Server-Patches/Stackable-Buckets.patch deleted file mode 100644 index ccf4c68c6e..0000000000 --- a/Spigot-Server-Patches/Stackable-Buckets.patch +++ /dev/null @@ -1,172 +0,0 @@ -From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ItemBucket.java -+++ b/src/main/java/net/minecraft/server/ItemBucket.java -@@ -0,0 +0,0 @@ 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; -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ItemMilkBucket.java -+++ b/src/main/java/net/minecraft/server/ItemMilkBucket.java -@@ -0,0 +0,0 @@ - package net.minecraft.server; - -+import org.github.paperspigot.PaperSpigotConfig; // PaperSpigot -+ - public class ItemMilkBucket extends Item { - - public ItemMilkBucket() { -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -0,0 +0,0 @@ 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(); -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java -@@ -0,0 +0,0 @@ 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; -@@ -0,0 +0,0 @@ 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(); -+ } -+ } - } --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Stop-updating-flowing-block-if-material-has-changed.patch b/Spigot-Server-Patches/Stop-updating-flowing-block-if-material-has-changed.patch index 9426171bf9..c9e66df040 100644 --- a/Spigot-Server-Patches/Stop-updating-flowing-block-if-material-has-changed.patch +++ b/Spigot-Server-Patches/Stop-updating-flowing-block-if-material-has-changed.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 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 @@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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)) { diff --git a/Spigot-Server-Patches/Timings-v2.patch b/Spigot-Server-Patches/Timings-v2.patch index 6975fe282f..600879b306 100644 --- a/Spigot-Server-Patches/Timings-v2.patch +++ b/Spigot-Server-Patches/Timings-v2.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java +@@ -0,0 +0,0 @@ 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 { + +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/Block.java +++ b/src/main/java/net/minecraft/server/Block.java @@ -0,0 +0,0 @@ public class Block { - protected boolean y; - protected boolean z; - protected boolean isTileEntity; -+ // Spigot start + 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,11 +272,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/DedicatedServer.java @@ -226,7 +285,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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; @@ -234,33 +293,33 @@ diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -0,0 +0,0 @@ import org.bukkit.entity.Hanging; +@@ -0,0 +0,0 @@ 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; + import org.bukkit.event.vehicle.VehicleBlockCollisionEvent; @@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener { - public boolean loadChunks = false; // PaperSpigot - Entities can load chunks they move through and keep them loaded - - // Spigot start + 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; @@ -0,0 +0,0 @@ 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)); + this.recalcPosition(); @@ -0,0 +0,0 @@ public abstract class Entity implements ICommandListener { this.world.methodProfiler.b(); @@ -268,42 +327,43 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -0,0 +0,0 @@ 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 { @@ -0,0 +0,0 @@ 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(); @@ -0,0 +0,0 @@ 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); @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { - - this.world.methodProfiler.b(); - this.aT += f2; + } else { + this.bo = 0; + } +- - SpigotTimings.timerEntityTickRest.stopTiming(); // Spigot } @@ -313,9 +373,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.world.methodProfiler.a("ai"); - SpigotTimings.timerEntityAI.startTiming(); // Spigot - if (this.bD()) { - this.aY = false; - this.aZ = 0.0F; + if (this.cf()) { + this.bc = false; + this.bd = 0.0F; @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { this.doTick(); this.world.methodProfiler.b(); @@ -325,49 +385,47 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.world.methodProfiler.b(); this.world.methodProfiler.a("jump"); @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { - this.aZ *= 0.98F; - this.ba *= 0.98F; - this.bb *= 0.9F; + 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -0,0 +0,0 @@ import jline.console.ConsoleReader; - import joptsimple.OptionSet; +@@ -0,0 +0,0 @@ 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 { -@@ -0,0 +0,0 @@ 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(); -@@ -0,0 +0,0 @@ public abstract class MinecraftServer implements Runnable, ICommandListener, IAs - protected void z() {} - protected void A() throws ExceptionWorldConflict { // CraftBukkit - added throws +@@ -0,0 +0,0 @@ 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(); + } +@@ -0,0 +0,0 @@ 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; @@ -377,11 +435,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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; @@ -389,16 +447,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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 @@ -410,43 +468,43 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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 -@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList + public class PlayerConnection implements PacketListenerPlayIn, ITickable { +@@ -0,0 +0,0 @@ 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); -@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList + this.LOGGER.info(this.player.getName() + " issued server command: " + s); +@@ -0,0 +0,0 @@ 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 } @@ -459,14 +517,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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(); @@ -474,74 +532,72 @@ diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/m index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -0,0 +0,0 @@ import org.bukkit.Bukkit; +@@ -0,0 +0,0 @@ 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; - - import java.util.*; - import java.util.concurrent.Callable; @@ -0,0 +0,0 @@ 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; ++ public final co.aikar.timings.WorldTimingsHandler timings; // Paper + private boolean guardEntityList; // Spigot + public static boolean haveWeSilencedAPhysicsCrash; + public static String blockLocation; @@ -0,0 +0,0 @@ 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); + 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); } @@ -0,0 +0,0 @@ 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; @@ -0,0 +0,0 @@ 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; +@@ -0,0 +0,0 @@ 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; @@ -0,0 +0,0 @@ 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); @@ -551,31 +607,31 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } 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(); } @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { - } - // PaperSpigot end + entity.ticksLived++; + entity.inactiveTick(); } else { - entity.tickTimer.startTiming(); // Spigot // CraftBukkit end - entity.P = entity.locX; - entity.Q = entity.locY; + entity.M = entity.locX; + entity.N = entity.locY; @@ -0,0 +0,0 @@ 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 { @@ -0,0 +0,0 @@ public abstract class World implements IBlockAccess { + } } } - +- - entity.tickTimer.stopTiming(); // Spigot } } @@ -589,105 +645,98 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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 + this.manager.flush(); @@ -0,0 +0,0 @@ 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(); + int i1 = achunksection.length; @@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler { } } } -+ timings.chunkTicksBlocks.stopTiming(); // Spigot ++ timings.chunkTicksBlocks.stopTiming(); // Paper } - } + this.methodProfiler.b(); @@ -0,0 +0,0 @@ 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) { @@ -0,0 +0,0 @@ public class WorldServer extends World implements IAsyncTaskHandler { - this.M.remove(nextticklistentry); - this.V.add(nextticklistentry); + // 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) { + // Paper start - Allow redstone ticks to bypass the tickNextTickListCap + if (paperConfig.tickNextTickListCapIgnoresRedstone) { @@ -0,0 +0,0 @@ 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()) { @@ -0,0 +0,0 @@ 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 { @@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -0,0 +0,0 @@ public final class CraftServer implements Server { - DefaultPermissions.registerCorePermissions(); - CraftDefaultPermissions.registerCorePermissions(); - helpMap.initializeCommands(); -+ co.aikar.timings.Timings.reset(); // Spigot - } - } - -@@ -0,0 +0,0 @@ public final class CraftServer implements Server { - } - // PaperSpigot end + private final Spigot spigot = new Spigot() + { + @Deprecated @Override public YamlConfiguration getConfig() { -+ return getBukkitConfig(); -+ } -+ -+ @Override +@@ -0,0 +0,0 @@ public final class CraftServer implements Server { + } + + @Override + public YamlConfiguration getBukkitConfig() + { + return configuration; @@ -696,13 +745,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @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 @@ -892,10 +941,27 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +@@ -0,0 +0,0 @@ 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; @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - ((WorldServer) getHandle().world).getPlayerChunkMap().updateViewDistance(getHandle(), viewDistance); + packet.components = components; + getHandle().playerConnection.sendPacket(packet); } - // PaperSpigot end + + @Override + public int getPing() @@ -914,7 +980,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } - }); -+ }){{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 0000000000000000000000000000000000000000..00000000000000000000000000000000 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) { @@ -956,8 +1022,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 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; @@ -976,9 +1042,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this(null, null, -1, -1); } @@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 - 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,7 +1066,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - 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() { @@ -1007,16 +1074,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } 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() { @@ -0,0 +0,0 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot + setPeriod(-2l); return true; } - +- - // Spigot start - public String getTaskName() { - if (timingName != null) { @@ -1034,7 +1102,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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; } @@ -1042,125 +1110,13 @@ diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java -@@ -0,0 +0,0 @@ import net.minecraft.server.EntityWither; - import net.minecraft.server.MathHelper; - import net.minecraft.server.MinecraftServer; - import net.minecraft.server.World; +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/spigotmc/AntiXray.java -+++ b/src/main/java/org/spigotmc/AntiXray.java -@@ -0,0 +0,0 @@ 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; -@@ -0,0 +0,0 @@ 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 -@@ -0,0 +0,0 @@ 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(); - } - } - -@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/spigotmc/SpigotConfig.java -+++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -0,0 +0,0 @@ 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; -@@ -0,0 +0,0 @@ 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 - { -@@ -0,0 +0,0 @@ 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 ); -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Toggle-for-player-interact-limiter.patch b/Spigot-Server-Patches/Toggle-for-player-interact-limiter.patch index 69053b68c7..f5e967afb7 100644 --- a/Spigot-Server-Patches/Toggle-for-player-interact-limiter.patch +++ b/Spigot-Server-Patches/Toggle-for-player-interact-limiter.patch @@ -1,40 +1,38 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> -Date: Sat, 7 Mar 2015 21:07:10 -0600 +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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java +@@ -0,0 +0,0 @@ public class PaperConfig { + 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList - PlayerConnectionUtils.ensureMainThread(packetplayinblockplace, this, this.player.u()); - WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable { + this.player.resetIdleTimer(); + // Spigot start 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) { ++ // 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 ) { -diff --git a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotConfig.java -@@ -0,0 +0,0 @@ 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" ); -+ } -+ } - } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Toggleable-player-crits-helps-mitigate-hacked-client.patch b/Spigot-Server-Patches/Toggleable-player-crits-helps-mitigate-hacked-client.patch deleted file mode 100644 index fab1b5c241..0000000000 --- a/Spigot-Server-Patches/Toggleable-player-crits-helps-mitigate-hacked-client.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityHuman.java -+++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { - } - - 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java -@@ -0,0 +0,0 @@ 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; --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Use-UserCache-for-player-heads.patch b/Spigot-Server-Patches/Use-UserCache-for-player-heads.patch index ad75c684ab..0e482e811b 100644 --- a/Spigot-Server-Patches/Use-UserCache-for-player-heads.patch +++ b/Spigot-Server-Patches/Use-UserCache-for-player-heads.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 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 @@ -8,27 +8,26 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java -@@ -0,0 +0,0 @@ import net.minecraft.server.GameProfileSerializer; - import net.minecraft.server.NBTBase; - import net.minecraft.server.NBTTagCompound; +@@ -0,0 +0,0 @@ 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; @@ -0,0 +0,0 @@ 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; diff --git a/Spigot-Server-Patches/Vanished-players-don-t-have-rights.patch b/Spigot-Server-Patches/Vanished-players-don-t-have-rights.patch index 734aeb2fc7..e8a8ef2cd5 100644 --- a/Spigot-Server-Patches/Vanished-players-don-t-have-rights.patch +++ b/Spigot-Server-Patches/Vanished-players-don-t-have-rights.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> -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 @@ -8,69 +8,69 @@ diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityArrow.java +++ b/src/main/java/net/minecraft/server/EntityArrow.java -@@ -0,0 +0,0 @@ public class EntityArrow extends Entity implements IProjectile { - float f2; - float f3; +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityFishingHook.java +++ b/src/main/java/net/minecraft/server/EntityFishingHook.java @@ -0,0 +0,0 @@ public class EntityFishingHook extends Entity { - movingobjectposition = new MovingObjectPosition(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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/EntityProjectile.java +++ b/src/main/java/net/minecraft/server/EntityProjectile.java @@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/ItemBlock.java +++ b/src/main/java/net/minecraft/server/ItemBlock.java @@ -0,0 +0,0 @@ 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 + 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); @@ -82,14 +82,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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; } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/mc-dev-imports.patch b/Spigot-Server-Patches/mc-dev-imports.patch index a2892786d7..18555ef908 100644 --- a/Spigot-Server-Patches/mc-dev-imports.patch +++ b/Spigot-Server-Patches/mc-dev-imports.patch @@ -1,100 +1,9 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> -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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java -@@ -0,0 +0,0 @@ -+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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 @@ -104,11 +13,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + } + -+ 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } + ++ 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } + -+ 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; @@ -603,37 +486,41 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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,24 +726,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + 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 @@ -868,47 +739,39 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return iblockdata; + } + -+ if (iblockdata1.getBlock().o()) { ++ if (iblockdata1.b()) { + if (enumdirection != null) { + enumdirection = null; + break; @@ -1084,15 +937,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + if (world.getType(blockposition2).getBlock() == this) { -+ if (this.m(world, blockposition2)) { ++ if (this.d(world, blockposition2)) { + return false; + } + @@ -1124,7 +977,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + if (world.getType(blockposition3).getBlock() == this) { -+ if (this.m(world, blockposition3)) { ++ if (this.d(world, blockposition3)) { + return false; + } + @@ -1132,7 +985,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + if (world.getType(blockposition4).getBlock() == this) { -+ if (this.m(world, blockposition4)) { ++ if (this.d(world, blockposition4)) { + return false; + } + @@ -1142,7 +995,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + TileEntity tileentity = world.getTileEntity(blockposition); + + if (tileentity instanceof TileEntityChest) { -+ tileentity.E(); ++ tileentity.invalidateBlockCache(); + } + + } @@ -1183,18 +1036,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } + -+ 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } + -+ 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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,9 +1170,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 @@ -1354,13 +1222,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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; + } @@ -1419,16 +1287,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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,272 +1500,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } +} -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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/BlockPosition.java -@@ -0,0 +0,0 @@ -+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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 @@ -1900,10 +1514,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + } + -+ 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,24 +1709,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 @@ -2147,79 +1731,80 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + d8 = d8 * (1.0D - d9) + -10.0D * d9; + } + -+ this.p[l] = d8; ++ this.q[l] = d8; + ++l; + } + } @@ -2444,90 +2031,88 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + } + -+ 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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,38 +2147,32 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + 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 @@ -2625,80 +2186,86 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + k1 = -1; + } + } else { -+ chunksnapshot.a(i1, l1, l, Blocks.BEDROCK.getBlockData()); ++ chunksnapshot.a(i1, l1, l, ChunkProviderHell.c); + } + } + } @@ -2815,25 +2382,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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,167 +2546,196 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 --- /dev/null -+++ b/src/main/java/net/minecraft/server/EntityMinecartFurnace.java ++++ b/src/main/java/net/minecraft/server/EntitySquid.java @@ -0,0 +0,0 @@ +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 @@ -3185,41 +2759,39 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } + -+ public String e_(ItemStack itemstack) { ++ public String f_(ItemStack itemstack) { + return this.a.a(); + } + @@ -3270,65 +2842,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/ItemMilkBucket.java -@@ -0,0 +0,0 @@ -+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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/MobEffectAttackDamage.java -@@ -0,0 +0,0 @@ -+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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 @@ -3337,37 +2850,67 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + 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,183 +3066,61 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutPlayerListHeaderFooter.java -@@ -0,0 +0,0 @@ -+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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PacketPlayOutTitle.java -@@ -0,0 +0,0 @@ -+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 @@ -3720,245 +3138,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/PathfinderNormal.java -@@ -0,0 +0,0 @@ -+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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 @@ -3967,7 +3160,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + public void y() { -+ this.E(); ++ this.invalidateBlockCache(); + super.y(); + } + @@ -4052,26 +3245,149 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 --- /dev/null -+++ b/src/main/java/net/minecraft/server/TileEntityLightDetector.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/PacketPlayOutPlayerListHeaderFooter.java +@@ -0,0 +0,0 @@ ++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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 +--- /dev/null ++++ b/src/main/java/org/bukkit/craftbukkit/entity/PacketPlayOutTitle.java @@ -0,0 +0,0 @@ +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; ++ } ++ } +} -- \ No newline at end of file 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