diff --git a/Paper-MojangAPI/pom.xml b/Paper-MojangAPI/pom.xml index d0da7daf4..4c7c62c78 100644 --- a/Paper-MojangAPI/pom.xml +++ b/Paper-MojangAPI/pom.xml @@ -10,7 +10,7 @@ com.destroystokyo.paper paper-mojangapi - 1.15.2-R0.1-SNAPSHOT + 1.16.1-R0.1-SNAPSHOT jar Paper-MojangAPI diff --git a/README.md b/README.md index be8cacbb4..fbc4befe6 100644 --- a/README.md +++ b/README.md @@ -36,11 +36,28 @@ How To (Plugin Developers) com.destroystokyo.paper paper-api - 1.15.2-R0.1-SNAPSHOT + 1.16.1-R0.1-SNAPSHOT provided - + ``` +**Or alternatively, with Gradle:** + + * Repository: +```groovy +repositories { + maven { + url 'https://papermc.io/repo/repository/maven-public/' + } +} +``` + * Artifact: +```groovy +dependencies { + compileOnly 'com.destroystokyo.paper:paper-api:1.16.1-R0.1-SNAPSHOT' +} +``` + How To (Compiling Jar From Source) ------ To compile Paper, you need JDK 8, maven, and an internet connection. diff --git a/SHIT_TO_CHECK.md b/SHIT_TO_CHECK.md new file mode 100644 index 000000000..d6eeb9a77 --- /dev/null +++ b/SHIT_TO_CHECK.md @@ -0,0 +1,8 @@ +# Shit to check + +* Mini: "Optimize World Server Map": Figure out how to fill PaperWorldMap, it needs a dim key which doesnt exist anymore? +* Mini: "MC-50319": fix if still works +* Make sure the flat bedrock setting doesn't do anything stupid +* Check DataBits foreach +* lighting is bork (load chunk, fly away, come back, everything or parts are black) +* chunk generation seems slow with a lot of it happening \ No newline at end of file diff --git a/Spigot-API-Patches/0001-POM-changes.patch b/Spigot-API-Patches/0001-POM-changes.patch index 52950142e..cd8c45817 100644 --- a/Spigot-API-Patches/0001-POM-changes.patch +++ b/Spigot-API-Patches/0001-POM-changes.patch @@ -5,7 +5,7 @@ Subject: [PATCH] POM changes diff --git a/pom.xml b/pom.xml -index 186405ba1914b2b384896c61770c225b50091401..9975ba9ae19f6217bec206fee247fac1a30d58fc 100644 +index 274fd7d65ed48af7c4c055db0f99d1637f1af88f..14383eb14c5f3893edc7c76db90881d1abd4b675 100644 --- a/pom.xml +++ b/pom.xml @@ -2,34 +2,28 @@ @@ -22,7 +22,7 @@ index 186405ba1914b2b384896c61770c225b50091401..9975ba9ae19f6217bec206fee247fac1 - spigot-api + com.destroystokyo.paper + paper-api - 1.15.2-R0.1-SNAPSHOT + 1.16.1-R0.1-SNAPSHOT jar - Spigot-API @@ -85,14 +85,7 @@ index 186405ba1914b2b384896c61770c225b50091401..9975ba9ae19f6217bec206fee247fac1 com.google.guava -@@ -107,12 +119,13 @@ - - org.ow2.asm - asm-tree -- 7.3.1 -+ 8.0.1 - test - +@@ -113,6 +125,7 @@ @@ -111,7 +104,7 @@ index 186405ba1914b2b384896c61770c225b50091401..9975ba9ae19f6217bec206fee247fac1 -@@ -180,6 +189,7 @@ +@@ -185,6 +194,7 @@ diff --git a/Spigot-API-Patches/0002-Add-FastUtil-to-Bukkit.patch b/Spigot-API-Patches/0002-Add-FastUtil-to-Bukkit.patch index 0f3d5a059..6fde59106 100644 --- a/Spigot-API-Patches/0002-Add-FastUtil-to-Bukkit.patch +++ b/Spigot-API-Patches/0002-Add-FastUtil-to-Bukkit.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Add FastUtil to Bukkit Doesn't expose to plugins, just allows Paper-API to use it for optimization diff --git a/pom.xml b/pom.xml -index 9975ba9ae19f6217bec206fee247fac1a30d58fc..e8d9982bdbf9f66a54db16bf920e8106b81b034f 100644 +index 14383eb14c5f3893edc7c76db90881d1abd4b675..ae9179d4e3ea5608dfb9a5677de7c59c403450cc 100644 --- a/pom.xml +++ b/pom.xml @@ -49,6 +49,12 @@ diff --git a/Spigot-API-Patches/0004-Timings-v2.patch b/Spigot-API-Patches/0004-Timings-v2.patch index 8c10658d7..0d52c2f6a 100644 --- a/Spigot-API-Patches/0004-Timings-v2.patch +++ b/Spigot-API-Patches/0004-Timings-v2.patch @@ -2778,10 +2778,10 @@ index 0000000000000000000000000000000000000000..5989ee21297935651b0edd44b8239e65 + } +} diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index ae21e0f97d3d078e3b9ce9f60590c20e5012396e..755869366e7546fa8aefe7d7a1a602bab91a458c 100644 +index c1ecd19dd062276f5680b903309efce194559ae9..0b6ff0fe323397bb257f55bd2db21eba4ccc50f7 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java -@@ -618,7 +618,6 @@ public final class Bukkit { +@@ -640,7 +640,6 @@ public final class Bukkit { */ public static void reload() { server.reload(); @@ -2790,10 +2790,10 @@ index ae21e0f97d3d078e3b9ce9f60590c20e5012396e..755869366e7546fa8aefe7d7a1a602ba /** diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index f6fb72fab398ae8ca8b746154ff3c8fcad378faf..fad4e929264e2be534d3c4a90a5d557fd6c5807b 100644 +index 5a99e36393f885003569977461923a9f6fa23402..113536d4c86a5aa863c4db2416caa41ca6bc55c0 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java -@@ -1300,6 +1300,26 @@ public interface Server extends PluginMessageRecipient { +@@ -1328,6 +1328,26 @@ public interface Server extends PluginMessageRecipient { throw new UnsupportedOperationException("Not supported yet."); } @@ -3358,10 +3358,10 @@ index 2a145d851ce30360aa39549745bd87590c034584..00000000000000000000000000000000 - // Spigot end -} diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 92bafd6365313390326ea12fb815c62463f4d0fc..bfbe775fcd631b12975c0aaae8c82156b81c9614 100644 +index 0859d2bc226c4abf21ac1dc28f35ebe805046d89..39d196992bbcc263fa4bcd46c6187ba7b8adb935 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -1329,6 +1329,11 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -1369,6 +1369,11 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM public void sendMessage(@NotNull net.md_5.bungee.api.ChatMessageType position, @NotNull net.md_5.bungee.api.chat.BaseComponent... components) { throw new UnsupportedOperationException("Not supported yet."); } @@ -3374,7 +3374,7 @@ index 92bafd6365313390326ea12fb815c62463f4d0fc..bfbe775fcd631b12975c0aaae8c82156 @NotNull diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java -index ec77d7be69a8213c91d05bd3beabdd4fc664afa4..c548911c4b4fad495e4b321ea47455ec65c68255 100644 +index 62d0017362204070465c8ff72e5c2ca07501f558..745eaa8f2f2ff83536301db8ca47a8af30df7a73 100644 --- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java +++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java @@ -358,7 +358,6 @@ public final class SimplePluginManager implements PluginManager { @@ -3434,7 +3434,7 @@ index ec77d7be69a8213c91d05bd3beabdd4fc664afa4..c548911c4b4fad495e4b321ea47455ec } } diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -index df8a5dcbe3345abf7be53d7ebb81d13b33c86511..50a51394f71579b71c3875e4dc8c71abc23ae246 100644 +index 7b9ad3834c9c81220c74a16f1e66fb4da512e9f6..b6d739ca8ad8ebd4b1be7ebd129f9a7ae16b2a2a 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java @@ -53,7 +53,6 @@ public final class JavaPluginLoader implements PluginLoader { diff --git a/Spigot-API-Patches/0005-Player-affects-spawning-API.patch b/Spigot-API-Patches/0005-Player-affects-spawning-API.patch index b086a964b..b36f2c83e 100644 --- a/Spigot-API-Patches/0005-Player-affects-spawning-API.patch +++ b/Spigot-API-Patches/0005-Player-affects-spawning-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Player affects spawning API diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index bfbe775fcd631b12975c0aaae8c82156b81c9614..41cb8b3770d787eb0e12be191984e7767cc004e1 100644 +index 39d196992bbcc263fa4bcd46c6187ba7b8adb935..4f3a2189b42a2909f152ed1e33f79f431c6b903c 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -1231,6 +1231,22 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -1271,6 +1271,22 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM @NotNull public String getLocale(); diff --git a/Spigot-API-Patches/0006-Add-getTPS-method.patch b/Spigot-API-Patches/0006-Add-getTPS-method.patch index 6dc0d5c20..2530d8c06 100644 --- a/Spigot-API-Patches/0006-Add-getTPS-method.patch +++ b/Spigot-API-Patches/0006-Add-getTPS-method.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add getTPS method diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 755869366e7546fa8aefe7d7a1a602bab91a458c..6c3aa418589903925d92d48a79f9f3d2461f78d7 100644 +index 0b6ff0fe323397bb257f55bd2db21eba4ccc50f7..15543603c168623572b1a26e41eb20058770784d 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java -@@ -1369,6 +1369,17 @@ public final class Bukkit { +@@ -1401,6 +1401,17 @@ public final class Bukkit { return server.getEntity(uuid); } @@ -27,10 +27,10 @@ index 755869366e7546fa8aefe7d7a1a602bab91a458c..6c3aa418589903925d92d48a79f9f3d2 * Get the advancement specified by this key. * diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index fad4e929264e2be534d3c4a90a5d557fd6c5807b..f0dba56dcd8adb50725356810d316e74527939d8 100644 +index 113536d4c86a5aa863c4db2416caa41ca6bc55c0..3af00d77f9015f2eccab3047676b70c1af68daa7 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java -@@ -1148,6 +1148,16 @@ public interface Server extends PluginMessageRecipient { +@@ -1176,6 +1176,16 @@ public interface Server extends PluginMessageRecipient { @Nullable Entity getEntity(@NotNull UUID uuid); diff --git a/Spigot-API-Patches/0007-Entity-Origin-API.patch b/Spigot-API-Patches/0007-Entity-Origin-API.patch index 4c84cd9ee..f07f83e8f 100644 --- a/Spigot-API-Patches/0007-Entity-Origin-API.patch +++ b/Spigot-API-Patches/0007-Entity-Origin-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Entity Origin API diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java -index 6b550dda2a107d08553544261f26c08b6cdfa648..4e4445d186303c06906fea68a867cc7985c69ba2 100644 +index 05a507fec7b5ba091608c39e2231ee64c085e790..d2fa3628a3825b2226292bf6974866557abf799e 100644 --- a/src/main/java/org/bukkit/entity/Entity.java +++ b/src/main/java/org/bukkit/entity/Entity.java -@@ -598,4 +598,16 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent +@@ -599,4 +599,16 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent @Override Spigot spigot(); // Spigot end diff --git a/Spigot-API-Patches/0008-Version-Command-2.0.patch b/Spigot-API-Patches/0008-Version-Command-2.0.patch index 30c0dac02..3a888b027 100644 --- a/Spigot-API-Patches/0008-Version-Command-2.0.patch +++ b/Spigot-API-Patches/0008-Version-Command-2.0.patch @@ -55,7 +55,7 @@ index 0000000000000000000000000000000000000000..2a2651299e8dc631938ba4b4078dc694 + } +} diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index 26dbc2a761108d6aad056a786cb5146c63b7ad3d..98df287bcb1462fa42b7d4a706a68d36927fbc1c 100644 +index 945b8b030d1b2a13afc0c4efad76997eb7bf00ba..1b6d737046646c102b0d519ab3f67c3fbd503979 100644 --- a/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java @@ -77,5 +77,12 @@ public interface UnsafeValues { diff --git a/Spigot-API-Patches/0010-Add-player-view-distance-API.patch b/Spigot-API-Patches/0010-Add-player-view-distance-API.patch index 3df8366b1..df389fb6f 100644 --- a/Spigot-API-Patches/0010-Add-player-view-distance-API.patch +++ b/Spigot-API-Patches/0010-Add-player-view-distance-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add player view distance API diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 41cb8b3770d787eb0e12be191984e7767cc004e1..a985431e5d69e2837dae5c3284b0252ace04992a 100644 +index 4f3a2189b42a2909f152ed1e33f79f431c6b903c..babf70ad97413112f57ae1380f09a74e51975ff5 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -1245,6 +1245,20 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -1285,6 +1285,20 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * @param affects Whether the player can affect mob spawning */ public void setAffectsSpawning(boolean affects); diff --git a/Spigot-API-Patches/0013-Automatically-disable-plugins-that-fail-to-load.patch b/Spigot-API-Patches/0013-Automatically-disable-plugins-that-fail-to-load.patch index ea81806df..9d44d1360 100644 --- a/Spigot-API-Patches/0013-Automatically-disable-plugins-that-fail-to-load.patch +++ b/Spigot-API-Patches/0013-Automatically-disable-plugins-that-fail-to-load.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Automatically disable plugins that fail to load diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -index 50a51394f71579b71c3875e4dc8c71abc23ae246..5cc37eeedab8437db82791dd95cef4e387c124b3 100644 +index b6d739ca8ad8ebd4b1be7ebd129f9a7ae16b2a2a..c8497cb3021f584a885f4cb21c3be576ce0935a7 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java @@ -344,6 +344,10 @@ public final class JavaPluginLoader implements PluginLoader { diff --git a/Spigot-API-Patches/0014-Expose-server-CommandMap.patch b/Spigot-API-Patches/0014-Expose-server-CommandMap.patch index 64791486f..dc662b9ea 100644 --- a/Spigot-API-Patches/0014-Expose-server-CommandMap.patch +++ b/Spigot-API-Patches/0014-Expose-server-CommandMap.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Expose server CommandMap diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 6c3aa418589903925d92d48a79f9f3d2461f78d7..6b951d5adf9a665fd8bf8560a3fd7deb14897b34 100644 +index 15543603c168623572b1a26e41eb20058770784d..b46222ed2822fea563585462e43ee73ba2bb9b37 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java -@@ -1543,6 +1543,19 @@ public final class Bukkit { +@@ -1575,6 +1575,19 @@ public final class Bukkit { return server.getUnsafe(); } @@ -29,10 +29,10 @@ index 6c3aa418589903925d92d48a79f9f3d2461f78d7..6b951d5adf9a665fd8bf8560a3fd7deb public static Server.Spigot spigot() { return server.spigot(); diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index f0dba56dcd8adb50725356810d316e74527939d8..af21bb1aa133c6ab119f23c098d17a5bc4e9cd47 100644 +index 3af00d77f9015f2eccab3047676b70c1af68daa7..d3c498ad0e7681422ef2117be41c6603ebce0e0a 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java -@@ -1158,6 +1158,15 @@ public interface Server extends PluginMessageRecipient { +@@ -1186,6 +1186,15 @@ public interface Server extends PluginMessageRecipient { public double[] getTPS(); // Paper end diff --git a/Spigot-API-Patches/0015-Graduate-bungeecord-chat-API-from-spigot-subclasses.patch b/Spigot-API-Patches/0015-Graduate-bungeecord-chat-API-from-spigot-subclasses.patch index d870c5543..c92e65575 100644 --- a/Spigot-API-Patches/0015-Graduate-bungeecord-chat-API-from-spigot-subclasses.patch +++ b/Spigot-API-Patches/0015-Graduate-bungeecord-chat-API-from-spigot-subclasses.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Graduate bungeecord chat API from spigot subclasses Change Javadoc to be accurate diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 6b951d5adf9a665fd8bf8560a3fd7deb14897b34..39423f3a689a69de666537603e97d50244827f64 100644 +index b46222ed2822fea563585462e43ee73ba2bb9b37..7b1978a258cbf74983dc2512092653ed4ff64e98 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java @@ -274,6 +274,26 @@ public final class Bukkit { @@ -37,7 +37,7 @@ index 6b951d5adf9a665fd8bf8560a3fd7deb14897b34..39423f3a689a69de666537603e97d502 * Gets the name of the update folder. The update folder is used to safely * update plugins at the right moment on a plugin load. diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index af21bb1aa133c6ab119f23c098d17a5bc4e9cd47..b09d010853a67db16787d9e764f1e2949cb33050 100644 +index d3c498ad0e7681422ef2117be41c6603ebce0e0a..e3385abec44c603201aa37e3b3180cf88d378b52 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java @@ -225,6 +225,26 @@ public interface Server extends PluginMessageRecipient { @@ -68,10 +68,10 @@ index af21bb1aa133c6ab119f23c098d17a5bc4e9cd47..b09d010853a67db16787d9e764f1e294 * Gets the name of the update folder. The update folder is used to safely * update plugins at the right moment on a plugin load. diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index a985431e5d69e2837dae5c3284b0252ace04992a..dd6adedb63c0a51dab92879b199a8d284472f270 100644 +index babf70ad97413112f57ae1380f09a74e51975ff5..296aca8a5da6aa2a61988c9915df4d95279815a5 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -441,6 +441,38 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -481,6 +481,38 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM */ public void sendMap(@NotNull MapView map); diff --git a/Spigot-API-Patches/0016-Player-Tab-List-and-Title-APIs.patch b/Spigot-API-Patches/0016-Player-Tab-List-and-Title-APIs.patch index 6fbbfe5ed..933dad54b 100644 --- a/Spigot-API-Patches/0016-Player-Tab-List-and-Title-APIs.patch +++ b/Spigot-API-Patches/0016-Player-Tab-List-and-Title-APIs.patch @@ -384,7 +384,7 @@ index 0000000000000000000000000000000000000000..4fe18540f77143ee7cd7e94d3aa279ae + } +} diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index dd6adedb63c0a51dab92879b199a8d284472f270..3d07467a4ba39aa7c59abb49d12b094c872251da 100644 +index 296aca8a5da6aa2a61988c9915df4d95279815a5..eab4e326392efa93dd9acd086755a97616c79c39 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -1,6 +1,7 @@ @@ -395,7 +395,7 @@ index dd6adedb63c0a51dab92879b199a8d284472f270..3d07467a4ba39aa7c59abb49d12b094c import org.bukkit.DyeColor; import org.bukkit.Effect; import org.bukkit.GameMode; -@@ -471,6 +472,116 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -511,6 +512,116 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM public default void sendMessage(net.md_5.bungee.api.ChatMessageType position, net.md_5.bungee.api.chat.BaseComponent... components) { spigot().sendMessage(position, components); } diff --git a/Spigot-API-Patches/0017-Add-exception-reporting-event.patch b/Spigot-API-Patches/0017-Add-exception-reporting-event.patch index 914766487..b295b466f 100644 --- a/Spigot-API-Patches/0017-Add-exception-reporting-event.patch +++ b/Spigot-API-Patches/0017-Add-exception-reporting-event.patch @@ -506,7 +506,7 @@ index f020cb04eba27a2e70fc7cf799ebbfb434b9d974..adfc7aae2c0f49bbcdd358e83b04a0cf } diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java -index c548911c4b4fad495e4b321ea47455ec65c68255..9a5fe8ca4ad9415055f3a71b62064d9e79b8e644 100644 +index 745eaa8f2f2ff83536301db8ca47a8af30df7a73..d0fec44d2546290091649879450761ce08514fcb 100644 --- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java +++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java @@ -23,6 +23,10 @@ import java.util.WeakHashMap; diff --git a/Spigot-API-Patches/0020-Add-methods-for-working-with-arrows-stuck-in-living-.patch b/Spigot-API-Patches/0020-Add-methods-for-working-with-arrows-stuck-in-living-.patch index 3b095e9b8..b617eea89 100644 --- a/Spigot-API-Patches/0020-Add-methods-for-working-with-arrows-stuck-in-living-.patch +++ b/Spigot-API-Patches/0020-Add-methods-for-working-with-arrows-stuck-in-living-.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add methods for working with arrows stuck in living entities diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 203d135f156aa78f4daf497831399f4fdab41d5f..52541e496bd85e041a96fd5858acbb9bddbb8196 100644 +index 8744f2e5fdf47200d433d708fcd9d9aaded56c0c..5b0c95ab7372c7accd190b9052b587637106c4af 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -531,4 +531,19 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource +@@ -552,4 +552,19 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource * @param the type of the passed value */ void setMemory(@NotNull MemoryKey memoryKey, @Nullable T memoryValue); diff --git a/Spigot-API-Patches/0021-Complete-resource-pack-API.patch b/Spigot-API-Patches/0021-Complete-resource-pack-API.patch index 0cec19d18..691aac64f 100644 --- a/Spigot-API-Patches/0021-Complete-resource-pack-API.patch +++ b/Spigot-API-Patches/0021-Complete-resource-pack-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Complete resource pack API diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 3d07467a4ba39aa7c59abb49d12b094c872251da..9e62987cbd36074923ade7c9dea0e418cfb9c2bc 100644 +index eab4e326392efa93dd9acd086755a97616c79c39..bc9ff9b4a475d8b108b54f2d4a99199379b1c63d 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -981,7 +981,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -1021,7 +1021,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * @throws IllegalArgumentException Thrown if the URL is null. * @throws IllegalArgumentException Thrown if the URL is too long. The * length restriction is an implementation specific arbitrary value. @@ -18,7 +18,7 @@ index 3d07467a4ba39aa7c59abb49d12b094c872251da..9e62987cbd36074923ade7c9dea0e418 public void setResourcePack(@NotNull String url); /** -@@ -1419,6 +1421,62 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -1459,6 +1461,62 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM */ public void openBook(@NotNull ItemStack book); diff --git a/Spigot-API-Patches/0022-Use-ASM-for-event-executors.patch b/Spigot-API-Patches/0022-Use-ASM-for-event-executors.patch index 65e844a8e..5dd097c3b 100644 --- a/Spigot-API-Patches/0022-Use-ASM-for-event-executors.patch +++ b/Spigot-API-Patches/0022-Use-ASM-for-event-executors.patch @@ -6,11 +6,11 @@ Subject: [PATCH] Use ASM for event executors. Uses method handles for private or static methods. diff --git a/pom.xml b/pom.xml -index e8d9982bdbf9f66a54db16bf920e8106b81b034f..661d109f7c5b78587c68f32d47029c6d2fe7604d 100644 +index ae9179d4e3ea5608dfb9a5677de7c59c403450cc..a7064cc7810cd3567111a1594bd316663d516dca 100644 --- a/pom.xml +++ b/pom.xml @@ -128,6 +128,17 @@ - 8.0.1 + 8.0.1 test + @@ -412,7 +412,7 @@ index a850f0780de05463fc0d3f9e15ff7f19d88b2aed..9026e108ccd3a88aee1267ee275137be + // Paper end } diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -index 5cc37eeedab8437db82791dd95cef4e387c124b3..e72cbde4b3225cbf17d8a9b275e0ffcaa6d86c19 100644 +index c8497cb3021f584a885f4cb21c3be576ce0935a7..5be6460e8eb81381c7e305cb7ab6b77c0c7a8fe5 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java @@ -300,21 +300,7 @@ public final class JavaPluginLoader implements PluginLoader { diff --git a/Spigot-API-Patches/0025-Add-command-to-reload-permissions.yml-and-require-co.patch b/Spigot-API-Patches/0025-Add-command-to-reload-permissions.yml-and-require-co.patch index b7eafeabd..d23e579ff 100644 --- a/Spigot-API-Patches/0025-Add-command-to-reload-permissions.yml-and-require-co.patch +++ b/Spigot-API-Patches/0025-Add-command-to-reload-permissions.yml-and-require-co.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Add command to reload permissions.yml and require confirm to diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 39423f3a689a69de666537603e97d50244827f64..423fecf5411c05a55f22951437ff77af4bd29318 100644 +index 7b1978a258cbf74983dc2512092653ed4ff64e98..a0473d6b5339513f10749c0498b2ef5a0d710b14 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java -@@ -1574,6 +1574,13 @@ public final class Bukkit { +@@ -1606,6 +1606,13 @@ public final class Bukkit { public static org.bukkit.command.CommandMap getCommandMap() { return server.getCommandMap(); } @@ -24,10 +24,10 @@ index 39423f3a689a69de666537603e97d50244827f64..423fecf5411c05a55f22951437ff77af @NotNull diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index b09d010853a67db16787d9e764f1e2949cb33050..38d7da7378f9dc387ce9b52f1527db929901670e 100644 +index e3385abec44c603201aa37e3b3180cf88d378b52..a13c5014e0815d1de0bab184ea365bc6f97dcd8f 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java -@@ -1388,4 +1388,6 @@ public interface Server extends PluginMessageRecipient { +@@ -1416,4 +1416,6 @@ public interface Server extends PluginMessageRecipient { @NotNull Spigot spigot(); // Spigot end @@ -85,7 +85,7 @@ index 50cc311be7904cc8fc6070a21c8e4de3a489fd20..c62da4131b17e66892678e8b618fb9ba } } diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java -index 9a5fe8ca4ad9415055f3a71b62064d9e79b8e644..8ddaf9c2e63b382533d7f8929023c364ff3a8f9d 100644 +index d0fec44d2546290091649879450761ce08514fcb..8b33d914d29897c0276f9e2e7ce83bd2c316d5e2 100644 --- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java +++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java @@ -894,4 +894,13 @@ public final class SimplePluginManager implements PluginManager { diff --git a/Spigot-API-Patches/0038-Allow-Reloading-of-Command-Aliases.patch b/Spigot-API-Patches/0038-Allow-Reloading-of-Command-Aliases.patch index a5593ab83..840e64ab7 100644 --- a/Spigot-API-Patches/0038-Allow-Reloading-of-Command-Aliases.patch +++ b/Spigot-API-Patches/0038-Allow-Reloading-of-Command-Aliases.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Allow Reloading of Command Aliases Reload the aliases stored in commands.yml diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 423fecf5411c05a55f22951437ff77af4bd29318..0ec517701677a844c72b065e0ce453a0408102a5 100644 +index a0473d6b5339513f10749c0498b2ef5a0d710b14..6f2b67774a989ade2ec8acafd9f5288d51fb2102 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java -@@ -1581,6 +1581,15 @@ public final class Bukkit { +@@ -1613,6 +1613,15 @@ public final class Bukkit { public static void reloadPermissions() { server.reloadPermissions(); } @@ -26,10 +26,10 @@ index 423fecf5411c05a55f22951437ff77af4bd29318..0ec517701677a844c72b065e0ce453a0 @NotNull diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 38d7da7378f9dc387ce9b52f1527db929901670e..93bb91fad3a27632f2d6d02f1e08ddbca6152a43 100644 +index a13c5014e0815d1de0bab184ea365bc6f97dcd8f..339463eb75e3cb4a9d025892835d54b6ce76c478 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java -@@ -1390,4 +1390,6 @@ public interface Server extends PluginMessageRecipient { +@@ -1418,4 +1418,6 @@ public interface Server extends PluginMessageRecipient { // Spigot end void reloadPermissions(); // Paper diff --git a/Spigot-API-Patches/0041-Add-String-based-Action-Bar-API.patch b/Spigot-API-Patches/0041-Add-String-based-Action-Bar-API.patch index c4221d173..eaeaa26cd 100644 --- a/Spigot-API-Patches/0041-Add-String-based-Action-Bar-API.patch +++ b/Spigot-API-Patches/0041-Add-String-based-Action-Bar-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add String based Action Bar API diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 9e62987cbd36074923ade7c9dea0e418cfb9c2bc..6f3ab730b3196ae0cb4b3c2fb8976dcefafc1d4d 100644 +index bc9ff9b4a475d8b108b54f2d4a99199379b1c63d..3166d4809f12e55f53670a84e69f420ee3ee792b 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -443,6 +443,26 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -483,6 +483,26 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM public void sendMap(@NotNull MapView map); // Paper start @@ -35,7 +35,7 @@ index 9e62987cbd36074923ade7c9dea0e418cfb9c2bc..6f3ab730b3196ae0cb4b3c2fb8976dce /** * Sends the component to the player * -@@ -466,9 +486,11 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -506,9 +526,11 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM /** * Sends an array of components as a single message to the specified screen position of this player * @@ -47,7 +47,7 @@ index 9e62987cbd36074923ade7c9dea0e418cfb9c2bc..6f3ab730b3196ae0cb4b3c2fb8976dce public default void sendMessage(net.md_5.bungee.api.ChatMessageType position, net.md_5.bungee.api.chat.BaseComponent... components) { spigot().sendMessage(position, components); } -@@ -1544,9 +1566,11 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -1584,9 +1606,11 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM /** * Sends the component to the specified screen position of this player * @@ -59,7 +59,7 @@ index 9e62987cbd36074923ade7c9dea0e418cfb9c2bc..6f3ab730b3196ae0cb4b3c2fb8976dce public void sendMessage(@NotNull net.md_5.bungee.api.ChatMessageType position, @NotNull net.md_5.bungee.api.chat.BaseComponent component) { throw new UnsupportedOperationException("Not supported yet."); } -@@ -1554,9 +1578,11 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -1594,9 +1618,11 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM /** * Sends an array of components as a single message to the specified screen position of this player * diff --git a/Spigot-API-Patches/0044-Fireworks-API-s.patch b/Spigot-API-Patches/0044-Fireworks-API-s.patch index c2de448c1..a0ed753ac 100644 --- a/Spigot-API-Patches/0044-Fireworks-API-s.patch +++ b/Spigot-API-Patches/0044-Fireworks-API-s.patch @@ -7,32 +7,22 @@ Get the Entity being boosted Get the firework launcher diff --git a/src/main/java/org/bukkit/entity/Firework.java b/src/main/java/org/bukkit/entity/Firework.java -index f844d5aa983f1d4718c9f22da80b0eed113547b1..e8c04c1383ec6dd53f30727db4e910ca17fbae5d 100644 +index 05e86cb9d826cdf14490fa649348d46c51adbfdb..d616d5941b3c7b85e350e845901da798601b9a3c 100644 --- a/src/main/java/org/bukkit/entity/Firework.java +++ b/src/main/java/org/bukkit/entity/Firework.java -@@ -3,6 +3,9 @@ package org.bukkit.entity; - import org.bukkit.inventory.meta.FireworkMeta; - import org.jetbrains.annotations.NotNull; - -+import java.util.UUID; -+import org.jetbrains.annotations.Nullable; -+ - public interface Firework extends Entity { - - /** -@@ -43,4 +46,15 @@ public interface Firework extends Entity { +@@ -43,4 +43,15 @@ public interface Firework extends Projectile { * @param shotAtAngle the new shotAtAngle */ void setShotAtAngle(boolean shotAtAngle); + + // Paper start -+ @Nullable -+ public UUID getSpawningEntity(); ++ @org.jetbrains.annotations.Nullable ++ public java.util.UUID getSpawningEntity(); + /** + * If this firework is boosting an entity, return it + * @return The entity being boosted + */ -+ @Nullable ++ @org.jetbrains.annotations.Nullable + public LivingEntity getBoostedEntity(); + // Paper end } diff --git a/Spigot-API-Patches/0046-Provide-E-TE-Chunk-count-stat-methods.patch b/Spigot-API-Patches/0046-Provide-E-TE-Chunk-count-stat-methods.patch index a522f45e4..ca1b41a18 100644 --- a/Spigot-API-Patches/0046-Provide-E-TE-Chunk-count-stat-methods.patch +++ b/Spigot-API-Patches/0046-Provide-E-TE-Chunk-count-stat-methods.patch @@ -7,7 +7,7 @@ Provides counts without the ineffeciency of using .getEntities().size() which creates copy of the collections. diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index cd8a09576a99f03f5ef9926d55fa3a1193ba0da6..808c3b4a4f494e05542f29324db655ee6166021e 100644 +index c79e083a97b849f9cdd3f9646c4f2892976b2a55..480386b2405953c3a06958a9728b38371d75662b 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -40,6 +40,33 @@ import org.jetbrains.annotations.Nullable; diff --git a/Spigot-API-Patches/0049-Add-configuration-option-to-prevent-player-names-fro.patch b/Spigot-API-Patches/0049-Add-configuration-option-to-prevent-player-names-fro.patch index b0c301af1..302fc8516 100644 --- a/Spigot-API-Patches/0049-Add-configuration-option-to-prevent-player-names-fro.patch +++ b/Spigot-API-Patches/0049-Add-configuration-option-to-prevent-player-names-fro.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Add configuration option to prevent player names from being diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 0ec517701677a844c72b065e0ce453a0408102a5..ded9df9a31fb9ac847a60b4eba182ac487252aca 100644 +index 6f2b67774a989ade2ec8acafd9f5288d51fb2102..c5b6e5fa0cfd876733b2010494ad7bbeafc789f8 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java -@@ -1590,6 +1590,16 @@ public final class Bukkit { +@@ -1622,6 +1622,16 @@ public final class Bukkit { public static boolean reloadCommandAliases() { return server.reloadCommandAliases(); } @@ -27,10 +27,10 @@ index 0ec517701677a844c72b065e0ce453a0408102a5..ded9df9a31fb9ac847a60b4eba182ac4 @NotNull diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 93bb91fad3a27632f2d6d02f1e08ddbca6152a43..112098f9bab1b091538d74f558113830c8cdce90 100644 +index 339463eb75e3cb4a9d025892835d54b6ce76c478..457007005f9ff5f6818c559635379a2e698fc4d7 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java -@@ -1392,4 +1392,14 @@ public interface Server extends PluginMessageRecipient { +@@ -1420,4 +1420,14 @@ public interface Server extends PluginMessageRecipient { void reloadPermissions(); // Paper boolean reloadCommandAliases(); // Paper diff --git a/Spigot-API-Patches/0050-Fix-upstream-javadoc-warnings-and-errors.patch b/Spigot-API-Patches/0050-Fix-upstream-javadoc-warnings-and-errors.patch index 7cb9a9960..f6e7304b3 100644 --- a/Spigot-API-Patches/0050-Fix-upstream-javadoc-warnings-and-errors.patch +++ b/Spigot-API-Patches/0050-Fix-upstream-javadoc-warnings-and-errors.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Fix upstream javadoc warnings and errors Upstream still refuses to use Java 8 with the API so they are likely unaware these are even issues. diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 808c3b4a4f494e05542f29324db655ee6166021e..3b027f67c1763ee0a4f7b02490d3cee1c3eff369 100644 +index 480386b2405953c3a06958a9728b38371d75662b..55d114e3a17ea623ecc0d9fa87b14c3ffc65e6be 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java -@@ -2009,6 +2009,7 @@ public interface World extends PluginMessageRecipient, Metadatable { +@@ -2077,6 +2077,7 @@ public interface World extends PluginMessageRecipient, Metadatable { * @param count the number of particles * @param data the data to use for the particle or null, * the type of this depends on {@link Particle#getDataType()} @@ -17,7 +17,7 @@ index 808c3b4a4f494e05542f29324db655ee6166021e..3b027f67c1763ee0a4f7b02490d3cee1 */ public void spawnParticle(@NotNull Particle particle, @NotNull Location location, int count, @Nullable T data); -@@ -2025,6 +2026,7 @@ public interface World extends PluginMessageRecipient, Metadatable { +@@ -2093,6 +2094,7 @@ public interface World extends PluginMessageRecipient, Metadatable { * @param count the number of particles * @param data the data to use for the particle or null, * the type of this depends on {@link Particle#getDataType()} @@ -25,7 +25,7 @@ index 808c3b4a4f494e05542f29324db655ee6166021e..3b027f67c1763ee0a4f7b02490d3cee1 */ public void spawnParticle(@NotNull Particle particle, double x, double y, double z, int count, @Nullable T data); -@@ -2075,6 +2077,7 @@ public interface World extends PluginMessageRecipient, Metadatable { +@@ -2143,6 +2145,7 @@ public interface World extends PluginMessageRecipient, Metadatable { * @param offsetZ the maximum random offset on the Z axis * @param data the data to use for the particle or null, * the type of this depends on {@link Particle#getDataType()} @@ -33,7 +33,7 @@ index 808c3b4a4f494e05542f29324db655ee6166021e..3b027f67c1763ee0a4f7b02490d3cee1 */ public void spawnParticle(@NotNull Particle particle, @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ, @Nullable T data); -@@ -2095,6 +2098,7 @@ public interface World extends PluginMessageRecipient, Metadatable { +@@ -2163,6 +2166,7 @@ public interface World extends PluginMessageRecipient, Metadatable { * @param offsetZ the maximum random offset on the Z axis * @param data the data to use for the particle or null, * the type of this depends on {@link Particle#getDataType()} @@ -41,7 +41,7 @@ index 808c3b4a4f494e05542f29324db655ee6166021e..3b027f67c1763ee0a4f7b02490d3cee1 */ public void spawnParticle(@NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, @Nullable T data); -@@ -2151,6 +2155,7 @@ public interface World extends PluginMessageRecipient, Metadatable { +@@ -2219,6 +2223,7 @@ public interface World extends PluginMessageRecipient, Metadatable { * particle used (normally speed) * @param data the data to use for the particle or null, * the type of this depends on {@link Particle#getDataType()} @@ -49,7 +49,7 @@ index 808c3b4a4f494e05542f29324db655ee6166021e..3b027f67c1763ee0a4f7b02490d3cee1 */ public void spawnParticle(@NotNull Particle particle, @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data); -@@ -2173,6 +2178,7 @@ public interface World extends PluginMessageRecipient, Metadatable { +@@ -2241,6 +2246,7 @@ public interface World extends PluginMessageRecipient, Metadatable { * particle used (normally speed) * @param data the data to use for the particle or null, * the type of this depends on {@link Particle#getDataType()} @@ -57,7 +57,7 @@ index 808c3b4a4f494e05542f29324db655ee6166021e..3b027f67c1763ee0a4f7b02490d3cee1 */ public void spawnParticle(@NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data); -@@ -2196,6 +2202,7 @@ public interface World extends PluginMessageRecipient, Metadatable { +@@ -2264,6 +2270,7 @@ public interface World extends PluginMessageRecipient, Metadatable { * @param force whether to send the particle to players within an extended * range and encourage their client to render it regardless of * settings @@ -65,7 +65,7 @@ index 808c3b4a4f494e05542f29324db655ee6166021e..3b027f67c1763ee0a4f7b02490d3cee1 */ public void spawnParticle(@NotNull Particle particle, @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data, boolean force); -@@ -2221,6 +2228,7 @@ public interface World extends PluginMessageRecipient, Metadatable { +@@ -2289,6 +2296,7 @@ public interface World extends PluginMessageRecipient, Metadatable { * @param force whether to send the particle to players within an extended * range and encourage their client to render it regardless of * settings @@ -86,10 +86,10 @@ index c2096b5344d48d855d031538ec32e0154bd9054d..bca9d3659f6fceeca4b7fecbc7034d6f void setParticle(@NotNull Particle particle, @Nullable T data); diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 6f3ab730b3196ae0cb4b3c2fb8976dcefafc1d4d..cb7d9f055193618c8a7e80796c2ba52651baca55 100644 +index 3166d4809f12e55f53670a84e69f420ee3ee792b..4f419c7b07d771019ab2906d609772cc0f080b23 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -458,7 +458,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -498,7 +498,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * * Use supplied alternative character to the section symbol to represent legacy color codes. * @@ -98,7 +98,7 @@ index 6f3ab730b3196ae0cb4b3c2fb8976dcefafc1d4d..cb7d9f055193618c8a7e80796c2ba526 * @param message The message to send */ public void sendActionBar(char alternateChar, @NotNull String message); -@@ -525,6 +525,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -565,6 +565,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM /** * Update the subtitle of titles displayed to the player * @@ -106,7 +106,7 @@ index 6f3ab730b3196ae0cb4b3c2fb8976dcefafc1d4d..cb7d9f055193618c8a7e80796c2ba526 * @deprecated Use {@link #updateTitle(Title)} */ @Deprecated -@@ -533,6 +534,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -573,6 +574,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM /** * Update the subtitle of titles displayed to the player * @@ -114,7 +114,7 @@ index 6f3ab730b3196ae0cb4b3c2fb8976dcefafc1d4d..cb7d9f055193618c8a7e80796c2ba526 * @deprecated Use {@link #updateTitle(Title)} */ @Deprecated -@@ -541,6 +543,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -581,6 +583,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM /** * Show the given title to the player, along with the last subtitle set, using the last set times * @@ -122,7 +122,7 @@ index 6f3ab730b3196ae0cb4b3c2fb8976dcefafc1d4d..cb7d9f055193618c8a7e80796c2ba526 * @deprecated Use {@link #sendTitle(Title)} or {@link #updateTitle(Title)} */ @Deprecated -@@ -549,6 +552,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -589,6 +592,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM /** * Show the given title to the player, along with the last subtitle set, using the last set times * @@ -130,7 +130,7 @@ index 6f3ab730b3196ae0cb4b3c2fb8976dcefafc1d4d..cb7d9f055193618c8a7e80796c2ba526 * @deprecated Use {@link #sendTitle(Title)} or {@link #updateTitle(Title)} */ @Deprecated -@@ -1198,6 +1202,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -1238,6 +1242,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * @param count the number of particles * @param data the data to use for the particle or null, * the type of this depends on {@link Particle#getDataType()} @@ -138,7 +138,7 @@ index 6f3ab730b3196ae0cb4b3c2fb8976dcefafc1d4d..cb7d9f055193618c8a7e80796c2ba526 */ public void spawnParticle(@NotNull Particle particle, @NotNull Location location, int count, @Nullable T data); -@@ -1214,6 +1219,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -1254,6 +1259,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * @param count the number of particles * @param data the data to use for the particle or null, * the type of this depends on {@link Particle#getDataType()} @@ -146,7 +146,7 @@ index 6f3ab730b3196ae0cb4b3c2fb8976dcefafc1d4d..cb7d9f055193618c8a7e80796c2ba526 */ public void spawnParticle(@NotNull Particle particle, double x, double y, double z, int count, @Nullable T data); -@@ -1264,6 +1270,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -1304,6 +1310,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * @param offsetZ the maximum random offset on the Z axis * @param data the data to use for the particle or null, * the type of this depends on {@link Particle#getDataType()} @@ -154,7 +154,7 @@ index 6f3ab730b3196ae0cb4b3c2fb8976dcefafc1d4d..cb7d9f055193618c8a7e80796c2ba526 */ public void spawnParticle(@NotNull Particle particle, @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ, @Nullable T data); -@@ -1284,6 +1291,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -1324,6 +1331,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * @param offsetZ the maximum random offset on the Z axis * @param data the data to use for the particle or null, * the type of this depends on {@link Particle#getDataType()} @@ -162,7 +162,7 @@ index 6f3ab730b3196ae0cb4b3c2fb8976dcefafc1d4d..cb7d9f055193618c8a7e80796c2ba526 */ public void spawnParticle(@NotNull Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, @Nullable T data); -@@ -1340,6 +1348,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -1380,6 +1388,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * particle used (normally speed) * @param data the data to use for the particle or null, * the type of this depends on {@link Particle#getDataType()} @@ -170,7 +170,7 @@ index 6f3ab730b3196ae0cb4b3c2fb8976dcefafc1d4d..cb7d9f055193618c8a7e80796c2ba526 */ public void spawnParticle(@NotNull Particle particle, @NotNull Location location, int count, double offsetX, double offsetY, double offsetZ, double extra, @Nullable T data); -@@ -1362,6 +1371,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -1402,6 +1411,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * particle used (normally speed) * @param data the data to use for the particle or null, * the type of this depends on {@link Particle#getDataType()} diff --git a/Spigot-API-Patches/0051-Item-canEntityPickup.patch b/Spigot-API-Patches/0051-Item-canEntityPickup.patch index 2b3d47cfb..0f5325a00 100644 --- a/Spigot-API-Patches/0051-Item-canEntityPickup.patch +++ b/Spigot-API-Patches/0051-Item-canEntityPickup.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Item#canEntityPickup diff --git a/src/main/java/org/bukkit/entity/Item.java b/src/main/java/org/bukkit/entity/Item.java -index 00c58c1d94b4822e7e26029cab23cf1964613db5..cb9e9f369e041cd9e5835cac7909db482295083c 100644 +index 4f0caf5a7084f2be1ce1a4b49318e78597b45846..ae3880491682067d4c5baef0a8c90b1036d67ac0 100644 --- a/src/main/java/org/bukkit/entity/Item.java +++ b/src/main/java/org/bukkit/entity/Item.java -@@ -37,4 +37,20 @@ public interface Item extends Entity { +@@ -36,4 +36,20 @@ public interface Item extends Entity { * @param delay New delay */ public void setPickupDelay(int delay); diff --git a/Spigot-API-Patches/0055-Basic-PlayerProfile-API.patch b/Spigot-API-Patches/0055-Basic-PlayerProfile-API.patch index e6b95f463..bc1cd82b9 100644 --- a/Spigot-API-Patches/0055-Basic-PlayerProfile-API.patch +++ b/Spigot-API-Patches/0055-Basic-PlayerProfile-API.patch @@ -267,10 +267,10 @@ index 0000000000000000000000000000000000000000..7b3b6ef533d32169fbeca389bd61cfc6 + } +} diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index ded9df9a31fb9ac847a60b4eba182ac487252aca..5d4fb5b9d55bfbe6bc9a9082b5cb85aa9ee86de2 100644 +index c5b6e5fa0cfd876733b2010494ad7bbeafc789f8..d27405a8cfa590c13f5a3976c74c05655ae1f93d 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java -@@ -1600,6 +1600,40 @@ public final class Bukkit { +@@ -1632,6 +1632,40 @@ public final class Bukkit { public static boolean suggestPlayerNamesWhenNullTabCompletions() { return server.suggestPlayerNamesWhenNullTabCompletions(); } @@ -312,10 +312,10 @@ index ded9df9a31fb9ac847a60b4eba182ac487252aca..5d4fb5b9d55bfbe6bc9a9082b5cb85aa @NotNull diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 112098f9bab1b091538d74f558113830c8cdce90..6778ac8e5a16eb20574732acb0cc0038ec286467 100644 +index 457007005f9ff5f6818c559635379a2e698fc4d7..24922e5699241e29bc615dcffadce21c89f6ff35 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java -@@ -1401,5 +1401,33 @@ public interface Server extends PluginMessageRecipient { +@@ -1429,5 +1429,33 @@ public interface Server extends PluginMessageRecipient { * @return true if player names should be suggested */ boolean suggestPlayerNamesWhenNullTabCompletions(); diff --git a/Spigot-API-Patches/0056-Shoulder-Entities-Release-API.patch b/Spigot-API-Patches/0056-Shoulder-Entities-Release-API.patch index 859798a0b..84254db36 100644 --- a/Spigot-API-Patches/0056-Shoulder-Entities-Release-API.patch +++ b/Spigot-API-Patches/0056-Shoulder-Entities-Release-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Shoulder Entities Release API diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java -index a7f08bb1c0778d99f06abfd15bb4a1a8bef6d502..3adff676c85a6648fc85a088e12ea524f4567b12 100644 +index abe3d91428c4a5f7e3c6fec51faf973b76896dc3..babda8f047ab134223651ddcc8e4eb8d6682a031 100644 --- a/src/main/java/org/bukkit/entity/HumanEntity.java +++ b/src/main/java/org/bukkit/entity/HumanEntity.java -@@ -324,6 +324,26 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder +@@ -300,6 +300,26 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder */ public int getExpToLevel(); diff --git a/Spigot-API-Patches/0058-Entity-fromMobSpawner.patch b/Spigot-API-Patches/0058-Entity-fromMobSpawner.patch index 5ad75ae83..6632b4b8b 100644 --- a/Spigot-API-Patches/0058-Entity-fromMobSpawner.patch +++ b/Spigot-API-Patches/0058-Entity-fromMobSpawner.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Entity#fromMobSpawner() diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java -index 4e4445d186303c06906fea68a867cc7985c69ba2..e2952209d5e98ad507628bed4fbefc3aede6045f 100644 +index d2fa3628a3825b2226292bf6974866557abf799e..15e9ecd898b27d87a2d4f05c5b22de7c1b9a260c 100644 --- a/src/main/java/org/bukkit/entity/Entity.java +++ b/src/main/java/org/bukkit/entity/Entity.java -@@ -609,5 +609,12 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent +@@ -610,5 +610,12 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent */ @Nullable Location getOrigin(); diff --git a/Spigot-API-Patches/0063-Make-plugins-list-alphabetical.patch b/Spigot-API-Patches/0063-Make-plugins-list-alphabetical.patch index 0451f10f2..2b36db8e4 100644 --- a/Spigot-API-Patches/0063-Make-plugins-list-alphabetical.patch +++ b/Spigot-API-Patches/0063-Make-plugins-list-alphabetical.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Make /plugins list alphabetical diff --git a/src/main/java/org/bukkit/command/defaults/PluginsCommand.java b/src/main/java/org/bukkit/command/defaults/PluginsCommand.java -index bcb576a4271b1ec7b1cfe6f83cf161b7d89ed2e5..a1071e3178a298f3fc1d6c960f4d8a6d3a3d0277 100644 +index e8a7f435fb30da3506b2b4fa8c5675c829edc105..4a75997f93f5c33f19200994562aaff99bdd422f 100644 --- a/src/main/java/org/bukkit/command/defaults/PluginsCommand.java +++ b/src/main/java/org/bukkit/command/defaults/PluginsCommand.java @@ -3,6 +3,9 @@ package org.bukkit.command.defaults; @@ -18,7 +18,7 @@ index bcb576a4271b1ec7b1cfe6f83cf161b7d89ed2e5..a1071e3178a298f3fc1d6c960f4d8a6d import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; -@@ -34,23 +37,32 @@ public class PluginsCommand extends BukkitCommand { +@@ -49,24 +52,33 @@ public class PluginsCommand extends BukkitCommand { @NotNull private String getPluginList() { @@ -26,12 +26,12 @@ index bcb576a4271b1ec7b1cfe6f83cf161b7d89ed2e5..a1071e3178a298f3fc1d6c960f4d8a6d - Plugin[] plugins = Bukkit.getPluginManager().getPlugins(); + // Paper start + TreeMap plugins = new TreeMap<>(String.CASE_INSENSITIVE_ORDER); -+ + +- for (Plugin plugin : plugins) { + for (Plugin plugin : Bukkit.getPluginManager().getPlugins()) { + plugins.put(plugin.getDescription().getName(), plugin); + } - -- for (Plugin plugin : plugins) { ++ + StringBuilder pluginList = new StringBuilder(); + for (Map.Entry entry : plugins.entrySet()) { if (pluginList.length() > 0) { @@ -56,4 +56,5 @@ index bcb576a4271b1ec7b1cfe6f83cf161b7d89ed2e5..a1071e3178a298f3fc1d6c960f4d8a6d + return "(" + plugins.size() + "): " + pluginList.toString(); + // Paper end } - } + + // Spigot start diff --git a/Spigot-API-Patches/0064-LivingEntity-setKiller.patch b/Spigot-API-Patches/0064-LivingEntity-setKiller.patch index 12e8f6c34..f95331f27 100644 --- a/Spigot-API-Patches/0064-LivingEntity-setKiller.patch +++ b/Spigot-API-Patches/0064-LivingEntity-setKiller.patch @@ -5,10 +5,10 @@ Subject: [PATCH] LivingEntity#setKiller diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 52541e496bd85e041a96fd5858acbb9bddbb8196..ae712e76d961137a35b70dd3f3fbb33dddf37f0a 100644 +index 5b0c95ab7372c7accd190b9052b587637106c4af..f0018823e17fab49e0167ece1c8c9eda2d562b87 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -250,6 +250,15 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource +@@ -251,6 +251,15 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource @Nullable public Player getKiller(); diff --git a/Spigot-API-Patches/0066-Allow-plugins-to-use-SLF4J-for-logging.patch b/Spigot-API-Patches/0066-Allow-plugins-to-use-SLF4J-for-logging.patch index 82911ecbf..e56e87d0d 100644 --- a/Spigot-API-Patches/0066-Allow-plugins-to-use-SLF4J-for-logging.patch +++ b/Spigot-API-Patches/0066-Allow-plugins-to-use-SLF4J-for-logging.patch @@ -14,11 +14,11 @@ it without having to shade it in the plugin and going through several layers of logging abstraction. diff --git a/pom.xml b/pom.xml -index 661d109f7c5b78587c68f32d47029c6d2fe7604d..20c473f521e50df57065d3644398f9db777c1a24 100644 +index a7064cc7810cd3567111a1594bd316663d516dca..dfc7c2f351c895a7378b13f88ca8efcaaf38d478 100644 --- a/pom.xml +++ b/pom.xml @@ -109,6 +109,13 @@ - 18.0.0 + 19.0.0 provided + diff --git a/Spigot-API-Patches/0069-Expose-client-protocol-version-and-virtual-host.patch b/Spigot-API-Patches/0069-Expose-client-protocol-version-and-virtual-host.patch index ee3fbafd4..a1ffa9d59 100644 --- a/Spigot-API-Patches/0069-Expose-client-protocol-version-and-virtual-host.patch +++ b/Spigot-API-Patches/0069-Expose-client-protocol-version-and-virtual-host.patch @@ -57,7 +57,7 @@ index 0000000000000000000000000000000000000000..7b2af1bd72dfbcf4e962a982940fc49b + +} diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index cb7d9f055193618c8a7e80796c2ba52651baca55..9398f303f191c57ee3e2bd33f205a881be6543f4 100644 +index 4f419c7b07d771019ab2906d609772cc0f080b23..2079395c29854ec7e751d210a05f329f31ebb8ad 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -30,7 +30,7 @@ import org.jetbrains.annotations.Nullable; diff --git a/Spigot-API-Patches/0071-API-to-get-a-BlockState-without-a-snapshot.patch b/Spigot-API-Patches/0071-API-to-get-a-BlockState-without-a-snapshot.patch index 3fe23df9f..0f95b2be8 100644 --- a/Spigot-API-Patches/0071-API-to-get-a-BlockState-without-a-snapshot.patch +++ b/Spigot-API-Patches/0071-API-to-get-a-BlockState-without-a-snapshot.patch @@ -9,7 +9,7 @@ on the real tile entity. This is useful for where performance is needed diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java -index 8a48572e92e311de8c799ae608c5bee681ac91a5..8154093df6f6d4180485cecf98da3af26219eab8 100644 +index 2ff77abef2b25c839ddd524aa29afbc4e49d0c31..633733d7c914cf6ae988f727d644c8f2be408b02 100644 --- a/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java @@ -269,6 +269,16 @@ public interface Block extends Metadatable { diff --git a/Spigot-API-Patches/0076-Ability-to-apply-mending-to-XP-API.patch b/Spigot-API-Patches/0076-Ability-to-apply-mending-to-XP-API.patch index ba17eaf22..695aae29f 100644 --- a/Spigot-API-Patches/0076-Ability-to-apply-mending-to-XP-API.patch +++ b/Spigot-API-Patches/0076-Ability-to-apply-mending-to-XP-API.patch @@ -10,10 +10,10 @@ of giving the player experience points. Both an API To standalone mend, and apply mending logic to .giveExp has been added. diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 9398f303f191c57ee3e2bd33f205a881be6543f4..8a67375dedf9ef91216a431d87e1e6a90c6787d8 100644 +index 2079395c29854ec7e751d210a05f329f31ebb8ad..444a495e53d1be036f7a1bda89bedf438be913c1 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -690,12 +690,33 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -730,12 +730,33 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM */ public void resetPlayerWeather(); diff --git a/Spigot-API-Patches/0085-Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch b/Spigot-API-Patches/0085-Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch index 4db167a05..2bbaa66d1 100644 --- a/Spigot-API-Patches/0085-Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch +++ b/Spigot-API-Patches/0085-Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Ability to change PlayerProfile in AsyncPreLoginEvent This will allow you to change the players name or skin on login. diff --git a/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java b/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java -index c8384da69af61e1970f254a3a9c206ee81d7a989..10292e59257d1c33cf4800d38bc24f6b35f75de1 100644 +index c8384da69af61e1970f254a3a9c206ee81d7a989..16352c7dab042c5042020a06208270200f576c02 100644 --- a/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java +++ b/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java @@ -2,6 +2,9 @@ package org.bukkit.event.player; diff --git a/Spigot-API-Patches/0087-Player.setPlayerProfile-API.patch b/Spigot-API-Patches/0087-Player.setPlayerProfile-API.patch index ba0f7d54f..c6118576d 100644 --- a/Spigot-API-Patches/0087-Player.setPlayerProfile-API.patch +++ b/Spigot-API-Patches/0087-Player.setPlayerProfile-API.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Player.setPlayerProfile API This can be useful for changing name or skins after a player has logged in. diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 8a67375dedf9ef91216a431d87e1e6a90c6787d8..8fe402336c2fe8d3f4d803f73b24d4848cdb3c69 100644 +index 444a495e53d1be036f7a1bda89bedf438be913c1..505078ce7fa5fce981d26d07e61fc1e12fbed67a 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -2,6 +2,7 @@ package org.bukkit.entity; @@ -17,7 +17,7 @@ index 8a67375dedf9ef91216a431d87e1e6a90c6787d8..8fe402336c2fe8d3f4d803f73b24d484 import org.bukkit.DyeColor; import org.bukkit.Effect; import org.bukkit.GameMode; -@@ -1528,6 +1529,20 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -1568,6 +1569,20 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * was {@link org.bukkit.event.player.PlayerResourcePackStatusEvent.Status#SUCCESSFULLY_LOADED} */ boolean hasResourcePack(); diff --git a/Spigot-API-Patches/0088-getPlayerUniqueId-API.patch b/Spigot-API-Patches/0088-getPlayerUniqueId-API.patch index e70a1220e..da536f8e8 100644 --- a/Spigot-API-Patches/0088-getPlayerUniqueId-API.patch +++ b/Spigot-API-Patches/0088-getPlayerUniqueId-API.patch @@ -9,10 +9,10 @@ In Offline Mode, will return an Offline UUID This is a more performant way to obtain a UUID for a name than loading an OfflinePlayer diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 5d4fb5b9d55bfbe6bc9a9082b5cb85aa9ee86de2..f5fac807cce22819cba5878a6e2664f0f82f1ae3 100644 +index d27405a8cfa590c13f5a3976c74c05655ae1f93d..4b6b1bce3a728d74f8b791efd2d981e907e202bc 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java -@@ -467,6 +467,20 @@ public final class Bukkit { +@@ -489,6 +489,20 @@ public final class Bukkit { return server.getPlayer(id); } @@ -34,10 +34,10 @@ index 5d4fb5b9d55bfbe6bc9a9082b5cb85aa9ee86de2..f5fac807cce22819cba5878a6e2664f0 * Gets the plugin manager for interfacing with plugins. * diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 6778ac8e5a16eb20574732acb0cc0038ec286467..11fffc514ed1f0b00b09c0cdb5272ea79340972c 100644 +index 24922e5699241e29bc615dcffadce21c89f6ff35..a2420771ca49acc08826ca60fcda7495c80cf1d5 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java -@@ -396,6 +396,18 @@ public interface Server extends PluginMessageRecipient { +@@ -416,6 +416,18 @@ public interface Server extends PluginMessageRecipient { @Nullable public Player getPlayer(@NotNull UUID id); diff --git a/Spigot-API-Patches/0090-Add-method-to-open-already-placed-sign.patch b/Spigot-API-Patches/0090-Add-method-to-open-already-placed-sign.patch index 094aa9960..0af409cf2 100644 --- a/Spigot-API-Patches/0090-Add-method-to-open-already-placed-sign.patch +++ b/Spigot-API-Patches/0090-Add-method-to-open-already-placed-sign.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add method to open already placed sign diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java -index 3adff676c85a6648fc85a088e12ea524f4567b12..2d413d720c828c7f334abde7eb02935317e2fd17 100644 +index babda8f047ab134223651ddcc8e4eb8d6682a031..dd7b08f985d8ac41fdce8241a3cd2c84c1555ab3 100644 --- a/src/main/java/org/bukkit/entity/HumanEntity.java +++ b/src/main/java/org/bukkit/entity/HumanEntity.java -@@ -468,4 +468,13 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder +@@ -461,4 +461,13 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder */ @Deprecated public void setShoulderEntityRight(@Nullable Entity entity); diff --git a/Spigot-API-Patches/0091-Add-Ban-Methods-to-Player-Objects.patch b/Spigot-API-Patches/0091-Add-Ban-Methods-to-Player-Objects.patch index eaf7e30eb..b848fef9a 100644 --- a/Spigot-API-Patches/0091-Add-Ban-Methods-to-Player-Objects.patch +++ b/Spigot-API-Patches/0091-Add-Ban-Methods-to-Player-Objects.patch @@ -74,7 +74,7 @@ index 58313929f81509030216a0e5e3869da63e11108e..6cf05fed701c67a2c797a4e0839c7958 /** * Checks if this player is whitelisted or not diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 8fe402336c2fe8d3f4d803f73b24d4848cdb3c69..c37d7fca014fb0f325574a33ef4ccba67db7fe49 100644 +index 505078ce7fa5fce981d26d07e61fc1e12fbed67a..2441b714d343b963c43c9f8827550e683be4a93d 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -3,6 +3,10 @@ package org.bukkit.entity; @@ -88,7 +88,7 @@ index 8fe402336c2fe8d3f4d803f73b24d4848cdb3c69..c37d7fca014fb0f325574a33ef4ccba6 import org.bukkit.DyeColor; import org.bukkit.Effect; import org.bukkit.GameMode; -@@ -444,6 +448,162 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -484,6 +488,162 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM public void sendMap(@NotNull MapView map); // Paper start diff --git a/Spigot-API-Patches/0094-Additional-world.getNearbyEntities-API-s.patch b/Spigot-API-Patches/0094-Additional-world.getNearbyEntities-API-s.patch index 8f2e86051..ef34a0f2a 100644 --- a/Spigot-API-Patches/0094-Additional-world.getNearbyEntities-API-s.patch +++ b/Spigot-API-Patches/0094-Additional-world.getNearbyEntities-API-s.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Additional world.getNearbyEntities API's Provides more methods to get nearby entities, and filter by types and predicates diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 3b027f67c1763ee0a4f7b02490d3cee1c3eff369..fbe7e76c0f3122dd47c7ca4562b5ac3577a71ffc 100644 +index 55d114e3a17ea623ecc0d9fa87b14c3ffc65e6be..c422cfa1b599bc4c158dea178e5677c4b4545d99 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -1,6 +1,9 @@ @@ -277,7 +277,7 @@ index 3b027f67c1763ee0a4f7b02490d3cee1c3eff369..fbe7e76c0f3122dd47c7ca4562b5ac35 * Get a list of all players in this World * diff --git a/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java b/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java -index 6c09ea6c61bdeb6149c8f2f23f15b2abb543e66e..76c4a1a6e0c0e72b0f3f75d06f179c07f863e143 100644 +index 16352c7dab042c5042020a06208270200f576c02..e5b811229830e4d55b08ab18bedec1494ff342ac 100644 --- a/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java +++ b/src/main/java/org/bukkit/event/player/AsyncPlayerPreLoginEvent.java @@ -42,8 +42,7 @@ public class AsyncPlayerPreLoginEvent extends Event { diff --git a/Spigot-API-Patches/0096-Expand-World.spawnParticle-API-and-add-Builder.patch b/Spigot-API-Patches/0096-Expand-World.spawnParticle-API-and-add-Builder.patch index 27f7e480f..6083ef390 100644 --- a/Spigot-API-Patches/0096-Expand-World.spawnParticle-API-and-add-Builder.patch +++ b/Spigot-API-Patches/0096-Expand-World.spawnParticle-API-and-add-Builder.patch @@ -493,10 +493,10 @@ index 0000000000000000000000000000000000000000..06f1602f5b327705f726d0a99dd6b95e + } +} diff --git a/src/main/java/org/bukkit/Particle.java b/src/main/java/org/bukkit/Particle.java -index 49467ac70a5ff6e31a8c5c3ec92de3c65fee2284..d2ceb07c727ab898e4ef1b502f9544817ce3bda6 100644 +index b32de827cf8d1780861c271b4215276fdaab7165..1020002ff7127877db2d7e096f2c521751bf13a7 100644 --- a/src/main/java/org/bukkit/Particle.java +++ b/src/main/java/org/bukkit/Particle.java -@@ -96,6 +96,17 @@ public enum Particle { +@@ -106,6 +106,17 @@ public enum Particle { return dataType; } @@ -515,10 +515,10 @@ index 49467ac70a5ff6e31a8c5c3ec92de3c65fee2284..d2ceb07c727ab898e4ef1b502f954481 * Options which can be applied to redstone dust particles - a particle * color and size. diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index fbe7e76c0f3122dd47c7ca4562b5ac3577a71ffc..085c7a42c3e758770d5883e3cddf896ac6b7645b 100644 +index c422cfa1b599bc4c158dea178e5677c4b4545d99..6e311dd8f1105c28be7259855e0b19ae182badfd 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java -@@ -2433,7 +2433,57 @@ public interface World extends PluginMessageRecipient, Metadatable { +@@ -2501,7 +2501,57 @@ public interface World extends PluginMessageRecipient, Metadatable { * the type of this depends on {@link Particle#getDataType()} * @param Type */ diff --git a/Spigot-API-Patches/0098-Close-Plugin-Class-Loaders-on-Disable.patch b/Spigot-API-Patches/0098-Close-Plugin-Class-Loaders-on-Disable.patch index 331239ba2..4272393c9 100644 --- a/Spigot-API-Patches/0098-Close-Plugin-Class-Loaders-on-Disable.patch +++ b/Spigot-API-Patches/0098-Close-Plugin-Class-Loaders-on-Disable.patch @@ -53,7 +53,7 @@ index 41e26451fe12d8e6e0ef73c85731b24b4e3f200c..86cc5025ad98f7a752c51713b7cd6a39 * Gets a {@link Permission} from its fully qualified name * diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java -index 8ddaf9c2e63b382533d7f8929023c364ff3a8f9d..8bb24f734f0bbb5df37dff2f376a450b8be9be28 100644 +index 8b33d914d29897c0276f9e2e7ce83bd2c316d5e2..a7393d2830b95d7167121b02066a3f357cee6085 100644 --- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java +++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java @@ -492,17 +492,28 @@ public final class SimplePluginManager implements PluginManager { @@ -97,7 +97,7 @@ index 8ddaf9c2e63b382533d7f8929023c364ff3a8f9d..8bb24f734f0bbb5df37dff2f376a450b lookupNames.clear(); dependencyGraph = GraphBuilder.directed().build(); diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -index e72cbde4b3225cbf17d8a9b275e0ffcaa6d86c19..32ec68b489ab1933b4375a339c77c05a3e235202 100644 +index 5be6460e8eb81381c7e305cb7ab6b77c0c7a8fe5..bef88a6e2e6f7071401a3af0aec31e62aa265566 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java @@ -331,7 +331,7 @@ public final class JavaPluginLoader implements PluginLoader { diff --git a/Spigot-API-Patches/0106-Make-shield-blocking-delay-configurable.patch b/Spigot-API-Patches/0106-Make-shield-blocking-delay-configurable.patch index 031f7f057..d5f7d1d09 100644 --- a/Spigot-API-Patches/0106-Make-shield-blocking-delay-configurable.patch +++ b/Spigot-API-Patches/0106-Make-shield-blocking-delay-configurable.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Make shield blocking delay configurable diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index ae712e76d961137a35b70dd3f3fbb33dddf37f0a..896b1971c86410ccc62353e44bfe5a449f8a0c97 100644 +index f0018823e17fab49e0167ece1c8c9eda2d562b87..3c02de9ebca92ba03beb1dd3c04a32c745e9ea8e 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -554,5 +554,19 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource +@@ -575,5 +575,19 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource * @param arrows Number of arrows to stick in this entity */ void setArrowsStuck(int arrows); diff --git a/Spigot-API-Patches/0111-Expand-Explosions-API.patch b/Spigot-API-Patches/0111-Expand-Explosions-API.patch index 0b5880cfd..f5574a6e8 100644 --- a/Spigot-API-Patches/0111-Expand-Explosions-API.patch +++ b/Spigot-API-Patches/0111-Expand-Explosions-API.patch @@ -106,7 +106,7 @@ index 4cf22afc3c1f1cc19b6e5350043431215908a612..ac3c8eef58872c2de840a4b7ba7d77c2 * Returns a list of entities within a bounding box centered around a Location. * diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 085c7a42c3e758770d5883e3cddf896ac6b7645b..08985f77dce71ebd76510be873043e34ac34a821 100644 +index 6e311dd8f1105c28be7259855e0b19ae182badfd..4cbea0cc7b2594ebbc555edb00a86dac6d293f91 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -1354,6 +1354,88 @@ public interface World extends PluginMessageRecipient, Metadatable { diff --git a/Spigot-API-Patches/0113-LivingEntity-Hand-Raised-Item-Use-API.patch b/Spigot-API-Patches/0113-LivingEntity-Hand-Raised-Item-Use-API.patch index 46d1a43a6..ac446cc82 100644 --- a/Spigot-API-Patches/0113-LivingEntity-Hand-Raised-Item-Use-API.patch +++ b/Spigot-API-Patches/0113-LivingEntity-Hand-Raised-Item-Use-API.patch @@ -6,10 +6,10 @@ Subject: [PATCH] LivingEntity Hand Raised/Item Use API How long an entity has raised hands to charge an attack or use an item diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 896b1971c86410ccc62353e44bfe5a449f8a0c97..4af8e680dbcd3e0bc1ed692146b72fecbf7735ba 100644 +index 3c02de9ebca92ba03beb1dd3c04a32c745e9ea8e..5f8a544574bbc095f2b2c06ccbf887d17af93475 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -11,6 +11,7 @@ import org.bukkit.attribute.Attributable; +@@ -12,6 +12,7 @@ import org.bukkit.attribute.Attributable; import org.bukkit.block.Block; import org.bukkit.entity.memory.MemoryKey; import org.bukkit.inventory.EntityEquipment; @@ -17,7 +17,7 @@ index 896b1971c86410ccc62353e44bfe5a449f8a0c97..4af8e680dbcd3e0bc1ed692146b72fec import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; import org.bukkit.projectiles.ProjectileSource; -@@ -568,5 +569,32 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource +@@ -589,5 +590,32 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource * @param delay Delay in ticks */ void setShieldBlockingDelay(int delay); diff --git a/Spigot-API-Patches/0115-Add-World.getEntity-UUID-API.patch b/Spigot-API-Patches/0115-Add-World.getEntity-UUID-API.patch index c8a7bafa4..121bb131b 100644 --- a/Spigot-API-Patches/0115-Add-World.getEntity-UUID-API.patch +++ b/Spigot-API-Patches/0115-Add-World.getEntity-UUID-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add World.getEntity(UUID) API diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 08985f77dce71ebd76510be873043e34ac34a821..889756b1c8d5e413a6ebe3623e128a737f88d48c 100644 +index 4cbea0cc7b2594ebbc555edb00a86dac6d293f91..2e52059cdf2431baac09db521b02fbc4c594eb60 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -914,6 +914,17 @@ public interface World extends PluginMessageRecipient, Metadatable { diff --git a/Spigot-API-Patches/0116-InventoryCloseEvent-Reason-API.patch b/Spigot-API-Patches/0116-InventoryCloseEvent-Reason-API.patch index 566114944..b11da6a93 100644 --- a/Spigot-API-Patches/0116-InventoryCloseEvent-Reason-API.patch +++ b/Spigot-API-Patches/0116-InventoryCloseEvent-Reason-API.patch @@ -7,10 +7,10 @@ Allows you to determine why an inventory was closed, enabling plugin developers to "confirm" things based on if it was player triggered close or not. diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java -index 2d413d720c828c7f334abde7eb02935317e2fd17..79569a329aa19ed954b9b65b78ef5d6d313501a1 100644 +index dd7b08f985d8ac41fdce8241a3cd2c84c1555ab3..2668196e04a7de245c63b4b74f0d056784ef0736 100644 --- a/src/main/java/org/bukkit/entity/HumanEntity.java +++ b/src/main/java/org/bukkit/entity/HumanEntity.java -@@ -152,6 +152,15 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder +@@ -153,6 +153,15 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder */ public void closeInventory(); diff --git a/Spigot-API-Patches/0117-Entity-getChunk-API.patch b/Spigot-API-Patches/0117-Entity-getChunk-API.patch index ef5187873..3b43f12f3 100644 --- a/Spigot-API-Patches/0117-Entity-getChunk-API.patch +++ b/Spigot-API-Patches/0117-Entity-getChunk-API.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Entity#getChunk API Get the chunk the entity is currently registered to diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java -index e2952209d5e98ad507628bed4fbefc3aede6045f..a8dbf282d0a8fb57f4719b9e95199894d8d3324c 100644 +index 15e9ecd898b27d87a2d4f05c5b22de7c1b9a260c..d9922f0777d018f1e6c5673b9fc907fde3fbfa8d 100644 --- a/src/main/java/org/bukkit/entity/Entity.java +++ b/src/main/java/org/bukkit/entity/Entity.java @@ -3,6 +3,7 @@ package org.bukkit.entity; @@ -17,7 +17,7 @@ index e2952209d5e98ad507628bed4fbefc3aede6045f..a8dbf282d0a8fb57f4719b9e95199894 import org.bukkit.EntityEffect; import org.bukkit.Location; import org.bukkit.Nameable; -@@ -616,5 +617,13 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent +@@ -617,5 +618,13 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent * @return True if entity spawned from a mob spawner */ boolean fromMobSpawner(); diff --git a/Spigot-API-Patches/0118-Add-an-asterisk-to-legacy-API-plugins.patch b/Spigot-API-Patches/0118-Add-an-asterisk-to-legacy-API-plugins.patch index ed8e05eb0..9c95b7231 100644 --- a/Spigot-API-Patches/0118-Add-an-asterisk-to-legacy-API-plugins.patch +++ b/Spigot-API-Patches/0118-Add-an-asterisk-to-legacy-API-plugins.patch @@ -7,7 +7,7 @@ Not here to name and shame, only so server admins can be aware of which plugins have and haven't been updated. diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index 98df287bcb1462fa42b7d4a706a68d36927fbc1c..6f5601639c472db62120bab8d903620ee87f7e5c 100644 +index 1b6d737046646c102b0d519ab3f67c3fbd503979..541e28a9bece0beb0c2cf02c39030840b758c6e6 100644 --- a/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java @@ -84,5 +84,11 @@ public interface UnsafeValues { @@ -23,10 +23,10 @@ index 98df287bcb1462fa42b7d4a706a68d36927fbc1c..6f5601639c472db62120bab8d903620e // Paper end } diff --git a/src/main/java/org/bukkit/command/defaults/PluginsCommand.java b/src/main/java/org/bukkit/command/defaults/PluginsCommand.java -index a1071e3178a298f3fc1d6c960f4d8a6d3a3d0277..3dcecf3a543646327c277ee2698106159b2cbc84 100644 +index 4a75997f93f5c33f19200994562aaff99bdd422f..665211cb1bb27d228a43342ebca0f60e0b7f6c4b 100644 --- a/src/main/java/org/bukkit/command/defaults/PluginsCommand.java +++ b/src/main/java/org/bukkit/command/defaults/PluginsCommand.java -@@ -59,7 +59,13 @@ public class PluginsCommand extends BukkitCommand { +@@ -74,7 +74,13 @@ public class PluginsCommand extends BukkitCommand { pluginList.append(plugin.isEnabled() ? ChatColor.GREEN : ChatColor.RED); @@ -42,7 +42,7 @@ index a1071e3178a298f3fc1d6c960f4d8a6d3a3d0277..3dcecf3a543646327c277ee269810615 return "(" + plugins.size() + "): " + pluginList.toString(); diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -index 32ec68b489ab1933b4375a339c77c05a3e235202..8ff228ced356eb509b93abb7a0d3d9a26dd3e057 100644 +index bef88a6e2e6f7071401a3af0aec31e62aa265566..de44d850d7b3ab3e528eb6f2de375a6c3e0e5cf9 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java @@ -315,7 +315,14 @@ public final class JavaPluginLoader implements PluginLoader { diff --git a/Spigot-API-Patches/0128-Remove-deadlock-risk-in-firing-async-events.patch b/Spigot-API-Patches/0128-Remove-deadlock-risk-in-firing-async-events.patch index 20fce849c..697b83c69 100644 --- a/Spigot-API-Patches/0128-Remove-deadlock-risk-in-firing-async-events.patch +++ b/Spigot-API-Patches/0128-Remove-deadlock-risk-in-firing-async-events.patch @@ -16,7 +16,7 @@ which results in a hard crash. This change removes the synchronize and adds some protection around enable/disable diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java -index a8dbf282d0a8fb57f4719b9e95199894d8d3324c..b4069dbf31587786da39f5e387a71b7bc6a5d0ae 100644 +index d9922f0777d018f1e6c5673b9fc907fde3fbfa8d..f3dc2f7f45bea1a91171339a5d19461735845aee 100644 --- a/src/main/java/org/bukkit/entity/Entity.java +++ b/src/main/java/org/bukkit/entity/Entity.java @@ -28,7 +28,7 @@ import org.jetbrains.annotations.Nullable; @@ -29,7 +29,7 @@ index a8dbf282d0a8fb57f4719b9e95199894d8d3324c..b4069dbf31587786da39f5e387a71b7b * * @return a new copy of Location containing the position of this entity diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java -index 8bb24f734f0bbb5df37dff2f376a450b8be9be28..8355f9f0eb1b554bf6cfd3883afd2bdd2bf8c357 100644 +index a7393d2830b95d7167121b02066a3f357cee6085..a1a805004941d67abb0b9aa1721e0370c45b5289 100644 --- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java +++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java @@ -462,7 +462,7 @@ public final class SimplePluginManager implements PluginManager { diff --git a/Spigot-API-Patches/0131-Provide-Chunk-Coordinates-as-a-Long-API.patch b/Spigot-API-Patches/0131-Provide-Chunk-Coordinates-as-a-Long-API.patch index 7ebd3b8fd..0e7fd480e 100644 --- a/Spigot-API-Patches/0131-Provide-Chunk-Coordinates-as-a-Long-API.patch +++ b/Spigot-API-Patches/0131-Provide-Chunk-Coordinates-as-a-Long-API.patch @@ -44,7 +44,7 @@ index 95e485eea693e7648e63d198c8591d89e02e6755..0bbef14a9fc2a3ec03b4db59c8d8e1ee * Gets the world containing this chunk * diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 889756b1c8d5e413a6ebe3623e128a737f88d48c..e5b76d59fdcc85344cf3932b38ab096155d2eec3 100644 +index 2e52059cdf2431baac09db521b02fbc4c594eb60..fe8b255aeb46e30d0a954dcd0e3e6ac29b4fd33d 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -207,6 +207,22 @@ public interface World extends PluginMessageRecipient, Metadatable { diff --git a/Spigot-API-Patches/0132-Async-Chunks-API.patch b/Spigot-API-Patches/0132-Async-Chunks-API.patch index 16273413b..9e7d3074f 100644 --- a/Spigot-API-Patches/0132-Async-Chunks-API.patch +++ b/Spigot-API-Patches/0132-Async-Chunks-API.patch @@ -8,7 +8,7 @@ Adds API's to load or generate chunks asynchronously. Also adds utility methods to Entity to teleport asynchronously. diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index e5b76d59fdcc85344cf3932b38ab096155d2eec3..8fe496ad8f566183e2280582d00c3b7751f06d75 100644 +index fe8b255aeb46e30d0a954dcd0e3e6ac29b4fd33d..eef7750fdebb4fbd156d729e4cc87f7b3d0a2ad4 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -221,6 +221,467 @@ public interface World extends PluginMessageRecipient, Metadatable { @@ -480,10 +480,10 @@ index e5b76d59fdcc85344cf3932b38ab096155d2eec3..8fe496ad8f566183e2280582d00c3b77 /** diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java -index b4069dbf31587786da39f5e387a71b7bc6a5d0ae..b8e8a425a84a562ccd8431d30e39145a662c4180 100644 +index f3dc2f7f45bea1a91171339a5d19461735845aee..4a7b4112192f317b2feed9dfa7713155183578b6 100644 --- a/src/main/java/org/bukkit/entity/Entity.java +++ b/src/main/java/org/bukkit/entity/Entity.java -@@ -155,6 +155,33 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent +@@ -156,6 +156,33 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent */ public boolean teleport(@NotNull Entity destination, @NotNull TeleportCause cause); diff --git a/Spigot-API-Patches/0136-Allow-Blocks-to-be-accessed-via-a-long-key.patch b/Spigot-API-Patches/0136-Allow-Blocks-to-be-accessed-via-a-long-key.patch index 32b318c48..5ed126598 100644 --- a/Spigot-API-Patches/0136-Allow-Blocks-to-be-accessed-via-a-long-key.patch +++ b/Spigot-API-Patches/0136-Allow-Blocks-to-be-accessed-via-a-long-key.patch @@ -48,7 +48,7 @@ index f87ecd0a753b0f730ee33c0dd699b7388e8c6697..07e532cde37255ffb2db368453bb69ee * @return A new location where X/Y/Z are the center of the block */ diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 8fe496ad8f566183e2280582d00c3b7751f06d75..08aebaedce935faa1a2c54c5abc02b85896df216 100644 +index eef7750fdebb4fbd156d729e4cc87f7b3d0a2ad4..656615290c3378a853ea298d0a3b5f8d28c6a177 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -90,6 +90,38 @@ public interface World extends PluginMessageRecipient, Metadatable { @@ -91,7 +91,7 @@ index 8fe496ad8f566183e2280582d00c3b7751f06d75..08aebaedce935faa1a2c54c5abc02b85 * Gets the highest non-empty (impassable) coordinate at the given * coordinates. diff --git a/src/main/java/org/bukkit/block/Block.java b/src/main/java/org/bukkit/block/Block.java -index 8154093df6f6d4180485cecf98da3af26219eab8..41f6b849186346f9a4e254122d2448a7ea8e0ee9 100644 +index 633733d7c914cf6ae988f727d644c8f2be408b02..d7c7df85228c01529e266ffdd3b3bcdc9ed35774 100644 --- a/src/main/java/org/bukkit/block/Block.java +++ b/src/main/java/org/bukkit/block/Block.java @@ -153,6 +153,72 @@ public interface Block extends Metadatable { diff --git a/Spigot-API-Patches/0138-isChunkGenerated-API.patch b/Spigot-API-Patches/0138-isChunkGenerated-API.patch index 5d2194dad..5733dadbe 100644 --- a/Spigot-API-Patches/0138-isChunkGenerated-API.patch +++ b/Spigot-API-Patches/0138-isChunkGenerated-API.patch @@ -34,7 +34,7 @@ index 07e532cde37255ffb2db368453bb69ee0a410931..6e1a1124a6e528c1a94ccb1d09bc5dcc /** * Sets the position of this Location and returns itself diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 08aebaedce935faa1a2c54c5abc02b85896df216..42b91634a131f8705cbde96b6068d5881a393fb7 100644 +index 656615290c3378a853ea298d0a3b5f8d28c6a177..40dd88b538e9d9f7684f65415cf18e9b416e28de 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -254,6 +254,17 @@ public interface World extends PluginMessageRecipient, Metadatable { diff --git a/Spigot-API-Patches/0143-Add-ray-tracing-methods-to-LivingEntity.patch b/Spigot-API-Patches/0143-Add-ray-tracing-methods-to-LivingEntity.patch index 1ff60e35c..284a02349 100644 --- a/Spigot-API-Patches/0143-Add-ray-tracing-methods-to-LivingEntity.patch +++ b/Spigot-API-Patches/0143-Add-ray-tracing-methods-to-LivingEntity.patch @@ -65,10 +65,10 @@ index 0000000000000000000000000000000000000000..18a96dbb01d3b34476652264b2d6be37 + } +} diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 4af8e680dbcd3e0bc1ed692146b72fecbf7735ba..5e9ca6f3d5aac2d119808eb03cfc00367306f5e4 100644 +index 5f8a544574bbc095f2b2c06ccbf887d17af93475..c75ce8435ddef6502df1a57ca4b95186259a2a41 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -81,6 +81,77 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource +@@ -82,6 +82,77 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource @NotNull public Block getTargetBlock(@Nullable Set transparent, int maxDistance); diff --git a/Spigot-API-Patches/0146-Expose-attack-cooldown-methods-for-Player.patch b/Spigot-API-Patches/0146-Expose-attack-cooldown-methods-for-Player.patch index 3a0c136f2..9f23a9c89 100644 --- a/Spigot-API-Patches/0146-Expose-attack-cooldown-methods-for-Player.patch +++ b/Spigot-API-Patches/0146-Expose-attack-cooldown-methods-for-Player.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Expose attack cooldown methods for Player diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index c37d7fca014fb0f325574a33ef4ccba67db7fe49..3600b4c84058713616a6448c1175a7d1ba74fd7b 100644 +index 2441b714d343b963c43c9f8827550e683be4a93d..dec87413b5c22c95524a1b1f70fdd1ef016a6791 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java -@@ -1703,6 +1703,26 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -1743,6 +1743,26 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * @param profile The new profile to use */ void setPlayerProfile(@NotNull PlayerProfile profile); diff --git a/Spigot-API-Patches/0153-Material-API-additions.patch b/Spigot-API-Patches/0153-Material-API-additions.patch index 970b65393..665fe7619 100644 --- a/Spigot-API-Patches/0153-Material-API-additions.patch +++ b/Spigot-API-Patches/0153-Material-API-additions.patch @@ -5,18 +5,18 @@ Subject: [PATCH] Material API additions diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java -index 57b0d98121cea592dded31165e5e70f6b3bbdaa5..b89fc2dc0b186b99f76d9bf8b1f5daad3e211dfb 100644 +index cedb719856573a9284443626d8823201125c895d..3a8438fb674006a5cbfd977a1cd016117691f0ee 100644 --- a/src/main/java/org/bukkit/Material.java +++ b/src/main/java/org/bukkit/Material.java -@@ -82,6 +82,7 @@ import org.jetbrains.annotations.Nullable; +@@ -85,6 +85,7 @@ import org.jetbrains.annotations.Nullable; /** * An enum of all material IDs accepted by the official server and client */ +@SuppressWarnings({"DeprecatedIsStillUsed", "deprecation"}) // Paper public enum Material implements Keyed { // - ACACIA_BOAT(27326, 1), -@@ -3306,6 +3307,22 @@ public enum Material implements Keyed { + AIR(9648, 0), +@@ -3563,6 +3564,22 @@ public enum Material implements Keyed { } } diff --git a/Spigot-API-Patches/0154-Add-Material-Tags.patch b/Spigot-API-Patches/0154-Add-Material-Tags.patch index 4ead20379..f4f4cb9ce 100644 --- a/Spigot-API-Patches/0154-Add-Material-Tags.patch +++ b/Spigot-API-Patches/0154-Add-Material-Tags.patch @@ -204,10 +204,10 @@ index 0000000000000000000000000000000000000000..c91ea2a0679a7f3a5627b5a008e0b39d +} diff --git a/src/main/java/com/destroystokyo/paper/MaterialTags.java b/src/main/java/com/destroystokyo/paper/MaterialTags.java new file mode 100644 -index 0000000000000000000000000000000000000000..88556fdb6fa8f21355c49a77d5f4638216fbf156 +index 0000000000000000000000000000000000000000..e72fc52240015051fe58b246fcf5c014f3330f0a --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/MaterialTags.java -@@ -0,0 +1,374 @@ +@@ -0,0 +1,410 @@ +/* + * Copyright (c) 2018 Daniel Ennis (Aikar) MIT License + * @@ -253,7 +253,7 @@ index 0000000000000000000000000000000000000000..88556fdb6fa8f21355c49a77d5f46382 + .ensureSize("ARROWS", 3); + + /** -+ * Cover all 16 colors of beds. ++ * Covers all colors of beds. + */ + public static final MaterialSetTag BEDS = new MaterialSetTag(keyFor("beds")) + .endsWith("_BED") @@ -286,14 +286,14 @@ index 0000000000000000000000000000000000000000..88556fdb6fa8f21355c49a77d5f46382 + .add(Material.COBBLESTONE, Material.MOSSY_COBBLESTONE); + + /** -+ * Covers all 16 colors of concrete. ++ * Covers all colors of concrete. + */ + public static final MaterialSetTag CONCRETES = new MaterialSetTag(keyFor("concretes")) + .endsWith("_CONCRETE") + .ensureSize("CONCRETES", 16); + + /** -+ * Covers all 16 colors of concrete powder. ++ * Covers all colors of concrete powder. + */ + public static final MaterialSetTag CONCRETE_POWDER = new MaterialSetTag(keyFor("concrete_powder")) + .endsWith("_CONCRETE_POWDER") @@ -306,28 +306,28 @@ index 0000000000000000000000000000000000000000..88556fdb6fa8f21355c49a77d5f46382 + .add(Material.COOKED_COD, Material.COOKED_SALMON); + + /** -+ * Covers all 16 dyes. ++ * Covers all dyes. + */ + public static final MaterialSetTag DYES = new MaterialSetTag(keyFor("dyes")) + .endsWith("_DYE") + .ensureSize("DYES", 16); + + /** -+ * Covers all 6 wood variants of gates. ++ * Covers all variants of gates. + */ + public static final MaterialSetTag FENCE_GATES = new MaterialSetTag(keyFor("fence_gates")) + .endsWith("_GATE") -+ .ensureSize("FENCE_GATES", 6); ++ .ensureSize("FENCE_GATES", 8); + + /** -+ * Covers all 6 wood variants and nether brick fence. ++ * Covers all variants of fences. + */ + public static final MaterialSetTag FENCES = new MaterialSetTag(keyFor("fences")) + .endsWith("_FENCE") -+ .ensureSize("FENCES", 7); ++ .ensureSize("FENCES", 9); + + /** -+ * Covers all 4 variants of fish buckets. ++ * Covers all variants of fish buckets. + */ + public static final MaterialSetTag FISH_BUCKETS = new MaterialSetTag(keyFor("fish_buckets")) + .add(Material.COD_BUCKET, Material.PUFFERFISH_BUCKET, Material.SALMON_BUCKET, Material.TROPICAL_FISH_BUCKET); @@ -341,21 +341,21 @@ index 0000000000000000000000000000000000000000..88556fdb6fa8f21355c49a77d5f46382 + .ensureSize("GLASS", 17); + + /** -+ * Covers the non-colored glass panes and 16 stained glass panes (panes only). ++ * Covers the non-colored glass panes and stained glass panes (panes only). + */ + public static final MaterialSetTag GLASS_PANES = new MaterialSetTag(keyFor("glass_panes")) + .endsWith("GLASS_PANE") + .ensureSize("GLASS_PANES", 17); + + /** -+ * Covers all 16 glazed terracotta blocks. ++ * Covers all glazed terracotta blocks. + */ + public static final MaterialSetTag GLAZED_TERRACOTTA = new MaterialSetTag(keyFor("glazed_terracotta")) + .endsWith("GLAZED_TERRACOTTA") + .ensureSize("GLAZED_TERRACOTTA", 16); + + /** -+ * Covers the 16 colors of stained terracotta. ++ * Covers the colors of stained terracotta. + */ + public static final MaterialSetTag STAINED_TERRACOTTA = new MaterialSetTag(keyFor("stained_terracotta")) + .endsWith("TERRACOTTA") @@ -364,7 +364,7 @@ index 0000000000000000000000000000000000000000..88556fdb6fa8f21355c49a77d5f46382 + .ensureSize("STAINED_TERRACOTTA", 16); + + /** -+ * Covers terracotta along with the 16 stained variants. ++ * Covers terracotta along with the stained variants. + */ + public static final MaterialSetTag TERRACOTTA = new MaterialSetTag(keyFor("terracotta")) + .endsWith("TERRACOTTA") @@ -379,21 +379,21 @@ index 0000000000000000000000000000000000000000..88556fdb6fa8f21355c49a77d5f46382 + .ensureSize("GOLDEN_APPLES", 2); + + /** -+ * Covers the 3 variants of horse armor. ++ * Covers the variants of horse armor. + */ + public static final MaterialSetTag HORSE_ARMORS = new MaterialSetTag(keyFor("horse_armors")) + .endsWith("_HORSE_ARMOR") + .ensureSize("HORSE_ARMORS", 4); + + /** -+ * Covers the 6 variants of infested blocks. ++ * Covers the variants of infested blocks. + */ + public static final MaterialSetTag INFESTED_BLOCKS = new MaterialSetTag(keyFor("infested_blocks")) + .startsWith("INFESTED_") + .ensureSize("INFESTED_BLOCKS", 6); + + /** -+ * Covers the 3 variants of mushroom blocks. ++ * Covers the variants of mushroom blocks. + */ + public static final MaterialSetTag MUSHROOM_BLOCKS = new MaterialSetTag(keyFor("mushroom_blocks")) + .endsWith("MUSHROOM_BLOCK") @@ -401,24 +401,24 @@ index 0000000000000000000000000000000000000000..88556fdb6fa8f21355c49a77d5f46382 + .ensureSize("MUSHROOM_BLOCKS", 3); + + /** -+ * Covers both mushrooms. ++ * Covers all mushrooms. + */ + public static final MaterialSetTag MUSHROOMS = new MaterialSetTag(keyFor("mushrooms")) + .add(Material.BROWN_MUSHROOM, Material.RED_MUSHROOM); + + /** -+ * Covers all 12 music disc items. ++ * Covers all music disc items. + */ + public static final MaterialSetTag MUSIC_DISCS = new MaterialSetTag(keyFor("music_discs")) -+ .startsWith("MUSIC_DISC_") -+ .ensureSize("MUSIC_DISCS", 12); ++ .startsWith("MUSIC_DISC_"); + + /** -+ * Covers all 8 ores. ++ * Covers all ores. + */ + public static final MaterialSetTag ORES = new MaterialSetTag(keyFor("ores")) ++ .add(Material.ANCIENT_DEBRIS) + .endsWith("_ORE") -+ .ensureSize("ORES", 8); ++ .ensureSize("ORES", 10); + + /** + * Covers all piston typed items and blocks including the piston head and moving piston. @@ -435,38 +435,38 @@ index 0000000000000000000000000000000000000000..88556fdb6fa8f21355c49a77d5f46382 + .ensureSize("POTATOES", 3); + + /** -+ * Covers all 6 wooden pressure plates and the 2 weighted pressure plates and 1 stone pressure plate. ++ * Covers all wooden pressure plates and the weighted pressure plates and the stone pressure plate. + */ + public static final MaterialSetTag PRESSURE_PLATES = new MaterialSetTag(keyFor("pressure_plates")) + .endsWith("_PRESSURE_PLATE") -+ .ensureSize("PRESSURE_PLATES", 9); ++ .ensureSize("PRESSURE_PLATES", 12); + + /** -+ * Covers the 3 variants of prismarine blocks. ++ * Covers the variants of prismarine blocks. + */ + public static final MaterialSetTag PRISMARINE = new MaterialSetTag(keyFor("prismarine")) + .add(Material.PRISMARINE, Material.PRISMARINE_BRICKS, Material.DARK_PRISMARINE); + + /** -+ * Covers the 3 variants of prismarine slabs. ++ * Covers the variants of prismarine slabs. + */ + public static final MaterialSetTag PRISMARINE_SLABS = new MaterialSetTag(keyFor("prismarine_slabs")) + .add(Material.PRISMARINE_SLAB, Material.PRISMARINE_BRICK_SLAB, Material.DARK_PRISMARINE_SLAB); + + /** -+ * Covers the 3 variants of prismarine stairs. ++ * Covers the variants of prismarine stairs. + */ + public static final MaterialSetTag PRISMARINE_STAIRS = new MaterialSetTag(keyFor("prismarine_stairs")) + .add(Material.PRISMARINE_STAIRS, Material.PRISMARINE_BRICK_STAIRS, Material.DARK_PRISMARINE_STAIRS); + + /** -+ * Covers the 3 variants of pumpkins. ++ * Covers the variants of pumpkins. + */ + public static final MaterialSetTag PUMPKINS = new MaterialSetTag(keyFor("pumpkins")) + .add(Material.CARVED_PUMPKIN, Material.JACK_O_LANTERN, Material.PUMPKIN); + + /** -+ * Covers the 4 variants of quartz blocks. ++ * Covers the variants of quartz blocks. + */ + public static final MaterialSetTag QUARTZ_BLOCKS = new MaterialSetTag(keyFor("quartz_blocks")) + .add(Material.QUARTZ_BLOCK, Material.QUARTZ_PILLAR, Material.CHISELED_QUARTZ_BLOCK, Material.SMOOTH_QUARTZ); @@ -478,14 +478,14 @@ index 0000000000000000000000000000000000000000..88556fdb6fa8f21355c49a77d5f46382 + .add(Material.COD, Material.PUFFERFISH, Material.SALMON, Material.TROPICAL_FISH); + + /** -+ * Covers the 4 variants of red sandstone blocks. ++ * Covers the variants of red sandstone blocks. + */ + public static final MaterialSetTag RED_SANDSTONES = new MaterialSetTag(keyFor("red_sandstones")) + .endsWith("RED_SANDSTONE") + .ensureSize("RED_SANDSTONES", 4); + + /** -+ * Covers the 4 variants of sandstone blocks. ++ * Covers the variants of sandstone blocks. + */ + public static final MaterialSetTag SANDSTONES = new MaterialSetTag(keyFor("sandstones")) + .add(Material.SANDSTONE, Material.CHISELED_SANDSTONE, Material.CUT_SANDSTONE, Material.SMOOTH_SANDSTONE); @@ -498,7 +498,7 @@ index 0000000000000000000000000000000000000000..88556fdb6fa8f21355c49a77d5f46382 + .ensureSize("SPONGES", 2); + + /** -+ * Covers the non-colored and 16 colored shulker boxes. ++ * Covers the non-colored and colored shulker boxes. + */ + public static final MaterialSetTag SHULKER_BOXES = new MaterialSetTag(keyFor("shulker_boxes")) + .endsWith("SHULKER_BOX") @@ -518,65 +518,101 @@ index 0000000000000000000000000000000000000000..88556fdb6fa8f21355c49a77d5f46382 + */ + public static final MaterialSetTag SPAWN_EGGS = new MaterialSetTag(keyFor("spawn_eggs")) + .endsWith("_SPAWN_EGG") -+ .ensureSize("SPAWN_EGGS", 59); ++ .ensureSize("SPAWN_EGGS", 63); + + /** -+ * Covers all 16 colors of stained glass. ++ * Covers all colors of stained glass. + */ + public static final MaterialSetTag STAINED_GLASS = new MaterialSetTag(keyFor("stained_glass")) + .endsWith("_STAINED_GLASS") + .ensureSize("STAINED_GLASS", 16); + + /** -+ * Covers all 16 colors of stained glass panes. ++ * Covers all colors of stained glass panes. + */ + public static final MaterialSetTag STAINED_GLASS_PANES = new MaterialSetTag(keyFor("stained_glass_panes")) + .endsWith("STAINED_GLASS_PANE") + .ensureSize("STAINED_GLASS_PANES", 16); + + /** -+ * Covers all 7 variants of trapdoors. ++ * Covers all variants of trapdoors. + */ + public static final MaterialSetTag TRAPDOORS = new MaterialSetTag(keyFor("trapdoors")) + .endsWith("_TRAPDOOR") -+ .ensureSize("TRAPDOORS", 7); ++ .ensureSize("TRAPDOORS", 9); + + /** -+ * Covers all 6 wood variants of fences. ++ * Covers all wood variants of fences. + */ + public static final MaterialSetTag WOODEN_FENCES = new MaterialSetTag(keyFor("wooden_fences")) + .endsWith("_FENCE") + .not(Material.NETHER_BRICK_FENCE) -+ .ensureSize("WOODEN_FENCES", 6); ++ .ensureSize("WOODEN_FENCES", 8); + + /** -+ * Covers all 6 wood variants of trapdoors. ++ * Covers all wood variants of trapdoors. + */ + public static final MaterialSetTag WOODEN_TRAPDOORS = new MaterialSetTag(keyFor("wooden_trapdoors")) + .endsWith("_TRAPDOOR") + .not(Material.IRON_TRAPDOOR) -+ .ensureSize("WOODEN_TRAPDOORS", 6); ++ .ensureSize("WOODEN_TRAPDOORS", 8); + ++ /** ++ * Covers the wood variants of gates. ++ */ + public static final MaterialSetTag WOODEN_GATES = new MaterialSetTag(keyFor("wooden_gates")) + .endsWith("_GATE") -+ .ensureSize("WOODEN_GATES", 6); ++ .ensureSize("WOODEN_GATES", 8); + ++ /** ++ * Covers the variants of purpur. ++ */ + public static final MaterialSetTag PURPUR = new MaterialSetTag(keyFor("purpur")) + .startsWith("PURPUR_") + .ensureSize("PURPUR", 4); + ++ /** ++ * Covers the variants of signs. ++ */ + public static final MaterialSetTag SIGNS = new MaterialSetTag(keyFor("signs")) + .endsWith("_SIGN") -+ .ensureSize("SIGNS", 12); ++ .ensureSize("SIGNS", 16); + ++ /** ++ * Covers the variants of a regular torch. ++ */ + public static final MaterialSetTag TORCH = new MaterialSetTag(keyFor("torch")) + .add(Material.TORCH, Material.WALL_TORCH) + .ensureSize("TORCH", 2); + ++ /** ++ * Covers the variants of a redstone torch. ++ */ + public static final MaterialSetTag REDSTONE_TORCH = new MaterialSetTag(keyFor("restone_torch")) + .add(Material.REDSTONE_TORCH, Material.REDSTONE_WALL_TORCH) + .ensureSize("REDSTONE_TORCH", 2); + ++ /** ++ * Covers the variants of a soul torch. ++ */ ++ public static final MaterialSetTag SOUL_TORCH = new MaterialSetTag(keyFor("soul_torch")) ++ .add(Material.SOUL_TORCH, Material.SOUL_WALL_TORCH) ++ .ensureSize("SOUL_TORCH", 2); ++ ++ /** ++ * Covers the variants of torches. ++ */ ++ public static final MaterialSetTag TORCHES = new MaterialSetTag(keyFor("torches")) ++ .add(TORCH, REDSTONE_TORCH, SOUL_TORCH) ++ .ensureSize("TORCHES", 6); ++ ++ /** ++ * Covers the variants of lanterns. ++ */ ++ public static final MaterialSetTag LANTERNS = new MaterialSetTag(keyFor("lanterns")) ++ .add(Material.LANTERN, Material.SOUL_LANTERN) ++ .ensureSize("LANTERNS", 2); ++ + @SuppressWarnings("unchecked") + public static final MaterialSetTag COLORABLE = new MaterialSetTag(keyFor("colorable")) + .add(Tag.WOOL, Tag.CARPETS).add(SHULKER_BOXES, STAINED_GLASS, STAINED_GLASS_PANES, CONCRETES, BEDS); diff --git a/Spigot-API-Patches/0156-Add-LivingEntity-getTargetEntity.patch b/Spigot-API-Patches/0156-Add-LivingEntity-getTargetEntity.patch index 1e8991f57..154fabd97 100644 --- a/Spigot-API-Patches/0156-Add-LivingEntity-getTargetEntity.patch +++ b/Spigot-API-Patches/0156-Add-LivingEntity-getTargetEntity.patch @@ -49,10 +49,10 @@ index 0000000000000000000000000000000000000000..f52644fab1522bdf83ff4f489e9805b2 + } +} diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index 5e9ca6f3d5aac2d119808eb03cfc00367306f5e4..deab505250145e795ef14537c5d453c1703f80aa 100644 +index c75ce8435ddef6502df1a57ca4b95186259a2a41..cda3ab0924b27bcd3ccfec4b0eb19ef1c24f18fb 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -150,6 +150,50 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource +@@ -151,6 +151,50 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource */ @Nullable public com.destroystokyo.paper.block.TargetBlockInfo getTargetBlockInfo(int maxDistance, @NotNull com.destroystokyo.paper.block.TargetBlockInfo.FluidMode fluidMode); diff --git a/Spigot-API-Patches/0157-Add-sun-related-API.patch b/Spigot-API-Patches/0157-Add-sun-related-API.patch index b4c7ae239..8fda90ee4 100644 --- a/Spigot-API-Patches/0157-Add-sun-related-API.patch +++ b/Spigot-API-Patches/0157-Add-sun-related-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add sun related API diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 42b91634a131f8705cbde96b6068d5881a393fb7..f9a5ea4fcdb87e741cf04b47d469e05f8a786155 100644 +index 40dd88b538e9d9f7684f65415cf18e9b416e28de..8d951577c0797d299951f7fd2448121710f07e6b 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -1755,6 +1755,16 @@ public interface World extends PluginMessageRecipient, Metadatable { diff --git a/Spigot-API-Patches/0160-Implement-getters-and-setters-for-EntityItem-owner-a.patch b/Spigot-API-Patches/0160-Implement-getters-and-setters-for-EntityItem-owner-a.patch index c96f13750..7645d0f72 100644 --- a/Spigot-API-Patches/0160-Implement-getters-and-setters-for-EntityItem-owner-a.patch +++ b/Spigot-API-Patches/0160-Implement-getters-and-setters-for-EntityItem-owner-a.patch @@ -6,21 +6,22 @@ Subject: [PATCH] Implement getters and setters for EntityItem owner and diff --git a/src/main/java/org/bukkit/entity/Item.java b/src/main/java/org/bukkit/entity/Item.java -index cb9e9f369e041cd9e5835cac7909db482295083c..a15f70ff4ef74e9e14fcc03850c477557b15285c 100644 +index ae3880491682067d4c5baef0a8c90b1036d67ac0..acd80d812fe88dee3978d19b24149e9fe0ac596b 100644 --- a/src/main/java/org/bukkit/entity/Item.java +++ b/src/main/java/org/bukkit/entity/Item.java -@@ -4,6 +4,10 @@ import org.bukkit.inventory.ItemStack; +@@ -3,6 +3,11 @@ package org.bukkit.entity; + import org.bukkit.inventory.ItemStack; import org.jetbrains.annotations.NotNull; - import org.jetbrains.annotations.Nullable; +// Paper start ++import org.jetbrains.annotations.Nullable; +import java.util.UUID; +// Paper end + /** * Represents a dropped item. */ -@@ -52,5 +56,35 @@ public interface Item extends Entity { +@@ -51,5 +56,35 @@ public interface Item extends Entity { * @param canMobPickup True to allow non-player entity pickup */ public void setCanMobPickup(boolean canMobPickup); diff --git a/Spigot-API-Patches/0163-Make-the-default-permission-message-configurable.patch b/Spigot-API-Patches/0163-Make-the-default-permission-message-configurable.patch index 07a9decd2..cf14442da 100644 --- a/Spigot-API-Patches/0163-Make-the-default-permission-message-configurable.patch +++ b/Spigot-API-Patches/0163-Make-the-default-permission-message-configurable.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Make the default permission message configurable diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index f5fac807cce22819cba5878a6e2664f0f82f1ae3..e83f0852d187524a0068a81875323b01e3fd5cbd 100644 +index 4b6b1bce3a728d74f8b791efd2d981e907e202bc..e372ca2339bc25d6110bf95e159703630acca215 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java -@@ -1615,6 +1615,15 @@ public final class Bukkit { +@@ -1647,6 +1647,15 @@ public final class Bukkit { return server.suggestPlayerNamesWhenNullTabCompletions(); } @@ -25,10 +25,10 @@ index f5fac807cce22819cba5878a6e2664f0f82f1ae3..e83f0852d187524a0068a81875323b01 * Creates a PlayerProfile for the specified uuid, with name as null * @param uuid UUID to create profile for diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 11fffc514ed1f0b00b09c0cdb5272ea79340972c..fa855cacec894a0efb254e8a9729a9787464f17d 100644 +index a2420771ca49acc08826ca60fcda7495c80cf1d5..8bbb2efe835b575733b560fe5e2b824e1a859d09 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java -@@ -1414,6 +1414,13 @@ public interface Server extends PluginMessageRecipient { +@@ -1442,6 +1442,13 @@ public interface Server extends PluginMessageRecipient { */ boolean suggestPlayerNamesWhenNullTabCompletions(); diff --git a/Spigot-API-Patches/0173-Entity-getEntitySpawnReason.patch b/Spigot-API-Patches/0173-Entity-getEntitySpawnReason.patch index 7e528fc7e..4a56dab29 100644 --- a/Spigot-API-Patches/0173-Entity-getEntitySpawnReason.patch +++ b/Spigot-API-Patches/0173-Entity-getEntitySpawnReason.patch @@ -10,10 +10,10 @@ persistenting Living Entity, SPAWNER for spawners, or DEFAULT since data was not stored. diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java -index b8e8a425a84a562ccd8431d30e39145a662c4180..3f0f38031000a4eda25584d069939f40fbfb026b 100644 +index 4a7b4112192f317b2feed9dfa7713155183578b6..d4c776f32caf0491670175a79584c73dd2c7fcca 100644 --- a/src/main/java/org/bukkit/entity/Entity.java +++ b/src/main/java/org/bukkit/entity/Entity.java -@@ -652,5 +652,11 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent +@@ -653,5 +653,11 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent */ @NotNull Chunk getChunk(); diff --git a/Spigot-API-Patches/0177-Flip-some-Spigot-API-null-annotations.patch b/Spigot-API-Patches/0177-Flip-some-Spigot-API-null-annotations.patch index 002ce7578..903a23846 100644 --- a/Spigot-API-Patches/0177-Flip-some-Spigot-API-null-annotations.patch +++ b/Spigot-API-Patches/0177-Flip-some-Spigot-API-null-annotations.patch @@ -9,10 +9,10 @@ a ton of noise to plugin developers. These do not help plugin developers if they bring moise noise than value. diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index e83f0852d187524a0068a81875323b01e3fd5cbd..6658c12b87472a7fa58a6ca70ab0189083e75242 100644 +index e372ca2339bc25d6110bf95e159703630acca215..12603c91046abf1ab58e8b797904b2cdafa7c9af 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java -@@ -1211,7 +1211,7 @@ public final class Bukkit { +@@ -1243,7 +1243,7 @@ public final class Bukkit { * * @return the scoreboard manager or null if no worlds are loaded. */ @@ -21,7 +21,7 @@ index e83f0852d187524a0068a81875323b01e3fd5cbd..6658c12b87472a7fa58a6ca70ab01890 public static ScoreboardManager getScoreboardManager() { return server.getScoreboardManager(); } -@@ -1508,7 +1508,7 @@ public final class Bukkit { +@@ -1540,7 +1540,7 @@ public final class Bukkit { * @param clazz the class of the tag entries * @return the tag or null */ @@ -62,10 +62,10 @@ index 6e1a1124a6e528c1a94ccb1d09bc5dccf056b0b8..77d9cd0a1f54b5eb233eddbcff1bfa76 if (this.world == null) { return null; diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index fa855cacec894a0efb254e8a9729a9787464f17d..df37b9ee57ff8cd194401719bc48f868d6b1ee7e 100644 +index 8bbb2efe835b575733b560fe5e2b824e1a859d09..b46644bc97122814f80a44e6ff0b848f4cf132b7 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java -@@ -1014,7 +1014,7 @@ public interface Server extends PluginMessageRecipient { +@@ -1042,7 +1042,7 @@ public interface Server extends PluginMessageRecipient { * * @return the scoreboard manager or null if no worlds are loaded. */ @@ -74,7 +74,7 @@ index fa855cacec894a0efb254e8a9729a9787464f17d..df37b9ee57ff8cd194401719bc48f868 ScoreboardManager getScoreboardManager(); /** -@@ -1284,7 +1284,7 @@ public interface Server extends PluginMessageRecipient { +@@ -1312,7 +1312,7 @@ public interface Server extends PluginMessageRecipient { * @param clazz the class of the tag entries * @return the tag or null */ diff --git a/Spigot-API-Patches/0180-Add-Heightmap-API.patch b/Spigot-API-Patches/0180-Add-Heightmap-API.patch index cec357317..65fbbc79e 100644 --- a/Spigot-API-Patches/0180-Add-Heightmap-API.patch +++ b/Spigot-API-Patches/0180-Add-Heightmap-API.patch @@ -89,7 +89,7 @@ index 77d9cd0a1f54b5eb233eddbcff1bfa76bc182e9a..5904750329a5c7061de6e4fe32335b0d * Creates explosion at this location with given power * diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index f9a5ea4fcdb87e741cf04b47d469e05f8a786155..0a5865d85dfc28cb68f753878608b12afd74bc99 100644 +index 8d951577c0797d299951f7fd2448121710f07e6b..90e41bead6a51ab1f272af806c396d8411a96eb7 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -160,6 +160,87 @@ public interface World extends PluginMessageRecipient, Metadatable { diff --git a/Spigot-API-Patches/0186-Expose-the-internal-current-tick.patch b/Spigot-API-Patches/0186-Expose-the-internal-current-tick.patch index bc3db0517..127f1d96b 100644 --- a/Spigot-API-Patches/0186-Expose-the-internal-current-tick.patch +++ b/Spigot-API-Patches/0186-Expose-the-internal-current-tick.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Expose the internal current tick diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 6658c12b87472a7fa58a6ca70ab0189083e75242..b997340686e86e05847bedcbf125e070c569b90a 100644 +index 12603c91046abf1ab58e8b797904b2cdafa7c9af..6a0fee5e81e4d97b624af2718595b63e4d7a95b2 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java -@@ -1657,6 +1657,10 @@ public final class Bukkit { +@@ -1689,6 +1689,10 @@ public final class Bukkit { public static com.destroystokyo.paper.profile.PlayerProfile createProfile(@Nullable UUID uuid, @Nullable String name) { return server.createProfile(uuid, name); } @@ -20,10 +20,10 @@ index 6658c12b87472a7fa58a6ca70ab0189083e75242..b997340686e86e05847bedcbf125e070 @NotNull diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index df37b9ee57ff8cd194401719bc48f868d6b1ee7e..80f9abdca71bba79cbf09035cfd5534e41002a27 100644 +index b46644bc97122814f80a44e6ff0b848f4cf132b7..ea6c86c8979ea6253b00c99b4f9cfcd1621beff0 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java -@@ -1448,5 +1448,12 @@ public interface Server extends PluginMessageRecipient { +@@ -1476,5 +1476,12 @@ public interface Server extends PluginMessageRecipient { */ @NotNull com.destroystokyo.paper.profile.PlayerProfile createProfile(@Nullable UUID uuid, @Nullable String name); diff --git a/Spigot-API-Patches/0190-Entity-Jump-API.patch b/Spigot-API-Patches/0190-Entity-Jump-API.patch index 74f7ac19f..32ddfae9d 100644 --- a/Spigot-API-Patches/0190-Entity-Jump-API.patch +++ b/Spigot-API-Patches/0190-Entity-Jump-API.patch @@ -57,10 +57,10 @@ index 0000000000000000000000000000000000000000..f0067c2e953d18e1a33536980071ba3f + } +} diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index deab505250145e795ef14537c5d453c1703f80aa..7f73e4b92bc7456477d054e69e93e5602d88a8fa 100644 +index cda3ab0924b27bcd3ccfec4b0eb19ef1c24f18fb..a60523cc9c05396ce5c3ebabd231f3ca374c3efe 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java -@@ -711,5 +711,25 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource +@@ -732,5 +732,25 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource * @return Whether or not this entity is using or charging an attack (Bow pulled back, drinking potion, eating food) */ boolean isHandRaised(); diff --git a/Spigot-API-Patches/0192-Add-tick-times-API.patch b/Spigot-API-Patches/0192-Add-tick-times-API.patch index efbcbd05c..4f61829ae 100644 --- a/Spigot-API-Patches/0192-Add-tick-times-API.patch +++ b/Spigot-API-Patches/0192-Add-tick-times-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add tick times API diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index b997340686e86e05847bedcbf125e070c569b90a..c3c2d9c6b546459a614b5fdf5ec3debf4ebcabcf 100644 +index 6a0fee5e81e4d97b624af2718595b63e4d7a95b2..eb2fb4cdc4e7585017acfce0198bb0746d2255cc 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java -@@ -1412,6 +1412,25 @@ public final class Bukkit { +@@ -1444,6 +1444,25 @@ public final class Bukkit { public static double[] getTPS() { return server.getTPS(); } @@ -35,10 +35,10 @@ index b997340686e86e05847bedcbf125e070c569b90a..c3c2d9c6b546459a614b5fdf5ec3debf /** diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 80f9abdca71bba79cbf09035cfd5534e41002a27..bfa83c9bb4d5f1ff4591e80fd38942d6c88cf960 100644 +index ea6c86c8979ea6253b00c99b4f9cfcd1621beff0..8cb38856d85e9239a132234fdc6af88f3adfe5b7 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java -@@ -1188,6 +1188,21 @@ public interface Server extends PluginMessageRecipient { +@@ -1216,6 +1216,21 @@ public interface Server extends PluginMessageRecipient { */ @NotNull public double[] getTPS(); diff --git a/Spigot-API-Patches/0193-Expose-MinecraftServer-isRunning.patch b/Spigot-API-Patches/0193-Expose-MinecraftServer-isRunning.patch index 0013b87f4..e05aaa4e5 100644 --- a/Spigot-API-Patches/0193-Expose-MinecraftServer-isRunning.patch +++ b/Spigot-API-Patches/0193-Expose-MinecraftServer-isRunning.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Expose MinecraftServer#isRunning This allows for plugins to detect if the server is actually turning off in onDisable rather than just plugins reloading. diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index c3c2d9c6b546459a614b5fdf5ec3debf4ebcabcf..ea3e5d6fa56a7ff259a9ce55a8e31d3921768b8b 100644 +index eb2fb4cdc4e7585017acfce0198bb0746d2255cc..600334831293793840511992048c43bff1febc24 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java -@@ -1680,6 +1680,15 @@ public final class Bukkit { +@@ -1712,6 +1712,15 @@ public final class Bukkit { public static int getCurrentTick() { return server.getCurrentTick(); } @@ -26,10 +26,10 @@ index c3c2d9c6b546459a614b5fdf5ec3debf4ebcabcf..ea3e5d6fa56a7ff259a9ce55a8e31d39 @NotNull diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index bfa83c9bb4d5f1ff4591e80fd38942d6c88cf960..9ceaac0e859e347b07fa9f4c6507a73deb280670 100644 +index 8cb38856d85e9239a132234fdc6af88f3adfe5b7..f44a582e954625a12b19d4e142865e5d3154edd5 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java -@@ -1470,5 +1470,12 @@ public interface Server extends PluginMessageRecipient { +@@ -1498,5 +1498,12 @@ public interface Server extends PluginMessageRecipient { * @return Current tick */ int getCurrentTick(); diff --git a/Spigot-API-Patches/0194-Disable-Sync-Events-firing-Async-errors-during-shutd.patch b/Spigot-API-Patches/0194-Disable-Sync-Events-firing-Async-errors-during-shutd.patch index a7e3a69f3..5ca0264ed 100644 --- a/Spigot-API-Patches/0194-Disable-Sync-Events-firing-Async-errors-during-shutd.patch +++ b/Spigot-API-Patches/0194-Disable-Sync-Events-firing-Async-errors-during-shutd.patch @@ -11,7 +11,7 @@ errors. This isn't an issue on Spigot diff --git a/src/main/java/org/bukkit/plugin/SimplePluginManager.java b/src/main/java/org/bukkit/plugin/SimplePluginManager.java -index 8355f9f0eb1b554bf6cfd3883afd2bdd2bf8c357..4931bc86d44cd697d458d6e365c3b8030ea8285d 100644 +index a1a805004941d67abb0b9aa1721e0370c45b5289..26685f59b235ea5b4c4fb7ae21acb5149edaa2b3 100644 --- a/src/main/java/org/bukkit/plugin/SimplePluginManager.java +++ b/src/main/java/org/bukkit/plugin/SimplePluginManager.java @@ -591,7 +591,7 @@ public final class SimplePluginManager implements PluginManager { diff --git a/Spigot-API-Patches/0195-Make-JavaPluginLoader-thread-safe.patch b/Spigot-API-Patches/0195-Make-JavaPluginLoader-thread-safe.patch index 283d4022b..21dbe589a 100644 --- a/Spigot-API-Patches/0195-Make-JavaPluginLoader-thread-safe.patch +++ b/Spigot-API-Patches/0195-Make-JavaPluginLoader-thread-safe.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Make JavaPluginLoader thread-safe diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -index 8ff228ced356eb509b93abb7a0d3d9a26dd3e057..ba2c5c6eee6fc9f7c96c3ab304d8a1fc759ccd77 100644 +index de44d850d7b3ab3e528eb6f2de375a6c3e0e5cf9..9d1f7cdf12029c8198792fd299f92be476040222 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java @@ -52,6 +52,8 @@ public final class JavaPluginLoader implements PluginLoader { diff --git a/Spigot-API-Patches/0196-Add-Player-Client-Options-API.patch b/Spigot-API-Patches/0196-Add-Player-Client-Options-API.patch index 8b7612e97..00ebdd1e9 100644 --- a/Spigot-API-Patches/0196-Add-Player-Client-Options-API.patch +++ b/Spigot-API-Patches/0196-Add-Player-Client-Options-API.patch @@ -176,7 +176,7 @@ index 0000000000000000000000000000000000000000..f7f171c4ee0b8339b2f8fbe82442d65f + } +} diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java -index 3600b4c84058713616a6448c1175a7d1ba74fd7b..787bb144b5918ef1e46d69cb72b84128d2b678f3 100644 +index dec87413b5c22c95524a1b1f70fdd1ef016a6791..2eb3121386e3bc5ccdd74726a7c4b5f832ec5aea 100644 --- a/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java @@ -1,6 +1,7 @@ @@ -187,7 +187,7 @@ index 3600b4c84058713616a6448c1175a7d1ba74fd7b..787bb144b5918ef1e46d69cb72b84128 import com.destroystokyo.paper.Title; // Paper import com.destroystokyo.paper.profile.PlayerProfile; // Paper import java.util.Date; // Paper -@@ -1723,6 +1724,12 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM +@@ -1763,6 +1764,12 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM * Reset the cooldown counter to 0, effectively starting the cooldown period. */ void resetCooldown(); diff --git a/Spigot-API-Patches/0200-Expose-game-version.patch b/Spigot-API-Patches/0200-Expose-game-version.patch index c2e98ecdc..50ff8c84f 100644 --- a/Spigot-API-Patches/0200-Expose-game-version.patch +++ b/Spigot-API-Patches/0200-Expose-game-version.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Expose game version diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index ea3e5d6fa56a7ff259a9ce55a8e31d3921768b8b..95ad0122605b40e28352fa6205528eeb5c453a50 100644 +index 600334831293793840511992048c43bff1febc24..c0421b5a09c25ad4f23387b8b0e035871a9d367b 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java @@ -118,6 +118,18 @@ public final class Bukkit { @@ -28,7 +28,7 @@ index ea3e5d6fa56a7ff259a9ce55a8e31d3921768b8b..95ad0122605b40e28352fa6205528eeb * Gets a view of all currently logged in players. This {@linkplain * Collections#unmodifiableCollection(Collection) view} is a reused diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 9ceaac0e859e347b07fa9f4c6507a73deb280670..c3fb1c27187b5283e2fd5c2b894bbc889a48544d 100644 +index f44a582e954625a12b19d4e142865e5d3154edd5..0ad848c42039eeed64cc0b8372d3a9331e61d286 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java @@ -97,6 +97,16 @@ public interface Server extends PluginMessageRecipient { diff --git a/Spigot-API-Patches/0202-Add-Mob-Goal-API.patch b/Spigot-API-Patches/0202-Add-Mob-Goal-API.patch index 30f4ae11c..7ad680ded 100644 --- a/Spigot-API-Patches/0202-Add-Mob-Goal-API.patch +++ b/Spigot-API-Patches/0202-Add-Mob-Goal-API.patch @@ -227,10 +227,10 @@ index 0000000000000000000000000000000000000000..e21f7574763dd4f13794f91bbef192ef +} diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java b/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java new file mode 100644 -index 0000000000000000000000000000000000000000..d23ad96ee436ae57231bbf88eed19487dec06780 +index 0000000000000000000000000000000000000000..d7f1b2c84aebe8ed04084b9249ed08d5e52a6ecd --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java -@@ -0,0 +1,198 @@ +@@ -0,0 +1,208 @@ +package com.destroystokyo.paper.entity.ai; + +import com.destroystokyo.paper.entity.RangedEntity; @@ -319,7 +319,15 @@ index 0000000000000000000000000000000000000000..d23ad96ee436ae57231bbf88eed19487 + GoalKey PHANTOM_ATTACK_STRATEGY = GoalKey.of(Phantom.class, NamespacedKey.minecraft("phantom_attack_strategy")); + GoalKey PHANTOM_CIRCLE_AROUND_ANCHOR = GoalKey.of(Phantom.class, NamespacedKey.minecraft("phantom_circle_around_anchor")); + GoalKey PHANTOM_SWEEP_ATTACK = GoalKey.of(Phantom.class, NamespacedKey.minecraft("phantom_sweep_attack")); ++ /** ++ * @deprecated removed in 1.16 ++ */ ++ @Deprecated + GoalKey ANGER = GoalKey.of(PigZombie.class, NamespacedKey.minecraft("anger")); ++ /** ++ * @deprecated removed in 1.16 ++ */ ++ @Deprecated + GoalKey ANGER_OTHER = GoalKey.of(PigZombie.class, NamespacedKey.minecraft("anger_other")); + GoalKey POLARBEAR_ATTACK_PLAYERS = GoalKey.of(PolarBear.class, NamespacedKey.minecraft("polarbear_attack_players")); + GoalKey POLARBEAR_HURT_BY = GoalKey.of(PolarBear.class, NamespacedKey.minecraft("polarbear_hurt_by")); @@ -428,12 +436,14 @@ index 0000000000000000000000000000000000000000..d23ad96ee436ae57231bbf88eed19487 + GoalKey WATER = GoalKey.of(Creature.class, NamespacedKey.minecraft("water")); + GoalKey WATER_JUMP = GoalKey.of(Dolphin.class, NamespacedKey.minecraft("water_jump")); + GoalKey ZOMBIE_ATTACK = GoalKey.of(Zombie.class, NamespacedKey.minecraft("zombie_attack")); ++ GoalKey STROLL_VILLAGE_GOLEM = GoalKey.of(Creature.class, NamespacedKey.minecraft("stroll_village_golem")); ++ GoalKey UNIVERSAL_ANGER_RESET = GoalKey.of(Mob.class, NamespacedKey.minecraft("universal_anger_reset")); +} diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 95ad0122605b40e28352fa6205528eeb5c453a50..a9c10228eeeaac89361c695a5ab90161b6358ca1 100644 +index c0421b5a09c25ad4f23387b8b0e035871a9d367b..329e2dd1c057788d6bb5a1adc7ee9282820e927d 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java -@@ -1701,6 +1701,16 @@ public final class Bukkit { +@@ -1733,6 +1733,16 @@ public final class Bukkit { public static boolean isStopping() { return server.isStopping(); } @@ -451,10 +461,10 @@ index 95ad0122605b40e28352fa6205528eeb5c453a50..a9c10228eeeaac89361c695a5ab90161 @NotNull diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index c3fb1c27187b5283e2fd5c2b894bbc889a48544d..cc06492f46ba5776221cd2614c1dcd8f33cc8faf 100644 +index 0ad848c42039eeed64cc0b8372d3a9331e61d286..b464cc1a70aca3450a5de84a657a1e069a1a8ab6 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java -@@ -1487,5 +1487,13 @@ public interface Server extends PluginMessageRecipient { +@@ -1515,5 +1515,13 @@ public interface Server extends PluginMessageRecipient { * @return true if server is in the process of being shutdown */ boolean isStopping(); diff --git a/Spigot-API-Patches/0203-World-view-distance-api.patch b/Spigot-API-Patches/0203-World-view-distance-api.patch index 6676931bf..31cfeddff 100644 --- a/Spigot-API-Patches/0203-World-view-distance-api.patch +++ b/Spigot-API-Patches/0203-World-view-distance-api.patch @@ -5,10 +5,10 @@ Subject: [PATCH] World view distance api diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 0a5865d85dfc28cb68f753878608b12afd74bc99..be4d6ca8e8ec4c2e6643eaecc19f11466e14658c 100644 +index 90e41bead6a51ab1f272af806c396d8411a96eb7..71c1e93ea15f0a926a9ad822d09a076f8b800988 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java -@@ -3275,6 +3275,34 @@ public interface World extends PluginMessageRecipient, Metadatable { +@@ -3343,6 +3343,34 @@ public interface World extends PluginMessageRecipient, Metadatable { int getViewDistance(); // Spigot end diff --git a/Spigot-API-Patches/0205-Spawn-Reason-API.patch b/Spigot-API-Patches/0205-Spawn-Reason-API.patch index de7272882..5be9eb6a7 100644 --- a/Spigot-API-Patches/0205-Spawn-Reason-API.patch +++ b/Spigot-API-Patches/0205-Spawn-Reason-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Spawn Reason API diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index be4d6ca8e8ec4c2e6643eaecc19f11466e14658c..9518da825ed752c5a477ca9132de50f923f9192d 100644 +index 71c1e93ea15f0a926a9ad822d09a076f8b800988..75c9225bd07b4c4b6dcd702c52294a7637eb6884 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -1,6 +1,8 @@ diff --git a/Spigot-API-Patches/0206-Potential-bed-API.patch b/Spigot-API-Patches/0206-Potential-bed-API.patch index 764a63d9d..021be7137 100644 --- a/Spigot-API-Patches/0206-Potential-bed-API.patch +++ b/Spigot-API-Patches/0206-Potential-bed-API.patch @@ -8,13 +8,14 @@ Adds a new method to fetch the location of a player's bed without generating any getPotentialBedLocation - Gets the last known location of a player's bed. This does not preform any check if the bed is still valid and does not load any chunks. diff --git a/src/main/java/org/bukkit/entity/HumanEntity.java b/src/main/java/org/bukkit/entity/HumanEntity.java -index 79569a329aa19ed954b9b65b78ef5d6d313501a1..c0d38f5a39610cbc523d210b76f17fa17c0d7e62 100644 +index 2668196e04a7de245c63b4b74f0d056784ef0736..d3998c61af0c5fb1189ae7829e8cdfbef0cd3f97 100644 --- a/src/main/java/org/bukkit/entity/HumanEntity.java +++ b/src/main/java/org/bukkit/entity/HumanEntity.java -@@ -248,6 +248,18 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder - @Nullable - public Location getBedSpawnLocation(); +@@ -240,6 +240,19 @@ public interface HumanEntity extends LivingEntity, AnimalTamer, InventoryHolder + */ + public int getSleepTicks(); ++ + // Paper start - Potential bed api + /** + * Gets the Location of the player's bed, null if they have not slept @@ -28,5 +29,5 @@ index 79569a329aa19ed954b9b65b78ef5d6d313501a1..c0d38f5a39610cbc523d210b76f17fa1 + // Paper end + /** - * Sets the Location where the player will spawn at their bed. - * + * Attempts to make the entity sleep at the given location. + *
diff --git a/Spigot-API-Patches/0207-Prioritise-own-classes-where-possible.patch b/Spigot-API-Patches/0207-Prioritise-own-classes-where-possible.patch index a96387ed8..fad10c31d 100644 --- a/Spigot-API-Patches/0207-Prioritise-own-classes-where-possible.patch +++ b/Spigot-API-Patches/0207-Prioritise-own-classes-where-possible.patch @@ -25,7 +25,7 @@ The patch in general terms just loads the class in the plugin's jar before it starts looking elsewhere for it. diff --git a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java -index ba2c5c6eee6fc9f7c96c3ab304d8a1fc759ccd77..528ceeb22c55f23259340c29e3c4ed5ece89a118 100644 +index 9d1f7cdf12029c8198792fd299f92be476040222..384edf9890dfbd1cddfdcac4db1ebe9a4d761f78 100644 --- a/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java +++ b/src/main/java/org/bukkit/plugin/java/JavaPluginLoader.java @@ -50,6 +50,7 @@ import org.yaml.snakeyaml.error.YAMLException; diff --git a/Spigot-API-Patches/0208-Add-Raw-Byte-ItemStack-Serialization.patch b/Spigot-API-Patches/0208-Add-Raw-Byte-ItemStack-Serialization.patch index e309f0c79..c4406670d 100644 --- a/Spigot-API-Patches/0208-Add-Raw-Byte-ItemStack-Serialization.patch +++ b/Spigot-API-Patches/0208-Add-Raw-Byte-ItemStack-Serialization.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Add Raw Byte ItemStack Serialization Serializes using NBT which is safer for server data migrations than bukkits format. diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java -index 6f5601639c472db62120bab8d903620ee87f7e5c..70d95e89a050632b2b0e2f477d3c286a3e8db1bd 100644 +index 541e28a9bece0beb0c2cf02c39030840b758c6e6..d3ec5084e33dff038d54cdd2aeb703a3eb25f7a7 100644 --- a/src/main/java/org/bukkit/UnsafeValues.java +++ b/src/main/java/org/bukkit/UnsafeValues.java @@ -90,5 +90,9 @@ public interface UnsafeValues { diff --git a/Spigot-API-Patches/0214-Support-components-in-ItemMeta.patch b/Spigot-API-Patches/0214-Support-components-in-ItemMeta.patch new file mode 100644 index 000000000..df59d38f9 --- /dev/null +++ b/Spigot-API-Patches/0214-Support-components-in-ItemMeta.patch @@ -0,0 +1,77 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MiniDigger +Date: Sat, 6 Jun 2020 18:13:16 +0200 +Subject: [PATCH] Support components in ItemMeta + + +diff --git a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java +index 7e0b1d363829031075b6822d7b35ccde9fc05da9..5db838cab09888c3b3537e122e0e381a78e1dbb7 100644 +--- a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java ++++ b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java +@@ -42,6 +42,18 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste + @NotNull + String getDisplayName(); + ++ // Paper start ++ /** ++ * Gets the display name that is set. ++ *

++ * Plugins should check that hasDisplayName() returns true ++ * before calling this method. ++ * ++ * @return the display name that is set ++ */ ++ @NotNull ++ net.md_5.bungee.api.chat.BaseComponent[] getDisplayNameComponent(); ++ // Paper end + /** + * Sets the display name. + * +@@ -49,6 +61,14 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste + */ + void setDisplayName(@Nullable String name); + ++ // Paper start ++ /** ++ * Sets the display name. ++ * ++ * @param component the name component to set ++ */ ++ void setDisplayNameComponent(@Nullable net.md_5.bungee.api.chat.BaseComponent[] component); ++ // Paper end + /** + * Checks for existence of a localized name. + * +@@ -92,6 +112,17 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste + @Nullable + List getLore(); + ++ /** ++ * Gets the lore that is set. ++ *

++ * Plugins should check if hasLore() returns true before ++ * calling this method. ++ * ++ * @return a list of lore that is set ++ */ ++ @Nullable ++ List getLoreComponents(); ++ + /** + * Sets the lore for this item. + * Removes lore when given null. +@@ -100,6 +131,14 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste + */ + void setLore(@Nullable List lore); + ++ /** ++ * Sets the lore for this item. ++ * Removes lore when given null. ++ * ++ * @param lore the lore that will be set ++ */ ++ void setLoreComponents(@Nullable List lore); ++ + /** + * Checks for existence of custom model data. + *

diff --git a/Spigot-Server-Patches/0001-POM-Changes.patch b/Spigot-Server-Patches/0001-POM-Changes.patch index d0e2a7092..c0c8c10cb 100644 --- a/Spigot-Server-Patches/0001-POM-Changes.patch +++ b/Spigot-Server-Patches/0001-POM-Changes.patch @@ -5,7 +5,7 @@ Subject: [PATCH] POM Changes diff --git a/pom.xml b/pom.xml -index 9fc92e347f24a0210a9190513e93cba3b6772557..3554314526b3f33ad02df2adfd42d45118d75526 100644 +index db08e98c60084b16ee18455ce014a6ea305f89c5..52834690de9f07c9c4838dbef50031567c1a72dc 100644 --- a/pom.xml +++ b/pom.xml @@ -1,15 +1,14 @@ @@ -16,7 +16,7 @@ index 9fc92e347f24a0210a9190513e93cba3b6772557..3554314526b3f33ad02df2adfd42d451 - spigot + paper jar - 1.15.2-R0.1-SNAPSHOT + 1.16.1-R0.1-SNAPSHOT - Spigot - https://www.spigotmc.org/ + Paper @@ -27,7 +27,7 @@ index 9fc92e347f24a0210a9190513e93cba3b6772557..3554314526b3f33ad02df2adfd42d451 + UTF-8 unknown - 1.15.2 + 1.16.1 @@ -19,16 +18,22 @@ @@ -56,7 +56,7 @@ index 9fc92e347f24a0210a9190513e93cba3b6772557..3554314526b3f33ad02df2adfd42d451 compile @@ -50,6 +55,17 @@ - 7.3.1 + 8.0.1 compile + @@ -190,18 +190,18 @@ index 9fc92e347f24a0210a9190513e93cba3b6772557..3554314526b3f33ad02df2adfd42d451 diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 91e2d0b9d9f698f54b49636944a6282adcff5b4b..3fb78997d8c4d913770a9a6a35f34e2c61b896fa 100644 +index 4ac80c20ba970a2078fe62c452e7fdfb8ad0b46e..a5c4b7f28f13f0aad4712912f60ba5fc6785539a 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -186,7 +186,7 @@ public class Main { } - if (false && Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) { + if (Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) { - Date buildDate = new Date(Integer.parseInt(Main.class.getPackage().getImplementationVendor()) * 1000L); + Date buildDate = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").parse(Main.class.getPackage().getImplementationVendor()); // Paper Calendar deadline = Calendar.getInstance(); - deadline.add(Calendar.DAY_OF_YEAR, -21); + deadline.add(Calendar.DAY_OF_YEAR, -3); diff --git a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java b/src/main/java/org/bukkit/craftbukkit/util/Versioning.java index 93046379d0cefd5d3236fc59e698809acdc18f80..674096cab190d62622f9947853b056f57d43a2a5 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/Versioning.java diff --git a/Spigot-Server-Patches/0002-Paper-config-files.patch b/Spigot-Server-Patches/0002-Paper-config-files.patch index f8d47ac48..827cabcf4 100644 --- a/Spigot-Server-Patches/0002-Paper-config-files.patch +++ b/Spigot-Server-Patches/0002-Paper-config-files.patch @@ -268,10 +268,10 @@ index 0000000000000000000000000000000000000000..41c79650b169b87fbc70cf502438a545 +} 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..273cdb598b3606b962dcc92564c84ad351b7a74f +index 0000000000000000000000000000000000000000..68d3cb02dbfdc9d6f9d3682a2659c9430b50c490 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -0,0 +1,184 @@ +@@ -0,0 +1,185 @@ +package com.destroystokyo.paper; + +import com.google.common.base.Throwables; @@ -291,6 +291,7 @@ index 0000000000000000000000000000000000000000..273cdb598b3606b962dcc92564c84ad3 +import net.minecraft.server.MinecraftServer; +import org.bukkit.Bukkit; +import org.bukkit.command.Command; ++import org.bukkit.configuration.ConfigurationSection; +import org.bukkit.configuration.InvalidConfigurationException; +import org.bukkit.configuration.file.YamlConfiguration; + @@ -530,10 +531,10 @@ index 0000000000000000000000000000000000000000..a738657394bcccd859ef260a801736d4 + } +} diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 87c4b4c6b7793808308c0bfab957f9fd6425f452..beb6b63fa483f0a7b29f5403bebf7ee47b27cd29 100644 +index 062a82c37723b7f032103ba2904877ae79b1ae01..5585b5646b5f3650aa3b795be06f920699a85403 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -270,15 +270,15 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -273,15 +273,15 @@ public class ChunkProviderServer extends IChunkProvider { } } @@ -543,27 +544,27 @@ index 87c4b4c6b7793808308c0bfab957f9fd6425f452..beb6b63fa483f0a7b29f5403bebf7ee4 + @Override public boolean a(Entity entity) { long i = ChunkCoordIntPair.pair(MathHelper.floor(entity.locX()) >> 4, MathHelper.floor(entity.locZ()) >> 4); - return this.a(i, PlayerChunk::b); + return this.a(i, (Function>>) PlayerChunk::b); // CraftBukkit - decompile error } - @Override - public boolean a(ChunkCoordIntPair chunkcoordintpair) { + public final boolean isEntityTickingChunk(ChunkCoordIntPair chunkcoordintpair) { return this.a(chunkcoordintpair); } // Paper - OBFHELPER + @Override public boolean a(ChunkCoordIntPair chunkcoordintpair) { - return this.a(chunkcoordintpair.pair(), PlayerChunk::b); + return this.a(chunkcoordintpair.pair(), (Function>>) PlayerChunk::b); // CraftBukkit - decompile error } diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index 136d1b50f1cfe71aa5ce1495d9ffdf4a3cbd5aac..9eed98e3796be6d49dc51af9038a7376c94edeee 100644 +index 27e6872c675647d7e61040b76183dac4e347a40c..aa68eb71b131c1d529ded6c651621cfab071b3c4 100644 --- a/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java -@@ -170,6 +170,15 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - org.spigotmc.SpigotConfig.init((File) options.valueOf("spigot-settings")); +@@ -148,6 +148,15 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer + org.spigotmc.SpigotConfig.init((java.io.File) options.valueOf("spigot-settings")); org.spigotmc.SpigotConfig.registerCommands(); // Spigot end + // Paper start + try { -+ com.destroystokyo.paper.PaperConfig.init((File) options.valueOf("paper-settings")); ++ com.destroystokyo.paper.PaperConfig.init((java.io.File) options.valueOf("paper-settings")); + } catch (Exception e) { + DedicatedServer.LOGGER.error("Unable to load server configuration", e); + return false; @@ -571,14 +572,14 @@ index 136d1b50f1cfe71aa5ce1495d9ffdf4a3cbd5aac..9eed98e3796be6d49dc51af9038a7376 + com.destroystokyo.paper.PaperConfig.registerCommands(); + // Paper end - this.setSpawnAnimals(dedicatedserverproperties.spawnAnimals); - this.setSpawnNPCs(dedicatedserverproperties.spawnNpcs); + this.setPVP(dedicatedserverproperties.pvp); + this.setAllowFlight(dedicatedserverproperties.allowFlight); diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 9fddbae24c7cb7b24e3899714ced1375b928654f..f4863852b04c5fa55b79acabe40ce59909b9bbbd 100644 +index 4ee11b6fbbb49b1f52fe2cf64f77c1bdd2fd3907..51499ef45faa2bba5f180ee333c09af73d3b708e 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -135,9 +135,9 @@ public abstract class Entity implements INamableTileEntity, ICommandListener { - private static final DataWatcherObject aC = DataWatcher.a(Entity.class, DataWatcherRegistry.i); + private static final DataWatcherObject aA = DataWatcher.a(Entity.class, DataWatcherRegistry.i); protected static final DataWatcherObject POSE = DataWatcher.a(Entity.class, DataWatcherRegistry.s); public boolean inChunk; - public int chunkX; @@ -587,23 +588,23 @@ index 9fddbae24c7cb7b24e3899714ced1375b928654f..f4863852b04c5fa55b79acabe40ce599 + public int chunkX; public int getChunkX() { return chunkX; } // Paper - OBFHELPER + public int chunkY; public int getChunkY() { return chunkY; } // Paper - OBFHELPER + public int chunkZ; public int getChunkZ() { return chunkZ; } // Paper - OBFHELPER + private boolean aB; public long Z; public long aa; - public long ab; diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java -index 158cc1beb2d6b00642d025a5dd6797c4a20464bd..29e776ca19621b93d5b295d12f0576e6980cf11a 100644 +index 62f62c2c98fbaff163d9079091e6f39db2d77fa0..484e78746aa62bb0b12968165bf8e056b27152f3 100644 --- a/src/main/java/net/minecraft/server/EntityTypes.java +++ b/src/main/java/net/minecraft/server/EntityTypes.java -@@ -3,6 +3,7 @@ package net.minecraft.server; - import com.mojang.datafixers.DataFixUtils; - import java.util.Collections; +@@ -2,6 +2,7 @@ package net.minecraft.server; + + import com.google.common.collect.ImmutableSet; import java.util.Optional; +import java.util.Set; // Paper import java.util.UUID; import java.util.function.Function; import java.util.stream.Stream; -@@ -435,4 +436,10 @@ public class EntityTypes { - return new EntityTypes<>(this.a, this.b, this.c, this.d, this.e, this.f, this.g); +@@ -463,4 +464,10 @@ public class EntityTypes { + return new EntityTypes<>(this.a, this.b, this.d, this.e, this.f, this.g, this.c, this.j, this.h, this.i); } } + @@ -614,10 +615,10 @@ index 158cc1beb2d6b00642d025a5dd6797c4a20464bd..29e776ca19621b93d5b295d12f0576e6 + // Paper end } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index ad43b48073f5d59e6f6b5b2ec3de8cc9f03f9956..2e1eabba14a3757d03fd90741651001e78c6322f 100644 +index d5e1da2eeea7c06289f52509af844df59e8a29b2..63d3d43f74bed94cd03aa3b7254e66302be861d5 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -70,6 +70,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -77,6 +77,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable { public boolean populating; public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot @@ -626,27 +627,27 @@ index ad43b48073f5d59e6f6b5b2ec3de8cc9f03f9956..2e1eabba14a3757d03fd90741651001e public final SpigotTimings.WorldTimingsHandler timings; // Spigot public static BlockPosition lastPhysicsProblem; // Spigot private org.spigotmc.TickLimiter entityLimiter; -@@ -90,6 +92,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -93,6 +95,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - protected World(WorldData worlddata, DimensionManager dimensionmanager, BiFunction bifunction, GameProfilerFiller gameprofilerfiller, boolean flag, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env) { - this.spigotConfig = new org.spigotmc.SpigotWorldConfig( worlddata.getName() ); // Spigot + protected World(WorldDataMutable worlddatamutable, ResourceKey resourcekey, ResourceKey resourcekey1, DimensionManager dimensionmanager, Supplier supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env) { + this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((WorldDataServer) worlddatamutable).getName()); // Spigot + this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(worlddata.getName(), this.spigotConfig); // Paper this.generator = gen; 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 be30f6bf6a978dfe14af1aca1099cb9a6f7ab443..ad1dcf53040695a1b3194efa92b549172bea56ec 100644 +index d05c57ce64b7d880ffd7dbd387d56f05f05cd3f0..239fa2404859d233161764cceec5cd0fc37899b9 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -769,6 +769,7 @@ public final class CraftServer implements Server { +@@ -803,6 +803,7 @@ public final class CraftServer implements Server { } org.spigotmc.SpigotConfig.init((File) console.options.valueOf("spigot-settings")); // Spigot + com.destroystokyo.paper.PaperConfig.init((File) console.options.valueOf("paper-settings")); // Paper for (WorldServer world : console.getWorlds()) { - world.worldData.setDifficulty(config.difficulty); + world.worldDataServer.setDifficulty(config.difficulty); world.setSpawnFlags(config.spawnMonsters, config.spawnAnimals); -@@ -796,6 +797,7 @@ public final class CraftServer implements Server { +@@ -836,6 +837,7 @@ public final class CraftServer implements Server { world.ticksPerAmbientSpawns = this.getTicksPerAmbientSpawns(); } world.spigotConfig.init(); // Spigot @@ -654,7 +655,7 @@ index be30f6bf6a978dfe14af1aca1099cb9a6f7ab443..ad1dcf53040695a1b3194efa92b54917 } pluginManager.clearPlugins(); -@@ -803,6 +805,7 @@ public final class CraftServer implements Server { +@@ -843,6 +845,7 @@ public final class CraftServer implements Server { resetRecipes(); reloadData(); org.spigotmc.SpigotConfig.registerCommands(); // Spigot @@ -662,7 +663,7 @@ index be30f6bf6a978dfe14af1aca1099cb9a6f7ab443..ad1dcf53040695a1b3194efa92b54917 overrideAllCommandBlockCommands = commandsConfiguration.getStringList("command-block-overrides").contains("*"); ignoreVanillaPermissions = commandsConfiguration.getBoolean("ignore-vanilla-permissions"); -@@ -2000,4 +2003,35 @@ public final class CraftServer implements Server { +@@ -2079,4 +2082,35 @@ public final class CraftServer implements Server { { return spigot; } @@ -699,7 +700,7 @@ index be30f6bf6a978dfe14af1aca1099cb9a6f7ab443..ad1dcf53040695a1b3194efa92b54917 + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 3fb78997d8c4d913770a9a6a35f34e2c61b896fa..daa65aaf8c9616e5e058f3337fc4fc0895d13364 100644 +index a5c4b7f28f13f0aad4712912f60ba5fc6785539a..3d15661eb1f15f74213ecb7e8eceb1f231ad2c1c 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -129,6 +129,14 @@ public class Main { @@ -718,7 +719,7 @@ index 3fb78997d8c4d913770a9a6a35f34e2c61b896fa..daa65aaf8c9616e5e058f3337fc4fc08 }; diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index a52cbba6e681bc96a15a3eea62831a1628f921a7..98ed975a6241395b6119d5b3a62d24329aa1f05b 100644 +index 0005d4226467cc25b55f9863eb5b7aaeb4dd6917..5c394d26e2d2dbc5d65e38c1273b7e5d02464f3a 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java +++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -39,36 +39,36 @@ public class SpigotWorldConfig diff --git a/Spigot-Server-Patches/0003-MC-Dev-fixes.patch b/Spigot-Server-Patches/0003-MC-Dev-fixes.patch index 315c5c35b..4a58b7cc1 100644 --- a/Spigot-Server-Patches/0003-MC-Dev-fixes.patch +++ b/Spigot-Server-Patches/0003-MC-Dev-fixes.patch @@ -49,111 +49,224 @@ index a3afe60b0d85cf90bf7a170dc0a0b61a796381a7..85f799a713db0c822d46b689010f9f6b } else { System.arraycopy(this.b, 0, au, 0, this.c); if (au.length > this.c) { -diff --git a/src/main/java/net/minecraft/server/BehaviorFindPosition.java b/src/main/java/net/minecraft/server/BehaviorFindPosition.java -index 37006ec1bbb8fa285257edacdf337591595852a2..35eb3a5a61145e94d5b0c77c0eb13bfa46fac23b 100644 ---- a/src/main/java/net/minecraft/server/BehaviorFindPosition.java -+++ b/src/main/java/net/minecraft/server/BehaviorFindPosition.java -@@ -53,7 +53,7 @@ public class BehaviorFindPosition extends Behavior { - villageplace.a(this.a.c(), (blockposition1) -> { - return blockposition1.equals(blockposition); - }, blockposition, 1); -- entitycreature.getBehaviorController().setMemory(this.b, (Object) GlobalPos.create(worldserver.getWorldProvider().getDimensionManager(), blockposition)); -+ entitycreature.getBehaviorController().setMemory(this.b, GlobalPos.create(worldserver.getWorldProvider().getDimensionManager(), blockposition)); - PacketDebug.c(worldserver, blockposition); - }); - } else if (this.f < 5) { diff --git a/src/main/java/net/minecraft/server/BiomeBase.java b/src/main/java/net/minecraft/server/BiomeBase.java -index 960dce23072bbb5fad36760677f0fe2efb661552..253890e53702f9ba1c6628cc860a4ca10756626a 100644 +index 6c2ed9c1b8567abcdb11bdc3dbaeed217a2f61e7..ae0ac8d383ca11a683465d8c83a8b8a66e567079 100644 --- a/src/main/java/net/minecraft/server/BiomeBase.java +++ b/src/main/java/net/minecraft/server/BiomeBase.java -@@ -54,7 +54,7 @@ public abstract class BiomeBase { +@@ -26,76 +26,31 @@ import org.apache.logging.log4j.Logger; + public class BiomeBase { + + public static final Logger LOGGER = LogManager.getLogger(); +- public static final Codec b = RecordCodecBuilder.create((instance) -> { +- RecordCodecBuilder recordcodecbuilder = BiomeBase.Precipitation.d.fieldOf("precipitation").forGetter((biomebase) -> { +- return biomebase.o; +- }); +- RecordCodecBuilder recordcodecbuilder1 = BiomeBase.Geography.r.fieldOf("category").forGetter((biomebase) -> { +- return biomebase.n; +- }); +- RecordCodecBuilder recordcodecbuilder2 = Codec.FLOAT.fieldOf("depth").forGetter((biomebase) -> { +- return biomebase.h; +- }); +- RecordCodecBuilder recordcodecbuilder3 = Codec.FLOAT.fieldOf("scale").forGetter((biomebase) -> { +- return biomebase.i; +- }); +- RecordCodecBuilder recordcodecbuilder4 = Codec.FLOAT.fieldOf("temperature").forGetter((biomebase) -> { +- return biomebase.j; +- }); +- RecordCodecBuilder recordcodecbuilder5 = Codec.FLOAT.fieldOf("downfall").forGetter((biomebase) -> { +- return biomebase.k; +- }); +- RecordCodecBuilder recordcodecbuilder6 = BiomeFog.a.fieldOf("effects").forGetter((biomebase) -> { +- return biomebase.p; +- }); +- RecordCodecBuilder recordcodecbuilder7 = Codec.INT.fieldOf("sky_color").forGetter((biomebase) -> { +- return biomebase.t; +- }); +- RecordCodecBuilder recordcodecbuilder8 = WorldGenSurfaceComposite.a.fieldOf("surface_builder").forGetter((biomebase) -> { +- return biomebase.m; +- }); +- Codec codec = WorldGenStage.Features.c; +- Codec codec1 = WorldGenCarverWrapper.a.listOf(); +- Logger logger = BiomeBase.LOGGER; +- +- logger.getClass(); +- RecordCodecBuilder recordcodecbuilder9 = Codec.simpleMap(codec, codec1.promotePartial(SystemUtils.a("Carver: ", logger::error)), INamable.a(WorldGenStage.Features.values())).fieldOf("carvers").forGetter((biomebase) -> { +- return biomebase.q; +- }); +- +- codec1 = WorldGenStage.Decoration.k; +- Codec codec2 = WorldGenFeatureConfigured.b.listOf(); +- Logger logger1 = BiomeBase.LOGGER; +- +- logger1.getClass(); +- RecordCodecBuilder recordcodecbuilder10 = Codec.simpleMap(codec1, codec2.promotePartial(SystemUtils.a("Feature: ", logger1::error)), INamable.a(WorldGenStage.Decoration.values())).fieldOf("features").forGetter((biomebase) -> { +- return biomebase.r; +- }); +- +- codec2 = StructureFeature.a.listOf(); +- logger1 = BiomeBase.LOGGER; +- logger1.getClass(); +- RecordCodecBuilder recordcodecbuilder11 = codec2.promotePartial(SystemUtils.a("Structure start: ", logger1::error)).fieldOf("starts").forGetter((biomebase) -> { +- return (List) biomebase.u.values().stream().sorted(Comparator.comparing((structurefeature) -> { +- return IRegistry.STRUCTURE_FEATURE.getKey(structurefeature.b); +- })).collect(Collectors.toList()); +- }); +- Codec codec3 = EnumCreatureType.g; +- Codec codec4 = BiomeBase.BiomeMeta.b.listOf(); +- Logger logger2 = BiomeBase.LOGGER; +- +- logger2.getClass(); +- return instance.group(recordcodecbuilder, recordcodecbuilder1, recordcodecbuilder2, recordcodecbuilder3, recordcodecbuilder4, recordcodecbuilder5, recordcodecbuilder6, recordcodecbuilder7, recordcodecbuilder8, recordcodecbuilder9, recordcodecbuilder10, recordcodecbuilder11, Codec.simpleMap(codec3, codec4.promotePartial(SystemUtils.a("Spawn data: ", logger2::error)), INamable.a(EnumCreatureType.values())).fieldOf("spawners").forGetter((biomebase) -> { +- return biomebase.v; +- }), BiomeBase.d.a.listOf().fieldOf("climate_parameters").forGetter((biomebase) -> { +- return biomebase.x; +- }), Codec.STRING.optionalFieldOf("parent").forGetter((biomebase) -> { +- return Optional.ofNullable(biomebase.l); +- })).apply(instance, BiomeBase::new); ++ // Paper decompile error - Spigots stupid decompiler ++ public static final Codec b = RecordCodecBuilder.create(i -> { ++ Codec k1 = WorldGenStage.Decoration.k; // Erase type - WorldGenstage.Decoration has wrong type ++ return i.group( ++ Precipitation.d.fieldOf("precipitation").forGetter(biome -> biome.o), ++ Geography.r.fieldOf("category").forGetter(biome -> biome.n), ++ Codec.FLOAT.fieldOf("depth").forGetter(biome -> biome.h), ++ Codec.FLOAT.fieldOf("scale").forGetter(biome -> biome.i), ++ Codec.FLOAT.fieldOf("temperature").forGetter(biome -> biome.j), ++ Codec.FLOAT.fieldOf("downfall").forGetter(biome -> biome.k), ++ BiomeFog.a.fieldOf("effects").forGetter(biome -> biome.p), ++ Codec.INT.fieldOf("sky_color").forGetter(biome -> biome.t), ++ WorldGenSurfaceComposite.a.fieldOf("surface_builder").forGetter(biome -> biome.m), ++ Codec.simpleMap(WorldGenStage.Features.c, WorldGenCarverWrapper.a.listOf().promotePartial(SystemUtils.a("Carver: ", LOGGER::error)), INamable.a(WorldGenStage.Features.values())).fieldOf("carvers").forGetter(biome -> biome.q), ++ Codec.simpleMap((Codec) k1, WorldGenFeatureConfigured.b.listOf().promotePartial(SystemUtils.a("Feature: ", LOGGER::error)), INamable.a(WorldGenStage.Decoration.values())).fieldOf("features").forGetter(biome -> biome.r), ++ StructureFeature.a.listOf().promotePartial(SystemUtils.a("Structure start: ", LOGGER::error)).fieldOf("starts").forGetter(biome -> biome.u.values().stream().sorted(Comparator.comparing(cf -> IRegistry.STRUCTURE_FEATURE.getKey(cf.b))).collect(Collectors.toList())), ++ Codec.simpleMap(EnumCreatureType.g, BiomeMeta.b.listOf().promotePartial(SystemUtils.a("Spawn data: ", LOGGER::error)), INamable.a(EnumCreatureType.values())).fieldOf("spawners").forGetter(biome -> biome.v), ++ d.a.listOf().fieldOf("climate_parameters").forGetter(biome -> biome.x), ++ Codec.STRING.optionalFieldOf("parent").forGetter(biome -> Optional.ofNullable(biome.l)) ++ ).apply(i, BiomeBase::new); ++ // Paper end + }); + public static final Set c = Sets.newHashSet(); +- public static final RegistryBlockID d = new RegistryBlockID<>(); +- protected static final NoiseGenerator3 e = new NoiseGenerator3(new SeededRandom(1234L), ImmutableList.of(0)); ++ public static final RegistryBlockID reg = new RegistryBlockID<>(); // Paper - decompile error - rename ++ protected static final NoiseGenerator3 NOISE_GENERATOR_3 = new NoiseGenerator3(new SeededRandom(1234L), ImmutableList.of(0)); // Paper - decompile error - rename + public static final NoiseGenerator3 f = new NoiseGenerator3(new SeededRandom(2345L), ImmutableList.of(0)); + @Nullable + protected String g; +@@ -130,7 +85,7 @@ public class BiomeBase { @Nullable public static BiomeBase a(BiomeBase biomebase) { -- return (BiomeBase) BiomeBase.c.fromId(IRegistry.BIOME.a((Object) biomebase)); -+ return (BiomeBase) BiomeBase.c.fromId(IRegistry.BIOME.a(biomebase)); // Paper - decompile fix +- return (BiomeBase) BiomeBase.d.fromId(IRegistry.BIOME.a((Object) biomebase)); ++ return (BiomeBase) BiomeBase.reg.fromId(IRegistry.BIOME.a(biomebase)); // Paper - decompile fix / rename } public static WorldGenCarverWrapper a(WorldGenCarverAbstract worldgencarverabstract, C c0) { -@@ -236,7 +236,7 @@ public abstract class BiomeBase { +@@ -197,7 +152,7 @@ public class BiomeBase { + }, Function.identity())); + this.v = map2; + this.x = list1; +- this.l = (String) optional.orElse((Object) null); ++ this.l = (String) optional.orElse(null); // Paper - decompile fix + Stream stream = map1.values().stream().flatMap(Collection::stream).filter((worldgenfeatureconfigured) -> { + return worldgenfeatureconfigured.d == WorldGenerator.DECORATED_FLOWER; + }); +@@ -250,7 +205,7 @@ public class BiomeBase { - @Nullable - public C b(StructureGenerator structuregenerator) { -- return (WorldGenFeatureConfiguration) this.t.get(structuregenerator); -+ return (C) this.t.get(structuregenerator); // Paper - decompile fix - } + protected float a(BlockPosition blockposition) { + if (blockposition.getY() > 64) { +- float f = (float) (BiomeBase.e.a((double) ((float) blockposition.getX() / 8.0F), (double) ((float) blockposition.getZ() / 8.0F), false) * 4.0D); ++ float f = (float) (BiomeBase.NOISE_GENERATOR_3.a((double) ((float) blockposition.getX() / 8.0F), (double) ((float) blockposition.getZ() / 8.0F), false) * 4.0D); // Paper - decompile error - rename - public List> g() { -diff --git a/src/main/java/net/minecraft/server/BlockDataAbstract.java b/src/main/java/net/minecraft/server/BlockDataAbstract.java -index ab03b556823a3daee07cc6a57112d01ee52b677f..1cf97cefc9d113583214f340e72b35d5560d1e5d 100644 ---- a/src/main/java/net/minecraft/server/BlockDataAbstract.java -+++ b/src/main/java/net/minecraft/server/BlockDataAbstract.java -@@ -29,7 +29,7 @@ public abstract class BlockDataAbstract implements IBlockDataHolder { - } - - private > String a(IBlockState iblockstate, Comparable comparable) { -- return iblockstate.a(comparable); -+ return iblockstate.a((T) comparable); // Paper - decompiler fix - } - }; - protected final O a; -@@ -42,11 +42,11 @@ public abstract class BlockDataAbstract implements IBlockDataHolder { - } - - public > S a(IBlockState iblockstate) { -- return this.set(iblockstate, (Comparable) a(iblockstate.getValues(), this.get(iblockstate))); -+ return this.set(iblockstate, a(iblockstate.getValues(), this.get(iblockstate))); // Paper - decompile fix - } - - protected static T a(Collection collection, T t0) { -- Iterator iterator = collection.iterator(); -+ Iterator iterator = collection.iterator(); // Paper - decompiler fix - - do { - if (!iterator.hasNext()) { -@@ -89,7 +89,7 @@ public abstract class BlockDataAbstract implements IBlockDataHolder { - if (comparable == null) { - throw new IllegalArgumentException("Cannot get property " + iblockstate + " as it does not exist in " + this.a); + return this.getTemperature() - (f + (float) blockposition.getY() - 64.0F) * 0.05F / 30.0F; } else { -- return (Comparable) iblockstate.b().cast(comparable); -+ return iblockstate.b().cast(comparable); // Paper - decompiler fix +diff --git a/src/main/java/net/minecraft/server/BiomeFrozenDeepOcean.java b/src/main/java/net/minecraft/server/BiomeFrozenDeepOcean.java +index 2ac69bf2ae5cbb763fc95c948725373a5c9b95b3..fdc66fc1e3440b6678a1318e9a109f2b41bc8847 100644 +--- a/src/main/java/net/minecraft/server/BiomeFrozenDeepOcean.java ++++ b/src/main/java/net/minecraft/server/BiomeFrozenDeepOcean.java +@@ -58,7 +58,7 @@ public class BiomeFrozenDeepOcean extends BiomeBase { } - } -@@ -100,7 +100,7 @@ public abstract class BlockDataAbstract implements IBlockDataHolder { - if (comparable == null) { - throw new IllegalArgumentException("Cannot set property " + iblockstate + " as it does not exist in " + this.a); - } else if (comparable == v0) { -- return this; -+ return (S) this; // Paper - decompiler fix + if (blockposition.getY() > 64) { +- float f1 = (float) (BiomeFrozenDeepOcean.e.a((double) ((float) blockposition.getX() / 8.0F), (double) ((float) blockposition.getZ() / 8.0F), false) * 4.0D); ++ float f1 = (float) (BiomeFrozenDeepOcean.NOISE_GENERATOR_3.a((double) ((float) blockposition.getX() / 8.0F), (double) ((float) blockposition.getZ() / 8.0F), false) * 4.0D); // Paper - rename + + return f - (f1 + (float) blockposition.getY() - 64.0F) * 0.05F / 30.0F; } else { - S s0 = this.e.get(iblockstate, v0); +diff --git a/src/main/java/net/minecraft/server/BiomeFrozenOcean.java b/src/main/java/net/minecraft/server/BiomeFrozenOcean.java +index 0d0ccaec8c497c9d222c7593684ed2d913d1881e..4b18e29ccb0cb15568367abb507b844011bd7f80 100644 +--- a/src/main/java/net/minecraft/server/BiomeFrozenOcean.java ++++ b/src/main/java/net/minecraft/server/BiomeFrozenOcean.java +@@ -57,7 +57,7 @@ public final class BiomeFrozenOcean extends BiomeBase { + } + if (blockposition.getY() > 64) { +- float f1 = (float) (BiomeFrozenOcean.e.a((double) ((float) blockposition.getX() / 8.0F), (double) ((float) blockposition.getZ() / 8.0F), false) * 4.0D); ++ float f1 = (float) (BiomeFrozenOcean.NOISE_GENERATOR_3.a((double) ((float) blockposition.getX() / 8.0F), (double) ((float) blockposition.getZ() / 8.0F), false) * 4.0D); // Paper - rename + + return f - (f1 + (float) blockposition.getY() - 64.0F) * 0.05F / 30.0F; + } else { +diff --git a/src/main/java/net/minecraft/server/Biomes.java b/src/main/java/net/minecraft/server/Biomes.java +index 0aa66addb2cb472b2ab90000d3f0e0f967353e0f..eaa527f4fe289a9492b12591154a60e5aa045252 100644 +--- a/src/main/java/net/minecraft/server/Biomes.java ++++ b/src/main/java/net/minecraft/server/Biomes.java +@@ -88,7 +88,7 @@ public abstract class Biomes { + private static BiomeBase a(int i, String s, BiomeBase biomebase) { + IRegistry.a(IRegistry.BIOME, i, s, biomebase); + if (biomebase.b()) { +- BiomeBase.d.a(biomebase, IRegistry.BIOME.a(IRegistry.BIOME.get(new MinecraftKey(biomebase.l)))); ++ BiomeBase.reg.a(biomebase, IRegistry.BIOME.a(IRegistry.BIOME.get(new MinecraftKey(biomebase.l)))); + } + + return biomebase; diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java -index e40f9c153b4f1f8f11ea467e6bd8e670959282d6..c88a62f6b72a8851b95587bb49c898569d74e0c6 100644 +index 8eb94bcb605f882c9ce096fc758df5e3ae3ab28d..886b43e2b8f21c358b4d6785c677f14c91d191f3 100644 --- a/src/main/java/net/minecraft/server/BlockPosition.java +++ b/src/main/java/net/minecraft/server/BlockPosition.java -@@ -57,12 +57,12 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali - OfInt ofint = dynamic.asIntStream().spliterator(); - int[] aint = new int[3]; +@@ -220,8 +220,8 @@ public class BlockPosition extends BaseBlockPosition { + }; + } -- if (ofint.tryAdvance((i) -> { -+ if (ofint.tryAdvance((Consumer) (i) -> { // Paper - decomile fix - aint[0] = i; -- }) && ofint.tryAdvance((i) -> { -+ }) && ofint.tryAdvance((Consumer) (i) -> { // Paper - decompile fix - aint[1] = i; - })) { -- ofint.tryAdvance((i) -> { -+ ofint.tryAdvance((Consumer) (i) -> { // Paper - decompile fix - aint[2] = i; - }); - } +- public static Iterable a(BlockPosition blockposition, int i, int j, int k) { +- int l = i + j + k; ++ public static Iterable a(BlockPosition blockposition, int p_i, int p_j, int p_k) { // Paper - decompile issues - variable name conflicts to inner class field refs ++ int l_decompiled = p_i + p_j + p_k; // Paper - decompile issues + int i1 = blockposition.getX(); + int j1 = blockposition.getY(); + int k1 = blockposition.getZ(); +@@ -249,15 +249,15 @@ public class BlockPosition extends BaseBlockPosition { + ++this.l; + if (this.l > this.j) { + ++this.i; +- if (this.i > l) { ++ if (this.i > l_decompiled) { // Paper - use proper l above (first line of this method) + return (BlockPosition) this.endOfData(); + } + +- this.j = Math.min(i, this.i); ++ this.j = Math.min(p_i, this.i); // Paper - decompile issues + this.l = -this.j; + } + +- this.k = Math.min(j, this.i - Math.abs(this.l)); ++ this.k = Math.min(p_j, this.i - Math.abs(this.l)); // Paper - decompile issues + this.m = -this.k; + } + +@@ -265,7 +265,7 @@ public class BlockPosition extends BaseBlockPosition { + int i2 = this.m; + int j2 = this.i - Math.abs(l1) - Math.abs(i2); + +- if (j2 <= k) { ++ if (j2 <= p_k) { // Paper - decompile issues + this.n = j2 != 0; + blockposition_mutableblockposition = this.h.d(i1 + l1, j1 + i2, k1 + j2); + } diff --git a/src/main/java/net/minecraft/server/BlockStateEnum.java b/src/main/java/net/minecraft/server/BlockStateEnum.java -index 28cfbaae287653d21e06f0017396b937e99fc3ad..1486d460c8ec3d117b4dc3d28b2c3f1b632e187b 100644 +index 771841e08591955e61c7bcc5b09c8457652c1b9c..8162c11d14b8e88c2b572f9ddf6b7a15977047f8 100644 --- a/src/main/java/net/minecraft/server/BlockStateEnum.java +++ b/src/main/java/net/minecraft/server/BlockStateEnum.java -@@ -20,10 +20,10 @@ public class BlockStateEnum & INamable> extends BlockState +@@ -20,10 +20,10 @@ public class BlockStateEnum & INamable> extends IBlockState protected BlockStateEnum(String s, Class oclass, Collection collection) { super(s, oclass); this.a = ImmutableSet.copyOf(collection); @@ -166,24 +279,11 @@ index 28cfbaae287653d21e06f0017396b937e99fc3ad..1486d460c8ec3d117b4dc3d28b2c3f1b String s1 = ((INamable) t0).getName(); if (this.b.containsKey(s1)) { -diff --git a/src/main/java/net/minecraft/server/ChunkStatus.java b/src/main/java/net/minecraft/server/ChunkStatus.java -index 68a601bac587294b46a79be6df7ee4e6e38e5f28..efdf611e66ffd782291de749d8a48f3bf08f2129 100644 ---- a/src/main/java/net/minecraft/server/ChunkStatus.java -+++ b/src/main/java/net/minecraft/server/ChunkStatus.java -@@ -84,7 +84,7 @@ public class ChunkStatus { - return (CompletableFuture) function.apply(ichunkaccess); - }); - private static final List q = ImmutableList.of(ChunkStatus.FULL, ChunkStatus.FEATURES, ChunkStatus.LIQUID_CARVERS, ChunkStatus.STRUCTURE_STARTS, ChunkStatus.STRUCTURE_STARTS, ChunkStatus.STRUCTURE_STARTS, ChunkStatus.STRUCTURE_STARTS, ChunkStatus.STRUCTURE_STARTS, ChunkStatus.STRUCTURE_STARTS, ChunkStatus.STRUCTURE_STARTS, ChunkStatus.STRUCTURE_STARTS); -- private static final IntList r = (IntList) SystemUtils.a((Object) (new IntArrayList(a().size())), (intarraylist) -> { -+ private static final IntList r = (IntList) SystemUtils.a((new IntArrayList(a().size())), (java.util.function.Consumer)(IntArrayList intarraylist) -> { // Paper - decompile fix - int i = 0; - - for (int j = a().size() - 1; j >= 0; --j) { diff --git a/src/main/java/net/minecraft/server/CraftingManager.java b/src/main/java/net/minecraft/server/CraftingManager.java -index ca9ed573914558d51318c713b14665480efdc5bf..f0d7a91fa06632d5731e277a9199aa9804d3a96a 100644 +index fbb708f5f7e4d2da9d96b595498da436b088a408..f27c7041cdc2f062f0abb222b02026194ab33c60 100644 --- a/src/main/java/net/minecraft/server/CraftingManager.java +++ b/src/main/java/net/minecraft/server/CraftingManager.java -@@ -63,7 +63,7 @@ public class CraftingManager extends ResourceDataJson { +@@ -64,7 +64,7 @@ public class CraftingManager extends ResourceDataJson { } this.recipes = (Map) map1.entrySet().stream().collect(ImmutableMap.toImmutableMap(Entry::getKey, (entry1) -> { @@ -193,7 +293,7 @@ index ca9ed573914558d51318c713b14665480efdc5bf..f0d7a91fa06632d5731e277a9199aa98 CraftingManager.LOGGER.info("Loaded {} recipes", map1.size()); } diff --git a/src/main/java/net/minecraft/server/EntityVindicator.java b/src/main/java/net/minecraft/server/EntityVindicator.java -index 7d44348c78b0e468cef5c137d3a69aeb5704d881..73ecdd22ea1157abe00795d90c3e7b748650dbc8 100644 +index 4ab6e82a1415c40f3e2eee7414bf7de97f53b420..9c152b79164710d3d4175d0acbc9548d61390097 100644 --- a/src/main/java/net/minecraft/server/EntityVindicator.java +++ b/src/main/java/net/minecraft/server/EntityVindicator.java @@ -25,7 +25,7 @@ public class EntityVindicator extends EntityIllagerAbstract { @@ -205,21 +305,8 @@ index 7d44348c78b0e468cef5c137d3a69aeb5704d881..73ecdd22ea1157abe00795d90c3e7b74 this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, true)); this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityVillagerAbstract.class, true)); this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityIronGolem.class, true)); -diff --git a/src/main/java/net/minecraft/server/Fluid.java b/src/main/java/net/minecraft/server/Fluid.java -index 035f05e82769445f213c225a731db6d95626f6cd..7c9ba128620f54c9cd691d350d1ee225d867fe70 100644 ---- a/src/main/java/net/minecraft/server/Fluid.java -+++ b/src/main/java/net/minecraft/server/Fluid.java -@@ -74,7 +74,7 @@ public interface Fluid extends IBlockDataHolder { - if (immutablemap.isEmpty()) { - object = dynamicops.createMap(ImmutableMap.of(dynamicops.createString("Name"), dynamicops.createString(IRegistry.FLUID.getKey(fluid.getType()).toString()))); - } else { -- object = dynamicops.createMap(ImmutableMap.of(dynamicops.createString("Name"), dynamicops.createString(IRegistry.FLUID.getKey(fluid.getType()).toString()), dynamicops.createString("Properties"), dynamicops.createMap((Map) immutablemap.entrySet().stream().map((entry) -> { -+ object = dynamicops.createMap(ImmutableMap.of(dynamicops.createString("Name"), dynamicops.createString(IRegistry.FLUID.getKey(fluid.getType()).toString()), dynamicops.createString("Properties"), dynamicops.createMap(immutablemap.entrySet().stream().map((entry) -> { // Paper - decompile fix - return Pair.of(dynamicops.createString(((IBlockState) entry.getKey()).a()), dynamicops.createString(IBlockDataHolder.b((IBlockState) entry.getKey(), (Comparable) entry.getValue()))); - }).collect(Collectors.toMap(Pair::getFirst, Pair::getSecond))))); - } diff --git a/src/main/java/net/minecraft/server/IAsyncTaskHandler.java b/src/main/java/net/minecraft/server/IAsyncTaskHandler.java -index 447f6a55b619402447b5cf4db9b22ea8cfc7d51d..1890c760f9ffd7628d6ae3db40c36f5272379227 100644 +index 8886cedfe8809fe4711b5f2451e3e6456d2a6513..b77a0f0c2ee30df44b113aa6c8d4fa9206d3e2ba 100644 --- a/src/main/java/net/minecraft/server/IAsyncTaskHandler.java +++ b/src/main/java/net/minecraft/server/IAsyncTaskHandler.java @@ -55,7 +55,7 @@ public abstract class IAsyncTaskHandler implements Mailbox implements +diff --git a/src/main/java/net/minecraft/server/IBlockState.java b/src/main/java/net/minecraft/server/IBlockState.java +index 88f1f201240ef0479c4f0f93f4caca454bbe7e9e..d63a4e4916ed5f5d901be0f4dd2c13cf66239055 100644 +--- a/src/main/java/net/minecraft/server/IBlockState.java ++++ b/src/main/java/net/minecraft/server/IBlockState.java +@@ -16,12 +16,10 @@ public abstract class IBlockState> { + private final Codec> e; - public static Dynamic a(DynamicOps dynamicops, IBlockData iblockdata) { - ImmutableMap, Comparable> immutablemap = iblockdata.getStateMap(); -- Object object; -+ T object; // Paper - decompile fix - - if (immutablemap.isEmpty()) { - object = dynamicops.createMap(ImmutableMap.of(dynamicops.createString("Name"), dynamicops.createString(IRegistry.BLOCK.getKey(iblockdata.getBlock()).toString()))); - } else { -- object = dynamicops.createMap(ImmutableMap.of(dynamicops.createString("Name"), dynamicops.createString(IRegistry.BLOCK.getKey(iblockdata.getBlock()).toString()), dynamicops.createString("Properties"), dynamicops.createMap((Map) immutablemap.entrySet().stream().map((entry) -> { -+ object = dynamicops.createMap(ImmutableMap.of(dynamicops.createString("Name"), dynamicops.createString(IRegistry.BLOCK.getKey(iblockdata.getBlock()).toString()), dynamicops.createString("Properties"), dynamicops.createMap(immutablemap.entrySet().stream().map((entry) -> { // Paper - decompile fix - return Pair.of(dynamicops.createString(((IBlockState) entry.getKey()).a()), dynamicops.createString(IBlockDataHolder.b((IBlockState) entry.getKey(), (Comparable) entry.getValue()))); - }).collect(Collectors.toMap(Pair::getFirst, Pair::getSecond))))); - } -@@ -348,9 +348,9 @@ public class IBlockData extends BlockDataAbstract implements - if (!iblockdata.o()) { - this.f = null; - } else { -- this.f = new VoxelShape[IBlockData.a.a.length]; -+ this.f = new VoxelShape[a.length]; // Paper - decompile fix - VoxelShape voxelshape = block.i(iblockdata, BlockAccessAir.INSTANCE, BlockPosition.ZERO); -- EnumDirection[] aenumdirection = IBlockData.a.a; -+ EnumDirection[] aenumdirection = a; // Paper - decompile fix - - i = aenumdirection.length; - -@@ -366,7 +366,7 @@ public class IBlockData extends BlockDataAbstract implements - return this.g.b(enumdirection_enumaxis) < 0.0D || this.g.c(enumdirection_enumaxis) > 1.0D; - }); - this.i = new boolean[6]; -- EnumDirection[] aenumdirection1 = IBlockData.a.a; -+ EnumDirection[] aenumdirection1 = a; // Paper - decompile fix - int k = aenumdirection1.length; - - for (i = 0; i < k; ++i) { + protected IBlockState(String s, Class oclass) { +- this.d = Codec.STRING.comapFlatMap((s1) -> { +- return (DataResult) this.b(s1).map(DataResult::success).orElseGet(() -> { +- return DataResult.error("Unable to read property: " + this + " with value: " + s1); +- }); +- }, this::a); +- this.e = this.d.xmap(this::b, IBlockState.a::b); ++ this.d = Codec.STRING.comapFlatMap((s1) -> this.b(s1).map(DataResult::success).orElseGet(() -> { // Paper - decompile error ++ return DataResult.error("Unable to read property: " + this + " with value: " + s1); ++ }), this::a); ++ this.e = this.d.xmap(this::b, (IBlockState.a param) -> param.b()); // Paper - decompile fix + this.a = oclass; + this.b = s; + } diff --git a/src/main/java/net/minecraft/server/IEntityAccess.java b/src/main/java/net/minecraft/server/IEntityAccess.java -index 534e70671a624e58ed98df9dd62bd7f5ffdf91af..d5c284cdd10d33f5f1b7f456d6a384a44eafb139 100644 +index 2517b70ddeb985ae7d708c6a1708b42c6a67dd00..c469b5db81fb040fc27cd2e4f7cd61797f56a62d 100644 --- a/src/main/java/net/minecraft/server/IEntityAccess.java +++ b/src/main/java/net/minecraft/server/IEntityAccess.java -@@ -47,7 +47,7 @@ public interface IEntityAccess { - return Stream.empty(); - } else { - AxisAlignedBB axisalignedbb1 = axisalignedbb.g(1.0E-7D); -- Stream stream = this.getEntities(entity, axisalignedbb1).stream().filter((entity1) -> { -+ Stream stream = this.getEntities(entity, axisalignedbb1).stream().filter((entity1) -> { // Paper - decompile fix - return !set.contains(entity1); - }).filter((entity1) -> { - return entity == null || !entity.isSameVehicle(entity1); -@@ -55,7 +55,6 @@ public interface IEntityAccess { - return Stream.of(entity1.au(), entity == null ? null : entity.j(entity1)); - }).filter(Objects::nonNull); - -- axisalignedbb1.getClass(); - return stream.filter(axisalignedbb1::c).map(VoxelShapes::a); - } - } -@@ -157,22 +156,22 @@ public interface IEntityAccess { +@@ -150,22 +150,22 @@ public interface IEntityAccess { @Nullable default T a(Class oclass, PathfinderTargetCondition pathfindertargetcondition, @Nullable EntityLiving entityliving, double d0, double d1, double d2, AxisAlignedBB axisalignedbb) { @@ -336,7 +387,7 @@ index 534e70671a624e58ed98df9dd62bd7f5ffdf91af..d5c284cdd10d33f5f1b7f456d6a384a4 if (pathfindertargetcondition.a(entityliving, t1)) { double d4 = t1.g(d0, d1, d2); -@@ -205,10 +204,10 @@ public interface IEntityAccess { +@@ -198,10 +198,10 @@ public interface IEntityAccess { default List a(Class oclass, PathfinderTargetCondition pathfindertargetcondition, EntityLiving entityliving, AxisAlignedBB axisalignedbb) { List list = this.a(oclass, axisalignedbb, (Predicate) null); List list1 = Lists.newArrayList(); @@ -350,45 +401,34 @@ index 534e70671a624e58ed98df9dd62bd7f5ffdf91af..d5c284cdd10d33f5f1b7f456d6a384a4 if (pathfindertargetcondition.a(entityliving, t0)) { list1.add(t0); diff --git a/src/main/java/net/minecraft/server/IOWorker.java b/src/main/java/net/minecraft/server/IOWorker.java -index a986f2912fc04a7fdd49d648cbcd570464597937..c5658c0779b0e0d51fd4921456b6fef0711d7be3 100644 +index c5a95f51ba43b94fd07f8df6576f45c3dd0216a3..38ccfd78639a85abcefb915c5c231be5881cebc1 100644 --- a/src/main/java/net/minecraft/server/IOWorker.java +++ b/src/main/java/net/minecraft/server/IOWorker.java -@@ -46,7 +46,7 @@ public class IOWorker implements AutoCloseable { - if (throwable != null) { - completablefuture.completeExceptionally(throwable); - } else { -- completablefuture.complete((Object) null); -+ completablefuture.complete(null); // Paper - Decompile fix - } +@@ -83,7 +83,7 @@ public class IOWorker implements AutoCloseable { + return this.a(() -> { + try { + this.d.a(); +- return Either.left((Object) null); ++ return Either.left(null); // Paper - decompile error + } catch (Exception exception) { + IOWorker.LOGGER.warn("Failed to synchronized chunks", exception); + return Either.right(exception); +@@ -117,13 +117,13 @@ public class IOWorker implements AutoCloseable { + } - }); -@@ -106,7 +106,7 @@ public class IOWorker implements AutoCloseable { - })); + private void c() { +- this.c.a((Object) (new PairedQueue.b(IOWorker.Priority.LOW.ordinal(), this::b))); ++ this.c.a((new PairedQueue.b(IOWorker.Priority.LOW.ordinal(), this::b))); // Paper - decompile error + } - completablefuture1.whenComplete((object, throwable) -> { -- completablefuture.complete((Object) null); -+ completablefuture.complete(null); // Paper - decompile fix - }); - }; - }); -@@ -165,7 +165,7 @@ public class IOWorker implements AutoCloseable { private void a(ChunkCoordIntPair chunkcoordintpair, IOWorker.a ioworker_a) { try { - this.e.write(chunkcoordintpair, ioworker_a.a); + this.d.write(chunkcoordintpair, ioworker_a.a); - ioworker_a.b.complete((Object) null); + ioworker_a.b.complete(null); // Paper - decompile fix } catch (Exception exception) { IOWorker.LOGGER.error("Failed to store chunk {}", chunkcoordintpair, exception); ioworker_a.b.completeExceptionally(exception); -@@ -176,7 +176,7 @@ public class IOWorker implements AutoCloseable { - private void g() { - try { - this.e.close(); -- this.h.complete((Object) null); -+ this.h.complete(null); // Paper - decompile fix - } catch (Exception exception) { - IOWorker.LOGGER.error("Failed to close storage", exception); - this.h.completeExceptionally(exception); diff --git a/src/main/java/net/minecraft/server/LightEngineStorageSky.java b/src/main/java/net/minecraft/server/LightEngineStorageSky.java index 1e1f7ec6e6e6fc698a8a5118ce21321d104dc5eb..75d9065b32731dc635d9d09c48fb9643172381a9 100644 --- a/src/main/java/net/minecraft/server/LightEngineStorageSky.java @@ -407,18 +447,9 @@ index 1e1f7ec6e6e6fc698a8a5118ce21321d104dc5eb..75d9065b32731dc635d9d09c48fb9643 ++k; if (k >= l) { diff --git a/src/main/java/net/minecraft/server/LightEngineThreaded.java b/src/main/java/net/minecraft/server/LightEngineThreaded.java -index ef315377579ca425ecb8d41aaf59eb1dd5b39e12..8776799de033f02b0f87e9ea7e4a4ce912e94dd4 100644 +index 8b1f9116afd92b13426eb0e97066297705d202fb..a9dc8466278f9ec2becbcb643e6e1c973df72b82 100644 --- a/src/main/java/net/minecraft/server/LightEngineThreaded.java +++ b/src/main/java/net/minecraft/server/LightEngineThreaded.java -@@ -110,7 +110,7 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable { - } - - private void a(int i, int j, IntSupplier intsupplier, LightEngineThreaded.Update lightenginethreaded_update, Runnable runnable) { -- this.e.a((Object) ChunkTaskQueueSorter.a(() -> { -+ this.e.a(ChunkTaskQueueSorter.a(() -> { // Paper - decompile error - this.c.add(Pair.of(lightenginethreaded_update, runnable)); - if (this.c.size() >= this.f) { - this.b(); @@ -167,7 +167,7 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable { public void queueUpdate() { @@ -428,24 +459,37 @@ index ef315377579ca425ecb8d41aaf59eb1dd5b39e12..8776799de033f02b0f87e9ea7e4a4ce9 this.b(); this.g.set(false); })); +diff --git a/src/main/java/net/minecraft/server/LootEntryAbstract.java b/src/main/java/net/minecraft/server/LootEntryAbstract.java +index 8cc8c60d3297a4ed98f3950a3971d83499ad1dfa..788078c209b8bcbd551cf0a52eb6172928d7b5f9 100644 +--- a/src/main/java/net/minecraft/server/LootEntryAbstract.java ++++ b/src/main/java/net/minecraft/server/LootEntryAbstract.java +@@ -36,7 +36,7 @@ public abstract class LootEntryAbstract implements LootEntryChildren { + + // CraftBukkit start + @Override +- public final void a(JsonObject jsonobject, T t0, JsonSerializationContext jsonserializationcontext) { ++ public void a(JsonObject jsonobject, T t0, JsonSerializationContext jsonserializationcontext) { // Paper - remove final + if (!org.apache.commons.lang3.ArrayUtils.isEmpty(t0.d)) { + jsonobject.add("conditions", jsonserializationcontext.serialize(t0.d)); + } diff --git a/src/main/java/net/minecraft/server/LootItemFunctionExplorationMap.java b/src/main/java/net/minecraft/server/LootItemFunctionExplorationMap.java -index fa11b2fc6364dc6fb6a951e092ea01f5e74c2c1d..5fe0da76bd172c2c552b2dd210e89be214c4385c 100644 +index 3aa5cc4281cdba8738890e9ffd5c7a129e60c310..32a98e758b9df48005ddc5283eacdc5123a32c39 100644 --- a/src/main/java/net/minecraft/server/LootItemFunctionExplorationMap.java +++ b/src/main/java/net/minecraft/server/LootItemFunctionExplorationMap.java -@@ -69,7 +69,7 @@ public class LootItemFunctionExplorationMap extends LootItemFunctionConditional - } +@@ -73,7 +73,7 @@ public class LootItemFunctionExplorationMap extends LootItemFunctionConditional + public b() {} public void a(JsonObject jsonobject, LootItemFunctionExplorationMap lootitemfunctionexplorationmap, JsonSerializationContext jsonserializationcontext) { - super.a(jsonobject, (LootItemFunctionConditional) lootitemfunctionexplorationmap, jsonserializationcontext); + super.a(jsonobject, lootitemfunctionexplorationmap, jsonserializationcontext); // Paper - decompile fix - if (!lootitemfunctionexplorationmap.d.equals("Buried_Treasure")) { - jsonobject.add("destination", jsonserializationcontext.serialize(lootitemfunctionexplorationmap.d)); + if (!lootitemfunctionexplorationmap.e.equals(LootItemFunctionExplorationMap.a)) { + jsonobject.add("destination", jsonserializationcontext.serialize(lootitemfunctionexplorationmap.e.i())); } diff --git a/src/main/java/net/minecraft/server/LootSelectorEntry.java b/src/main/java/net/minecraft/server/LootSelectorEntry.java -index 59bb53543113660cd2514350a24a4908a8464f24..3ed6a1e785f68c4bb6c5afe024c43150915968a3 100644 +index 998101592723abb26c91d1f92e98be1cf24c954d..ee9069c744df63cbb7f21dd9d28d6d554593674c 100644 --- a/src/main/java/net/minecraft/server/LootSelectorEntry.java +++ b/src/main/java/net/minecraft/server/LootSelectorEntry.java -@@ -125,7 +125,7 @@ public abstract class LootSelectorEntry extends LootEntryAbstract { +@@ -123,7 +123,7 @@ public abstract class LootSelectorEntry extends LootEntryAbstract { @Override public T b(LootItemFunction.a lootitemfunction_a) { this.c.add(lootitemfunction_a.b()); @@ -454,7 +498,7 @@ index 59bb53543113660cd2514350a24a4908a8464f24..3ed6a1e785f68c4bb6c5afe024c43150 } protected LootItemFunction[] a() { -@@ -134,12 +134,12 @@ public abstract class LootSelectorEntry extends LootEntryAbstract { +@@ -132,12 +132,12 @@ public abstract class LootSelectorEntry extends LootEntryAbstract { public T a(int i) { this.a = i; @@ -469,6 +513,22 @@ index 59bb53543113660cd2514350a24a4908a8464f24..3ed6a1e785f68c4bb6c5afe024c43150 } } +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index ea3685df509101f3fed8b07088baef3ffdb4b85a..5e2dff9a30615b5580710f872a92ab9f07fca6cf 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -1549,9 +1549,9 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrantmap(resourcepackrepository::a).filter(Objects::nonNull).map(ResourcePackLoader::d).collect(ImmutableList.toImmutableList()); // CraftBukkit - decompile error // Paper - decompile error + }, this).thenCompose((immutablelist) -> { +- return DataPackResources.a(immutablelist, this.j() ? CommandDispatcher.ServerType.DEDICATED : CommandDispatcher.ServerType.INTEGRATED, this.h(), this.executorService, this); ++ return DataPackResources.a((List) immutablelist, this.j() ? CommandDispatcher.ServerType.DEDICATED : CommandDispatcher.ServerType.INTEGRATED, this.h(), this.executorService, this); // Paper - decompile error + }).thenAcceptAsync((datapackresources) -> { + this.dataPackResources.close(); + this.dataPackResources = datapackresources; diff --git a/src/main/java/net/minecraft/server/NBTBase.java b/src/main/java/net/minecraft/server/NBTBase.java index 829a7ae0a2b77205fb8e8c5754d0d4333afa224d..8b9e47b4c7f5dc464fa617a59583df9e30a54045 100644 --- a/src/main/java/net/minecraft/server/NBTBase.java @@ -482,8 +542,29 @@ index 829a7ae0a2b77205fb8e8c5754d0d4333afa224d..8b9e47b4c7f5dc464fa617a59583df9e default String asString() { return this.toString(); +diff --git a/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java +index db66d4ac7dc1bede8b674cd9ad8f56dd989b6693..c9be8c7f40917056091f63d36311a10d6302acbb 100644 +--- a/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java ++++ b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java +@@ -11,6 +11,7 @@ import java.io.InputStream; + import java.io.OutputStream; + import java.util.zip.GZIPInputStream; + import java.util.zip.GZIPOutputStream; ++import io.netty.buffer.ByteBufInputStream; // Paper + + public class NBTCompressedStreamTools { + +@@ -75,7 +76,7 @@ public class NBTCompressedStreamTools { + + public static NBTTagCompound a(DataInput datainput, NBTReadLimiter nbtreadlimiter) throws IOException { + // Spigot start +- if ( datainput instanceof io.netty.buffer.ByteBufInputStream ) ++ if ( datainput instanceof ByteBufInputStream) // Paper + { + datainput = new DataInputStream(new org.spigotmc.LimitStream((InputStream) datainput, nbtreadlimiter)); + } diff --git a/src/main/java/net/minecraft/server/NBTTagList.java b/src/main/java/net/minecraft/server/NBTTagList.java -index 22035b6c0b76687404e4df92f5796dbf244c50bc..5406f4c40f86e74f8ed4e7e986b23d19141ddc30 100644 +index b8bb5027ecccfc9b664145a1bfe3755f1a8af3eb..ad8a506bb430b26fe147a657a2f826daf9bf4d45 100644 --- a/src/main/java/net/minecraft/server/NBTTagList.java +++ b/src/main/java/net/minecraft/server/NBTTagList.java @@ -51,7 +51,7 @@ public class NBTTagList extends NBTList { @@ -517,31 +598,6 @@ index 8471920b8b92f0bbd0d3ee827e1b0a120f405f6c..e9c405fb5376c5733b9b0191cd530917 }); } -diff --git a/src/main/java/net/minecraft/server/RegionFileSection.java b/src/main/java/net/minecraft/server/RegionFileSection.java -index 737afc7d71f415e942602efb4bd91fba6c6baa72..db9f0196bda4c987de6cf63eea437b7154d47b57 100644 ---- a/src/main/java/net/minecraft/server/RegionFileSection.java -+++ b/src/main/java/net/minecraft/server/RegionFileSection.java -@@ -83,9 +83,9 @@ public class RegionFileSection implements AutoC - Optional optional = this.d(i); - - if (optional.isPresent()) { -- return (MinecraftSerializable) optional.get(); -+ return optional.get(); // Paper - decompile fix - } else { -- R r0 = (MinecraftSerializable) this.f.apply(() -> { -+ R r0 = this.f.apply(() -> { // Paper - decompile fix - this.a(i); - }); - -@@ -124,7 +124,7 @@ public class RegionFileSection implements AutoC - for (int l = 0; l < 16; ++l) { - long i1 = SectionPosition.a(chunkcoordintpair, l).v(); - Optional optional = optionaldynamic.get(Integer.toString(l)).get().map((dynamic2) -> { -- return (MinecraftSerializable) this.e.apply(() -> { -+ return this.e.apply(() -> { // Paper - decompile fix - this.a(i1); - }, dynamic2); - }); diff --git a/src/main/java/net/minecraft/server/RegistryBlockID.java b/src/main/java/net/minecraft/server/RegistryBlockID.java index 7f89562e90ede1bdd06b71c0798d986ccbb7886e..4efcb8b595750891b421e524812542f0f67e9f3f 100644 --- a/src/main/java/net/minecraft/server/RegistryBlockID.java @@ -556,7 +612,7 @@ index 7f89562e90ede1bdd06b71c0798d986ccbb7886e..4efcb8b595750891b421e524812542f0 this.c.set(i, t0); diff --git a/src/main/java/net/minecraft/server/RegistryID.java b/src/main/java/net/minecraft/server/RegistryID.java -index 4cb78c6a3feb15eb15f76f967e724829655e8617..e15d286710ed66a01bfb6b60f8735b837efb3fd7 100644 +index 2dc20b5c930c6845af41b35d69cdb03db639d63e..6cdd4d46d987132c3c241800b5d59cee2dfa25e2 100644 --- a/src/main/java/net/minecraft/server/RegistryID.java +++ b/src/main/java/net/minecraft/server/RegistryID.java @@ -17,9 +17,9 @@ public class RegistryID implements Registry { @@ -571,7 +627,7 @@ index 4cb78c6a3feb15eb15f76f967e724829655e8617..e15d286710ed66a01bfb6b60f8735b83 } public int getId(@Nullable K k0) { -@@ -55,9 +55,9 @@ public class RegistryID implements Registry { +@@ -59,9 +59,9 @@ public class RegistryID implements Registry { K[] ak = this.b; int[] aint = this.c; @@ -583,11 +639,24 @@ index 4cb78c6a3feb15eb15f76f967e724829655e8617..e15d286710ed66a01bfb6b60f8735b83 this.e = 0; this.f = 0; +diff --git a/src/main/java/net/minecraft/server/StructureGenerator.java b/src/main/java/net/minecraft/server/StructureGenerator.java +index 68510457b527e61bf60bf1e7dfd664578172c00a..eefad79a01de61eff5e0bd3f709bfda030ebe20d 100644 +--- a/src/main/java/net/minecraft/server/StructureGenerator.java ++++ b/src/main/java/net/minecraft/server/StructureGenerator.java +@@ -42,7 +42,7 @@ public abstract class StructureGenerator + private static > F a(String s, F f0, WorldGenStage.Decoration worldgenstage_decoration) { + StructureGenerator.a.put(s.toLowerCase(Locale.ROOT), f0); + StructureGenerator.u.put(f0, worldgenstage_decoration); +- return (StructureGenerator) IRegistry.a(IRegistry.STRUCTURE_FEATURE, s.toLowerCase(Locale.ROOT), (Object) f0); ++ return (F) IRegistry.>a(IRegistry.STRUCTURE_FEATURE, s.toLowerCase(Locale.ROOT), f0); // Paper - decomp fix + } + + public StructureGenerator(Codec codec) { diff --git a/src/main/java/net/minecraft/server/SystemUtils.java b/src/main/java/net/minecraft/server/SystemUtils.java -index 8534585eb17cd46f1e392d8f09bb671abe27ef52..7b92ecfff94e3c4a69269139ebed75fc59bbd4f1 100644 +index a1a5460e429356b52a75037c809cec85bd99084a..80ee8d196436e271833503a0e123401d1b3314a9 100644 --- a/src/main/java/net/minecraft/server/SystemUtils.java +++ b/src/main/java/net/minecraft/server/SystemUtils.java -@@ -45,8 +45,8 @@ public class SystemUtils { +@@ -55,8 +55,8 @@ public class SystemUtils { return Collectors.toMap(Entry::getKey, Entry::getValue); } @@ -598,7 +667,7 @@ index 8534585eb17cd46f1e392d8f09bb671abe27ef52..7b92ecfff94e3c4a69269139ebed75fc } public static String a(String s, @Nullable MinecraftKey minecraftkey) { -@@ -168,8 +168,8 @@ public class SystemUtils { +@@ -224,8 +224,8 @@ public class SystemUtils { public static T b(Iterable iterable, @Nullable T t0) { Iterator iterator = iterable.iterator(); @@ -609,16 +678,16 @@ index 8534585eb17cd46f1e392d8f09bb671abe27ef52..7b92ecfff94e3c4a69269139ebed75fc for (object1 = null; iterator.hasNext(); object1 = object) { object = iterator.next(); -@@ -194,7 +194,7 @@ public class SystemUtils { +@@ -250,7 +250,7 @@ public class SystemUtils { } - public static Strategy i() { + public static Strategy k() { - return SystemUtils.IdentityHashingStrategy.INSTANCE; + return (Strategy) SystemUtils.IdentityHashingStrategy.INSTANCE; // Paper - decompile fix } public static CompletableFuture> b(List> list) { -@@ -205,7 +205,7 @@ public class SystemUtils { +@@ -261,7 +261,7 @@ public class SystemUtils { list.forEach((completablefuture1) -> { int i = list1.size(); @@ -628,10 +697,10 @@ index 8534585eb17cd46f1e392d8f09bb671abe27ef52..7b92ecfff94e3c4a69269139ebed75fc if (throwable != null) { completablefuture.completeExceptionally(throwable); diff --git a/src/main/java/net/minecraft/server/ThreadedMailbox.java b/src/main/java/net/minecraft/server/ThreadedMailbox.java -index 8dbb33e749a282ab1e41bfdc616a22744dc7b162..8082569022384a3ba03fb4a6f1ae12b443598dcb 100644 +index b64fc6e3dc8f628ead2c243baa48f2872bd8da0c..35f4d2d9591e625ab0bbeab7b606761e74965eec 100644 --- a/src/main/java/net/minecraft/server/ThreadedMailbox.java +++ b/src/main/java/net/minecraft/server/ThreadedMailbox.java -@@ -83,7 +83,7 @@ public class ThreadedMailbox implements Mailbox, AutoCloseable, Runnable { +@@ -99,7 +99,7 @@ public class ThreadedMailbox implements Mailbox, AutoCloseable, Runnable { public void run() { try { @@ -654,10 +723,10 @@ index ee2059cf8ef0a0372e02b91a4bf6fa8a0ab31bca..77bb6b092a0763ff27f90f0401a8a81b } diff --git a/src/main/java/net/minecraft/server/TileEntityPiston.java b/src/main/java/net/minecraft/server/TileEntityPiston.java -index 79df42f5e53464f07e76d22cd1317637145e2056..489175abd8e582a3c082364fec357c4f061a22d7 100644 +index dc52856856796524e4519c34ab92e37031013759..5b941321a7fdc561e6b794a1dce5d600083c505d 100644 --- a/src/main/java/net/minecraft/server/TileEntityPiston.java +++ b/src/main/java/net/minecraft/server/TileEntityPiston.java -@@ -137,7 +137,7 @@ public class TileEntityPiston extends TileEntity implements ITickable { +@@ -140,7 +140,7 @@ public class TileEntityPiston extends TileEntity implements ITickable { private static void a(EnumDirection enumdirection, Entity entity, double d0, EnumDirection enumdirection1) { TileEntityPiston.h.set(enumdirection); entity.move(EnumMoveType.PISTON, new Vec3D(d0 * (double) enumdirection1.getAdjacentX(), d0 * (double) enumdirection1.getAdjacentY(), d0 * (double) enumdirection1.getAdjacentZ())); @@ -667,28 +736,31 @@ index 79df42f5e53464f07e76d22cd1317637145e2056..489175abd8e582a3c082364fec357c4f private void g(float f) { diff --git a/src/main/java/net/minecraft/server/VillagePlace.java b/src/main/java/net/minecraft/server/VillagePlace.java -index c137484f66a022f7f4581d0657210d60c619c5fa..c999f8c9bf8a59e19b3d6d1b7ad8b5fb6e48b928 100644 +index bc2fab806ee1cc7628841a065436f0339f17ecce..b8c15047771bd4527b86e514a3b950b2ffc6eef0 100644 --- a/src/main/java/net/minecraft/server/VillagePlace.java +++ b/src/main/java/net/minecraft/server/VillagePlace.java -@@ -165,7 +165,7 @@ public class VillagePlace extends RegionFileSection { +@@ -170,9 +170,9 @@ public class VillagePlace extends RegionFileSection { } private static boolean a(ChunkSection chunksection) { -- Stream stream = VillagePlaceType.e(); -+ Stream stream = VillagePlaceType.e(); // Paper - decompile fix +- Set set = VillagePlaceType.x; ++ Set set = VillagePlaceType.x; // Paper - decompile error - chunksection.getClass(); - return stream.anyMatch(chunksection::a); -@@ -185,7 +185,7 @@ public class VillagePlace extends RegionFileSection { +- set.getClass(); ++ //set.getClass(); // Paper - decompile error + return chunksection.a(set::contains); + } + +@@ -190,7 +190,7 @@ public class VillagePlace extends RegionFileSection { SectionPosition.b(new ChunkCoordIntPair(blockposition), Math.floorDiv(i, 16)).map((sectionposition) -> { - return Pair.of(sectionposition, this.d(sectionposition.v())); + return Pair.of(sectionposition, this.d(sectionposition.s())); }).filter((pair) -> { - return !(Boolean) ((Optional) pair.getSecond()).map(VillagePlaceSection::a).orElse(false); + return !(Boolean) (pair.getSecond()).map(VillagePlaceSection::a).orElse(false); // Paper - decompile fix }).map((pair) -> { - return ((SectionPosition) pair.getFirst()).u(); + return ((SectionPosition) pair.getFirst()).r(); }).filter((chunkcoordintpair) -> { -@@ -237,7 +237,7 @@ public class VillagePlace extends RegionFileSection { +@@ -242,7 +242,7 @@ public class VillagePlace extends RegionFileSection { private final Predicate d; @@ -698,25 +770,25 @@ index c137484f66a022f7f4581d0657210d60c619c5fa..c999f8c9bf8a59e19b3d6d1b7ad8b5fb } diff --git a/src/main/java/net/minecraft/server/VillagerTrades.java b/src/main/java/net/minecraft/server/VillagerTrades.java -index a06a31534e5bdfddcd3914f68e5b60ae0ec43117..3bcf0b385d1f707176dae9c3ee49370e2e6dd481 100644 +index b0ec371c058c428a909faafe027e58e9c7f0cb38..532460e7549192dfe6170e2bf489edb46b8b5737 100644 --- a/src/main/java/net/minecraft/server/VillagerTrades.java +++ b/src/main/java/net/minecraft/server/VillagerTrades.java -@@ -15,12 +15,12 @@ import javax.annotation.Nullable; +@@ -14,12 +14,12 @@ import javax.annotation.Nullable; public class VillagerTrades { - public static final Map> a = (Map) SystemUtils.a((Object) Maps.newHashMap(), (hashmap) -> { + public static final Map> a = SystemUtils.a(Maps.newHashMap(), (hashmap) -> { // Paper - decompile fix hashmap.put(VillagerProfession.FARMER, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.WHEAT, 20, 16, 2), new VillagerTrades.b(Items.POTATO, 26, 16, 2), new VillagerTrades.b(Items.CARROT, 22, 16, 2), new VillagerTrades.b(Items.BEETROOT, 15, 16, 2), new VillagerTrades.h(Items.BREAD, 1, 6, 16, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Blocks.PUMPKIN, 6, 12, 10), new VillagerTrades.h(Items.PUMPKIN_PIE, 1, 4, 5), new VillagerTrades.h(Items.APPLE, 1, 4, 16, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.COOKIE, 3, 18, 10), new VillagerTrades.b(Blocks.MELON, 4, 12, 20)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Blocks.CAKE, 1, 1, 12, 15), new VillagerTrades.i(MobEffects.NIGHT_VISION, 100, 15), new VillagerTrades.i(MobEffects.JUMP, 160, 15), new VillagerTrades.i(MobEffects.WEAKNESS, 140, 15), new VillagerTrades.i(MobEffects.BLINDNESS, 120, 15), new VillagerTrades.i(MobEffects.POISON, 280, 15), new VillagerTrades.i(MobEffects.SATURATION, 7, 15)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.GOLDEN_CARROT, 3, 3, 30), new VillagerTrades.h(Items.GLISTERING_MELON_SLICE, 4, 3, 30)}))); -- hashmap.put(VillagerProfession.FISHERMAN, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.STRING, 20, 16, 2), new VillagerTrades.b(Items.COAL, 10, 16, 2), new VillagerTrades.g(Items.COD, 6, Items.COOKED_COD, 6, 16, 1), new VillagerTrades.h(Items.COD_BUCKET, 3, 1, 16, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.COD, 15, 16, 10), new VillagerTrades.g(Items.SALMON, 6, Items.COOKED_SALMON, 6, 16, 5), new VillagerTrades.h(Items.pT, 2, 1, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.SALMON, 13, 16, 20), new VillagerTrades.e(Items.FISHING_ROD, 3, 3, 10, 0.2F)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.TROPICAL_FISH, 6, 12, 30)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.PUFFERFISH, 4, 12, 30), new VillagerTrades.c(1, 12, 30, ImmutableMap.builder().put(VillagerType.PLAINS, Items.OAK_BOAT).put(VillagerType.TAIGA, Items.SPRUCE_BOAT).put(VillagerType.SNOW, Items.SPRUCE_BOAT).put(VillagerType.DESERT, Items.JUNGLE_BOAT).put(VillagerType.JUNGLE, Items.JUNGLE_BOAT).put(VillagerType.SAVANNA, Items.ACACIA_BOAT).put(VillagerType.SWAMP, Items.DARK_OAK_BOAT).build())}))); -+ hashmap.put(VillagerProfession.FISHERMAN, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.STRING, 20, 16, 2), new VillagerTrades.b(Items.COAL, 10, 16, 2), new VillagerTrades.g(Items.COD, 6, Items.COOKED_COD, 6, 16, 1), new VillagerTrades.h(Items.COD_BUCKET, 3, 1, 16, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.COD, 15, 16, 10), new VillagerTrades.g(Items.SALMON, 6, Items.COOKED_SALMON, 6, 16, 5), new VillagerTrades.h(Items.pT, 2, 1, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.SALMON, 13, 16, 20), new VillagerTrades.e(Items.FISHING_ROD, 3, 3, 10, 0.2F)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.TROPICAL_FISH, 6, 12, 30)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.PUFFERFISH, 4, 12, 30), new VillagerTrades.c(1, 12, 30, ImmutableMap.builder().put(VillagerType.PLAINS, Items.OAK_BOAT).put(VillagerType.TAIGA, Items.SPRUCE_BOAT).put(VillagerType.SNOW, Items.SPRUCE_BOAT).put(VillagerType.DESERT, Items.JUNGLE_BOAT).put(VillagerType.JUNGLE, Items.JUNGLE_BOAT).put(VillagerType.SAVANNA, Items.ACACIA_BOAT).put(VillagerType.SWAMP, Items.DARK_OAK_BOAT).build())}))); // Paper - decompile fix +- hashmap.put(VillagerProfession.FISHERMAN, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.STRING, 20, 16, 2), new VillagerTrades.b(Items.COAL, 10, 16, 2), new VillagerTrades.g(Items.COD, 6, Items.COOKED_COD, 6, 16, 1), new VillagerTrades.h(Items.COD_BUCKET, 3, 1, 16, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.COD, 15, 16, 10), new VillagerTrades.g(Items.SALMON, 6, Items.COOKED_SALMON, 6, 16, 5), new VillagerTrades.h(Items.rm, 2, 1, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.SALMON, 13, 16, 20), new VillagerTrades.e(Items.FISHING_ROD, 3, 3, 10, 0.2F)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.TROPICAL_FISH, 6, 12, 30)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.PUFFERFISH, 4, 12, 30), new VillagerTrades.c(1, 12, 30, ImmutableMap.builder().put(VillagerType.PLAINS, Items.OAK_BOAT).put(VillagerType.TAIGA, Items.SPRUCE_BOAT).put(VillagerType.SNOW, Items.SPRUCE_BOAT).put(VillagerType.DESERT, Items.JUNGLE_BOAT).put(VillagerType.JUNGLE, Items.JUNGLE_BOAT).put(VillagerType.SAVANNA, Items.ACACIA_BOAT).put(VillagerType.SWAMP, Items.DARK_OAK_BOAT).build())}))); ++ hashmap.put(VillagerProfession.FISHERMAN, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.STRING, 20, 16, 2), new VillagerTrades.b(Items.COAL, 10, 16, 2), new VillagerTrades.g(Items.COD, 6, Items.COOKED_COD, 6, 16, 1), new VillagerTrades.h(Items.COD_BUCKET, 3, 1, 16, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.COD, 15, 16, 10), new VillagerTrades.g(Items.SALMON, 6, Items.COOKED_SALMON, 6, 16, 5), new VillagerTrades.h(Items.rm, 2, 1, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.SALMON, 13, 16, 20), new VillagerTrades.e(Items.FISHING_ROD, 3, 3, 10, 0.2F)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.TROPICAL_FISH, 6, 12, 30)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.PUFFERFISH, 4, 12, 30), new VillagerTrades.c(1, 12, 30, ImmutableMap.builder().put(VillagerType.PLAINS, Items.OAK_BOAT).put(VillagerType.TAIGA, Items.SPRUCE_BOAT).put(VillagerType.SNOW, Items.SPRUCE_BOAT).put(VillagerType.DESERT, Items.JUNGLE_BOAT).put(VillagerType.JUNGLE, Items.JUNGLE_BOAT).put(VillagerType.SAVANNA, Items.ACACIA_BOAT).put(VillagerType.SWAMP, Items.DARK_OAK_BOAT).build())}))); // hashmap.put(VillagerProfession.SHEPHERD, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Blocks.WHITE_WOOL, 18, 16, 2), new VillagerTrades.b(Blocks.BROWN_WOOL, 18, 16, 2), new VillagerTrades.b(Blocks.BLACK_WOOL, 18, 16, 2), new VillagerTrades.b(Blocks.GRAY_WOOL, 18, 16, 2), new VillagerTrades.h(Items.SHEARS, 2, 1, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.WHITE_DYE, 12, 16, 10), new VillagerTrades.b(Items.GRAY_DYE, 12, 16, 10), new VillagerTrades.b(Items.BLACK_DYE, 12, 16, 10), new VillagerTrades.b(Items.LIGHT_BLUE_DYE, 12, 16, 10), new VillagerTrades.b(Items.LIME_DYE, 12, 16, 10), new VillagerTrades.h(Blocks.WHITE_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.ORANGE_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.MAGENTA_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.LIGHT_BLUE_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.YELLOW_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.LIME_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.PINK_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.GRAY_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.LIGHT_GRAY_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.CYAN_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.PURPLE_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.BLUE_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.BROWN_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.GREEN_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.RED_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.BLACK_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.WHITE_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.ORANGE_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.MAGENTA_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.LIGHT_BLUE_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.YELLOW_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.LIME_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.PINK_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.GRAY_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.LIGHT_GRAY_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.CYAN_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.PURPLE_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.BLUE_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.BROWN_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.GREEN_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.RED_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.BLACK_CARPET, 1, 4, 16, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.YELLOW_DYE, 12, 16, 20), new VillagerTrades.b(Items.LIGHT_GRAY_DYE, 12, 16, 20), new VillagerTrades.b(Items.ORANGE_DYE, 12, 16, 20), new VillagerTrades.b(Items.RED_DYE, 12, 16, 20), new VillagerTrades.b(Items.PINK_DYE, 12, 16, 20), new VillagerTrades.h(Blocks.WHITE_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.YELLOW_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.RED_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.BLACK_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.BLUE_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.BROWN_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.CYAN_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.GRAY_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.GREEN_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.LIGHT_BLUE_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.LIGHT_GRAY_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.LIME_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.MAGENTA_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.ORANGE_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.PINK_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.PURPLE_BED, 3, 1, 12, 10)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.BROWN_DYE, 12, 16, 30), new VillagerTrades.b(Items.PURPLE_DYE, 12, 16, 30), new VillagerTrades.b(Items.BLUE_DYE, 12, 16, 30), new VillagerTrades.b(Items.GREEN_DYE, 12, 16, 30), new VillagerTrades.b(Items.MAGENTA_DYE, 12, 16, 30), new VillagerTrades.b(Items.CYAN_DYE, 12, 16, 30), new VillagerTrades.h(Items.WHITE_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.BLUE_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.LIGHT_BLUE_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.RED_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.PINK_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.GREEN_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.LIME_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.GRAY_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.BLACK_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.PURPLE_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.MAGENTA_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.CYAN_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.BROWN_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.YELLOW_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.ORANGE_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.LIGHT_GRAY_BANNER, 3, 1, 12, 15)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.PAINTING, 2, 3, 30)}))); - hashmap.put(VillagerProfession.FLETCHER, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.STICK, 32, 16, 2), new VillagerTrades.h(Items.ARROW, 1, 16, 1), new VillagerTrades.g(Blocks.GRAVEL, 10, Items.FLINT, 10, 12, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.FLINT, 26, 12, 10), new VillagerTrades.h(Items.BOW, 2, 1, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.STRING, 14, 16, 20), new VillagerTrades.h(Items.CROSSBOW, 3, 1, 10)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.FEATHER, 24, 16, 30), new VillagerTrades.e(Items.BOW, 2, 3, 15)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.dE, 8, 12, 30), new VillagerTrades.e(Items.CROSSBOW, 3, 3, 15), new VillagerTrades.j(Items.ARROW, 5, Items.TIPPED_ARROW, 5, 2, 12, 30)}))); -- hashmap.put(VillagerProfession.LIBRARIAN, a(ImmutableMap.builder().put(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.PAPER, 24, 16, 2), new VillagerTrades.d(1), new VillagerTrades.h(Blocks.BOOKSHELF, 9, 1, 12, 1)}).put(2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.BOOK, 4, 12, 10), new VillagerTrades.d(5), new VillagerTrades.h(Items.pR, 1, 1, 5)}).put(3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.INK_SAC, 5, 12, 20), new VillagerTrades.d(10), new VillagerTrades.h(Items.am, 1, 4, 10)}).put(4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.WRITABLE_BOOK, 2, 12, 30), new VillagerTrades.d(15), new VillagerTrades.h(Items.CLOCK, 5, 1, 15), new VillagerTrades.h(Items.COMPASS, 4, 1, 15)}).put(5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.NAME_TAG, 20, 1, 30)}).build())); -+ hashmap.put(VillagerProfession.LIBRARIAN, a(ImmutableMap.builder().put(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.PAPER, 24, 16, 2), new VillagerTrades.d(1), new VillagerTrades.h(Blocks.BOOKSHELF, 9, 1, 12, 1)}).put(2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.BOOK, 4, 12, 10), new VillagerTrades.d(5), new VillagerTrades.h(Items.pR, 1, 1, 5)}).put(3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.INK_SAC, 5, 12, 20), new VillagerTrades.d(10), new VillagerTrades.h(Items.am, 1, 4, 10)}).put(4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.WRITABLE_BOOK, 2, 12, 30), new VillagerTrades.d(15), new VillagerTrades.h(Items.CLOCK, 5, 1, 15), new VillagerTrades.h(Items.COMPASS, 4, 1, 15)}).put(5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.NAME_TAG, 20, 1, 30)}).build())); // Paper - decompile fix - hashmap.put(VillagerProfession.CARTOGRAPHER, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.PAPER, 24, 16, 2), new VillagerTrades.h(Items.MAP, 7, 1, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.df, 11, 16, 10), new VillagerTrades.k(13, "Monument", MapIcon.Type.MONUMENT, 12, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.COMPASS, 1, 12, 20), new VillagerTrades.k(14, "Mansion", MapIcon.Type.MANSION, 12, 10)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.ITEM_FRAME, 7, 1, 15), new VillagerTrades.h(Items.WHITE_BANNER, 3, 1, 15), new VillagerTrades.h(Items.BLUE_BANNER, 3, 1, 15), new VillagerTrades.h(Items.LIGHT_BLUE_BANNER, 3, 1, 15), new VillagerTrades.h(Items.RED_BANNER, 3, 1, 15), new VillagerTrades.h(Items.PINK_BANNER, 3, 1, 15), new VillagerTrades.h(Items.GREEN_BANNER, 3, 1, 15), new VillagerTrades.h(Items.LIME_BANNER, 3, 1, 15), new VillagerTrades.h(Items.GRAY_BANNER, 3, 1, 15), new VillagerTrades.h(Items.BLACK_BANNER, 3, 1, 15), new VillagerTrades.h(Items.PURPLE_BANNER, 3, 1, 15), new VillagerTrades.h(Items.MAGENTA_BANNER, 3, 1, 15), new VillagerTrades.h(Items.CYAN_BANNER, 3, 1, 15), new VillagerTrades.h(Items.BROWN_BANNER, 3, 1, 15), new VillagerTrades.h(Items.YELLOW_BANNER, 3, 1, 15), new VillagerTrades.h(Items.ORANGE_BANNER, 3, 1, 15), new VillagerTrades.h(Items.LIGHT_GRAY_BANNER, 3, 1, 15)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.GLOBE_BANNER_PATTERN, 8, 1, 30)}))); + hashmap.put(VillagerProfession.FLETCHER, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.STICK, 32, 16, 2), new VillagerTrades.h(Items.ARROW, 1, 16, 1), new VillagerTrades.g(Blocks.GRAVEL, 10, Items.FLINT, 10, 12, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.FLINT, 26, 12, 10), new VillagerTrades.h(Items.BOW, 2, 1, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.STRING, 14, 16, 20), new VillagerTrades.h(Items.CROSSBOW, 3, 1, 10)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.FEATHER, 24, 16, 30), new VillagerTrades.e(Items.BOW, 2, 3, 15)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.es, 8, 12, 30), new VillagerTrades.e(Items.CROSSBOW, 3, 3, 15), new VillagerTrades.j(Items.ARROW, 5, Items.TIPPED_ARROW, 5, 2, 12, 30)}))); +- hashmap.put(VillagerProfession.LIBRARIAN, a(ImmutableMap.builder().put(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.PAPER, 24, 16, 2), new VillagerTrades.d(1), new VillagerTrades.h(Blocks.BOOKSHELF, 9, 1, 12, 1)}).put(2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.BOOK, 4, 12, 10), new VillagerTrades.d(5), new VillagerTrades.h(Items.rj, 1, 1, 5)}).put(3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.INK_SAC, 5, 12, 20), new VillagerTrades.d(10), new VillagerTrades.h(Items.az, 1, 4, 10)}).put(4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.WRITABLE_BOOK, 2, 12, 30), new VillagerTrades.d(15), new VillagerTrades.h(Items.CLOCK, 5, 1, 15), new VillagerTrades.h(Items.COMPASS, 4, 1, 15)}).put(5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.NAME_TAG, 20, 1, 30)}).build())); ++ hashmap.put(VillagerProfession.LIBRARIAN, a(ImmutableMap.builder().put(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.PAPER, 24, 16, 2), new VillagerTrades.d(1), new VillagerTrades.h(Blocks.BOOKSHELF, 9, 1, 12, 1)}).put(2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.BOOK, 4, 12, 10), new VillagerTrades.d(5), new VillagerTrades.h(Items.rj, 1, 1, 5)}).put(3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.INK_SAC, 5, 12, 20), new VillagerTrades.d(10), new VillagerTrades.h(Items.az, 1, 4, 10)}).put(4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.WRITABLE_BOOK, 2, 12, 30), new VillagerTrades.d(15), new VillagerTrades.h(Items.CLOCK, 5, 1, 15), new VillagerTrades.h(Items.COMPASS, 4, 1, 15)}).put(5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.NAME_TAG, 20, 1, 30)}).build())); // Integer, IMerchantRecipeOption[] + hashmap.put(VillagerProfession.CARTOGRAPHER, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.PAPER, 24, 16, 2), new VillagerTrades.h(Items.MAP, 7, 1, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.dP, 11, 16, 10), new VillagerTrades.k(13, StructureGenerator.MONUMENT, MapIcon.Type.MONUMENT, 12, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.COMPASS, 1, 12, 20), new VillagerTrades.k(14, StructureGenerator.MANSION, MapIcon.Type.MANSION, 12, 10)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.ITEM_FRAME, 7, 1, 15), new VillagerTrades.h(Items.WHITE_BANNER, 3, 1, 15), new VillagerTrades.h(Items.BLUE_BANNER, 3, 1, 15), new VillagerTrades.h(Items.LIGHT_BLUE_BANNER, 3, 1, 15), new VillagerTrades.h(Items.RED_BANNER, 3, 1, 15), new VillagerTrades.h(Items.PINK_BANNER, 3, 1, 15), new VillagerTrades.h(Items.GREEN_BANNER, 3, 1, 15), new VillagerTrades.h(Items.LIME_BANNER, 3, 1, 15), new VillagerTrades.h(Items.GRAY_BANNER, 3, 1, 15), new VillagerTrades.h(Items.BLACK_BANNER, 3, 1, 15), new VillagerTrades.h(Items.PURPLE_BANNER, 3, 1, 15), new VillagerTrades.h(Items.MAGENTA_BANNER, 3, 1, 15), new VillagerTrades.h(Items.CYAN_BANNER, 3, 1, 15), new VillagerTrades.h(Items.BROWN_BANNER, 3, 1, 15), new VillagerTrades.h(Items.YELLOW_BANNER, 3, 1, 15), new VillagerTrades.h(Items.ORANGE_BANNER, 3, 1, 15), new VillagerTrades.h(Items.LIGHT_GRAY_BANNER, 3, 1, 15)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.GLOBE_BANNER_PATTERN, 8, 1, 30)}))); hashmap.put(VillagerProfession.CLERIC, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.ROTTEN_FLESH, 32, 16, 2), new VillagerTrades.h(Items.REDSTONE, 1, 2, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.GOLD_INGOT, 3, 12, 10), new VillagerTrades.h(Items.LAPIS_LAZULI, 1, 1, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.RABBIT_FOOT, 2, 12, 20), new VillagerTrades.h(Blocks.GLOWSTONE, 4, 1, 12, 10)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.SCUTE, 4, 12, 30), new VillagerTrades.b(Items.GLASS_BOTTLE, 9, 12, 30), new VillagerTrades.h(Items.ENDER_PEARL, 5, 1, 15)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.NETHER_WART, 22, 12, 30), new VillagerTrades.h(Items.EXPERIENCE_BOTTLE, 3, 1, 30)}))); - hashmap.put(VillagerProfession.ARMORER, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.COAL, 15, 16, 2), new VillagerTrades.h(new ItemStack(Items.IRON_LEGGINGS), 7, 1, 12, 1, 0.2F), new VillagerTrades.h(new ItemStack(Items.IRON_BOOTS), 4, 1, 12, 1, 0.2F), new VillagerTrades.h(new ItemStack(Items.IRON_HELMET), 5, 1, 12, 1, 0.2F), new VillagerTrades.h(new ItemStack(Items.IRON_CHESTPLATE), 9, 1, 12, 1, 0.2F)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.IRON_INGOT, 4, 12, 10), new VillagerTrades.h(new ItemStack(Items.pQ), 36, 1, 12, 5, 0.2F), new VillagerTrades.h(new ItemStack(Items.CHAINMAIL_BOOTS), 1, 1, 12, 5, 0.2F), new VillagerTrades.h(new ItemStack(Items.CHAINMAIL_LEGGINGS), 3, 1, 12, 5, 0.2F)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.LAVA_BUCKET, 1, 12, 20), new VillagerTrades.b(Items.DIAMOND, 1, 12, 20), new VillagerTrades.h(new ItemStack(Items.CHAINMAIL_HELMET), 1, 1, 12, 10, 0.2F), new VillagerTrades.h(new ItemStack(Items.CHAINMAIL_CHESTPLATE), 4, 1, 12, 10, 0.2F), new VillagerTrades.h(new ItemStack(Items.SHIELD), 5, 1, 12, 10, 0.2F)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.e(Items.DIAMOND_LEGGINGS, 14, 3, 15, 0.2F), new VillagerTrades.e(Items.DIAMOND_BOOTS, 8, 3, 15, 0.2F)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.e(Items.DIAMOND_HELMET, 8, 3, 30, 0.2F), new VillagerTrades.e(Items.DIAMOND_CHESTPLATE, 16, 3, 30, 0.2F)}))); + hashmap.put(VillagerProfession.ARMORER, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.COAL, 15, 16, 2), new VillagerTrades.h(new ItemStack(Items.IRON_LEGGINGS), 7, 1, 12, 1, 0.2F), new VillagerTrades.h(new ItemStack(Items.IRON_BOOTS), 4, 1, 12, 1, 0.2F), new VillagerTrades.h(new ItemStack(Items.IRON_HELMET), 5, 1, 12, 1, 0.2F), new VillagerTrades.h(new ItemStack(Items.IRON_CHESTPLATE), 9, 1, 12, 1, 0.2F)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.IRON_INGOT, 4, 12, 10), new VillagerTrades.h(new ItemStack(Items.ri), 36, 1, 12, 5, 0.2F), new VillagerTrades.h(new ItemStack(Items.CHAINMAIL_BOOTS), 1, 1, 12, 5, 0.2F), new VillagerTrades.h(new ItemStack(Items.CHAINMAIL_LEGGINGS), 3, 1, 12, 5, 0.2F)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.LAVA_BUCKET, 1, 12, 20), new VillagerTrades.b(Items.DIAMOND, 1, 12, 20), new VillagerTrades.h(new ItemStack(Items.CHAINMAIL_HELMET), 1, 1, 12, 10, 0.2F), new VillagerTrades.h(new ItemStack(Items.CHAINMAIL_CHESTPLATE), 4, 1, 12, 10, 0.2F), new VillagerTrades.h(new ItemStack(Items.SHIELD), 5, 1, 12, 10, 0.2F)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.e(Items.DIAMOND_LEGGINGS, 14, 3, 15, 0.2F), new VillagerTrades.e(Items.DIAMOND_BOOTS, 8, 3, 15, 0.2F)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.e(Items.DIAMOND_HELMET, 8, 3, 30, 0.2F), new VillagerTrades.e(Items.DIAMOND_CHESTPLATE, 16, 3, 30, 0.2F)}))); diff --git a/src/main/java/net/minecraft/server/VoxelShapeMergerList.java b/src/main/java/net/minecraft/server/VoxelShapeMergerList.java index e8daa74986f07163fd5318f431398b4f0efde6e8..71d2ae2a9c5a05351241b5a313e66ca15b0624ef 100644 --- a/src/main/java/net/minecraft/server/VoxelShapeMergerList.java @@ -730,18 +802,6 @@ index e8daa74986f07163fd5318f431398b4f0efde6e8..71d2ae2a9c5a05351241b5a313e66ca1 this.b.add(i - 1); this.c.add(j - 1); this.a.add(d1); -diff --git a/src/main/java/net/minecraft/server/WorldGenFeatureStateProviderWeighted.java b/src/main/java/net/minecraft/server/WorldGenFeatureStateProviderWeighted.java -index 555cf6be79985b686eb71cffe25453648f4cbc17..22e14fe1e98c8439f8db74c9464137a497fdaf7c 100644 ---- a/src/main/java/net/minecraft/server/WorldGenFeatureStateProviderWeighted.java -+++ b/src/main/java/net/minecraft/server/WorldGenFeatureStateProviderWeighted.java -@@ -40,6 +40,6 @@ public class WorldGenFeatureStateProviderWeighted extends WorldGenFeatureStatePr - builder.put(dynamicops.createString("type"), dynamicops.createString(IRegistry.t.getKey(this.a).toString())).put(dynamicops.createString("entries"), this.b.a(dynamicops, (iblockdata) -> { - return IBlockData.a(dynamicops, iblockdata); - })); -- return (new Dynamic(dynamicops, dynamicops.createMap(builder.build()))).getValue(); -+ return (new Dynamic(dynamicops, dynamicops.createMap(builder.build()))).getValue(); // Paper - decompile fix - } - } diff --git a/src/main/java/net/minecraft/server/WorldPersistentData.java b/src/main/java/net/minecraft/server/WorldPersistentData.java index 55fe7625af2207062f69188e9ab345ea68fac6ca..19e68a78310de787bca701bc2597c64e34a77d7c 100644 --- a/src/main/java/net/minecraft/server/WorldPersistentData.java diff --git a/Spigot-Server-Patches/0004-MC-Utils.patch b/Spigot-Server-Patches/0004-MC-Utils.patch index 10a690c4b..0468e151a 100644 --- a/Spigot-Server-Patches/0004-MC-Utils.patch +++ b/Spigot-Server-Patches/0004-MC-Utils.patch @@ -2259,10 +2259,10 @@ index 0000000000000000000000000000000000000000..9df0006c1a283f77c4d01d9fce9062fc + } +} diff --git a/src/main/java/net/minecraft/server/AxisAlignedBB.java b/src/main/java/net/minecraft/server/AxisAlignedBB.java -index 4f60b931a143ebf70a8469913ec445ff13da4d8d..3e90b57b6fd5dcb6cb1325861306e2ff84d0cccb 100644 +index 277d7a124e9a21803fe4d5a66fc0b311df2cfba7..02c09f39848399a86d46bd17569b4f01a7b5ab1f 100644 --- a/src/main/java/net/minecraft/server/AxisAlignedBB.java +++ b/src/main/java/net/minecraft/server/AxisAlignedBB.java -@@ -186,10 +186,12 @@ public class AxisAlignedBB { +@@ -190,10 +190,12 @@ public class AxisAlignedBB { return this.d(vec3d.x, vec3d.y, vec3d.z); } @@ -2275,7 +2275,7 @@ index 4f60b931a143ebf70a8469913ec445ff13da4d8d..3e90b57b6fd5dcb6cb1325861306e2ff public boolean a(double d0, double d1, double d2, double d3, double d4, double d5) { return this.minX < d3 && this.maxX > d0 && this.minY < d4 && this.maxY > d1 && this.minZ < d5 && this.maxZ > d2; } -@@ -202,6 +204,7 @@ public class AxisAlignedBB { +@@ -206,6 +208,7 @@ public class AxisAlignedBB { return d0 >= this.minX && d0 < this.maxX && d1 >= this.minY && d1 < this.maxY && d2 >= this.minZ && d2 < this.maxZ; } @@ -2284,15 +2284,15 @@ index 4f60b931a143ebf70a8469913ec445ff13da4d8d..3e90b57b6fd5dcb6cb1325861306e2ff double d0 = this.b(); double d1 = this.c(); diff --git a/src/main/java/net/minecraft/server/BaseBlockPosition.java b/src/main/java/net/minecraft/server/BaseBlockPosition.java -index a3b5793e4824718c8bf3d0a4f963de0ca94a738e..3f09c24e1cd1bba2809b70b1fa6e89773537d834 100644 +index ff4b23927bb0e0ac8221d71fe2543cbee54f913a..ee28d0335418a0053f8448ab5e12ebba5a9a3b2d 100644 --- a/src/main/java/net/minecraft/server/BaseBlockPosition.java +++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java -@@ -80,6 +80,7 @@ public class BaseBlockPosition implements Comparable { +@@ -98,6 +98,7 @@ public class BaseBlockPosition implements Comparable { return this.distanceSquared(iposition.getX(), iposition.getY(), iposition.getZ(), true) < d0 * d0; } -+ public final double distanceSquared(BaseBlockPosition baseblockposition) { return m(baseblockposition); } // Paper - OBFHELPER - public double m(BaseBlockPosition baseblockposition) { ++ public final double distanceSquared(BaseBlockPosition baseblockposition) { return j(baseblockposition); } // Paper - OBFHELPER + public double j(BaseBlockPosition baseblockposition) { return this.distanceSquared((double) baseblockposition.getX(), (double) baseblockposition.getY(), (double) baseblockposition.getZ(), true); } diff --git a/src/main/java/net/minecraft/server/BlockAccessAir.java b/src/main/java/net/minecraft/server/BlockAccessAir.java @@ -2318,23 +2318,23 @@ index eff6ebcd30b538cbaedaa031a46a59ea956253ba..30cbfc8eac20910aa55951e3dce63862 @Override public IBlockData getType(BlockPosition blockposition) { return Blocks.AIR.getBlockData(); -diff --git a/src/main/java/net/minecraft/server/BlockDataAbstract.java b/src/main/java/net/minecraft/server/BlockDataAbstract.java -index 1cf97cefc9d113583214f340e72b35d5560d1e5d..2040f183490d515b913df048ae8ab07bbecaa9a4 100644 ---- a/src/main/java/net/minecraft/server/BlockDataAbstract.java -+++ b/src/main/java/net/minecraft/server/BlockDataAbstract.java -@@ -78,6 +78,7 @@ public abstract class BlockDataAbstract implements IBlockDataHolder { - return Collections.unmodifiableCollection(this.d.keySet()); - } +diff --git a/src/main/java/net/minecraft/server/BlockBase.java b/src/main/java/net/minecraft/server/BlockBase.java +index 47324feca49786b49563d3d0e854e74ad27c190b..26d446077bb563ca3c5bb0339695b3364a3e41bf 100644 +--- a/src/main/java/net/minecraft/server/BlockBase.java ++++ b/src/main/java/net/minecraft/server/BlockBase.java +@@ -632,6 +632,7 @@ public abstract class BlockBase { + return this.a != null ? this.a.e : Block.a(this.getCollisionShape(iblockaccess, blockposition)); + } -+ public final > boolean hasProperty(IBlockState iblockstate) { return this.b(iblockstate); } // Paper - OBFHELPER - public > boolean b(IBlockState iblockstate) { - return this.d.containsKey(iblockstate); - } ++ public IBlockData getBlockData() { return p(); } // Paper - OBFHELPER + protected abstract IBlockData p(); + + public boolean isAlwaysDestroyable() { diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java -index c88a62f6b72a8851b95587bb49c898569d74e0c6..f8ac39e1b019b0918996f745d99f6ed09db0fd11 100644 +index 886b43e2b8f21c358b4d6785c677f14c91d191f3..f1ad6ad22a59b28d2e8aeb2c0f4c21bce6070bc5 100644 --- a/src/main/java/net/minecraft/server/BlockPosition.java +++ b/src/main/java/net/minecraft/server/BlockPosition.java -@@ -120,6 +120,7 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali +@@ -98,6 +98,7 @@ public class BlockPosition extends BaseBlockPosition { 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); } @@ -2342,7 +2342,7 @@ index c88a62f6b72a8851b95587bb49c898569d74e0c6..f8ac39e1b019b0918996f745d99f6ed0 public BlockPosition b(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); } -@@ -210,6 +211,8 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali +@@ -188,6 +189,8 @@ public class BlockPosition extends 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()); } @@ -2351,62 +2351,70 @@ index c88a62f6b72a8851b95587bb49c898569d74e0c6..f8ac39e1b019b0918996f745d99f6ed0 public BlockPosition immutableCopy() { return this; } -@@ -264,6 +267,7 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali - super(i, j, k); - } - -+ public static BlockPosition.PooledBlockPosition acquire() { return r(); } // Paper - OBFHELPER - public static BlockPosition.PooledBlockPosition r() { - return f(0, 0, 0); - } -@@ -402,6 +406,7 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali - return this.d; +@@ -368,6 +371,7 @@ public class BlockPosition extends BaseBlockPosition { + return super.a(enumblockrotation).immutableCopy(); } + public BlockPosition.MutableBlockPosition setValues(int i, int j, int k) { return d(i, j, k);} // Paper - OBFHELPER public BlockPosition.MutableBlockPosition d(int i, int j, int k) { - this.b = i; - this.c = j; -@@ -413,6 +418,7 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali - return this.c(entity.locX(), entity.locY(), entity.locZ()); + this.o(i); + this.p(j); +@@ -375,6 +379,7 @@ public class BlockPosition extends BaseBlockPosition { + return this; } + public BlockPosition.MutableBlockPosition setValues(double d0, double d1, double d2) { return c(d0, d1, d2);} // Paper - OBFHELPER public BlockPosition.MutableBlockPosition c(double d0, double d1, double d2) { return this.d(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2)); } -@@ -441,14 +447,17 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali - return this.d(this.b + i, this.c + j, this.d + k); +@@ -424,16 +429,19 @@ public class BlockPosition extends BaseBlockPosition { + } } -+ public final void setX(final int x) { this.o(x); } // Paper - OBFHELPER ++ public final void setX(final int x) { super.o(x); } // Paper - OBFHELPER + @Override public void o(int i) { - this.b = i; + super.o(i); } -+ public final void setY(final int y) { this.p(y); } // Paper - OBFHELPER ++ public final void setY(final int y) { super.p(y); } // Paper - OBFHELPER + @Override public void p(int i) { - this.c = i; + super.p(i); } -+ public final void setZ(final int z) { this.q(z); } // Paper - OBFHELPER ++ public final void setZ(final int z) { super.q(z); } // Paper - OBFHELPER + @Override public void q(int i) { - this.d = i; + super.q(i); +@@ -444,4 +452,13 @@ public class BlockPosition extends BaseBlockPosition { + return new BlockPosition(this); } + } ++ ++ // Paper start ++ public static class PooledBlockPosition extends BlockPosition.MutableBlockPosition implements AutoCloseable { ++ @Deprecated ++ public void close() {} ++ @Deprecated ++ public static BlockPosition.PooledBlockPosition acquire() { return new PooledBlockPosition(); } ++ } ++ // Paper end + } diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 55373cae078ddaf6c7c974abf59183698f669c24..9397b58f047c837f8a9146723e4cd9a4d6b787a7 100644 +index 3cdcdc60df4f28197cf19c59ea42a92ae4af3819..7c7826cf3adb19814984ab627e4c4726d8933244 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -25,7 +25,7 @@ import org.apache.logging.log4j.Logger; - public class Chunk implements IChunkAccess { +@@ -26,7 +26,7 @@ public class Chunk implements IChunkAccess { private static final Logger LOGGER = LogManager.getLogger(); + @Nullable - public static final ChunkSection a = null; -+ public static final ChunkSection a = null; public static final ChunkSection EMPTY_CHUNK_SECTION = Chunk.a; // Paper - OBFHELPER ++ public static final ChunkSection a = null; public static final ChunkSection EMPTY_CHUNK_SECTION = a; // Paper - OBFHELPER private final ChunkSection[] sections; private BiomeStorage d; private final Map e; -@@ -48,7 +48,7 @@ public class Chunk implements IChunkAccess { +@@ -49,7 +49,7 @@ public class Chunk implements IChunkAccess { private Supplier u; @Nullable private Consumer v; @@ -2415,16 +2423,16 @@ index 55373cae078ddaf6c7c974abf59183698f669c24..9397b58f047c837f8a9146723e4cd9a4 private volatile boolean x; public Chunk(World world, ChunkCoordIntPair chunkcoordintpair, BiomeStorage biomestorage) { -@@ -65,7 +65,7 @@ public class Chunk implements IChunkAccess { +@@ -66,7 +66,7 @@ public class Chunk implements IChunkAccess { this.n = new ShortList[16]; this.entitySlices = (List[]) (new List[16]); // Spigot - this.world = world; + this.world = (WorldServer) world; // CraftBukkit - type - this.loc = chunkcoordintpair; + this.loc = chunkcoordintpair; this.coordinateKey = MCUtil.getCoordinateKey(chunkcoordintpair); // Paper - cache coordinate key this.i = chunkconverter; HeightMap.Type[] aheightmap_type = HeightMap.Type.values(); int j = aheightmap_type.length; -@@ -108,6 +108,110 @@ public class Chunk implements IChunkAccess { +@@ -109,6 +109,110 @@ public class Chunk implements IChunkAccess { public boolean needsDecoration; // CraftBukkit end @@ -2535,7 +2543,7 @@ index 55373cae078ddaf6c7c974abf59183698f669c24..9397b58f047c837f8a9146723e4cd9a4 public Chunk(World world, ProtoChunk protochunk) { this(world, protochunk.getPos(), protochunk.getBiomeIndex(), protochunk.p(), protochunk.n(), protochunk.o(), protochunk.getInhabitedTime(), protochunk.getSections(), (Consumer) null); Iterator iterator = protochunk.y().iterator(); -@@ -213,6 +317,18 @@ public class Chunk implements IChunkAccess { +@@ -214,6 +318,18 @@ public class Chunk implements IChunkAccess { } } @@ -2554,7 +2562,7 @@ index 55373cae078ddaf6c7c974abf59183698f669c24..9397b58f047c837f8a9146723e4cd9a4 @Override public Fluid getFluid(BlockPosition blockposition) { return this.a(blockposition.getX(), blockposition.getY(), blockposition.getZ()); -@@ -352,6 +468,7 @@ public class Chunk implements IChunkAccess { +@@ -353,6 +469,7 @@ public class Chunk implements IChunkAccess { entity.chunkX = this.loc.x; entity.chunkY = k; entity.chunkZ = this.loc.z; @@ -2562,7 +2570,7 @@ index 55373cae078ddaf6c7c974abf59183698f669c24..9397b58f047c837f8a9146723e4cd9a4 this.entitySlices[k].add(entity); } -@@ -374,6 +491,7 @@ public class Chunk implements IChunkAccess { +@@ -375,6 +492,7 @@ public class Chunk implements IChunkAccess { } this.entitySlices[i].remove(entity); @@ -2570,7 +2578,7 @@ index 55373cae078ddaf6c7c974abf59183698f669c24..9397b58f047c837f8a9146723e4cd9a4 } @Override -@@ -395,6 +513,7 @@ public class Chunk implements IChunkAccess { +@@ -396,6 +514,7 @@ public class Chunk implements IChunkAccess { return this.a(blockposition, Chunk.EnumTileEntityState.CHECK); } @@ -2578,7 +2586,7 @@ index 55373cae078ddaf6c7c974abf59183698f669c24..9397b58f047c837f8a9146723e4cd9a4 @Nullable public TileEntity a(BlockPosition blockposition, Chunk.EnumTileEntityState chunk_enumtileentitystate) { // CraftBukkit start -@@ -506,7 +625,25 @@ public class Chunk implements IChunkAccess { +@@ -507,7 +626,25 @@ public class Chunk implements IChunkAccess { // CraftBukkit start public void loadCallback() { @@ -2604,7 +2612,7 @@ index 55373cae078ddaf6c7c974abf59183698f669c24..9397b58f047c837f8a9146723e4cd9a4 if (server != null) { /* * If it's a new world, the first few chunks are generated inside -@@ -545,6 +682,22 @@ public class Chunk implements IChunkAccess { +@@ -546,6 +683,22 @@ public class Chunk implements IChunkAccess { server.getPluginManager().callEvent(unloadEvent); // note: saving can be prevented, but not forced if no saving is actually required this.mustNotSave = !unloadEvent.isSaveChunk(); @@ -2628,10 +2636,10 @@ index 55373cae078ddaf6c7c974abf59183698f669c24..9397b58f047c837f8a9146723e4cd9a4 // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/ChunkCache.java b/src/main/java/net/minecraft/server/ChunkCache.java -index 11c4d23ba988dac5f3fd85142083c77fb603e673..a03e4c5b8693395f4a145ca565b074d6aed1913f 100644 +index b703382204a3ccd57e642cff18c7c28fef157cc0..8eecdcde510661ec3a13a25a04ba394f6b6dc012 100644 --- a/src/main/java/net/minecraft/server/ChunkCache.java +++ b/src/main/java/net/minecraft/server/ChunkCache.java -@@ -8,7 +8,7 @@ public class ChunkCache implements IBlockAccess, ICollisionAccess { +@@ -10,7 +10,7 @@ public class ChunkCache implements IBlockAccess, ICollisionAccess { protected final int b; protected final IChunkAccess[][] c; protected boolean d; @@ -2640,7 +2648,7 @@ index 11c4d23ba988dac5f3fd85142083c77fb603e673..a03e4c5b8693395f4a145ca565b074d6 public ChunkCache(World world, BlockPosition blockposition, BlockPosition blockposition1) { this.e = world; -@@ -27,7 +27,7 @@ public class ChunkCache implements IBlockAccess, ICollisionAccess { +@@ -29,7 +29,7 @@ public class ChunkCache implements IBlockAccess, ICollisionAccess { for (k = this.a; k <= i; ++k) { for (l = this.b; l <= j; ++l) { @@ -2649,7 +2657,7 @@ index 11c4d23ba988dac5f3fd85142083c77fb603e673..a03e4c5b8693395f4a145ca565b074d6 } } -@@ -52,7 +52,7 @@ public class ChunkCache implements IBlockAccess, ICollisionAccess { +@@ -54,7 +54,7 @@ public class ChunkCache implements IBlockAccess, ICollisionAccess { int k = i - this.a; int l = j - this.b; @@ -2658,7 +2666,7 @@ index 11c4d23ba988dac5f3fd85142083c77fb603e673..a03e4c5b8693395f4a145ca565b074d6 IChunkAccess ichunkaccess = this.c[k][l]; return (IChunkAccess) (ichunkaccess != null ? ichunkaccess : new ChunkEmpty(this.e, new ChunkCoordIntPair(i, j))); -@@ -71,6 +71,29 @@ public class ChunkCache implements IBlockAccess, ICollisionAccess { +@@ -73,6 +73,29 @@ public class ChunkCache implements IBlockAccess, ICollisionAccess { return this.a(i, j); } @@ -2689,7 +2697,7 @@ index 11c4d23ba988dac5f3fd85142083c77fb603e673..a03e4c5b8693395f4a145ca565b074d6 @Override public TileEntity getTileEntity(BlockPosition blockposition) { diff --git a/src/main/java/net/minecraft/server/ChunkCoordIntPair.java b/src/main/java/net/minecraft/server/ChunkCoordIntPair.java -index 260644bf0be4c5b2d96033f11382f88231048ce3..5a975f6bc60922ac872ec9c00c9150ce7dcad046 100644 +index 2837823547bdc9655376af3af89c43d84719d513..35b8a85d1280ba3be757b14b14388954ac1617d4 100644 --- a/src/main/java/net/minecraft/server/ChunkCoordIntPair.java +++ b/src/main/java/net/minecraft/server/ChunkCoordIntPair.java @@ -11,27 +11,33 @@ public class ChunkCoordIntPair { @@ -2729,22 +2737,22 @@ index 260644bf0be4c5b2d96033f11382f88231048ce3..5a975f6bc60922ac872ec9c00c9150ce } diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index beb6b63fa483f0a7b29f5403bebf7ee47b27cd29..64d84b334d211fe39e808d2c8b5d457757fb1359 100644 +index 5585b5646b5f3650aa3b795be06f920699a85403..359441cd993a95f933f23aebcec8180f314a5f09 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -23,7 +23,7 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -24,7 +24,7 @@ public class ChunkProviderServer extends IChunkProvider { private final ChunkMapDistance chunkMapDistance; - public final ChunkGenerator chunkGenerator; + public final ChunkGenerator chunkGenerator; private final WorldServer world; - private final Thread serverThread; + public final Thread serverThread; // Paper - private -> public private final LightEngineThreaded lightEngine; private final ChunkProviderServer.a serverThreadQueue; public final PlayerChunkMap playerChunkMap; -@@ -35,6 +35,169 @@ public class ChunkProviderServer extends IChunkProvider { - private final ChunkStatus[] cacheStatus = new ChunkStatus[4]; +@@ -37,6 +37,167 @@ public class ChunkProviderServer extends IChunkProvider { private final IChunkAccess[] cacheChunk = new IChunkAccess[4]; - + @Nullable + private SpawnerCreature.d p; + // Paper start + final com.destroystokyo.paper.util.concurrent.WeakSeqLock loadedChunkMapSeqLock = new com.destroystokyo.paper.util.concurrent.WeakSeqLock(); + final it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap loadedChunkMap = new it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap<>(8192, 0.5f); @@ -2863,7 +2871,7 @@ index beb6b63fa483f0a7b29f5403bebf7ee47b27cd29..64d84b334d211fe39e808d2c8b5d4577 + } + ChunkCoordIntPair chunkPos = new ChunkCoordIntPair(x, z); + Long identifier = Long.valueOf(this.chunkFutureAwaitCounter++); -+ this.addTicketAtLevel(TicketType.FUTURE_AWAIT, chunkPos, ticketLevel, identifier); ++ this.chunkMapDistance.addTicketAtLevel(TicketType.FUTURE_AWAIT, chunkPos, ticketLevel, identifier); + this.tickDistanceManager(); + + PlayerChunk chunk = this.playerChunkMap.getUpdatingChunk(chunkPos.pair()); @@ -2900,18 +2908,16 @@ index beb6b63fa483f0a7b29f5403bebf7ee47b27cd29..64d84b334d211fe39e808d2c8b5d4577 + } + } finally { + // due to odd behaviour with CB unload implementation we need to have these AFTER the load callback. -+ ChunkProviderServer.this.addTicketAtLevel(TicketType.UNKNOWN, chunkPos, ticketLevel, chunkPos); -+ ChunkProviderServer.this.removeTicketAtLevel(TicketType.FUTURE_AWAIT, chunkPos, ticketLevel, identifier); ++ ChunkProviderServer.this.chunkMapDistance.addTicketAtLevel(TicketType.UNKNOWN, chunkPos, ticketLevel, chunkPos); ++ ChunkProviderServer.this.chunkMapDistance.removeTicketAtLevel(TicketType.FUTURE_AWAIT, chunkPos, ticketLevel, identifier); + } + }, this.serverThreadQueue); + } + // Paper end -+ -+ - public ChunkProviderServer(WorldServer worldserver, File file, DataFixer datafixer, DefinedStructureManager definedstructuremanager, Executor executor, ChunkGenerator chunkgenerator, int i, WorldLoadListener worldloadlistener, Supplier supplier) { + + public ChunkProviderServer(WorldServer worldserver, Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, DefinedStructureManager definedstructuremanager, Executor executor, ChunkGenerator chunkgenerator, int i, boolean flag, WorldLoadListener worldloadlistener, Supplier supplier) { this.world = worldserver; - this.serverThreadQueue = new ChunkProviderServer.a(worldserver); -@@ -87,6 +250,49 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -90,6 +251,49 @@ public class ChunkProviderServer extends IChunkProvider { this.cacheChunk[0] = ichunkaccess; } @@ -2961,11 +2967,25 @@ index beb6b63fa483f0a7b29f5403bebf7ee47b27cd29..64d84b334d211fe39e808d2c8b5d4577 @Nullable @Override public IChunkAccess getChunkAt(int i, int j, ChunkStatus chunkstatus, boolean flag) { +@@ -372,10 +576,9 @@ public class ChunkProviderServer extends IChunkProvider { + + this.p = spawnercreature_d; + this.world.getMethodProfiler().exit(); +- List list = Lists.newArrayList(this.playerChunkMap.f()); +- +- Collections.shuffle(list); +- list.forEach((playerchunk) -> { ++ //List list = Lists.newArrayList(this.playerChunkMap.f()); // Paper ++ //Collections.shuffle(list); // Paper ++ this.playerChunkMap.f().forEach((playerchunk) -> { // Paper - no... just no... + Optional optional = ((Either) playerchunk.a().getNow(PlayerChunk.UNLOADED_CHUNK)).left(); + + if (optional.isPresent()) { diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java -index 652067757a6b9510b19c339072f1f4183e8d64b6..638b0e39798a3f75566fcf9ea48b81024e60b471 100644 +index b0f7ea97d4795655b6c30b296fd929806dac4ef1..882c2733beaff1df68b892d44fc77cacf4364ff4 100644 --- a/src/main/java/net/minecraft/server/ChunkSection.java +++ b/src/main/java/net/minecraft/server/ChunkSection.java -@@ -132,6 +132,7 @@ public class ChunkSection { +@@ -133,6 +133,7 @@ public class ChunkSection { return this.blockIds; } @@ -2974,39 +2994,39 @@ index 652067757a6b9510b19c339072f1f4183e8d64b6..638b0e39798a3f75566fcf9ea48b8102 packetdataserializer.writeShort(this.nonEmptyBlockCount); this.blockIds.b(packetdataserializer); diff --git a/src/main/java/net/minecraft/server/DataBits.java b/src/main/java/net/minecraft/server/DataBits.java -index 7ca3a1d0c592df0038953c9fd81783f9bb5c8beb..2edd9b87146a3d1b6623b0efb17b28b524f18c2f 100644 +index cd572c76522b2ee900a03fd5cf6753f3297c1ccd..2c3580c1c7bcd6afc83a45550c0f672a592e0c38 100644 --- a/src/main/java/net/minecraft/server/DataBits.java +++ b/src/main/java/net/minecraft/server/DataBits.java @@ -83,6 +83,7 @@ public class DataBits { - } + return (int) (k >> l & this.d); } + public long[] getDataBits() { return this.a(); } // Paper - OBFHELPER public long[] a() { - return this.a; + return this.b; } diff --git a/src/main/java/net/minecraft/server/DataPalette.java b/src/main/java/net/minecraft/server/DataPalette.java -index 75ba69886872f737ff102cb68ec229feb268f94a..45403fbe308cbc6192536d5df606cf8643a65e13 100644 +index b7f4330bbe3b51e6792043cbd0c46c73aad457cb..75b721933ccbe8edc1cd7ea5cc4562214e26b66d 100644 --- a/src/main/java/net/minecraft/server/DataPalette.java +++ b/src/main/java/net/minecraft/server/DataPalette.java -@@ -4,10 +4,12 @@ import javax.annotation.Nullable; +@@ -5,10 +5,12 @@ import javax.annotation.Nullable; public interface DataPalette { + default int getOrCreateIdFor(T object) { return this.a(object); } // Paper - OBFHELPER int a(T t0); - boolean b(T t0); + boolean a(Predicate predicate); + @Nullable default T getObject(int dataBits) { return this.a(dataBits); } // Paper - OBFHELPER @Nullable T a(int i); diff --git a/src/main/java/net/minecraft/server/DataPaletteBlock.java b/src/main/java/net/minecraft/server/DataPaletteBlock.java -index 774a8f543424853be5fc8c0367d734ddf196d7f9..d5f5a51872dfabdbb828b6c20d61893aed2efec7 100644 +index 8856981da86219bdb036aa6246152f382ff8a818..4c6979903d287f7f37d9029f6ce2551742f26164 100644 --- a/src/main/java/net/minecraft/server/DataPaletteBlock.java +++ b/src/main/java/net/minecraft/server/DataPaletteBlock.java -@@ -11,7 +11,7 @@ import java.util.stream.Collectors; +@@ -10,7 +10,7 @@ import java.util.stream.Collectors; public class DataPaletteBlock implements DataPaletteExpandable { @@ -3015,7 +3035,7 @@ index 774a8f543424853be5fc8c0367d734ddf196d7f9..d5f5a51872dfabdbb828b6c20d61893a private final DataPaletteExpandable c = (i, object) -> { return 0; }; -@@ -19,9 +19,9 @@ public class DataPaletteBlock implements DataPaletteExpandable { +@@ -18,9 +18,9 @@ public class DataPaletteBlock implements DataPaletteExpandable { private final Function e; private final Function f; private final T g; @@ -3028,7 +3048,7 @@ index 774a8f543424853be5fc8c0367d734ddf196d7f9..d5f5a51872dfabdbb828b6c20d61893a private final ReentrantLock j = new ReentrantLock(); public void a() { -@@ -56,6 +56,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { +@@ -55,6 +55,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { return j << 8 | k << 4 | i; } @@ -3036,7 +3056,7 @@ index 774a8f543424853be5fc8c0367d734ddf196d7f9..d5f5a51872dfabdbb828b6c20d61893a private void b(int i) { if (i != this.i) { this.i = i; -@@ -133,6 +134,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { +@@ -132,6 +133,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { return t0 == null ? this.g : t0; } @@ -3044,32 +3064,24 @@ index 774a8f543424853be5fc8c0367d734ddf196d7f9..d5f5a51872dfabdbb828b6c20d61893a public void b(PacketDataSerializer packetdataserializer) { this.a(); packetdataserializer.writeByte(this.i); -diff --git a/src/main/java/net/minecraft/server/DimensionManager.java b/src/main/java/net/minecraft/server/DimensionManager.java -index 5724fe6e57d3671b4978aecaf217ac4c2e0d7f82..393bc4dc700bbf8653db0662c7957f676b0a647a 100644 ---- a/src/main/java/net/minecraft/server/DimensionManager.java -+++ b/src/main/java/net/minecraft/server/DimensionManager.java -@@ -55,6 +55,7 @@ public class DimensionManager implements MinecraftSerializable { - return this.folder.isEmpty() ? file : new File(file, this.folder); - } - -+ public WorldServer world; // Paper - store ref to world this manager is for - public WorldProvider getWorldProvider(World world) { - return (WorldProvider) this.providerFactory.apply(world, this); - } diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index f4863852b04c5fa55b79acabe40ce59909b9bbbd..7e01f6a1807f9885a7f4b163ce6bb626d8786a9a 100644 +index 51499ef45faa2bba5f180ee333c09af73d3b708e..9da321fc0e02e4a2e47f515011df33714affd368 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -1033,6 +1033,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener { +@@ -983,8 +983,9 @@ public abstract class Entity implements INamableTileEntity, ICommandListener { } -+ public final AxisAlignedBB getCollisionBox(){return au();} //Paper - OBFHELPER - @Nullable - public AxisAlignedBB au() { +- @Nullable +- public AxisAlignedBB ay() { ++ ++ @Nullable public final AxisAlignedBB getCollisionBox(){return ay();} //Paper - OBFHELPER ++ @Nullable public AxisAlignedBB ay() { return null; -@@ -1842,6 +1843,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener { - return false; + } + +@@ -1774,6 +1775,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener { + return EnumInteractionResult.PASS; } + public final AxisAlignedBB getHardCollisionBox(Entity entity){ return j(entity);}//Paper - OBFHELPER @@ -3077,7 +3089,7 @@ index f4863852b04c5fa55b79acabe40ce59909b9bbbd..7e01f6a1807f9885a7f4b163ce6bb626 public AxisAlignedBB j(Entity entity) { return null; diff --git a/src/main/java/net/minecraft/server/EntityCreature.java b/src/main/java/net/minecraft/server/EntityCreature.java -index fe69161e5b9e69c75696a3434a681d0489f3863e..b40c8d2f83a80bcb8925632a1e7d6bb4cc0caebf 100644 +index e83d587fd4feee1e36c18c49b98e669c09f5de20..c94197a50269622e8995685119bac984c45e6833 100644 --- a/src/main/java/net/minecraft/server/EntityCreature.java +++ b/src/main/java/net/minecraft/server/EntityCreature.java @@ -6,6 +6,8 @@ import org.bukkit.event.entity.EntityUnleashEvent; @@ -3090,10 +3102,10 @@ index fe69161e5b9e69c75696a3434a681d0489f3863e..b40c8d2f83a80bcb8925632a1e7d6bb4 super(entitytypes, world); } diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index bdfb1738539d0e0c9043ecb63950a5e7fce1c532..0b06fa2b664830d40cdb93968bc2f8c98415d1bf 100644 +index b309d9a13b35f5c04c3a0f048e858df99d8ac617..e5455d99e3f5607a5754e5760d42853a62dddb82 100644 --- a/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java -@@ -146,6 +146,7 @@ public abstract class EntityInsentient extends EntityLiving { +@@ -160,6 +160,7 @@ public abstract class EntityInsentient extends EntityLiving { return this.goalTarget; } @@ -3102,19 +3114,19 @@ index bdfb1738539d0e0c9043ecb63950a5e7fce1c532..0b06fa2b664830d40cdb93968bc2f8c9 // CraftBukkit start - fire event setGoalTarget(entityliving, EntityTargetEvent.TargetReason.UNKNOWN, true); diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 9d1adaaa2c0dbd3773f81a1b54aac98fd16ae26d..3ace8ee854c11abd607dc27b93fe61a0982a73de 100644 +index 8ff295ed373cc316e56e4a01a268f98b7b773bd5..dccb315440f7429fe881bd0d12af8f1ae8e35c3d 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -129,6 +129,7 @@ public abstract class EntityLiving extends Entity { - public org.bukkit.craftbukkit.attribute.CraftAttributeMap craftAttributes; +@@ -137,6 +137,7 @@ public abstract class EntityLiving extends Entity { public boolean collides = true; + public Set collidableExemptions = new HashSet<>(); public boolean canPickUpLoot; + public org.bukkit.craftbukkit.entity.CraftLivingEntity getBukkitLivingEntity() { return (org.bukkit.craftbukkit.entity.CraftLivingEntity) super.getBukkitEntity(); } // Paper @Override public float getBukkitYaw() { diff --git a/src/main/java/net/minecraft/server/EntityMonster.java b/src/main/java/net/minecraft/server/EntityMonster.java -index 00c3b666d7b568f1619d885de6ca7ab2ce0daa7a..e5322fbae5140ce784dad49b690767af8c52ce1c 100644 +index fb0f281261455c9f127abd8d3b336135ad84fc27..ebdd990829edb8e423f482fa4352fe2d468efcba 100644 --- a/src/main/java/net/minecraft/server/EntityMonster.java +++ b/src/main/java/net/minecraft/server/EntityMonster.java @@ -5,6 +5,7 @@ import java.util.function.Predicate; @@ -3126,21 +3138,21 @@ index 00c3b666d7b568f1619d885de6ca7ab2ce0daa7a..e5322fbae5140ce784dad49b690767af super(entitytypes, world); this.f = 5; diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 541ddc928b9a4e6a7bf5c6a4f64d78422d241d90..26e32aa1dbd6de0ba971c32f8daef0d92d65b683 100644 +index 6a38418d40763705639d361e47201f8b26216052..5bf3c279b86ed0fa416ee7dd9923172d6e6261a5 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -87,6 +87,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -91,6 +91,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public Integer clientViewDistance; // CraftBukkit end + public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet cachedSingleHashSet; // Paper + public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) { - super((World) worldserver, gameprofile); - playerinteractmanager.player = this; -@@ -98,6 +100,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - this.H = 1.0F; - this.a(worldserver); + super(worldserver, worldserver.getSpawn(), gameprofile); + this.spawnDimension = World.OVERWORLD; +@@ -102,6 +104,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + this.G = 1.0F; + this.b(worldserver); + this.cachedSingleHashSet = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<>(this); // Paper + @@ -3148,30 +3160,30 @@ index 541ddc928b9a4e6a7bf5c6a4f64d78422d241d90..26e32aa1dbd6de0ba971c32f8daef0d9 this.displayName = this.getName(); this.canPickUpLoot = true; diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java -index 29e776ca19621b93d5b295d12f0576e6980cf11a..4328273b1fca165320097dbac0650b31fae4e5ca 100644 +index 484e78746aa62bb0b12968165bf8e056b27152f3..9a772e40ad8f9858e6278b99d9d1ff5dc54513cb 100644 --- a/src/main/java/net/minecraft/server/EntityTypes.java +++ b/src/main/java/net/minecraft/server/EntityTypes.java -@@ -4,6 +4,7 @@ import com.mojang.datafixers.DataFixUtils; - import java.util.Collections; +@@ -3,6 +3,7 @@ package net.minecraft.server; + import com.google.common.collect.ImmutableSet; import java.util.Optional; import java.util.Set; // Paper +import java.util.Map; // Paper import java.util.UUID; import java.util.function.Function; import java.util.stream.Stream; -@@ -290,8 +291,8 @@ public class EntityTypes { - return this.bj.height; +@@ -305,8 +306,8 @@ public class EntityTypes { + return this.bq.height; } - @Nullable - public T a(World world) { + public T create(World world) { return this.a(world); } // Paper - OBFHELPER + @Nullable public T a(World world) { // Paper - OBFHELPER - return this.ba.create(this, world); + return this.be.create(this, world); } diff --git a/src/main/java/net/minecraft/server/IAsyncTaskHandler.java b/src/main/java/net/minecraft/server/IAsyncTaskHandler.java -index 1890c760f9ffd7628d6ae3db40c36f5272379227..7e5ece9d50af7151ad4cc084e3680dae41ac92be 100644 +index b77a0f0c2ee30df44b113aa6c8d4fa9206d3e2ba..1ba26ee10f338edbec0f580bb55d083a3d6d2284 100644 --- a/src/main/java/net/minecraft/server/IAsyncTaskHandler.java +++ b/src/main/java/net/minecraft/server/IAsyncTaskHandler.java @@ -68,6 +68,15 @@ public abstract class IAsyncTaskHandler implements Mailbox implements - return this.c != null && this.c.f != null ? this.c.f[enumdirection.ordinal()] : VoxelShapes.a(this.j(iblockaccess, blockposition), enumdirection); - } - -+ public final boolean exceedsCube(){ return f();} // Paper - OBFHELPER - public boolean f() { - return this.c == null || this.c.h; + return this.getType(blockposition).f(); } diff --git a/src/main/java/net/minecraft/server/IOWorker.java b/src/main/java/net/minecraft/server/IOWorker.java -index c5658c0779b0e0d51fd4921456b6fef0711d7be3..b90baef0f54bdb8f5ee51cdde149f64e39887ef5 100644 +index 38ccfd78639a85abcefb915c5c231be5881cebc1..8668b8f3941f37a7bc30a55c33baf74bd8ac49e3 100644 --- a/src/main/java/net/minecraft/server/IOWorker.java +++ b/src/main/java/net/minecraft/server/IOWorker.java -@@ -22,7 +22,7 @@ public class IOWorker implements AutoCloseable { - private final Thread b; - private final AtomicBoolean c = new AtomicBoolean(); - private final Queue d = Queues.newConcurrentLinkedQueue(); -- private final RegionFileCache e; -+ private final RegionFileCache e; public RegionFileCache getRegionFileCache() { return e; } // Paper - OBFHELPER - private final Map f = Maps.newLinkedHashMap(); - private boolean g = true; - private CompletableFuture h = new CompletableFuture(); +@@ -21,7 +21,7 @@ public class IOWorker implements AutoCloseable { + private static final Logger LOGGER = LogManager.getLogger(); + private final AtomicBoolean b = new AtomicBoolean(); + private final ThreadedMailbox c; +- private final RegionFileCache d; ++ private final RegionFileCache d;public RegionFileCache getRegionFileCache() { return d; } // Paper - OBFHELPER + private final Map e = Maps.newLinkedHashMap(); + + protected IOWorker(File file, boolean flag, String s) { diff --git a/src/main/java/net/minecraft/server/IWorldReader.java b/src/main/java/net/minecraft/server/IWorldReader.java -index ba315131e1633ce8b9b8824b00d2be47950d6f19..cbe2aa4c0acbdcc0b453fdad9a192a3e264406c6 100644 +index 284283c5f062107df88e77edaf092cf23302a109..b6d6905260cdd32873010f24ef5a3505e66159be 100644 --- a/src/main/java/net/minecraft/server/IWorldReader.java +++ b/src/main/java/net/minecraft/server/IWorldReader.java -@@ -4,6 +4,7 @@ import javax.annotation.Nullable; +@@ -5,6 +5,7 @@ import javax.annotation.Nullable; public interface IWorldReader extends IBlockLightAccess, ICollisionAccess, BiomeManager.Provider { @@ -3257,31 +3257,19 @@ index ba315131e1633ce8b9b8824b00d2be47950d6f19..cbe2aa4c0acbdcc0b453fdad9a192a3e IChunkAccess getChunkAt(int i, int j, ChunkStatus chunkstatus, boolean flag); diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java -index 75308712d0642d5ab168de653023349df8aee5ed..aa7501d366b15e7f7f64b7d98a1dccff99f731d2 100644 +index dc5625f54a54db35e5dfa630f1414887c736b704..76091ab3f149decc0d3c848b79edd24e20cf181d 100644 --- a/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java -@@ -37,10 +37,19 @@ import org.bukkit.event.world.StructureGrowEvent; - public final class ItemStack { - +@@ -49,7 +49,7 @@ public final class ItemStack { + })).apply(instance, ItemStack::new); + }); private static final Logger LOGGER = LogManager.getLogger(); -- public static final ItemStack a = new ItemStack((Item) null); -+ public static final ItemStack a = new ItemStack((Item) null);public static final ItemStack NULL_ITEM = a; // Paper - OBFHELPER - public static final DecimalFormat b = H(); - private int count; - private int e; -+ // Paper start -+ private org.bukkit.craftbukkit.inventory.CraftItemStack bukkitStack; -+ public org.bukkit.inventory.ItemStack getBukkitStack() { -+ if (bukkitStack == null || bukkitStack.getHandle() != this) { -+ bukkitStack = org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(this); -+ } -+ return bukkitStack; -+ } -+ // Paper end - @Deprecated - private Item item; - private NBTTagCompound tag; -@@ -593,6 +602,17 @@ public final class ItemStack { +- public static final ItemStack b = new ItemStack((Item) null); ++ public static final ItemStack b = new ItemStack((Item) null);public static final ItemStack NULL_ITEM = b; // Paper - OBFHELPER + public static final DecimalFormat c = (DecimalFormat) SystemUtils.a((new DecimalFormat("#.##")), (decimalformat) -> { // CraftBukkit - decompile error + decimalformat.setDecimalFormatSymbols(DecimalFormatSymbols.getInstance(Locale.ROOT)); + }); +@@ -606,6 +606,24 @@ public final class ItemStack { return this.tag != null ? this.tag.getList("Enchantments", 10) : new NBTTagList(); } @@ -3295,11 +3283,18 @@ index 75308712d0642d5ab168de653023349df8aee5ed..aa7501d366b15e7f7f64b7d98a1dccff + public static ItemStack fromBukkitCopy(org.bukkit.inventory.ItemStack itemstack) { + return CraftItemStack.asNMSCopy(itemstack); + } ++ private org.bukkit.craftbukkit.inventory.CraftItemStack bukkitStack; ++ public org.bukkit.inventory.ItemStack getBukkitStack() { ++ if (bukkitStack == null || bukkitStack.getHandle() != this) { ++ bukkitStack = org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(this); ++ } ++ return bukkitStack; ++ } + // Paper end public void setTag(@Nullable NBTTagCompound nbttagcompound) { this.tag = nbttagcompound; if (this.getItem().usesDurability()) { -@@ -685,6 +705,7 @@ public final class ItemStack { +@@ -698,6 +716,7 @@ public final class ItemStack { return this.tag != null && this.tag.hasKeyOfType("Enchantments", 9) ? !this.tag.getList("Enchantments", 10).isEmpty() : false; } @@ -3307,7 +3302,7 @@ index 75308712d0642d5ab168de653023349df8aee5ed..aa7501d366b15e7f7f64b7d98a1dccff public void a(String s, NBTBase nbtbase) { this.getOrCreateTag().set(s, nbtbase); } -@@ -761,6 +782,7 @@ public final class ItemStack { +@@ -783,6 +802,7 @@ public final class ItemStack { // CraftBukkit start @Deprecated public void setItem(Item item) { @@ -3317,10 +3312,10 @@ index 75308712d0642d5ab168de653023349df8aee5ed..aa7501d366b15e7f7f64b7d98a1dccff // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java new file mode 100644 -index 0000000000000000000000000000000000000000..16302c4ac6d3e40318a762cea0afcf3f94715216 +index 0000000000000000000000000000000000000000..da7a325d070e194cd1664ed20dcb3a762c9a517a --- /dev/null +++ b/src/main/java/net/minecraft/server/MCUtil.java -@@ -0,0 +1,514 @@ +@@ -0,0 +1,502 @@ +package net.minecraft.server; + +import com.destroystokyo.paper.block.TargetBlockInfo; @@ -3782,24 +3777,12 @@ index 0000000000000000000000000000000000000000..16302c4ac6d3e40318a762cea0afcf3f + asyncExecutor.execute(run); + } + -+ @Nullable -+ public static TileEntityHopper getHopper(World world, BlockPosition pos) { -+ Chunk chunk = world.getChunkIfLoaded(pos.getX() >> 4, pos.getZ() >> 4); -+ if (chunk != null && chunk.getType(new BlockPosition(pos.getX(), pos.getY(), pos.getZ())).getBlock() == Blocks.HOPPER) { -+ TileEntity tileEntity = chunk.getTileEntityImmediately(pos); -+ if (tileEntity instanceof TileEntityHopper) { -+ return (TileEntityHopper) tileEntity; -+ } -+ } -+ return null; -+ } -+ + @Nonnull -+ public static World getNMSWorld(@Nonnull org.bukkit.World world) { ++ public static WorldServer getNMSWorld(@Nonnull org.bukkit.World world) { + return ((CraftWorld) world).getHandle(); + } + -+ public static World getNMSWorld(@Nonnull org.bukkit.entity.Entity entity) { ++ public static WorldServer getNMSWorld(@Nonnull org.bukkit.entity.Entity entity) { + return getNMSWorld(entity.getWorld()); + } + @@ -3836,12 +3819,12 @@ index 0000000000000000000000000000000000000000..16302c4ac6d3e40318a762cea0afcf3f + } +} diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index b4a0bd79511a3b1185a165991c937375aeecf3d1..786d38438cc1bd5a736b2dfa80aca9b9c6253e65 100644 +index 5e2dff9a30615b5580710f872a92ab9f07fca6cf..70604fbf6bdd5166fc91d57fb4db4a8337bc4727 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -741,6 +741,9 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant map; + public final Map map; // Paper - private NBTTagCompound(Map map) { + protected NBTTagCompound(Map map) { this.map = map; -@@ -123,11 +123,15 @@ public class NBTTagCompound implements NBTBase { +@@ -133,10 +133,14 @@ public class NBTTagCompound implements NBTBase { this.map.put(s, NBTTagLong.a(i)); } + public void setUUID(String prefix, UUID uuid) { a(prefix, uuid); } // Paper - OBFHELPER public void a(String s, UUID uuid) { - this.setLong(s + "Most", uuid.getMostSignificantBits()); - this.setLong(s + "Least", uuid.getLeastSignificantBits()); + this.map.put(s, GameProfileSerializer.a(uuid)); } + + @Nullable public UUID getUUID(String prefix) { return a(prefix); } // Paper - OBFHELPER + @Nullable public UUID a(String s) { - return new UUID(this.getLong(s + "Most"), this.getLong(s + "Least")); + return GameProfileSerializer.a(this.get(s)); } diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index 6700582e362b3ff2e0aa4a203981f75de0f22d89..3ccf1663669c79a63a6b3a9f6dc17a6e25e91915 100644 +index 69718caa347bc75ed243041797a6b53d90fc553c..c2fdccfb9192aa7ec55fd67c169cba71a695075c 100644 --- a/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java -@@ -159,6 +159,7 @@ public class NetworkManager extends SimpleChannelInboundHandler> { +@@ -158,6 +158,7 @@ public class NetworkManager extends SimpleChannelInboundHandler> { } @@ -3890,7 +3872,7 @@ index 6700582e362b3ff2e0aa4a203981f75de0f22d89..3ccf1663669c79a63a6b3a9f6dc17a6e private void b(Packet packet, @Nullable GenericFutureListener> genericfuturelistener) { EnumProtocol enumprotocol = EnumProtocol.a(packet); EnumProtocol enumprotocol1 = (EnumProtocol) this.channel.attr(NetworkManager.c).get(); -@@ -199,6 +200,7 @@ public class NetworkManager extends SimpleChannelInboundHandler> { +@@ -198,6 +199,7 @@ public class NetworkManager extends SimpleChannelInboundHandler> { } @@ -3898,7 +3880,7 @@ index 6700582e362b3ff2e0aa4a203981f75de0f22d89..3ccf1663669c79a63a6b3a9f6dc17a6e private void o() { if (this.channel != null && this.channel.isOpen()) { Queue queue = this.packetQueue; -@@ -327,9 +329,9 @@ public class NetworkManager extends SimpleChannelInboundHandler> { +@@ -326,9 +328,9 @@ public class NetworkManager extends SimpleChannelInboundHandler> { static class QueuedPacket { @@ -3911,10 +3893,10 @@ index 6700582e362b3ff2e0aa4a203981f75de0f22d89..3ccf1663669c79a63a6b3a9f6dc17a6e public QueuedPacket(Packet packet, @Nullable GenericFutureListener> genericfuturelistener) { this.a = packet; diff --git a/src/main/java/net/minecraft/server/PacketDataSerializer.java b/src/main/java/net/minecraft/server/PacketDataSerializer.java -index 81b6f4581f8e4d956668535a44342f991d677267..d9574a9ace96d8c5666e62a5aed96a67021b91d8 100644 +index f574a28b68cf4d3745ee5f1a3756e19dbc23ca92..6e049c2e2a142ce022b9dc278a3bb302f723e42c 100644 --- a/src/main/java/net/minecraft/server/PacketDataSerializer.java +++ b/src/main/java/net/minecraft/server/PacketDataSerializer.java -@@ -33,6 +33,7 @@ public class PacketDataSerializer extends ByteBuf { +@@ -36,6 +36,7 @@ public class PacketDataSerializer extends ByteBuf { this.a = bytebuf; } @@ -3935,7 +3917,7 @@ index 90223deae3376fd6828eddf3831dab96650afef2..63c4dbd327beb7b6ab42eb44650d68ac throw new SkipEncodeException(throwable); } else { diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -index 677e3e5f687e81ffb6c6aec134e2a19b90bd61cf..3a1d0deb0dec880d73185690e2a7c769a2731479 100644 +index cb0b7e7157b629c259b0ccb946c29cbcb3c6fa98..e336437207f9d6adbab69ef2785c129ff2ec1b36 100644 --- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java +++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java @@ -17,7 +17,7 @@ public class PacketPlayOutMapChunk implements Packet { @@ -3946,8 +3928,8 @@ index 677e3e5f687e81ffb6c6aec134e2a19b90bd61cf..3a1d0deb0dec880d73185690e2a7c769 + private byte[] f; private byte[] getData() { return this.f; } // Paper - OBFHELPER private List g; private boolean h; - -@@ -129,6 +129,7 @@ public class PacketPlayOutMapChunk implements Packet { + private boolean i; +@@ -133,6 +133,7 @@ public class PacketPlayOutMapChunk implements Packet { return bytebuf; } @@ -3956,7 +3938,7 @@ index 677e3e5f687e81ffb6c6aec134e2a19b90bd61cf..3a1d0deb0dec880d73185690e2a7c769 int j = 0; ChunkSection[] achunksection = chunk.getSections(); diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index 5c5bf010d07b65f1328541843b0f24ce5d50e6ac..6e9f402fb0faccc222b4289deb36e2d85a66eb7c 100644 +index dc5e59bcecbe080445f33daa01b81ba747ed6337..ca41e420a1ab22f097dd0b98e156fd51434733d8 100644 --- a/src/main/java/net/minecraft/server/PlayerChunk.java +++ b/src/main/java/net/minecraft/server/PlayerChunk.java @@ -19,9 +19,9 @@ public class PlayerChunk { @@ -3972,7 +3954,7 @@ index 5c5bf010d07b65f1328541843b0f24ce5d50e6ac..6e9f402fb0faccc222b4289deb36e2d8 private CompletableFuture chunkSave; public int oldTicketLevel; private int ticketLevel; -@@ -38,6 +38,8 @@ public class PlayerChunk { +@@ -37,6 +37,8 @@ public class PlayerChunk { public final PlayerChunk.d players; private boolean hasBeenLoaded; @@ -3981,7 +3963,7 @@ index 5c5bf010d07b65f1328541843b0f24ce5d50e6ac..6e9f402fb0faccc222b4289deb36e2d8 public PlayerChunk(ChunkCoordIntPair chunkcoordintpair, int i, LightEngine lightengine, PlayerChunk.c playerchunk_c, PlayerChunk.d playerchunk_d) { this.statusFutures = new AtomicReferenceArray(PlayerChunk.CHUNK_STATUSES.size()); this.fullChunkFuture = PlayerChunk.UNLOADED_CHUNK_FUTURE; -@@ -53,8 +55,47 @@ public class PlayerChunk { +@@ -52,8 +54,47 @@ public class PlayerChunk { this.ticketLevel = this.oldTicketLevel; this.n = this.oldTicketLevel; this.a(i); @@ -4029,7 +4011,7 @@ index 5c5bf010d07b65f1328541843b0f24ce5d50e6ac..6e9f402fb0faccc222b4289deb36e2d8 // CraftBukkit start public Chunk getFullChunk() { if (!getChunkState(this.oldTicketLevel).isAtLeast(PlayerChunk.State.BORDER)) return null; // note: using oldTicketLevel for isLoaded checks -@@ -63,6 +104,14 @@ public class PlayerChunk { +@@ -62,6 +103,14 @@ public class PlayerChunk { return either == null ? null : (Chunk) either.left().orElse(null); } // CraftBukkit end @@ -4044,7 +4026,7 @@ index 5c5bf010d07b65f1328541843b0f24ce5d50e6ac..6e9f402fb0faccc222b4289deb36e2d8 public CompletableFuture> getStatusFutureUnchecked(ChunkStatus chunkstatus) { CompletableFuture> completablefuture = (CompletableFuture) this.statusFutures.get(chunkstatus.c()); -@@ -74,14 +123,17 @@ public class PlayerChunk { +@@ -73,14 +122,17 @@ public class PlayerChunk { return getChunkStatus(this.ticketLevel).b(chunkstatus) ? this.getStatusFutureUnchecked(chunkstatus) : PlayerChunk.UNLOADED_CHUNK_ACCESS_FUTURE; } @@ -4062,7 +4044,7 @@ index 5c5bf010d07b65f1328541843b0f24ce5d50e6ac..6e9f402fb0faccc222b4289deb36e2d8 public CompletableFuture> c() { return this.fullChunkFuture; } -@@ -335,13 +387,27 @@ public class PlayerChunk { +@@ -322,13 +374,27 @@ public class PlayerChunk { this.hasBeenLoaded |= flag3; if (!flag2 && flag3) { @@ -4091,7 +4073,7 @@ index 5c5bf010d07b65f1328541843b0f24ce5d50e6ac..6e9f402fb0faccc222b4289deb36e2d8 this.a(((CompletableFuture>) completablefuture).thenApply((either1) -> { // CraftBukkit - decompile error playerchunkmap.getClass(); return either1.ifLeft(playerchunkmap::a); -@@ -352,12 +418,24 @@ public class PlayerChunk { +@@ -339,12 +405,24 @@ public class PlayerChunk { boolean flag5 = playerchunk_state1.isAtLeast(PlayerChunk.State.TICKING); if (!flag4 && flag5) { @@ -4118,7 +4100,7 @@ index 5c5bf010d07b65f1328541843b0f24ce5d50e6ac..6e9f402fb0faccc222b4289deb36e2d8 this.tickingFuture = PlayerChunk.UNLOADED_CHUNK_FUTURE; } -@@ -369,12 +447,24 @@ public class PlayerChunk { +@@ -356,12 +434,24 @@ public class PlayerChunk { throw (IllegalStateException) SystemUtils.c(new IllegalStateException()); } @@ -4146,10 +4128,10 @@ index 5c5bf010d07b65f1328541843b0f24ce5d50e6ac..6e9f402fb0faccc222b4289deb36e2d8 } diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 7ad30548e2ad221494d6870b0b3a08e1d2f3ed06..b505244516321292e56609eaa54693d84e0bf617 100644 +index 5f692d719fd270120207ebcf6d0a2a24e8d59f7b..3e2e355177e32856dac07dc8b98658ad1b717045 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -99,6 +99,28 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -101,6 +101,26 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { }; // CraftBukkit end @@ -4171,14 +4153,12 @@ index 7ad30548e2ad221494d6870b0b3a08e1d2f3ed06..b505244516321292e56609eaa54693d8 + int chunkZ = MCUtil.getChunkCoordinate(player.locZ()); + // Note: players need to be explicitly added to distance maps before they can be updated + } -+ -+ + // Paper end + - public PlayerChunkMap(WorldServer worldserver, File file, DataFixer datafixer, DefinedStructureManager definedstructuremanager, Executor executor, IAsyncTaskHandler iasynctaskhandler, ILightAccess ilightaccess, ChunkGenerator chunkgenerator, WorldLoadListener worldloadlistener, Supplier supplier, int i) { - super(new File(worldserver.getWorldProvider().getDimensionManager().a(file), "region"), datafixer); + public PlayerChunkMap(WorldServer worldserver, Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, DefinedStructureManager definedstructuremanager, Executor executor, IAsyncTaskHandler iasynctaskhandler, ILightAccess ilightaccess, ChunkGenerator chunkgenerator, WorldLoadListener worldloadlistener, Supplier supplier, int i, boolean flag) { + super(new File(convertable_conversionsession.a(worldserver.getDimensionKey()), "region"), datafixer, flag); this.visibleChunks = this.updatingChunks.clone(); -@@ -187,6 +209,14 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -190,6 +210,14 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { }; } @@ -4193,15 +4173,15 @@ index 7ad30548e2ad221494d6870b0b3a08e1d2f3ed06..b505244516321292e56609eaa54693d8 private CompletableFuture, PlayerChunk.Failure>> a(ChunkCoordIntPair chunkcoordintpair, int i, IntFunction intfunction) { List>> list = Lists.newArrayList(); int j = chunkcoordintpair.x; -@@ -867,6 +897,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -900,6 +928,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { if (!flag1) { this.chunkDistanceManager.a(SectionPosition.a((Entity) entityplayer), entityplayer); } + this.addPlayerToDistanceMaps(entityplayer); // Paper - distance maps } else { - SectionPosition sectionposition = entityplayer.K(); + SectionPosition sectionposition = entityplayer.N(); -@@ -874,6 +905,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -907,6 +936,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { if (!flag2) { this.chunkDistanceManager.b(sectionposition, entityplayer); } @@ -4209,7 +4189,7 @@ index 7ad30548e2ad221494d6870b0b3a08e1d2f3ed06..b505244516321292e56609eaa54693d8 } for (int k = i - this.viewDistance; k <= i + this.viewDistance; ++k) { -@@ -984,6 +1016,8 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1017,6 +1047,8 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } } @@ -4219,7 +4199,7 @@ index 7ad30548e2ad221494d6870b0b3a08e1d2f3ed06..b505244516321292e56609eaa54693d8 @Override diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 8cc5f417fe2ad2370b52236e8f5497688553aeba..f40cb14d5301631161f1701043ee987359d9a8e9 100644 +index 92922db3f57877507c6443c49f4c021aee667b1d..b8d3c4d35cee2ba4678f6d22b8ea956d598d9d9b 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -67,9 +67,9 @@ public class PlayerConnection implements PacketListenerPlayIn { @@ -4236,7 +4216,7 @@ index 8cc5f417fe2ad2370b52236e8f5497688553aeba..f40cb14d5301631161f1701043ee9873 private volatile int chatThrottle; private static final AtomicIntegerFieldUpdater chatSpamField = AtomicIntegerFieldUpdater.newUpdater(PlayerConnection.class, "chatThrottle"); diff --git a/src/main/java/net/minecraft/server/PlayerInventory.java b/src/main/java/net/minecraft/server/PlayerInventory.java -index 08768a3c877bfe26c2a9533af390068b172a5996..d103cfaace4f42aaad677103f4eef578490699da 100644 +index c027fb94881be14396cba879087861df35023500..3b65711b91c51ac7b4b5b2b0144ffd279fe60eeb 100644 --- a/src/main/java/net/minecraft/server/PlayerInventory.java +++ b/src/main/java/net/minecraft/server/PlayerInventory.java @@ -17,7 +17,7 @@ public class PlayerInventory implements IInventory, INamableTileEntity { @@ -4261,10 +4241,10 @@ index b3824898daa80da791cdc8cfd06900e9a0b3b5b5..bf4172be525d5bdd7c152117afce8bf0 MinecraftKey minecraftkey = IRegistry.POTION.getKey(potionregistry); diff --git a/src/main/java/net/minecraft/server/ProtoChunk.java b/src/main/java/net/minecraft/server/ProtoChunk.java -index 6e65306a275fe91ce82b28e4e6155f91dceaa3f2..39339fa27551b06a9bfd8ea67b1ec8c66726f488 100644 +index f92fbf136158336b65217a504ecd422bfcc4964f..070449198273e6c42e72c891882b82361d1c8dbd 100644 --- a/src/main/java/net/minecraft/server/ProtoChunk.java +++ b/src/main/java/net/minecraft/server/ProtoChunk.java -@@ -80,6 +80,18 @@ public class ProtoChunk implements IChunkAccess { +@@ -81,6 +81,18 @@ public class ProtoChunk implements IChunkAccess { } @@ -4284,10 +4264,10 @@ index 6e65306a275fe91ce82b28e4e6155f91dceaa3f2..39339fa27551b06a9bfd8ea67b1ec8c6 public IBlockData getType(BlockPosition blockposition) { int i = blockposition.getY(); diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java -index 7b6e0e86b00c7750267f0090b79b738696f115c4..187c4e0f58b7de58dfd2194afb194cbed0a58957 100644 +index 43c5b8258d9cd15d86d4160e9c614c7ca6152962..1ce85ab949213efb9eae6daddca6ac8fb15dd472 100644 --- a/src/main/java/net/minecraft/server/RegionFile.java +++ b/src/main/java/net/minecraft/server/RegionFile.java -@@ -88,6 +88,7 @@ public class RegionFile implements AutoCloseable { +@@ -93,6 +93,7 @@ public class RegionFile implements AutoCloseable { return this.d.resolve(s); } @@ -4296,11 +4276,11 @@ index 7b6e0e86b00c7750267f0090b79b738696f115c4..187c4e0f58b7de58dfd2194afb194cbe public synchronized DataInputStream a(ChunkCoordIntPair chunkcoordintpair) throws IOException { int i = this.getOffset(chunkcoordintpair); diff --git a/src/main/java/net/minecraft/server/RegionLimitedWorldAccess.java b/src/main/java/net/minecraft/server/RegionLimitedWorldAccess.java -index 8c123f265e674ca99bc06e4d64f212148f6cac1a..9d0e8c2d43ba56d53bc30c0a3e2d7d170d8be474 100644 +index a2ec45a6b8bd63299508113e3522436cea2507e5..478d252953c65792df9f0068a4c1afd1985151ab 100644 --- a/src/main/java/net/minecraft/server/RegionLimitedWorldAccess.java +++ b/src/main/java/net/minecraft/server/RegionLimitedWorldAccess.java -@@ -108,6 +108,26 @@ public class RegionLimitedWorldAccess implements GeneratorAccess { - return i >= ichunkaccess.getPos().x && i <= ichunkaccess1.getPos().x && j >= ichunkaccess.getPos().z && j <= ichunkaccess1.getPos().z; +@@ -101,6 +101,26 @@ public class RegionLimitedWorldAccess implements GeneratorAccessSeed { + return i >= this.n.x && i <= this.o.x && j >= this.n.z && j <= this.o.z; } + // Paper start - if loaded util @@ -4339,10 +4319,10 @@ index 4efcb8b595750891b421e524812542f0f67e9f3f..60948afa4ead71010dc27c7cef3e5acd return this.b.size(); } diff --git a/src/main/java/net/minecraft/server/SystemUtils.java b/src/main/java/net/minecraft/server/SystemUtils.java -index 7b92ecfff94e3c4a69269139ebed75fc59bbd4f1..7e224ebeff3bf34270df173a47b08d3290c00670 100644 +index 80ee8d196436e271833503a0e123401d1b3314a9..275c1d2d1eb2649de9a9b5aece6e88c21362efba 100644 --- a/src/main/java/net/minecraft/server/SystemUtils.java +++ b/src/main/java/net/minecraft/server/SystemUtils.java -@@ -58,7 +58,7 @@ public class SystemUtils { +@@ -68,7 +68,7 @@ public class SystemUtils { } public static long getMonotonicNanos() { @@ -4364,7 +4344,7 @@ index f82db93f88223ffddc55deec8f21efc5b774d900..75ab9f185b3231113dfa387c956a707b public static TicketType a(String s, Comparator comparator) { return new TicketType<>(s, comparator, 0L); diff --git a/src/main/java/net/minecraft/server/VoxelShapes.java b/src/main/java/net/minecraft/server/VoxelShapes.java -index 143be566c683ae035997f9a4058381a109f3de23..0e30d8c9933dc6595b9715ef6dc99cc8910892cb 100644 +index 3c08ae0cf92ab1f5395662e957ab4d9c03e13deb..86f6f082fe2991ea9065b09c9680b76ca1cf7154 100644 --- a/src/main/java/net/minecraft/server/VoxelShapes.java +++ b/src/main/java/net/minecraft/server/VoxelShapes.java @@ -21,10 +21,12 @@ public final class VoxelShapes { @@ -4381,7 +4361,7 @@ index 143be566c683ae035997f9a4058381a109f3de23..0e30d8c9933dc6595b9715ef6dc99cc8 return VoxelShapes.b; } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 2e1eabba14a3757d03fd90741651001e78c6322f..45ded8cd3aee69083f6196765208d8c2430f0a02 100644 +index 63d3d43f74bed94cd03aa3b7254e66302be861d5..bd5a2eee9cb435a5ee75a39cea231151fba00387 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -22,6 +22,7 @@ import org.bukkit.craftbukkit.SpigotTimings; // Spigot @@ -4392,15 +4372,16 @@ index 2e1eabba14a3757d03fd90741651001e78c6322f..45ded8cd3aee69083f6196765208d8c2 import org.bukkit.craftbukkit.block.data.CraftBlockData; import org.bukkit.event.block.BlockPhysicsEvent; // CraftBukkit end -@@ -94,6 +95,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - this.spigotConfig = new org.spigotmc.SpigotWorldConfig( worlddata.getName() ); // Spigot - this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(worlddata.getName(), this.spigotConfig); // Paper +@@ -95,7 +96,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + + protected World(WorldDataMutable worlddatamutable, ResourceKey resourcekey, ResourceKey resourcekey1, DimensionManager dimensionmanager, Supplier supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env) { + this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((WorldDataServer) worlddatamutable).getName()); // Spigot +- this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(worlddata.getName(), this.spigotConfig); // Paper ++ this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig((((WorldDataServer)worlddatamutable).getName()), this.spigotConfig); // Paper this.generator = gen; -+ if (dimensionmanager.world == null) dimensionmanager.world = (WorldServer) this; // Paper this.world = new CraftWorld((WorldServer) this, gen, env); this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit - this.ticksPerMonsterSpawns = this.getServer().getTicksPerMonsterSpawns(); // CraftBukkit -@@ -183,6 +185,39 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -247,6 +248,39 @@ public abstract class World implements GeneratorAccess, AutoCloseable { return (Chunk) this.getChunkAt(i, j, ChunkStatus.FULL); } @@ -4408,7 +4389,7 @@ index 2e1eabba14a3757d03fd90741651001e78c6322f..45ded8cd3aee69083f6196765208d8c2 + @Nullable + @Override + public IChunkAccess getChunkIfLoadedImmediately(int x, int z) { -+ return ((ChunkProviderServer)this.chunkProvider).getChunkAtIfLoadedImmediately(x, z); ++ return ((WorldServer)this).chunkProvider.getChunkAtIfLoadedImmediately(x, z); + } + + @Override @@ -4439,8 +4420,8 @@ index 2e1eabba14a3757d03fd90741651001e78c6322f..45ded8cd3aee69083f6196765208d8c2 + @Override public IChunkAccess getChunkAt(int i, int j, ChunkStatus chunkstatus, boolean flag) { - IChunkAccess ichunkaccess = this.chunkProvider.getChunkAt(i, j, chunkstatus, flag); -@@ -336,8 +371,9 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + IChunkAccess ichunkaccess = this.getChunkProvider().getChunkAt(i, j, chunkstatus, flag); +@@ -405,8 +439,9 @@ public abstract class World implements GeneratorAccess, AutoCloseable { public void a(BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) {} @@ -4453,20 +4434,32 @@ index 2e1eabba14a3757d03fd90741651001e78c6322f..45ded8cd3aee69083f6196765208d8c2 return this.setTypeAndData(blockposition, fluid.getBlockData(), 3 | (flag ? 64 : 0)); diff --git a/src/main/java/net/minecraft/server/WorldBorder.java b/src/main/java/net/minecraft/server/WorldBorder.java -index 020e5c171a44f8886395849d718efd6f90659bab..3db276f176301ebf15d5a2ba44d0edb5c7ec6097 100644 +index ddc4570139fd9b82f4b740697e84775f5ff0a75a..d039e715624d33fc3ec9e87d5ad992415e7dc6b9 100644 --- a/src/main/java/net/minecraft/server/WorldBorder.java +++ b/src/main/java/net/minecraft/server/WorldBorder.java -@@ -35,6 +35,8 @@ public class WorldBorder { +@@ -37,6 +37,7 @@ public class WorldBorder { return this.b(entity.locX(), entity.locZ()); } -+ public final VoxelShape asVoxelShape(){ return a();} // Paper - OBFHELPER -+ - public VoxelShape a() { - return this.i.m(); ++ public final VoxelShape asVoxelShape(){ return c();} // Paper - OBFHELPER + public VoxelShape c() { + return this.j.m(); } +diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java +index bd6dfddb3c076cf92588dd508975db0eee5c2962..d643ff0a0ae9d45711c9a40fc12af68157604a33 100644 +--- a/src/main/java/net/minecraft/server/WorldServer.java ++++ b/src/main/java/net/minecraft/server/WorldServer.java +@@ -56,7 +56,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { + private final Map entitiesByUUID = Maps.newHashMap(); + private final Queue entitiesToAdd = Queues.newArrayDeque(); + private final List players = Lists.newArrayList(); +- private final ChunkProviderServer chunkProvider; ++ public final ChunkProviderServer chunkProvider; // Paper - public + boolean tickingEntities; + private final MinecraftServer server; + public final WorldDataServer worldDataServer; // CraftBukkit - type diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java -index e181df6f4d08b88835db7342f97e0b848bcf01ef..4a9132c7016b076ab35b5d66ce81bbd247e1a3ce 100644 +index 62cdb32a63cdcbaee80946f73d23817bbb455488..721a1c6bd4505cb132e7004c45b795d4959389e3 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java @@ -85,6 +85,7 @@ public final class CraftItemStack extends ItemStack { @@ -4478,7 +4471,7 @@ index e181df6f4d08b88835db7342f97e0b848bcf01ef..4a9132c7016b076ab35b5d66ce81bbd2 /** * Mirror diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java -index 9ad17c560c8d99a396543ab9f97c34de648f6544..533c0bc55fc7ac4cc1f493f898a85a6617371031 100644 +index 9ad17c560c8d99a396543ab9f97c34de648f6544..4bf48f77f3f7cd62a91590543f5af441c8268029 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java @@ -43,6 +43,7 @@ import org.bukkit.scheduler.BukkitWorker; @@ -4501,6 +4494,32 @@ index 9ad17c560c8d99a396543ab9f97c34de648f6544..533c0bc55fc7ac4cc1f493f898a85a66 public BukkitTask runTaskTimer(Plugin plugin, Object runnable, long delay, long period) { validate(plugin, runnable); if (delay < 0L) { +@@ -400,13 +406,20 @@ public class CraftScheduler implements BukkitScheduler { + task.run(); + task.timings.stopTiming(); // Spigot + } catch (final Throwable throwable) { +- task.getOwner().getLogger().log( ++ // Paper start ++ String msg = String.format( ++ "Task #%s for %s generated an exception", ++ task.getTaskId(), ++ task.getOwner().getDescription().getFullName()); ++ if (task.getOwner() == MINECRAFT) { ++ net.minecraft.server.MinecraftServer.LOGGER.error(msg, throwable); ++ } else { ++ task.getOwner().getLogger().log( + Level.WARNING, +- String.format( +- "Task #%s for %s generated an exception", +- task.getTaskId(), +- task.getOwner().getDescription().getFullName()), ++ msg, + throwable); ++ } ++ // Paper end + } finally { + currentTask = null; + } diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java index 3f55381c152b9841b524f623c9b32360e97cb8ed..d85e21b75054067b926ecfee89d62c6dd0744189 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java @@ -4666,11 +4685,11 @@ index 0000000000000000000000000000000000000000..49dc0c441b9dd7e7745cf15ced67f383 + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java -index d8358a0f031ca6e5d5dc1700172175446f74384e..d0b813008ca21fe6aa9b514ed4325596113fd459 100644 +index eb87f3720977e4e980d26e9cfd4fed0a808636dd..b6c39bf77e716addc9d2a1e915687bc770e937f4 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java +++ b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java -@@ -196,4 +196,22 @@ public class DummyGeneratorAccess implements GeneratorAccess { - public boolean a(BlockPosition blockposition, boolean flag, Entity entity) { +@@ -187,4 +187,22 @@ public class DummyGeneratorAccess implements GeneratorAccess { + public boolean a(BlockPosition blockposition, boolean flag, Entity entity, int i) { throw new UnsupportedOperationException("Not supported yet."); } + diff --git a/Spigot-Server-Patches/0005-Paper-Metrics.patch b/Spigot-Server-Patches/0005-Paper-Metrics.patch index 0ac402ed6..999be8eb7 100644 --- a/Spigot-Server-Patches/0005-Paper-Metrics.patch +++ b/Spigot-Server-Patches/0005-Paper-Metrics.patch @@ -647,10 +647,10 @@ index 0000000000000000000000000000000000000000..e257d6b36e0e78dac5b8320017d92776 + } +} diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 273cdb598b3606b962dcc92564c84ad351b7a74f..b6d470e594ce196f560ac6c94ced904b0081b205 100644 +index 68d3cb02dbfdc9d6f9d3682a2659c9430b50c490..b367bb8ea184489f433f8acc798466c38816ae62 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -41,6 +41,7 @@ public class PaperConfig { +@@ -42,6 +42,7 @@ public class PaperConfig { private static boolean verbose; private static boolean fatalError; /*========================================================================*/ @@ -658,7 +658,7 @@ index 273cdb598b3606b962dcc92564c84ad351b7a74f..b6d470e594ce196f560ac6c94ced904b public static void init(File configFile) { CONFIG_FILE = configFile; -@@ -83,6 +84,11 @@ public class PaperConfig { +@@ -84,6 +85,11 @@ public class PaperConfig { for (Map.Entry entry : commands.entrySet()) { MinecraftServer.getServer().server.getCommandMap().register(entry.getKey(), "Paper", entry.getValue()); } diff --git a/Spigot-Server-Patches/0006-Add-MinecraftKey-Information-to-Objects.patch b/Spigot-Server-Patches/0006-Add-MinecraftKey-Information-to-Objects.patch index cb079c224..48fd21a4f 100644 --- a/Spigot-Server-Patches/0006-Add-MinecraftKey-Information-to-Objects.patch +++ b/Spigot-Server-Patches/0006-Add-MinecraftKey-Information-to-Objects.patch @@ -19,7 +19,7 @@ index 41c79650b169b87fbc70cf502438a5453a04f23d..b839769ceae8932bb121a0b96fde1e7d MutablePair> info = list.computeIfAbsent(key, k -> MutablePair.of(0, Maps.newHashMap())); ChunkCoordIntPair chunk = new ChunkCoordIntPair(e.getChunkX(), e.getChunkZ()); diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 7e01f6a1807f9885a7f4b163ce6bb626d8786a9a..6c7816fdc1ef476969cb70c8ea697b60746d6ab4 100644 +index 9da321fc0e02e4a2e47f515011df33714affd368..ee93b977b5f78855fd58a2055ca4e17255f3388b 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -49,7 +49,7 @@ import org.bukkit.event.player.PlayerTeleportEvent; @@ -31,7 +31,7 @@ index 7e01f6a1807f9885a7f4b163ce6bb626d8786a9a..6c7816fdc1ef476969cb70c8ea697b60 // CraftBukkit start private static final int CURRENT_LEVEL = 2; -@@ -1708,12 +1708,31 @@ public abstract class Entity implements INamableTileEntity, ICommandListener { +@@ -1670,12 +1670,31 @@ public abstract class Entity implements INamableTileEntity, ICommandListener { return true; } @@ -63,18 +63,18 @@ index 7e01f6a1807f9885a7f4b163ce6bb626d8786a9a..6c7816fdc1ef476969cb70c8ea697b60 + // Paper end } - protected abstract void a(NBTTagCompound nbttagcompound); + protected abstract void loadData(NBTTagCompound nbttagcompound); diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java -index 4328273b1fca165320097dbac0650b31fae4e5ca..8427ee2ee8b90d5deb686412bb2eefb9a574b75a 100644 +index 9a772e40ad8f9858e6278b99d9d1ff5dc54513cb..b9fe08301409bc1f0d61a7566c26e720ff720d80 100644 --- a/src/main/java/net/minecraft/server/EntityTypes.java +++ b/src/main/java/net/minecraft/server/EntityTypes.java -@@ -237,6 +237,7 @@ public class EntityTypes { +@@ -248,6 +248,7 @@ public class EntityTypes { } } + public boolean isPersistable() { return a(); } // Paper - OBFHELPER public boolean a() { - return this.bc; + return this.bh; } diff --git a/src/main/java/net/minecraft/server/KeyedObject.java b/src/main/java/net/minecraft/server/KeyedObject.java new file mode 100644 @@ -92,7 +92,7 @@ index 0000000000000000000000000000000000000000..743142d0303fa25fe48a2abb07040d12 + } +} diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index 40752f7617d5aa6b5ae55cd9a1b2eeb57c276adb..9071bb7ece6d38d85b4ea11e53671f3ec5210b28 100644 +index 6d06812f5fb6366ccd2673e9155be869b9bc0f6d..3cae7ef750371cee741c2f27799c1bb5864a278a 100644 --- a/src/main/java/net/minecraft/server/TileEntity.java +++ b/src/main/java/net/minecraft/server/TileEntity.java @@ -11,7 +11,7 @@ import org.bukkit.inventory.InventoryHolder; diff --git a/Spigot-Server-Patches/0007-Store-reference-to-current-Chunk-for-Entity-and-Bloc.patch b/Spigot-Server-Patches/0007-Store-reference-to-current-Chunk-for-Entity-and-Bloc.patch index bdd856382..fd87bcbea 100644 --- a/Spigot-Server-Patches/0007-Store-reference-to-current-Chunk-for-Entity-and-Bloc.patch +++ b/Spigot-Server-Patches/0007-Store-reference-to-current-Chunk-for-Entity-and-Bloc.patch @@ -8,19 +8,10 @@ This enables us a fast reference to the entities current chunk instead of having to look it up by hashmap lookups. diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 9397b58f047c837f8a9146723e4cd9a4d6b787a7..e1ac0c479ebfa2da69575db2032dd1415c4a41a5 100644 +index 7c7826cf3adb19814984ab627e4c4726d8933244..bd92ed2e6d4766f4f16ec3002c41b36b5a7e0358 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -29,7 +29,7 @@ public class Chunk implements IChunkAccess { - private final ChunkSection[] sections; - private BiomeStorage d; - private final Map e; -- public boolean loaded; -+ public boolean loaded; public boolean isLoaded() { return loaded; } // Paper - OBFHELPER - public final World world; - public final Map heightMap; - private final ChunkConverter i; -@@ -55,11 +55,36 @@ public class Chunk implements IChunkAccess { +@@ -56,11 +56,36 @@ public class Chunk implements IChunkAccess { this(world, chunkcoordintpair, biomestorage, ChunkConverter.a, TickListEmpty.b(), TickListEmpty.b(), 0L, (ChunkSection[]) null, (Consumer) null); } @@ -58,7 +49,7 @@ index 9397b58f047c837f8a9146723e4cd9a4d6b787a7..e1ac0c479ebfa2da69575db2032dd141 this.l = Maps.newHashMap(); this.m = Maps.newHashMap(); this.n = new ShortList[16]; -@@ -465,6 +490,7 @@ public class Chunk implements IChunkAccess { +@@ -466,6 +491,7 @@ public class Chunk implements IChunkAccess { } entity.inChunk = true; @@ -66,7 +57,7 @@ index 9397b58f047c837f8a9146723e4cd9a4d6b787a7..e1ac0c479ebfa2da69575db2032dd141 entity.chunkX = this.loc.x; entity.chunkY = k; entity.chunkZ = this.loc.z; -@@ -477,6 +503,7 @@ public class Chunk implements IChunkAccess { +@@ -478,6 +504,7 @@ public class Chunk implements IChunkAccess { ((HeightMap) this.heightMap.get(heightmap_type)).a(along); } @@ -74,7 +65,7 @@ index 9397b58f047c837f8a9146723e4cd9a4d6b787a7..e1ac0c479ebfa2da69575db2032dd141 public void b(Entity entity) { this.a(entity, entity.chunkY); } -@@ -490,7 +517,12 @@ public class Chunk implements IChunkAccess { +@@ -491,7 +518,12 @@ public class Chunk implements IChunkAccess { i = this.entitySlices.length - 1; } @@ -89,28 +80,19 @@ index 9397b58f047c837f8a9146723e4cd9a4d6b787a7..e1ac0c479ebfa2da69575db2032dd141 } diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 6c7816fdc1ef476969cb70c8ea697b60746d6ab4..0d8262b1d2722e716f95db4c9a8a132c54b613cf 100644 +index ee93b977b5f78855fd58a2055ca4e17255f3388b..e3f2e259b2c5e478bde45554995b9c742d9e2008 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -134,7 +134,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - private static final DataWatcherObject aB = DataWatcher.a(Entity.class, DataWatcherRegistry.i); - private static final DataWatcherObject aC = DataWatcher.a(Entity.class, DataWatcherRegistry.i); - protected static final DataWatcherObject POSE = DataWatcher.a(Entity.class, DataWatcherRegistry.s); -- public boolean inChunk; -+ public boolean inChunk; public boolean isAddedToChunk() { return inChunk; } // Paper - OBFHELPER - public int chunkX; public int getChunkX() { return chunkX; } // Paper - OBFHELPER - public int chunkY; public int getChunkY() { return chunkY; } // Paper - OBFHELPER - public int chunkZ; public int getChunkZ() { return chunkZ; } // Paper - OBFHELPER @@ -178,7 +178,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke } public boolean isChunkLoaded() { -- return world.isChunkLoaded((int) Math.floor(this.locX) >> 4, (int) Math.floor(this.locZ) >> 4); +- return world.isChunkLoaded((int) Math.floor(this.locX()) >> 4, (int) Math.floor(this.locZ()) >> 4); + return getCurrentChunk() != null; } // CraftBukkit end -@@ -1709,6 +1709,43 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -1671,6 +1671,23 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke } // Paper start @@ -124,38 +106,18 @@ index 6c7816fdc1ef476969cb70c8ea697b60746d6ab4..0d8262b1d2722e716f95db4c9a8a132c + */ + public Chunk getCurrentChunk() { + final Chunk chunk = currentChunk != null ? currentChunk.get() : null; -+ if (chunk != null && chunk.isLoaded()) { ++ if (chunk != null && chunk.loaded) { + return chunk; + } + -+ return !isAddedToChunk() ? null : ((ChunkProviderServer) world.chunkProvider).getChunkAtIfLoadedMainThreadNoCache(getChunkX(), getChunkZ()); -+ } -+ -+ /** -+ * Returns the chunk at the location, using the entities local cache if avail -+ * Will only return null if the location specified is not loaded -+ */ -+ public Chunk getCurrentChunkAt(int x, int z) { -+ Chunk chunk = getCurrentChunk(); -+ if (chunk != null && getChunkX() == chunk.getPos().x && getChunkZ() == chunk.getPos().z) { -+ return chunk; -+ } -+ return ((ChunkProviderServer) world.chunkProvider).getChunkAtIfLoadedMainThreadNoCache(getChunkX(), getChunkZ()); -+ } -+ /** -+ * Returns the chunk at the entities current location, using the entities local cache if avail -+ * Ideally this is always the same as getCurrentChunk, but only becomes different in registration issues. -+ * Will only return null if the location specified is not loaded -+ */ -+ public Chunk getChunkAtLocation() { -+ return getCurrentChunkAt((int)Math.floor(locX) >> 4, (int)Math.floor(locZ) >> 4); ++ return !inChunk ? null : ((WorldServer)world).getChunkProvider().getChunkAtIfLoadedMainThreadNoCache(getChunkX(), getChunkZ()); + } + private MinecraftKey entityKey; private String entityKeyString; diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index 9071bb7ece6d38d85b4ea11e53671f3ec5210b28..820180ab3f7053c348caa80cc21f15dfa3d26afd 100644 +index 3cae7ef750371cee741c2f27799c1bb5864a278a..f8d859cda8186d706304b4e182bca34573f09433 100644 --- a/src/main/java/net/minecraft/server/TileEntity.java +++ b/src/main/java/net/minecraft/server/TileEntity.java @@ -51,6 +51,15 @@ public abstract class TileEntity implements KeyedObject { // Paper @@ -166,7 +128,7 @@ index 9071bb7ece6d38d85b4ea11e53671f3ec5210b28..820180ab3f7053c348caa80cc21f15df + private java.lang.ref.WeakReference currentChunk = null; + public Chunk getCurrentChunk() { + final Chunk chunk = currentChunk != null ? currentChunk.get() : null; -+ return chunk != null && chunk.isLoaded() ? chunk : null; ++ return chunk != null && chunk.loaded ? chunk : null; + } + public void setCurrentChunk(Chunk chunk) { + this.currentChunk = chunk != null ? new java.lang.ref.WeakReference<>(chunk) : null; @@ -175,10 +137,10 @@ index 9071bb7ece6d38d85b4ea11e53671f3ec5210b28..820180ab3f7053c348caa80cc21f15df @Nullable diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 27e2379f2dd6e9e06ae7a973ab8654cdcacf66c0..9672dd7c2166bba88832b1743b97e16561fe434c 100644 +index 305de86630b442fe1fa27431fca1ac989d16dc61..e867168be3c17548490f30944ca56a635cc3b054 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -137,6 +137,7 @@ import net.minecraft.server.EntityZombieHusk; +@@ -141,6 +141,7 @@ import net.minecraft.server.EntityZombieHusk; import net.minecraft.server.EntityZombieVillager; import net.minecraft.server.IChatBaseComponent; import net.minecraft.server.NBTTagCompound; @@ -186,7 +148,7 @@ index 27e2379f2dd6e9e06ae7a973ab8654cdcacf66c0..9672dd7c2166bba88832b1743b97e165 import org.bukkit.EntityEffect; import org.bukkit.Location; import org.bukkit.Server; -@@ -178,6 +179,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { +@@ -182,6 +183,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { this.entity = entity; } diff --git a/Spigot-Server-Patches/0008-Store-counts-for-each-Entity-Block-Entity-Type.patch b/Spigot-Server-Patches/0008-Store-counts-for-each-Entity-Block-Entity-Type.patch index c1622b5e1..57cb42608 100644 --- a/Spigot-Server-Patches/0008-Store-counts-for-each-Entity-Block-Entity-Type.patch +++ b/Spigot-Server-Patches/0008-Store-counts-for-each-Entity-Block-Entity-Type.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Store counts for each Entity/Block Entity Type Opens door for future patches to optimize performance diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index e1ac0c479ebfa2da69575db2032dd1415c4a41a5..f1b9b937e8ced0c718db463c94d716422113c396 100644 +index bd92ed2e6d4766f4f16ec3002c41b36b5a7e0358..eb08c7467595394fff9adf4f162aba9d71d7a7c2 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -56,15 +56,19 @@ public class Chunk implements IChunkAccess { +@@ -57,15 +57,19 @@ public class Chunk implements IChunkAccess { } // Paper start @@ -29,7 +29,7 @@ index e1ac0c479ebfa2da69575db2032dd1415c4a41a5..f1b9b937e8ced0c718db463c94d71642 } return replaced; } -@@ -74,6 +78,7 @@ public class Chunk implements IChunkAccess { +@@ -75,6 +79,7 @@ public class Chunk implements IChunkAccess { TileEntity removed = super.remove(key); if (removed != null) { removed.setCurrentChunk(null); @@ -37,7 +37,7 @@ index e1ac0c479ebfa2da69575db2032dd1415c4a41a5..f1b9b937e8ced0c718db463c94d71642 } return removed; } -@@ -489,6 +494,7 @@ public class Chunk implements IChunkAccess { +@@ -490,6 +495,7 @@ public class Chunk implements IChunkAccess { k = this.entitySlices.length - 1; } @@ -45,7 +45,7 @@ index e1ac0c479ebfa2da69575db2032dd1415c4a41a5..f1b9b937e8ced0c718db463c94d71642 entity.inChunk = true; entity.setCurrentChunk(this); // Paper entity.chunkX = this.loc.x; -@@ -522,6 +528,7 @@ public class Chunk implements IChunkAccess { +@@ -523,6 +529,7 @@ public class Chunk implements IChunkAccess { if (!this.entitySlices[i].remove(entity)) { return; } diff --git a/Spigot-Server-Patches/0009-Timings-v2.patch b/Spigot-Server-Patches/0009-Timings-v2.patch index 19951169a..27c0b8507 100644 --- a/Spigot-Server-Patches/0009-Timings-v2.patch +++ b/Spigot-Server-Patches/0009-Timings-v2.patch @@ -544,13 +544,14 @@ index 0000000000000000000000000000000000000000..d4ebcf8f66197299256bd6b65710a148 +} diff --git a/src/main/java/co/aikar/timings/WorldTimingsHandler.java b/src/main/java/co/aikar/timings/WorldTimingsHandler.java new file mode 100644 -index 0000000000000000000000000000000000000000..fa1c920ea6092259149f9e7f9cd7cc1ed27bf338 +index 0000000000000000000000000000000000000000..944fd203e9f39d6c6fc9e270940c76c98067273a --- /dev/null +++ b/src/main/java/co/aikar/timings/WorldTimingsHandler.java -@@ -0,0 +1,118 @@ +@@ -0,0 +1,119 @@ +package co.aikar.timings; + +import net.minecraft.server.World; ++import net.minecraft.server.WorldDataServer; +import net.minecraft.server.WorldServer; + +/** @@ -608,7 +609,7 @@ index 0000000000000000000000000000000000000000..fa1c920ea6092259149f9e7f9cd7cc1e + public final Timing miscMobSpawning; + + public WorldTimingsHandler(World server) { -+ String name = server.worldData.getName() +" - "; ++ String name = ((WorldDataServer) server.getWorldData()).getName() + " - "; + + mobSpawn = Timings.ofSafe(name + "mobSpawn"); + doChunkUnload = Timings.ofSafe(name + "doChunkUnload"); @@ -663,14 +664,14 @@ index 0000000000000000000000000000000000000000..fa1c920ea6092259149f9e7f9cd7cc1e + } + + public static Timing getTickList(WorldServer worldserver, String timingsType) { -+ return Timings.ofSafe(worldserver.getWorldData().getName() + " - Scheduled " + timingsType); ++ return Timings.ofSafe(((WorldDataServer) worldserver.getWorldData()).getName() + " - Scheduled " + timingsType); + } +} diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index b6d470e594ce196f560ac6c94ced904b0081b205..f402a29b0904a0094ffe6e42dbdc6fbc0912d9d9 100644 +index b367bb8ea184489f433f8acc798466c38816ae62..a62f4bbb973b9cb6d1ee53f56a0897d70ae176af 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -14,11 +14,14 @@ import java.util.concurrent.TimeUnit; +@@ -14,12 +14,15 @@ import java.util.concurrent.TimeUnit; import java.util.logging.Level; import java.util.regex.Pattern; @@ -678,6 +679,7 @@ index b6d470e594ce196f560ac6c94ced904b0081b205..f402a29b0904a0094ffe6e42dbdc6fbc import net.minecraft.server.MinecraftServer; import org.bukkit.Bukkit; 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; @@ -685,7 +687,7 @@ index b6d470e594ce196f560ac6c94ced904b0081b205..f402a29b0904a0094ffe6e42dbdc6fbc public class PaperConfig { -@@ -187,4 +190,27 @@ public class PaperConfig { +@@ -188,4 +191,27 @@ public class PaperConfig { config.addDefault(path, def); return config.getString(path, config.getString(path)); } @@ -714,13 +716,13 @@ index b6d470e594ce196f560ac6c94ced904b0081b205..f402a29b0904a0094ffe6e42dbdc6fbc + } } diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java -index cd72a9c84569592f9c82708a17388e594648d19d..5de881371a485957fd8fadc7540a2b549b20dd65 100644 +index c95bbcd46978522a2dce173b4c116aa39c8f2f01..3cc572b0ce757160c7ab4733b98d8ca84f9f325a 100644 --- a/src/main/java/net/minecraft/server/Block.java +++ b/src/main/java/net/minecraft/server/Block.java -@@ -31,6 +31,15 @@ public class Block implements IMaterial { - protected final boolean q; - protected final SoundEffectType stepSound; - protected final Material material; +@@ -24,6 +24,15 @@ public class Block extends BlockBase implements IMaterial { + private static final VoxelShape c = a(7.0D, 0.0D, 7.0D, 9.0D, 10.0D, 9.0D); + protected final BlockStateList blockStateList; + private IBlockData blockData; + // Paper start + public co.aikar.timings.Timing timing; + public co.aikar.timings.Timing getTiming() { @@ -730,14 +732,14 @@ index cd72a9c84569592f9c82708a17388e594648d19d..5de881371a485957fd8fadc7540a2b54 + return timing; + } + // Paper end - protected final MaterialMapColor t; - private final float frictionFactor; - private final float f; + @Nullable + private String name; + @Nullable diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index f1b9b937e8ced0c718db463c94d716422113c396..43dc791191cdf2aa3e5cb2768c25e6be4b2cf6b1 100644 +index eb08c7467595394fff9adf4f162aba9d71d7a7c2..09b4594ae6750252b4b13ed4735dad0d00e2aeec 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -692,6 +692,7 @@ public class Chunk implements IChunkAccess { +@@ -693,6 +693,7 @@ public class Chunk implements IChunkAccess { server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkLoadEvent(this.bukkitChunk, this.needsDecoration)); if (this.needsDecoration) { @@ -745,7 +747,7 @@ index f1b9b937e8ced0c718db463c94d716422113c396..43dc791191cdf2aa3e5cb2768c25e6be this.needsDecoration = false; java.util.Random random = new java.util.Random(); random.setSeed(world.getSeed()); -@@ -711,6 +712,7 @@ public class Chunk implements IChunkAccess { +@@ -712,6 +713,7 @@ public class Chunk implements IChunkAccess { } } server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkPopulateEvent(bukkitChunk)); @@ -754,10 +756,10 @@ index f1b9b937e8ced0c718db463c94d716422113c396..43dc791191cdf2aa3e5cb2768c25e6be } } diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 64d84b334d211fe39e808d2c8b5d457757fb1359..83707fa6ae5cf4f564760ca0fb5e8c1932d4a91e 100644 +index 359441cd993a95f933f23aebcec8180f314a5f09..7dd9c5eec53631d25ae511b1e57bdadfe28ce289 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -318,11 +318,13 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -319,11 +319,13 @@ public class ChunkProviderServer extends IChunkProvider { } gameprofilerfiller.c("getChunkCacheMiss"); @@ -773,7 +775,7 @@ index 64d84b334d211fe39e808d2c8b5d457757fb1359..83707fa6ae5cf4f564760ca0fb5e8c19 ichunkaccess = (IChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> { return ichunkaccess1; }, (playerchunk_failure) -> { -@@ -515,7 +517,9 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -510,7 +512,9 @@ public class ChunkProviderServer extends IChunkProvider { public void save(boolean flag) { this.tickDistanceManager(); @@ -783,7 +785,7 @@ index 64d84b334d211fe39e808d2c8b5d457757fb1359..83707fa6ae5cf4f564760ca0fb5e8c19 } @Override -@@ -552,7 +556,9 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -547,7 +551,9 @@ public class ChunkProviderServer extends IChunkProvider { this.tickDistanceManager(); this.world.timings.doChunkMap.stopTiming(); // Spigot this.world.getMethodProfiler().exitEnter("chunks"); @@ -793,50 +795,44 @@ index 64d84b334d211fe39e808d2c8b5d457757fb1359..83707fa6ae5cf4f564760ca0fb5e8c19 this.world.timings.doChunkUnload.startTiming(); // Spigot this.world.getMethodProfiler().exitEnter("unload"); this.playerChunkMap.unloadChunks(booleansupplier); -@@ -583,10 +589,12 @@ public class ChunkProviderServer extends IChunkProvider { - // CraftBukkit end +@@ -571,8 +577,10 @@ public class ChunkProviderServer extends IChunkProvider { + boolean flag2 = world.ticksPerAnimalSpawns != 0L && worlddata.getTime() % world.ticksPerAnimalSpawns == 0L; // CraftBukkit this.world.getMethodProfiler().enter("naturalSpawnCount"); + this.world.timings.countNaturalMobs.startTiming(); // Paper - timings int l = this.chunkMapDistance.b(); - EnumCreatureType[] aenumcreaturetype = EnumCreatureType.values(); - Object2IntMap object2intmap = this.world.l(); - + SpawnerCreature.d spawnercreature_d = SpawnerCreature.a(l, this.world.z(), this::a); + this.world.timings.countNaturalMobs.stopTiming(); // Paper - timings - this.world.getMethodProfiler().exit(); - this.playerChunkMap.f().forEach((playerchunk) -> { - Optional optional = ((Either) playerchunk.b().getNow(PlayerChunk.UNLOADED_CHUNK)).left(); -@@ -595,11 +603,14 @@ public class ChunkProviderServer extends IChunkProvider { - Chunk chunk = (Chunk) optional.get(); + this.p = spawnercreature_d; + this.world.getMethodProfiler().exit(); +@@ -583,7 +591,9 @@ public class ChunkProviderServer extends IChunkProvider { + + if (optional.isPresent()) { this.world.getMethodProfiler().enter("broadcast"); + this.world.timings.broadcastChunkUpdates.startTiming(); // Paper - timings - playerchunk.a(chunk); + playerchunk.a((Chunk) optional.get()); + this.world.timings.broadcastChunkUpdates.stopTiming(); // Paper - timings this.world.getMethodProfiler().exit(); - ChunkCoordIntPair chunkcoordintpair = playerchunk.i(); + Optional optional1 = ((Either) playerchunk.b().getNow(PlayerChunk.UNLOADED_CHUNK)).left(); - if (!this.playerChunkMap.isOutsideOfRange(chunkcoordintpair)) { -+ // Paper end - chunk.setInhabitedTime(chunk.getInhabitedTime() + j); - if (flag1 && (this.allowMonsters || this.allowAnimals) && this.world.getWorldBorder().isInBounds(chunk.getPos()) && !this.playerChunkMap.isOutsideOfRange(chunkcoordintpair, true)) { // Spigot - this.world.getMethodProfiler().enter("spawner"); -@@ -650,24 +661,24 @@ public class ChunkProviderServer extends IChunkProvider { - this.world.getMethodProfiler().exit(); +@@ -597,25 +607,25 @@ public class ChunkProviderServer extends IChunkProvider { + SpawnerCreature.a(this.world, chunk, spawnercreature_d, this.allowAnimals, this.allowMonsters, flag2); + } + +- this.world.timings.doTickTiles.startTiming(); // Spigot ++ this.world.timings.chunkTicks.startTiming(); // Spigot // Paper + this.world.a(chunk, k); +- this.world.timings.doTickTiles.stopTiming(); // Spigot ++ this.world.timings.chunkTicks.stopTiming(); // Spigot // Paper } - -- this.world.timings.doTickTiles.startTiming(); // Spigot -+ this.world.timings.chunkTicks.startTiming(); // Spigot // Paper - this.world.a(chunk, k); -- this.world.timings.doTickTiles.stopTiming(); // Spigot -+ this.world.timings.chunkTicks.stopTiming(); // Spigot // Paper } } }); this.world.getMethodProfiler().enter("customSpawners"); if (flag1) { + try (co.aikar.timings.Timing ignored = this.world.timings.miscMobSpawning.startTiming()) { // Paper - timings - this.chunkGenerator.doMobSpawning(this.world, this.allowMonsters, this.allowAnimals); + this.world.doMobSpawning(this.allowMonsters, this.allowAnimals); + } // Paper - timings } @@ -849,9 +845,9 @@ index 64d84b334d211fe39e808d2c8b5d457757fb1359..83707fa6ae5cf4f564760ca0fb5e8c19 - this.world.timings.tracker.stopTiming(); // Spigot } - @Override + private void a(long i, Consumer consumer) { diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index e16d30f2cafcbc5edbcd58d97703686aaf1537d5..13d99de2cd08de02215031a1f699110c13ef35ff 100644 +index 79e0e65a35945a6071cf08f688311ec4d1f71c72..28039aa8421207ce04840cc90e03d21bc8b7269f 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java @@ -1,5 +1,6 @@ @@ -861,7 +857,7 @@ index e16d30f2cafcbc5edbcd58d97703686aaf1537d5..13d99de2cd08de02215031a1f699110c import com.google.common.collect.Maps; import it.unimi.dsi.fastutil.longs.LongOpenHashSet; import it.unimi.dsi.fastutil.longs.LongSet; -@@ -388,7 +389,6 @@ public class ChunkRegionLoader { +@@ -392,7 +393,6 @@ public class ChunkRegionLoader { private static void loadEntities(NBTTagCompound nbttagcompound, Chunk chunk) { NBTTagList nbttaglist = nbttagcompound.getList("Entities", 10); World world = chunk.getWorld(); @@ -869,7 +865,7 @@ index e16d30f2cafcbc5edbcd58d97703686aaf1537d5..13d99de2cd08de02215031a1f699110c for (int i = 0; i < nbttaglist.size(); ++i) { NBTTagCompound nbttagcompound1 = nbttaglist.getCompound(i); -@@ -400,8 +400,6 @@ public class ChunkRegionLoader { +@@ -404,8 +404,6 @@ public class ChunkRegionLoader { chunk.d(true); } @@ -878,7 +874,7 @@ index e16d30f2cafcbc5edbcd58d97703686aaf1537d5..13d99de2cd08de02215031a1f699110c NBTTagList nbttaglist1 = nbttagcompound.getList("TileEntities", 10); for (int j = 0; j < nbttaglist1.size(); ++j) { -@@ -418,8 +416,6 @@ public class ChunkRegionLoader { +@@ -423,8 +421,6 @@ public class ChunkRegionLoader { } } } @@ -886,9 +882,9 @@ index e16d30f2cafcbc5edbcd58d97703686aaf1537d5..13d99de2cd08de02215031a1f699110c - } - private static NBTTagCompound a(ChunkCoordIntPair chunkcoordintpair, Map map, Map map1) { + private static NBTTagCompound a(ChunkCoordIntPair chunkcoordintpair, Map, StructureStart> map, Map, LongSet> map1) { diff --git a/src/main/java/net/minecraft/server/CustomFunction.java b/src/main/java/net/minecraft/server/CustomFunction.java -index 8d7a6d2403722c7e7ff437f8e153ffa6194679d7..707bd2600d19699f58405eaa23ec36f406ca20ba 100644 +index 6d628c759346701c4097f36c302d1a1ab258bf9c..dd945eb709f75da58889002c9b8f7c22aaeeb30f 100644 --- a/src/main/java/net/minecraft/server/CustomFunction.java +++ b/src/main/java/net/minecraft/server/CustomFunction.java @@ -13,12 +13,22 @@ public class CustomFunction { @@ -915,32 +911,23 @@ index 8d7a6d2403722c7e7ff437f8e153ffa6194679d7..707bd2600d19699f58405eaa23ec36f4 return this.b; } diff --git a/src/main/java/net/minecraft/server/CustomFunctionData.java b/src/main/java/net/minecraft/server/CustomFunctionData.java -index ba40d5fbb5fe69225d25bdc4e299857f5ab21b40..ee42e1dfa493c3d7f5af8cc7b8e17e80fcb32b71 100644 +index 903cbd10fba18e61a4dc3ced71e22a665b78f177..423e4d12aba9197b936e69dfd4146ceeca3a30c4 100644 --- a/src/main/java/net/minecraft/server/CustomFunctionData.java +++ b/src/main/java/net/minecraft/server/CustomFunctionData.java -@@ -103,7 +103,7 @@ public class CustomFunctionData implements IResourcePackListener { +@@ -69,7 +69,7 @@ public class CustomFunctionData { } else { int j; - try { + try (co.aikar.timings.Timing timing = customfunction.getTiming().startTiming()) { // Paper - this.h = true; + this.d = true; int k = 0; CustomFunction.c[] acustomfunction_c = customfunction.b(); diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index 9eed98e3796be6d49dc51af9038a7376c94edeee..d6646d7e61b63c116fa87951b0ef3131b68ebe97 100644 +index aa68eb71b131c1d529ded6c651621cfab071b3c4..9cba62efdb051c9850bbf28b0be17a7e00ed83c9 100644 --- a/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java -@@ -20,6 +20,8 @@ import java.util.List; - import java.util.Locale; - import java.util.Optional; - import java.util.Random; -+import java.util.concurrent.CompletableFuture; -+import java.util.concurrent.ExecutionException; - import java.util.function.BooleanSupplier; - import java.util.regex.Pattern; - import javax.annotation.Nullable; -@@ -32,7 +34,7 @@ import org.apache.logging.log4j.Level; +@@ -28,7 +28,7 @@ import org.apache.logging.log4j.Level; import org.bukkit.command.CommandSender; import org.bukkit.craftbukkit.LoggerOutputStream; @@ -949,7 +936,7 @@ index 9eed98e3796be6d49dc51af9038a7376c94edeee..d6646d7e61b63c116fa87951b0ef3131 import org.bukkit.event.server.ServerCommandEvent; import org.bukkit.craftbukkit.util.Waitable; import org.bukkit.event.server.RemoteServerCommandEvent; -@@ -438,7 +440,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer +@@ -381,7 +381,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer } public void handleCommandQueue() { @@ -958,7 +945,7 @@ index 9eed98e3796be6d49dc51af9038a7376c94edeee..d6646d7e61b63c116fa87951b0ef3131 while (!this.serverCommandQueue.isEmpty()) { ServerCommand servercommand = (ServerCommand) this.serverCommandQueue.remove(0); -@@ -453,7 +455,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer +@@ -396,7 +396,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer // CraftBukkit end } @@ -967,7 +954,7 @@ index 9eed98e3796be6d49dc51af9038a7376c94edeee..d6646d7e61b63c116fa87951b0ef3131 } @Override -@@ -679,6 +681,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer +@@ -627,6 +627,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer @Override public String executeRemoteCommand(String s) { @@ -975,7 +962,7 @@ index 9eed98e3796be6d49dc51af9038a7376c94edeee..d6646d7e61b63c116fa87951b0ef3131 this.remoteControlCommandListener.clearMessages(); this.executeSync(() -> { // CraftBukkit start - fire RemoteServerCommandEvent -@@ -687,10 +690,39 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer +@@ -635,10 +636,39 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer if (event.isCancelled()) { return; } @@ -1016,7 +1003,7 @@ index 9eed98e3796be6d49dc51af9038a7376c94edeee..d6646d7e61b63c116fa87951b0ef3131 } diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 0d8262b1d2722e716f95db4c9a8a132c54b613cf..19d68aa4585ccfc156e9db6024b7a99bbeca4de4 100644 +index e3f2e259b2c5e478bde45554995b9c742d9e2008..98eec5efe474011665bd819d0d0b11abd6a068ea 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -29,7 +29,8 @@ import org.bukkit.command.CommandSender; @@ -1038,27 +1025,27 @@ index 0d8262b1d2722e716f95db4c9a8a132c54b613cf..19d68aa4585ccfc156e9db6024b7a99b // Spigot start public final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this); public final boolean defaultActivationState; -@@ -504,7 +505,6 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -526,7 +527,6 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke } public void move(EnumMoveType enummovetype, Vec3D vec3d) { - org.bukkit.craftbukkit.SpigotTimings.entityMoveTimer.startTiming(); // Spigot if (this.noclip) { - this.a(this.getBoundingBox().b(vec3d)); + this.a(this.getBoundingBox().c(vec3d)); this.recalcPosition(); -@@ -656,7 +656,6 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -663,7 +663,6 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke this.world.getMethodProfiler().exit(); } - org.bukkit.craftbukkit.SpigotTimings.entityMoveTimer.stopTiming(); // Spigot } - protected BlockPosition ag() { + protected BlockPosition ak() { diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 3ace8ee854c11abd607dc27b93fe61a0982a73de..690c1ce0f6707b2f5dd787e0fe340af5bd719783 100644 +index dccb315440f7429fe881bd0d12af8f1ae8e35c3d..96a95413f74592ef0a8e9367fd3ed81fc0a2c2fe 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -37,7 +37,7 @@ import org.bukkit.event.entity.EntityTeleportEvent; +@@ -41,7 +41,7 @@ import org.bukkit.event.entity.EntityTeleportEvent; import org.bukkit.event.player.PlayerItemConsumeEvent; // CraftBukkit end @@ -1067,15 +1054,15 @@ index 3ace8ee854c11abd607dc27b93fe61a0982a73de..690c1ce0f6707b2f5dd787e0fe340af5 public abstract class EntityLiving extends Entity { -@@ -2265,7 +2265,6 @@ public abstract class EntityLiving extends Entity { +@@ -2335,7 +2335,6 @@ public abstract class EntityLiving extends Entity { @Override public void tick() { - SpigotTimings.timerEntityBaseTick.startTiming(); // Spigot super.tick(); - this.o(); - this.r(); -@@ -2353,9 +2352,7 @@ public abstract class EntityLiving extends Entity { + this.u(); + this.x(); +@@ -2384,9 +2383,7 @@ public abstract class EntityLiving extends Entity { } } @@ -1085,7 +1072,7 @@ index 3ace8ee854c11abd607dc27b93fe61a0982a73de..690c1ce0f6707b2f5dd787e0fe340af5 double d0 = this.locX() - this.lastX; double d1 = this.locZ() - this.lastZ; float f = (float) (d0 * d0 + d1 * d1); -@@ -2435,8 +2432,6 @@ public abstract class EntityLiving extends Entity { +@@ -2466,8 +2463,6 @@ public abstract class EntityLiving extends Entity { if (this.isSleeping()) { this.pitch = 0.0F; } @@ -1093,16 +1080,16 @@ index 3ace8ee854c11abd607dc27b93fe61a0982a73de..690c1ce0f6707b2f5dd787e0fe340af5 - SpigotTimings.timerEntityTickRest.stopTiming(); // Spigot } - protected float f(float f, float f1) { -@@ -2515,7 +2510,6 @@ public abstract class EntityLiving extends Entity { + private void q() { +@@ -2649,7 +2644,6 @@ public abstract class EntityLiving extends Entity { this.setMot(d4, d5, d6); this.world.getMethodProfiler().enter("ai"); - SpigotTimings.timerEntityAI.startTiming(); // Spigot if (this.isFrozen()) { this.jumping = false; - this.aZ = 0.0F; -@@ -2525,7 +2519,6 @@ public abstract class EntityLiving extends Entity { + this.aY = 0.0F; +@@ -2659,7 +2653,6 @@ public abstract class EntityLiving extends Entity { this.doTick(); this.world.getMethodProfiler().exit(); } @@ -1110,17 +1097,17 @@ index 3ace8ee854c11abd607dc27b93fe61a0982a73de..690c1ce0f6707b2f5dd787e0fe340af5 this.world.getMethodProfiler().exit(); this.world.getMethodProfiler().enter("jump"); -@@ -2549,9 +2542,7 @@ public abstract class EntityLiving extends Entity { - this.n(); +@@ -2694,9 +2687,7 @@ public abstract class EntityLiving extends Entity { + this.t(); AxisAlignedBB axisalignedbb = this.getBoundingBox(); - SpigotTimings.timerEntityAIMove.startTiming(); // Spigot - this.e(new Vec3D((double) this.aZ, (double) this.ba, (double) this.bb)); + this.f(new Vec3D((double) this.aY, (double) this.aZ, (double) this.ba)); - SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot this.world.getMethodProfiler().exit(); this.world.getMethodProfiler().enter("push"); - if (this.bn > 0) { -@@ -2559,9 +2550,7 @@ public abstract class EntityLiving extends Entity { + if (this.bm > 0) { +@@ -2704,9 +2695,7 @@ public abstract class EntityLiving extends Entity { this.a(axisalignedbb, this.getBoundingBox()); } @@ -1128,13 +1115,13 @@ index 3ace8ee854c11abd607dc27b93fe61a0982a73de..690c1ce0f6707b2f5dd787e0fe340af5 this.collideNearby(); - SpigotTimings.timerEntityAICollision.stopTiming(); // Spigot this.world.getMethodProfiler().exit(); - } - + if (!this.world.isClientSide && this.dN() && this.aC()) { + this.damageEntity(DamageSource.DROWN, 1.0F); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 786d38438cc1bd5a736b2dfa80aca9b9c6253e65..5429d8eee93980a01cdf008b57e88e1dccc1ef67 100644 +index 70604fbf6bdd5166fc91d57fb4db4a8337bc4727..0867ad04857c652dcbcdf130bb5353113ea039a0 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -63,7 +63,7 @@ import org.bukkit.craftbukkit.CraftServer; +@@ -65,7 +65,7 @@ import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.Main; import org.bukkit.event.server.ServerLoadEvent; // CraftBukkit end @@ -1142,19 +1129,19 @@ index 786d38438cc1bd5a736b2dfa80aca9b9c6253e65..5429d8eee93980a01cdf008b57e88e1d +import co.aikar.timings.MinecraftTimings; // Paper import org.spigotmc.SlackActivityAccountant; // Spigot - public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant implements IMojangStatistics, ICommandListener, AutoCloseable, Runnable { -@@ -128,8 +128,8 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant implements IMojangStatistics, ICommandListener, AutoCloseable { +@@ -119,8 +119,8 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant resourcePackRepository; + private final ScoreboardServer scoreboardServer; @Nullable -@@ -694,6 +694,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant= 5000000000L) { -@@ -1000,14 +1021,12 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant= 5000000000L) { +@@ -1025,14 +1046,12 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant 0 && this.ticks % autosavePeriod == 0) { // CraftBukkit @@ -1231,7 +1218,7 @@ index 786d38438cc1bd5a736b2dfa80aca9b9c6253e65..5429d8eee93980a01cdf008b57e88e1d } this.methodProfiler.enter("snooper"); -@@ -1020,6 +1039,13 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant> f(ChunkCoordIntPair chunkcoordintpair) { return CompletableFuture.supplyAsync(() -> { @@ -1356,7 +1343,7 @@ index b505244516321292e56609eaa54693d84e0bf617..65134c87772cb6d4d732fc223929cfda boolean flag = nbttagcompound.hasKeyOfType("Level", 10) && nbttagcompound.getCompound("Level").hasKeyOfType("Status", 8); if (flag) { -@@ -522,7 +527,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -524,7 +529,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } PlayerChunkMap.LOGGER.error("Chunk file at {} is missing level data, skipping", chunkcoordintpair); @@ -1365,7 +1352,7 @@ index b505244516321292e56609eaa54693d84e0bf617..65134c87772cb6d4d732fc223929cfda } catch (ReportedException reportedexception) { Throwable throwable = reportedexception.getCause(); -@@ -549,7 +554,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -561,7 +566,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { return "chunkGenerate " + chunkstatus.d(); }); return completablefuture.thenComposeAsync((either) -> { @@ -1374,7 +1361,7 @@ index b505244516321292e56609eaa54693d84e0bf617..65134c87772cb6d4d732fc223929cfda try { CompletableFuture> completablefuture1 = chunkstatus.a(this.world, this.chunkGenerator, this.definedStructureManager, this.lightEngine, (ichunkaccess) -> { return this.c(playerchunk); -@@ -602,6 +607,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -614,6 +619,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { ChunkStatus chunkstatus = PlayerChunk.getChunkStatus(playerchunk.getTicketLevel()); return !chunkstatus.b(ChunkStatus.FULL) ? PlayerChunk.UNLOADED_CHUNK_ACCESS : either.mapLeft((ichunkaccess) -> { @@ -1382,7 +1369,7 @@ index b505244516321292e56609eaa54693d84e0bf617..65134c87772cb6d4d732fc223929cfda ChunkCoordIntPair chunkcoordintpair = playerchunk.i(); Chunk chunk; -@@ -653,6 +659,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -665,6 +671,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } return chunk; @@ -1390,7 +1377,7 @@ index b505244516321292e56609eaa54693d84e0bf617..65134c87772cb6d4d732fc223929cfda }); }, (runnable) -> { Mailbox mailbox = this.mailboxMain; -@@ -1094,6 +1101,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1123,6 +1130,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { PlayerChunkMap.EntityTracker playerchunkmap_entitytracker; ObjectIterator objectiterator; @@ -1398,7 +1385,7 @@ index b505244516321292e56609eaa54693d84e0bf617..65134c87772cb6d4d732fc223929cfda for (objectiterator = this.trackedEntities.values().iterator(); objectiterator.hasNext(); playerchunkmap_entitytracker.trackerEntry.a()) { playerchunkmap_entitytracker = (PlayerChunkMap.EntityTracker) objectiterator.next(); -@@ -1111,16 +1119,20 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1140,16 +1148,20 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { playerchunkmap_entitytracker.e = sectionposition1; } } @@ -1420,7 +1407,7 @@ index b505244516321292e56609eaa54693d84e0bf617..65134c87772cb6d4d732fc223929cfda protected void broadcast(Entity entity, Packet packet) { diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index f40cb14d5301631161f1701043ee987359d9a8e9..87119b4fe5ae27c63d272c8e436e3734eddd8f68 100644 +index b8d3c4d35cee2ba4678f6d22b8ea956d598d9d9b..88fa8d63c5bb2c76ba09db6bb002f6d6b6a42afc 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -58,6 +58,7 @@ import org.bukkit.inventory.CraftingInventory; @@ -1441,13 +1428,13 @@ index f40cb14d5301631161f1701043ee987359d9a8e9..87119b4fe5ae27c63d272c8e436e3734 this.player.lastY = this.player.locY(); @@ -211,7 +211,6 @@ public class PlayerConnection implements PacketListenerPlayIn { this.player.resetIdleTimer(); // CraftBukkit - SPIGOT-854 - this.disconnect(new ChatMessage("multiplayer.disconnect.idling", new Object[0])); + this.disconnect(new ChatMessage("multiplayer.disconnect.idling")); } - org.bukkit.craftbukkit.SpigotTimings.playerConnectionTimer.stopTiming(); // Spigot } -@@ -1639,7 +1638,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -1684,7 +1683,7 @@ public class PlayerConnection implements PacketListenerPlayIn { // CraftBukkit end private void handleCommand(String s) { @@ -1456,7 +1443,7 @@ index f40cb14d5301631161f1701043ee987359d9a8e9..87119b4fe5ae27c63d272c8e436e3734 // CraftBukkit start - whole method if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot this.LOGGER.info(this.player.getName() + " issued server command: " + s); -@@ -1650,7 +1649,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -1695,7 +1694,7 @@ public class PlayerConnection implements PacketListenerPlayIn { this.server.getPluginManager().callEvent(event); if (event.isCancelled()) { @@ -1465,7 +1452,7 @@ index f40cb14d5301631161f1701043ee987359d9a8e9..87119b4fe5ae27c63d272c8e436e3734 return; } -@@ -1663,7 +1662,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -1708,7 +1707,7 @@ public class PlayerConnection implements PacketListenerPlayIn { java.util.logging.Logger.getLogger(PlayerConnection.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); return; } finally { @@ -1502,7 +1489,7 @@ index 2c671629a43f42da8335e7216f9fd399bb878729..eb3269e0ea3ce33d08e9eee3bca7cf43 PlayerConnectionUtils.LOGGER.debug("Ignoring packet due to disconnection: " + packet); } diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 7e8c50aa92e036b88b1fd725021c31846eb06097..79cfcbce85e779fc8e8589840a27961f59209f3d 100644 +index b9b055923bb70e7b9fc9cd69c28bd06d7836a38c..213e8512247e9873563ad606a7e3a2a3ca409718 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java @@ -1,5 +1,6 @@ @@ -1512,7 +1499,7 @@ index 7e8c50aa92e036b88b1fd725021c31846eb06097..79cfcbce85e779fc8e8589840a27961f import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; -@@ -898,10 +899,11 @@ public abstract class PlayerList { +@@ -941,10 +942,11 @@ public abstract class PlayerList { } public void savePlayers() { @@ -1526,20 +1513,19 @@ index 7e8c50aa92e036b88b1fd725021c31846eb06097..79cfcbce85e779fc8e8589840a27961f public WhiteList getWhitelist() { diff --git a/src/main/java/net/minecraft/server/TickListServer.java b/src/main/java/net/minecraft/server/TickListServer.java -index 00bbd34b6a2a8185bc6395d6c85bce6353c3cbc4..f533860bbed19ff2915c90186c259b466f41ce90 100644 +index e8ff43662b8397229cb19ea26342b66c88807379..3b8f56c0f0507ebdd9ac20be70688b4c0cfe4cf8 100644 --- a/src/main/java/net/minecraft/server/TickListServer.java +++ b/src/main/java/net/minecraft/server/TickListServer.java -@@ -28,13 +28,18 @@ public class TickListServer implements TickList { - private final List> h = Lists.newArrayList(); - private final Consumer> i; +@@ -26,12 +26,17 @@ public class TickListServer implements TickList { + private final List> g = Lists.newArrayList(); + private final Consumer> h; -- public TickListServer(WorldServer worldserver, Predicate predicate, Function function, Function function1, Consumer> consumer) { -+ public TickListServer(WorldServer worldserver, Predicate predicate, Function function, Function function1, Consumer> consumer, String timingsType) { // Paper +- public TickListServer(WorldServer worldserver, Predicate predicate, Function function, Consumer> consumer) { ++ public TickListServer(WorldServer worldserver, Predicate predicate, Function function, Consumer> consumer, String timingsType) { // Paper this.a = predicate; this.b = function; - this.c = function1; - this.f = worldserver; - this.i = consumer; + this.e = worldserver; + this.h = consumer; + this.timingCleanup = co.aikar.timings.WorldTimingsHandler.getTickList(worldserver, timingsType + " - Cleanup"); + this.timingTicking = co.aikar.timings.WorldTimingsHandler.getTickList(worldserver, timingsType + " - Ticking"); } @@ -1549,34 +1535,34 @@ index 00bbd34b6a2a8185bc6395d6c85bce6353c3cbc4..f533860bbed19ff2915c90186c259b46 public void b() { int i = this.nextTickList.size(); -@@ -57,6 +62,7 @@ public class TickListServer implements TickList { +@@ -54,6 +59,7 @@ public class TickListServer implements TickList { - this.f.getMethodProfiler().enter("cleaning"); + this.e.getMethodProfiler().enter("cleaning"); + this.timingCleanup.startTiming(); // Paper NextTickListEntry nextticklistentry; while (i > 0 && iterator.hasNext()) { -@@ -72,7 +78,9 @@ public class TickListServer implements TickList { +@@ -69,7 +75,9 @@ public class TickListServer implements TickList { --i; } } + this.timingCleanup.stopTiming(); // Paper + this.timingTicking.startTiming(); // Paper - this.f.getMethodProfiler().exitEnter("ticking"); + this.e.getMethodProfiler().exitEnter("ticking"); - while ((nextticklistentry = (NextTickListEntry) this.g.poll()) != null) { -@@ -93,6 +101,7 @@ public class TickListServer implements TickList { + while ((nextticklistentry = (NextTickListEntry) this.f.poll()) != null) { +@@ -89,6 +97,7 @@ public class TickListServer implements TickList { + } } - this.f.getMethodProfiler().exit(); + this.timingTicking.stopTiming(); // Paper - this.h.clear(); + this.e.getMethodProfiler().exit(); this.g.clear(); - } + this.f.clear(); diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index 820180ab3f7053c348caa80cc21f15dfa3d26afd..fa6400dccd4df635d696e0858c0c164a0f19b4a4 100644 +index f8d859cda8186d706304b4e182bca34573f09433..057d703fe73de9bb9ca6f0e263463d32abae4c13 100644 --- a/src/main/java/net/minecraft/server/TileEntity.java +++ b/src/main/java/net/minecraft/server/TileEntity.java @@ -9,11 +9,12 @@ import org.bukkit.craftbukkit.persistence.CraftPersistentDataContainer; @@ -1595,27 +1581,18 @@ index 820180ab3f7053c348caa80cc21f15dfa3d26afd..fa6400dccd4df635d696e0858c0c164a private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry(); public CraftPersistentDataContainer persistentDataContainer; diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 45ded8cd3aee69083f6196765208d8c2430f0a02..a126a6d22ccee90d0aadb8513bda60455a703bf6 100644 +index bd5a2eee9cb435a5ee75a39cea231151fba00387..a559f423b19a1e6f8efb6327270250844e8c6fb6 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -1,5 +1,7 @@ - package net.minecraft.server; - -+import co.aikar.timings.Timing; -+import co.aikar.timings.Timings; - import com.google.common.collect.Lists; - import java.io.IOException; - import java.util.Collection; -@@ -18,7 +20,7 @@ import org.apache.logging.log4j.util.Supplier; +@@ -18,7 +18,6 @@ import org.apache.logging.log4j.Logger; import java.util.HashMap; import java.util.Map; import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.SpigotTimings; // Spigot -+import org.bukkit.block.BlockState; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.block.CapturedBlockState; -@@ -73,7 +75,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -80,7 +79,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { public final com.destroystokyo.paper.PaperWorldConfig paperConfig; // Paper @@ -1624,7 +1601,7 @@ index 45ded8cd3aee69083f6196765208d8c2430f0a02..a126a6d22ccee90d0aadb8513bda6045 public static BlockPosition lastPhysicsProblem; // Spigot private org.spigotmc.TickLimiter entityLimiter; private org.spigotmc.TickLimiter tileLimiter; -@@ -139,7 +141,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -159,7 +158,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { public void c(WorldBorder worldborder, double d0) {} }); // CraftBukkit end @@ -1633,7 +1610,7 @@ index 45ded8cd3aee69083f6196765208d8c2430f0a02..a126a6d22ccee90d0aadb8513bda6045 this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime); this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime); } -@@ -723,15 +725,14 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -781,15 +780,14 @@ public abstract class World implements GeneratorAccess, AutoCloseable { } timings.tileEntityPending.stopTiming(); // Spigot @@ -1651,87 +1628,72 @@ index 45ded8cd3aee69083f6196765208d8c2430f0a02..a126a6d22ccee90d0aadb8513bda6045 CrashReport crashreport = CrashReport.a(throwable, "Ticking entity"); CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being ticked"); diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 545ec5a2de00e9a91b349e358db44ed16aa50e68..4ab77e8dc0f918bd4f069a0f886d04dea473f046 100644 +index d643ff0a0ae9d45711c9a40fc12af68157604a33..9df9ce88e23b31f0303a3c84136a10ea14a6d33d 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1,6 +1,8 @@ - package net.minecraft.server; - +@@ -3,6 +3,8 @@ package net.minecraft.server; import com.google.common.annotations.VisibleForTesting; + import com.google.common.collect.ImmutableList; + import com.google.common.collect.Iterables; +import co.aikar.timings.TimingHistory; // Paper +import co.aikar.timings.Timings; // Paper import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Queues; -@@ -40,7 +42,6 @@ import org.apache.logging.log4j.Logger; +@@ -39,7 +41,6 @@ import org.apache.logging.log4j.Logger; import java.util.logging.Level; import org.bukkit.Bukkit; import org.bukkit.WeatherType; -import org.bukkit.craftbukkit.SpigotTimings; // Spigot import org.bukkit.craftbukkit.event.CraftEventFactory; + import org.bukkit.craftbukkit.util.WorldUUID; import org.bukkit.event.entity.CreatureSpawnEvent; - import org.bukkit.event.server.MapInitializeEvent; -@@ -97,10 +98,10 @@ public class WorldServer extends World { +@@ -95,10 +96,10 @@ public class WorldServer extends World implements GeneratorAccessSeed { // CraftBukkit end this.nextTickListBlock = new TickListServer<>(this, (block) -> { return block == null || block.getBlockData().isAir(); -- }, IRegistry.BLOCK::getKey, IRegistry.BLOCK::get, this::b); -+ }, IRegistry.BLOCK::getKey, IRegistry.BLOCK::get, this::b, "Blocks"); // Paper - Timings +- }, IRegistry.BLOCK::getKey, this::b); ++ }, IRegistry.BLOCK::getKey, this::b, "Blocks"); // Paper - Timings this.nextTickListFluid = new TickListServer<>(this, (fluidtype) -> { return fluidtype == null || fluidtype == FluidTypes.EMPTY; -- }, IRegistry.FLUID::getKey, IRegistry.FLUID::get, this::a); -+ }, IRegistry.FLUID::getKey, IRegistry.FLUID::get, this::a, "Fluids"); // Paper - Timings +- }, IRegistry.FLUID::getKey, this::a); ++ }, IRegistry.FLUID::getKey, this::a, "Fluids"); // Paper - Timings this.navigators = Sets.newHashSet(); - this.I = new ObjectLinkedOpenHashSet(); - this.dataManager = worldnbtstorage; -@@ -305,20 +306,24 @@ public class WorldServer extends World { + this.L = new ObjectLinkedOpenHashSet(); + this.Q = flag1; +@@ -326,17 +327,21 @@ public class WorldServer extends World implements GeneratorAccessSeed { this.N(); - this.a(); + this.b(); gameprofilerfiller.exitEnter("chunkSource"); + this.timings.chunkProviderTick.startTiming(); // Paper - timings this.getChunkProvider().tick(booleansupplier); + this.timings.chunkProviderTick.stopTiming(); // Paper - timings gameprofilerfiller.exitEnter("tickPending"); - timings.doTickPending.startTiming(); // Spigot -+ timings.scheduledBlocks.startTiming(); // Spigot - if (this.worldData.getType() != WorldType.DEBUG_ALL_BLOCK_STATES) { ++ timings.scheduledBlocks.startTiming(); // Paper + if (!this.isDebugWorld()) { this.nextTickListBlock.b(); this.nextTickListFluid.b(); } - timings.doTickPending.stopTiming(); // Spigot -+ timings.scheduledBlocks.stopTiming(); // Spigot ++ timings.scheduledBlocks.stopTiming(); // Paper gameprofilerfiller.exitEnter("raid"); + this.timings.raids.startTiming(); // Paper - timings this.persistentRaid.a(); - if (this.mobSpawnerTrader != null) { - this.mobSpawnerTrader.a(); - } + this.timings.raids.stopTiming(); // Paper - timings - gameprofilerfiller.exitEnter("blockEvents"); timings.doSounds.startTiming(); // Spigot -@@ -361,6 +366,7 @@ public class WorldServer extends World { + this.ah(); +@@ -360,6 +365,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { org.spigotmc.ActivationRange.activateEntities(this); // Spigot timings.entityTick.startTiming(); // Spigot -+ TimingHistory.entityTicks += this.globalEntityList.size(); // Paper ++ TimingHistory.entityTicks += this.entitiesById.size(); // Paper while (objectiterator.hasNext()) { Entry entry = (Entry) objectiterator.next(); - Entity entity1 = (Entity) entry.getValue(); -@@ -409,9 +415,11 @@ public class WorldServer extends World { - - this.tickingEntities = false; - -+ try (co.aikar.timings.Timing ignored = this.timings.newEntities.startTiming()) { // Paper - timings - while ((entity = (Entity) this.entitiesToAdd.poll()) != null) { - this.registerEntity(entity); - } -+ } // Paper - timings - - gameprofilerfiller.exit(); - timings.tickEntities.stopTiming(); // Spigot -@@ -476,6 +484,7 @@ public class WorldServer extends World { + Entity entity = (Entity) entry.getValue(); +@@ -508,6 +514,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { } gameprofilerfiller.exitEnter("tickBlocks"); @@ -1739,7 +1701,7 @@ index 545ec5a2de00e9a91b349e358db44ed16aa50e68..4ab77e8dc0f918bd4f069a0f886d04de if (i > 0) { ChunkSection[] achunksection = chunk.getSections(); int l = achunksection.length; -@@ -507,7 +516,7 @@ public class WorldServer extends World { +@@ -539,7 +546,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { } } } @@ -1748,25 +1710,25 @@ index 545ec5a2de00e9a91b349e358db44ed16aa50e68..4ab77e8dc0f918bd4f069a0f886d04de gameprofilerfiller.exit(); } -@@ -603,6 +612,7 @@ public class WorldServer extends World { - - public void entityJoinedWorld(Entity entity) { - if (entity instanceof EntityHuman || this.getChunkProvider().a(entity)) { +@@ -637,6 +644,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { + if (!(entity instanceof EntityHuman) && !this.getChunkProvider().a(entity)) { + this.chunkCheck(entity); + } else { + ++TimingHistory.entityTicks; // Paper - timings // Spigot start if (!org.spigotmc.ActivationRange.checkIfActive(entity)) { entity.ticksLived++; -@@ -611,7 +621,9 @@ public class WorldServer extends World { +@@ -644,7 +652,9 @@ public class WorldServer extends World implements GeneratorAccessSeed { + return; } // Spigot end - + TimingHistory.activatedEntityTicks++; // Paper - timings entity.tickTimer.startTiming(); // Spigot + try { // Paper - timings entity.f(entity.locX(), entity.locY(), entity.locZ()); entity.lastYaw = entity.yaw; entity.lastPitch = entity.pitch; -@@ -638,7 +650,9 @@ public class WorldServer extends World { +@@ -671,7 +681,9 @@ public class WorldServer extends World implements GeneratorAccessSeed { this.a(entity, entity1); } } @@ -1776,16 +1738,16 @@ index 545ec5a2de00e9a91b349e358db44ed16aa50e68..4ab77e8dc0f918bd4f069a0f886d04de } } -@@ -799,6 +813,7 @@ public class WorldServer extends World { +@@ -748,6 +760,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { if (!flag1) { org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld())); // CraftBukkit + try (co.aikar.timings.Timing ignored = timings.worldSave.startTiming()) { // Paper if (iprogressupdate != null) { - iprogressupdate.a(new ChatMessage("menu.savingLevel", new Object[0])); + iprogressupdate.a(new ChatMessage("menu.savingLevel")); } -@@ -808,7 +823,10 @@ public class WorldServer extends World { - iprogressupdate.c(new ChatMessage("menu.savingChunks", new Object[0])); +@@ -757,7 +770,10 @@ public class WorldServer extends World implements GeneratorAccessSeed { + iprogressupdate.c(new ChatMessage("menu.savingChunks")); } + timings.worldSaveChunks.startTiming(); // Paper @@ -1796,10 +1758,10 @@ index 545ec5a2de00e9a91b349e358db44ed16aa50e68..4ab77e8dc0f918bd4f069a0f886d04de // CraftBukkit start - moved from MinecraftServer.saveChunks diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index ad1dcf53040695a1b3194efa92b549172bea56ec..1ceba5f7eae58426834d7042af17f7e3b1990a56 100644 +index 239fa2404859d233161764cceec5cd0fc37899b9..c6c4033b16df4d31e87f4dca8d9293698e03958a 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1973,12 +1973,31 @@ public final class CraftServer implements Server { +@@ -2052,12 +2052,31 @@ public final class CraftServer implements Server { private final Spigot spigot = new Spigot() { @@ -1833,16 +1795,17 @@ index ad1dcf53040695a1b3194efa92b549172bea56ec..1ceba5f7eae58426834d7042af17f7e3 org.spigotmc.RestartCommand.restart(); diff --git a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java b/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java deleted file mode 100644 -index 2bd22a369825040c7f5074117d82ae83f07b6096..0000000000000000000000000000000000000000 +index 7f435847ac1d13756ce233e7d5ae13f9dc17c443..0000000000000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java +++ /dev/null -@@ -1,162 +0,0 @@ +@@ -1,163 +0,0 @@ -package org.bukkit.craftbukkit; - -import java.util.HashMap; -import net.minecraft.server.Entity; -import net.minecraft.server.TileEntity; -import net.minecraft.server.World; +-import net.minecraft.server.WorldDataServer; -import org.bukkit.craftbukkit.scheduler.CraftTask; -import org.bukkit.plugin.java.JavaPluginLoader; -import org.bukkit.scheduler.BukkitTask; @@ -1973,7 +1936,7 @@ index 2bd22a369825040c7f5074117d82ae83f07b6096..00000000000000000000000000000000 - public final CustomTimingsHandler syncChunkLoadPostTimer; - - public WorldTimingsHandler(World server) { -- String name = server.worldData.getName() +" - "; +- String name = ((WorldDataServer) server.worldData).getName() + " - "; - - mobSpawn = new CustomTimingsHandler("** " + name + "mobSpawn"); - doChunkUnload = new CustomTimingsHandler("** " + name + "doChunkUnload"); @@ -2000,10 +1963,10 @@ index 2bd22a369825040c7f5074117d82ae83f07b6096..00000000000000000000000000000000 - } -} diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index db0bd5cc0acb5523815183ba9c4a8b853a9e9d12..48d1397a6846c64dfa372390783ce66827153bf9 100644 +index 82d302832c579b4524121d21332c999a4d757de6..f8c4fb312232f1689fd19e165830e62609813213 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1717,6 +1717,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1778,6 +1778,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player { packet.components = components; getHandle().playerConnection.sendPacket(packet); } @@ -2019,7 +1982,7 @@ index db0bd5cc0acb5523815183ba9c4a8b853a9e9d12..48d1397a6846c64dfa372390783ce668 public Player.Spigot spigot() diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java -index 533c0bc55fc7ac4cc1f493f898a85a6617371031..de332758e03a563a9b72c134332db9e6a1c5ed2b 100644 +index 4bf48f77f3f7cd62a91590543f5af441c8268029..ffe9cc1011226d604dc5499e7692e9a9a5132b72 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java @@ -1,5 +1,6 @@ @@ -2065,9 +2028,9 @@ index 533c0bc55fc7ac4cc1f493f898a85a6617371031..de332758e03a563a9b72c134332db9e6 task.run(); - task.timings.stopTiming(); // Spigot } catch (final Throwable throwable) { - task.getOwner().getLogger().log( - Level.WARNING, -@@ -431,8 +431,10 @@ public class CraftScheduler implements BukkitScheduler { + // Paper start + String msg = String.format( +@@ -438,8 +438,10 @@ public class CraftScheduler implements BukkitScheduler { runners.remove(task.getTaskId()); } } @@ -2078,7 +2041,7 @@ index 533c0bc55fc7ac4cc1f493f898a85a6617371031..de332758e03a563a9b72c134332db9e6 debugHead = debugHead.getNextHead(currentTick); } -@@ -465,6 +467,7 @@ public class CraftScheduler implements BukkitScheduler { +@@ -472,6 +474,7 @@ public class CraftScheduler implements BukkitScheduler { } private void parsePending() { @@ -2086,7 +2049,7 @@ index 533c0bc55fc7ac4cc1f493f898a85a6617371031..de332758e03a563a9b72c134332db9e6 CraftTask head = this.head; CraftTask task = head.getNext(); CraftTask lastTask = head; -@@ -483,6 +486,7 @@ public class CraftScheduler implements BukkitScheduler { +@@ -490,6 +493,7 @@ public class CraftScheduler implements BukkitScheduler { task.setNext(null); } this.head = lastTask; @@ -2095,7 +2058,7 @@ index 533c0bc55fc7ac4cc1f493f898a85a6617371031..de332758e03a563a9b72c134332db9e6 private boolean isReady(final int currentTick) { diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java -index d85e21b75054067b926ecfee89d62c6dd0744189..ce495907f13dd10b5daba521101a78d65a2e8836 100644 +index d85e21b75054067b926ecfee89d62c6dd0744189..9d0d1598bfce2f51998395faf39d8bd2f5d3f9f3 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java @@ -1,9 +1,11 @@ @@ -2128,7 +2091,7 @@ index d85e21b75054067b926ecfee89d62c6dd0744189..ce495907f13dd10b5daba521101a78d6 CraftTask() { this(null, null, CraftTask.NO_REPEATING, CraftTask.NO_REPEATING); } -@@ -51,11 +53,11 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot +@@ -51,7 +53,7 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot this.id = id; this.period = CraftTask.NO_REPEATING; this.taskName = taskName; @@ -2137,11 +2100,6 @@ index d85e21b75054067b926ecfee89d62c6dd0744189..ce495907f13dd10b5daba521101a78d6 } // Paper end -- CraftTask(final Plugin plugin, final Object task, final int id, final long period) { -+ CraftTask(final Plugin plugin, final Object task, final int id, final long period) { // Paper - this.plugin = plugin; - if (task instanceof Runnable) { - this.rTask = (Runnable) task; @@ -72,7 +74,7 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot } this.id = id; @@ -2197,10 +2155,10 @@ index e52ef47b783785dc214746b678e7b549aea9a274..3d90b3426873a3528af14f7f1ab0adae this.value = value; } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 68728b4d86c4037fb1907bd16d86df5e23e8fe77..f647450b8c6977b4a6bb1819b34052c4ae2fe0f4 100644 +index de168983ea04519c4951216621b3493245bd8383..b3b2ad576137d0383f43ec444f2353ecad3743d9 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -133,6 +133,12 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -137,6 +137,12 @@ public final class CraftMagicNumbers implements UnsafeValues { return CraftNamespacedKey.toMinecraft(mat.getKey()); } // ======================================================================== @@ -2213,7 +2171,7 @@ index 68728b4d86c4037fb1907bd16d86df5e23e8fe77..f647450b8c6977b4a6bb1819b34052c4 public static byte toLegacyData(IBlockData data) { return CraftLegacy.toLegacyData(data); -@@ -298,6 +304,13 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -309,6 +315,13 @@ public final class CraftMagicNumbers implements UnsafeValues { return clazz; } @@ -2228,7 +2186,7 @@ index 68728b4d86c4037fb1907bd16d86df5e23e8fe77..f647450b8c6977b4a6bb1819b34052c4 * This helper class represents the different NBT Tags. *

diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java -index ca7789b5e0f0baf0a1b0529236d6469b2abae236..4423839697987e255e5a93bdd6742186dde2e4c4 100644 +index d838cd421ddcb082beba1edcd84b5d30e26b1544..2b00258ccd808e3332af5ab3f7e4967f03dd4aa3 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java @@ -31,7 +31,7 @@ import net.minecraft.server.EntityWither; diff --git a/Spigot-Server-Patches/0010-Configurable-cactus-and-reed-natural-growth-heights.patch b/Spigot-Server-Patches/0010-Configurable-cactus-and-reed-natural-growth-heights.patch index dbef4cb01..2f721262c 100644 --- a/Spigot-Server-Patches/0010-Configurable-cactus-and-reed-natural-growth-heights.patch +++ b/Spigot-Server-Patches/0010-Configurable-cactus-and-reed-natural-growth-heights.patch @@ -23,23 +23,23 @@ index a738657394bcccd859ef260a801736d44b234469..098bd3fba867c0e4c6c58748aa6e2e63 + } } diff --git a/src/main/java/net/minecraft/server/BlockCactus.java b/src/main/java/net/minecraft/server/BlockCactus.java -index 1e1d02dc73ea193fca69b26e4c51efd845713d2f..e0974e256f0f10e047b9eb8e362982c6578d2d98 100644 +index 4a3049575ad78e1c75d1b43a35311974c1d489de..13e4517bd04096001ca1caf32b9949abb3cf9c7f 100644 --- a/src/main/java/net/minecraft/server/BlockCactus.java +++ b/src/main/java/net/minecraft/server/BlockCactus.java -@@ -30,7 +30,7 @@ public class BlockCactus extends Block { - ; - } +@@ -35,7 +35,7 @@ public class BlockCactus extends Block { + ; + } -- if (i < 3) { +- if (i < 3) { + if (i < worldserver.paperConfig.cactusMaxHeight) { // Paper - Configurable growth height - int j = (Integer) iblockdata.get(BlockCactus.AGE); + int j = (Integer) iblockdata.get(BlockCactus.AGE); - if (j >= (byte) range(3, ((100.0F / worldserver.spigotConfig.cactusModifier) * 15) + 0.5F, 15)) { // Spigot + if (j >= (byte) range(3, ((100.0F / worldserver.spigotConfig.cactusModifier) * 15) + 0.5F, 15)) { // Spigot diff --git a/src/main/java/net/minecraft/server/BlockReed.java b/src/main/java/net/minecraft/server/BlockReed.java -index 2106b0b49f19f56fd446c2c6cec63526eb74fdb7..55b07444e1d769952f2a411b1b5d1032565af8a1 100644 +index 30282f73d263a96a14bd7bf7d3ac520e315b093a..c051decd19ff763a061822bc2a4b03289dfe3ac7 100644 --- a/src/main/java/net/minecraft/server/BlockReed.java +++ b/src/main/java/net/minecraft/server/BlockReed.java -@@ -29,7 +29,7 @@ public class BlockReed extends Block { +@@ -35,7 +35,7 @@ public class BlockReed extends Block { ; } diff --git a/Spigot-Server-Patches/0011-Configurable-baby-zombie-movement-speed.patch b/Spigot-Server-Patches/0011-Configurable-baby-zombie-movement-speed.patch index 009e07aa2..334c3d9cc 100644 --- a/Spigot-Server-Patches/0011-Configurable-baby-zombie-movement-speed.patch +++ b/Spigot-Server-Patches/0011-Configurable-baby-zombie-movement-speed.patch @@ -25,27 +25,27 @@ index 098bd3fba867c0e4c6c58748aa6e2e632737a948..912611cf1aeccf5a82a789aab07d7672 + } } diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java -index 7783b57912e87ac132bab3d2e85808240f077174..0240cef74aaa7f9fcfea40106267ee2e8d39f133 100644 +index 4b924ce42c9440c06c8c4f04dd4262289cfee6b7..951cf5546af11434971a26dca15c20c25e6c555e 100644 --- a/src/main/java/net/minecraft/server/EntityZombie.java +++ b/src/main/java/net/minecraft/server/EntityZombie.java -@@ -21,7 +21,7 @@ public class EntityZombie extends EntityMonster { +@@ -21,7 +21,7 @@ import org.bukkit.event.entity.EntityTransformEvent; + public class EntityZombie extends EntityMonster { - protected static final IAttribute d = (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, AttributeModifier.Operation.MULTIPLY_BASE); -+ private final AttributeModifier c = new AttributeModifier(EntityZombie.b, "Baby speed boost", world.paperConfig.babyZombieMovementModifier, AttributeModifier.Operation.MULTIPLY_BASE); private final AttributeModifier babyModifier = this.c; // Paper - remove static - Make baby speed configurable - private static final DataWatcherObject bw = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.i); - private static final DataWatcherObject bx = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.b); ++ private final AttributeModifier c = new AttributeModifier(EntityZombie.b, "Baby speed boost", 0.5D, AttributeModifier.Operation.MULTIPLY_BASE); private final AttributeModifier babyModifier = this.c; // Paper - remove static - Make baby speed configurable + private static final DataWatcherObject d = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.i); + private static final DataWatcherObject bv = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.b); public static final DataWatcherObject DROWN_CONVERTING = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.i); -@@ -129,9 +129,9 @@ public class EntityZombie extends EntityMonster { +@@ -123,9 +123,9 @@ public class EntityZombie extends EntityMonster { if (this.world != null && !this.world.isClientSide) { - AttributeInstance attributeinstance = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED); + AttributeModifiable attributemodifiable = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED); -- attributeinstance.removeModifier(EntityZombie.c); -+ attributeinstance.removeModifier(this.babyModifier); // Paper +- attributemodifiable.removeModifier(EntityZombie.c); ++ attributemodifiable.removeModifier(this.babyModifier); // Paper if (flag) { -- attributeinstance.addModifier(EntityZombie.c); -+ attributeinstance.addModifier(this.babyModifier); // Paper +- attributemodifiable.b(EntityZombie.c); ++ attributemodifiable.b(this.babyModifier); // Paper } } diff --git a/Spigot-Server-Patches/0012-Configurable-fishing-time-ranges.patch b/Spigot-Server-Patches/0012-Configurable-fishing-time-ranges.patch index bd2fd3296..7f0cd9f31 100644 --- a/Spigot-Server-Patches/0012-Configurable-fishing-time-ranges.patch +++ b/Spigot-Server-Patches/0012-Configurable-fishing-time-ranges.patch @@ -22,17 +22,17 @@ index 912611cf1aeccf5a82a789aab07d76723d4357cc..7d9976ce6bf86e6fdfd0c7770104cee0 + } } diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java -index 7be189f7428886058982774028de6adbd384fafd..40bdcf4e75bb36385e82ba8b8f2471760072705a 100644 +index b0f3b30944b7741ef1d9af21e919ff2df9c510a3..ab8f67c11419cc788fc3cb814d2224e65217dd08 100644 --- a/src/main/java/net/minecraft/server/EntityFishingHook.java +++ b/src/main/java/net/minecraft/server/EntityFishingHook.java -@@ -326,8 +326,9 @@ public class EntityFishingHook extends Entity { - this.aq = MathHelper.nextInt(this.random, 20, 80); +@@ -338,8 +338,9 @@ public class EntityFishingHook extends IProjectile { + this.ap = MathHelper.nextInt(this.random, 20, 80); } } else { -- this.ap = MathHelper.nextInt(this.random, 100, 600); -+ this.ap = MathHelper.nextInt(this.random, world.paperConfig.fishingMinTicks, world.paperConfig.fishingMaxTicks); // Paper - this.ap -= this.au * 20 * 5; -+ this.ap = Math.max(0, this.ap); // Paper - Don't allow negative values +- this.ao = MathHelper.nextInt(this.random, 100, 600); ++ this.ao = MathHelper.nextInt(this.random, world.paperConfig.fishingMinTicks, world.paperConfig.fishingMaxTicks); // Paper + this.ao -= this.av * 20 * 5; ++ this.ao = Math.max(0, this.ao); // Paper - Don't allow negative values; } } diff --git a/Spigot-Server-Patches/0013-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch b/Spigot-Server-Patches/0013-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch index b5c52ae76..3e47e61bd 100644 --- a/Spigot-Server-Patches/0013-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch +++ b/Spigot-Server-Patches/0013-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch @@ -31,43 +31,30 @@ index 2e869004c8c6b8bfbb002fb4eda04519d50390c8..8a6856e0fd7b9b515d98f45aaabefbc3 this.b.setJumping(this.a); this.a = false; diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 19d68aa4585ccfc156e9db6024b7a99bbeca4de4..2a449ec40a725b01a7bf572ae119c2197944ecbc 100644 +index 98eec5efe474011665bd819d0d0b11abd6a068ea..a50b005b9f3fc58674560f42b9c4a20fd8b669fa 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -1104,6 +1104,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -1024,6 +1024,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke return this.isInWater() || this.isInRain(); } -+ public boolean isInWaterOrRainOrBubble() { return ay(); } // Paper - OBFHELPER - public boolean ay() { - return this.isInWater() || this.isInRain() || this.l(); ++ public boolean isInWaterOrRainOrBubble() { return aC(); } // Paper - OBFHELPER + public boolean aC() { + return this.isInWater() || this.isInRain() || this.k(); } -diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java -index 1cc66108d0f799eef6ee984e8f65a9a46e337785..538c2169cd53d364b941ad1251df3731f77b3a2c 100644 ---- a/src/main/java/net/minecraft/server/EntityEnderman.java -+++ b/src/main/java/net/minecraft/server/EntityEnderman.java -@@ -171,7 +171,7 @@ public class EntityEnderman extends EntityMonster { - @Override - protected void mobTick() { - if (this.ay()) { -- this.damageEntity(DamageSource.DROWN, 1.0F); -+ this.damageEntity(DamageSource.DROWN, 1.0F); // Paper - copied in patch 13 (allow nerfed mobs to jump, float and take water damage) - } - - if (this.world.isDay() && this.ticksLived >= this.bA + 600) { diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index 0b06fa2b664830d40cdb93968bc2f8c98415d1bf..70cd0801dc62dc0b15a75869b375353db8a9ae46 100644 +index e5455d99e3f5607a5754e5760d42853a62dddb82..b9732287ba16d90bed33929348a223f6dbdbfb45 100644 --- a/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java -@@ -32,6 +32,7 @@ public abstract class EntityInsentient extends EntityLiving { +@@ -33,6 +33,7 @@ public abstract class EntityInsentient extends EntityLiving { private final EntityAIBodyControl c; protected NavigationAbstract navigation; public PathfinderGoalSelector goalSelector; + @Nullable public PathfinderGoalFloat goalFloat; // Paper public PathfinderGoalSelector targetSelector; private EntityLiving goalTarget; - private final EntitySenses bw; -@@ -648,7 +649,17 @@ public abstract class EntityInsentient extends EntityLiving { + private final EntitySenses bv; +@@ -719,7 +720,17 @@ public abstract class EntityInsentient extends EntityLiving { @Override protected final void doTick() { ++this.ticksFarFromPlayer; @@ -84,13 +71,13 @@ index 0b06fa2b664830d40cdb93968bc2f8c98415d1bf..70cd0801dc62dc0b15a75869b375353d + } + // Paper end this.world.getMethodProfiler().enter("sensing"); - this.bw.a(); + this.bv.a(); this.world.getMethodProfiler().exit(); diff --git a/src/main/java/net/minecraft/server/PathfinderGoalFloat.java b/src/main/java/net/minecraft/server/PathfinderGoalFloat.java -index 0f0dc7277f28a96711ab81e6bbf2dd7d1c212f25..43908b0400933119de9bcfe4240853e4fce7ec6f 100644 +index d0281a98a318376922b5bd8fcad7ba7db2012b54..e2b23978e347fe63e8bc900b72da6cbaf27bf652 100644 --- a/src/main/java/net/minecraft/server/PathfinderGoalFloat.java +++ b/src/main/java/net/minecraft/server/PathfinderGoalFloat.java -@@ -8,10 +8,12 @@ public class PathfinderGoalFloat extends PathfinderGoal { +@@ -8,15 +8,18 @@ public class PathfinderGoalFloat extends PathfinderGoal { public PathfinderGoalFloat(EntityInsentient entityinsentient) { this.a = entityinsentient; @@ -102,9 +89,7 @@ index 0f0dc7277f28a96711ab81e6bbf2dd7d1c212f25..43908b0400933119de9bcfe4240853e4 + public final boolean validConditions() { return this.a(); } // Paper - OBFHELPER @Override public boolean a() { - double d0 = (double) this.a.getHeadHeight() < 0.4D ? 0.2D : 0.4D; -@@ -19,6 +21,7 @@ public class PathfinderGoalFloat extends PathfinderGoal { - return this.a.isInWater() && this.a.co() > d0 || this.a.aH(); + return this.a.isInWater() && this.a.b((Tag) TagsFluid.WATER) > this.a.cw() || this.a.aN(); } + public void update() { this.e(); } // Paper - OBFHELPER diff --git a/Spigot-Server-Patches/0014-Add-configurable-despawn-distances-for-living-entiti.patch b/Spigot-Server-Patches/0014-Add-configurable-despawn-distances-for-living-entiti.patch index 70a3cff14..5ea097611 100644 --- a/Spigot-Server-Patches/0014-Add-configurable-despawn-distances-for-living-entiti.patch +++ b/Spigot-Server-Patches/0014-Add-configurable-despawn-distances-for-living-entiti.patch @@ -30,20 +30,23 @@ index 6d6a68cb1b952da8308ac9ce5b54694bc9ba0e30..2845686411615245137cfe1a155088a8 + } } diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index 70cd0801dc62dc0b15a75869b375353db8a9ae46..23995b68a17b87b90962c4c12aa37e3a254073b5 100644 +index b9732287ba16d90bed33929348a223f6dbdbfb45..885b97f9397753e7561f113f588b4ca2d5edb0fe 100644 --- a/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java -@@ -630,11 +630,11 @@ public abstract class EntityInsentient extends EntityLiving { - if (entityhuman != null) { - double d0 = entityhuman.h(this); +@@ -698,14 +698,14 @@ public abstract class EntityInsentient extends EntityLiving { + int i = this.getEntityType().e().f(); + int j = i * i; -- if (d0 > 16384.0D) { // CraftBukkit - remove isTypeNotPersistent() check -+ if (d0 > world.paperConfig.hardDespawnDistance) { // CraftBukkit - remove isTypeNotPersistent() check // Paper - custom despawn distances +- if (d0 > (double) j) { // CraftBukkit - remove isTypeNotPersistent() check ++ if (d0 > (double) world.paperConfig.hardDespawnDistance) { // CraftBukkit - remove isTypeNotPersistent() check // Paper - custom despawn distances this.die(); } -- if (this.ticksFarFromPlayer > 600 && this.random.nextInt(800) == 0 && d0 > 1024.0D) { // CraftBukkit - remove isTypeNotPersistent() check + int k = this.getEntityType().e().g(); + int l = k * k; + +- if (this.ticksFarFromPlayer > 600 && this.random.nextInt(800) == 0 && d0 > (double) l) { // CraftBukkit - remove isTypeNotPersistent() check + if (this.ticksFarFromPlayer > 600 && this.random.nextInt(800) == 0 && d0 > world.paperConfig.softDespawnDistance) { // CraftBukkit - remove isTypeNotPersistent() check // Paper - custom despawn distances this.die(); - } else if (d0 < 1024.0D) { + } else if (d0 < (double) l) { this.ticksFarFromPlayer = 0; diff --git a/Spigot-Server-Patches/0015-Allow-for-toggling-of-spawn-chunks.patch b/Spigot-Server-Patches/0015-Allow-for-toggling-of-spawn-chunks.patch index c3a72a7fe..7a49b2571 100644 --- a/Spigot-Server-Patches/0015-Allow-for-toggling-of-spawn-chunks.patch +++ b/Spigot-Server-Patches/0015-Allow-for-toggling-of-spawn-chunks.patch @@ -20,10 +20,10 @@ index 2845686411615245137cfe1a155088a865a4d3a0..8ee2b9bb1bce698fce50ac1b3fc477fc + } } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 740c59004514a332ebe556c4e91f84bd9bf4a11d..b69d84baf8d318968ef171232e493a315f71814b 100644 +index a559f423b19a1e6f8efb6327270250844e8c6fb6..b09f3f2bda126adf58d58e45f03f4205b28f29fd 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -142,6 +142,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -159,6 +159,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { }); // CraftBukkit end timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings diff --git a/Spigot-Server-Patches/0016-Drop-falling-block-and-tnt-entities-at-the-specified.patch b/Spigot-Server-Patches/0016-Drop-falling-block-and-tnt-entities-at-the-specified.patch index c505513f0..ddde3606d 100644 --- a/Spigot-Server-Patches/0016-Drop-falling-block-and-tnt-entities-at-the-specified.patch +++ b/Spigot-Server-Patches/0016-Drop-falling-block-and-tnt-entities-at-the-specified.patch @@ -24,10 +24,10 @@ index 8ee2b9bb1bce698fce50ac1b3fc477fcafd0542c..d59b82b7bb1f6d1b231f4e394e0a67a3 + } } diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 2a449ec40a725b01a7bf572ae119c2197944ecbc..0d617c8e09cf0adf0d7aa8c95fc69c641f91b795 100644 +index a50b005b9f3fc58674560f42b9c4a20fd8b669fa..e85172eb69b04746eab08abf213dcd02cd4513ee 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -1819,6 +1819,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -1761,6 +1761,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke return this.a(itemstack, 0.0F); } @@ -36,7 +36,7 @@ index 2a449ec40a725b01a7bf572ae119c2197944ecbc..0d617c8e09cf0adf0d7aa8c95fc69c64 public EntityItem a(ItemStack itemstack, float f) { if (itemstack.isEmpty()) { diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java -index 4b4e71bf700f13d9719556d4c07316b93aac0fd2..2097ec535e8a4427fc08da02726044b837d5a716 100644 +index d3e25e3503670804fba67c922c63e0e7f5a9543b..8c51b3060114a24249962c2d6142166ac8600a0a 100644 --- a/src/main/java/net/minecraft/server/EntityFallingBlock.java +++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java @@ -85,6 +85,17 @@ public class EntityFallingBlock extends Entity { @@ -55,10 +55,10 @@ index 4b4e71bf700f13d9719556d4c07316b93aac0fd2..2097ec535e8a4427fc08da02726044b8 + } + // Paper end if (!this.world.isClientSide) { - blockposition = new BlockPosition(this); + blockposition = this.getChunkCoordinates(); boolean flag = this.block.getBlock() instanceof BlockConcretePowder; diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java -index d042124362e02a6ec634a16610d4a1ed5ef83284..d9fd4448c707aca8e2040a5848387ce76bbee1df 100644 +index 5fca541ca8af4a8ed9ec6dacb3d551048b9efbf4..b5900e1cad8137954d5fa4fde10b4afb64fb6412 100644 --- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java +++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java @@ -54,6 +54,12 @@ public class EntityTNTPrimed extends Entity { diff --git a/Spigot-Server-Patches/0017-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch b/Spigot-Server-Patches/0017-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch index 280e94335..c9b447679 100644 --- a/Spigot-Server-Patches/0017-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch +++ b/Spigot-Server-Patches/0017-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Show 'Paper' in client crashes, server lists, and Mojang diff --git a/src/main/java/net/minecraft/server/EULA.java b/src/main/java/net/minecraft/server/EULA.java -index 3f35a28ba15f4d0dfe1cb2b56f621e81b1fb8c99..cf00f35a5b7c2d2f6b6989e0855de8b882dcef50 100644 +index aab33df7a36eb69300fedfce733985d6c239ca01..550232cb3819138b3bae0fa1c51429485e8bc593 100644 --- a/src/main/java/net/minecraft/server/EULA.java +++ b/src/main/java/net/minecraft/server/EULA.java @@ -70,7 +70,7 @@ public class EULA { @@ -19,10 +19,10 @@ index 3f35a28ba15f4d0dfe1cb2b56f621e81b1fb8c99..cf00f35a5b7c2d2f6b6989e0855de8b8 throwable = throwable1; throw throwable1; diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 5429d8eee93980a01cdf008b57e88e1dccc1ef67..b6912f97c2240b0524735e0f8d1937f2e76dba5b 100644 +index 0867ad04857c652dcbcdf130bb5353113ea039a0..9eacc1ba58986c21c5d8dc8d8d14c6f3b48fd171 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1348,7 +1348,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant world.paperConfig.hardDespawnDistance) { // CraftBukkit - remove isTypeNotPersistent() check // Paper - custom despawn distances + if (entityhuman != null) { + double d0 = entityhuman.h((Entity) this); // CraftBukkit - decompile error diff --git a/src/main/java/net/minecraft/server/EntitySilverfish.java b/src/main/java/net/minecraft/server/EntitySilverfish.java -index 102b3a3c48799e44de760da48425fef9c5278771..08c2a22f7a01df21532e1949ea9d51f78a611cee 100644 +index f9ae1ffbff3a813226b2081c79abf3b92d07754d..29c0a9c36a1f6727fb9485ab41e04f7dc9db1fe5 100644 --- a/src/main/java/net/minecraft/server/EntitySilverfish.java +++ b/src/main/java/net/minecraft/server/EntitySilverfish.java -@@ -99,7 +99,7 @@ public class EntitySilverfish extends EntityMonster { +@@ -95,7 +95,7 @@ public class EntitySilverfish extends EntityMonster { if (d(entitytypes, generatoraccess, enummobspawn, blockposition, random)) { EntityHuman entityhuman = generatoraccess.a((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, 5.0D, true); @@ -44,11 +44,85 @@ index 102b3a3c48799e44de760da48425fef9c5278771..08c2a22f7a01df21532e1949ea9d51f7 } else { return false; } +diff --git a/src/main/java/net/minecraft/server/IEntityAccess.java b/src/main/java/net/minecraft/server/IEntityAccess.java +index c469b5db81fb040fc27cd2e4f7cd61797f56a62d..48e8b005bd9589135eff03a110ecce8776ab208a 100644 +--- a/src/main/java/net/minecraft/server/IEntityAccess.java ++++ b/src/main/java/net/minecraft/server/IEntityAccess.java +@@ -75,8 +75,9 @@ public interface IEntityAccess { + } + } + +- @Nullable +- default EntityHuman a(double d0, double d1, double d2, double d3, @Nullable Predicate predicate) { ++ default EntityHuman findNearbyPlayer(Entity entity, double d0, @Nullable Predicate predicate) { return this.findNearbyPlayer(entity.locX(), entity.locY(), entity.locZ(), d0, predicate); } // Paper ++ @Nullable default EntityHuman findNearbyPlayer(double d0, double d1, double d2, double d3, @Nullable Predicate predicate) { return a(d0, d1, d2, d3, predicate); } // Paper - OBFHELPER ++ @Nullable default EntityHuman a(double d0, double d1, double d2, double d3, @Nullable Predicate predicate) { // Paper + double d4 = -1.0D; + EntityHuman entityhuman = null; + Iterator iterator = this.getPlayers().iterator(); +@@ -109,6 +110,27 @@ public interface IEntityAccess { + return this.a(d0, d1, d2, d3, predicate); + } + ++ // Paper end ++ default boolean isAffectsSpawningPlayerNearby(double d0, double d1, double d2, double d3) { ++ Iterator iterator = this.getPlayers().iterator(); ++ double d4; ++ do { ++ EntityHuman entityhuman; ++ do { ++ if (!iterator.hasNext()) { ++ return false; ++ } ++ ++ entityhuman = (EntityHuman) iterator.next(); ++ } while (!IEntitySelector.affectsSpawning.test(entityhuman)); ++ ++ d4 = entityhuman.g(d0, d1, d2); ++ } while (d3 >= 0.0D && d4 >= d3 * d3); ++ ++ return true; ++ } ++ // Paper end ++ + default boolean isPlayerNearby(double d0, double d1, double d2, double d3) { + Iterator iterator = this.getPlayers().iterator(); + +diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java +index 37ece74b4265a6f555d2550df7dade416bc7ef84..ed7566591bac72d17b40a940531b7feb1cb8f392 100644 +--- a/src/main/java/net/minecraft/server/IEntitySelector.java ++++ b/src/main/java/net/minecraft/server/IEntitySelector.java +@@ -24,6 +24,12 @@ public final class IEntitySelector { + return !entity.isSpectator(); + }; + ++ // Paper start ++ public static final Predicate affectsSpawning = (entity) -> { ++ return !entity.isSpectator() && entity.isAlive() && (entity instanceof EntityPlayer) && ((EntityPlayer) entity).affectsSpawning; ++ }; ++ // Paper end ++ + public static Predicate a(double d0, double d1, double d2, double d3) { + double d4 = d3 * d3; + +diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +index 4f7dc23d67e97f9a2b8983750299fc43b0ed6db9..a4a48dbee002e96a5644d9a033f9f233cc9a6b46 100644 +--- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java ++++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +@@ -49,7 +49,7 @@ public abstract class MobSpawnerAbstract { + private boolean h() { + BlockPosition blockposition = this.b(); + +- return this.a().isPlayerNearby((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, (double) this.requiredPlayerRange); ++ return this.a().isAffectsSpawningPlayerNearby((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, (double) this.requiredPlayerRange); // Paper + } + + public void c() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 48d1397a6846c64dfa372390783ce66827153bf9..2d3f3a2b7f4e6acdf8043befb584fc0752b1ba3a 100644 +index f8c4fb312232f1689fd19e165830e62609813213..8d4a0513df27767053342eddda05398eae7b46be 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1625,7 +1625,19 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1690,7 +1690,19 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public String getLocale() { return getHandle().locale; diff --git a/Spigot-Server-Patches/0021-Remove-invalid-mob-spawner-tile-entities.patch b/Spigot-Server-Patches/0021-Remove-invalid-mob-spawner-tile-entities.patch index 4d5d2ed9a..92005b1f0 100644 --- a/Spigot-Server-Patches/0021-Remove-invalid-mob-spawner-tile-entities.patch +++ b/Spigot-Server-Patches/0021-Remove-invalid-mob-spawner-tile-entities.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Remove invalid mob spawner tile entities diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 43dc791191cdf2aa3e5cb2768c25e6be4b2cf6b1..ef779879e33c2f64c325afd3cd411032fb0d63f9 100644 +index 09b4594ae6750252b4b13ed4735dad0d00e2aeec..a803d1093dfa7c7421eda913679766224fda6dcf 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -607,6 +607,10 @@ public class Chunk implements IChunkAccess { +@@ -608,6 +608,10 @@ public class Chunk implements IChunkAccess { } // CraftBukkit start diff --git a/Spigot-Server-Patches/0022-Optimize-TileEntity-Ticking.patch b/Spigot-Server-Patches/0022-Optimize-TileEntity-Ticking.patch index a6d738ce9..0b5321647 100644 --- a/Spigot-Server-Patches/0022-Optimize-TileEntity-Ticking.patch +++ b/Spigot-Server-Patches/0022-Optimize-TileEntity-Ticking.patch @@ -4,8 +4,45 @@ Date: Sun, 8 Mar 2015 22:55:25 -0600 Subject: [PATCH] Optimize TileEntity Ticking +diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java +index d4ebcf8f66197299256bd6b65710a1488c90ea41..c9164dfdb27ddf3709129c8aec54903a1df121ff 100644 +--- a/src/main/java/co/aikar/timings/TimingsExport.java ++++ b/src/main/java/co/aikar/timings/TimingsExport.java +@@ -109,7 +109,7 @@ public class TimingsExport extends Thread { + pair("end", System.currentTimeMillis() / 1000), + pair("online-mode", Bukkit.getServer().getOnlineMode()), + pair("sampletime", (System.currentTimeMillis() - TimingsManager.timingStart) / 1000), +- pair("datapacks", toArrayMapper(MinecraftServer.getServer().getResourcePackRepository().d(), pack -> { ++ pair("datapacks", toArrayMapper(MinecraftServer.getServer().getResourcePackRepository().e(), pack -> { + // Don't feel like obf helper'ing these, non fatal if its temp missed. + return ChatColor.stripColor(CraftChatMessage.fromComponent(pack.a(true))); + })) +@@ -148,8 +148,8 @@ public class TimingsExport extends Thread { + ); + + parent.put("worlds", toObjectMapper(MinecraftServer.getServer().getWorlds(), world -> { +- if (world.getWorldData().getName().equals("worldeditregentempworld")) return null; +- return pair(world.getWorldData().getName(), createObject( ++ if (world.getWorld().getName().equals("worldeditregentempworld")) return null; ++ return pair(world.getWorld().getName(), createObject( + pair("gamerules", toObjectMapper(world.getWorld().getGameRules(), rule -> { + return pair(rule, world.getWorld().getGameRuleValue(rule)); + })), +diff --git a/src/main/java/net/minecraft/server/BlockChest.java b/src/main/java/net/minecraft/server/BlockChest.java +index 1441d096d44ea653539ba20ccda94eb62ffc32df..b9d0d2d42850c3a5d093429cd0d02ac47848f04b 100644 +--- a/src/main/java/net/minecraft/server/BlockChest.java ++++ b/src/main/java/net/minecraft/server/BlockChest.java +@@ -11,7 +11,7 @@ public class BlockChest extends BlockChestAbstract implements I + + public static final BlockStateDirection FACING = BlockFacingHorizontal.FACING; + public static final BlockStateEnum c = BlockProperties.aF; +- public static final BlockStateBoolean d = BlockProperties.C; ++ public static final BlockStateBoolean d = BlockProperties.C; public static final BlockStateBoolean waterlogged() { return d; } // Paper OBFHELPER + protected static final VoxelShape e = Block.a(1.0D, 0.0D, 0.0D, 15.0D, 14.0D, 15.0D); + protected static final VoxelShape f = Block.a(1.0D, 0.0D, 1.0D, 15.0D, 14.0D, 16.0D); + protected static final VoxelShape g = Block.a(0.0D, 0.0D, 1.0D, 15.0D, 14.0D, 15.0D); diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/java/net/minecraft/server/TileEntityChest.java -index 35f4dc75fbc7cccc80453f279a08b286ab32a25a..eb2b6ff8fd86233c434882c69a8890adc9861d4b 100644 +index 58b1fd7415fdc67be7dc33e7f55c59df83bc996a..a016d97be93c4218136f803cc9a7f986d70309d2 100644 --- a/src/main/java/net/minecraft/server/TileEntityChest.java +++ b/src/main/java/net/minecraft/server/TileEntityChest.java @@ -7,7 +7,7 @@ import org.bukkit.craftbukkit.entity.CraftHumanEntity; @@ -70,7 +107,7 @@ index 35f4dc75fbc7cccc80453f279a08b286ab32a25a..eb2b6ff8fd86233c434882c69a8890ad } private void a(SoundEffect soundeffect) { -+ if (!this.getBlock().hasProperty(BlockChest.c)) { return; } // Paper - this can be delayed, double check exists - Fixes GH-2074 ++ if (!this.getBlock().b(BlockChest.c)) { return; } // Paper - this can be delayed, double check exists - Fixes GH-2074 BlockPropertyChestType blockpropertychesttype = (BlockPropertyChestType) this.getBlock().get(BlockChest.c); if (blockpropertychesttype != BlockPropertyChestType.LEFT) { @@ -91,7 +128,7 @@ index 35f4dc75fbc7cccc80453f279a08b286ab32a25a..eb2b6ff8fd86233c434882c69a8890ad int newPower = Math.max(0, Math.min(15, this.viewingCount)); diff --git a/src/main/java/net/minecraft/server/TileEntityEnderChest.java b/src/main/java/net/minecraft/server/TileEntityEnderChest.java -index 68737be5e67b52cb1f9f526b58b589ecba14dd6b..ea2d5cdd38b305563e9f979887eb455095928ec9 100644 +index b37a705e49f64b46c2256a1b6b077c67fa240b0f..9d03a9ae7fe85fdd0550f737246eef2688a51c8e 100644 --- a/src/main/java/net/minecraft/server/TileEntityEnderChest.java +++ b/src/main/java/net/minecraft/server/TileEntityEnderChest.java @@ -1,6 +1,6 @@ diff --git a/Spigot-Server-Patches/0023-Further-improve-server-tick-loop.patch b/Spigot-Server-Patches/0023-Further-improve-server-tick-loop.patch index c772b6e1b..8441b8088 100644 --- a/Spigot-Server-Patches/0023-Further-improve-server-tick-loop.patch +++ b/Spigot-Server-Patches/0023-Further-improve-server-tick-loop.patch @@ -12,10 +12,10 @@ Previous implementation did not calculate TPS correctly. Switch to a realistic rolling average and factor in std deviation as an extra reporting variable diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index b6912f97c2240b0524735e0f8d1937f2e76dba5b..c61037c837e29544e3afeb0b23f422073d3f5166 100644 +index 9eacc1ba58986c21c5d8dc8d8d14c6f3b48fd171..7b58499c24d5a4296cc539087ca86d2ec4148b1c 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -160,7 +160,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant processQueue = new java.util.concurrent.ConcurrentLinkedQueue(); public int autosavePeriod; - public File bukkitDataPackFolder; -@@ -170,7 +170,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant 0 && args[0].equals("mem") && sender.hasPermission("bukkit.command.tpsmemory")) { ++ sender.sendMessage(ChatColor.GOLD + "Current Memory Usage: " + ChatColor.GREEN + ((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / (1024 * 1024)) + "/" + (Runtime.getRuntime().totalMemory() / (1024 * 1024)) + " mb (Max: " + (Runtime.getRuntime().maxMemory() / (1024 * 1024)) + " mb)"); ++ if (!hasShownMemoryWarning) { ++ sender.sendMessage(ChatColor.RED + "Warning: " + ChatColor.GOLD + " Memory usage on modern garbage collectors is not a stable value and it is perfectly normal to see it reach max. Please do not pay it much attention."); ++ hasShownMemoryWarning = true; ++ } } - 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, ", ")); +- sender.sendMessage(ChatColor.GOLD + "Current Memory Usage: " + ChatColor.GREEN + ((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / (1024 * 1024)) + "/" + (Runtime.getRuntime().totalMemory() / (1024 * 1024)) + " mb (Max: " +- + (Runtime.getRuntime().maxMemory() / (1024 * 1024)) + " mb)"); + // Paper end return true; } - private String format(double tps) ++ private boolean hasShownMemoryWarning; // Paper + private static String format(double tps) // Paper - Made static { return ( ( tps > 18.0 ) ? ChatColor.GREEN : ( tps > 16.0 ) ? ChatColor.YELLOW : ChatColor.RED ).toString() diff --git a/Spigot-Server-Patches/0024-Only-refresh-abilities-if-needed.patch b/Spigot-Server-Patches/0024-Only-refresh-abilities-if-needed.patch index 4f61568f2..0cdd1fd06 100644 --- a/Spigot-Server-Patches/0024-Only-refresh-abilities-if-needed.patch +++ b/Spigot-Server-Patches/0024-Only-refresh-abilities-if-needed.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Only refresh abilities if needed diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 2d3f3a2b7f4e6acdf8043befb584fc0752b1ba3a..690d150aa9117be315d624bf5e8131d70c7c59bf 100644 +index 8d4a0513df27767053342eddda05398eae7b46be..cebf6f85eea3faea8fecb112234ea23b40cd4d9c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1314,12 +1314,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1370,12 +1370,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public void setFlying(boolean value) { diff --git a/Spigot-Server-Patches/0025-Entity-Origin-API.patch b/Spigot-Server-Patches/0025-Entity-Origin-API.patch index bcd50b5b5..21a93e22e 100644 --- a/Spigot-Server-Patches/0025-Entity-Origin-API.patch +++ b/Spigot-Server-Patches/0025-Entity-Origin-API.patch @@ -5,18 +5,18 @@ Subject: [PATCH] Entity Origin API diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 0d617c8e09cf0adf0d7aa8c95fc69c641f91b795..7e400f4c281a02f038834ac984df4ce35a6a7ec3 100644 +index e85172eb69b04746eab08abf213dcd02cd4513ee..bfe36be070677d215eadd3ad38f93c6bddab0b75 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -167,6 +167,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke public org.bukkit.projectiles.ProjectileSource projectileSource; // For projectiles only public boolean forceExplosionKnockback; // SPIGOT-949 public Timing tickTimer = MinecraftTimings.getEntityTimings(this); // Paper -+ public Location origin; // Paper ++ public org.bukkit.Location origin; // Paper // Spigot start public final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this); public final boolean defaultActivationState; -@@ -1581,6 +1582,11 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -1541,6 +1542,11 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke this.bukkitEntity.storeBukkitValues(nbttagcompound); } // CraftBukkit end @@ -28,30 +28,30 @@ index 0d617c8e09cf0adf0d7aa8c95fc69c641f91b795..7e400f4c281a02f038834ac984df4ce3 return nbttagcompound; } catch (Throwable throwable) { CrashReport crashreport = CrashReport.a(throwable, "Saving entity NBT"); -@@ -1695,6 +1701,13 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -1657,6 +1663,13 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke this.getBukkitEntity().readBukkitValues(nbttagcompound); // CraftBukkit end + // Paper start - Restore the entity's origin location + NBTTagList originTag = nbttagcompound.getList("Paper.Origin", 6); + if (!originTag.isEmpty()) { -+ origin = new Location(world.getWorld(), originTag.getDoubleAt(0), originTag.getDoubleAt(1), originTag.getDoubleAt(2)); ++ origin = new org.bukkit.Location(world.getWorld(), originTag.getDoubleAt(0), originTag.getDoubleAt(1), originTag.getDoubleAt(2)); + } + // Paper end + } catch (Throwable throwable) { CrashReport crashreport = CrashReport.a(throwable, "Loading entity NBT"); CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being loaded"); -@@ -1776,6 +1789,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -1718,6 +1731,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - protected abstract void b(NBTTagCompound nbttagcompound); + protected abstract void saveData(NBTTagCompound nbttagcompound); + protected NBTTagList createList(double... adouble) { return a(adouble); } // Paper - OBFHELPER protected NBTTagList a(double... adouble) { NBTTagList nbttaglist = new NBTTagList(); double[] adouble1 = adouble; diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java -index 2097ec535e8a4427fc08da02726044b837d5a716..e64722f63bab6bc1ce97ca63d4fde7599f6c1296 100644 +index 8c51b3060114a24249962c2d6142166ac8600a0a..7c308e0912fb60f8dcdfb36c8a8c8718231858bc 100644 --- a/src/main/java/net/minecraft/server/EntityFallingBlock.java +++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java @@ -254,6 +254,14 @@ public class EntityFallingBlock extends Entity { @@ -70,12 +70,12 @@ index 2097ec535e8a4427fc08da02726044b837d5a716..e64722f63bab6bc1ce97ca63d4fde759 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 d9fd4448c707aca8e2040a5848387ce76bbee1df..7f8b8f5a365d44f03cb4dd60a7403721f9859446 100644 +index b5900e1cad8137954d5fa4fde10b4afb64fb6412..0f4923bce392c8e46f6b256f47d23e15b08e6d62 100644 --- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java +++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java @@ -104,6 +104,14 @@ public class EntityTNTPrimed extends Entity { @Override - protected void a(NBTTagCompound nbttagcompound) { + protected void loadData(NBTTagCompound nbttagcompound) { this.setFuseTicks(nbttagcompound.getShort("Fuse")); + // Paper start - Try and load origin location from the old NBT tags for backwards compatibility + if (nbttagcompound.hasKey("SourceLoc_x")) { @@ -89,7 +89,7 @@ index d9fd4448c707aca8e2040a5848387ce76bbee1df..7f8b8f5a365d44f03cb4dd60a7403721 @Nullable diff --git a/src/main/java/net/minecraft/server/NBTTagList.java b/src/main/java/net/minecraft/server/NBTTagList.java -index 5406f4c40f86e74f8ed4e7e986b23d19141ddc30..d778eac45de775cf4058621fadb55b1b4e1f3457 100644 +index ad8a506bb430b26fe147a657a2f826daf9bf4d45..ad4807e0bdd6409bd798f995da8f43cec1d0b385 100644 --- a/src/main/java/net/minecraft/server/NBTTagList.java +++ b/src/main/java/net/minecraft/server/NBTTagList.java @@ -188,6 +188,7 @@ public class NBTTagList extends NBTList { @@ -101,10 +101,10 @@ index 5406f4c40f86e74f8ed4e7e986b23d19141ddc30..d778eac45de775cf4058621fadb55b1b if (i >= 0 && i < this.list.size()) { NBTBase nbtbase = (NBTBase) this.list.get(i); diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 4ab77e8dc0f918bd4f069a0f886d04dea473f046..f8c9e90d2e5bb60795f7957786e56168ff7bf11c 100644 +index 9df9ce88e23b31f0303a3c84136a10ea14a6d33d..f764eaf58d225d3c875dda66c1a2ac43ef3c1eae 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1166,6 +1166,11 @@ public class WorldServer extends World { +@@ -1088,6 +1088,11 @@ public class WorldServer extends World implements GeneratorAccessSeed { this.navigators.add(((EntityInsentient) entity).getNavigation()); } entity.valid = true; // CraftBukkit @@ -117,10 +117,10 @@ index 4ab77e8dc0f918bd4f069a0f886d04dea473f046..f8c9e90d2e5bb60795f7957786e56168 } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 9672dd7c2166bba88832b1743b97e16561fe434c..3e8ea3a94d0547afc7de4f7b5cd901e93028808d 100644 +index e867168be3c17548490f30944ca56a635cc3b054..19669d7354d8cfa723e614ac3b471e703ee7feee 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -1008,4 +1008,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { +@@ -1016,4 +1016,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { return spigot; } // Spigot end diff --git a/Spigot-Server-Patches/0026-Prevent-tile-entity-and-entity-crashes.patch b/Spigot-Server-Patches/0026-Prevent-tile-entity-and-entity-crashes.patch index fe41d422f..16c4a538e 100644 --- a/Spigot-Server-Patches/0026-Prevent-tile-entity-and-entity-crashes.patch +++ b/Spigot-Server-Patches/0026-Prevent-tile-entity-and-entity-crashes.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Prevent tile entity and entity crashes diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index fa6400dccd4df635d696e0858c0c164a0f19b4a4..e2f3cec7420edbd284b531ca7d1d121459fc098c 100644 +index 057d703fe73de9bb9ca6f0e263463d32abae4c13..534295965ee701611b5e12a10f14a69e8226376a 100644 --- a/src/main/java/net/minecraft/server/TileEntity.java +++ b/src/main/java/net/minecraft/server/TileEntity.java @@ -194,7 +194,12 @@ public abstract class TileEntity implements KeyedObject { // Paper @@ -23,10 +23,10 @@ index fa6400dccd4df635d696e0858c0c164a0f19b4a4..e2f3cec7420edbd284b531ca7d1d1214 } } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index b69d84baf8d318968ef171232e493a315f71814b..ca3b4c9f2f7e1b5425e8be4c3d11e3e881915e8b 100644 +index b09f3f2bda126adf58d58e45f03f4205b28f29fd..8a1f8a8bc2e70b6675011f571b9a6cb58dc79877 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -665,11 +665,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -720,11 +720,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable { gameprofilerfiller.exit(); } catch (Throwable throwable) { @@ -45,7 +45,7 @@ index b69d84baf8d318968ef171232e493a315f71814b..ca3b4c9f2f7e1b5425e8be4c3d11e3e8 } // Spigot start finally { -@@ -735,11 +737,12 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -790,11 +792,12 @@ public abstract class World implements GeneratorAccess, AutoCloseable { try { consumer.accept(entity); } catch (Throwable throwable) { diff --git a/Spigot-Server-Patches/0027-Configurable-top-of-nether-void-damage.patch b/Spigot-Server-Patches/0027-Configurable-top-of-nether-void-damage.patch index 5eebd91e1..cf16b0e54 100644 --- a/Spigot-Server-Patches/0027-Configurable-top-of-nether-void-damage.patch +++ b/Spigot-Server-Patches/0027-Configurable-top-of-nether-void-damage.patch @@ -29,10 +29,10 @@ index d59b82b7bb1f6d1b231f4e394e0a67a3d154d7be..f7a0a33e49cadf9b2bd43f118c106937 + } } diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 7e400f4c281a02f038834ac984df4ce35a6a7ec3..94b74e0c0eb9495f9b2cb066c86bdedbe247a0cd 100644 +index bfe36be070677d215eadd3ad38f93c6bddab0b75..9e132052e1a9b997300e3f5d88473fc5f9ebdd73 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -406,9 +406,16 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -420,9 +420,16 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke this.fallDistance *= 0.5F; } @@ -41,7 +41,7 @@ index 7e400f4c281a02f038834ac984df4ce35a6a7ec3..94b74e0c0eb9495f9b2cb066c86bdedb + // Extracted to own function + /* if (this.locY() < -64.0D) { - this.af(); + this.ai(); } + */ + this.performVoidDamage(); @@ -49,15 +49,15 @@ index 7e400f4c281a02f038834ac984df4ce35a6a7ec3..94b74e0c0eb9495f9b2cb066c86bdedb if (!this.world.isClientSide) { this.setFlag(0, this.fireTicks > 0); -@@ -418,6 +425,17 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -432,6 +439,17 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke this.world.getMethodProfiler().exit(); } + // Paper start + protected void performVoidDamage() { -+ if (this.locY < -64.0D || (this.world.getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER ++ if (this.locY() < -64.0D || (this.world.getWorld().getEnvironment() == org.bukkit.World.Environment.NETHER + && world.paperConfig.doNetherTopVoidDamage() -+ && this.locY >= world.paperConfig.netherVoidTopDamageHeight)) { ++ && this.locY() >= world.paperConfig.netherVoidTopDamageHeight)) { + + this.doVoidDamage(); + } @@ -67,19 +67,19 @@ index 7e400f4c281a02f038834ac984df4ce35a6a7ec3..94b74e0c0eb9495f9b2cb066c86bdedb protected void E() { if (this.portalCooldown > 0) { --this.portalCooldown; -@@ -493,6 +511,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - this.fireTicks = 0; +@@ -507,6 +525,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke + this.setFireTicks(0); } -+ protected final void doVoidDamage() { this.af(); } // Paper - OBFHELPER - protected void af() { ++ protected final void doVoidDamage() { this.ai(); } // Paper - OBFHELPER + protected void ai() { this.die(); } diff --git a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java -index e4d1f37f9f93a62602753e82caa128111abeec4d..c2843d5d607c3d19806b673c76289a8bee035e70 100644 +index cb25cf3bb7be041d9b135165b6f66b5c232a2553..9124d00521463157df6348b84260f91a47e1f076 100644 --- a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java +++ b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java -@@ -210,9 +210,15 @@ public abstract class EntityMinecartAbstract extends Entity { +@@ -285,9 +285,15 @@ public abstract class EntityMinecartAbstract extends Entity { this.setDamage(this.getDamage() - 1.0F); } @@ -87,7 +87,7 @@ index e4d1f37f9f93a62602753e82caa128111abeec4d..c2843d5d607c3d19806b673c76289a8b + // Extracted to own function + /* if (this.locY() < -64.0D) { - this.af(); + this.ai(); } + */ + this.performVoidDamage(); diff --git a/Spigot-Server-Patches/0028-Check-online-mode-before-converting-and-renaming-pla.patch b/Spigot-Server-Patches/0028-Check-online-mode-before-converting-and-renaming-pla.patch index 3e7ef8369..d9176841a 100644 --- a/Spigot-Server-Patches/0028-Check-online-mode-before-converting-and-renaming-pla.patch +++ b/Spigot-Server-Patches/0028-Check-online-mode-before-converting-and-renaming-pla.patch @@ -5,15 +5,15 @@ Subject: [PATCH] Check online mode before converting and renaming player data diff --git a/src/main/java/net/minecraft/server/WorldNBTStorage.java b/src/main/java/net/minecraft/server/WorldNBTStorage.java -index 97bac7d2579a8b895d76082c6575491b83411298..a0254d8e519fa8b19dc282f3abf33b8ebe4f0aba 100644 +index 240f9331dca65990f5e724b88050342831868e72..ef9719bf20db92a7e6690bccb00cc54293d392a9 100644 --- a/src/main/java/net/minecraft/server/WorldNBTStorage.java +++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java -@@ -164,7 +164,7 @@ public class WorldNBTStorage implements IPlayerFileData { +@@ -50,7 +50,7 @@ public class WorldNBTStorage { File file = new File(this.playerDir, entityhuman.getUniqueIDString() + ".dat"); // Spigot Start boolean usingWrongFile = false; - if ( !file.exists() ) + 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"); + file = new File( this.playerDir, java.util.UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + entityhuman.getName() ).getBytes( "UTF-8" ) ).toString() + ".dat"); if ( file.exists() ) diff --git a/Spigot-Server-Patches/0029-Always-tick-falling-blocks.patch b/Spigot-Server-Patches/0029-Always-tick-falling-blocks.patch index daf6c75ab..f66392597 100644 --- a/Spigot-Server-Patches/0029-Always-tick-falling-blocks.patch +++ b/Spigot-Server-Patches/0029-Always-tick-falling-blocks.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Always tick falling blocks diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java -index 4423839697987e255e5a93bdd6742186dde2e4c4..f86404f83ae605159307a3ad2cca6c6c314a01af 100644 +index 2b00258ccd808e3332af5ab3f7e4967f03dd4aa3..78f0fb5d97b077673ec542cd70bbc3ffa13f916c 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java @@ -13,6 +13,7 @@ import net.minecraft.server.EntityCreature; diff --git a/Spigot-Server-Patches/0030-Configurable-end-credits.patch b/Spigot-Server-Patches/0030-Configurable-end-credits.patch index b07c0149f..4d39e6b1e 100644 --- a/Spigot-Server-Patches/0030-Configurable-end-credits.patch +++ b/Spigot-Server-Patches/0030-Configurable-end-credits.patch @@ -20,23 +20,23 @@ index f7a0a33e49cadf9b2bd43f118c106937760da762..50dec5cb5e924301842300e8fc80cb67 + } } diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 26e32aa1dbd6de0ba971c32f8daef0d92d65b683..cd09b207c963d81c9302067e0294db57e3ffd0f7 100644 +index 5bf3c279b86ed0fa416ee7dd9923172d6e6261a5..7012bd08fb4715eb66e6f47733b82f556c2b8a11 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -60,7 +60,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - private long cj = SystemUtils.getMonotonicMillis(); + private long ch = SystemUtils.getMonotonicMillis(); private Entity spectatedEntity; public boolean worldChangeInvuln; -- private boolean cm; -+ private boolean cm; private void setHasSeenCredits(boolean has) { this.cm = has; } // Paper - OBFHELPER - private final RecipeBookServer recipeBook; - private Vec3D co; - private int cp; -@@ -695,6 +695,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +- private boolean ck; ++ private boolean ck; private void setHasSeenCredits(boolean has) { this.ck = has; } // Paper - OBFHELPER + private final RecipeBookServer recipeBook = new RecipeBookServer(); + private Vec3D cm; + private int cn; +@@ -749,6 +749,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { this.getWorldServer().removePlayer(this); if (!this.viewingCredits) { this.viewingCredits = true; + if (world.paperConfig.disableEndCredits) this.setHasSeenCredits(true); // Paper - Toggle to always disable end credits - this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(4, this.cm ? 0.0F : 1.0F)); - this.cm = true; + this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.e, this.ck ? 0.0F : 1.0F)); + this.ck = true; } diff --git a/Spigot-Server-Patches/0031-Fix-lag-from-explosions-processing-dead-entities.patch b/Spigot-Server-Patches/0031-Fix-lag-from-explosions-processing-dead-entities.patch index 0a4db8807..99d0d82ee 100644 --- a/Spigot-Server-Patches/0031-Fix-lag-from-explosions-processing-dead-entities.patch +++ b/Spigot-Server-Patches/0031-Fix-lag-from-explosions-processing-dead-entities.patch @@ -5,27 +5,20 @@ Subject: [PATCH] Fix lag from explosions processing dead entities diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java -index eb7b8d94c83c3f3be0a7f019dad7dd87da5347fe..a063d1bfaa1acd20a5de9701eef028a543235d5e 100644 +index 692625d9f80b6e98ba4bb6c94c71e6b59ba36d6a..bf156897acfe25c16a1b09a83a00ba3ab647a2dd 100644 --- a/src/main/java/net/minecraft/server/Explosion.java +++ b/src/main/java/net/minecraft/server/Explosion.java -@@ -151,7 +151,14 @@ public class Explosion { - int i1 = MathHelper.floor(this.posY + (double) f3 + 1.0D); - int j1 = MathHelper.floor(this.posZ - (double) f3 - 1.0D); - int k1 = MathHelper.floor(this.posZ + (double) f3 + 1.0D); +@@ -153,7 +153,7 @@ public class Explosion { + int i1 = MathHelper.floor(this.posY + (double) f2 + 1.0D); + int j1 = MathHelper.floor(this.posZ - (double) f2 - 1.0D); + int k1 = MathHelper.floor(this.posZ + (double) f2 + 1.0D); - List list = this.world.getEntities(this.source, new AxisAlignedBB((double) i, (double) l, (double) j1, (double) j, (double) i1, (double) k1)); -+ // Paper start - Fix lag from explosions processing dead entities -+ List list = this.world.getEntities(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.canAITarget().test(entity) && !entity.dead; -+ } -+ }); -+ // Paper end ++ List list = this.world.getEntities(this.source, new AxisAlignedBB((double) i, (double) l, (double) j1, (double) j, (double) i1, (double) k1), (com.google.common.base.Predicate) entity -> IEntitySelector.canAITarget().test(entity) && !entity.dead); // Paper - Fix lag from explosions processing dead entities Vec3D vec3d = new Vec3D(this.posX, this.posY, this.posZ); for (int l1 = 0; l1 < list.size(); ++l1) { diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java -index c75ed9ddc14e1fd3b57a7c989267bf5a0bb6157a..c1f462d9d3eefdab767bea28da484bfb1dfda06a 100644 +index ed7566591bac72d17b40a940531b7feb1cb8f392..d7e3580067bcbca09b66f05f02e8736863bd7ef5 100644 --- a/src/main/java/net/minecraft/server/IEntitySelector.java +++ b/src/main/java/net/minecraft/server/IEntitySelector.java @@ -14,6 +14,7 @@ public final class IEntitySelector { diff --git a/Spigot-Server-Patches/0032-Optimize-explosions.patch b/Spigot-Server-Patches/0032-Optimize-explosions.patch index 9fafbf045..d1d73ce7a 100644 --- a/Spigot-Server-Patches/0032-Optimize-explosions.patch +++ b/Spigot-Server-Patches/0032-Optimize-explosions.patch @@ -25,10 +25,10 @@ index 50dec5cb5e924301842300e8fc80cb671b6b9173..f038d3f7dc7d1034a3ee9f2384a85642 + } } diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java -index a063d1bfaa1acd20a5de9701eef028a543235d5e..5583860f152aadcbe74bf7b99e7efd8e47cefa35 100644 +index bf156897acfe25c16a1b09a83a00ba3ab647a2dd..842563f2030382659a62a3a63d9af9d5a58e3d85 100644 --- a/src/main/java/net/minecraft/server/Explosion.java +++ b/src/main/java/net/minecraft/server/Explosion.java -@@ -177,7 +177,7 @@ public class Explosion { +@@ -172,7 +172,7 @@ public class Explosion { d8 /= d11; d9 /= d11; d10 /= d11; @@ -37,7 +37,7 @@ index a063d1bfaa1acd20a5de9701eef028a543235d5e..5583860f152aadcbe74bf7b99e7efd8e double d13 = (1.0D - d7) * d12; // CraftBukkit start -@@ -384,4 +384,84 @@ public class Explosion { +@@ -391,4 +391,84 @@ public class Explosion { private Effect() {} } @@ -123,22 +123,22 @@ index a063d1bfaa1acd20a5de9701eef028a543235d5e..5583860f152aadcbe74bf7b99e7efd8e + // Paper end } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index c61037c837e29544e3afeb0b23f422073d3f5166..a67c31a6021d881b49cfdb75f514404c342eea45 100644 +index 7b58499c24d5a4296cc539087ca86d2ec4148b1c..991baec71cfeb79ee2108870645a19582f151def 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1184,6 +1184,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant trackedPlayers; @@ -49,7 +49,7 @@ index a75e0ec54e9dfd98c1bcbd13cb022ab05d8410b9..a13fd9b3404381879663c1f694a5d190 this.trackedPlayers = trackedPlayers; // CraftBukkit end this.m = Vec3D.a; -@@ -159,7 +175,25 @@ public class EntityTrackerEntry { +@@ -161,7 +177,25 @@ public class EntityTrackerEntry { } if (packet1 != null) { @@ -77,10 +77,10 @@ index a75e0ec54e9dfd98c1bcbd13cb022ab05d8410b9..a13fd9b3404381879663c1f694a5d190 this.c(); diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 65134c87772cb6d4d732fc223929cfda7524dde2..eece2f689cce58a35d33c6e8d9d56ea4e9dfd88c 100644 +index 7c5eaff23ef6bf3cdf2575330ea6341d6240e283..31d4faebcf34e2e207806d7945e1d8c50c5097bd 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -1220,10 +1220,14 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1249,10 +1249,14 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { private final Entity tracker; private final int trackingDistance; private SectionPosition e; @@ -97,7 +97,7 @@ index 65134c87772cb6d4d732fc223929cfda7524dde2..eece2f689cce58a35d33c6e8d9d56ea4 this.tracker = entity; this.trackingDistance = i; this.e = SectionPosition.a(entity); -@@ -1305,7 +1309,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1334,7 +1338,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { entityplayer.removeQueue.remove(Integer.valueOf(this.tracker.getId())); // CraftBukkit end diff --git a/Spigot-Server-Patches/0038-Add-BeaconEffectEvent.patch b/Spigot-Server-Patches/0038-Add-BeaconEffectEvent.patch index 81f607b50..6b397633d 100644 --- a/Spigot-Server-Patches/0038-Add-BeaconEffectEvent.patch +++ b/Spigot-Server-Patches/0038-Add-BeaconEffectEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add BeaconEffectEvent diff --git a/src/main/java/net/minecraft/server/TileEntityBeacon.java b/src/main/java/net/minecraft/server/TileEntityBeacon.java -index 536afe531278e8f6f1ab730c875346c8a624486b..df2d6c3b070c2fc106fa2942959ef21b3511f0ee 100644 +index b9aa63e6c38f6b023da5e9865ba1f74f931cc7af..2858ea1f3eb44ea2cc6b11454b8e94bca4ab0568 100644 --- a/src/main/java/net/minecraft/server/TileEntityBeacon.java +++ b/src/main/java/net/minecraft/server/TileEntityBeacon.java @@ -14,6 +14,11 @@ import org.bukkit.craftbukkit.potion.CraftPotionUtil; @@ -20,7 +20,7 @@ index 536afe531278e8f6f1ab730c875346c8a624486b..df2d6c3b070c2fc106fa2942959ef21b public class TileEntityBeacon extends TileEntity implements ITileInventory, ITickable { -@@ -242,14 +247,31 @@ public class TileEntityBeacon extends TileEntity implements ITileInventory, ITic +@@ -240,14 +245,31 @@ public class TileEntityBeacon extends TileEntity implements ITileInventory, ITic } private void applyEffect(List list, MobEffectList effects, int i, int b0) { @@ -53,7 +53,7 @@ index 536afe531278e8f6f1ab730c875346c8a624486b..df2d6c3b070c2fc106fa2942959ef21b } } } -@@ -272,10 +294,10 @@ public class TileEntityBeacon extends TileEntity implements ITileInventory, ITic +@@ -270,10 +292,10 @@ public class TileEntityBeacon extends TileEntity implements ITileInventory, ITic int i = getLevel(); List list = getHumansInRange(); diff --git a/Spigot-Server-Patches/0039-Configurable-container-update-tick-rate.patch b/Spigot-Server-Patches/0039-Configurable-container-update-tick-rate.patch index 12dd86313..58b234158 100644 --- a/Spigot-Server-Patches/0039-Configurable-container-update-tick-rate.patch +++ b/Spigot-Server-Patches/0039-Configurable-container-update-tick-rate.patch @@ -19,10 +19,10 @@ index 428deed56dae597291670bea8c8a6a67ce4d940f..a4da22ea65d5fdba38f8dc331919088f + } } diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index cd09b207c963d81c9302067e0294db57e3ffd0f7..64635fe70f37cecdf4344661c28768f6ac16fdd2 100644 +index 7012bd08fb4715eb66e6f47733b82f556c2b8a11..b8a45b6c7f519e4948f14ccc39b505420c3a0dd7 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -72,6 +72,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -76,6 +76,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public boolean e; public int ping; public boolean viewingCredits; @@ -30,7 +30,7 @@ index cd09b207c963d81c9302067e0294db57e3ffd0f7..64635fe70f37cecdf4344661c28768f6 // CraftBukkit start public String displayName; -@@ -355,7 +356,12 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -395,7 +396,12 @@ public class EntityPlayer extends EntityHuman implements ICrafting { --this.noDamageTicks; } diff --git a/Spigot-Server-Patches/0041-Disable-spigot-tick-limiters.patch b/Spigot-Server-Patches/0041-Disable-spigot-tick-limiters.patch index b50f63392..fb75cd06c 100644 --- a/Spigot-Server-Patches/0041-Disable-spigot-tick-limiters.patch +++ b/Spigot-Server-Patches/0041-Disable-spigot-tick-limiters.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Disable spigot tick limiters diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 6dfefa3f9ebf6d2ad08ebe6ddd77ca6d95971544..65fc7105c8c93ccee569abb14ccba3f5cf75a7a8 100644 +index 7fe3cfebb051944f3c619ae04bc966efdbff31da..864df4fbcb0f4a09fc12b270955c36d779aeb7d4 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -635,9 +635,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -690,9 +690,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { // Spigot start // Iterator iterator = this.tileEntityListTick.iterator(); int tilesThisCycle = 0; diff --git a/Spigot-Server-Patches/0042-Add-PlayerInitialSpawnEvent.patch b/Spigot-Server-Patches/0042-Add-PlayerInitialSpawnEvent.patch index 4c186c7a8..fb173c861 100644 --- a/Spigot-Server-Patches/0042-Add-PlayerInitialSpawnEvent.patch +++ b/Spigot-Server-Patches/0042-Add-PlayerInitialSpawnEvent.patch @@ -9,10 +9,10 @@ This is a duplicate API from spigot, so use our duplicate subclass and improve setPosition to use raw diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 79cfcbce85e779fc8e8589840a27961f59209f3d..f8b7ea28694170148027123f889fb93f8647cdc4 100644 +index 213e8512247e9873563ad606a7e3a2a3ca409718..2265fa3c04305e18653b4b37a0d1d36b261521d7 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -119,14 +119,14 @@ public abstract class PlayerList { +@@ -143,7 +143,7 @@ public abstract class PlayerList { // Spigot start - spawn location event Player bukkitPlayer = entityplayer.getBukkitEntity(); @@ -21,9 +21,10 @@ index 79cfcbce85e779fc8e8589840a27961f59209f3d..f8b7ea28694170148027123f889fb93f Bukkit.getPluginManager().callEvent(ev); Location loc = ev.getSpawnLocation(); - worldserver = ((CraftWorld) loc.getWorld()).getHandle(); +@@ -151,7 +151,7 @@ public abstract class PlayerList { - entityplayer.spawnIn(worldserver); + entityplayer.spawnIn(worldserver1); + entityplayer.playerInteractManager.a((WorldServer) entityplayer.world); - entityplayer.setPosition(loc.getX(), loc.getY(), loc.getZ()); + entityplayer.setPositionRaw(loc.getX(), loc.getY(), loc.getZ()); // Paper - set raw so we aren't fully joined to the world (not added to chunk or world) entityplayer.setYawPitch(loc.getYaw(), loc.getPitch()); diff --git a/Spigot-Server-Patches/0043-Configurable-Disabling-Cat-Chest-Detection.patch b/Spigot-Server-Patches/0043-Configurable-Disabling-Cat-Chest-Detection.patch index f03361ec1..4f50672d2 100644 --- a/Spigot-Server-Patches/0043-Configurable-Disabling-Cat-Chest-Detection.patch +++ b/Spigot-Server-Patches/0043-Configurable-Disabling-Cat-Chest-Detection.patch @@ -20,10 +20,10 @@ index a4da22ea65d5fdba38f8dc331919088f9ca99aed..345ac63e281bb3372b2ae879d587d658 + } } diff --git a/src/main/java/net/minecraft/server/BlockChest.java b/src/main/java/net/minecraft/server/BlockChest.java -index 033cb78d91d522b356fea85e66b33de2224f8fe2..72fb92f7c379cb84425b6b03ddf8aad29388c0ae 100644 +index b9d0d2d42850c3a5d093429cd0d02ac47848f04b..44b9bfcdc7f2cbf4dc6e28c258506d9f84783b0e 100644 --- a/src/main/java/net/minecraft/server/BlockChest.java +++ b/src/main/java/net/minecraft/server/BlockChest.java -@@ -267,6 +267,11 @@ public class BlockChest extends BlockChestAbstract implements I +@@ -268,6 +268,11 @@ public class BlockChest extends BlockChestAbstract implements I } private static boolean b(GeneratorAccess generatoraccess, BlockPosition blockposition) { diff --git a/Spigot-Server-Patches/0044-Ensure-commands-are-not-ran-async.patch b/Spigot-Server-Patches/0044-Ensure-commands-are-not-ran-async.patch index 91fb60a59..4b8e06ce4 100644 --- a/Spigot-Server-Patches/0044-Ensure-commands-are-not-ran-async.patch +++ b/Spigot-Server-Patches/0044-Ensure-commands-are-not-ran-async.patch @@ -14,10 +14,10 @@ big slowdown in execution but throwing an exception at same time to raise awaren that it is happening so that plugin authors can fix their code to stop executing commands async. diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 87119b4fe5ae27c63d272c8e436e3734eddd8f68..2e24d5ba85d7938a9ffe2339fa22c19ee5362b5f 100644 +index 88fa8d63c5bb2c76ba09db6bb002f6d6b6a42afc..8ecca907357119ed8eb67381914daba4ae6db38f 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1570,6 +1570,29 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -1615,6 +1615,29 @@ public class PlayerConnection implements PacketListenerPlayIn { } if (!async && s.startsWith("/")) { @@ -48,10 +48,10 @@ index 87119b4fe5ae27c63d272c8e436e3734eddd8f68..2e24d5ba85d7938a9ffe2339fa22c19e } else if (this.player.getChatFlags() == EnumChatVisibility.SYSTEM) { // Do nothing, this is coming from a plugin diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 99083a1f36f95a4fb3d67f903d02b84d6ebae3d2..697246492a4bf31e84ce3d9f4e35c46f54b7eb7d 100644 +index 4edc9d892a18f7ea2b22f597ee075b09cf843eaf..e6836b4afa60de8990cbc3e8a3bb39edd753782e 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -720,6 +720,29 @@ public final class CraftServer implements Server { +@@ -754,6 +754,29 @@ public final class CraftServer implements Server { Validate.notNull(commandLine, "CommandLine cannot be null"); org.spigotmc.AsyncCatcher.catchOp("command dispatch"); // Spigot diff --git a/Spigot-Server-Patches/0045-All-chunks-are-slime-spawn-chunks-toggle.patch b/Spigot-Server-Patches/0045-All-chunks-are-slime-spawn-chunks-toggle.patch index 99c268a3a..e71531ace 100644 --- a/Spigot-Server-Patches/0045-All-chunks-are-slime-spawn-chunks-toggle.patch +++ b/Spigot-Server-Patches/0045-All-chunks-are-slime-spawn-chunks-toggle.patch @@ -19,15 +19,15 @@ index 345ac63e281bb3372b2ae879d587d658243581ba..62e793b71b313146b86b466421e7a5f8 + } } diff --git a/src/main/java/net/minecraft/server/EntitySlime.java b/src/main/java/net/minecraft/server/EntitySlime.java -index 8e8526f371ec967862891e371faa0e4b9c2c11c3..3ecf732192f7f1bd20b9d766bedef08e64434fda 100644 +index 8e958367fb0873b26cb01c5a38e24650b0527be8..9c83389c56083d9febf604bf30da47c89330902e 100644 --- a/src/main/java/net/minecraft/server/EntitySlime.java +++ b/src/main/java/net/minecraft/server/EntitySlime.java -@@ -289,7 +289,7 @@ public class EntitySlime extends EntityInsentient implements IMonster { - } +@@ -285,7 +285,7 @@ public class EntitySlime extends EntityInsentient implements IMonster { + } - ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(blockposition); -- boolean flag = SeededRandom.a(chunkcoordintpair.x, chunkcoordintpair.z, generatoraccess.getSeed(), generatoraccess.getMinecraftWorld().spigotConfig.slimeSeed).nextInt(10) == 0; // Spigot -+ boolean flag = generatoraccess.getMinecraftWorld().paperConfig.allChunksAreSlimeChunks || SeededRandom.a(chunkcoordintpair.x, chunkcoordintpair.z, generatoraccess.getSeed(), generatoraccess.getMinecraftWorld().spigotConfig.slimeSeed).nextInt(10) == 0; // Spigot // Paper + ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(blockposition); +- boolean flag = SeededRandom.a(chunkcoordintpair.x, chunkcoordintpair.z, ((GeneratorAccessSeed) generatoraccess).getSeed(), generatoraccess.getMinecraftWorld().spigotConfig.slimeSeed).nextInt(10) == 0; // Spigot ++ boolean flag = generatoraccess.getMinecraftWorld().paperConfig.allChunksAreSlimeChunks || SeededRandom.a(chunkcoordintpair.x, chunkcoordintpair.z, ((GeneratorAccessSeed) generatoraccess).getSeed(), generatoraccess.getMinecraftWorld().spigotConfig.slimeSeed).nextInt(10) == 0; // Spigot // Paper - if (random.nextInt(10) == 0 && flag && blockposition.getY() < 40) { - return a(entitytypes, generatoraccess, enummobspawn, blockposition, random); + if (random.nextInt(10) == 0 && flag && blockposition.getY() < 40) { + return a(entitytypes, generatoraccess, enummobspawn, blockposition, random); diff --git a/Spigot-Server-Patches/0046-Expose-server-CommandMap.patch b/Spigot-Server-Patches/0046-Expose-server-CommandMap.patch index 713d41008..13527a1fe 100644 --- a/Spigot-Server-Patches/0046-Expose-server-CommandMap.patch +++ b/Spigot-Server-Patches/0046-Expose-server-CommandMap.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Expose server CommandMap diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 697246492a4bf31e84ce3d9f4e35c46f54b7eb7d..1cf8fd93a45fb76fc1638c7fd8751314d4c813e3 100644 +index e6836b4afa60de8990cbc3e8a3bb39edd753782e..6fdc6caa4d58aea28911442ac29d7420926b30f4 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1629,6 +1629,7 @@ public final class CraftServer implements Server { +@@ -1703,6 +1703,7 @@ public final class CraftServer implements Server { return helpMap; } diff --git a/Spigot-Server-Patches/0047-Be-a-bit-more-informative-in-maxHealth-exception.patch b/Spigot-Server-Patches/0047-Be-a-bit-more-informative-in-maxHealth-exception.patch index 734e22a13..018c221dc 100644 --- a/Spigot-Server-Patches/0047-Be-a-bit-more-informative-in-maxHealth-exception.patch +++ b/Spigot-Server-Patches/0047-Be-a-bit-more-informative-in-maxHealth-exception.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Be a bit more informative in maxHealth exception diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 6146db18416785a06f86a3118329b33adde9c5f8..966d23add13a3139adead8f8969c0a4ff34929c6 100644 +index 8f16b27123f1fc7c648c7d1f7c557e491d36f243..7e95ef170c418594f5469431c052e64107c08ab5 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -106,7 +106,10 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -109,7 +109,10 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { public void setHealth(double health) { health = (float) health; if ((health < 0) || (health > getMaxHealth())) { diff --git a/Spigot-Server-Patches/0048-Player-Tab-List-and-Title-APIs.patch b/Spigot-Server-Patches/0048-Player-Tab-List-and-Title-APIs.patch index e78636a76..6d46ff6c9 100644 --- a/Spigot-Server-Patches/0048-Player-Tab-List-and-Title-APIs.patch +++ b/Spigot-Server-Patches/0048-Player-Tab-List-and-Title-APIs.patch @@ -5,17 +5,17 @@ Subject: [PATCH] Player Tab List and Title APIs diff --git a/src/main/java/net/minecraft/server/IChatBaseComponent.java b/src/main/java/net/minecraft/server/IChatBaseComponent.java -index cf89622a8b56ddcff1ba09dfb3fbd1b4c3c4677e..fb97c51bb1a4cabc6b67d8f74a5f0b6e0fb6052c 100644 +index 89dae553392206abb8b3a7be6c807f97cb60ddac..fd3e6cda6a0e7154c50608ba9a4b70f3c43c8f2a 100644 --- a/src/main/java/net/minecraft/server/IChatBaseComponent.java +++ b/src/main/java/net/minecraft/server/IChatBaseComponent.java -@@ -439,6 +439,7 @@ public interface IChatBaseComponent extends Message, Iterable tileEntityList = Lists.newArrayList(); public final List tileEntityListTick = Lists.newArrayList(); protected final List tileEntityListPending = Lists.newArrayList(); - protected final List tileEntityListUnload = Lists.newArrayList(); + protected final java.util.Set tileEntityListUnload = com.google.common.collect.Sets.newHashSet(); public final Thread serverThread; - private int c; - protected int i = (new Random()).nextInt(); + private final boolean debugWorld; + private int d; diff --git a/Spigot-Server-Patches/0051-Add-configurable-portal-search-radius.patch b/Spigot-Server-Patches/0051-Add-configurable-portal-search-radius.patch index cf0740eee..4c5b19325 100644 --- a/Spigot-Server-Patches/0051-Add-configurable-portal-search-radius.patch +++ b/Spigot-Server-Patches/0051-Add-configurable-portal-search-radius.patch @@ -21,35 +21,34 @@ index 62e793b71b313146b86b466421e7a5f894bef9df..cd47a4ca069df26969de3051c2aac805 + } } diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 94b74e0c0eb9495f9b2cb066c86bdedbe247a0cd..65a421ee6f704af88ba2170930d17b46a9531c28 100644 +index 9e132052e1a9b997300e3f5d88473fc5f9ebdd73..1a8fc714f6e4663fc02c1df6a67aaa37d48f743d 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -2582,7 +2582,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -2508,7 +2508,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke blockposition = new BlockPosition(d0, this.locY(), d1); // CraftBukkit start -- EntityPortalEvent event = CraftEventFactory.callEntityPortalEvent(this, worldserver1, blockposition, 128); -+ EntityPortalEvent event = CraftEventFactory.callEntityPortalEvent(this, worldserver1, blockposition, world.paperConfig.portalSearchRadius); // Paper - use portal search radius +- EntityPortalEvent event = CraftEventFactory.callEntityPortalEvent(this, worldserver, blockposition, 128); ++ EntityPortalEvent event = CraftEventFactory.callEntityPortalEvent(this, worldserver, blockposition, worldserver.paperConfig.portalSearchRadius); // Paper - use portal search radius if (event == null) { return null; } diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 64635fe70f37cecdf4344661c28768f6ac16fdd2..540048627ef5716be2c9115b162a6eeaf9951ad9 100644 +index b8a45b6c7f519e4948f14ccc39b505420c3a0dd7..7eb56761d9073156b30d4c981dcd4b4ba646f0bc 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -755,7 +755,9 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -815,7 +815,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting { // CraftBukkit start Location enter = this.getBukkitEntity().getLocation(); - Location exit = (worldserver1 == null) ? null : new Location(worldserver1.getWorld(), d0, d1, d2, f1, f); -- PlayerPortalEvent event = new PlayerPortalEvent(this.getBukkitEntity(), enter, exit, cause, 128, true, dimensionmanager.getType() == DimensionManager.THE_END ? 0 : 16); -+ int configuredSearchRadius = (worldserver1 == null ? worldserver : worldserver1).paperConfig.portalSearchRadius; -+ int configuredCreateRadius = (worldserver1 == null ? worldserver : worldserver1).paperConfig.portalCreateRadius; -+ PlayerPortalEvent event = new PlayerPortalEvent(this.getBukkitEntity(), enter, exit, cause, configuredSearchRadius, true, dimensionmanager.getType() == DimensionManager.THE_END ? 0 : configuredCreateRadius); // Paper - configurable portal search radius + Location exit = (worldserver == null) ? null : new Location(worldserver.getWorld(), d0, d1, d2, f1, f); +- PlayerPortalEvent event = new PlayerPortalEvent(this.getBukkitEntity(), enter, exit, cause, 128, true, resourcekey == DimensionManager.THE_END ? 0 : 16); ++ com.destroystokyo.paper.PaperWorldConfig config = worldserver != null ? worldserver.paperConfig : worldserver1.paperConfig; // Paper - portal radius ++ PlayerPortalEvent event = new PlayerPortalEvent(this.getBukkitEntity(), enter, exit, cause, config.portalSearchRadius, true, resourcekey == DimensionManager.THE_END ? 0 : config.portalCreateRadius); // Paper - portal radius Bukkit.getServer().getPluginManager().callEvent(event); if (event.isCancelled() || event.getTo() == null) { return null; diff --git a/src/main/java/net/minecraft/server/PortalTravelAgent.java b/src/main/java/net/minecraft/server/PortalTravelAgent.java -index 19c54f1dde60feb2e8deedc83940c778500401eb..f84dd6d9bec4c0f2f741bab20a4f45884594da2d 100644 +index 8eacfc66dc04bba89c8e1c03746c67068e07718b..f6ec165f9c7d83698100c85b1d4bf6b4cea0f458 100644 --- a/src/main/java/net/minecraft/server/PortalTravelAgent.java +++ b/src/main/java/net/minecraft/server/PortalTravelAgent.java @@ -45,7 +45,7 @@ public class PortalTravelAgent { @@ -63,10 +62,10 @@ index 19c54f1dde60feb2e8deedc83940c778500401eb..f84dd6d9bec4c0f2f741bab20a4f4588 @Nullable @@ -53,7 +53,7 @@ public class PortalTravelAgent { // CraftBukkit end - VillagePlace villageplace = this.world.B(); + VillagePlace villageplace = this.world.x(); - villageplace.a(this.world, blockposition, 128); + villageplace.a(this.world, blockposition, searchRadius); // Paper - This impacts the # of chunks searched for entries List list = (List) villageplace.b((villageplacetype) -> { - return villageplacetype == VillagePlaceType.u; + return villageplacetype == VillagePlaceType.v; }, blockposition, searchRadius, VillagePlace.Occupancy.ANY).collect(Collectors.toList()); // CraftBukkit - searchRadius diff --git a/Spigot-Server-Patches/0052-Add-velocity-warnings.patch b/Spigot-Server-Patches/0052-Add-velocity-warnings.patch index 7b1125b28..4460e8b19 100644 --- a/Spigot-Server-Patches/0052-Add-velocity-warnings.patch +++ b/Spigot-Server-Patches/0052-Add-velocity-warnings.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add velocity warnings diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 1cf8fd93a45fb76fc1638c7fd8751314d4c813e3..d5311eb017fa093c3068e7ea0c24026822b9d638 100644 +index 6fdc6caa4d58aea28911442ac29d7420926b30f4..3c95cbc18826912eb53205c6fb1387af90a5804c 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -234,6 +234,7 @@ public final class CraftServer implements Server { +@@ -262,6 +262,7 @@ public final class CraftServer implements Server { public boolean ignoreVanillaPermissions = false; private final List playerView; public int reloadCount; @@ -17,10 +17,10 @@ index 1cf8fd93a45fb76fc1638c7fd8751314d4c813e3..d5311eb017fa093c3068e7ea0c240268 static { ConfigurationSerialization.registerClass(CraftOfflinePlayer.class); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 3e8ea3a94d0547afc7de4f7b5cd901e93028808d..7a6df77f196db8ccdaf589b680de9aab09b0ef32 100644 +index 19669d7354d8cfa723e614ac3b471e703ee7feee..613081685e233074728366b9ff16642c04774c91 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -408,10 +408,41 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { +@@ -416,10 +416,41 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { public void setVelocity(Vector velocity) { Preconditions.checkArgument(velocity != null, "velocity"); velocity.checkFinite(); diff --git a/Spigot-Server-Patches/0053-Configurable-inter-world-teleportation-safety.patch b/Spigot-Server-Patches/0053-Configurable-inter-world-teleportation-safety.patch index d94fcaf88..a9d43064e 100644 --- a/Spigot-Server-Patches/0053-Configurable-inter-world-teleportation-safety.patch +++ b/Spigot-Server-Patches/0053-Configurable-inter-world-teleportation-safety.patch @@ -30,15 +30,15 @@ index cd47a4ca069df26969de3051c2aac80540093818..abbf59bb91021821876a8960e8f77fac + } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index c0937138a31077244e39b1154cd7838e26aa1205..c6c8d24e3b4c24ec5a6c7dd33afa3ab86d388ca1 100644 +index f933af87971ae96f154f26be2a8c122670e3cf64..c90d3c8fe0965f437fe17979978f1189a27851ac 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -758,7 +758,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -764,7 +764,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { if (fromWorld == toWorld) { entity.playerConnection.teleport(to); } else { -- server.getHandle().moveToWorld(entity, toWorld.getWorldProvider().getDimensionManager(), true, to, true); -+ server.getHandle().moveToWorld(entity, toWorld.getWorldProvider().getDimensionManager(), true, to, !toWorld.paperConfig.disableTeleportationSuffocationCheck); +- server.getHandle().moveToWorld(entity, toWorld, true, to, true); ++ server.getHandle().moveToWorld(entity, toWorld, true, to, !toWorld.paperConfig.disableTeleportationSuffocationCheck); // Paper } return true; } diff --git a/Spigot-Server-Patches/0054-Add-exception-reporting-event.patch b/Spigot-Server-Patches/0054-Add-exception-reporting-event.patch index ccf79bfb4..0e2d54f0e 100644 --- a/Spigot-Server-Patches/0054-Add-exception-reporting-event.patch +++ b/Spigot-Server-Patches/0054-Add-exception-reporting-event.patch @@ -49,7 +49,7 @@ index 0000000000000000000000000000000000000000..f699ce18ca044f813e194ef2786b7ea8 + } +} diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index ef779879e33c2f64c325afd3cd411032fb0d63f9..b85e21202eb8bb9446989aa1d6889eed784762a4 100644 +index a803d1093dfa7c7421eda913679766224fda6dcf..3ade9a83f750854cd5663a6a177fe27eaac73c39 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -1,5 +1,6 @@ @@ -59,7 +59,7 @@ index ef779879e33c2f64c325afd3cd411032fb0d63f9..b85e21202eb8bb9446989aa1d6889eed import com.google.common.collect.Maps; import com.google.common.collect.Sets; import it.unimi.dsi.fastutil.longs.LongOpenHashSet; -@@ -612,10 +613,15 @@ public class Chunk implements IChunkAccess { +@@ -613,10 +614,15 @@ public class Chunk implements IChunkAccess { this.tileEntities.remove(blockposition); // Paper end } else { @@ -80,10 +80,10 @@ index ef779879e33c2f64c325afd3cd411032fb0d63f9..b85e21202eb8bb9446989aa1d6889eed } } diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 875f353dc3a0f3418b01821abf30e0f1ca32bb4d..fa4ad0b6dcd2cb428d87047340b81594b271e4b2 100644 +index 7dd9c5eec53631d25ae511b1e57bdadfe28ce289..7abd3683f9cc21b90dc74739954de2decddf6478 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -15,6 +15,9 @@ import java.util.function.BooleanSupplier; +@@ -17,6 +17,9 @@ import java.util.function.Consumer; import java.util.function.Function; import java.util.function.Supplier; import javax.annotation.Nullable; @@ -94,7 +94,7 @@ index 875f353dc3a0f3418b01821abf30e0f1ca32bb4d..fa4ad0b6dcd2cb428d87047340b81594 public class ChunkProviderServer extends IChunkProvider { diff --git a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java -index c9c2b0025159c8383998bfe374bcf995f75ed95f..1422503e11ac632c7b94640d59d9aaa0c5cb2f8f 100644 +index bf0ccfb9bf20422b90ef26370d113b49be7d730b..060887d765604e4be82913607bb6266a278f5db6 100644 --- a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java +++ b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java @@ -1,5 +1,6 @@ @@ -104,7 +104,7 @@ index c9c2b0025159c8383998bfe374bcf995f75ed95f..1422503e11ac632c7b94640d59d9aaa0 import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.io.Files; -@@ -354,6 +355,7 @@ public class NameReferencingFileConverter { +@@ -353,6 +354,7 @@ public class NameReferencingFileConverter { root = NBTCompressedStreamTools.a(new java.io.FileInputStream(file5)); } catch (Exception exception) { exception.printStackTrace(); @@ -112,7 +112,7 @@ index c9c2b0025159c8383998bfe374bcf995f75ed95f..1422503e11ac632c7b94640d59d9aaa0 } if (root != null) { -@@ -367,6 +369,7 @@ public class NameReferencingFileConverter { +@@ -366,6 +368,7 @@ public class NameReferencingFileConverter { NBTCompressedStreamTools.a(root, new java.io.FileOutputStream(file2)); } catch (Exception exception) { exception.printStackTrace(); @@ -121,18 +121,10 @@ index c9c2b0025159c8383998bfe374bcf995f75ed95f..1422503e11ac632c7b94640d59d9aaa0 } // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index eece2f689cce58a35d33c6e8d9d56ea4e9dfd88c..6374bf8785f7d99ab8750deba79867433d31eb5f 100644 +index 31d4faebcf34e2e207806d7945e1d8c50c5097bd..2b4033cb2b3d42b776afb9c219d2f64b6c6b1e79 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -728,6 +728,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - this.world.checkSession(); - } catch (ExceptionWorldConflict exceptionworldconflict) { - PlayerChunkMap.LOGGER.error("Couldn't save chunk; already in use by another instance of Minecraft?", exceptionworldconflict); -+ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(exceptionworldconflict); // Paper - return false; - } - -@@ -756,6 +757,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -761,6 +761,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { return true; } catch (Exception exception) { PlayerChunkMap.LOGGER.error("Failed to save chunk {},{}", chunkcoordintpair.x, chunkcoordintpair.z, exception); @@ -141,10 +133,10 @@ index eece2f689cce58a35d33c6e8d9d56ea4e9dfd88c..6374bf8785f7d99ab8750deba7986743 } } diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java -index 187c4e0f58b7de58dfd2194afb194cbed0a58957..c2312a227c60417c02fc028047e1e4562bbfccff 100644 +index 1ce85ab949213efb9eae6daddca6ac8fb15dd472..d2977022d163edc5518dd4737c30cffd3eff5954 100644 --- a/src/main/java/net/minecraft/server/RegionFile.java +++ b/src/main/java/net/minecraft/server/RegionFile.java -@@ -241,6 +241,7 @@ public class RegionFile implements AutoCloseable { +@@ -246,6 +246,7 @@ public class RegionFile implements AutoCloseable { return true; } } catch (IOException ioexception) { @@ -152,7 +144,7 @@ index 187c4e0f58b7de58dfd2194afb194cbed0a58957..c2312a227c60417c02fc028047e1e456 return false; } } -@@ -309,6 +310,7 @@ public class RegionFile implements AutoCloseable { +@@ -318,6 +319,7 @@ public class RegionFile implements AutoCloseable { filechannel.write(bytebuffer); } catch (Throwable throwable1) { throwable = throwable1; @@ -161,10 +153,10 @@ index 187c4e0f58b7de58dfd2194afb194cbed0a58957..c2312a227c60417c02fc028047e1e456 } finally { if (filechannel != null) { diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java -index 8ba344df6455307be88113e52d46b0d802f4443e..02157d051f3ecfc05f23ae8631cf01b6133ad159 100644 +index f27ffc56d548c09b7a1fced6d87623d493a21543..e08de74543535072e63ecfc9bd3ada95c9dbfeb7 100644 --- a/src/main/java/net/minecraft/server/SpawnerCreature.java +++ b/src/main/java/net/minecraft/server/SpawnerCreature.java -@@ -8,6 +8,7 @@ import org.apache.logging.log4j.LogManager; +@@ -14,6 +14,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; // CraftBukkit start @@ -172,16 +164,16 @@ index 8ba344df6455307be88113e52d46b0d802f4443e..02157d051f3ecfc05f23ae8631cf01b6 import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; // CraftBukkit end -@@ -86,6 +87,7 @@ public final class SpawnerCreature { - entityinsentient = (EntityInsentient) entity; - } catch (Exception exception) { - SpawnerCreature.LOGGER.warn("Failed to create mob", exception); -+ ServerInternalException.reportInternalException(exception); // Paper - return; - } - -@@ -214,6 +216,7 @@ public final class SpawnerCreature { - entity = biomebase_biomemeta.b.a(generatoraccess.getMinecraftWorld()); +@@ -268,6 +269,7 @@ public final class SpawnerCreature { + } + } catch (Exception exception) { + SpawnerCreature.LOGGER.warn("Failed to create mob", exception); ++ ServerInternalException.reportInternalException(exception); // Paper + return null; + } + } +@@ -373,6 +375,7 @@ public final class SpawnerCreature { + entity = biomebase_biomemeta.c.a(generatoraccess.getMinecraftWorld()); } catch (Exception exception) { SpawnerCreature.LOGGER.warn("Failed to create mob", exception); + ServerInternalException.reportInternalException(exception); // Paper @@ -189,7 +181,7 @@ index 8ba344df6455307be88113e52d46b0d802f4443e..02157d051f3ecfc05f23ae8631cf01b6 } diff --git a/src/main/java/net/minecraft/server/VillageSiege.java b/src/main/java/net/minecraft/server/VillageSiege.java -index d5e9bae7097460b44f9061198cf54b421bf2b3cf..1bcf01c09a9ba5168d491797e13eeddcf8961b75 100644 +index 045c16654e60f2312e9b6f7b0de2c9e921321201..b1081e441023f5d24091321b1267b5651adeb331 100644 --- a/src/main/java/net/minecraft/server/VillageSiege.java +++ b/src/main/java/net/minecraft/server/VillageSiege.java @@ -1,5 +1,7 @@ @@ -200,8 +192,8 @@ index d5e9bae7097460b44f9061198cf54b421bf2b3cf..1bcf01c09a9ba5168d491797e13eeddc import java.util.Iterator; import javax.annotation.Nullable; -@@ -100,6 +102,7 @@ public class VillageSiege { - entityzombie.prepare(worldserver, worldserver.getDamageScaler(new BlockPosition(entityzombie)), EnumMobSpawn.EVENT, (GroupDataEntity) null, (NBTTagCompound) null); +@@ -101,6 +103,7 @@ public class VillageSiege implements MobSpawner { + entityzombie.prepare(worldserver, worldserver.getDamageScaler(entityzombie.getChunkCoordinates()), EnumMobSpawn.EVENT, (GroupDataEntity) null, (NBTTagCompound) null); } catch (Exception exception) { exception.printStackTrace(); + ServerInternalException.reportInternalException(exception); // Paper @@ -209,20 +201,21 @@ index d5e9bae7097460b44f9061198cf54b421bf2b3cf..1bcf01c09a9ba5168d491797e13eeddc } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 9a9a7ae659dd1aea5111603852fbda9fad707be2..6e4329d21d7877e46369361e55954f2f9371bd6e 100644 +index a1e1dc72cd6a556505a6f0d7feee2527947c00dd..c01f0e897ab8741c7fd68245458acdb8559e843e 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -2,6 +2,9 @@ package net.minecraft.server; +@@ -1,5 +1,10 @@ + package net.minecraft.server; - import co.aikar.timings.Timing; - import co.aikar.timings.Timings; ++import co.aikar.timings.Timing; ++import co.aikar.timings.Timings; +import com.destroystokyo.paper.event.server.ServerExceptionEvent; +import com.destroystokyo.paper.exception.ServerInternalException; +import com.google.common.base.MoreObjects; import com.google.common.collect.Lists; + import com.mojang.serialization.Codec; import java.io.IOException; - import java.util.Collection; -@@ -665,8 +668,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -720,8 +725,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable { gameprofilerfiller.exit(); } catch (Throwable throwable) { // Paper start - Prevent tile entity and entity crashes @@ -235,7 +228,7 @@ index 9a9a7ae659dd1aea5111603852fbda9fad707be2..6e4329d21d7877e46369361e55954f2f tilesThisCycle--; this.tileEntityListTick.remove(tileTickPosition--); continue; -@@ -737,8 +743,10 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -792,8 +800,10 @@ public abstract class World implements GeneratorAccess, AutoCloseable { consumer.accept(entity); } catch (Throwable throwable) { // Paper start - Prevent tile entity and entity crashes @@ -260,7 +253,7 @@ index 19e68a78310de787bca701bc2597c64e34a77d7c..a2a25cf6a43a1f59a80c997e2980f2bb } finally { if (pushbackinputstream != null) { diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java -index de332758e03a563a9b72c134332db9e6a1c5ed2b..e68533176a0c07560118531600304fa76a1c3fc6 100644 +index ffe9cc1011226d604dc5499e7692e9a9a5132b72..343cdb06881fa8b0155b56d29c110bba489f9667 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java @@ -16,6 +16,9 @@ import java.util.concurrent.atomic.AtomicInteger; @@ -273,30 +266,16 @@ index de332758e03a563a9b72c134332db9e6a1c5ed2b..e68533176a0c07560118531600304fa7 import org.apache.commons.lang.Validate; import org.bukkit.plugin.IllegalPluginAccessException; import org.bukkit.plugin.Plugin; -@@ -406,20 +409,26 @@ 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, +@@ -419,6 +422,8 @@ public class CraftScheduler implements BukkitScheduler { + msg, throwable); + } + task.getOwner().getServer().getPluginManager().callEvent( -+ new ServerExceptionEvent(new ServerSchedulerException(msg, throwable, task)) -+ ); -+ // Paper end ++ new ServerExceptionEvent(new ServerSchedulerException(msg, throwable, task))); + // Paper end } finally { currentTask = null; - } +@@ -426,7 +431,7 @@ public class CraftScheduler implements BukkitScheduler { parsePending(); } else { debugTail = debugTail.setNext(new CraftAsyncDebugger(currentTick + RECENT_TICKS, task.getOwner(), task.getTaskClass())); diff --git a/Spigot-Server-Patches/0055-Don-t-nest-if-we-don-t-need-to-when-cerealising-text.patch b/Spigot-Server-Patches/0055-Don-t-nest-if-we-don-t-need-to-when-cerealising-text.patch index 6390cb250..77180fe30 100644 --- a/Spigot-Server-Patches/0055-Don-t-nest-if-we-don-t-need-to-when-cerealising-text.patch +++ b/Spigot-Server-Patches/0055-Don-t-nest-if-we-don-t-need-to-when-cerealising-text.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Don't nest if we don't need to when cerealising text diff --git a/src/main/java/net/minecraft/server/PacketPlayOutChat.java b/src/main/java/net/minecraft/server/PacketPlayOutChat.java -index fa4eab5b0b72595fb247b512d732bebe3a98a776..0ab611564edc3cd9322e0dbe21832510e9c35bbf 100644 +index 9ae419f9ad971ee5c743ee931426ab482b6184f1..6ae26f8c3637e0c9e56ed3e14aaac0e3f781cb43 100644 --- a/src/main/java/net/minecraft/server/PacketPlayOutChat.java +++ b/src/main/java/net/minecraft/server/PacketPlayOutChat.java @@ -29,7 +29,14 @@ public class PacketPlayOutChat implements Packet { diff --git a/Spigot-Server-Patches/0056-Disable-Scoreboards-for-non-players-by-default.patch b/Spigot-Server-Patches/0056-Disable-Scoreboards-for-non-players-by-default.patch index 631beb2a4..3e83fd946 100644 --- a/Spigot-Server-Patches/0056-Disable-Scoreboards-for-non-players-by-default.patch +++ b/Spigot-Server-Patches/0056-Disable-Scoreboards-for-non-players-by-default.patch @@ -25,10 +25,10 @@ index abbf59bb91021821876a8960e8f77fac24457ec4..04430aae52205ee167662004e45c145b + } } diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 65a421ee6f704af88ba2170930d17b46a9531c28..383805926e60f9f2f77e258e9d51ed079549713a 100644 +index 1a8fc714f6e4663fc02c1df6a67aaa37d48f743d..1903635fd3416965adbbba5af38ff29dac0c6670 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -2271,6 +2271,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -2201,6 +2201,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @Nullable public ScoreboardTeamBase getScoreboardTeam() { @@ -37,10 +37,10 @@ index 65a421ee6f704af88ba2170930d17b46a9531c28..383805926e60f9f2f77e258e9d51ed07 } diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index d4d60220efdf32ee84eef57a7155e7de513cf029..591bf14a6270a67e0bf705a90869c1223b9b36fd 100644 +index 8fc632b4b0d79efaced83ea9b39b5727f6f5ebef..d96f6736826896d2b7f482fba0c5125edf2ce3c0 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -535,6 +535,7 @@ public abstract class EntityLiving extends Entity { +@@ -641,6 +641,7 @@ public abstract class EntityLiving extends Entity { if (nbttagcompound.hasKeyOfType("Team", 8)) { String s = nbttagcompound.getString("Team"); ScoreboardTeam scoreboardteam = this.world.getScoreboard().getTeam(s); diff --git a/Spigot-Server-Patches/0057-Add-methods-for-working-with-arrows-stuck-in-living-.patch b/Spigot-Server-Patches/0057-Add-methods-for-working-with-arrows-stuck-in-living-.patch index 361126510..35b6db371 100644 --- a/Spigot-Server-Patches/0057-Add-methods-for-working-with-arrows-stuck-in-living-.patch +++ b/Spigot-Server-Patches/0057-Add-methods-for-working-with-arrows-stuck-in-living-.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add methods for working with arrows stuck in living entities diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 966d23add13a3139adead8f8969c0a4ff34929c6..da86ee41499b02959755328544307aed39752483 100644 +index 7e95ef170c418594f5469431c052e64107c08ab5..d5b165e8275c012d775b77b8440489716a6c3c08 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -623,4 +623,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -636,4 +636,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { public void setMemory(MemoryKey memoryKey, T t) { getHandle().getBehaviorController().setMemory(CraftMemoryKey.fromMemoryKey(memoryKey), CraftMemoryMapper.toNms(t)); } diff --git a/Spigot-Server-Patches/0058-Complete-resource-pack-API.patch b/Spigot-Server-Patches/0058-Complete-resource-pack-API.patch index 75a6bad4c..ce3f99220 100644 --- a/Spigot-Server-Patches/0058-Complete-resource-pack-API.patch +++ b/Spigot-Server-Patches/0058-Complete-resource-pack-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Complete resource pack API diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 2e24d5ba85d7938a9ffe2339fa22c19ee5362b5f..33482a85aa6c3600394684c83e03a4e84be7f1fa 100644 +index 8ecca907357119ed8eb67381914daba4ae6db38f..ffed0587323dbf522e478f43948bbb03c0af84a2 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1335,7 +1335,11 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -1381,7 +1381,11 @@ public class PlayerConnection implements PacketListenerPlayIn { // CraftBukkit start public void a(PacketPlayInResourcePackStatus packetplayinresourcepackstatus) { PlayerConnectionUtils.ensureMainThread(packetplayinresourcepackstatus, this, this.player.getWorldServer()); @@ -22,10 +22,10 @@ index 2e24d5ba85d7938a9ffe2339fa22c19ee5362b5f..33482a85aa6c3600394684c83e03a4e8 // CraftBukkit end diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index c6c8d24e3b4c24ec5a6c7dd33afa3ab86d388ca1..98c09d169a4ab7cf248b3306a92f45092bca04f8 100644 +index c90d3c8fe0965f437fe17979978f1189a27851ac..34a3e269c59d1797c764a2dc6c5ba9e646792084 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -132,6 +132,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -138,6 +138,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player { private double health = 20; private boolean scaledHealth = false; private double healthScale = 20; @@ -36,7 +36,7 @@ index c6c8d24e3b4c24ec5a6c7dd33afa3ab86d388ca1..98c09d169a4ab7cf248b3306a92f4509 public CraftPlayer(CraftServer server, EntityPlayer entity) { super(server, entity); -@@ -1729,6 +1733,32 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1794,6 +1798,32 @@ public class CraftPlayer extends CraftHumanEntity implements Player { public boolean getAffectsSpawning() { return this.getHandle().affectsSpawning; } diff --git a/Spigot-Server-Patches/0059-Chunk-Save-Reattempt.patch b/Spigot-Server-Patches/0059-Chunk-Save-Reattempt.patch index e4ae1be13..24e5c9f56 100644 --- a/Spigot-Server-Patches/0059-Chunk-Save-Reattempt.patch +++ b/Spigot-Server-Patches/0059-Chunk-Save-Reattempt.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Chunk Save Reattempt We commonly have "Stream Closed" errors on chunk saving, so this code should re-try to save the chunk in the event of failure and hopefully prevent rollbacks. diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java -index c2312a227c60417c02fc028047e1e4562bbfccff..cee1ea8f43e3135cd72a67c1c8067174feaf956e 100644 +index d2977022d163edc5518dd4737c30cffd3eff5954..26b55108ecf4cd48762b00da625b0ce1d2f42c67 100644 --- a/src/main/java/net/minecraft/server/RegionFile.java +++ b/src/main/java/net/minecraft/server/RegionFile.java -@@ -241,7 +241,7 @@ public class RegionFile implements AutoCloseable { +@@ -246,7 +246,7 @@ public class RegionFile implements AutoCloseable { return true; } } catch (IOException ioexception) { @@ -19,10 +19,10 @@ index c2312a227c60417c02fc028047e1e4562bbfccff..cee1ea8f43e3135cd72a67c1c8067174 } } diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java -index a164aee8805580069cc4b6daee7f2ad9137d34e0..fd46da95e0342c0004d82a36a164f3a18f9edac6 100644 +index 4d1de29e7c4bea266c544917fbe807a0b19462d6..4cff831de2128cd346f1f1627f0915d534b0d3bf 100644 --- a/src/main/java/net/minecraft/server/RegionFileCache.java +++ b/src/main/java/net/minecraft/server/RegionFileCache.java -@@ -85,6 +85,7 @@ public final class RegionFileCache implements AutoCloseable { +@@ -87,6 +87,7 @@ public final class RegionFileCache implements AutoCloseable { protected void write(ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) throws IOException { RegionFile regionfile = this.getFile(chunkcoordintpair, false); // CraftBukkit @@ -30,7 +30,7 @@ index a164aee8805580069cc4b6daee7f2ad9137d34e0..fd46da95e0342c0004d82a36a164f3a1 DataOutputStream dataoutputstream = regionfile.c(chunkcoordintpair); Throwable throwable = null; -@@ -108,6 +109,18 @@ public final class RegionFileCache implements AutoCloseable { +@@ -110,6 +111,18 @@ public final class RegionFileCache implements AutoCloseable { } diff --git a/Spigot-Server-Patches/0060-Default-loading-permissions.yml-before-plugins.patch b/Spigot-Server-Patches/0060-Default-loading-permissions.yml-before-plugins.patch index c70f3d90a..20942b4e3 100644 --- a/Spigot-Server-Patches/0060-Default-loading-permissions.yml-before-plugins.patch +++ b/Spigot-Server-Patches/0060-Default-loading-permissions.yml-before-plugins.patch @@ -16,10 +16,10 @@ modify that. Under the previous logic, plugins were unable (cleanly) override pe A config option has been added for those who depend on the previous behavior, but I don't expect that. diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index f402a29b0904a0094ffe6e42dbdc6fbc0912d9d9..6ef5bb9f323da7cbf8cb24d094bf43c4735549b0 100644 +index a62f4bbb973b9cb6d1ee53f56a0897d70ae176af..f207abbe757ad403a29a7a012903aaa88d5b1685 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -213,4 +213,9 @@ public class PaperConfig { +@@ -214,4 +214,9 @@ public class PaperConfig { " - Length: " + timeSummary(Timings.getHistoryLength() / 20) + " - Server Name: " + timingsServerName); } @@ -30,10 +30,10 @@ index f402a29b0904a0094ffe6e42dbdc6fbc0912d9d9..6ef5bb9f323da7cbf8cb24d094bf43c4 + } } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index d5311eb017fa093c3068e7ea0c24026822b9d638..8f6eb08a4fb74727259b864cad782bf1c5054bdd 100644 +index 3c95cbc18826912eb53205c6fb1387af90a5804c..aa74c838147d67c9cbfcff1f9b0dc653808fb109 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -370,6 +370,7 @@ public final class CraftServer implements Server { +@@ -399,6 +399,7 @@ public final class CraftServer implements Server { if (type == PluginLoadOrder.STARTUP) { helpMap.clear(); helpMap.initializeGeneralTopics(); @@ -41,7 +41,7 @@ index d5311eb017fa093c3068e7ea0c24026822b9d638..8f6eb08a4fb74727259b864cad782bf1 } Plugin[] plugins = pluginManager.getPlugins(); -@@ -389,7 +390,7 @@ public final class CraftServer implements Server { +@@ -418,7 +419,7 @@ public final class CraftServer implements Server { commandMap.registerServerAliases(); DefaultPermissions.registerCorePermissions(); CraftDefaultPermissions.registerCorePermissions(); diff --git a/Spigot-Server-Patches/0061-Allow-Reloading-of-Custom-Permissions.patch b/Spigot-Server-Patches/0061-Allow-Reloading-of-Custom-Permissions.patch index 234d830bc..2ff1c55e2 100644 --- a/Spigot-Server-Patches/0061-Allow-Reloading-of-Custom-Permissions.patch +++ b/Spigot-Server-Patches/0061-Allow-Reloading-of-Custom-Permissions.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Allow Reloading of Custom Permissions https://github.com/PaperMC/Paper/issues/49 diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 8f6eb08a4fb74727259b864cad782bf1c5054bdd..2ed74cd9fc48ce398e597dfc0bf333d085fe1437 100644 +index aa74c838147d67c9cbfcff1f9b0dc653808fb109..7c4ef70f540de9d5486d1ccef65ef8d82580694e 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2089,5 +2089,23 @@ public final class CraftServer implements Server { +@@ -2168,5 +2168,23 @@ public final class CraftServer implements Server { return null; } } diff --git a/Spigot-Server-Patches/0062-Remove-Metadata-on-reload.patch b/Spigot-Server-Patches/0062-Remove-Metadata-on-reload.patch index a29b0ebb6..438bdff91 100644 --- a/Spigot-Server-Patches/0062-Remove-Metadata-on-reload.patch +++ b/Spigot-Server-Patches/0062-Remove-Metadata-on-reload.patch @@ -7,10 +7,10 @@ Metadata is not meant to persist reload as things break badly with non primitive This will remove metadata on reload so it does not crash everything if a plugin uses it. diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 2ed74cd9fc48ce398e597dfc0bf333d085fe1437..ddb16ca8b69adc6d7e7efda7a7fb906234c19cb4 100644 +index 7c4ef70f540de9d5486d1ccef65ef8d82580694e..660f0362303df0fa990fa8f1507435666445c228 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -825,8 +825,18 @@ public final class CraftServer implements Server { +@@ -865,8 +865,18 @@ public final class CraftServer implements Server { world.paperConfig.init(); // Paper } diff --git a/Spigot-Server-Patches/0064-Handle-Item-Meta-Inconsistencies.patch b/Spigot-Server-Patches/0063-Handle-Item-Meta-Inconsistencies.patch similarity index 91% rename from Spigot-Server-Patches/0064-Handle-Item-Meta-Inconsistencies.patch rename to Spigot-Server-Patches/0063-Handle-Item-Meta-Inconsistencies.patch index d5bf43590..63db7ba56 100644 --- a/Spigot-Server-Patches/0064-Handle-Item-Meta-Inconsistencies.patch +++ b/Spigot-Server-Patches/0063-Handle-Item-Meta-Inconsistencies.patch @@ -18,21 +18,21 @@ For consistency, the old API methods now forward to use the ItemMeta API equivalents, and should deprecate the old API's. diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java -index aa7501d366b15e7f7f64b7d98a1dccff99f731d2..db11c8ec692aaf37fc68fd39b95fcadacf5eda38 100644 +index 76091ab3f149decc0d3c848b79edd24e20cf181d..a360711ea14983e8df34caa5edda80a015e6db23 100644 --- a/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java -@@ -7,6 +7,8 @@ import com.mojang.brigadier.StringReader; - import com.mojang.brigadier.exceptions.CommandSyntaxException; +@@ -9,6 +9,8 @@ import com.mojang.serialization.Codec; + import com.mojang.serialization.codecs.RecordCodecBuilder; import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; +import java.util.Collections; +import java.util.Comparator; import java.util.Locale; import java.util.Objects; - import java.util.Random; -@@ -67,6 +69,23 @@ public final class ItemStack { - return decimalformat; - } + import java.util.Optional; +@@ -66,6 +68,23 @@ public final class ItemStack { + private ShapeDetectorBlock n; + private boolean o; + // Paper start + private static final java.util.Comparator enchantSorter = java.util.Comparator.comparing(o -> o.getString("id")); @@ -54,15 +54,15 @@ index aa7501d366b15e7f7f64b7d98a1dccff99f731d2..db11c8ec692aaf37fc68fd39b95fcada public ItemStack(IMaterial imaterial) { this(imaterial, 1); } -@@ -104,6 +123,7 @@ public final class ItemStack { +@@ -108,6 +127,7 @@ public final class ItemStack { if (nbttagcompound.hasKeyOfType("tag", 10)) { // CraftBukkit start - make defensive copy as this data may be coming from the save thread this.tag = (NBTTagCompound) nbttagcompound.getCompound("tag").clone(); + processEnchantOrder(this.tag); // Paper - this.getItem().a(this.tag); + this.getItem().b(this.tag); // CraftBukkit end } -@@ -615,6 +635,7 @@ public final class ItemStack { +@@ -626,6 +646,7 @@ public final class ItemStack { // Paper end public void setTag(@Nullable NBTTagCompound nbttagcompound) { this.tag = nbttagcompound; @@ -70,7 +70,7 @@ index aa7501d366b15e7f7f64b7d98a1dccff99f731d2..db11c8ec692aaf37fc68fd39b95fcada if (this.getItem().usesDurability()) { this.setDamage(this.getDamage()); } -@@ -699,6 +720,7 @@ public final class ItemStack { +@@ -710,6 +731,7 @@ public final class ItemStack { nbttagcompound.setString("id", String.valueOf(IRegistry.ENCHANTMENT.getKey(enchantment))); nbttagcompound.setShort("lvl", (short) ((byte) i)); nbttaglist.add(nbttagcompound); @@ -79,7 +79,7 @@ index aa7501d366b15e7f7f64b7d98a1dccff99f731d2..db11c8ec692aaf37fc68fd39b95fcada public boolean hasEnchantments() { diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java -index 4a9132c7016b076ab35b5d66ce81bbd247e1a3ce..3dd912abe3fec22adb29d8edfd66b9f5f3bee4f6 100644 +index 721a1c6bd4505cb132e7004c45b795d4959389e3..9913d0136841dac35b6649cb1afbe1e93b36bf4c 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java @@ -178,28 +178,11 @@ public final class CraftItemStack extends ItemStack { @@ -194,7 +194,7 @@ index 4a9132c7016b076ab35b5d66ce81bbd247e1a3ce..3dd912abe3fec22adb29d8edfd66b9f5 static Map getEnchantments(net.minecraft.server.ItemStack item) { diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index cea4c7809758c6e271079546652635929985d143..b9435bbd51764f75b8d24171513f3dddc48906f8 100644 +index be74b465dd94a79fdfc8fdc236b4fc7b59424499..be39fbc1433e03e2f0e562095fea590691d7a062 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java @@ -6,6 +6,7 @@ import com.google.common.collect.ImmutableList; @@ -221,7 +221,7 @@ index cea4c7809758c6e271079546652635929985d143..b9435bbd51764f75b8d24171513f3ddd import java.util.logging.Level; import java.util.logging.Logger; import javax.annotation.Nonnull; -@@ -270,7 +273,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -271,7 +274,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { private List lore; private Integer customModelData; private NBTTagCompound blockData; @@ -230,7 +230,7 @@ index cea4c7809758c6e271079546652635929985d143..b9435bbd51764f75b8d24171513f3ddd private Multimap attributeModifiers; private int repairCost; private int hideFlag; -@@ -281,7 +284,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -282,7 +285,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry(); private NBTTagCompound internalTag; @@ -239,7 +239,7 @@ index cea4c7809758c6e271079546652635929985d143..b9435bbd51764f75b8d24171513f3ddd private CraftPersistentDataContainer persistentDataContainer = new CraftPersistentDataContainer(DATA_TYPE_REGISTRY); private int version = CraftMagicNumbers.INSTANCE.getDataVersion(); // Internal use only -@@ -302,7 +305,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -303,7 +306,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { this.blockData = meta.blockData; if (meta.enchantments != null) { // Spigot @@ -248,7 +248,7 @@ index cea4c7809758c6e271079546652635929985d143..b9435bbd51764f75b8d24171513f3ddd } if (meta.hasAttributeModifiers()) { -@@ -398,13 +401,13 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -399,13 +402,13 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { } } @@ -264,7 +264,7 @@ index cea4c7809758c6e271079546652635929985d143..b9435bbd51764f75b8d24171513f3ddd for (int i = 0; i < ench.size(); i++) { String id = ((NBTTagCompound) ench.get(i)).getString(ENCHANTMENTS_ID.NBT); -@@ -556,13 +559,13 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -557,13 +560,13 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { } } @@ -280,7 +280,7 @@ index cea4c7809758c6e271079546652635929985d143..b9435bbd51764f75b8d24171513f3ddd for (Map.Entry entry : ench.entrySet()) { // Doctor older enchants String enchantKey = entry.getKey().toString(); -@@ -814,14 +817,14 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -815,14 +818,14 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @Override public Map getEnchants() { @@ -297,7 +297,7 @@ index cea4c7809758c6e271079546652635929985d143..b9435bbd51764f75b8d24171513f3ddd } if (ignoreRestrictions || level >= ench.getStartLevel() && level <= ench.getMaxLevel()) { -@@ -1202,7 +1205,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1203,7 +1206,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { clone.customModelData = this.customModelData; clone.blockData = this.blockData; if (this.enchantments != null) { @@ -306,7 +306,7 @@ index cea4c7809758c6e271079546652635929985d143..b9435bbd51764f75b8d24171513f3ddd } if (this.hasAttributeModifiers()) { clone.attributeModifiers = LinkedHashMultimap.create(this.attributeModifiers); -@@ -1431,4 +1434,22 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1435,4 +1438,22 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { return HANDLED_TAGS; } } diff --git a/Spigot-Server-Patches/0063-Undead-horse-leashing.patch b/Spigot-Server-Patches/0063-Undead-horse-leashing.patch deleted file mode 100644 index 4c360f169..000000000 --- a/Spigot-Server-Patches/0063-Undead-horse-leashing.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Fri, 18 Mar 2016 14:19:19 -0400 -Subject: [PATCH] Undead horse leashing - -default false to match vanilla, but option to allow undead horse types to be leashed. - -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 04430aae52205ee167662004e45c145b9d2e8bed..dd21221534542d0265fa7d2178ab69c236579cf7 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -208,4 +208,9 @@ public class PaperWorldConfig { - private void nonPlayerEntitiesOnScoreboards() { - nonPlayerEntitiesOnScoreboards = getBoolean("allow-non-player-entities-on-scoreboards", false); - } -+ -+ public boolean allowLeashingUndeadHorse = false; -+ private void allowLeashingUndeadHorse() { -+ allowLeashingUndeadHorse = getBoolean("allow-leashing-undead-horse", false); -+ } - } -diff --git a/src/main/java/net/minecraft/server/EntityHorseAbstract.java b/src/main/java/net/minecraft/server/EntityHorseAbstract.java -index b611ade24817a7d6a740bf5366816b6694d79713..c56efe035ac87e5ef49ad39d82499c7348ee8d2f 100644 ---- a/src/main/java/net/minecraft/server/EntityHorseAbstract.java -+++ b/src/main/java/net/minecraft/server/EntityHorseAbstract.java -@@ -107,7 +107,7 @@ public abstract class EntityHorseAbstract extends EntityAnimal implements IInven - - @Override - public boolean a(EntityHuman entityhuman) { -- return super.a(entityhuman) && this.getMonsterType() != EnumMonsterType.UNDEAD; -+ return world.paperConfig.allowLeashingUndeadHorse ? super.a(entityhuman) : super.a(entityhuman) && this.getMonsterType() != EnumMonsterType.UNDEAD; // Paper - } - - @Override diff --git a/Spigot-Server-Patches/0065-Configurable-Non-Player-Arrow-Despawn-Rate.patch b/Spigot-Server-Patches/0064-Configurable-Non-Player-Arrow-Despawn-Rate.patch similarity index 80% rename from Spigot-Server-Patches/0065-Configurable-Non-Player-Arrow-Despawn-Rate.patch rename to Spigot-Server-Patches/0064-Configurable-Non-Player-Arrow-Despawn-Rate.patch index a0208ed0c..4af143465 100644 --- a/Spigot-Server-Patches/0065-Configurable-Non-Player-Arrow-Despawn-Rate.patch +++ b/Spigot-Server-Patches/0064-Configurable-Non-Player-Arrow-Despawn-Rate.patch @@ -6,12 +6,12 @@ Subject: [PATCH] Configurable Non Player Arrow Despawn Rate Can set a much shorter despawn rate for arrows that players can not pick up. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index dd21221534542d0265fa7d2178ab69c236579cf7..7de7b74ff69bba1cbad24623d7eeff6c79812bab 100644 +index 04430aae52205ee167662004e45c145b9d2e8bed..d8b9d87bca6eb95c2cea91e4d8466b9792582d52 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -213,4 +213,19 @@ public class PaperWorldConfig { - private void allowLeashingUndeadHorse() { - allowLeashingUndeadHorse = getBoolean("allow-leashing-undead-horse", false); +@@ -208,4 +208,19 @@ public class PaperWorldConfig { + private void nonPlayerEntitiesOnScoreboards() { + nonPlayerEntitiesOnScoreboards = getBoolean("allow-non-player-entities-on-scoreboards", false); } + + public int nonPlayerArrowDespawnRate = -1; @@ -30,12 +30,12 @@ index dd21221534542d0265fa7d2178ab69c236579cf7..7de7b74ff69bba1cbad24623d7eeff6c + } } diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java -index a9f843aade2a9a5e7004632c72e5bb1b46d9ad65..2b14b2c3fa21e67ebd8f344a6ee066d67bf53044 100644 +index b0930e054ea99f921fc71db9f9342b1a64f3df43..44e23fa452c5f39ad7ff678064f5474813f7cea8 100644 --- a/src/main/java/net/minecraft/server/EntityArrow.java +++ b/src/main/java/net/minecraft/server/EntityArrow.java -@@ -266,7 +266,7 @@ public abstract class EntityArrow extends Entity implements IProjectile { +@@ -245,7 +245,7 @@ public abstract class EntityArrow extends IProjectile { - protected void i() { + protected void h() { ++this.despawnCounter; - if (this.despawnCounter >= ((this instanceof EntityThrownTrident) ? world.spigotConfig.tridentDespawnRate : world.spigotConfig.arrowDespawnRate)) { // Spigot + if (this.despawnCounter >= (fromPlayer == PickupStatus.CREATIVE_ONLY ? world.paperConfig.creativeArrowDespawnRate : (fromPlayer == PickupStatus.DISALLOWED ? world.paperConfig.nonPlayerArrowDespawnRate : ((this instanceof EntityThrownTrident) ? world.spigotConfig.tridentDespawnRate : world.spigotConfig.arrowDespawnRate)))) { // Spigot // Paper - TODO: Extract this to init? diff --git a/Spigot-Server-Patches/0065-Add-World-Util-Methods.patch b/Spigot-Server-Patches/0065-Add-World-Util-Methods.patch new file mode 100644 index 000000000..ed8f0c05d --- /dev/null +++ b/Spigot-Server-Patches/0065-Add-World-Util-Methods.patch @@ -0,0 +1,59 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Fri, 18 Mar 2016 20:16:03 -0400 +Subject: [PATCH] Add World Util Methods + +Methods that can be used for other patches to help improve logic. + +diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java +index c01f0e897ab8741c7fd68245458acdb8559e843e..ee1f5c1e1bc9440a743a361bf3aaa991dddbc9cd 100644 +--- a/src/main/java/net/minecraft/server/World.java ++++ b/src/main/java/net/minecraft/server/World.java +@@ -285,6 +285,22 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + + return chunk == null ? null : chunk.getFluid(blockposition); + } ++ ++ public boolean isLoadedAndInBounds(BlockPosition blockposition) { ++ return getWorldBorder().isInBounds(blockposition) && getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4) != null; ++ } ++ ++ public Chunk getChunkIfLoaded(int x, int z) { ++ return ((WorldServer) this).getChunkProvider().getChunkAtIfLoadedImmediately(x, z); ++ } ++ public final Chunk getChunkIfLoaded(BlockPosition blockposition) { ++ return ((WorldServer) this).getChunkProvider().getChunkAtIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4); ++ } ++ ++ // reduces need to do isLoaded before getType ++ public IBlockData getTypeIfLoadedAndInBounds(BlockPosition blockposition) { ++ return getWorldBorder().isInBounds(blockposition) ? getTypeIfLoaded(blockposition) : null; ++ } + // Paper end + + @Override +diff --git a/src/main/java/net/minecraft/server/WorldBorder.java b/src/main/java/net/minecraft/server/WorldBorder.java +index d039e715624d33fc3ec9e87d5ad992415e7dc6b9..d5c0d394feaf8bb991245dbdcc6252cf45eac13d 100644 +--- a/src/main/java/net/minecraft/server/WorldBorder.java ++++ b/src/main/java/net/minecraft/server/WorldBorder.java +@@ -21,6 +21,7 @@ public class WorldBorder { + + public WorldBorder() {} + ++ public final boolean isInBounds(BlockPosition blockposition) { return this.a(blockposition); } // Paper - OBFHELPER + public boolean a(BlockPosition blockposition) { + return (double) (blockposition.getX() + 1) > this.e() && (double) blockposition.getX() < this.g() && (double) (blockposition.getZ() + 1) > this.f() && (double) blockposition.getZ() < this.h(); + } +diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java +index 223482e468862407d53299219e2f4debecd0cd87..f38c88df648aa715aefb18018779efd8075d781e 100644 +--- a/src/main/java/net/minecraft/server/WorldServer.java ++++ b/src/main/java/net/minecraft/server/WorldServer.java +@@ -83,7 +83,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { + public final Convertable.ConversionSession convertable; + public final UUID uuid; + +- public Chunk getChunkIfLoaded(int x, int z) { ++ @Override public Chunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI + return this.chunkProvider.getChunkAt(x, z, false); + } + diff --git a/Spigot-Server-Patches/0066-Add-World-Util-Methods.patch b/Spigot-Server-Patches/0066-Add-World-Util-Methods.patch deleted file mode 100644 index 1114a1ed8..000000000 --- a/Spigot-Server-Patches/0066-Add-World-Util-Methods.patch +++ /dev/null @@ -1,42 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Fri, 18 Mar 2016 20:16:03 -0400 -Subject: [PATCH] Add World Util Methods - -Methods that can be used for other patches to help improve logic. - -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 6e7d3573ed6f58a9c5f29c8b1b49746f13e21dc7..a721ad8addfd5a47608e304b372762d3ca89fa65 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -223,6 +223,18 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - - return chunk == null ? null : chunk.getFluid(blockposition); - } -+ -+ public boolean isLoadedAndInBounds(BlockPosition blockposition) { -+ return getWorldBorder().isInBounds(blockposition) && getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4) != null; -+ } -+ public Chunk getChunkIfLoaded(BlockPosition blockposition) { -+ return getChunkIfLoaded(blockposition.getX() >> 4, blockposition.getZ() >> 4); -+ } -+ -+ // reduces need to do isLoaded before getType -+ public IBlockData getTypeIfLoadedAndInBounds(BlockPosition blockposition) { -+ return getWorldBorder().isInBounds(blockposition) ? getTypeIfLoaded(blockposition) : null; -+ } - // Paper end - - @Override -diff --git a/src/main/java/net/minecraft/server/WorldBorder.java b/src/main/java/net/minecraft/server/WorldBorder.java -index 3db276f176301ebf15d5a2ba44d0edb5c7ec6097..73730fe25c84a867b8d95525c9d76d60a5797396 100644 ---- a/src/main/java/net/minecraft/server/WorldBorder.java -+++ b/src/main/java/net/minecraft/server/WorldBorder.java -@@ -19,6 +19,7 @@ public class WorldBorder { - - public WorldBorder() {} - -+ public final boolean isInBounds(BlockPosition blockposition) { return this.a(blockposition); } // Paper - OBFHELPER - public boolean a(BlockPosition blockposition) { - return (double) (blockposition.getX() + 1) > this.c() && (double) blockposition.getX() < this.e() && (double) (blockposition.getZ() + 1) > this.d() && (double) blockposition.getZ() < this.f(); - } diff --git a/Spigot-Server-Patches/0067-Custom-replacement-for-eaten-items.patch b/Spigot-Server-Patches/0066-Custom-replacement-for-eaten-items.patch similarity index 89% rename from Spigot-Server-Patches/0067-Custom-replacement-for-eaten-items.patch rename to Spigot-Server-Patches/0066-Custom-replacement-for-eaten-items.patch index 15692f8ef..541513885 100644 --- a/Spigot-Server-Patches/0067-Custom-replacement-for-eaten-items.patch +++ b/Spigot-Server-Patches/0066-Custom-replacement-for-eaten-items.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Custom replacement for eaten items diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index e763bf1a6486134fe222865d207359c8b868c008..e8e14ac6c6fcf5375976dfbe9ed97ad4619bfbee 100644 +index d96f6736826896d2b7f482fba0c5125edf2ce3c0..f1080e7d10d5105e3f4010489393f6150c7c4a75 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -2900,9 +2900,10 @@ public abstract class EntityLiving extends Entity { +@@ -3069,9 +3069,10 @@ public abstract class EntityLiving extends Entity { this.b(this.activeItem, 16); // CraftBukkit start - fire PlayerItemConsumeEvent ItemStack itemstack; @@ -20,7 +20,7 @@ index e763bf1a6486134fe222865d207359c8b868c008..e8e14ac6c6fcf5375976dfbe9ed97ad4 world.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { -@@ -2917,9 +2918,20 @@ public abstract class EntityLiving extends Entity { +@@ -3086,9 +3087,20 @@ public abstract class EntityLiving extends Entity { itemstack = this.activeItem.a(this.world, this); } @@ -32,7 +32,7 @@ index e763bf1a6486134fe222865d207359c8b868c008..e8e14ac6c6fcf5375976dfbe9ed97ad4 + // Paper end this.a(this.getRaisedHand(), itemstack); // CraftBukkit end - this.dH(); + this.clearActiveItem(); + // Paper start - if the replacement is anything but the default, update the client inventory + if (this instanceof EntityPlayer && !com.google.common.base.Objects.equal(defaultReplacement, itemstack)) { + ((EntityPlayer) this).getBukkitEntity().updateInventory(); diff --git a/Spigot-Server-Patches/0068-handle-NaN-health-absorb-values-and-repair-bad-data.patch b/Spigot-Server-Patches/0067-handle-NaN-health-absorb-values-and-repair-bad-data.patch similarity index 77% rename from Spigot-Server-Patches/0068-handle-NaN-health-absorb-values-and-repair-bad-data.patch rename to Spigot-Server-Patches/0067-handle-NaN-health-absorb-values-and-repair-bad-data.patch index 69a2fc25f..d93286a40 100644 --- a/Spigot-Server-Patches/0068-handle-NaN-health-absorb-values-and-repair-bad-data.patch +++ b/Spigot-Server-Patches/0067-handle-NaN-health-absorb-values-and-repair-bad-data.patch @@ -5,13 +5,13 @@ Subject: [PATCH] handle NaN health/absorb values and repair bad data diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index e8e14ac6c6fcf5375976dfbe9ed97ad4619bfbee..d6ef12f1d65e8ab8b1c41bcf06f022f3193df15f 100644 +index f1080e7d10d5105e3f4010489393f6150c7c4a75..374e4a3dcb656d6a84e05bb9260d3198a4243c05 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -496,7 +496,13 @@ public abstract class EntityLiving extends Entity { +@@ -602,7 +602,13 @@ public abstract class EntityLiving extends Entity { @Override - public void a(NBTTagCompound nbttagcompound) { + public void loadData(NBTTagCompound nbttagcompound) { - this.setAbsorptionHearts(nbttagcompound.getFloat("AbsorptionAmount")); + // Paper start - jvm keeps optimizing the setter + float absorptionAmount = nbttagcompound.getFloat("AbsorptionAmount"); @@ -21,9 +21,9 @@ index e8e14ac6c6fcf5375976dfbe9ed97ad4619bfbee..d6ef12f1d65e8ab8b1c41bcf06f022f3 + this.setAbsorptionHearts(absorptionAmount); + // Paper end if (nbttagcompound.hasKeyOfType("Attributes", 9) && this.world != null && !this.world.isClientSide) { - GenericAttributes.a(this.getAttributeMap(), nbttagcompound.getList("Attributes", 10)); + this.getAttributeMap().a(nbttagcompound.getList("Attributes", 10)); } -@@ -945,6 +951,10 @@ public abstract class EntityLiving extends Entity { +@@ -1051,6 +1057,10 @@ public abstract class EntityLiving extends Entity { } public void setHealth(float f) { @@ -34,7 +34,7 @@ index e8e14ac6c6fcf5375976dfbe9ed97ad4619bfbee..d6ef12f1d65e8ab8b1c41bcf06f022f3 // CraftBukkit start - Handle scaled health if (this instanceof EntityPlayer) { org.bukkit.craftbukkit.entity.CraftPlayer player = ((EntityPlayer) this).getBukkitEntity(); -@@ -2743,7 +2753,7 @@ public abstract class EntityLiving extends Entity { +@@ -2911,7 +2921,7 @@ public abstract class EntityLiving extends Entity { } public void setAbsorptionHearts(float f) { @@ -44,10 +44,10 @@ index e8e14ac6c6fcf5375976dfbe9ed97ad4619bfbee..d6ef12f1d65e8ab8b1c41bcf06f022f3 } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 98c09d169a4ab7cf248b3306a92f45092bca04f8..b2e6eeb60db96cab7b95048d9773c3e3f6da10dc 100644 +index 34a3e269c59d1797c764a2dc6c5ba9e646792084..2e8105fe1d0f5f953ac8ba94df3e8eb66b7813d7 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1548,6 +1548,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1611,6 +1611,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } public void setRealHealth(double health) { diff --git a/Spigot-Server-Patches/0069-Waving-banner-workaround.patch b/Spigot-Server-Patches/0068-Waving-banner-workaround.patch similarity index 100% rename from Spigot-Server-Patches/0069-Waving-banner-workaround.patch rename to Spigot-Server-Patches/0068-Waving-banner-workaround.patch diff --git a/Spigot-Server-Patches/0070-Use-a-Shared-Random-for-Entities.patch b/Spigot-Server-Patches/0069-Use-a-Shared-Random-for-Entities.patch similarity index 87% rename from Spigot-Server-Patches/0070-Use-a-Shared-Random-for-Entities.patch rename to Spigot-Server-Patches/0069-Use-a-Shared-Random-for-Entities.patch index 9b37704a0..690ca1f25 100644 --- a/Spigot-Server-Patches/0070-Use-a-Shared-Random-for-Entities.patch +++ b/Spigot-Server-Patches/0069-Use-a-Shared-Random-for-Entities.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Use a Shared Random for Entities Reduces memory usage and provides ensures more randomness, Especially since a lot of garbage entity objects get created. diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 383805926e60f9f2f77e258e9d51ed079549713a..d6fc93b5923096d3f092f561cbefdf26f2bbfb15 100644 +index 1903635fd3416965adbbba5af38ff29dac0c6670..b5625318ca6bfeeada2d3fb009b711685265ebaa 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -58,6 +58,21 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -32,11 +32,11 @@ index 383805926e60f9f2f77e258e9d51ed079549713a..d6fc93b5923096d3f092f561cbefdf26 public CraftEntity getBukkitEntity() { @@ -192,7 +207,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - this.y = Vec3D.a; - this.av = 1.0F; - this.aw = 1.0F; + this.x = Vec3D.a; + this.at = 1.0F; + this.au = 1.0F; - this.random = new Random(); + this.random = SHARED_RANDOM; // Paper this.fireTicks = -this.getMaxFireTicks(); + this.M = new Object2DoubleArrayMap(2); this.justCreated = true; - this.uniqueID = MathHelper.a(this.random); diff --git a/Spigot-Server-Patches/0071-Configurable-spawn-chances-for-skeleton-horses.patch b/Spigot-Server-Patches/0070-Configurable-spawn-chances-for-skeleton-horses.patch similarity index 85% rename from Spigot-Server-Patches/0071-Configurable-spawn-chances-for-skeleton-horses.patch rename to Spigot-Server-Patches/0070-Configurable-spawn-chances-for-skeleton-horses.patch index 966656b18..8e413d7e4 100644 --- a/Spigot-Server-Patches/0071-Configurable-spawn-chances-for-skeleton-horses.patch +++ b/Spigot-Server-Patches/0070-Configurable-spawn-chances-for-skeleton-horses.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Configurable spawn chances for skeleton horses diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 7de7b74ff69bba1cbad24623d7eeff6c79812bab..6ef0e1399e9ff260712db1a044068c125b1316d3 100644 +index d8b9d87bca6eb95c2cea91e4d8466b9792582d52..92d1dffbf436a21943b4a6aa0fabf54f064e6046 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -228,4 +228,12 @@ public class PaperWorldConfig { +@@ -223,4 +223,12 @@ public class PaperWorldConfig { log("Non Player Arrow Despawn Rate: " + nonPlayerArrowDespawnRate); log("Creative Arrow Despawn Rate: " + creativeArrowDespawnRate); } @@ -22,10 +22,10 @@ index 7de7b74ff69bba1cbad24623d7eeff6c79812bab..6ef0e1399e9ff260712db1a044068c12 + } } diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index d744daeb7c678d9f073d848be50a0f6eee721f0e..4b355ecbdaa8471225eb979270f2abc086e27e18 100644 +index f38c88df648aa715aefb18018779efd8075d781e..5e64aca8c318f2fd909cd0e934867e890a152373 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -449,7 +449,7 @@ public class WorldServer extends World { +@@ -475,7 +475,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { blockposition = this.a(this.a(j, 0, k, 15)); if (this.isRainingAt(blockposition)) { DifficultyDamageScaler difficultydamagescaler = this.getDamageScaler(blockposition); diff --git a/Spigot-Server-Patches/0072-Optimize-isValidLocation-getType-and-getBlockData-fo.patch b/Spigot-Server-Patches/0071-Optimize-isValidLocation-getType-and-getBlockData-fo.patch similarity index 82% rename from Spigot-Server-Patches/0072-Optimize-isValidLocation-getType-and-getBlockData-fo.patch rename to Spigot-Server-Patches/0071-Optimize-isValidLocation-getType-and-getBlockData-fo.patch index 118ea94f0..e371673a9 100644 --- a/Spigot-Server-Patches/0072-Optimize-isValidLocation-getType-and-getBlockData-fo.patch +++ b/Spigot-Server-Patches/0071-Optimize-isValidLocation-getType-and-getBlockData-fo.patch @@ -13,29 +13,30 @@ Replace all calls to the new place to the unnecessary forward. Optimize getType and getBlockData to manually inline and optimize the calls diff --git a/src/main/java/net/minecraft/server/BaseBlockPosition.java b/src/main/java/net/minecraft/server/BaseBlockPosition.java -index 3f09c24e1cd1bba2809b70b1fa6e89773537d834..7b05bb9edcd059a134cef12cc9fea570217bc601 100644 +index ee28d0335418a0053f8448ab5e12ebba5a9a3b2d..8b202b342f899a38b989b683bd8be4f5c4061f48 100644 --- a/src/main/java/net/minecraft/server/BaseBlockPosition.java +++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java -@@ -13,6 +13,14 @@ public class BaseBlockPosition implements Comparable { - private final int b; - @Deprecated - private final int c; +@@ -20,6 +20,15 @@ public class BaseBlockPosition implements Comparable { + private int b; + private int e; + + // Paper start + public boolean isValidLocation() { -+ return a >= -30000000 && c >= -30000000 && a < 30000000 && c < 30000000 && b >= 0 && b < 256; ++ return getX() >= -30000000 && getZ() >= -30000000 && getX() < 30000000 && getZ() < 30000000 && getY() >= 0 && getY() < 256; + } + public boolean isInvalidYLocation() { + return b < 0 || b >= 256; + } + // Paper end - ++ public BaseBlockPosition(int i, int j, int k) { this.a = i; + this.b = j; diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index b85e21202eb8bb9446989aa1d6889eed784762a4..671bcc763c78114f38d2b9b0320d7b168a756e21 100644 +index 3ade9a83f750854cd5663a6a177fe27eaac73c39..dc65ad095f9ec281c13f04254311d9cea80f43f8 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -307,12 +307,27 @@ public class Chunk implements IChunkAccess { +@@ -308,12 +308,27 @@ public class Chunk implements IChunkAccess { return this.sections; } @@ -64,7 +65,7 @@ index b85e21202eb8bb9446989aa1d6889eed784762a4..671bcc763c78114f38d2b9b0320d7b16 + public IBlockData getBlockData_unused(int i, int j, int k) { + // Paper end - if (this.world.P() == WorldType.DEBUG_ALL_BLOCK_STATES) { + if (this.world.isDebugWorld()) { IBlockData iblockdata = null; diff --git a/src/main/java/net/minecraft/server/ChunkEmpty.java b/src/main/java/net/minecraft/server/ChunkEmpty.java @@ -93,10 +94,10 @@ index 82fdd3db6f698f8b77c8bbd1f17cb21980ecfeec..fd49438961451987bd102a85484be24b public IBlockData getType(BlockPosition blockposition) { return Blocks.VOID_AIR.getBlockData(); diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java -index 638b0e39798a3f75566fcf9ea48b81024e60b471..e72d1386feb59e4a4c27466da96ffd29222bea18 100644 +index 882c2733beaff1df68b892d44fc77cacf4364ff4..bd2290a4d4ec314b7afdb1f63d711f80803153cd 100644 --- a/src/main/java/net/minecraft/server/ChunkSection.java +++ b/src/main/java/net/minecraft/server/ChunkSection.java -@@ -6,10 +6,10 @@ public class ChunkSection { +@@ -7,10 +7,10 @@ public class ChunkSection { public static final DataPalette GLOBAL_PALETTE = new DataPaletteGlobal<>(Block.REGISTRY_ID, Blocks.AIR.getBlockData()); private final int yPos; @@ -109,8 +110,8 @@ index 638b0e39798a3f75566fcf9ea48b81024e60b471..e72d1386feb59e4a4c27466da96ffd29 public ChunkSection(int i) { this(i, (short) 0, (short) 0, (short) 0); -@@ -23,8 +23,8 @@ public class ChunkSection { - this.blockIds = new DataPaletteBlock<>(ChunkSection.GLOBAL_PALETTE, Block.REGISTRY_ID, GameProfileSerializer::d, GameProfileSerializer::a, Blocks.AIR.getBlockData()); +@@ -24,8 +24,8 @@ public class ChunkSection { + this.blockIds = new DataPaletteBlock<>(ChunkSection.GLOBAL_PALETTE, Block.REGISTRY_ID, GameProfileSerializer::c, GameProfileSerializer::a, Blocks.AIR.getBlockData()); } - public IBlockData getType(int i, int j, int k) { @@ -121,10 +122,10 @@ index 638b0e39798a3f75566fcf9ea48b81024e60b471..e72d1386feb59e4a4c27466da96ffd29 public Fluid b(int i, int j, int k) { diff --git a/src/main/java/net/minecraft/server/DataPaletteBlock.java b/src/main/java/net/minecraft/server/DataPaletteBlock.java -index d5f5a51872dfabdbb828b6c20d61893aed2efec7..3586fe065f21fbf1e71b602c372a690ef603f377 100644 +index 4c6979903d287f7f37d9029f6ce2551742f26164..bcf249aab7d8223f6d9b597fcb20c1aa523ab862 100644 --- a/src/main/java/net/minecraft/server/DataPaletteBlock.java +++ b/src/main/java/net/minecraft/server/DataPaletteBlock.java -@@ -125,7 +125,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { +@@ -124,7 +124,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { } public T a(int i, int j, int k) { @@ -134,10 +135,10 @@ index d5f5a51872dfabdbb828b6c20d61893aed2efec7..3586fe065f21fbf1e71b602c372a690e protected T a(int i) { diff --git a/src/main/java/net/minecraft/server/IChunkAccess.java b/src/main/java/net/minecraft/server/IChunkAccess.java -index 6f25c37658e8e4b31fec2d9e8b69616f073e0b30..2de4796946e79c5fc7a36a1e26cbcad7bca6e12a 100644 +index 91efe3e9d8da340b383847bc1ba29d26b7971cd2..3adb35b6abd0df9617e27e10fa3e0d365958ba42 100644 --- a/src/main/java/net/minecraft/server/IChunkAccess.java +++ b/src/main/java/net/minecraft/server/IChunkAccess.java -@@ -13,6 +13,7 @@ import org.apache.logging.log4j.LogManager; +@@ -12,6 +12,7 @@ import org.apache.logging.log4j.LogManager; public interface IChunkAccess extends IBlockAccess, IStructureAccess { @@ -146,10 +147,10 @@ index 6f25c37658e8e4b31fec2d9e8b69616f073e0b30..2de4796946e79c5fc7a36a1e26cbcad7 IBlockData setType(BlockPosition blockposition, IBlockData iblockdata, boolean flag); diff --git a/src/main/java/net/minecraft/server/ProtoChunk.java b/src/main/java/net/minecraft/server/ProtoChunk.java -index 39339fa27551b06a9bfd8ea67b1ec8c66726f488..51a5b9cb36c4325df8d1434dcf28d27abefdfede 100644 +index 070449198273e6c42e72c891882b82361d1c8dbd..5114ce15ad1be23ca83b3a3fcaba10a34fcb1a6f 100644 --- a/src/main/java/net/minecraft/server/ProtoChunk.java +++ b/src/main/java/net/minecraft/server/ProtoChunk.java -@@ -94,16 +94,18 @@ public class ProtoChunk implements IChunkAccess { +@@ -95,16 +95,18 @@ public class ProtoChunk implements IChunkAccess { @Override public IBlockData getType(BlockPosition blockposition) { @@ -175,7 +176,7 @@ index 39339fa27551b06a9bfd8ea67b1ec8c66726f488..51a5b9cb36c4325df8d1434dcf28d27a @Override public Fluid getFluid(BlockPosition blockposition) { diff --git a/src/main/java/net/minecraft/server/ProtoChunkExtension.java b/src/main/java/net/minecraft/server/ProtoChunkExtension.java -index 01bf28dc34dd69dbcee5f470cc71ec2fbb2fcc12..b740e82622e282bdf543a84a559af69dd5b8568c 100644 +index c5d7a013e65c2c81b14ceb2476c1c6dfe3239f0d..ee8df274d43be753887fb77e4203e2ee30ea02b3 100644 --- a/src/main/java/net/minecraft/server/ProtoChunkExtension.java +++ b/src/main/java/net/minecraft/server/ProtoChunkExtension.java @@ -26,6 +26,11 @@ public class ProtoChunkExtension extends ProtoChunk { @@ -191,17 +192,21 @@ index 01bf28dc34dd69dbcee5f470cc71ec2fbb2fcc12..b740e82622e282bdf543a84a559af69d @Override public Fluid getFluid(BlockPosition blockposition) { diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 7f1f0111373fa409e52894e59ac49d5278d0bd58..50c2c4b0dc6256d5fbc361ba9b89b4e17bef8acb 100644 +index ee1f5c1e1bc9440a743a361bf3aaa991dddbc9cd..1e72dd313e1fe0f701f3d14fffdc9a6a8db78934 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -172,11 +172,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -181,7 +181,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { } public static boolean isValidLocation(BlockPosition blockposition) { -- return !isOutsideWorld(blockposition) && blockposition.getX() >= -30000000 && blockposition.getZ() >= -30000000 && blockposition.getX() < 30000000 && blockposition.getZ() < 30000000; +- return !isOutsideWorld(blockposition) && e(blockposition); + return blockposition.isValidLocation(); } + public static boolean k(BlockPosition blockposition) { +@@ -197,7 +197,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + } + public static boolean isOutsideWorld(BlockPosition blockposition) { - return b(blockposition.getY()); + return blockposition.isInvalidYLocation(); diff --git a/Spigot-Server-Patches/0073-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch b/Spigot-Server-Patches/0072-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch similarity index 71% rename from Spigot-Server-Patches/0073-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch rename to Spigot-Server-Patches/0072-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch index 09ee1b4a6..cabdba7ec 100644 --- a/Spigot-Server-Patches/0073-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch +++ b/Spigot-Server-Patches/0072-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Only process BlockPhysicsEvent if a plugin has a listener Saves on some object allocation and processing when no plugin listens to this diff --git a/src/main/java/net/minecraft/server/BlockPlant.java b/src/main/java/net/minecraft/server/BlockPlant.java -index ed1da4f4baf705f368247802cba42263030dba73..a6891b9fa7d01628de309e52b0cd8706d405ac36 100644 +index 47e370667926e59f036be3f2befe8820668cf892..a830305f0e334ad87e6b9ed94230ff611d997d7e 100644 --- a/src/main/java/net/minecraft/server/BlockPlant.java +++ b/src/main/java/net/minecraft/server/BlockPlant.java -@@ -16,7 +16,7 @@ public class BlockPlant extends Block { +@@ -14,7 +14,7 @@ public class BlockPlant extends Block { public IBlockData updateState(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) { // CraftBukkit start if (!iblockdata.canPlace(generatoraccess, blockposition)) { @@ -19,12 +19,12 @@ index ed1da4f4baf705f368247802cba42263030dba73..a6891b9fa7d01628de309e52b0cd8706 } } diff --git a/src/main/java/net/minecraft/server/BlockTallPlant.java b/src/main/java/net/minecraft/server/BlockTallPlant.java -index 42e86881bd891b176237eeb24492fe8050e36334..6cdce115814690f6e432aea54f69f32da2b4d206 100644 +index f87fc631255aa5948459f0726b188ebbbae13c5f..446a2ffcd95fd631750b74fd31b4c41013b8a5a8 100644 --- a/src/main/java/net/minecraft/server/BlockTallPlant.java +++ b/src/main/java/net/minecraft/server/BlockTallPlant.java -@@ -55,7 +55,7 @@ public class BlockTallPlant extends BlockPlant { - @Override - public void a(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman) { +@@ -67,7 +67,7 @@ public class BlockTallPlant extends BlockPlant { + + protected static void b(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman) { // CraftBukkit start - if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(world, blockposition).isCancelled()) { + if (((WorldServer)world).hasPhysicsEvent && org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(world, blockposition).isCancelled()) { // Paper @@ -32,22 +32,22 @@ index 42e86881bd891b176237eeb24492fe8050e36334..6cdce115814690f6e432aea54f69f32d } // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index a67c31a6021d881b49cfdb75f514404c342eea45..4c7df81217c10d92d05e619ad760bc5d9a6a79cf 100644 +index 991baec71cfeb79ee2108870645a19582f151def..a2954709415751d9688b5b3597f5b15ae5bd8ccb 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1150,6 +1150,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant 0; // Paper - if (true || worldserver.worldProvider.getDimensionManager() == DimensionManager.OVERWORLD || this.getAllowNether()) { // CraftBukkit - this.methodProfiler.a(() -> { - return worldserver.getWorldData().getName() + " " + IRegistry.DIMENSION_TYPE.getKey(worldserver.worldProvider.getDimensionManager()); + + this.methodProfiler.a(() -> { + return worldserver + " " + worldserver.getDimensionKey().a(); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 40a51633ed509ca7ae6131e11276f8f3cb7c03ce..7278242d569dafd99984921a3a3b86de46d8287f 100644 +index 1e72dd313e1fe0f701f3d14fffdc9a6a8db78934..948e477e112cd1e27c74a29c6330b07f9b710ffe 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -370,7 +370,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -441,7 +441,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { // CraftBukkit start iblockdata1.b(this, blockposition, j); // Don't call an event for the old block to limit event spam CraftWorld world = ((WorldServer) this).getWorld(); @@ -56,7 +56,7 @@ index 40a51633ed509ca7ae6131e11276f8f3cb7c03ce..7278242d569dafd99984921a3a3b86de BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), CraftBlockData.fromData(iblockdata)); this.getServer().getPluginManager().callEvent(event); -@@ -482,7 +482,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -543,7 +543,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { try { // CraftBukkit start CraftWorld world = ((WorldServer) this).getWorld(); @@ -66,14 +66,14 @@ index 40a51633ed509ca7ae6131e11276f8f3cb7c03ce..7278242d569dafd99984921a3a3b86de this.getServer().getPluginManager().callEvent(event); diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 4b355ecbdaa8471225eb979270f2abc086e27e18..1e74e339de72ac34351e7bda6a2992c582d56f3f 100644 +index 5e64aca8c318f2fd909cd0e934867e890a152373..b800844c9a2ae76019213ccb64655eeea2885a67 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -75,6 +75,7 @@ public class WorldServer extends World { - - // CraftBukkit start +@@ -82,6 +82,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { private int tickPosition; + public final Convertable.ConversionSession convertable; + public final UUID uuid; + boolean hasPhysicsEvent = true; // Paper - // Add env and gen to constructor - public WorldServer(MinecraftServer minecraftserver, Executor executor, WorldNBTStorage worldnbtstorage, WorldData worlddata, DimensionManager dimensionmanager, GameProfilerFiller gameprofilerfiller, WorldLoadListener worldloadlistener, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { + @Override public Chunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI + return this.chunkProvider.getChunkAt(x, z, false); diff --git a/Spigot-Server-Patches/0074-Entity-AddTo-RemoveFrom-World-Events.patch b/Spigot-Server-Patches/0073-Entity-AddTo-RemoveFrom-World-Events.patch similarity index 78% rename from Spigot-Server-Patches/0074-Entity-AddTo-RemoveFrom-World-Events.patch rename to Spigot-Server-Patches/0073-Entity-AddTo-RemoveFrom-World-Events.patch index a41ea5de8..d2f5db120 100644 --- a/Spigot-Server-Patches/0074-Entity-AddTo-RemoveFrom-World-Events.patch +++ b/Spigot-Server-Patches/0073-Entity-AddTo-RemoveFrom-World-Events.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Entity AddTo/RemoveFrom World Events diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 1e74e339de72ac34351e7bda6a2992c582d56f3f..02fe6706b855bb152effda5cedf1627f9a13db2a 100644 +index b800844c9a2ae76019213ccb64655eeea2885a67..85e6b6fbf99b177a15a04b91fce36a5dcbe0cc7b 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1134,7 +1134,7 @@ public class WorldServer extends World { +@@ -1056,7 +1056,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { if (entity instanceof EntityInsentient) { this.navigators.remove(((EntityInsentient) entity).getNavigation()); } @@ -17,7 +17,7 @@ index 1e74e339de72ac34351e7bda6a2992c582d56f3f..02fe6706b855bb152effda5cedf1627f entity.valid = false; // CraftBukkit } -@@ -1172,6 +1172,7 @@ public class WorldServer extends World { +@@ -1094,6 +1094,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { entity.origin = entity.getBukkitEntity().getLocation(); } // Paper end diff --git a/Spigot-Server-Patches/0075-Configurable-Chunk-Inhabited-Time.patch b/Spigot-Server-Patches/0074-Configurable-Chunk-Inhabited-Time.patch similarity index 85% rename from Spigot-Server-Patches/0075-Configurable-Chunk-Inhabited-Time.patch rename to Spigot-Server-Patches/0074-Configurable-Chunk-Inhabited-Time.patch index 1f592a154..ee7c5ebd1 100644 --- a/Spigot-Server-Patches/0075-Configurable-Chunk-Inhabited-Time.patch +++ b/Spigot-Server-Patches/0074-Configurable-Chunk-Inhabited-Time.patch @@ -11,10 +11,10 @@ For people who want all chunks to be treated equally, you can chose a fixed valu This allows to fine-tune vanilla gameplay. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 6ef0e1399e9ff260712db1a044068c125b1316d3..5872e6b171416686b11678ac9f65706b83b4e231 100644 +index 92d1dffbf436a21943b4a6aa0fabf54f064e6046..725958efab3dd05e04b7b18e169230762ef800d0 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -236,4 +236,14 @@ public class PaperWorldConfig { +@@ -231,4 +231,14 @@ public class PaperWorldConfig { skeleHorseSpawnChance = 0.01D; // Vanilla value } } @@ -30,10 +30,10 @@ index 6ef0e1399e9ff260712db1a044068c125b1316d3..5872e6b171416686b11678ac9f65706b + } } diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 671bcc763c78114f38d2b9b0320d7b168a756e21..2c1570c89026a5dbbe76ab00c6a89919e566a5f6 100644 +index dc65ad095f9ec281c13f04254311d9cea80f43f8..c0b5d25f63741947c0d8ee32f317eb7fd3db4b65 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -976,7 +976,7 @@ public class Chunk implements IChunkAccess { +@@ -977,7 +977,7 @@ public class Chunk implements IChunkAccess { @Override public long getInhabitedTime() { diff --git a/Spigot-Server-Patches/0076-EntityPathfindEvent.patch b/Spigot-Server-Patches/0075-EntityPathfindEvent.patch similarity index 76% rename from Spigot-Server-Patches/0076-EntityPathfindEvent.patch rename to Spigot-Server-Patches/0075-EntityPathfindEvent.patch index cd3e9cc2d..87db80a59 100644 --- a/Spigot-Server-Patches/0076-EntityPathfindEvent.patch +++ b/Spigot-Server-Patches/0075-EntityPathfindEvent.patch @@ -6,20 +6,20 @@ Subject: [PATCH] EntityPathfindEvent Fires when an Entity decides to start moving to a location. diff --git a/src/main/java/net/minecraft/server/Navigation.java b/src/main/java/net/minecraft/server/Navigation.java -index 3fdeda0cea0b1df2d1f1051f5654e06bcbccd410..abf450917e605972d84cb603b966feb013ae0002 100644 +index 3303edadf722557212ab973cb4f1684a0a8ae0f2..681465d8a74831461dce4615d2d19c7ed46bc299 100644 --- a/src/main/java/net/minecraft/server/Navigation.java +++ b/src/main/java/net/minecraft/server/Navigation.java @@ -60,7 +60,7 @@ public class Navigation extends NavigationAbstract { @Override public PathEntity a(Entity entity, int i) { -- return this.a(new BlockPosition(entity), i); -+ return this.a(new BlockPosition(entity), entity, i); // Paper - Forward target entity +- return this.a(entity.getChunkCoordinates(), i); ++ return this.a(entity.getChunkCoordinates(), entity, i); // Paper - Forward target entity } private int t() { diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java -index a600ee7654aa0898c17c8a433580d92ce447320c..5e7158ba1053ae77fc5c5811d49214e877a5fe30 100644 +index 6c65bab60d21b6c431855bc6516d4fd840a0efb8..0ed4b1d9c636a9051718f800ba5717e3ae46cdc9 100644 --- a/src/main/java/net/minecraft/server/NavigationAbstract.java +++ b/src/main/java/net/minecraft/server/NavigationAbstract.java @@ -8,7 +8,7 @@ import javax.annotation.Nullable; @@ -31,7 +31,7 @@ index a600ee7654aa0898c17c8a433580d92ce447320c..5e7158ba1053ae77fc5c5811d49214e8 protected final World b; @Nullable protected PathEntity c; -@@ -91,16 +91,26 @@ public abstract class NavigationAbstract { +@@ -94,16 +94,26 @@ public abstract class NavigationAbstract { @Nullable public PathEntity a(BlockPosition blockposition, int i) { @@ -46,8 +46,8 @@ index a600ee7654aa0898c17c8a433580d92ce447320c..5e7158ba1053ae77fc5c5811d49214e8 @Nullable public PathEntity a(Entity entity, int i) { -- return this.a(ImmutableSet.of(new BlockPosition(entity)), 16, true, i); -+ return this.a(ImmutableSet.of(new BlockPosition(entity)), entity, 16, true, i); // Paper +- return this.a(ImmutableSet.of(entity.getChunkCoordinates()), 16, true, i); ++ return this.a(ImmutableSet.of(entity.getChunkCoordinates()), entity, 16, true, i); // Paper } @Nullable @@ -60,8 +60,8 @@ index a600ee7654aa0898c17c8a433580d92ce447320c..5e7158ba1053ae77fc5c5811d49214e8 if (set.isEmpty()) { return null; } else if (this.a.locY() < 0.0D) { -@@ -110,6 +120,23 @@ public abstract class NavigationAbstract { - } else if (this.c != null && !this.c.b() && set.contains(this.q)) { +@@ -113,6 +123,23 @@ public abstract class NavigationAbstract { + } else if (this.c != null && !this.c.b() && set.contains(this.p)) { return this.c; } else { + // Paper start - Pathfind event @@ -82,18 +82,18 @@ index a600ee7654aa0898c17c8a433580d92ce447320c..5e7158ba1053ae77fc5c5811d49214e8 + } + // Paper end this.b.getMethodProfiler().enter("pathfind"); - float f = (float) this.p.getValue(); - BlockPosition blockposition = flag ? (new BlockPosition(this.a)).up() : new BlockPosition(this.a); + float f = (float) this.a.b(GenericAttributes.FOLLOW_RANGE); + BlockPosition blockposition = flag ? this.a.getChunkCoordinates().up() : this.a.getChunkCoordinates(); diff --git a/src/main/java/net/minecraft/server/NavigationFlying.java b/src/main/java/net/minecraft/server/NavigationFlying.java -index 5b057e96db5e12bace186f449ae5658b25123000..f16c6d1faac21478cc9b828c478f3f38a90615fc 100644 +index d9f0d446fceeba33fdf47e6ff88f888e6e17d019..0c33a0c9d59d79a39826b5ee14144604717ffebe 100644 --- a/src/main/java/net/minecraft/server/NavigationFlying.java +++ b/src/main/java/net/minecraft/server/NavigationFlying.java @@ -25,7 +25,7 @@ public class NavigationFlying extends NavigationAbstract { @Override public PathEntity a(Entity entity, int i) { -- return this.a(new BlockPosition(entity), i); -+ return this.a(new BlockPosition(entity), entity, i); // Paper - Forward target entity +- return this.a(entity.getChunkCoordinates(), i); ++ return this.a(entity.getChunkCoordinates(), entity, i); // Paper - Forward target entity } @Override diff --git a/Spigot-Server-Patches/0077-Sanitise-RegionFileCache-and-make-configurable.patch b/Spigot-Server-Patches/0076-Sanitise-RegionFileCache-and-make-configurable.patch similarity index 85% rename from Spigot-Server-Patches/0077-Sanitise-RegionFileCache-and-make-configurable.patch rename to Spigot-Server-Patches/0076-Sanitise-RegionFileCache-and-make-configurable.patch index ec7d8d24f..40b7fe709 100644 --- a/Spigot-Server-Patches/0077-Sanitise-RegionFileCache-and-make-configurable.patch +++ b/Spigot-Server-Patches/0076-Sanitise-RegionFileCache-and-make-configurable.patch @@ -11,10 +11,10 @@ The implementation uses a LinkedHashMap as an LRU cache (modified from HashMap). The maximum size of the RegionFileCache is also made configurable. diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 6ef5bb9f323da7cbf8cb24d094bf43c4735549b0..d500cd75a9229584a70bbdbda6de9bce67b836e8 100644 +index f207abbe757ad403a29a7a012903aaa88d5b1685..7d726757d1083011a09c9f2ca37c33a81360e964 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -218,4 +218,9 @@ public class PaperConfig { +@@ -219,4 +219,9 @@ public class PaperConfig { private static void loadPermsBeforePlugins() { loadPermsBeforePlugins = getBoolean("settings.load-permissions-yml-before-plugins", true); } @@ -25,10 +25,10 @@ index 6ef5bb9f323da7cbf8cb24d094bf43c4735549b0..d500cd75a9229584a70bbdbda6de9bce + } } diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java -index fd46da95e0342c0004d82a36a164f3a18f9edac6..5065ece393a47add3c4e888fd7fb3d9ba47acfed 100644 +index 4cff831de2128cd346f1f1627f0915d534b0d3bf..0305f3c93e8485552890dd5eca8e79277e2bb886 100644 --- a/src/main/java/net/minecraft/server/RegionFileCache.java +++ b/src/main/java/net/minecraft/server/RegionFileCache.java -@@ -25,7 +25,7 @@ public final class RegionFileCache implements AutoCloseable { +@@ -27,7 +27,7 @@ public final class RegionFileCache implements AutoCloseable { if (regionfile != null) { return regionfile; } else { diff --git a/Spigot-Server-Patches/0077-Do-not-load-chunks-for-Pathfinding.patch b/Spigot-Server-Patches/0077-Do-not-load-chunks-for-Pathfinding.patch new file mode 100644 index 000000000..1a57e503c --- /dev/null +++ b/Spigot-Server-Patches/0077-Do-not-load-chunks-for-Pathfinding.patch @@ -0,0 +1,68 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Thu, 31 Mar 2016 19:17:58 -0400 +Subject: [PATCH] Do not load chunks for Pathfinding + + +diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java +index 0ed4b1d9c636a9051718f800ba5717e3ae46cdc9..9330e65cbdf2f826528e3c891197fac7860306ec 100644 +--- a/src/main/java/net/minecraft/server/NavigationAbstract.java ++++ b/src/main/java/net/minecraft/server/NavigationAbstract.java +@@ -27,7 +27,7 @@ public abstract class NavigationAbstract { + private BlockPosition p; + private int q; + private float r; +- private final Pathfinder s; ++ private final Pathfinder s; public Pathfinder getPathfinder() { return this.s; } // Paper - OBFHELPER + + public NavigationAbstract(EntityInsentient entityinsentient, World world) { + this.g = Vec3D.a; +diff --git a/src/main/java/net/minecraft/server/Pathfinder.java b/src/main/java/net/minecraft/server/Pathfinder.java +index 8ba6dd459a863717c91dd59f3f2ee5e3a5ed8170..b31d1f73ce0f067e352868b53eab7557c34b17eb 100644 +--- a/src/main/java/net/minecraft/server/Pathfinder.java ++++ b/src/main/java/net/minecraft/server/Pathfinder.java +@@ -17,7 +17,7 @@ public class Pathfinder { + + private final PathPoint[] a = new PathPoint[32]; + private final int b; +- private final PathfinderAbstract c; ++ private final PathfinderAbstract c; public PathfinderAbstract getPathfinder() { return this.c; } // Paper - OBFHELPER + private final Path d = new Path(); + + public Pathfinder(PathfinderAbstract pathfinderabstract, int i) { +diff --git a/src/main/java/net/minecraft/server/PathfinderNormal.java b/src/main/java/net/minecraft/server/PathfinderNormal.java +index 7249dd2e6d66b20398103301050ac96ca0c44386..d7f0df123ba716ca8587cbfab2c8e94961164909 100644 +--- a/src/main/java/net/minecraft/server/PathfinderNormal.java ++++ b/src/main/java/net/minecraft/server/PathfinderNormal.java +@@ -468,7 +468,12 @@ public class PathfinderNormal extends PathfinderAbstract { + for (int j1 = -1; j1 <= 1; ++j1) { + if (l != 0 || j1 != 0) { + blockposition_mutableblockposition.d(i + l, j + i1, k + j1); +- IBlockData iblockdata = iblockaccess.getType(blockposition_mutableblockposition); ++ // Paper start ++ IBlockData iblockdata = iblockaccess.getTypeIfLoaded(blockposition_mutableblockposition); ++ if (iblockdata == null) { ++ pathtype = PathType.BLOCKED; ++ } else { ++ // Paper end + + if (iblockdata.a(Blocks.CACTUS)) { + return PathType.DANGER_CACTUS; +@@ -491,6 +496,7 @@ public class PathfinderNormal extends PathfinderAbstract { + if (fluid.a((Tag) TagsFluid.LAVA)) { + return PathType.LAVA; + } ++ } // Paper + } + } + } +@@ -500,7 +506,8 @@ public class PathfinderNormal extends PathfinderAbstract { + } + + protected static PathType b(IBlockAccess iblockaccess, BlockPosition blockposition) { +- IBlockData iblockdata = iblockaccess.getType(blockposition); ++ IBlockData iblockdata = iblockaccess.getTypeIfLoaded(blockposition); // Paper ++ if (iblockdata == null) return PathType.BLOCKED; // Paper + Block block = iblockdata.getBlock(); + Material material = iblockdata.getMaterial(); + diff --git a/Spigot-Server-Patches/0079-Add-PlayerUseUnknownEntityEvent.patch b/Spigot-Server-Patches/0078-Add-PlayerUseUnknownEntityEvent.patch similarity index 86% rename from Spigot-Server-Patches/0079-Add-PlayerUseUnknownEntityEvent.patch rename to Spigot-Server-Patches/0078-Add-PlayerUseUnknownEntityEvent.patch index 6b440af86..693ddb374 100644 --- a/Spigot-Server-Patches/0079-Add-PlayerUseUnknownEntityEvent.patch +++ b/Spigot-Server-Patches/0078-Add-PlayerUseUnknownEntityEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerUseUnknownEntityEvent diff --git a/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java b/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java -index 680adbdeb03acb5471613b6ad9c2ecaba9c402c6..3f7697b39ce31174a14b1f62c6549ee3a2cfcec2 100644 +index 58546550cba0dc239980ef6c920bd5db55328693..51970a4f134e29f5d2bf681d83aeeda916fe9195 100644 --- a/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java +++ b/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java @@ -5,7 +5,7 @@ import javax.annotation.Nullable; @@ -18,10 +18,10 @@ index 680adbdeb03acb5471613b6ad9c2ecaba9c402c6..3f7697b39ce31174a14b1f62c6549ee3 private Vec3D c; private EnumHand d; diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 33482a85aa6c3600394684c83e03a4e84be7f1fa..f879b40ac64ecd8b5713bbd6c07247e270a46095 100644 +index ffed0587323dbf522e478f43948bbb03c0af84a2..e65aa13ed4d751c7eec576b75496683d8b95d06f 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1912,6 +1912,16 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -1955,6 +1955,16 @@ public class PlayerConnection implements PacketListenerPlayIn { } } } diff --git a/Spigot-Server-Patches/0078-Do-not-load-chunks-for-Pathfinding.patch b/Spigot-Server-Patches/0078-Do-not-load-chunks-for-Pathfinding.patch deleted file mode 100644 index d9be283f5..000000000 --- a/Spigot-Server-Patches/0078-Do-not-load-chunks-for-Pathfinding.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Thu, 31 Mar 2016 19:17:58 -0400 -Subject: [PATCH] Do not load chunks for Pathfinding - - -diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java -index 5e7158ba1053ae77fc5c5811d49214e877a5fe30..39a0c45bb0e3d2fcfbcc07192f9e1e61570c922e 100644 ---- a/src/main/java/net/minecraft/server/NavigationAbstract.java -+++ b/src/main/java/net/minecraft/server/NavigationAbstract.java -@@ -28,7 +28,7 @@ public abstract class NavigationAbstract { - private BlockPosition q; - private int r; - private float s; -- private final Pathfinder t; -+ private final Pathfinder t; public Pathfinder getPathfinder() { return this.t; } // Paper - OBFHELPER - - public NavigationAbstract(EntityInsentient entityinsentient, World world) { - this.g = Vec3D.a; -diff --git a/src/main/java/net/minecraft/server/Pathfinder.java b/src/main/java/net/minecraft/server/Pathfinder.java -index 6199570618d4642b7ca7b2472852cec6af0202d9..67c63cfe333e328cbd00ada970bd81efebfe30b6 100644 ---- a/src/main/java/net/minecraft/server/Pathfinder.java -+++ b/src/main/java/net/minecraft/server/Pathfinder.java -@@ -19,7 +19,7 @@ public class Pathfinder { - private final Set b = Sets.newHashSet(); - private final PathPoint[] c = new PathPoint[32]; - private final int d; -- private final PathfinderAbstract e; -+ private final PathfinderAbstract e; public PathfinderAbstract getPathfinder() { return this.e; } // Paper - OBFHELPER - - public Pathfinder(PathfinderAbstract pathfinderabstract, int i) { - this.e = pathfinderabstract; -diff --git a/src/main/java/net/minecraft/server/PathfinderNormal.java b/src/main/java/net/minecraft/server/PathfinderNormal.java -index ef248ebcc4419609836c2025548aefb3afcf27d1..4240ca81cb6debecc54dcf9a550e9d916dfa8f9f 100644 ---- a/src/main/java/net/minecraft/server/PathfinderNormal.java -+++ b/src/main/java/net/minecraft/server/PathfinderNormal.java -@@ -365,7 +365,8 @@ public class PathfinderNormal extends PathfinderAbstract { - PathType pathtype = c(iblockaccess, i, j, k); - - if (pathtype == PathType.OPEN && j >= 1) { -- Block block = iblockaccess.getType(new BlockPosition(i, j - 1, k)).getBlock(); -+ Block block = iblockaccess.getBlockIfLoaded(new BlockPosition(i, j - 1, k)); // Paper -+ if (block == null) return PathType.BLOCKED; // Paper - PathType pathtype1 = c(iblockaccess, i, j - 1, k); - - pathtype = pathtype1 != PathType.WALKABLE && pathtype1 != PathType.OPEN && pathtype1 != PathType.WATER && pathtype1 != PathType.LAVA ? PathType.WALKABLE : PathType.OPEN; -@@ -402,8 +403,12 @@ public class PathfinderNormal extends PathfinderAbstract { - for (int i1 = -1; i1 <= 1; ++i1) { - for (int j1 = -1; j1 <= 1; ++j1) { - if (l != 0 || j1 != 0) { -- Block block = iblockaccess.getType(blockposition_pooledblockposition.d(l + i, i1 + j, j1 + k)).getBlock(); -- -+ // Paper start -+ Block block = iblockaccess.getBlockIfLoaded(blockposition_pooledblockposition.d(l + i, i1 + j, j1 + k)); -+ if (block == null) { -+ pathtype = PathType.BLOCKED; -+ } else -+ // Paper end - if (block == Blocks.CACTUS) { - pathtype = PathType.DANGER_CACTUS; - } else if (block != Blocks.FIRE && block != Blocks.LAVA) { -@@ -440,7 +445,8 @@ public class PathfinderNormal extends PathfinderAbstract { - - protected static PathType c(IBlockAccess iblockaccess, int i, int j, int k) { - BlockPosition blockposition = new BlockPosition(i, j, k); -- IBlockData iblockdata = iblockaccess.getType(blockposition); -+ IBlockData iblockdata = iblockaccess.getTypeIfLoaded(blockposition); // Paper -+ if (iblockdata == null) return PathType.BLOCKED; // Paper - Block block = iblockdata.getBlock(); - Material material = iblockdata.getMaterial(); - diff --git a/Spigot-Server-Patches/0080-Fix-reducedDebugInfo-not-initialized-on-client.patch b/Spigot-Server-Patches/0079-Fix-reducedDebugInfo-not-initialized-on-client.patch similarity index 74% rename from Spigot-Server-Patches/0080-Fix-reducedDebugInfo-not-initialized-on-client.patch rename to Spigot-Server-Patches/0079-Fix-reducedDebugInfo-not-initialized-on-client.patch index 4c750dd27..3ed46d295 100644 --- a/Spigot-Server-Patches/0080-Fix-reducedDebugInfo-not-initialized-on-client.patch +++ b/Spigot-Server-Patches/0079-Fix-reducedDebugInfo-not-initialized-on-client.patch @@ -5,14 +5,14 @@ Subject: [PATCH] Fix reducedDebugInfo not initialized on client diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index f8b7ea28694170148027123f889fb93f8647cdc4..87c854d052d32a10ba6f1abc317db083e8f079d4 100644 +index 2265fa3c04305e18653b4b37a0d1d36b261521d7..ca1f4bdf81600d2e72564e5dba1df0d69877bdce 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -150,6 +150,7 @@ public abstract class PlayerList { +@@ -174,6 +174,7 @@ public abstract class PlayerList { playerconnection.sendPacket(new PacketPlayOutHeldItemSlot(entityplayer.inventory.itemInHandIndex)); playerconnection.sendPacket(new PacketPlayOutRecipeUpdate(this.server.getCraftingManager().b())); playerconnection.sendPacket(new PacketPlayOutTags(this.server.getTagRegistry())); -+ playerconnection.sendPacket(new PacketPlayOutEntityStatus(entityplayer, (byte) (worldserver.getGameRules().getBoolean(GameRules.REDUCED_DEBUG_INFO) ? 22 : 23))); // Paper - fix this rule not being initialized on the client ++ playerconnection.sendPacket(new PacketPlayOutEntityStatus(entityplayer, (byte) (worldserver1.getGameRules().getBoolean(GameRules.REDUCED_DEBUG_INFO) ? 22 : 23))); // Paper - fix this rule not being initialized on the client this.d(entityplayer); entityplayer.getStatisticManager().c(); entityplayer.B().a(entityplayer); diff --git a/Spigot-Server-Patches/0081-Configurable-Grass-Spread-Tick-Rate.patch b/Spigot-Server-Patches/0080-Configurable-Grass-Spread-Tick-Rate.patch similarity index 85% rename from Spigot-Server-Patches/0081-Configurable-Grass-Spread-Tick-Rate.patch rename to Spigot-Server-Patches/0080-Configurable-Grass-Spread-Tick-Rate.patch index f4c224ea3..8941bb9c1 100644 --- a/Spigot-Server-Patches/0081-Configurable-Grass-Spread-Tick-Rate.patch +++ b/Spigot-Server-Patches/0080-Configurable-Grass-Spread-Tick-Rate.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Configurable Grass Spread Tick Rate diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 5872e6b171416686b11678ac9f65706b83b4e231..47f5f8055ed45914309ca9a295ac48b89f192320 100644 +index 725958efab3dd05e04b7b18e169230762ef800d0..fe2c8001897dc6d66ce0d24ddb1a5d3b79810294 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -246,4 +246,10 @@ public class PaperWorldConfig { +@@ -241,4 +241,10 @@ public class PaperWorldConfig { } fixedInhabitedTime = getInt("fixed-chunk-inhabited-time", -1); } @@ -20,10 +20,10 @@ index 5872e6b171416686b11678ac9f65706b83b4e231..47f5f8055ed45914309ca9a295ac48b8 + } } diff --git a/src/main/java/net/minecraft/server/BlockDirtSnowSpreadable.java b/src/main/java/net/minecraft/server/BlockDirtSnowSpreadable.java -index 9b25fc2f9e3990acf4e8e4b325fe7a67a4b4d804..2b19b6754acd1b5ed60faee154b5af2b6635645e 100644 +index 87f5aa46d6a3f8510f4359415f8405c56841619b..3262b43b5844c332502a3dd1358596998aba0a89 100644 --- a/src/main/java/net/minecraft/server/BlockDirtSnowSpreadable.java +++ b/src/main/java/net/minecraft/server/BlockDirtSnowSpreadable.java -@@ -29,6 +29,7 @@ public abstract class BlockDirtSnowSpreadable extends BlockDirtSnow { +@@ -31,6 +31,7 @@ public abstract class BlockDirtSnowSpreadable extends BlockDirtSnow { @Override public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) { diff --git a/Spigot-Server-Patches/0082-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch b/Spigot-Server-Patches/0081-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch similarity index 84% rename from Spigot-Server-Patches/0082-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch rename to Spigot-Server-Patches/0081-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch index d88c6fc35..0d3122c07 100644 --- a/Spigot-Server-Patches/0082-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch +++ b/Spigot-Server-Patches/0081-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix Cancelling BlockPlaceEvent triggering physics diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 7278242d569dafd99984921a3a3b86de46d8287f..491e491895246063c4df38e1a90693bfc730ef33 100644 +index 948e477e112cd1e27c74a29c6330b07f9b710ffe..58277457ef879c48f3678efeb2a646e116320754 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -440,6 +440,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -501,6 +501,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { public void b(BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) {} public void applyPhysics(BlockPosition blockposition, Block block) { diff --git a/Spigot-Server-Patches/0082-Remove-Debug-checks-from-DataBits.patch b/Spigot-Server-Patches/0082-Remove-Debug-checks-from-DataBits.patch new file mode 100644 index 000000000..ff31c66ed --- /dev/null +++ b/Spigot-Server-Patches/0082-Remove-Debug-checks-from-DataBits.patch @@ -0,0 +1,45 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Tue, 5 Apr 2016 21:38:58 -0400 +Subject: [PATCH] Remove Debug checks from DataBits + +These are super hot and causing noticeable hits + +Before: http://i.imgur.com/nQsMzAE.png +After: http://i.imgur.com/nJ46crB.png + +diff --git a/src/main/java/net/minecraft/server/DataBits.java b/src/main/java/net/minecraft/server/DataBits.java +index 2c3580c1c7bcd6afc83a45550c0f672a592e0c38..48cca2b9a1dbb071615625842123c0c47e281b29 100644 +--- a/src/main/java/net/minecraft/server/DataBits.java ++++ b/src/main/java/net/minecraft/server/DataBits.java +@@ -53,8 +53,8 @@ public class DataBits { + } + + public int a(int i, int j) { +- Validate.inclusiveBetween(0L, (long) (this.e - 1), (long) i); +- Validate.inclusiveBetween(0L, this.d, (long) j); ++ //Validate.inclusiveBetween(0L, (long) (this.e - 1), (long) i); // Paper ++ //Validate.inclusiveBetween(0L, this.d, (long) j); // Paper + int k = this.b(i); + long l = this.b[k]; + int i1 = (i - k * this.f) * this.c; +@@ -65,8 +65,8 @@ public class DataBits { + } + + public void b(int i, int j) { +- Validate.inclusiveBetween(0L, (long) (this.e - 1), (long) i); +- Validate.inclusiveBetween(0L, this.d, (long) j); ++ //Validate.inclusiveBetween(0L, (long) (this.e - 1), (long) i); // Paper ++ //Validate.inclusiveBetween(0L, this.d, (long) j); // Paper + int k = this.b(i); + long l = this.b[k]; + int i1 = (i - k * this.f) * this.c; +@@ -75,7 +75,7 @@ public class DataBits { + } + + public int a(int i) { +- Validate.inclusiveBetween(0L, (long) (this.e - 1), (long) i); ++ //Validate.inclusiveBetween(0L, (long) (this.e - 1), (long) i); // Paper + int j = this.b(i); + long k = this.b[j]; + int l = (i - j * this.f) * this.c; diff --git a/Spigot-Server-Patches/0084-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch b/Spigot-Server-Patches/0083-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch similarity index 89% rename from Spigot-Server-Patches/0084-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch rename to Spigot-Server-Patches/0083-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch index 08baaa10a..c515eb5bc 100644 --- a/Spigot-Server-Patches/0084-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch +++ b/Spigot-Server-Patches/0083-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch @@ -12,10 +12,10 @@ for this on CB at one point but I can't find it. We may need to do this ourselves at some point in the future. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 47f5f8055ed45914309ca9a295ac48b89f192320..b1d1a3c1f84e0d2153de257183687502c8f393d1 100644 +index fe2c8001897dc6d66ce0d24ddb1a5d3b79810294..538e6751f3bda77ba32256158d2a6a25025b360c 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -252,4 +252,9 @@ public class PaperWorldConfig { +@@ -247,4 +247,9 @@ public class PaperWorldConfig { grassUpdateRate = Math.max(0, getInt("grass-spread-tick-rate", grassUpdateRate)); log("Grass Spread Tick Rate: " + grassUpdateRate); } @@ -26,10 +26,10 @@ index 47f5f8055ed45914309ca9a295ac48b89f192320..b1d1a3c1f84e0d2153de257183687502 + } } diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index f879b40ac64ecd8b5713bbd6c07247e270a46095..f9b77ec31b466687eaef2b952b01a2dcf38605c1 100644 +index e65aa13ed4d751c7eec576b75496683d8b95d06f..c865aab4f56d6b0544ef66a35ebf58e48c8afbb8 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1648,7 +1648,16 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -1693,7 +1693,16 @@ public class PlayerConnection implements PacketListenerPlayIn { return; } diff --git a/Spigot-Server-Patches/0083-Remove-Debug-checks-from-DataBits.patch b/Spigot-Server-Patches/0083-Remove-Debug-checks-from-DataBits.patch deleted file mode 100644 index c8465b02d..000000000 --- a/Spigot-Server-Patches/0083-Remove-Debug-checks-from-DataBits.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Tue, 5 Apr 2016 21:38:58 -0400 -Subject: [PATCH] Remove Debug checks from DataBits - -These are super hot and causing noticeable hits - -Before: http://i.imgur.com/nQsMzAE.png -After: http://i.imgur.com/nJ46crB.png - -diff --git a/src/main/java/net/minecraft/server/DataBits.java b/src/main/java/net/minecraft/server/DataBits.java -index 2edd9b87146a3d1b6623b0efb17b28b524f18c2f..f9680b6830c77f31e1eb8b6845dd6d58d04f624a 100644 ---- a/src/main/java/net/minecraft/server/DataBits.java -+++ b/src/main/java/net/minecraft/server/DataBits.java -@@ -15,7 +15,7 @@ public class DataBits { - } - - public DataBits(int i, int j, long[] along) { -- Validate.inclusiveBetween(1L, 32L, (long) i); -+ //Validate.inclusiveBetween(1L, 32L, (long) i); // Paper - this.d = j; - this.b = i; - this.a = along; -@@ -28,8 +28,8 @@ public class DataBits { - } - - public int a(int i, int j) { -- Validate.inclusiveBetween(0L, (long) (this.d - 1), (long) i); -- Validate.inclusiveBetween(0L, this.c, (long) j); -+ //Validate.inclusiveBetween(0L, (long) (this.d - 1), (long) i); // Paper -+ //Validate.inclusiveBetween(0L, this.c, (long) j); // Paper - int k = i * this.b; - int l = k >> 6; - int i1 = (i + 1) * this.b - 1 >> 6; -@@ -50,8 +50,8 @@ public class DataBits { - } - - public void b(int i, int j) { -- Validate.inclusiveBetween(0L, (long) (this.d - 1), (long) i); -- Validate.inclusiveBetween(0L, this.c, (long) j); -+ //Validate.inclusiveBetween(0L, (long) (this.d - 1), (long) i); // Paper -+ //Validate.inclusiveBetween(0L, this.c, (long) j); // Paper - int k = i * this.b; - int l = k >> 6; - int i1 = (i + 1) * this.b - 1 >> 6; -@@ -68,7 +68,7 @@ public class DataBits { - } - - public int a(int i) { -- Validate.inclusiveBetween(0L, (long) (this.d - 1), (long) i); -+ //Validate.inclusiveBetween(0L, (long) (this.d - 1), (long) i); // Paper - int j = i * this.b; - int k = j >> 6; - int l = (i + 1) * this.b - 1 >> 6; diff --git a/Spigot-Server-Patches/0085-Workaround-for-setting-passengers-on-players.patch b/Spigot-Server-Patches/0084-Workaround-for-setting-passengers-on-players.patch similarity index 87% rename from Spigot-Server-Patches/0085-Workaround-for-setting-passengers-on-players.patch rename to Spigot-Server-Patches/0084-Workaround-for-setting-passengers-on-players.patch index 0a407b78c..d7effbc68 100644 --- a/Spigot-Server-Patches/0085-Workaround-for-setting-passengers-on-players.patch +++ b/Spigot-Server-Patches/0084-Workaround-for-setting-passengers-on-players.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Workaround for setting passengers on players SPIGOT-1915 & GH-114 diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index b2e6eeb60db96cab7b95048d9773c3e3f6da10dc..faff98ac698a5576ef4112a334e845a50d60b857 100644 +index 2e8105fe1d0f5f953ac8ba94df3e8eb66b7813d7..532698f80bb2e266f27ae1d4b70c80138560b8cc 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -767,6 +767,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -773,6 +773,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player { return true; } diff --git a/Spigot-Server-Patches/0086-Remove-unused-World-Tile-Entity-List.patch b/Spigot-Server-Patches/0085-Remove-unused-World-Tile-Entity-List.patch similarity index 82% rename from Spigot-Server-Patches/0086-Remove-unused-World-Tile-Entity-List.patch rename to Spigot-Server-Patches/0085-Remove-unused-World-Tile-Entity-List.patch index 0e9f14b4f..5ef8c2944 100644 --- a/Spigot-Server-Patches/0086-Remove-unused-World-Tile-Entity-List.patch +++ b/Spigot-Server-Patches/0085-Remove-unused-World-Tile-Entity-List.patch @@ -6,19 +6,19 @@ Subject: [PATCH] Remove unused World Tile Entity List Massive hit to performance and it is completely unnecessary. diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 491e491895246063c4df38e1a90693bfc730ef33..a3de9ae44acb3736394ac97c730d1b1cc2d5b914 100644 +index 58277457ef879c48f3678efeb2a646e116320754..bd7214e4679044461f141f3000f1dab648a24051 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -36,7 +36,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - - protected static final Logger LOGGER = LogManager.getLogger(); +@@ -39,7 +39,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + public static final ResourceKey THE_NETHER = ResourceKey.a(IRegistry.ae, new MinecraftKey("the_nether")); + public static final ResourceKey THE_END = ResourceKey.a(IRegistry.ae, new MinecraftKey("the_end")); private static final EnumDirection[] a = EnumDirection.values(); - public final List tileEntityList = Lists.newArrayList(); + //public final List tileEntityList = Lists.newArrayList(); // Paper - remove unused list public final List tileEntityListTick = Lists.newArrayList(); protected final List tileEntityListPending = Lists.newArrayList(); protected final java.util.Set tileEntityListUnload = com.google.common.collect.Sets.newHashSet(); -@@ -605,9 +605,9 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -666,9 +666,9 @@ public abstract class World implements GeneratorAccess, AutoCloseable { }, tileentity::getPosition}); } @@ -30,7 +30,7 @@ index 491e491895246063c4df38e1a90693bfc730ef33..a3de9ae44acb3736394ac97c730d1b1c this.tileEntityListTick.add(tileentity); } -@@ -643,7 +643,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -704,7 +704,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { timings.tileEntityTick.startTiming(); // Spigot if (!this.tileEntityListUnload.isEmpty()) { this.tileEntityListTick.removeAll(this.tileEntityListUnload); @@ -39,7 +39,7 @@ index 491e491895246063c4df38e1a90693bfc730ef33..a3de9ae44acb3736394ac97c730d1b1c this.tileEntityListUnload.clear(); } -@@ -704,7 +704,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -765,7 +765,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { tilesThisCycle--; this.tileEntityListTick.remove(tileTickPosition--); // Spigot end @@ -48,7 +48,7 @@ index 491e491895246063c4df38e1a90693bfc730ef33..a3de9ae44acb3736394ac97c730d1b1c if (this.isLoaded(tileentity.getPosition())) { this.getChunkAtWorldCoords(tileentity.getPosition()).removeTileEntity(tileentity.getPosition()); } -@@ -734,7 +734,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -795,7 +795,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { this.notify(tileentity1.getPosition(), iblockdata, iblockdata, 3); // CraftBukkit start // From above, don't screw this up - SPIGOT-1746 @@ -57,7 +57,7 @@ index 491e491895246063c4df38e1a90693bfc730ef33..a3de9ae44acb3736394ac97c730d1b1c this.a(tileentity1); } // CraftBukkit end -@@ -1000,7 +1000,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -937,7 +937,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { } else { if (tileentity != null) { this.tileEntityListPending.remove(tileentity); @@ -67,10 +67,10 @@ index 491e491895246063c4df38e1a90693bfc730ef33..a3de9ae44acb3736394ac97c730d1b1c } diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 02fe6706b855bb152effda5cedf1627f9a13db2a..532b5a4743fb2216ba3c1b61206cde4391275c8c 100644 +index 85e6b6fbf99b177a15a04b91fce36a5dcbe0cc7b..6bcead2505365ed2631cd991ac2dae99fff14f78 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1619,7 +1619,7 @@ public class WorldServer extends World { +@@ -1542,7 +1542,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { } bufferedwriter.write(String.format("entities: %d\n", this.entitiesById.size())); @@ -79,7 +79,7 @@ index 02fe6706b855bb152effda5cedf1627f9a13db2a..532b5a4743fb2216ba3c1b61206cde43 bufferedwriter.write(String.format("block_ticks: %d\n", this.getBlockTickList().a())); bufferedwriter.write(String.format("fluid_ticks: %d\n", this.getFluidTickList().a())); bufferedwriter.write("distance_manager: " + playerchunkmap.e().c() + "\n"); -@@ -1782,7 +1782,7 @@ public class WorldServer extends World { +@@ -1681,7 +1681,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { private void a(Writer writer) throws IOException { CSVWriter csvwriter = CSVWriter.a().a("x").a("y").a("z").a("type").a(writer); diff --git a/Spigot-Server-Patches/0087-Don-t-tick-Skulls-unused-code.patch b/Spigot-Server-Patches/0086-Don-t-tick-Skulls-unused-code.patch similarity index 76% rename from Spigot-Server-Patches/0087-Don-t-tick-Skulls-unused-code.patch rename to Spigot-Server-Patches/0086-Don-t-tick-Skulls-unused-code.patch index 067640d7e..1c814d0fd 100644 --- a/Spigot-Server-Patches/0087-Don-t-tick-Skulls-unused-code.patch +++ b/Spigot-Server-Patches/0086-Don-t-tick-Skulls-unused-code.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Don't tick Skulls - unused code diff --git a/src/main/java/net/minecraft/server/TileEntitySkull.java b/src/main/java/net/minecraft/server/TileEntitySkull.java -index 99442bb130220cf00e728e3a0da7fd6a04aa8994..177cceb77f8783fe93ba7e4342de9c589f155c1b 100644 +index 5528df3d07a2649a5248ff3b26720a2e2a4a0c25..4fae1b3274a96b871b39de083e9b28ab6129533f 100644 --- a/src/main/java/net/minecraft/server/TileEntitySkull.java +++ b/src/main/java/net/minecraft/server/TileEntitySkull.java @@ -24,7 +24,7 @@ import com.mojang.authlib.ProfileLookupCallback; @@ -15,14 +15,14 @@ index 99442bb130220cf00e728e3a0da7fd6a04aa8994..177cceb77f8783fe93ba7e4342de9c58 -public class TileEntitySkull extends TileEntity implements ITickable { +public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Paper - remove tickable - public GameProfile gameProfile; - private int b; -@@ -124,7 +124,7 @@ public class TileEntitySkull extends TileEntity implements ITickable { + @Nullable + private static UserCache userCache; +@@ -127,7 +127,7 @@ public class TileEntitySkull extends TileEntity implements ITickable { } - @Override + // Paper - remove override public void tick() { - Block block = this.getBlock().getBlock(); + IBlockData iblockdata = this.getBlock(); diff --git a/Spigot-Server-Patches/0088-Configurable-Player-Collision.patch b/Spigot-Server-Patches/0087-Configurable-Player-Collision.patch similarity index 83% rename from Spigot-Server-Patches/0088-Configurable-Player-Collision.patch rename to Spigot-Server-Patches/0087-Configurable-Player-Collision.patch index a0776b800..49c7705dc 100644 --- a/Spigot-Server-Patches/0088-Configurable-Player-Collision.patch +++ b/Spigot-Server-Patches/0087-Configurable-Player-Collision.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Configurable Player Collision diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index d500cd75a9229584a70bbdbda6de9bce67b836e8..e4f0db64c061af684c28f50f0a37fbca693af7be 100644 +index 7d726757d1083011a09c9f2ca37c33a81360e964..3d9a98936cfe933fd71fb82f07e1ba54d5d35800 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -223,4 +223,9 @@ public class PaperConfig { +@@ -224,4 +224,9 @@ public class PaperConfig { private static void regionFileCacheSize() { regionFileCacheSize = Math.max(getInt("settings.region-file-cache-size", 256), 4); } @@ -19,10 +19,10 @@ index d500cd75a9229584a70bbdbda6de9bce67b836e8..e4f0db64c061af684c28f50f0a37fbca + } } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 4c7df81217c10d92d05e619ad760bc5d9a6a79cf..bd14edb06f7ce2560b600845df284e6c6860d699 100644 +index a2954709415751d9688b5b3597f5b15ae5bd8ccb..48511aac1493322803c49b36edea547810efc701 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -454,6 +454,20 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant playersByName = new java.util.HashMap<>(); + @Nullable String collideRuleTeamName; // Paper - Team name used for collideRule - public PlayerList(MinecraftServer minecraftserver, int i) { + public PlayerList(MinecraftServer minecraftserver, IRegistryCustom.Dimension iregistrycustom_dimension, WorldNBTStorage worldnbtstorage, int i) { this.cserver = minecraftserver.server = new CraftServer((DedicatedServer) minecraftserver, this); -@@ -274,6 +275,13 @@ public abstract class PlayerList { +@@ -305,6 +306,13 @@ public abstract class PlayerList { } entityplayer.syncInventory(); + // Paper start - Add to collideRule team if needed -+ final Scoreboard scoreboard = this.getServer().getWorldServer(DimensionManager.OVERWORLD).getScoreboard(); ++ final Scoreboard scoreboard = this.getServer().getWorldServer(World.OVERWORLD).getScoreboard(); + final ScoreboardTeam collideRuleTeam = scoreboard.getTeam(collideRuleTeamName); + if (this.collideRuleTeamName != null && collideRuleTeam != null && entityplayer.getScoreboardTeam() == null) { + scoreboard.addPlayerToTeam(entityplayer.getName(), collideRuleTeam); + } + // Paper end // CraftBukkit - Moved from above, added world - PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", entityplayer.getDisplayName().getString(), s1, entityplayer.getId(), entityplayer.world.worldData.getName(), entityplayer.locX(), entityplayer.locY(), entityplayer.locZ()); + PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", entityplayer.getDisplayName().getString(), s1, entityplayer.getId(), worldserver1.worldDataServer.getName(), entityplayer.locX(), entityplayer.locY(), entityplayer.locZ()); } -@@ -392,6 +400,16 @@ public abstract class PlayerList { +@@ -422,6 +430,16 @@ public abstract class PlayerList { entityplayer.playerTick(); // SPIGOT-924 // CraftBukkit end + // Paper start - Remove from collideRule team if needed + if (this.collideRuleTeamName != null) { -+ final Scoreboard scoreBoard = this.server.getWorldServer(DimensionManager.OVERWORLD).getScoreboard(); ++ final Scoreboard scoreBoard = this.server.getWorldServer(World.OVERWORLD).getScoreboard(); + final ScoreboardTeam team = scoreBoard.getTeam(this.collideRuleTeamName); + if (entityplayer.getScoreboardTeam() == team && team != null) { + scoreBoard.removePlayerFromTeam(entityplayer.getName(), team); @@ -99,13 +99,13 @@ index c0c774d17b81109eaaea2ad726629eca902cfd6c..0f09cacf6d67dab5bc7962f19fcf3eba this.savePlayerFile(entityplayer); if (entityplayer.isPassenger()) { Entity entity = entityplayer.getRootVehicle(); -@@ -1018,6 +1036,13 @@ public abstract class PlayerList { +@@ -1059,6 +1077,13 @@ public abstract class PlayerList { } // CraftBukkit end + // Paper start - Remove collideRule team if it exists + if (this.collideRuleTeamName != null) { -+ final Scoreboard scoreboard = this.getServer().getWorldServer(DimensionManager.OVERWORLD).getScoreboard(); ++ final Scoreboard scoreboard = this.getServer().getWorldServer(World.OVERWORLD).getScoreboard(); + final ScoreboardTeam team = scoreboard.getTeam(this.collideRuleTeamName); + if (team != null) scoreboard.removeTeam(team); + } diff --git a/Spigot-Server-Patches/0089-Add-handshake-event-to-allow-plugins-to-handle-clien.patch b/Spigot-Server-Patches/0088-Add-handshake-event-to-allow-plugins-to-handle-clien.patch similarity index 63% rename from Spigot-Server-Patches/0089-Add-handshake-event-to-allow-plugins-to-handle-clien.patch rename to Spigot-Server-Patches/0088-Add-handshake-event-to-allow-plugins-to-handle-clien.patch index 84ebce0ad..bd37493f3 100644 --- a/Spigot-Server-Patches/0089-Add-handshake-event-to-allow-plugins-to-handle-clien.patch +++ b/Spigot-Server-Patches/0088-Add-handshake-event-to-allow-plugins-to-handle-clien.patch @@ -6,13 +6,22 @@ Subject: [PATCH] Add handshake event to allow plugins to handle client diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java -index 963dbd0648ea9295fe603bc683ffef0d2e22d62d..d0b9c6e3dcae76d802e095731c78fb9693982f90 100644 +index ba4e3177180f79b865140f29b6cb25156f9e96b1..c0e3d18b0a528d6bca878f354bf8b4b417522c29 100644 --- a/src/main/java/net/minecraft/server/HandshakeListener.java +++ b/src/main/java/net/minecraft/server/HandshakeListener.java +@@ -14,7 +14,7 @@ public class HandshakeListener implements PacketHandshakingInListener { + // CraftBukkit end + private static final IChatBaseComponent a = new ChatComponentText("Ignoring status request"); + private final MinecraftServer b; +- private final NetworkManager c; ++ private final NetworkManager c; final NetworkManager getNetworkManager() { return this.c; } // Paper - OBFHELPER + + public HandshakeListener(MinecraftServer minecraftserver, NetworkManager networkmanager) { + this.b = minecraftserver; @@ -73,8 +73,33 @@ public class HandshakeListener implements PacketHandshakingInListener { - this.b.close(chatmessage); + this.c.close(chatmessage); } else { - this.b.setPacketListener(new LoginListener(this.a, this.b)); + this.c.setPacketListener(new LoginListener(this.b, this.c)); + // Paper start - handshake event + boolean proxyLogicEnabled = org.spigotmc.SpigotConfig.bungee; + boolean handledByEvent = false; @@ -23,15 +32,15 @@ index 963dbd0648ea9295fe603bc683ffef0d2e22d62d..d0b9c6e3dcae76d802e095731c78fb96 + // If we've failed somehow, let the client know so and go no further. + if (event.isFailed()) { + chatmessage = new ChatMessage(event.getFailMessage()); -+ this.b.sendPacket(new PacketLoginOutDisconnect(chatmessage)); -+ this.b.close(chatmessage); ++ this.getNetworkManager().sendPacket(new PacketLoginOutDisconnect(chatmessage)); ++ this.getNetworkManager().close(chatmessage); + return; + } + + packethandshakinginsetprotocol.hostname = event.getServerHostname(); -+ this.b.socketAddress = new java.net.InetSocketAddress(event.getSocketAddressHostname(), ((java.net.InetSocketAddress) this.b.getSocketAddress()).getPort()); -+ this.b.spoofedUUID = event.getUniqueId(); -+ this.b.spoofedProfile = gson.fromJson(event.getPropertiesJson(), com.mojang.authlib.properties.Property[].class); ++ this.getNetworkManager().socketAddress = new java.net.InetSocketAddress(event.getSocketAddressHostname(), ((java.net.InetSocketAddress) this.getNetworkManager().getSocketAddress()).getPort()); ++ this.getNetworkManager().spoofedUUID = event.getUniqueId(); ++ this.getNetworkManager().spoofedProfile = gson.fromJson(event.getPropertiesJson(), com.mojang.authlib.properties.Property[].class); + handledByEvent = true; // Hooray, we did it! + } + } diff --git a/Spigot-Server-Patches/0090-Configurable-RCON-IP-address.patch b/Spigot-Server-Patches/0089-Configurable-RCON-IP-address.patch similarity index 75% rename from Spigot-Server-Patches/0090-Configurable-RCON-IP-address.patch rename to Spigot-Server-Patches/0089-Configurable-RCON-IP-address.patch index a32a2c1d3..76224288c 100644 --- a/Spigot-Server-Patches/0090-Configurable-RCON-IP-address.patch +++ b/Spigot-Server-Patches/0089-Configurable-RCON-IP-address.patch @@ -6,22 +6,22 @@ Subject: [PATCH] Configurable RCON IP address For servers with multiple IP's, ability to bind to a specific interface. diff --git a/src/main/java/net/minecraft/server/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/DedicatedServerProperties.java -index ad1e3508a736504399b525a6ea322d3292b870b7..0c3ec8357039035e63fe9e97ea5ceb952330ef6e 100644 +index 9dcf91c0505c759d841791c37834360b82df8a7e..1122861a8f9c12668e7bd9d65e63fc9166a66d1a 100644 --- a/src/main/java/net/minecraft/server/DedicatedServerProperties.java +++ b/src/main/java/net/minecraft/server/DedicatedServerProperties.java -@@ -54,6 +54,8 @@ public class DedicatedServerProperties extends PropertyManager.EditableProperty playerIdleTimeout; +@@ -55,6 +55,8 @@ public class DedicatedServerProperties extends PropertyManager.EditableProperty whiteList; + public final GeneratorSettings generatorSettings; + public final String rconIp; // Paper - Add rcon ip + // CraftBukkit start public DedicatedServerProperties(Properties properties, OptionSet optionset) { super(properties, optionset); -@@ -100,6 +102,10 @@ public class DedicatedServerProperties extends PropertyManager 0) { -@@ -208,10 +209,16 @@ public class BlockFire extends Block { +@@ -224,10 +225,16 @@ public class BlockFire extends BlockFireAbstract { } - private void a(World world, BlockPosition blockposition, int i, Random random, int j, BlockPosition sourceposition) { // CraftBukkit add sourceposition -- int k = this.i(world.getType(blockposition)); + private void trySpread(World world, BlockPosition blockposition, int i, Random random, int j, BlockPosition sourceposition) { // CraftBukkit add sourceposition +- int k = this.getBurnChance(world.getType(blockposition)); + // Paper start + final IBlockData iblockdata = world.getTypeIfLoaded(blockposition); + if (iblockdata == null) { + return; + } -+ int k = this.i(iblockdata); ++ int k = this.getBurnChance(iblockdata); + // Paper end if (random.nextInt(i) < k) { @@ -46,36 +46,35 @@ index 2909f78f87b3d8870740f166e82d5e97b0ebdd48..d32857c8724f97c7625208cf815c2752 // CraftBukkit start org.bukkit.block.Block theBlock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); -@@ -251,7 +258,7 @@ public class BlockFire extends Block { +@@ -273,7 +280,7 @@ public class BlockFire extends BlockFireAbstract { for (int j = 0; j < i; ++j) { EnumDirection enumdirection = aenumdirection[j]; -- if (this.h(iblockaccess.getType(blockposition.shift(enumdirection)))) { -+ if (this.h(iblockaccess.getTypeIfLoaded(blockposition.shift(enumdirection)))) { // Paper - prevent chunk loads +- if (this.e(iblockaccess.getType(blockposition.shift(enumdirection)))) { ++ if (this.e(iblockaccess.getTypeIfLoaded(blockposition.shift(enumdirection)))) { // Paper - prevent chunk loads return true; } } -@@ -269,8 +276,12 @@ public class BlockFire extends Block { +@@ -291,7 +298,12 @@ public class BlockFire extends BlockFireAbstract { for (int k = 0; k < j; ++k) { EnumDirection enumdirection = aenumdirection[k]; - IBlockData iblockdata = iworldreader.getType(blockposition.shift(enumdirection)); -- + // Paper start + IBlockData iblockdata = iworldreader.getTypeIfLoaded(blockposition.shift(enumdirection)); + if (iblockdata == null) { + continue; + } + // Paper end - i = Math.max(this.r(iblockdata), i); + + i = Math.max(this.getFlameChance(iblockdata), i); } +@@ -302,7 +314,7 @@ public class BlockFire extends BlockFireAbstract { -@@ -279,7 +290,7 @@ public class BlockFire extends Block { - } - - public boolean h(IBlockData iblockdata) { -- return this.r(iblockdata) > 0; -+ return iblockdata != null && this.r(iblockdata) > 0; // Paper - iblockdata can be nullable if chunk is unloaded now + @Override + protected boolean e(IBlockData iblockdata) { +- return this.getFlameChance(iblockdata) > 0; ++ return iblockdata != null && this.getFlameChance(iblockdata) > 0; // Paper - iblockdata can be nullable if chunk is unloaded now } @Override diff --git a/Spigot-Server-Patches/0092-Implement-PlayerLocaleChangeEvent.patch b/Spigot-Server-Patches/0091-Implement-PlayerLocaleChangeEvent.patch similarity index 61% rename from Spigot-Server-Patches/0092-Implement-PlayerLocaleChangeEvent.patch rename to Spigot-Server-Patches/0091-Implement-PlayerLocaleChangeEvent.patch index 6a8bc4729..636bb6550 100644 --- a/Spigot-Server-Patches/0092-Implement-PlayerLocaleChangeEvent.patch +++ b/Spigot-Server-Patches/0091-Implement-PlayerLocaleChangeEvent.patch @@ -5,45 +5,45 @@ Subject: [PATCH] Implement PlayerLocaleChangeEvent diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 540048627ef5716be2c9115b162a6eeaf9951ad9..aca885db36a8c93e32b3a2e40c407e4fdd5c97e4 100644 +index 7eb56761d9073156b30d4c981dcd4b4ba646f0bc..ab89e508ee8b8142fb7c0b5101b0b0e157a68f35 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -37,7 +37,7 @@ import org.bukkit.inventory.MainHand; - public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -1567,20 +1567,28 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + return s; + } - private static final Logger LOGGER = LogManager.getLogger(); -- public String locale = "en_us"; // CraftBukkit - lowercase +- public String locale = "en_us"; // CraftBukkit - add, lowercase + public String locale = null; // CraftBukkit - lowercase // Paper - default to null - public PlayerConnection playerConnection; - public final MinecraftServer server; - public final PlayerInteractManager playerInteractManager; -@@ -1467,13 +1467,20 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + public void a(PacketPlayInSettings packetplayinsettings) { + // CraftBukkit start + if (getMainHand() != packetplayinsettings.getMainHand()) { PlayerChangedMainHandEvent event = new PlayerChangedMainHandEvent(getBukkitEntity(), getMainHand() == EnumMainHand.LEFT ? MainHand.LEFT : MainHand.RIGHT); this.server.server.getPluginManager().callEvent(event); } -- if (!this.locale.equals(packetplayinsettings.b())) { -+ if (this.locale == null || !this.locale.equals(packetplayinsettings.b())) { // Paper - check for null - PlayerLocaleChangeEvent event = new PlayerLocaleChangeEvent(getBukkitEntity(), packetplayinsettings.b()); +- if (!this.locale.equals(packetplayinsettings.locale)) { ++ if (this.locale == null || !this.locale.equals(packetplayinsettings.locale)) { // Paper - check for null + PlayerLocaleChangeEvent event = new PlayerLocaleChangeEvent(getBukkitEntity(), packetplayinsettings.locale); this.server.server.getPluginManager().callEvent(event); } + this.locale = packetplayinsettings.locale; this.clientViewDistance = packetplayinsettings.viewDistance; // CraftBukkit end + // Paper start - add PlayerLocaleChangeEvent + // Since the field is initialized to null, this event should always fire the first time the packet is received + String oldLocale = this.locale; - this.locale = packetplayinsettings.b(); ++ this.locale = packetplayinsettings.locale; + if (!this.locale.equals(oldLocale)) { + new com.destroystokyo.paper.event.player.PlayerLocaleChangeEvent(this.getBukkitEntity(), oldLocale, this.locale).callEvent(); + } + // Paper end - this.ch = packetplayinsettings.d(); - this.ci = packetplayinsettings.e(); - this.getDataWatcher().set(EntityPlayer.bq, (byte) packetplayinsettings.f()); + this.cf = packetplayinsettings.d(); + this.cg = packetplayinsettings.e(); + this.getDataWatcher().set(EntityPlayer.bp, (byte) packetplayinsettings.f()); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index faff98ac698a5576ef4112a334e845a50d60b857..a85638fb4022361cb17cac0d666f26cdd1a5ef11 100644 +index 532698f80bb2e266f27ae1d4b70c80138560b8cc..9e9d054ed9d345eb7ab76ad9c3526889aeb220e3 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1732,8 +1732,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1797,8 +1797,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public String getLocale() { @@ -56,11 +56,3 @@ index faff98ac698a5576ef4112a334e845a50d60b857..a85638fb4022361cb17cac0d666f26cd } // Paper start -@@ -1820,7 +1822,6 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - } - } - -- @Override - public Set getHiddenPlayers() - { - Set ret = new HashSet(); diff --git a/Spigot-Server-Patches/0093-EntityRegainHealthEvent-isFastRegen-API.patch b/Spigot-Server-Patches/0092-EntityRegainHealthEvent-isFastRegen-API.patch similarity index 88% rename from Spigot-Server-Patches/0093-EntityRegainHealthEvent-isFastRegen-API.patch rename to Spigot-Server-Patches/0092-EntityRegainHealthEvent-isFastRegen-API.patch index e79c9532f..e55c1e1ad 100644 --- a/Spigot-Server-Patches/0093-EntityRegainHealthEvent-isFastRegen-API.patch +++ b/Spigot-Server-Patches/0092-EntityRegainHealthEvent-isFastRegen-API.patch @@ -6,10 +6,10 @@ Subject: [PATCH] EntityRegainHealthEvent isFastRegen API Don't even get me started diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 07c8f38f86a9d1eed95ccddb4c97892b555faf59..56c8b56b06a67e90c05f21c8141e61df7c9aafb1 100644 +index 374e4a3dcb656d6a84e05bb9260d3198a4243c05..9086712e1206a980a10c7cc36d3ae3a0b8f8bc79 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -924,10 +924,16 @@ public abstract class EntityLiving extends Entity { +@@ -1030,10 +1030,16 @@ public abstract class EntityLiving extends Entity { } public void heal(float f, EntityRegainHealthEvent.RegainReason regainReason) { @@ -28,7 +28,7 @@ index 07c8f38f86a9d1eed95ccddb4c97892b555faf59..56c8b56b06a67e90c05f21c8141e61df if (this.valid) { this.world.getServer().getPluginManager().callEvent(event); diff --git a/src/main/java/net/minecraft/server/FoodMetaData.java b/src/main/java/net/minecraft/server/FoodMetaData.java -index 01d702d5ca3b09460a53f612ffdcc08a69724d4f..c3a9a9bd458ade65211730237177b1dadb6d1269 100644 +index 59fe6bc503c8b0554330e8f800bee3b1562c3eb9..d618c3a0a7ce7b7e63f6844e22492b8ff333e1e4 100644 --- a/src/main/java/net/minecraft/server/FoodMetaData.java +++ b/src/main/java/net/minecraft/server/FoodMetaData.java @@ -69,7 +69,7 @@ public class FoodMetaData { diff --git a/Spigot-Server-Patches/0094-Add-ability-to-configure-frosted_ice-properties.patch b/Spigot-Server-Patches/0093-Add-ability-to-configure-frosted_ice-properties.patch similarity index 62% rename from Spigot-Server-Patches/0094-Add-ability-to-configure-frosted_ice-properties.patch rename to Spigot-Server-Patches/0093-Add-ability-to-configure-frosted_ice-properties.patch index 44ec2804b..ad1bf5bf2 100644 --- a/Spigot-Server-Patches/0094-Add-ability-to-configure-frosted_ice-properties.patch +++ b/Spigot-Server-Patches/0093-Add-ability-to-configure-frosted_ice-properties.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add ability to configure frosted_ice properties diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index b1d1a3c1f84e0d2153de257183687502c8f393d1..9e0c4895403a264f927292db2ac06b00731986e3 100644 +index 538e6751f3bda77ba32256158d2a6a25025b360c..fd3793c55b8021b9fc61ce6be585a8c9b477aba2 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -257,4 +257,14 @@ public class PaperWorldConfig { +@@ -252,4 +252,14 @@ public class PaperWorldConfig { private void useVanillaScoreboardColoring() { useVanillaScoreboardColoring = getBoolean("use-vanilla-world-scoreboard-name-coloring", false); } @@ -24,27 +24,24 @@ index b1d1a3c1f84e0d2153de257183687502c8f393d1..9e0c4895403a264f927292db2ac06b00 + } } diff --git a/src/main/java/net/minecraft/server/BlockIceFrost.java b/src/main/java/net/minecraft/server/BlockIceFrost.java -index af17aba8b8573b4f946e79a00a1443e6edc425a1..5e414138e4e542c16508d679e571aac72c082e7b 100644 +index 00e19300f7f0c9873ca7abb0560f3a9308d2a73d..061b157f66999a733c3c4e990371b6f8d7860de2 100644 --- a/src/main/java/net/minecraft/server/BlockIceFrost.java +++ b/src/main/java/net/minecraft/server/BlockIceFrost.java -@@ -13,6 +13,7 @@ public class BlockIceFrost extends BlockIce { +@@ -18,6 +18,7 @@ public class BlockIceFrost extends BlockIce { @Override - public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) { + public void tickAlways(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) { + if (!worldserver.paperConfig.frostedIceEnabled) return; // Paper - add ability to disable frosted ice if ((random.nextInt(3) == 0 || this.a(worldserver, blockposition, 4)) && worldserver.getLightLevel(blockposition) > 11 - (Integer) iblockdata.get(BlockIceFrost.a) - iblockdata.b((IBlockAccess) worldserver, blockposition) && this.e(iblockdata, (World) worldserver, blockposition)) { - BlockPosition.PooledBlockPosition blockposition_pooledblockposition = BlockPosition.PooledBlockPosition.r(); - Throwable throwable = null; -@@ -28,7 +29,7 @@ public class BlockIceFrost extends BlockIce { - IBlockData iblockdata1 = worldserver.getType(blockposition_pooledblockposition); + BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition(); + EnumDirection[] aenumdirection = EnumDirection.values(); +@@ -30,12 +31,12 @@ public class BlockIceFrost extends BlockIce { + IBlockData iblockdata1 = worldserver.getType(blockposition_mutableblockposition); - if (iblockdata1.getBlock() == this && !this.e(iblockdata1, (World) worldserver, blockposition_pooledblockposition)) { -- worldserver.getBlockTickList().a(blockposition_pooledblockposition, this, MathHelper.nextInt(random, 20, 40)); -+ worldserver.getBlockTickList().a(blockposition_pooledblockposition, this, MathHelper.nextInt(random, worldserver.paperConfig.frostedIceDelayMin, worldserver.paperConfig.frostedIceDelayMax)); // Paper - use configurable min/max delay - } + if (iblockdata1.a((Block) this) && !this.e(iblockdata1, (World) worldserver, blockposition_mutableblockposition)) { +- worldserver.getBlockTickList().a(blockposition_mutableblockposition, this, MathHelper.nextInt(random, 20, 40)); ++ worldserver.getBlockTickList().a(blockposition_mutableblockposition, this, MathHelper.nextInt(random, worldserver.paperConfig.frostedIceDelayMin, worldserver.paperConfig.frostedIceDelayMax)); // Paper - use configurable min/max delay } - } catch (Throwable throwable1) { -@@ -50,7 +51,7 @@ public class BlockIceFrost extends BlockIce { } } else { diff --git a/Spigot-Server-Patches/0095-remove-null-possibility-for-getServer-singleton.patch b/Spigot-Server-Patches/0094-remove-null-possibility-for-getServer-singleton.patch similarity index 50% rename from Spigot-Server-Patches/0095-remove-null-possibility-for-getServer-singleton.patch rename to Spigot-Server-Patches/0094-remove-null-possibility-for-getServer-singleton.patch index c9bf893e4..cfafb2692 100644 --- a/Spigot-Server-Patches/0095-remove-null-possibility-for-getServer-singleton.patch +++ b/Spigot-Server-Patches/0094-remove-null-possibility-for-getServer-singleton.patch @@ -6,26 +6,26 @@ Subject: [PATCH] remove null possibility for getServer singleton to stop IDE complaining about potential NPE diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index bd14edb06f7ce2560b600845df284e6c6860d699..d4434f10b879d9e2119b8adb6757b771e9df04f7 100644 +index 48511aac1493322803c49b36edea547810efc701..f449a9aa819fca1fa1db72b8a76a2f2a2739ff96 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -68,6 +68,7 @@ import org.spigotmc.SlackActivityAccountant; // Spigot +@@ -70,6 +70,7 @@ import org.spigotmc.SlackActivityAccountant; // Spigot - public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant implements IMojangStatistics, ICommandListener, AutoCloseable, Runnable { + public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant implements IMojangStatistics, ICommandListener, AutoCloseable { + private static MinecraftServer SERVER; // Paper public static final Logger LOGGER = LogManager.getLogger(); public static final File b = new File("usercache.json"); - private static final CompletableFuture i = CompletableFuture.completedFuture(Unit.INSTANCE); -@@ -178,6 +179,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant resourcepackrepository, Proxy proxy, DataFixer datafixer, DataPackResources datapackresources, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) { super("Server"); - this.ae = new ResourceManager(EnumResourcePackType.SERVER_DATA, this.serverThread); + SERVER = this; // Paper - better singleton - this.resourcePackRepository = new ResourcePackRepository<>(ResourcePackLoader::new); - this.craftingManager = new CraftingManager(); - this.tagRegistry = new TagRegistry(); -@@ -2189,7 +2191,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant l = Maps.newHashMap(); +@@ -36,6 +36,7 @@ public class WorldMap extends PersistentBase { + private final Map m = Maps.newHashMap(); public final Map decorations = Maps.newLinkedHashMap(); - private final Map m = Maps.newHashMap(); + private final Map n = Maps.newHashMap(); + private org.bukkit.craftbukkit.map.RenderData vanillaRender = new org.bukkit.craftbukkit.map.RenderData(); // Paper // CraftBukkit start public final CraftMapView mapView; -@@ -43,6 +44,7 @@ public class WorldMap extends PersistentBase { +@@ -48,6 +49,7 @@ public class WorldMap extends PersistentBase { // CraftBukkit start mapView = new CraftMapView(this); server = (CraftServer) org.bukkit.Bukkit.getServer(); @@ -50,14 +50,14 @@ index a56ac3da806035e853bb912ab874265ecbcd2753..2f1be1995d1a188da5be792abd7ac6f1 } @@ -115,6 +117,7 @@ public class WorldMap extends PersistentBase { - this.l.put(mapiconbanner.f(), mapiconbanner); - this.a(mapiconbanner.c(), (GeneratorAccess) null, mapiconbanner.f(), (double) mapiconbanner.a().getX(), (double) mapiconbanner.a().getZ(), 180.0D, mapiconbanner.d()); - } -+ vanillaRender.buffer = colors; // Paper + this.m.put(mapiconbanner.f(), mapiconbanner); + this.a(mapiconbanner.c(), (GeneratorAccess) null, mapiconbanner.f(), (double) mapiconbanner.a().getX(), (double) mapiconbanner.a().getZ(), 180.0D, mapiconbanner.d()); + } ++ this.vanillaRender.buffer = colors; // Paper - NBTTagList nbttaglist1 = nbttagcompound.getList("frames", 10); + NBTTagList nbttaglist1 = nbttagcompound.getList("frames", 10); -@@ -190,6 +193,7 @@ public class WorldMap extends PersistentBase { +@@ -195,6 +198,7 @@ public class WorldMap extends PersistentBase { this.b(); } @@ -65,7 +65,7 @@ index a56ac3da806035e853bb912ab874265ecbcd2753..2f1be1995d1a188da5be792abd7ac6f1 public void a(EntityHuman entityhuman, ItemStack itemstack) { if (!this.humans.containsKey(entityhuman)) { WorldMap.WorldMapHumanTracker worldmap_worldmaphumantracker = new WorldMap.WorldMapHumanTracker(entityhuman); -@@ -425,6 +429,21 @@ public class WorldMap extends PersistentBase { +@@ -430,6 +434,21 @@ public class WorldMap extends PersistentBase { public class WorldMapHumanTracker { @@ -87,7 +87,7 @@ index a56ac3da806035e853bb912ab874265ecbcd2753..2f1be1995d1a188da5be792abd7ac6f1 public final EntityHuman trackee; private boolean d = true; private int e; -@@ -441,9 +460,12 @@ public class WorldMap extends PersistentBase { +@@ -446,9 +465,12 @@ public class WorldMap extends PersistentBase { @Nullable public Packet a(ItemStack itemstack) { // CraftBukkit start @@ -102,10 +102,10 @@ index a56ac3da806035e853bb912ab874265ecbcd2753..2f1be1995d1a188da5be792abd7ac6f1 for ( org.bukkit.map.MapCursor cursor : render.cursors) { diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 532b5a4743fb2216ba3c1b61206cde4391275c8c..f3fe395d9e9b1332d51cd35b0cb20f606a4a481e 100644 +index 6bcead2505365ed2631cd991ac2dae99fff14f78..f99bb7f52254d7f052ecfce2b94da329a9d05eea 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1090,6 +1090,7 @@ public class WorldServer extends World { +@@ -1012,6 +1012,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { { if ( iter.next().trackee == entity ) { diff --git a/Spigot-Server-Patches/0097-LootTable-API-Replenishable-Lootables-Feature.patch b/Spigot-Server-Patches/0096-LootTable-API-Replenishable-Lootables-Feature.patch similarity index 95% rename from Spigot-Server-Patches/0097-LootTable-API-Replenishable-Lootables-Feature.patch rename to Spigot-Server-Patches/0096-LootTable-API-Replenishable-Lootables-Feature.patch index 9b607dcdb..89c32e083 100644 --- a/Spigot-Server-Patches/0097-LootTable-API-Replenishable-Lootables-Feature.patch +++ b/Spigot-Server-Patches/0096-LootTable-API-Replenishable-Lootables-Feature.patch @@ -11,10 +11,10 @@ This feature is good for long term worlds so that newer players do not suffer with "Every chest has been looted" diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 9e0c4895403a264f927292db2ac06b00731986e3..6db1312035807c04b98408100fb0a5c04c07aff4 100644 +index fd3793c55b8021b9fc61ce6be585a8c9b477aba2..05ea87a473228f5b386258fae3943f3f4561eaa6 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -267,4 +267,26 @@ public class PaperWorldConfig { +@@ -262,4 +262,26 @@ public class PaperWorldConfig { this.frostedIceDelayMax = this.getInt("frosted-ice.delay.max", this.frostedIceDelayMax); log("Frosted Ice: " + (this.frostedIceEnabled ? "enabled" : "disabled") + " / delay: min=" + this.frostedIceDelayMin + ", max=" + this.frostedIceDelayMax); } @@ -520,7 +520,7 @@ index 0000000000000000000000000000000000000000..d50410532c27bd2aa932c2a3f5765ca1 + } +} diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index d6fc93b5923096d3f092f561cbefdf26f2bbfb15..f90627a7f4c399f0515690b2709eaf8c7e884313 100644 +index b5625318ca6bfeeada2d3fb009b711685265ebaa..562f2e3e639a07852951081ea0887a9c582be6c5 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -73,6 +73,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -532,7 +532,7 @@ index d6fc93b5923096d3f092f561cbefdf26f2bbfb15..f90627a7f4c399f0515690b2709eaf8c public CraftEntity getBukkitEntity() { diff --git a/src/main/java/net/minecraft/server/EntityMinecartContainer.java b/src/main/java/net/minecraft/server/EntityMinecartContainer.java -index 34ceace23f82e2c0bbaaad01eaef0fd0045cf8e2..60efd439af8fa8ed46d81d703271aa945c19d77e 100644 +index 9a969d71b078ec67a442cc2df387ad633e0fb0f7..fca0fb871e276f3e571944e0354f3acd821e8e86 100644 --- a/src/main/java/net/minecraft/server/EntityMinecartContainer.java +++ b/src/main/java/net/minecraft/server/EntityMinecartContainer.java @@ -15,10 +15,11 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp @@ -550,8 +550,8 @@ index 34ceace23f82e2c0bbaaad01eaef0fd0045cf8e2..60efd439af8fa8ed46d81d703271aa94 @@ -169,12 +170,13 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp @Override - protected void b(NBTTagCompound nbttagcompound) { - super.b(nbttagcompound); + protected void saveData(NBTTagCompound nbttagcompound) { + super.saveData(nbttagcompound); + this.lootableData.saveNbt(nbttagcompound); // Paper if (this.lootTable != null) { nbttagcompound.setString("LootTable", this.lootTable.toString()); @@ -565,10 +565,10 @@ index 34ceace23f82e2c0bbaaad01eaef0fd0045cf8e2..60efd439af8fa8ed46d81d703271aa94 @@ -183,11 +185,12 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp @Override - protected void a(NBTTagCompound nbttagcompound) { - super.a(nbttagcompound); + protected void loadData(NBTTagCompound nbttagcompound) { + super.loadData(nbttagcompound); + this.lootableData.loadNbt(nbttagcompound); // Paper - this.items = NonNullList.a(this.getSize(), ItemStack.a); + this.items = NonNullList.a(this.getSize(), ItemStack.b); if (nbttagcompound.hasKeyOfType("LootTable", 8)) { this.lootTable = new MinecraftKey(nbttagcompound.getString("LootTable")); this.lootTableSeed = nbttagcompound.getLong("LootTableSeed"); @@ -577,7 +577,7 @@ index 34ceace23f82e2c0bbaaad01eaef0fd0045cf8e2..60efd439af8fa8ed46d81d703271aa94 ContainerUtil.b(nbttagcompound, this.items); } -@@ -213,10 +216,10 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp +@@ -213,7 +216,7 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp } public void d(@Nullable EntityHuman entityhuman) { @@ -585,13 +585,17 @@ index 34ceace23f82e2c0bbaaad01eaef0fd0045cf8e2..60efd439af8fa8ed46d81d703271aa94 + if (this.lootableData.shouldReplenish(entityhuman) && this.world.getMinecraftServer() != null) { // Paper LootTable loottable = this.world.getMinecraftServer().getLootTableRegistry().getLootTable(this.lootTable); -- this.lootTable = null; + if (entityhuman instanceof EntityPlayer) { +@@ -221,6 +224,7 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp + } + + this.lootTable = null; + this.lootableData.processRefill(entityhuman); // Paper - LootTableInfo.Builder loottableinfo_builder = (new LootTableInfo.Builder((WorldServer) this.world)).set(LootContextParameters.POSITION, new BlockPosition(this)).a(this.lootTableSeed); + LootTableInfo.Builder loottableinfo_builder = (new LootTableInfo.Builder((WorldServer) this.world)).set(LootContextParameters.POSITION, this.getChunkCoordinates()).a(this.lootTableSeed); if (entityhuman != null) { diff --git a/src/main/java/net/minecraft/server/TileEntityLootable.java b/src/main/java/net/minecraft/server/TileEntityLootable.java -index f5316a4045efdd6bffba226b4a6244961a8b245d..d4cbce3243fe1f4973c9c0ae0dbdab10e3390897 100644 +index 1eb43345bda9fa96d4f3383afb2fed1e998c9da6..5ebba482a65cfe6079484a99f016f968c59df8ee 100644 --- a/src/main/java/net/minecraft/server/TileEntityLootable.java +++ b/src/main/java/net/minecraft/server/TileEntityLootable.java @@ -6,8 +6,9 @@ import javax.annotation.Nullable; @@ -609,7 +613,7 @@ index f5316a4045efdd6bffba226b4a6244961a8b245d..d4cbce3243fe1f4973c9c0ae0dbdab10 @@ -23,16 +24,18 @@ public abstract class TileEntityLootable extends TileEntityContainer { } - protected boolean d(NBTTagCompound nbttagcompound) { + protected boolean b(NBTTagCompound nbttagcompound) { + this.lootableData.loadNbt(nbttagcompound); // Paper if (nbttagcompound.hasKeyOfType("LootTable", 8)) { this.lootTable = new MinecraftKey(nbttagcompound.getString("LootTable")); @@ -621,12 +625,12 @@ index f5316a4045efdd6bffba226b4a6244961a8b245d..d4cbce3243fe1f4973c9c0ae0dbdab10 } } - protected boolean e(NBTTagCompound nbttagcompound) { + protected boolean c(NBTTagCompound nbttagcompound) { + this.lootableData.saveNbt(nbttagcompound); // Paper if (this.lootTable == null) { return false; } else { -@@ -41,15 +44,15 @@ public abstract class TileEntityLootable extends TileEntityContainer { +@@ -41,12 +44,12 @@ public abstract class TileEntityLootable extends TileEntityContainer { nbttagcompound.setLong("LootTableSeed", this.lootTableSeed); } @@ -640,13 +644,17 @@ index f5316a4045efdd6bffba226b4a6244961a8b245d..d4cbce3243fe1f4973c9c0ae0dbdab10 + if (this.lootableData.shouldReplenish(entityhuman) && this.world.getMinecraftServer() != null) { // Paper LootTable loottable = this.world.getMinecraftServer().getLootTableRegistry().getLootTable(this.lootTable); -- this.lootTable = null; + if (entityhuman instanceof EntityPlayer) { +@@ -54,6 +57,7 @@ public abstract class TileEntityLootable extends TileEntityContainer { + } + + this.lootTable = null; + this.lootableData.processRefill(entityhuman); // Paper LootTableInfo.Builder loottableinfo_builder = (new LootTableInfo.Builder((WorldServer) this.world)).set(LootContextParameters.POSITION, new BlockPosition(this.position)).a(this.lootTableSeed); if (entityhuman != null) { diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java -index 2831419446f4bd531f614f59308c8f5b61933507..17d80b5c6e512e0c582b05c92bb795b004ba27c2 100644 +index da5a80267b189d75374375211a574ca5f18d96be..26cc40e57f5b73b9c32859bff37c4a3d94904c56 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java @@ -64,7 +64,7 @@ public class CraftBlockEntityState extends CraftBlockState diff --git a/Spigot-Server-Patches/0098-Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch b/Spigot-Server-Patches/0097-Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch similarity index 86% rename from Spigot-Server-Patches/0098-Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch rename to Spigot-Server-Patches/0097-Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch index 0bade466a..3ee4b62f0 100644 --- a/Spigot-Server-Patches/0098-Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch +++ b/Spigot-Server-Patches/0097-Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Don't save empty scoreboard teams to scoreboard.dat diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index e4f0db64c061af684c28f50f0a37fbca693af7be..67f35fe66b33a4b461a310b6ce4fdedb5eaf1ac4 100644 +index 3d9a98936cfe933fd71fb82f07e1ba54d5d35800..6fbf9ab53c8b7fab93b55d815060033f945d56cd 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -228,4 +228,9 @@ public class PaperConfig { +@@ -229,4 +229,9 @@ public class PaperConfig { private static void enablePlayerCollisions() { enablePlayerCollisions = getBoolean("settings.enable-player-collisions", true); } @@ -19,7 +19,7 @@ index e4f0db64c061af684c28f50f0a37fbca693af7be..67f35fe66b33a4b461a310b6ce4fdedb + } } diff --git a/src/main/java/net/minecraft/server/PersistentScoreboard.java b/src/main/java/net/minecraft/server/PersistentScoreboard.java -index 1eab0c310d330ce37658bffb24e519c51cb24dbf..6bf66972f9ea2c3c9ee53a904a753453ebf0a69e 100644 +index 17bb9512e65f1a158efdc39813b04159000d9b33..a08c54da92d87fcd24ef8e2556901d3b1977c5ea 100644 --- a/src/main/java/net/minecraft/server/PersistentScoreboard.java +++ b/src/main/java/net/minecraft/server/PersistentScoreboard.java @@ -174,6 +174,7 @@ public class PersistentScoreboard extends PersistentBase { diff --git a/Spigot-Server-Patches/0099-System-property-for-disabling-watchdoge.patch b/Spigot-Server-Patches/0098-System-property-for-disabling-watchdoge.patch similarity index 100% rename from Spigot-Server-Patches/0099-System-property-for-disabling-watchdoge.patch rename to Spigot-Server-Patches/0098-System-property-for-disabling-watchdoge.patch diff --git a/Spigot-Server-Patches/0100-Optimize-UserCache-Thread-Safe.patch b/Spigot-Server-Patches/0099-Optimize-UserCache-Thread-Safe.patch similarity index 88% rename from Spigot-Server-Patches/0100-Optimize-UserCache-Thread-Safe.patch rename to Spigot-Server-Patches/0099-Optimize-UserCache-Thread-Safe.patch index fcaa937b2..5002a754a 100644 --- a/Spigot-Server-Patches/0100-Optimize-UserCache-Thread-Safe.patch +++ b/Spigot-Server-Patches/0099-Optimize-UserCache-Thread-Safe.patch @@ -10,10 +10,10 @@ Additionally, move Saving of the User cache to be done async, incase the user never changed the default setting for Spigot's save on stop only. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index d4434f10b879d9e2119b8adb6757b771e9df04f7..629304c403c596bf81dd8de919f0fcb5c77bd403 100644 +index f449a9aa819fca1fa1db72b8a76a2f2a2739ff96..793d4d928bac4febf090291eb773871b492cdc6d 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -763,7 +763,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant f = new java.util.concurrent.LinkedBlockingDeque(); // CraftBukkit private final GameProfileRepository g; protected final Gson b; -@@ -108,7 +108,7 @@ public class UserCache { +@@ -97,7 +97,7 @@ public class UserCache { this.a(gameprofile, (Date) null); } @@ -46,7 +46,7 @@ index 65659996c3a137f55e5900bf5919983ff4e77724..d32bec70d0c03f8d0e8888e754463772 UUID uuid = gameprofile.getId(); if (date == null) { -@@ -121,8 +121,9 @@ public class UserCache { +@@ -110,8 +110,9 @@ public class UserCache { UserCache.UserCacheEntry usercache_usercacheentry = new UserCache.UserCacheEntry(gameprofile, date); @@ -57,7 +57,7 @@ index 65659996c3a137f55e5900bf5919983ff4e77724..d32bec70d0c03f8d0e8888e754463772 this.d.remove(usercache_usercacheentry1.a().getName().toLowerCase(Locale.ROOT)); this.f.remove(gameprofile); -@@ -135,7 +136,7 @@ public class UserCache { +@@ -124,7 +125,7 @@ public class UserCache { } @Nullable @@ -66,7 +66,7 @@ index 65659996c3a137f55e5900bf5919983ff4e77724..d32bec70d0c03f8d0e8888e754463772 String s1 = s.toLowerCase(Locale.ROOT); UserCache.UserCacheEntry usercache_usercacheentry = (UserCache.UserCacheEntry) this.d.get(s1); -@@ -220,8 +221,15 @@ public class UserCache { +@@ -209,8 +210,15 @@ public class UserCache { } @@ -82,7 +82,7 @@ index 65659996c3a137f55e5900bf5919983ff4e77724..d32bec70d0c03f8d0e8888e754463772 BufferedWriter bufferedwriter = null; try { -@@ -235,6 +243,14 @@ public class UserCache { +@@ -224,6 +232,14 @@ public class UserCache { } finally { IOUtils.closeQuietly(bufferedwriter); } diff --git a/Spigot-Server-Patches/0101-Avoid-blocking-on-Network-Manager-creation.patch b/Spigot-Server-Patches/0100-Avoid-blocking-on-Network-Manager-creation.patch similarity index 91% rename from Spigot-Server-Patches/0101-Avoid-blocking-on-Network-Manager-creation.patch rename to Spigot-Server-Patches/0100-Avoid-blocking-on-Network-Manager-creation.patch index d7136ee98..0ef8f2f37 100644 --- a/Spigot-Server-Patches/0101-Avoid-blocking-on-Network-Manager-creation.patch +++ b/Spigot-Server-Patches/0100-Avoid-blocking-on-Network-Manager-creation.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Avoid blocking on Network Manager creation Per Paper issue 294 diff --git a/src/main/java/net/minecraft/server/ServerConnection.java b/src/main/java/net/minecraft/server/ServerConnection.java -index e7e216850894e764a3b5d92bf86d5a530a0fa503..37a22ba6f7a2ac54759428d23d5ea9787bb557f7 100644 +index 6e7c5756a2338f5e901fff0e75fa42a494a2e8ee..7abb122943b8a5ce0e888d16d1592a127bb9bb6f 100644 --- a/src/main/java/net/minecraft/server/ServerConnection.java +++ b/src/main/java/net/minecraft/server/ServerConnection.java -@@ -39,6 +39,15 @@ public class ServerConnection { +@@ -38,6 +38,15 @@ public class ServerConnection { public volatile boolean c; private final List listeningChannels = Collections.synchronizedList(Lists.newArrayList()); private final List connectedChannels = Collections.synchronizedList(Lists.newArrayList()); @@ -25,7 +25,7 @@ index e7e216850894e764a3b5d92bf86d5a530a0fa503..37a22ba6f7a2ac54759428d23d5ea978 public ServerConnection(MinecraftServer minecraftserver) { this.e = minecraftserver; -@@ -73,7 +82,7 @@ public class ServerConnection { +@@ -72,7 +81,7 @@ public class ServerConnection { channel.pipeline().addLast("timeout", new ReadTimeoutHandler(30)).addLast("legacy_query", new LegacyPingHandler(ServerConnection.this)).addLast("splitter", new PacketSplitter()).addLast("decoder", new PacketDecoder(EnumProtocolDirection.SERVERBOUND)).addLast("prepender", new PacketPrepender()).addLast("encoder", new PacketEncoder(EnumProtocolDirection.CLIENTBOUND)); NetworkManager networkmanager = new NetworkManager(EnumProtocolDirection.SERVERBOUND); @@ -34,7 +34,7 @@ index e7e216850894e764a3b5d92bf86d5a530a0fa503..37a22ba6f7a2ac54759428d23d5ea978 channel.pipeline().addLast("packet_handler", networkmanager); networkmanager.setPacketListener(new HandshakeListener(ServerConnection.this.e, networkmanager)); } -@@ -112,6 +121,7 @@ public class ServerConnection { +@@ -111,6 +120,7 @@ public class ServerConnection { synchronized (this.connectedChannels) { // Spigot Start diff --git a/Spigot-Server-Patches/0102-Optional-TNT-doesn-t-move-in-water.patch b/Spigot-Server-Patches/0101-Optional-TNT-doesn-t-move-in-water.patch similarity index 84% rename from Spigot-Server-Patches/0102-Optional-TNT-doesn-t-move-in-water.patch rename to Spigot-Server-Patches/0101-Optional-TNT-doesn-t-move-in-water.patch index be859d9db..e28762220 100644 --- a/Spigot-Server-Patches/0102-Optional-TNT-doesn-t-move-in-water.patch +++ b/Spigot-Server-Patches/0101-Optional-TNT-doesn-t-move-in-water.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Optional TNT doesn't move in water diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 6db1312035807c04b98408100fb0a5c04c07aff4..8cf3076f4e0d8d7e81158881c763f89ebda7e678 100644 +index 05ea87a473228f5b386258fae3943f3f4561eaa6..ac76bdd7e1d91b0d242539c4495948cdfbb622e0 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -2,7 +2,6 @@ package com.destroystokyo.paper; @@ -16,7 +16,7 @@ index 6db1312035807c04b98408100fb0a5c04c07aff4..8cf3076f4e0d8d7e81158881c763f89e import org.bukkit.configuration.file.YamlConfiguration; import org.spigotmc.SpigotWorldConfig; -@@ -289,4 +288,14 @@ public class PaperWorldConfig { +@@ -284,4 +283,14 @@ public class PaperWorldConfig { ); } } @@ -32,24 +32,23 @@ index 6db1312035807c04b98408100fb0a5c04c07aff4..8cf3076f4e0d8d7e81158881c763f89e + } } diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index f90627a7f4c399f0515690b2709eaf8c7e884313..3f1dbca881ce19a633fc7c20d26d1a25b550edf7 100644 +index 562f2e3e639a07852951081ea0887a9c582be6c5..14351cc9e60a0b8d33d319da9d473e74072767d7 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -2721,6 +2721,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -2652,6 +2652,11 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke } - public boolean bM() { + public boolean bU() { + // Paper start + return this.pushedByWater(); + } -+ + public boolean pushedByWater() { + // Paper end return true; } diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java -index 7f8b8f5a365d44f03cb4dd60a7403721f9859446..9c31edade247baac6811ef3ec98e88a332bcffba 100644 +index 0f4923bce392c8e46f6b256f47d23e15b08e6d62..00b95dcb80dd2510e7448c03f38cd84a50c6526a 100644 --- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java +++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java @@ -80,7 +80,27 @@ public class EntityTNTPrimed extends Entity { @@ -64,7 +63,7 @@ index 7f8b8f5a365d44f03cb4dd60a7403721f9859446..9c31edade247baac6811ef3ec98e88a3 + */ + // Send position and velocity updates to nearby players on every tick while the TNT is in water. + // This does pretty well at keeping their clients in sync with the server. -+ PlayerChunkMap.EntityTracker ete = this.tracker; ++ PlayerChunkMap.EntityTracker ete = ((WorldServer)this.world).getChunkProvider().playerChunkMap.trackedEntities.get(this.getId()); + if (ete != null) { + PacketPlayOutEntityVelocity velocityPacket = new PacketPlayOutEntityVelocity(this); + PacketPlayOutEntityTeleport positionPacket = new PacketPlayOutEntityTeleport(this); @@ -82,7 +81,7 @@ index 7f8b8f5a365d44f03cb4dd60a7403721f9859446..9c31edade247baac6811ef3ec98e88a3 private void explode() { @@ -149,4 +169,11 @@ public class EntityTNTPrimed extends Entity { - public Packet L() { + public Packet O() { return new PacketPlayOutSpawnEntity(this); } + @@ -94,10 +93,10 @@ index 7f8b8f5a365d44f03cb4dd60a7403721f9859446..9c31edade247baac6811ef3ec98e88a3 + // Paper end } diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -index a13fd9b3404381879663c1f694a5d1903d1fd884..3ff7a7b4a853068eba2fb034246a58116a846523 100644 +index 10821c2b631b4c0e91abb0b05cfc696f1fda36c0..b5a76f37c27cde25b2561a23c7c0fe7bdd992fee 100644 --- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java +++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -@@ -36,7 +36,7 @@ public class EntityTrackerEntry { +@@ -38,7 +38,7 @@ public class EntityTrackerEntry { private boolean q; private boolean r; // CraftBukkit start diff --git a/Spigot-Server-Patches/0103-Faster-redstone-torch-rapid-clock-removal.patch b/Spigot-Server-Patches/0102-Faster-redstone-torch-rapid-clock-removal.patch similarity index 74% rename from Spigot-Server-Patches/0103-Faster-redstone-torch-rapid-clock-removal.patch rename to Spigot-Server-Patches/0102-Faster-redstone-torch-rapid-clock-removal.patch index 2f5565d73..4b90659fc 100644 --- a/Spigot-Server-Patches/0103-Faster-redstone-torch-rapid-clock-removal.patch +++ b/Spigot-Server-Patches/0102-Faster-redstone-torch-rapid-clock-removal.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Faster redstone torch rapid clock removal Only resize the the redstone torch list once, since resizing arrays / lists is costly diff --git a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java -index 98a255ae578d4cdc6c0081c5fe7991a8a9b574f2..4c3062ece97409056b614cf36fefea22ad22864d 100644 +index d88d435b7777f731bc0bb728ebe4d4cb31c6376e..a63a60348fe45f63deec6fcb27b6be09cd2f088c 100644 --- a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java +++ b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java @@ -11,7 +11,7 @@ import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit @@ -16,29 +16,29 @@ index 98a255ae578d4cdc6c0081c5fe7991a8a9b574f2..4c3062ece97409056b614cf36fefea22 - private static final Map> b = new WeakHashMap(); + // Paper - Move the mapped list to World - protected BlockRedstoneTorch(Block.Info block_info) { - super(block_info); -@@ -66,11 +66,16 @@ public class BlockRedstoneTorch extends BlockTorch { - } - - public static void a(IBlockData iblockdata, World world, BlockPosition blockposition, Random random, boolean flag) { -- List list = (List) BlockRedstoneTorch.b.get(world); -+ // Paper start -+ java.util.ArrayDeque redstoneUpdateInfos = world.redstoneUpdateInfos; - -- while (list != null && !list.isEmpty() && world.getTime() - ((BlockRedstoneTorch.RedstoneUpdateInfo) list.get(0)).b > 60L) { + protected BlockRedstoneTorch(BlockBase.Info blockbase_info) { + super(blockbase_info, ParticleParamRedstone.a); +@@ -58,11 +58,15 @@ public class BlockRedstoneTorch extends BlockTorch { + @Override + public void tickAlways(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) { + boolean flag = this.a((World) worldserver, blockposition, iblockdata); +- List list = (List) BlockRedstoneTorch.b.get(worldserver); +- +- while (list != null && !list.isEmpty() && worldserver.getTime() - ((BlockRedstoneTorch.RedstoneUpdateInfo) list.get(0)).b > 60L) { - list.remove(0); ++ // Paper start ++ java.util.ArrayDeque redstoneUpdateInfos = worldserver.redstoneUpdateInfos; + if (redstoneUpdateInfos != null) { + BlockRedstoneTorch.RedstoneUpdateInfo curr; -+ while ((curr = redstoneUpdateInfos.peek()) != null && world.getTime() - curr.getTime() > 60L) { ++ while ((curr = redstoneUpdateInfos.peek()) != null && worldserver.getTime() - curr.getTime() > 60L) { + redstoneUpdateInfos.poll(); + } } + // Paper end // CraftBukkit start - org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager(); -@@ -140,9 +145,12 @@ public class BlockRedstoneTorch extends BlockTorch { + org.bukkit.plugin.PluginManager manager = worldserver.getServer().getPluginManager(); +@@ -127,9 +131,12 @@ public class BlockRedstoneTorch extends BlockTorch { } private static boolean a(World world, BlockPosition blockposition, boolean flag) { @@ -54,7 +54,7 @@ index 98a255ae578d4cdc6c0081c5fe7991a8a9b574f2..4c3062ece97409056b614cf36fefea22 if (flag) { list.add(new BlockRedstoneTorch.RedstoneUpdateInfo(blockposition.immutableCopy(), world.getTime())); -@@ -150,9 +158,9 @@ public class BlockRedstoneTorch extends BlockTorch { +@@ -137,9 +144,9 @@ public class BlockRedstoneTorch extends BlockTorch { int i = 0; @@ -67,7 +67,7 @@ index 98a255ae578d4cdc6c0081c5fe7991a8a9b574f2..4c3062ece97409056b614cf36fefea22 if (blockredstonetorch_redstoneupdateinfo.a.equals(blockposition)) { ++i; if (i >= 8) { -@@ -167,7 +175,7 @@ public class BlockRedstoneTorch extends BlockTorch { +@@ -154,7 +161,7 @@ public class BlockRedstoneTorch extends BlockTorch { public static class RedstoneUpdateInfo { private final BlockPosition a; @@ -77,10 +77,10 @@ index 98a255ae578d4cdc6c0081c5fe7991a8a9b574f2..4c3062ece97409056b614cf36fefea22 public RedstoneUpdateInfo(BlockPosition blockposition, long i) { this.a = blockposition; diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index a3de9ae44acb3736394ac97c730d1b1cc2d5b914..fd8724c755d4129c0f3fbd6e0730def09dba1e55 100644 +index bd7214e4679044461f141f3000f1dab648a24051..87a0e66029e10a22ea6e681c7d1e143b9bc5c2c8 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -84,6 +84,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -90,6 +90,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { private org.spigotmc.TickLimiter tileLimiter; private int tileTickPosition; public final Map explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions diff --git a/Spigot-Server-Patches/0104-Add-server-name-parameter.patch b/Spigot-Server-Patches/0103-Add-server-name-parameter.patch similarity index 90% rename from Spigot-Server-Patches/0104-Add-server-name-parameter.patch rename to Spigot-Server-Patches/0103-Add-server-name-parameter.patch index 0d4fa9b3a..d25dd6763 100644 --- a/Spigot-Server-Patches/0104-Add-server-name-parameter.patch +++ b/Spigot-Server-Patches/0103-Add-server-name-parameter.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add server-name parameter diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 1ee40506095ed14f50b4b8031bb882e9bea475b5..afbe711acbd1cbaf307513d4fede44bb17b3caae 100644 +index a111987658a6d89fc3fe970b1db37a7f3517b9bd..b1157195cf00a05d3417bccf781fdf58ff9919b6 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -137,6 +137,14 @@ public class Main { diff --git a/Spigot-Server-Patches/0104-Only-send-Dragon-Wither-Death-sounds-to-same-world.patch b/Spigot-Server-Patches/0104-Only-send-Dragon-Wither-Death-sounds-to-same-world.patch new file mode 100644 index 000000000..b12ddb26a --- /dev/null +++ b/Spigot-Server-Patches/0104-Only-send-Dragon-Wither-Death-sounds-to-same-world.patch @@ -0,0 +1,39 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Tue, 31 May 2016 22:53:50 -0400 +Subject: [PATCH] Only send Dragon/Wither Death sounds to same world + +Also fix view distance lookup + +diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java +index d335eb7898dc3a2b1553157d35050112f7b7a426..72a9430789301b264a36c5060ded31ccdc4a1ebf 100644 +--- a/src/main/java/net/minecraft/server/EntityEnderDragon.java ++++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java +@@ -570,8 +570,9 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster { + if (this.deathAnimationTicks == 1 && !this.isSilent()) { + // CraftBukkit start - Use relative location for far away sounds + // this.world.b(1028, this.getChunkCoordinates(), 0); +- int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16; +- for (EntityPlayer player : (List) MinecraftServer.getServer().getPlayerList().players) { ++ //int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API ++ for (EntityPlayer player : (List) ((WorldServer)world).getPlayers()) { ++ final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch + double deltaX = this.locX() - player.locX(); + double deltaZ = this.locZ() - player.locZ(); + double distanceSquared = deltaX * deltaX + deltaZ * deltaZ; +diff --git a/src/main/java/net/minecraft/server/EntityWither.java b/src/main/java/net/minecraft/server/EntityWither.java +index 1d725c152a2f96dd12fc3c4e25e142129a783e1b..9331f96f68f121b41ce74904d624520291b7c72e 100644 +--- a/src/main/java/net/minecraft/server/EntityWither.java ++++ b/src/main/java/net/minecraft/server/EntityWither.java +@@ -208,8 +208,9 @@ public class EntityWither extends EntityMonster implements IRangedEntity { + if (!this.isSilent()) { + // CraftBukkit start - Use relative location for far away sounds + // this.world.b(1023, new BlockPosition(this), 0); +- int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16; +- for (EntityPlayer player : (List) MinecraftServer.getServer().getPlayerList().players) { ++ //int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API ++ for (EntityPlayer player : (List)this.world.getPlayers()) { ++ final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch + double deltaX = this.locX() - player.locX(); + double deltaZ = this.locZ() - player.locZ(); + double distanceSquared = deltaX * deltaX + deltaZ * deltaZ; diff --git a/Spigot-Server-Patches/0106-Fix-Double-World-Add-issues.patch b/Spigot-Server-Patches/0105-Fix-Double-World-Add-issues.patch similarity index 85% rename from Spigot-Server-Patches/0106-Fix-Double-World-Add-issues.patch rename to Spigot-Server-Patches/0105-Fix-Double-World-Add-issues.patch index b364401ac..40be58081 100644 --- a/Spigot-Server-Patches/0106-Fix-Double-World-Add-issues.patch +++ b/Spigot-Server-Patches/0105-Fix-Double-World-Add-issues.patch @@ -8,10 +8,10 @@ Vanilla will double add Spider Jockeys to the world, so ignore already added. Also add debug if something else tries to, and abort before world gets bad state diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index f3fe395d9e9b1332d51cd35b0cb20f606a4a481e..aae3d51288a257f42e773cde052bee52fc1ca238 100644 +index f99bb7f52254d7f052ecfce2b94da329a9d05eea..b68338310106858195099bb45b8bf4da723b8439 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -997,6 +997,7 @@ public class WorldServer extends World { +@@ -919,6 +919,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { // CraftBukkit start private boolean addEntity0(Entity entity, CreatureSpawnEvent.SpawnReason spawnReason) { org.spigotmc.AsyncCatcher.catchOp("entity add"); // Spigot diff --git a/Spigot-Server-Patches/0105-Only-send-Dragon-Wither-Death-sounds-to-same-world.patch b/Spigot-Server-Patches/0105-Only-send-Dragon-Wither-Death-sounds-to-same-world.patch deleted file mode 100644 index 90eea7b3c..000000000 --- a/Spigot-Server-Patches/0105-Only-send-Dragon-Wither-Death-sounds-to-same-world.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Tue, 31 May 2016 22:53:50 -0400 -Subject: [PATCH] Only send Dragon/Wither Death sounds to same world - -Also fix view distance lookup - -diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java -index d4fd58414c98a0ba10bbea7fc0ecef44e8ac8d60..87625776963d6143d570cda8e72fda6b3f50047f 100644 ---- a/src/main/java/net/minecraft/server/EntityEnderDragon.java -+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java -@@ -572,8 +572,11 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster { - if (this.bA == 1) { - // CraftBukkit start - Use relative location for far away sounds - // this.world.b(1028, new BlockPosition(this), 0); -- int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16; -- for (EntityPlayer player : (List) MinecraftServer.getServer().getPlayerList().players) { -+ // Paper start -+ //int viewDistance = ((WorldServer) this.world).spigotConfig.viewDistance * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API -+ for (EntityPlayer player : ((WorldServer)world).getPlayers()) { -+ final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch -+ // Paper end - double deltaX = this.locX() - player.locX(); - double deltaZ = this.locZ() - player.locZ(); - double distanceSquared = deltaX * deltaX + deltaZ * deltaZ; -diff --git a/src/main/java/net/minecraft/server/EntityWither.java b/src/main/java/net/minecraft/server/EntityWither.java -index 2edf466ee24841cf1cc3b6a8c896ea82f09c17fd..2e95069c1907df951680f2a00441a72500c48430 100644 ---- a/src/main/java/net/minecraft/server/EntityWither.java -+++ b/src/main/java/net/minecraft/server/EntityWither.java -@@ -207,8 +207,11 @@ public class EntityWither extends EntityMonster implements IRangedEntity { - - // CraftBukkit start - Use relative location for far away sounds - // this.world.b(1023, new BlockPosition(this), 0); -- int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16; -- for (EntityPlayer player : (List) MinecraftServer.getServer().getPlayerList().players) { -+ // Paper start -+ //int viewDistance = ((WorldServer) this.world).spigotConfig.viewDistance * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API -+ for (EntityPlayer player : ((WorldServer)world).getPlayers()) { -+ final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch -+ // Paper end - double deltaX = this.locX() - player.locX(); - double deltaZ = this.locZ() - player.locZ(); - double distanceSquared = deltaX * deltaX + deltaZ * deltaZ; diff --git a/Spigot-Server-Patches/0107-Fix-Old-Sign-Conversion.patch b/Spigot-Server-Patches/0106-Fix-Old-Sign-Conversion.patch similarity index 70% rename from Spigot-Server-Patches/0107-Fix-Old-Sign-Conversion.patch rename to Spigot-Server-Patches/0106-Fix-Old-Sign-Conversion.patch index 9a5e3b777..02c51f9ac 100644 --- a/Spigot-Server-Patches/0107-Fix-Old-Sign-Conversion.patch +++ b/Spigot-Server-Patches/0106-Fix-Old-Sign-Conversion.patch @@ -9,15 +9,15 @@ Subject: [PATCH] Fix Old Sign Conversion This causes Igloos and such to render broken signs. We fix this by ignoring sign conversion for Defined Structures diff --git a/src/main/java/net/minecraft/server/DefinedStructure.java b/src/main/java/net/minecraft/server/DefinedStructure.java -index dad966825d988f275ed30c6f8f80d54d12d35c66..8c411ff074425138dd21f1577d8ecd19c355fb93 100644 +index 637632b1324e2cdc80cecc4a5a94dc9379312f30..05aae52e662f7effbfb358a5fa6e33c3c4d86001 100644 --- a/src/main/java/net/minecraft/server/DefinedStructure.java +++ b/src/main/java/net/minecraft/server/DefinedStructure.java -@@ -203,9 +203,11 @@ public class DefinedStructure { - definedstructure_blockinfo.c.setInt("x", blockposition1.getX()); - definedstructure_blockinfo.c.setInt("y", blockposition1.getY()); - definedstructure_blockinfo.c.setInt("z", blockposition1.getZ()); +@@ -242,9 +242,11 @@ public class DefinedStructure { + definedstructure_blockinfo.c.setLong("LootTableSeed", random.nextLong()); + } + + tileentity.isLoadingStructure = true; // Paper - tileentity.load(definedstructure_blockinfo.c); + tileentity.load(definedstructure_blockinfo.b, definedstructure_blockinfo.c); tileentity.a(definedstructureinfo.c()); tileentity.a(definedstructureinfo.d()); + tileentity.isLoadingStructure = false; // Paper @@ -25,7 +25,7 @@ index dad966825d988f275ed30c6f8f80d54d12d35c66..8c411ff074425138dd21f1577d8ecd19 } diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index e2f3cec7420edbd284b531ca7d1d121459fc098c..630b279158f26902ebdcc6e5c810b189ce49c910 100644 +index 534295965ee701611b5e12a10f14a69e8226376a..5e5bb5aaa3d8f4e8f4b00ba8bee059ec79f82b43 100644 --- a/src/main/java/net/minecraft/server/TileEntity.java +++ b/src/main/java/net/minecraft/server/TileEntity.java @@ -20,6 +20,7 @@ public abstract class TileEntity implements KeyedObject { // Paper @@ -37,15 +37,15 @@ index e2f3cec7420edbd284b531ca7d1d121459fc098c..630b279158f26902ebdcc6e5c810b189 @Nullable protected World world; diff --git a/src/main/java/net/minecraft/server/TileEntitySign.java b/src/main/java/net/minecraft/server/TileEntitySign.java -index 4a48c09e96ec5c2002ba297870ee5f06191f95f2..03f6ddf0003f0ef44ede31cf7a3491580ff0b5de 100644 +index b7b7d8966ed3390cb828cdd08e4e12d75024d784..8e77c662f7d970d8ff86f6c5b9bccc598442594d 100644 --- a/src/main/java/net/minecraft/server/TileEntitySign.java +++ b/src/main/java/net/minecraft/server/TileEntitySign.java -@@ -55,13 +55,14 @@ public class TileEntitySign extends TileEntity implements ICommandListener { // +@@ -59,13 +59,14 @@ public class TileEntitySign extends TileEntity implements ICommandListener { // } try { -- IChatBaseComponent ichatbasecomponent = IChatBaseComponent.ChatSerializer.a(s.isEmpty() ? "\"\"" : s); -+ //IChatBaseComponent ichatbasecomponent = IChatBaseComponent.ChatSerializer.a(s.isEmpty() ? "\"\"" : s); // Paper - move down - the old format might throw a json error +- IChatMutableComponent ichatmutablecomponent = IChatBaseComponent.ChatSerializer.a(s.isEmpty() ? "\"\"" : s); ++ //IChatMutableComponent ichatmutablecomponent = IChatBaseComponent.ChatSerializer.a(s.isEmpty() ? "\"\"" : s); // Paper - move down - the old format might throw a json error - if (oldSign) { + if (oldSign && !isLoadingStructure) { // Paper - saved structures will be in the new format, but will not have isConverted @@ -53,7 +53,7 @@ index 4a48c09e96ec5c2002ba297870ee5f06191f95f2..03f6ddf0003f0ef44ede31cf7a349158 continue; } // CraftBukkit end -+ IChatBaseComponent ichatbasecomponent = IChatBaseComponent.ChatSerializer.a(s.isEmpty() ? "\"\"" : s); // Paper - after old sign ++ IChatMutableComponent ichatmutablecomponent = IChatBaseComponent.ChatSerializer.a(s.isEmpty() ? "\"\"" : s); // Paper - after old sign if (this.world instanceof WorldServer) { try { diff --git a/Spigot-Server-Patches/0108-Don-t-lookup-game-profiles-that-have-no-UUID-and-no-.patch b/Spigot-Server-Patches/0107-Don-t-lookup-game-profiles-that-have-no-UUID-and-no-.patch similarity index 86% rename from Spigot-Server-Patches/0108-Don-t-lookup-game-profiles-that-have-no-UUID-and-no-.patch rename to Spigot-Server-Patches/0107-Don-t-lookup-game-profiles-that-have-no-UUID-and-no-.patch index 4d9ee673c..02a31384e 100644 --- a/Spigot-Server-Patches/0108-Don-t-lookup-game-profiles-that-have-no-UUID-and-no-.patch +++ b/Spigot-Server-Patches/0107-Don-t-lookup-game-profiles-that-have-no-UUID-and-no-.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Don't lookup game profiles that have no UUID and no name diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java -index d32bec70d0c03f8d0e8888e7544637729a1bef08..581199e6dcddb3692ccc6b6cf6c42fa5ef1f5e7e 100644 +index 4d3cbe3e517a75269d5c9cdd7f3751b81daee1c2..4f769211cf98c3da720a904da3dcdcd4c7611f0b 100644 --- a/src/main/java/net/minecraft/server/UserCache.java +++ b/src/main/java/net/minecraft/server/UserCache.java -@@ -86,7 +86,7 @@ public class UserCache { +@@ -75,7 +75,7 @@ public class UserCache { }; gameprofilerepository.findProfilesByNames(new String[]{s}, Agent.MINECRAFT, profilelookupcallback); diff --git a/Spigot-Server-Patches/0110-Add-setting-for-proxy-online-mode-status.patch b/Spigot-Server-Patches/0108-Add-setting-for-proxy-online-mode-status.patch similarity index 83% rename from Spigot-Server-Patches/0110-Add-setting-for-proxy-online-mode-status.patch rename to Spigot-Server-Patches/0108-Add-setting-for-proxy-online-mode-status.patch index 4d768029f..c2dbc7b14 100644 --- a/Spigot-Server-Patches/0110-Add-setting-for-proxy-online-mode-status.patch +++ b/Spigot-Server-Patches/0108-Add-setting-for-proxy-online-mode-status.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add setting for proxy online mode status diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 67f35fe66b33a4b461a310b6ce4fdedb5eaf1ac4..53f96a1576582fce83999a1f7e9a2624506ed51f 100644 +index 6fbf9ab53c8b7fab93b55d815060033f945d56cd..5827ef1e3eb35a11867ee4f92f301e1b0245c0fa 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -22,6 +22,7 @@ import org.bukkit.configuration.InvalidConfigurationException; +@@ -23,6 +23,7 @@ import org.bukkit.configuration.InvalidConfigurationException; import org.bukkit.configuration.file.YamlConfiguration; import co.aikar.timings.Timings; import co.aikar.timings.TimingsManager; @@ -16,7 +16,7 @@ index 67f35fe66b33a4b461a310b6ce4fdedb5eaf1ac4..53f96a1576582fce83999a1f7e9a2624 public class PaperConfig { -@@ -233,4 +234,13 @@ public class PaperConfig { +@@ -234,4 +235,13 @@ public class PaperConfig { private static void saveEmptyScoreboardTeams() { saveEmptyScoreboardTeams = getBoolean("settings.save-empty-scoreboard-teams", false); } @@ -31,10 +31,10 @@ index 67f35fe66b33a4b461a310b6ce4fdedb5eaf1ac4..53f96a1576582fce83999a1f7e9a2624 + } } diff --git a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java -index 1422503e11ac632c7b94640d59d9aaa0c5cb2f8f..d3c2e1bedfde39c19fe293941036641ea72c1bcd 100644 +index 060887d765604e4be82913607bb6266a278f5db6..c5957c2d6c54b076ebe7f9a432e30551d2b6febc 100644 --- a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java +++ b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java -@@ -58,7 +58,8 @@ public class NameReferencingFileConverter { +@@ -56,7 +56,8 @@ public class NameReferencingFileConverter { return new String[i]; }); @@ -45,10 +45,10 @@ index 1422503e11ac632c7b94640d59d9aaa0c5cb2f8f..d3c2e1bedfde39c19fe293941036641e } else { String[] astring1 = astring; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index ddb16ca8b69adc6d7e7efda7a7fb906234c19cb4..a27783dcf3f7575b8527aefc60a15621520cbf19 100644 +index 660f0362303df0fa990fa8f1507435666445c228..6d466ddc9c373fe314bf4d113a10407edeb9b22d 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1399,7 +1399,8 @@ public final class CraftServer implements Server { +@@ -1481,7 +1481,8 @@ public final class CraftServer implements Server { // Spigot Start GameProfile profile = null; // Only fetch an online UUID in online mode diff --git a/Spigot-Server-Patches/0109-More-informative-vehicle-moved-wrongly-message.patch b/Spigot-Server-Patches/0109-More-informative-vehicle-moved-wrongly-message.patch deleted file mode 100644 index ebef2819e..000000000 --- a/Spigot-Server-Patches/0109-More-informative-vehicle-moved-wrongly-message.patch +++ /dev/null @@ -1,19 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zach Brown -Date: Thu, 28 Jul 2016 17:58:53 -0500 -Subject: [PATCH] More informative vehicle moved wrongly message - - -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index ac5e6f9e0dd9ea62c93076f2810bcfb4dba9a83d..4aaa5e4dd02fe8b3db512facf8465c1f8d2d8c62 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -365,7 +365,7 @@ public class PlayerConnection implements PacketListenerPlayIn { - - if (d10 > org.spigotmc.SpigotConfig.movedWronglyThreshold) { // Spigot - flag1 = true; -- PlayerConnection.LOGGER.warn("{} moved wrongly!", entity.getDisplayName().getString()); -+ PlayerConnection.LOGGER.warn(entity.getName() + " (vehicle of " + this.player.getName() + ") moved wrongly!"); // Paper - More informative - } - Location curPos = this.getPlayer().getLocation(); // Spigot - diff --git a/Spigot-Server-Patches/0111-Optimise-BlockState-s-hashCode-equals.patch b/Spigot-Server-Patches/0109-Optimise-BlockState-s-hashCode-equals.patch similarity index 69% rename from Spigot-Server-Patches/0111-Optimise-BlockState-s-hashCode-equals.patch rename to Spigot-Server-Patches/0109-Optimise-BlockState-s-hashCode-equals.patch index 4db5da51d..85e775879 100644 --- a/Spigot-Server-Patches/0111-Optimise-BlockState-s-hashCode-equals.patch +++ b/Spigot-Server-Patches/0109-Optimise-BlockState-s-hashCode-equals.patch @@ -8,43 +8,11 @@ object identity checks safely. Use a simpler optimized hashcode -diff --git a/src/main/java/net/minecraft/server/BlockState.java b/src/main/java/net/minecraft/server/BlockState.java -index 0ce77d9230f3d1c53df7c5b72a380a2fa0c6d882..00e67b567f00824b25b45e5ff5ecd62c87ea0309 100644 ---- a/src/main/java/net/minecraft/server/BlockState.java -+++ b/src/main/java/net/minecraft/server/BlockState.java -@@ -28,23 +28,13 @@ public abstract class BlockState> implements IBlockState - } - - public boolean equals(Object object) { -- if (this == object) { -- return true; -- } else if (!(object instanceof BlockState)) { -- return false; -- } else { -- BlockState blockstate = (BlockState) object; -- -- return this.a.equals(blockstate.a) && this.b.equals(blockstate.b); -- } -+ return this == object; // Paper - only one instance per configuration - } - -+ private static final java.util.concurrent.atomic.AtomicInteger hashId = new java.util.concurrent.atomic.AtomicInteger(1); // Paper - only one instance per configuration -+ private final int hashCode = 92821 * hashId.getAndIncrement(); // Paper - only one instance per configuration - public final int hashCode() { -- if (this.c == null) { -- this.c = this.c(); -- } -- -- return this.c; -+ return this.hashCode; // Paper - only one instance per configuration - } - - public int c() { diff --git a/src/main/java/net/minecraft/server/BlockStateBoolean.java b/src/main/java/net/minecraft/server/BlockStateBoolean.java -index d8738447d794f6967307daa1271473903b76a632..7ca302b522df081755120c597a08d589193c57a6 100644 +index 8df150f4cabb3dd98cb66c9d1af7fae035a6a6fe..4ca8db630434915de4eaeac6c4ecd60714d7f5d9 100644 --- a/src/main/java/net/minecraft/server/BlockStateBoolean.java +++ b/src/main/java/net/minecraft/server/BlockStateBoolean.java -@@ -30,8 +30,7 @@ public class BlockStateBoolean extends BlockState { +@@ -30,8 +30,7 @@ public class BlockStateBoolean extends IBlockState { return obool.toString(); } @@ -55,10 +23,10 @@ index d8738447d794f6967307daa1271473903b76a632..7ca302b522df081755120c597a08d589 return true; } else if (object instanceof BlockStateBoolean && super.equals(object)) { diff --git a/src/main/java/net/minecraft/server/BlockStateEnum.java b/src/main/java/net/minecraft/server/BlockStateEnum.java -index 1486d460c8ec3d117b4dc3d28b2c3f1b632e187b..7cdadc6b6abd069f9a1bc000a8f116f73b90e029 100644 +index 8162c11d14b8e88c2b572f9ddf6b7a15977047f8..8dc620b22bb904aa6a82e2127aa9da861986525c 100644 --- a/src/main/java/net/minecraft/server/BlockStateEnum.java +++ b/src/main/java/net/minecraft/server/BlockStateEnum.java -@@ -49,8 +49,7 @@ public class BlockStateEnum & INamable> extends BlockState +@@ -49,8 +49,7 @@ public class BlockStateEnum & INamable> extends IBlockState return ((INamable) t0).getName(); } @@ -69,10 +37,10 @@ index 1486d460c8ec3d117b4dc3d28b2c3f1b632e187b..7cdadc6b6abd069f9a1bc000a8f116f7 return true; } else if (object instanceof BlockStateEnum && super.equals(object)) { diff --git a/src/main/java/net/minecraft/server/BlockStateInteger.java b/src/main/java/net/minecraft/server/BlockStateInteger.java -index 6f35c365f9086a2289e17b4d8e73757ad2c7f87b..0499a71705f3bdac6c94a8dc340cc15e96d9586e 100644 +index 5bd7a236b948666ca31e53cb3a8aa0dc147e274b..36b84446e96faefad3b783f73df74e0f3bce8255 100644 --- a/src/main/java/net/minecraft/server/BlockStateInteger.java +++ b/src/main/java/net/minecraft/server/BlockStateInteger.java -@@ -38,8 +38,7 @@ public class BlockStateInteger extends BlockState { +@@ -38,8 +38,7 @@ public class BlockStateInteger extends IBlockState { return this.a; } @@ -82,3 +50,35 @@ index 6f35c365f9086a2289e17b4d8e73757ad2c7f87b..0499a71705f3bdac6c94a8dc340cc15e if (this == object) { return true; } else if (object instanceof BlockStateInteger && super.equals(object)) { +diff --git a/src/main/java/net/minecraft/server/IBlockState.java b/src/main/java/net/minecraft/server/IBlockState.java +index d63a4e4916ed5f5d901be0f4dd2c13cf66239055..6550b55067db31dbbc903fe17a13849383651c5a 100644 +--- a/src/main/java/net/minecraft/server/IBlockState.java ++++ b/src/main/java/net/minecraft/server/IBlockState.java +@@ -59,23 +59,17 @@ public abstract class IBlockState> { + } + + public boolean equals(Object object) { +- if (this == object) { +- return true; +- } else if (!(object instanceof IBlockState)) { +- return false; +- } else { +- IBlockState iblockstate = (IBlockState) object; +- +- return this.a.equals(iblockstate.a) && this.b.equals(iblockstate.b); +- } ++ return this == object; // Paper - only one instance per configuration + } + ++ private static final java.util.concurrent.atomic.AtomicInteger hashId = new java.util.concurrent.atomic.AtomicInteger(1); // Paper - only one instance per configuration ++ private final int hashCode = 92821 * hashId.getAndIncrement(); // Paper - only one instance per configuration + public final int hashCode() { + if (this.c == null) { + this.c = this.b(); + } + +- return this.c; ++ return this.hashCode; // Paper - only one instance per configuration + } + + public int b() { diff --git a/Spigot-Server-Patches/0112-Configurable-packet-in-spam-threshold.patch b/Spigot-Server-Patches/0110-Configurable-packet-in-spam-threshold.patch similarity index 87% rename from Spigot-Server-Patches/0112-Configurable-packet-in-spam-threshold.patch rename to Spigot-Server-Patches/0110-Configurable-packet-in-spam-threshold.patch index af1a5acf0..158d12e49 100644 --- a/Spigot-Server-Patches/0112-Configurable-packet-in-spam-threshold.patch +++ b/Spigot-Server-Patches/0110-Configurable-packet-in-spam-threshold.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Configurable packet in spam threshold diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 53f96a1576582fce83999a1f7e9a2624506ed51f..010b17d2e7a27ace6ff8b15edff577c4164d2e81 100644 +index 5827ef1e3eb35a11867ee4f92f301e1b0245c0fa..23c9e0f317073bb9c327ec49e0b0586d2123e4e9 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -243,4 +243,13 @@ public class PaperConfig { +@@ -244,4 +244,13 @@ public class PaperConfig { public static boolean isProxyOnlineMode() { return Bukkit.getOnlineMode() || (SpigotConfig.bungee && bungeeOnlineMode); } @@ -23,10 +23,10 @@ index 53f96a1576582fce83999a1f7e9a2624506ed51f..010b17d2e7a27ace6ff8b15edff577c4 + } } diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 4aaa5e4dd02fe8b3db512facf8465c1f8d2d8c62..eec425abe1fd4c9730ab843d003267740216b050 100644 +index c865aab4f56d6b0544ef66a35ebf58e48c8afbb8..f92a994d3b0530a35195132adcf5af1ad1fcbb31 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1204,13 +1204,14 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -1241,13 +1241,14 @@ public class PlayerConnection implements PacketListenerPlayIn { // Spigot start - limit place/interactions private int limitedPackets; private long lastLimitedPacket = -1; diff --git a/Spigot-Server-Patches/0113-Configurable-flying-kick-messages.patch b/Spigot-Server-Patches/0111-Configurable-flying-kick-messages.patch similarity index 87% rename from Spigot-Server-Patches/0113-Configurable-flying-kick-messages.patch rename to Spigot-Server-Patches/0111-Configurable-flying-kick-messages.patch index d5362c506..01bfd92c0 100644 --- a/Spigot-Server-Patches/0113-Configurable-flying-kick-messages.patch +++ b/Spigot-Server-Patches/0111-Configurable-flying-kick-messages.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Configurable flying kick messages diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 010b17d2e7a27ace6ff8b15edff577c4164d2e81..5a83fc21cb6801d597a01fb4a83d30488f30bdb6 100644 +index 23c9e0f317073bb9c327ec49e0b0586d2123e4e9..c4086de778cc2ccc958b1a94dd6e9cdb5065076c 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -252,4 +252,11 @@ public class PaperConfig { +@@ -253,4 +253,11 @@ public class PaperConfig { } packetInSpamThreshold = getInt("settings.incoming-packet-spam-threshold", 300); } @@ -21,14 +21,14 @@ index 010b17d2e7a27ace6ff8b15edff577c4164d2e81..5a83fc21cb6801d597a01fb4a83d3048 + } } diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index eec425abe1fd4c9730ab843d003267740216b050..eb3ed0d8757c59b387cd74a6df7371c356bd6d3a 100644 +index f92a994d3b0530a35195132adcf5af1ad1fcbb31..17edeff6cf5c3f7fee5c17028d3231f70f358537 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -147,7 +147,7 @@ public class PlayerConnection implements PacketListenerPlayIn { - if (this.B) { + if (this.B && !this.player.isSleeping()) { if (++this.C > 80) { PlayerConnection.LOGGER.warn("{} was kicked for floating too long!", this.player.getDisplayName().getString()); -- this.disconnect(new ChatMessage("multiplayer.disconnect.flying", new Object[0])); +- this.disconnect(new ChatMessage("multiplayer.disconnect.flying")); + this.disconnect(com.destroystokyo.paper.PaperConfig.flyingKickPlayerMessage); // Paper - use configurable kick message return; } @@ -37,7 +37,7 @@ index eec425abe1fd4c9730ab843d003267740216b050..eb3ed0d8757c59b387cd74a6df7371c3 if (this.D && this.player.getRootVehicle().getRidingPassenger() == this.player) { if (++this.E > 80) { PlayerConnection.LOGGER.warn("{} was kicked for floating a vehicle too long!", this.player.getDisplayName().getString()); -- this.disconnect(new ChatMessage("multiplayer.disconnect.flying", new Object[0])); +- this.disconnect(new ChatMessage("multiplayer.disconnect.flying")); + this.disconnect(com.destroystokyo.paper.PaperConfig.flyingKickVehicleMessage); // Paper - use configurable kick message return; } diff --git a/Spigot-Server-Patches/0112-Chunk-registration-fixes.patch b/Spigot-Server-Patches/0112-Chunk-registration-fixes.patch new file mode 100644 index 000000000..a302a9c0a --- /dev/null +++ b/Spigot-Server-Patches/0112-Chunk-registration-fixes.patch @@ -0,0 +1,22 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Wed, 21 Sep 2016 22:54:28 -0400 +Subject: [PATCH] Chunk registration fixes + +World checks and the Chunk Add logic are inconsistent on how Y > 256, < 0, is treated + +Keep them consistent + +diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java +index b68338310106858195099bb45b8bf4da723b8439..809ae79c0febf8a6de8bf0ca4d996b68bff8a2b6 100644 +--- a/src/main/java/net/minecraft/server/WorldServer.java ++++ b/src/main/java/net/minecraft/server/WorldServer.java +@@ -728,7 +728,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { + if (entity.ck()) { + this.getMethodProfiler().enter("chunkCheck"); + int i = MathHelper.floor(entity.locX() / 16.0D); +- int j = MathHelper.floor(entity.locY() / 16.0D); ++ int j = Math.min(15, Math.max(0, MathHelper.floor(entity.locY() / 16.0D))); // Paper - stay consistent with chunk add/remove behavior + int k = MathHelper.floor(entity.locZ() / 16.0D); + + if (!entity.inChunk || entity.chunkX != i || entity.chunkY != j || entity.chunkZ != k) { diff --git a/Spigot-Server-Patches/0115-Remove-FishingHook-reference-on-Craft-Entity-removal.patch b/Spigot-Server-Patches/0113-Remove-FishingHook-reference-on-Craft-Entity-removal.patch similarity index 72% rename from Spigot-Server-Patches/0115-Remove-FishingHook-reference-on-Craft-Entity-removal.patch rename to Spigot-Server-Patches/0113-Remove-FishingHook-reference-on-Craft-Entity-removal.patch index 541110605..1c1a2e5f4 100644 --- a/Spigot-Server-Patches/0115-Remove-FishingHook-reference-on-Craft-Entity-removal.patch +++ b/Spigot-Server-Patches/0113-Remove-FishingHook-reference-on-Craft-Entity-removal.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Remove FishingHook reference on Craft Entity removal diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java -index 257ce11664e7388ec004f8fad62ad2fce2aeb791..d45bba0c97961eff6b5107ade63f897263eeff47 100644 +index 591650712199f904af2c66b0d7e36ce31d87e1a3..b3c293a55e199d862526d35b6e85afc760f2b6fb 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java -@@ -66,4 +66,15 @@ public class CraftFishHook extends AbstractProjectile implements FishHook { +@@ -48,4 +48,15 @@ public class CraftFishHook extends CraftProjectile implements FishHook { Validate.isTrue(chance >= 0 && chance <= 1, "The bite chance must be between 0 and 1."); this.biteChance = chance; } @@ -17,10 +17,10 @@ index 257ce11664e7388ec004f8fad62ad2fce2aeb791..d45bba0c97961eff6b5107ade63f8972 + @Override + public void remove() { + super.remove(); -+ if (getHandle().owner != null) { -+ getHandle().owner.hookedFish = null; ++ if (getHandle().getOwner() != null) { ++ getHandle().getOwner().hookedFish = null; + } + } + // Paper end -+ ++ } diff --git a/Spigot-Server-Patches/0116-Auto-fix-bad-Y-levels-on-player-login.patch b/Spigot-Server-Patches/0114-Auto-fix-bad-Y-levels-on-player-login.patch similarity index 68% rename from Spigot-Server-Patches/0116-Auto-fix-bad-Y-levels-on-player-login.patch rename to Spigot-Server-Patches/0114-Auto-fix-bad-Y-levels-on-player-login.patch index 1f124f372..b6b7c7786 100644 --- a/Spigot-Server-Patches/0116-Auto-fix-bad-Y-levels-on-player-login.patch +++ b/Spigot-Server-Patches/0114-Auto-fix-bad-Y-levels-on-player-login.patch @@ -6,14 +6,14 @@ Subject: [PATCH] Auto fix bad Y levels on player login Bring down to a saner Y level if super high, as this can cause the server to crash diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index aca885db36a8c93e32b3a2e40c407e4fdd5c97e4..83ffee35fb2f7de14dbaf06f62d2019eaf68814c 100644 +index ab89e508ee8b8142fb7c0b5101b0b0e157a68f35..1f98d4bec282c46355e325dcb9fe0cb23394ba9e 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -197,6 +197,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -203,6 +203,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { @Override - public void a(NBTTagCompound nbttagcompound) { - super.a(nbttagcompound); + public void loadData(NBTTagCompound nbttagcompound) { + super.loadData(nbttagcompound); + if (this.locY() > 300) this.setPositionRaw(locX(), 257, locZ()); // Paper - bring down to a saner Y level if out of world if (nbttagcompound.hasKeyOfType("playerGameType", 99)) { if (this.getMinecraftServer().getForceGamemode()) { - this.playerInteractManager.setGameMode(this.getMinecraftServer().getGamemode()); + this.playerInteractManager.a(this.getMinecraftServer().getGamemode(), EnumGamemode.NOT_SET); diff --git a/Spigot-Server-Patches/0114-Chunk-registration-fixes.patch b/Spigot-Server-Patches/0114-Chunk-registration-fixes.patch deleted file mode 100644 index 027a15844..000000000 --- a/Spigot-Server-Patches/0114-Chunk-registration-fixes.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Wed, 21 Sep 2016 22:54:28 -0400 -Subject: [PATCH] Chunk registration fixes - -World checks and the Chunk Add logic are inconsistent on how Y > 256, < 0, is treated - -Keep them consistent - -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index aae3d51288a257f42e773cde052bee52fc1ca238..e428b3cb8c8ca5a662a0e867bf74d08775f1bacd 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -696,7 +696,7 @@ public class WorldServer extends World { - public void chunkCheck(Entity entity) { - this.getMethodProfiler().enter("chunkCheck"); - int i = MathHelper.floor(entity.locX() / 16.0D); -- int j = MathHelper.floor(entity.locY() / 16.0D); -+ int j = Math.min(15, Math.max(0, MathHelper.floor(entity.locY() / 16.0D))); // Paper - stay consistent with chunk add/remove behavior; - int k = MathHelper.floor(entity.locZ() / 16.0D); - - if (!entity.inChunk || entity.chunkX != i || entity.chunkY != j || entity.chunkZ != k) { diff --git a/Spigot-Server-Patches/0117-Option-to-remove-corrupt-tile-entities.patch b/Spigot-Server-Patches/0115-Option-to-remove-corrupt-tile-entities.patch similarity index 83% rename from Spigot-Server-Patches/0117-Option-to-remove-corrupt-tile-entities.patch rename to Spigot-Server-Patches/0115-Option-to-remove-corrupt-tile-entities.patch index d1ed80769..4fc8b4c76 100644 --- a/Spigot-Server-Patches/0117-Option-to-remove-corrupt-tile-entities.patch +++ b/Spigot-Server-Patches/0115-Option-to-remove-corrupt-tile-entities.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Option to remove corrupt tile entities diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 8cf3076f4e0d8d7e81158881c763f89ebda7e678..721eceeffc843da8b9da1ccc2d07f3bcc901db76 100644 +index ac76bdd7e1d91b0d242539c4495948cdfbb622e0..6cb717a63f52d757b0b323408d2fc0c3d7db77da 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -298,4 +298,9 @@ public class PaperWorldConfig { +@@ -293,4 +293,9 @@ public class PaperWorldConfig { preventTntFromMovingInWater = getBoolean("prevent-tnt-from-moving-in-water", false); log("Prevent TNT from moving in water: " + preventTntFromMovingInWater); } @@ -19,10 +19,10 @@ index 8cf3076f4e0d8d7e81158881c763f89ebda7e678..721eceeffc843da8b9da1ccc2d07f3bc + } } diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 2c1570c89026a5dbbe76ab00c6a89919e566a5f6..87e94693f6db07d1273854ad55e5f263f2f2239e 100644 +index c0b5d25f63741947c0d8ee32f317eb7fd3db4b65..fdc02b512f2d4bc968977564d520bc7ec7189c69 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -636,6 +636,12 @@ public class Chunk implements IChunkAccess { +@@ -637,6 +637,12 @@ public class Chunk implements IChunkAccess { "Chunk coordinates: " + (this.loc.x * 16) + "," + (this.loc.z * 16)); e.printStackTrace(); ServerInternalException.reportInternalException(e); diff --git a/Spigot-Server-Patches/0118-Add-EntityZapEvent.patch b/Spigot-Server-Patches/0116-Add-EntityZapEvent.patch similarity index 51% rename from Spigot-Server-Patches/0118-Add-EntityZapEvent.patch rename to Spigot-Server-Patches/0116-Add-EntityZapEvent.patch index 5e2b15d0c..e709a1482 100644 --- a/Spigot-Server-Patches/0118-Add-EntityZapEvent.patch +++ b/Spigot-Server-Patches/0116-Add-EntityZapEvent.patch @@ -5,44 +5,43 @@ Subject: [PATCH] Add EntityZapEvent diff --git a/src/main/java/net/minecraft/server/EntityPig.java b/src/main/java/net/minecraft/server/EntityPig.java -index 5c24e22c7d0eb1f10b45fc782151f1d7606d5383..8d277566e9df010b6f86385bc8f018e4c8c2d3bf 100644 +index 1d580d9cbdca9ceafccd35e20f6f075a582a0ac6..cd0a94794e8969937f7f8408e0fb46c1684abc00 100644 --- a/src/main/java/net/minecraft/server/EntityPig.java +++ b/src/main/java/net/minecraft/server/EntityPig.java -@@ -164,6 +164,12 @@ public class EntityPig extends EntityAnimal { - entitypigzombie.setCustomNameVisible(this.getCustomNameVisible()); - } +@@ -208,6 +208,11 @@ public class EntityPig extends EntityAnimal implements ISteerable, ISaddleable { + } -+ // Paper start -+ if (CraftEventFactory.callEntityZapEvent(this, entitylightning, entitypigzombie).isCancelled()) { -+ return; -+ } -+ // Paper end -+ - // CraftBukkit start - if (CraftEventFactory.callPigZapEvent(this, entitylightning, entitypigzombie).isCancelled()) { - return; + entitypigzombie.setPersistent(); ++ // Paper start ++ if (CraftEventFactory.callEntityZapEvent(this, entitylightning, entitypigzombie).isCancelled()) { ++ return; ++ } ++ // Paper end + // CraftBukkit start + if (CraftEventFactory.callPigZapEvent(this, entitylightning, entitypigzombie).isCancelled()) { + return; diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java -index f72347050302e4cb99d4c9b71b7e8acab545ea59..5e3835851d8c5e804542c256a54187e4ed05bace 100644 +index f7f76bca254dc7bc5792e449feeaa113a96c93e4..d0b04707e830fbaf3a6bfe92637e4432172fd9c7 100644 --- a/src/main/java/net/minecraft/server/EntityVillager.java +++ b/src/main/java/net/minecraft/server/EntityVillager.java -@@ -681,6 +681,12 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation - public void onLightningStrike(EntityLightning entitylightning) { - EntityWitch entitywitch = (EntityWitch) EntityTypes.WITCH.a(this.world); +@@ -714,6 +714,12 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation + EntityVillager.LOGGER.info("Villager {} was struck by lightning {}.", this, entitylightning); + EntityWitch entitywitch = (EntityWitch) EntityTypes.WITCH.a(this.world); -+ // Paper start -+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityZapEvent(this, entitylightning, entitywitch).isCancelled()) { -+ return; -+ } -+ // Paper end ++ // Paper start ++ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityZapEvent(this, entitylightning, entitywitch).isCancelled()) { ++ return; ++ } ++ // Paper end + - entitywitch.setPositionRotation(this.locX(), this.locY(), this.locZ(), this.yaw, this.pitch); - entitywitch.prepare(this.world, this.world.getDamageScaler(new BlockPosition(entitywitch)), EnumMobSpawn.CONVERSION, (GroupDataEntity) null, (NBTTagCompound) null); - entitywitch.setNoAI(this.isNoAI()); + entitywitch.setPositionRotation(this.locX(), this.locY(), this.locZ(), this.yaw, this.pitch); + entitywitch.prepare(this.world, this.world.getDamageScaler(entitywitch.getChunkCoordinates()), EnumMobSpawn.CONVERSION, (GroupDataEntity) null, (NBTTagCompound) null); + entitywitch.setNoAI(this.isNoAI()); diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index b04ce0ee06ec21f87d605904e602ddc8d45a2aae..d739605ded8d81632c491af92322e02b4716c0b1 100644 +index f4abad0c0e7e2a57965311ee0a82224154f752aa..47f8c995025f26607baf3b80b8465f6df78a08ff 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -1053,6 +1053,14 @@ public class CraftEventFactory { +@@ -1080,6 +1080,14 @@ public class CraftEventFactory { return event; } diff --git a/Spigot-Server-Patches/0119-Filter-bad-data-from-ArmorStand-and-SpawnEgg-items.patch b/Spigot-Server-Patches/0117-Filter-bad-data-from-ArmorStand-and-SpawnEgg-items.patch similarity index 83% rename from Spigot-Server-Patches/0119-Filter-bad-data-from-ArmorStand-and-SpawnEgg-items.patch rename to Spigot-Server-Patches/0117-Filter-bad-data-from-ArmorStand-and-SpawnEgg-items.patch index 96c2424f9..bcf6ae928 100644 --- a/Spigot-Server-Patches/0119-Filter-bad-data-from-ArmorStand-and-SpawnEgg-items.patch +++ b/Spigot-Server-Patches/0117-Filter-bad-data-from-ArmorStand-and-SpawnEgg-items.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Filter bad data from ArmorStand and SpawnEgg items diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 721eceeffc843da8b9da1ccc2d07f3bcc901db76..bff2e9d26dc8057c3950d1b57ee2e7469e7f943c 100644 +index 6cb717a63f52d757b0b323408d2fc0c3d7db77da..e43aee3757b6765d898b50ebfff1a28071638558 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -2,6 +2,7 @@ package com.destroystokyo.paper; @@ -16,7 +16,7 @@ index 721eceeffc843da8b9da1ccc2d07f3bcc901db76..bff2e9d26dc8057c3950d1b57ee2e746 import org.bukkit.configuration.file.YamlConfiguration; import org.spigotmc.SpigotWorldConfig; -@@ -303,4 +304,12 @@ public class PaperWorldConfig { +@@ -298,4 +299,12 @@ public class PaperWorldConfig { private void removeCorruptTEs() { removeCorruptTEs = getBoolean("remove-corrupt-tile-entities", false); } @@ -30,14 +30,13 @@ index 721eceeffc843da8b9da1ccc2d07f3bcc901db76..bff2e9d26dc8057c3950d1b57ee2e746 + } } diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java -index e64722f63bab6bc1ce97ca63d4fde7599f6c1296..6683f7c5f31b88187961335c5f708b8a4f77b5af 100644 +index 7c308e0912fb60f8dcdfb36c8a8c8718231858bc..40ab0a1e5b8e31f1ef3b2444366784a65f034341 100644 --- a/src/main/java/net/minecraft/server/EntityFallingBlock.java +++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java -@@ -233,6 +233,15 @@ public class EntityFallingBlock extends Entity { +@@ -233,6 +233,13 @@ public class EntityFallingBlock extends Entity { @Override - protected void a(NBTTagCompound nbttagcompound) { - this.block = GameProfileSerializer.d(nbttagcompound.getCompound("BlockState")); -+ + protected void loadData(NBTTagCompound nbttagcompound) { + this.block = GameProfileSerializer.c(nbttagcompound.getCompound("BlockState")); + // Paper start - Block FallingBlocks with Command Blocks + // Check mappings on update - dc = "repeating_command_block" - dd = "chain_command_block" + final Block b = this.block.getBlock(); @@ -45,7 +44,6 @@ index e64722f63bab6bc1ce97ca63d4fde7599f6c1296..6683f7c5f31b88187961335c5f708b8a + this.block = Blocks.STONE.getBlockData(); + } + // Paper end -+ this.ticksLived = nbttagcompound.getInt("Time"); if (nbttagcompound.hasKeyOfType("HurtEntities", 99)) { this.hurtEntities = nbttagcompound.getBoolean("HurtEntities"); diff --git a/Spigot-Server-Patches/0120-Cache-user-authenticator-threads.patch b/Spigot-Server-Patches/0118-Cache-user-authenticator-threads.patch similarity index 90% rename from Spigot-Server-Patches/0120-Cache-user-authenticator-threads.patch rename to Spigot-Server-Patches/0118-Cache-user-authenticator-threads.patch index a6db0fb77..726bbaec7 100644 --- a/Spigot-Server-Patches/0120-Cache-user-authenticator-threads.patch +++ b/Spigot-Server-Patches/0118-Cache-user-authenticator-threads.patch @@ -5,13 +5,13 @@ Subject: [PATCH] Cache user authenticator threads diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 83ffee35fb2f7de14dbaf06f62d2019eaf68814c..482d7b7cb6b89d79b2ce54338130481f9f1c8c24 100644 +index 1f98d4bec282c46355e325dcb9fe0cb23394ba9e..c1c858f9384eb6e952198e531633d0a571c39ac2 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -4,7 +4,9 @@ import com.google.common.collect.Lists; import com.mojang.authlib.GameProfile; import com.mojang.datafixers.util.Either; - import io.netty.util.concurrent.Future; + import com.mojang.serialization.DataResult; +import java.util.ArrayDeque; // Paper import java.util.Collection; +import java.util.Deque; // Paper @@ -27,7 +27,7 @@ index 83ffee35fb2f7de14dbaf06f62d2019eaf68814c..482d7b7cb6b89d79b2ce54338130481f private final AdvancementDataPlayer advancementDataPlayer; private final ServerStatisticManager serverStatisticManager; private float lastHealthScored = Float.MIN_VALUE; -@@ -371,13 +373,20 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -411,13 +413,20 @@ public class EntityPlayer extends EntityHuman implements ICrafting { while (!this.removeQueue.isEmpty()) { int i = Math.min(this.removeQueue.size(), Integer.MAX_VALUE); int[] aint = new int[i]; @@ -50,7 +50,7 @@ index 83ffee35fb2f7de14dbaf06f62d2019eaf68814c..482d7b7cb6b89d79b2ce54338130481f this.playerConnection.sendPacket(new PacketPlayOutEntityDestroy(aint)); } -@@ -1327,7 +1336,14 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -1433,7 +1442,14 @@ public class EntityPlayer extends EntityHuman implements ICrafting { this.lastHealthSent = -1.0F; this.lastFoodSent = -1; // this.recipeBook.a((RecipeBook) entityplayer.recipeBook); // CraftBukkit @@ -63,6 +63,6 @@ index 83ffee35fb2f7de14dbaf06f62d2019eaf68814c..482d7b7cb6b89d79b2ce54338130481f + this.removeQueue.addAll(entityplayer.removeQueue); + } + // Paper end - this.cm = entityplayer.cm; - this.cr = entityplayer.cr; + this.ck = entityplayer.ck; + this.cp = entityplayer.cp; this.setShoulderEntityLeft(entityplayer.getShoulderEntityLeft()); diff --git a/Spigot-Server-Patches/0121-Optimise-removeQueue.patch b/Spigot-Server-Patches/0119-Optimise-removeQueue.patch similarity index 84% rename from Spigot-Server-Patches/0121-Optimise-removeQueue.patch rename to Spigot-Server-Patches/0119-Optimise-removeQueue.patch index f3dfb500c..58e4428a9 100644 --- a/Spigot-Server-Patches/0121-Optimise-removeQueue.patch +++ b/Spigot-Server-Patches/0119-Optimise-removeQueue.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Optimise removeQueue diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java -index c6fd50daa842aae7558ae14196483b544c377c29..19e72da6d9a8bf43d1d25c1be3aa23c75dd6e5d7 100644 +index 01e981209ec832b3da368091ed109f42464c1c33..7c016afc904d6d6958abf73fd0d87a25c9fa41ad 100644 --- a/src/main/java/net/minecraft/server/LoginListener.java +++ b/src/main/java/net/minecraft/server/LoginListener.java -@@ -97,6 +97,12 @@ public class LoginListener implements PacketLoginInListener { +@@ -96,6 +96,12 @@ public class LoginListener implements PacketLoginInListener { } @@ -21,7 +21,7 @@ index c6fd50daa842aae7558ae14196483b544c377c29..19e72da6d9a8bf43d1d25c1be3aa23c7 // Spigot start public void initUUID() { -@@ -175,8 +181,8 @@ public class LoginListener implements PacketLoginInListener { +@@ -174,8 +180,8 @@ public class LoginListener implements PacketLoginInListener { this.networkManager.sendPacket(new PacketLoginOutEncryptionBegin("", this.server.getKeyPair().getPublic(), this.e)); } else { // Spigot start @@ -32,7 +32,7 @@ index c6fd50daa842aae7558ae14196483b544c377c29..19e72da6d9a8bf43d1d25c1be3aa23c7 @Override public void run() { try { -@@ -187,7 +193,8 @@ public class LoginListener implements PacketLoginInListener { +@@ -186,7 +192,8 @@ public class LoginListener implements PacketLoginInListener { server.server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + i.getName(), ex); } } @@ -42,7 +42,7 @@ index c6fd50daa842aae7558ae14196483b544c377c29..19e72da6d9a8bf43d1d25c1be3aa23c7 // Spigot end } -@@ -204,7 +211,8 @@ public class LoginListener implements PacketLoginInListener { +@@ -203,7 +210,8 @@ public class LoginListener implements PacketLoginInListener { this.loginKey = packetlogininencryptionbegin.a(privatekey); this.g = LoginListener.EnumProtocolState.AUTHENTICATING; this.networkManager.a(this.loginKey); @@ -52,9 +52,9 @@ index c6fd50daa842aae7558ae14196483b544c377c29..19e72da6d9a8bf43d1d25c1be3aa23c7 public void run() { GameProfile gameprofile = LoginListener.this.i; -@@ -251,10 +259,8 @@ public class LoginListener implements PacketLoginInListener { +@@ -250,10 +258,8 @@ public class LoginListener implements PacketLoginInListener { - return LoginListener.this.server.Y() && socketaddress instanceof InetSocketAddress ? ((InetSocketAddress) socketaddress).getAddress() : null; + return LoginListener.this.server.U() && socketaddress instanceof InetSocketAddress ? ((InetSocketAddress) socketaddress).getAddress() : null; } - }; - diff --git a/Spigot-Server-Patches/0122-Allow-Reloading-of-Command-Aliases.patch b/Spigot-Server-Patches/0120-Allow-Reloading-of-Command-Aliases.patch similarity index 90% rename from Spigot-Server-Patches/0122-Allow-Reloading-of-Command-Aliases.patch rename to Spigot-Server-Patches/0120-Allow-Reloading-of-Command-Aliases.patch index 9052d5858..997276c40 100644 --- a/Spigot-Server-Patches/0122-Allow-Reloading-of-Command-Aliases.patch +++ b/Spigot-Server-Patches/0120-Allow-Reloading-of-Command-Aliases.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Allow Reloading of Command Aliases Reload the aliases stored in commands.yml diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index a27783dcf3f7575b8527aefc60a15621520cbf19..3cb57c3b8ca8f29437bea52e9cf3512985f56eb5 100644 +index 6d466ddc9c373fe314bf4d113a10407edeb9b22d..d83e3be6f1997b993f6d4e65b190af5ad3056328 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2118,5 +2118,24 @@ public final class CraftServer implements Server { +@@ -2197,5 +2197,24 @@ public final class CraftServer implements Server { DefaultPermissions.registerCorePermissions(); CraftDefaultPermissions.registerCorePermissions(); } diff --git a/Spigot-Server-Patches/0123-Add-source-to-PlayerExpChangeEvent.patch b/Spigot-Server-Patches/0121-Add-source-to-PlayerExpChangeEvent.patch similarity index 85% rename from Spigot-Server-Patches/0123-Add-source-to-PlayerExpChangeEvent.patch rename to Spigot-Server-Patches/0121-Add-source-to-PlayerExpChangeEvent.patch index 2d229c591..765101384 100644 --- a/Spigot-Server-Patches/0123-Add-source-to-PlayerExpChangeEvent.patch +++ b/Spigot-Server-Patches/0121-Add-source-to-PlayerExpChangeEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add source to PlayerExpChangeEvent diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java -index f72bb0c13806c3fadcbbf345f3533c115a200a7f..0447800d9dc341af647a928abd8b79938eddbd6f 100644 +index 2e25aba27993608ed7ee1cfb7ae8ee60bc74feda..c13a47382d0a7456fa5035a64f42a6ed5e9f1c8e 100644 --- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java +++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java -@@ -193,7 +193,7 @@ public class EntityExperienceOrb extends Entity { +@@ -188,7 +188,7 @@ public class EntityExperienceOrb extends Entity { } if (this.value > 0) { @@ -18,10 +18,10 @@ index f72bb0c13806c3fadcbbf345f3533c115a200a7f..0447800d9dc341af647a928abd8b7993 this.die(); diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index d739605ded8d81632c491af92322e02b4716c0b1..0c79171ba166846c7136ec6e89fd2a41f99ed260 100644 +index 47f8c995025f26607baf3b80b8465f6df78a08ff..9a4d74f6e241dd4e1785ed5bad0eac74b3130fca 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -117,6 +117,7 @@ import org.bukkit.entity.ThrownPotion; +@@ -120,6 +120,7 @@ import org.bukkit.entity.ThrownPotion; import org.bukkit.entity.Vehicle; import org.bukkit.entity.Villager; import org.bukkit.entity.Villager.Profession; @@ -29,7 +29,7 @@ index d739605ded8d81632c491af92322e02b4716c0b1..0c79171ba166846c7136ec6e89fd2a41 import org.bukkit.event.Cancellable; import org.bukkit.event.Event; import org.bukkit.event.Event.Result; -@@ -1012,6 +1013,17 @@ public class CraftEventFactory { +@@ -1039,6 +1040,17 @@ public class CraftEventFactory { return event; } diff --git a/Spigot-Server-Patches/0124-Don-t-let-fishinghooks-use-portals.patch b/Spigot-Server-Patches/0122-Don-t-let-fishinghooks-use-portals.patch similarity index 64% rename from Spigot-Server-Patches/0124-Don-t-let-fishinghooks-use-portals.patch rename to Spigot-Server-Patches/0122-Don-t-let-fishinghooks-use-portals.patch index 1837e84c0..2474bd653 100644 --- a/Spigot-Server-Patches/0124-Don-t-let-fishinghooks-use-portals.patch +++ b/Spigot-Server-Patches/0122-Don-t-let-fishinghooks-use-portals.patch @@ -5,26 +5,26 @@ Subject: [PATCH] Don't let fishinghooks use portals diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 3f1dbca881ce19a633fc7c20d26d1a25b550edf7..8a2093ac5a6d47c795523a1aab87e46f10b1699e 100644 +index 14351cc9e60a0b8d33d319da9d473e74072767d7..393a2d3ede8e82b33979f18e0cda796bf003f8ef 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -161,7 +161,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -162,7 +162,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke public boolean ac; public boolean impulse; public int portalCooldown; -- protected boolean af; -+ protected boolean af; public final boolean inPortal() { return this.af; } // Paper - OBFHELPER - protected int ag; - public DimensionManager dimension; - protected BlockPosition ai; +- protected boolean inPortal; ++ protected boolean inPortal; public final boolean inPortal() { return this.inPortal; } // Paper - OBFHELPER + protected int portalTicks; + protected BlockPosition ah; + protected Vec3D ai; diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java -index 40bdcf4e75bb36385e82ba8b8f2471760072705a..39e3bd37956d7e0a4d5f784a581e17a77b71f78b 100644 +index ab8f67c11419cc788fc3cb814d2224e65217dd08..13b46c59b9a017bfa985ad74f80eca77608d1891 100644 --- a/src/main/java/net/minecraft/server/EntityFishingHook.java +++ b/src/main/java/net/minecraft/server/EntityFishingHook.java -@@ -160,6 +160,12 @@ public class EntityFishingHook extends Entity { +@@ -191,6 +191,12 @@ public class EntityFishingHook extends IProjectile { this.setMot(this.getMot().a(0.92D)); - this.Z(); + this.ac(); + + // Paper start - These shouldn't be going through portals + if (this.inPortal()) { diff --git a/Spigot-Server-Patches/0125-Add-ProjectileCollideEvent.patch b/Spigot-Server-Patches/0123-Add-ProjectileCollideEvent.patch similarity index 51% rename from Spigot-Server-Patches/0125-Add-ProjectileCollideEvent.patch rename to Spigot-Server-Patches/0123-Add-ProjectileCollideEvent.patch index a42456458..540f7cb9a 100644 --- a/Spigot-Server-Patches/0125-Add-ProjectileCollideEvent.patch +++ b/Spigot-Server-Patches/0123-Add-ProjectileCollideEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add ProjectileCollideEvent diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java -index 2b14b2c3fa21e67ebd8f344a6ee066d67bf53044..634e2bd3049d65bbef4ef12e2264049a6980fd71 100644 +index 44e23fa452c5f39ad7ff678064f5474813f7cea8..c552962a9a2c8dac6794ef6698943c7d91ea45c4 100644 --- a/src/main/java/net/minecraft/server/EntityArrow.java +++ b/src/main/java/net/minecraft/server/EntityArrow.java -@@ -187,6 +187,17 @@ public abstract class EntityArrow extends Entity implements IProjectile { +@@ -160,6 +160,17 @@ public abstract class EntityArrow extends IProjectile { } } @@ -27,12 +27,12 @@ index 2b14b2c3fa21e67ebd8f344a6ee066d67bf53044..634e2bd3049d65bbef4ef12e2264049a this.a((MovingObjectPosition) object); this.impulse = true; diff --git a/src/main/java/net/minecraft/server/EntityFireball.java b/src/main/java/net/minecraft/server/EntityFireball.java -index 078cc252313faca997e3a716fed5c5d2261c086c..6756c79b31aa04a110eeedd3c44b11abc34f4b5f 100644 +index 17ab9401dbd6c67488a79abeeed24e37c126b729..5c737d605219bcb0c509f10e62550981f7cdb03f 100644 --- a/src/main/java/net/minecraft/server/EntityFireball.java +++ b/src/main/java/net/minecraft/server/EntityFireball.java -@@ -67,7 +67,16 @@ public abstract class EntityFireball extends Entity { - ++this.g; - MovingObjectPosition movingobjectposition = ProjectileHelper.a(this, true, this.g >= 25, this.shooter, RayTrace.BlockCollisionOption.COLLIDER); +@@ -57,7 +57,16 @@ public abstract class EntityFireball extends IProjectile { + + MovingObjectPosition movingobjectposition = ProjectileHelper.a(this, this::a, RayTrace.BlockCollisionOption.COLLIDER); - if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) { + // Paper start - Call ProjectileCollideEvent @@ -48,55 +48,33 @@ index 078cc252313faca997e3a716fed5c5d2261c086c..6756c79b31aa04a110eeedd3c44b11ab this.a(movingobjectposition); // CraftBukkit start - Fire ProjectileHitEvent -diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java -index 39e3bd37956d7e0a4d5f784a581e17a77b71f78b..807ec3394db7bef29bf92f2c200fd76f96df03ab 100644 ---- a/src/main/java/net/minecraft/server/EntityFishingHook.java -+++ b/src/main/java/net/minecraft/server/EntityFishingHook.java -@@ -214,7 +214,16 @@ public class EntityFishingHook extends Entity { - return !entity.isSpectator() && (entity.isInteractable() || entity instanceof EntityItem) && (entity != this.owner || this.g >= 5); - }, RayTrace.BlockCollisionOption.COLLIDER, true); - -- if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) { -+ // Paper start - Call ProjectileCollideEvent -+ if (movingobjectposition instanceof MovingObjectPositionEntity) { -+ com.destroystokyo.paper.event.entity.ProjectileCollideEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileCollideEvent(this, (MovingObjectPositionEntity)movingobjectposition); -+ if (event.isCancelled()) { -+ movingobjectposition = null; -+ } -+ } -+ // Paper end -+ -+ if (movingobjectposition != null && movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) { // Paper - add null check in case cancelled - org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this, movingobjectposition); // CraftBukkit - Call event - if (movingobjectposition.getType() == MovingObjectPosition.EnumMovingObjectType.ENTITY) { - this.hooked = ((MovingObjectPositionEntity) movingobjectposition).getEntity(); diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java -index 2e4c9d42677d3e48a8f8ad559a723fc4eeec07e3..724b78b5d2d7f4ce8de31c763d2d95b986c1b7f6 100644 +index 5cc122fc0e80bd67160c8b4a7a469edfb6e24808..795685f1eed489b8323c7a8528b2bbd4737b9cb7 100644 --- a/src/main/java/net/minecraft/server/EntityProjectile.java +++ b/src/main/java/net/minecraft/server/EntityProjectile.java -@@ -99,7 +99,16 @@ public abstract class EntityProjectile extends Entity implements IProjectile { - this.ap = null; +@@ -41,7 +41,17 @@ public abstract class EntityProjectile extends IProjectile { } -- if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) { -+ // Paper start - Call ProjectileCollideEvent -+ if (movingobjectposition instanceof MovingObjectPositionEntity) { -+ com.destroystokyo.paper.event.entity.ProjectileCollideEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileCollideEvent(this, (MovingObjectPositionEntity)movingobjectposition); -+ if (event.isCancelled()) { -+ movingobjectposition = null; + if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS && !flag) { ++ // Paper start - Call ProjectileCollideEvent ++ if (movingobjectposition instanceof MovingObjectPositionEntity) { ++ com.destroystokyo.paper.event.entity.ProjectileCollideEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileCollideEvent(this, (MovingObjectPositionEntity)movingobjectposition); ++ if (event.isCancelled()) { ++ movingobjectposition = null; ++ } + } -+ } -+ // Paper end -+ -+ if (movingobjectposition != null && movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) { // Paper - add null check in case cancelled - if (movingobjectposition.getType() == MovingObjectPosition.EnumMovingObjectType.BLOCK && this.world.getType(((MovingObjectPositionBlock) movingobjectposition).getBlockPosition()).getBlock() == Blocks.NETHER_PORTAL) { - this.c(((MovingObjectPositionBlock) movingobjectposition).getBlockPosition()); - } else { ++ if (movingobjectposition != null) { ++ // Paper end + this.a(movingobjectposition); ++ } // Paper + } + + Vec3D vec3d = this.getMot(); diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 0c79171ba166846c7136ec6e89fd2a41f99ed260..48008ca8b7632a9cfbf78ee8a142af9c8e2e91b6 100644 +index 9a4d74f6e241dd4e1785ed5bad0eac74b3130fca..ac5f492fd0d837da150e415bc007c10fe7ee3714 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -1157,6 +1157,16 @@ public class CraftEventFactory { +@@ -1184,6 +1184,16 @@ public class CraftEventFactory { return CraftItemStack.asNMSCopy(bitem); } diff --git a/Spigot-Server-Patches/0126-Prevent-Pathfinding-out-of-World-Border.patch b/Spigot-Server-Patches/0124-Prevent-Pathfinding-out-of-World-Border.patch similarity index 88% rename from Spigot-Server-Patches/0126-Prevent-Pathfinding-out-of-World-Border.patch rename to Spigot-Server-Patches/0124-Prevent-Pathfinding-out-of-World-Border.patch index 8b6912738..39a11f46f 100644 --- a/Spigot-Server-Patches/0126-Prevent-Pathfinding-out-of-World-Border.patch +++ b/Spigot-Server-Patches/0124-Prevent-Pathfinding-out-of-World-Border.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Prevent Pathfinding out of World Border This prevents Entities from trying to run outside of the World Border diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java -index 39a0c45bb0e3d2fcfbcc07192f9e1e61570c922e..bdd092e49da13960cd8a65e989a351d65cb620f7 100644 +index 9330e65cbdf2f826528e3c891197fac7860306ec..b06c76a369f1dc9de8d782272c3ff0573af89361 100644 --- a/src/main/java/net/minecraft/server/NavigationAbstract.java +++ b/src/main/java/net/minecraft/server/NavigationAbstract.java -@@ -123,7 +123,7 @@ public abstract class NavigationAbstract { +@@ -126,7 +126,7 @@ public abstract class NavigationAbstract { // Paper start - Pathfind event boolean copiedSet = false; for (BlockPosition possibleTarget : set) { diff --git a/Spigot-Server-Patches/0127-Optimize-World.isLoaded-BlockPosition-Z.patch b/Spigot-Server-Patches/0125-Optimize-World.isLoaded-BlockPosition-Z.patch similarity index 86% rename from Spigot-Server-Patches/0127-Optimize-World.isLoaded-BlockPosition-Z.patch rename to Spigot-Server-Patches/0125-Optimize-World.isLoaded-BlockPosition-Z.patch index 8a7422d28..fa5e04ac1 100644 --- a/Spigot-Server-Patches/0127-Optimize-World.isLoaded-BlockPosition-Z.patch +++ b/Spigot-Server-Patches/0125-Optimize-World.isLoaded-BlockPosition-Z.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Optimize World.isLoaded(BlockPosition)Z Reduce method invocations for World.isLoaded(BlockPosition)Z diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index fd8724c755d4129c0f3fbd6e0730def09dba1e55..184ea74726078809ae1b6df320d37532fa0d26ab 100644 +index 87a0e66029e10a22ea6e681c7d1e143b9bc5c2c8..5f23a7b952a5938ffa489bbf4f3d64caa8d0f4a6 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -225,6 +225,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -287,6 +287,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable { return chunk == null ? null : chunk.getFluid(blockposition); } diff --git a/Spigot-Server-Patches/0128-Bound-Treasure-Maps-to-World-Border.patch b/Spigot-Server-Patches/0126-Bound-Treasure-Maps-to-World-Border.patch similarity index 54% rename from Spigot-Server-Patches/0128-Bound-Treasure-Maps-to-World-Border.patch rename to Spigot-Server-Patches/0126-Bound-Treasure-Maps-to-World-Border.patch index faf683480..230f55e10 100644 --- a/Spigot-Server-Patches/0128-Bound-Treasure-Maps-to-World-Border.patch +++ b/Spigot-Server-Patches/0126-Bound-Treasure-Maps-to-World-Border.patch @@ -11,23 +11,23 @@ that is outside happens to be closer, but unreachable, yet another reachable one is in border that would of been missed. diff --git a/src/main/java/net/minecraft/server/StructureGenerator.java b/src/main/java/net/minecraft/server/StructureGenerator.java -index 0f248b6de3b822642389eba2ce3569a6538bdece..e8ce2ecf23e58d82febf6b9441e0004e69cdc858 100644 +index eefad79a01de61eff5e0bd3f709bfda030ebe20d..6eb81504146af614a806add6e5effe0c2b111c8a 100644 --- a/src/main/java/net/minecraft/server/StructureGenerator.java +++ b/src/main/java/net/minecraft/server/StructureGenerator.java -@@ -108,6 +108,7 @@ public abstract class StructureGenerator +@@ -138,6 +138,7 @@ public abstract class StructureGenerator + int i2 = l + k * k1; + int j2 = i1 + k * l1; + ChunkCoordIntPair chunkcoordintpair = this.a(structuresettingsfeature, j, seededrandom, i2, j2); ++ if (!iworldreader.getWorldBorder().isChunkInBounds(chunkcoordintpair.x, chunkcoordintpair.z)) { continue; } // Paper + IChunkAccess ichunkaccess = iworldreader.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z, ChunkStatus.STRUCTURE_STARTS); + StructureStart structurestart = structuremanager.a(SectionPosition.a(ichunkaccess.getPos(), 0), this, ichunkaccess); - if (flag1 || flag2) { - ChunkCoordIntPair chunkcoordintpair = this.a(chunkgenerator, seededrandom, j, k, i1, j1); -+ if (!world.getWorldBorder().isChunkInBounds(chunkcoordintpair.x, chunkcoordintpair.z)) { continue; } // Paper - StructureStart structurestart = world.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z, ChunkStatus.STRUCTURE_STARTS).a(this.b()); - - if (structurestart != null && structurestart.e()) { diff --git a/src/main/java/net/minecraft/server/WorldBorder.java b/src/main/java/net/minecraft/server/WorldBorder.java -index 73730fe25c84a867b8d95525c9d76d60a5797396..4c20db5a3f9e159997a9851691aca421241d6d95 100644 +index d5c0d394feaf8bb991245dbdcc6252cf45eac13d..0ef92a320d132b443e76276b2c34a4626cf187db 100644 --- a/src/main/java/net/minecraft/server/WorldBorder.java +++ b/src/main/java/net/minecraft/server/WorldBorder.java -@@ -24,6 +24,18 @@ public class WorldBorder { - return (double) (blockposition.getX() + 1) > this.c() && (double) blockposition.getX() < this.e() && (double) (blockposition.getZ() + 1) > this.d() && (double) blockposition.getZ() < this.f(); +@@ -26,6 +26,18 @@ public class WorldBorder { + return (double) (blockposition.getX() + 1) > this.e() && (double) blockposition.getX() < this.g() && (double) (blockposition.getZ() + 1) > this.f() && (double) blockposition.getZ() < this.h(); } + // Paper start @@ -43,5 +43,5 @@ index 73730fe25c84a867b8d95525c9d76d60a5797396..4c20db5a3f9e159997a9851691aca421 + // Paper end + public boolean isInBounds(ChunkCoordIntPair chunkcoordintpair) { - return (double) chunkcoordintpair.f() > this.c() && (double) chunkcoordintpair.d() < this.e() && (double) chunkcoordintpair.g() > this.d() && (double) chunkcoordintpair.e() < this.f(); + return (double) chunkcoordintpair.f() > this.e() && (double) chunkcoordintpair.d() < this.g() && (double) chunkcoordintpair.g() > this.f() && (double) chunkcoordintpair.e() < this.h(); } diff --git a/Spigot-Server-Patches/0129-Configurable-Cartographer-Treasure-Maps.patch b/Spigot-Server-Patches/0127-Configurable-Cartographer-Treasure-Maps.patch similarity index 79% rename from Spigot-Server-Patches/0129-Configurable-Cartographer-Treasure-Maps.patch rename to Spigot-Server-Patches/0127-Configurable-Cartographer-Treasure-Maps.patch index d51204507..f55d2be9c 100644 --- a/Spigot-Server-Patches/0129-Configurable-Cartographer-Treasure-Maps.patch +++ b/Spigot-Server-Patches/0127-Configurable-Cartographer-Treasure-Maps.patch @@ -9,10 +9,10 @@ Also allow turning off treasure maps all together as they can eat up Map ID's which are limited in quantity. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index bff2e9d26dc8057c3950d1b57ee2e7469e7f943c..f164844f339793860e773c499443ce160d0a6830 100644 +index e43aee3757b6765d898b50ebfff1a28071638558..255b4081314162cbe344b008158c6f4584795fb8 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -312,4 +312,14 @@ public class PaperWorldConfig { +@@ -307,4 +307,14 @@ public class PaperWorldConfig { Bukkit.getLogger().warning("Spawn Egg and Armor Stand NBT filtering disabled, this is a potential security risk"); } } @@ -28,13 +28,13 @@ index bff2e9d26dc8057c3950d1b57ee2e7469e7f943c..f164844f339793860e773c499443ce16 + } } diff --git a/src/main/java/net/minecraft/server/LootItemFunctionExplorationMap.java b/src/main/java/net/minecraft/server/LootItemFunctionExplorationMap.java -index 5fe0da76bd172c2c552b2dd210e89be214c4385c..f7220f057e313ad137fe01397e43c4a42afbccc1 100644 +index 32a98e758b9df48005ddc5283eacdc5123a32c39..30f21e3ff7eed3c7291e01b94cc0f66fd48756d0 100644 --- a/src/main/java/net/minecraft/server/LootItemFunctionExplorationMap.java +++ b/src/main/java/net/minecraft/server/LootItemFunctionExplorationMap.java -@@ -42,6 +42,15 @@ public class LootItemFunctionExplorationMap extends LootItemFunctionConditional +@@ -48,6 +48,15 @@ public class LootItemFunctionExplorationMap extends LootItemFunctionConditional if (blockposition != null) { - WorldServer worldserver = loottableinfo.c(); + WorldServer worldserver = loottableinfo.getWorld(); + // Paper start + if (!worldserver.paperConfig.enableTreasureMaps) { + /* @@ -44,20 +44,20 @@ index 5fe0da76bd172c2c552b2dd210e89be214c4385c..f7220f057e313ad137fe01397e43c4a4 + return itemstack; + } + // Paper end - BlockPosition blockposition1 = worldserver.a(this.d, blockposition, this.g, this.h); + BlockPosition blockposition1 = worldserver.a(this.e, blockposition, this.h, this.i); if (blockposition1 != null) { diff --git a/src/main/java/net/minecraft/server/VillagerTrades.java b/src/main/java/net/minecraft/server/VillagerTrades.java -index 3bcf0b385d1f707176dae9c3ee49370e2e6dd481..4764ffef77bf0a73018017a07103186a9ce55b8f 100644 +index 532460e7549192dfe6170e2bf489edb46b8b5737..d0c2ec4050458e26d1bd85cc09b1a3fdca8488c6 100644 --- a/src/main/java/net/minecraft/server/VillagerTrades.java +++ b/src/main/java/net/minecraft/server/VillagerTrades.java -@@ -92,7 +92,8 @@ public class VillagerTrades { +@@ -91,7 +91,8 @@ public class VillagerTrades { return null; } else { WorldServer worldserver = (WorldServer) entity.world; -- BlockPosition blockposition = worldserver.a(this.b, new BlockPosition(entity), 100, true); -+ if (!worldserver.paperConfig.enableTreasureMaps) return null; //Paper -+ BlockPosition blockposition = worldserver.a(this.b, new BlockPosition(entity), 100, !worldserver.paperConfig.treasureMapsAlreadyDiscovered); //Paper +- BlockPosition blockposition = worldserver.a(this.b, entity.getChunkCoordinates(), 100, true); ++ if (!worldserver.paperConfig.enableTreasureMaps) return null; // Paper ++ BlockPosition blockposition = worldserver.a(this.b, entity.getChunkCoordinates(), 100, !worldserver.paperConfig.treasureMapsAlreadyDiscovered); // Paper if (blockposition != null) { ItemStack itemstack = ItemWorldMap.createFilledMapView(worldserver, blockposition.getX(), blockposition.getZ(), (byte) 2, true, true); diff --git a/Spigot-Server-Patches/0130-Optimize-ItemStack.isEmpty.patch b/Spigot-Server-Patches/0128-Optimize-ItemStack.isEmpty.patch similarity index 65% rename from Spigot-Server-Patches/0130-Optimize-ItemStack.isEmpty.patch rename to Spigot-Server-Patches/0128-Optimize-ItemStack.isEmpty.patch index 0f34b8cd1..6c4eed7d3 100644 --- a/Spigot-Server-Patches/0130-Optimize-ItemStack.isEmpty.patch +++ b/Spigot-Server-Patches/0128-Optimize-ItemStack.isEmpty.patch @@ -6,15 +6,15 @@ Subject: [PATCH] Optimize ItemStack.isEmpty() Remove hashMap lookup every check, simplify code to remove ternary diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java -index db11c8ec692aaf37fc68fd39b95fcadacf5eda38..854cffe6c98956cbafa2ead9b831e39209a76c8d 100644 +index a360711ea14983e8df34caa5edda80a015e6db23..c4d034c6a6ff176bc954c00c328512bdf67455a6 100644 --- a/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java -@@ -150,7 +150,7 @@ public final class ItemStack { +@@ -154,7 +154,7 @@ public final class ItemStack { } public boolean isEmpty() { -- return this == ItemStack.a ? true : (this.getItem() != null && this.getItem() != Items.AIR ? this.count <= 0 : true); -+ return this == ItemStack.a || this.item == null || this.item == Items.AIR || this.count <= 0; // Paper +- return this == ItemStack.b ? true : (this.getItem() != null && this.getItem() != Items.AIR ? this.count <= 0 : true); ++ return this == ItemStack.NULL_ITEM || this.item == null || this.item == Items.AIR || this.count <= 0; // Paper } public ItemStack cloneAndSubtract(int i) { diff --git a/Spigot-Server-Patches/0131-Add-API-methods-to-control-if-armour-stands-can-move.patch b/Spigot-Server-Patches/0129-Add-API-methods-to-control-if-armour-stands-can-move.patch similarity index 93% rename from Spigot-Server-Patches/0131-Add-API-methods-to-control-if-armour-stands-can-move.patch rename to Spigot-Server-Patches/0129-Add-API-methods-to-control-if-armour-stands-can-move.patch index 18dc2682d..c05365d97 100644 --- a/Spigot-Server-Patches/0131-Add-API-methods-to-control-if-armour-stands-can-move.patch +++ b/Spigot-Server-Patches/0129-Add-API-methods-to-control-if-armour-stands-can-move.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add API methods to control if armour stands can move diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java -index ed6092f65a57b696d1343b5b6c061422bd1220b1..176af6c889fa29d5df7c822f888cdc26f81110e6 100644 +index 073c3e17eee996f2a9b620bbc13c59d6e342fd6c..3571ef9ac1299702ad274aad43070abf959bf9d9 100644 --- a/src/main/java/net/minecraft/server/EntityArmorStand.java +++ b/src/main/java/net/minecraft/server/EntityArmorStand.java @@ -43,6 +43,7 @@ public class EntityArmorStand extends EntityLiving { @@ -18,7 +18,7 @@ index ed6092f65a57b696d1343b5b6c061422bd1220b1..176af6c889fa29d5df7c822f888cdc26 super(entitytypes, world); @@ -817,4 +818,13 @@ public class EntityArmorStand extends EntityLiving { - return this.getEntityType().k().a(f); + return this.getEntityType().l().a(f); } + + // Paper start diff --git a/Spigot-Server-Patches/0132-Properly-fix-item-duplication-bug.patch b/Spigot-Server-Patches/0130-Properly-fix-item-duplication-bug.patch similarity index 80% rename from Spigot-Server-Patches/0132-Properly-fix-item-duplication-bug.patch rename to Spigot-Server-Patches/0130-Properly-fix-item-duplication-bug.patch index 38e21f3ef..ee946ddf2 100644 --- a/Spigot-Server-Patches/0132-Properly-fix-item-duplication-bug.patch +++ b/Spigot-Server-Patches/0130-Properly-fix-item-duplication-bug.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Properly fix item duplication bug Credit to prplz for figuring out the real issue diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 482d7b7cb6b89d79b2ce54338130481f9f1c8c24..bf32997c422d478699c32ce0539a65c35fbf0d12 100644 +index c1c858f9384eb6e952198e531633d0a571c39ac2..7d6b1893ae6b7a3e937f8f83fc222709c8120814 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -1795,7 +1795,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -1933,7 +1933,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { @Override protected boolean isFrozen() { @@ -19,10 +19,10 @@ index 482d7b7cb6b89d79b2ce54338130481f9f1c8c24..bf32997c422d478699c32ce0539a65c3 @Override diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index eb3ed0d8757c59b387cd74a6df7371c356bd6d3a..fbaf234e8400dc14dc2421c87c80eb887ba44fef 100644 +index 17edeff6cf5c3f7fee5c17028d3231f70f358537..e04bb290a94f5cfc93b5bd2121e6b32610199237 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -2526,7 +2526,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -2569,7 +2569,7 @@ public class PlayerConnection implements PacketListenerPlayIn { } public final boolean isDisconnected() { diff --git a/Spigot-Server-Patches/0133-String-based-Action-Bar-API.patch b/Spigot-Server-Patches/0131-String-based-Action-Bar-API.patch similarity index 52% rename from Spigot-Server-Patches/0133-String-based-Action-Bar-API.patch rename to Spigot-Server-Patches/0131-String-based-Action-Bar-API.patch index ca1000312..a7acfc523 100644 --- a/Spigot-Server-Patches/0133-String-based-Action-Bar-API.patch +++ b/Spigot-Server-Patches/0131-String-based-Action-Bar-API.patch @@ -4,18 +4,31 @@ Date: Tue, 27 Dec 2016 15:02:42 -0500 Subject: [PATCH] String based Action Bar API +diff --git a/src/main/java/net/minecraft/server/SystemUtils.java b/src/main/java/net/minecraft/server/SystemUtils.java +index 275c1d2d1eb2649de9a9b5aece6e88c21362efba..d72ba7f76c42fd525a5b59a999a0c08e35d0ef78 100644 +--- a/src/main/java/net/minecraft/server/SystemUtils.java ++++ b/src/main/java/net/minecraft/server/SystemUtils.java +@@ -48,7 +48,7 @@ public class SystemUtils { + private static final ExecutorService e = a("Main"); + private static final ExecutorService f = n(); + public static LongSupplier a = System::nanoTime; +- public static final UUID b = new UUID(0L, 0L); ++ public static final UUID b = new UUID(0L, 0L); public static final UUID getNullUUID() {return b;} // Paper OBFHELPER + private static final Logger LOGGER = LogManager.getLogger(); + + public static Collector, ?, Map> a() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index a85638fb4022361cb17cac0d666f26cdd1a5ef11..a4afce71be0707c43700b73ae0107074448e3d4a 100644 +index 9e9d054ed9d345eb7ab76ad9c3526889aeb220e3..e7c42fb4fd1235a934c16f4cccc1b1a66b3672a0 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -215,6 +215,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -221,6 +221,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } // Paper start + @Override + public void sendActionBar(String message) { + if (getHandle().playerConnection == null || message == null || message.isEmpty()) return; -+ getHandle().playerConnection.sendPacket(new PacketPlayOutChat(new net.minecraft.server.ChatComponentText(message), net.minecraft.server.ChatMessageType.GAME_INFO)); ++ getHandle().playerConnection.sendPacket(new PacketPlayOutChat(new net.minecraft.server.ChatComponentText(message), net.minecraft.server.ChatMessageType.GAME_INFO, SystemUtils.getNullUUID())); + } + + @Override diff --git a/Spigot-Server-Patches/0134-Firework-API-s.patch b/Spigot-Server-Patches/0132-Firework-API-s.patch similarity index 61% rename from Spigot-Server-Patches/0134-Firework-API-s.patch rename to Spigot-Server-Patches/0132-Firework-API-s.patch index 48fc515ad..e8539eaf0 100644 --- a/Spigot-Server-Patches/0134-Firework-API-s.patch +++ b/Spigot-Server-Patches/0132-Firework-API-s.patch @@ -5,29 +5,20 @@ Subject: [PATCH] Firework API's diff --git a/src/main/java/net/minecraft/server/EntityFireworks.java b/src/main/java/net/minecraft/server/EntityFireworks.java -index 4f51b9b654e4a9c9ee43261edb241bcf3c346be2..278ef79d8962cc5d337e34891c7ea3a606336cbb 100644 +index fd34a0f2dcfe300763f31eda4d53951d66d875f7..5ac7957016d1ca6bc78ced0bcf3767d358677f45 100644 --- a/src/main/java/net/minecraft/server/EntityFireworks.java +++ b/src/main/java/net/minecraft/server/EntityFireworks.java -@@ -3,6 +3,8 @@ package net.minecraft.server; - import java.util.Iterator; - import java.util.List; - import java.util.OptionalInt; -+import java.util.UUID; -+ - import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit - - public class EntityFireworks extends Entity implements IProjectile { -@@ -12,7 +14,8 @@ public class EntityFireworks extends Entity implements IProjectile { +@@ -13,7 +13,8 @@ public class EntityFireworks extends IProjectile { public static final DataWatcherObject SHOT_AT_ANGLE = DataWatcher.a(EntityFireworks.class, DataWatcherRegistry.i); private int ticksFlown; public int expectedLifespan; - private EntityLiving ridingEntity; + private EntityLiving ridingEntity; public final EntityLiving getBoostedEntity() { return this.ridingEntity; } // Paper - OBFHELPER -+ public UUID spawningEntity; // Paper ++ public java.util.UUID spawningEntity; // Paper public EntityFireworks(EntityTypes entitytypes, World world) { super(entitytypes, world); -@@ -268,6 +271,11 @@ public class EntityFireworks extends Entity implements IProjectile { +@@ -258,6 +259,11 @@ public class EntityFireworks extends IProjectile { } nbttagcompound.setBoolean("ShotAtAngle", (Boolean) this.datawatcher.get(EntityFireworks.SHOT_AT_ANGLE)); @@ -39,7 +30,7 @@ index 4f51b9b654e4a9c9ee43261edb241bcf3c346be2..278ef79d8962cc5d337e34891c7ea3a6 } @Override -@@ -283,7 +291,11 @@ public class EntityFireworks extends Entity implements IProjectile { +@@ -274,7 +280,11 @@ public class EntityFireworks extends IProjectile { if (nbttagcompound.hasKey("ShotAtAngle")) { this.datawatcher.set(EntityFireworks.SHOT_AT_ANGLE, nbttagcompound.getBoolean("ShotAtAngle")); } @@ -53,25 +44,25 @@ index 4f51b9b654e4a9c9ee43261edb241bcf3c346be2..278ef79d8962cc5d337e34891c7ea3a6 @Override diff --git a/src/main/java/net/minecraft/server/ItemCrossbow.java b/src/main/java/net/minecraft/server/ItemCrossbow.java -index 313076d6d8aa130451c4d6cc2795d34fd39f3e5d..7be41c8698e86727978db7d72b3dd3fbfe6b7272 100644 +index a2549cf1253f472d58ce68e4414448561a7a5ba4..1592e94c78611a4b968bfb24daf68570e778fadd 100644 --- a/src/main/java/net/minecraft/server/ItemCrossbow.java +++ b/src/main/java/net/minecraft/server/ItemCrossbow.java -@@ -199,6 +199,7 @@ public class ItemCrossbow extends ItemProjectileWeapon { +@@ -183,6 +183,7 @@ public class ItemCrossbow extends ItemProjectileWeapon implements ItemVanishable if (flag1) { - object = new EntityFireworks(world, itemstack1, entityliving.locX(), entityliving.getHeadY() - 0.15000000596046448D, entityliving.locZ(), true); + object = new EntityFireworks(world, itemstack1, entityliving, entityliving.locX(), entityliving.getHeadY() - 0.15000000596046448D, entityliving.locZ(), true); + ((EntityFireworks) object).spawningEntity = entityliving.getUniqueID(); // Paper } else { object = a(world, entityliving, itemstack, itemstack1); if (flag || f3 != 0.0F) { diff --git a/src/main/java/net/minecraft/server/ItemFireworks.java b/src/main/java/net/minecraft/server/ItemFireworks.java -index 058c016b7b12cea106916dbd81a231d29c67bc0f..92dac35ec4eefe0d5794d8205bc872d23a62e3cb 100644 +index 12ae2d9b747b69533fab2487ad55626c50c1d620..6cc243025f5bdac9be39f8a88a018893a9941dba 100644 --- a/src/main/java/net/minecraft/server/ItemFireworks.java +++ b/src/main/java/net/minecraft/server/ItemFireworks.java @@ -18,6 +18,7 @@ public class ItemFireworks extends Item { Vec3D vec3d = itemactioncontext.getPos(); EnumDirection enumdirection = itemactioncontext.getClickedFace(); - EntityFireworks entityfireworks = new EntityFireworks(world, vec3d.x + (double) enumdirection.getAdjacentX() * 0.15D, vec3d.y + (double) enumdirection.getAdjacentY() * 0.15D, vec3d.z + (double) enumdirection.getAdjacentZ() * 0.15D, itemstack); + EntityFireworks entityfireworks = new EntityFireworks(world, itemactioncontext.getEntity(), vec3d.x + (double) enumdirection.getAdjacentX() * 0.15D, vec3d.y + (double) enumdirection.getAdjacentY() * 0.15D, vec3d.z + (double) enumdirection.getAdjacentZ() * 0.15D, itemstack); + entityfireworks.spawningEntity = itemactioncontext.getEntity().getUniqueID(); // Paper world.addEntity(entityfireworks); @@ -90,57 +81,36 @@ index 058c016b7b12cea106916dbd81a231d29c67bc0f..92dac35ec4eefe0d5794d8205bc872d2 itemstack.subtract(1); } diff --git a/src/main/java/net/minecraft/server/NBTTagCompound.java b/src/main/java/net/minecraft/server/NBTTagCompound.java -index 75604dbc69d0a416dc9d56ae3f795ed03e120af8..98deaba12ceb25f59d1b56420fb544a64b417ddd 100644 +index c16ff6723d3fd191b990002d40dc021d7870555d..9c445902e6adc05773497bc4444203ca364e4f5c 100644 --- a/src/main/java/net/minecraft/server/NBTTagCompound.java +++ b/src/main/java/net/minecraft/server/NBTTagCompound.java -@@ -136,7 +136,7 @@ public class NBTTagCompound implements NBTBase { - return new UUID(this.getLong(s + "Most"), this.getLong(s + "Least")); +@@ -145,6 +145,7 @@ public class NBTTagCompound implements NBTBase { + return GameProfileSerializer.a(this.get(s)); } -- public boolean b(String s) { -+ public final boolean hasUUID(String s) { return this.b(s); } public boolean b(String s) { // Paper - OBFHELPER - return this.hasKeyOfType(s + "Most", 99) && this.hasKeyOfType(s + "Least", 99); - } ++ public final boolean hasUUID(String s) { return this.b(s); } // Paper - OBFHELPER + public boolean b(String s) { + NBTBase nbtbase = this.get(s); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java -index 475b7b004b7b30ee9e7d0dad92c4691ecd4afbdc..de74e7214a02a07e3ebdd099036c70bbc84c60e1 100644 +index d984a7a78e9f8536abf7c30df9aa59dbfc7984ce..2dfa24e52ae9c46291090d367b1ee4e25a71c213 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java -@@ -2,6 +2,7 @@ package org.bukkit.craftbukkit.entity; - - import java.util.Random; - import net.minecraft.server.EntityFireworks; -+import net.minecraft.server.EntityLiving; - import net.minecraft.server.ItemStack; - import net.minecraft.server.Items; - import org.bukkit.Material; -@@ -9,8 +10,11 @@ import org.bukkit.craftbukkit.CraftServer; - import org.bukkit.craftbukkit.inventory.CraftItemStack; - import org.bukkit.entity.EntityType; - import org.bukkit.entity.Firework; -+import org.bukkit.entity.LivingEntity; - import org.bukkit.inventory.meta.FireworkMeta; - -+import java.util.UUID; -+ - public class CraftFirework extends CraftEntity implements Firework { - - private final Random random = new Random(); -@@ -78,4 +82,17 @@ public class CraftFirework extends CraftEntity implements Firework { +@@ -78,4 +78,17 @@ public class CraftFirework extends CraftProjectile implements Firework { public void setShotAtAngle(boolean shotAtAngle) { getHandle().getDataWatcher().set(EntityFireworks.SHOT_AT_ANGLE, shotAtAngle); } + + // Paper start + @Override -+ public UUID getSpawningEntity() { ++ public java.util.UUID getSpawningEntity() { + return getHandle().spawningEntity; + } + + @Override -+ public LivingEntity getBoostedEntity() { -+ EntityLiving boostedEntity = getHandle().getBoostedEntity(); -+ return boostedEntity != null ? (LivingEntity) boostedEntity.getBukkitEntity() : null; ++ public org.bukkit.entity.LivingEntity getBoostedEntity() { ++ net.minecraft.server.EntityLiving boostedEntity = getHandle().getBoostedEntity(); ++ return boostedEntity != null ? (org.bukkit.entity.LivingEntity) boostedEntity.getBukkitEntity() : null; + } + // Paper end } diff --git a/Spigot-Server-Patches/0135-PlayerTeleportEndGatewayEvent.patch b/Spigot-Server-Patches/0133-PlayerTeleportEndGatewayEvent.patch similarity index 89% rename from Spigot-Server-Patches/0135-PlayerTeleportEndGatewayEvent.patch rename to Spigot-Server-Patches/0133-PlayerTeleportEndGatewayEvent.patch index 0478b625b..0de9818d2 100644 --- a/Spigot-Server-Patches/0135-PlayerTeleportEndGatewayEvent.patch +++ b/Spigot-Server-Patches/0133-PlayerTeleportEndGatewayEvent.patch @@ -6,10 +6,10 @@ Subject: [PATCH] PlayerTeleportEndGatewayEvent Allows you to access the Gateway being used in a teleport event diff --git a/src/main/java/net/minecraft/server/TileEntityEndGateway.java b/src/main/java/net/minecraft/server/TileEntityEndGateway.java -index b907a3c4d8dcf0d6dadb98807779fdfe1d706a52..78fba79378173dc2c4290e048c3497e206332458 100644 +index 2c449a92b1e0941cf746c3c50257e5c99f542d16..4686880e1f37841ae0217654ed6aa8f813ad90a6 100644 --- a/src/main/java/net/minecraft/server/TileEntityEndGateway.java +++ b/src/main/java/net/minecraft/server/TileEntityEndGateway.java -@@ -133,7 +133,7 @@ public class TileEntityEndGateway extends TileEntityEnderPortal implements ITick +@@ -151,7 +151,7 @@ public class TileEntityEndGateway extends TileEntityEnderPortal implements ITick location.setPitch(player.getLocation().getPitch()); location.setYaw(player.getLocation().getYaw()); diff --git a/Spigot-Server-Patches/0136-Provide-E-TE-Chunk-count-stat-methods.patch b/Spigot-Server-Patches/0134-Provide-E-TE-Chunk-count-stat-methods.patch similarity index 91% rename from Spigot-Server-Patches/0136-Provide-E-TE-Chunk-count-stat-methods.patch rename to Spigot-Server-Patches/0134-Provide-E-TE-Chunk-count-stat-methods.patch index 7eb6fa96a..1c58ca5da 100644 --- a/Spigot-Server-Patches/0136-Provide-E-TE-Chunk-count-stat-methods.patch +++ b/Spigot-Server-Patches/0134-Provide-E-TE-Chunk-count-stat-methods.patch @@ -7,11 +7,11 @@ Provides counts without the ineffeciency of using .getEntities().size() which creates copy of the collections. diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 3f420be58afb3721cef9caa413a2292a57406d19..32e96bc05704f10ac4830a661bd6abb71b71f487 100644 +index a6d892bab669d13767c43115cdbd99557181322d..ef3a539fd40555b1049131ee201569cabe2d6179 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -278,6 +278,48 @@ public class CraftWorld implements World { - private int waterAnimalSpawn = -1; +@@ -281,6 +281,48 @@ public class CraftWorld implements World { + private int waterAmbientSpawn = -1; private int ambientSpawn = -1; + // Paper start - Provide fast information methods diff --git a/Spigot-Server-Patches/0137-Enforce-Sync-Player-Saves.patch b/Spigot-Server-Patches/0135-Enforce-Sync-Player-Saves.patch similarity index 86% rename from Spigot-Server-Patches/0137-Enforce-Sync-Player-Saves.patch rename to Spigot-Server-Patches/0135-Enforce-Sync-Player-Saves.patch index 8f197b5f9..d98c82248 100644 --- a/Spigot-Server-Patches/0137-Enforce-Sync-Player-Saves.patch +++ b/Spigot-Server-Patches/0135-Enforce-Sync-Player-Saves.patch @@ -7,10 +7,10 @@ Saving players async is extremely dangerous. This will force it to main the same way we handle async chunk loads. diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index aeb0a77d9aaf3877310528286a481f71fd5a4290..a97941d1f8a125c6d033b1d359c1527937f97799 100644 +index 7fb344d9ef8f5c7a6c6ed5e7256d55860726c6f2..bfe7848655498287e357593259e188f161292d3e 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -918,11 +918,13 @@ public abstract class PlayerList { +@@ -961,11 +961,13 @@ public abstract class PlayerList { } public void savePlayers() { diff --git a/Spigot-Server-Patches/0138-Don-t-allow-entities-to-ride-themselves-572.patch b/Spigot-Server-Patches/0136-Don-t-allow-entities-to-ride-themselves-572.patch similarity index 83% rename from Spigot-Server-Patches/0138-Don-t-allow-entities-to-ride-themselves-572.patch rename to Spigot-Server-Patches/0136-Don-t-allow-entities-to-ride-themselves-572.patch index 9ce22e7cd..a03971152 100644 --- a/Spigot-Server-Patches/0138-Don-t-allow-entities-to-ride-themselves-572.patch +++ b/Spigot-Server-Patches/0136-Don-t-allow-entities-to-ride-themselves-572.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Don't allow entities to ride themselves - #572 diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 8a2093ac5a6d47c795523a1aab87e46f10b1699e..63649936525efd33f50c602f6d723085edb2896e 100644 +index 393a2d3ede8e82b33979f18e0cda796bf003f8ef..bd270ea92404c2055c09324988e1ec28109a8815 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -2031,6 +2031,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -1950,6 +1950,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke } protected boolean addPassenger(Entity entity) { // CraftBukkit diff --git a/Spigot-Server-Patches/0139-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch b/Spigot-Server-Patches/0137-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch similarity index 74% rename from Spigot-Server-Patches/0139-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch rename to Spigot-Server-Patches/0137-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch index 570232f96..2c38d50ee 100644 --- a/Spigot-Server-Patches/0139-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch +++ b/Spigot-Server-Patches/0137-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch @@ -8,10 +8,10 @@ Adds lots of information about why this orb exists. Replaces isFromBottle() with logic that persists entity reloads too. diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java -index 5de881371a485957fd8fadc7540a2b549b20dd65..5f261b9b92de4ca8638f41fa2947016cf590cf05 100644 +index 3cc572b0ce757160c7ab4733b98d8ca84f9f325a..247d9300a755aa22c2ca3bcef86b3b25f3ed75ee 100644 --- a/src/main/java/net/minecraft/server/Block.java +++ b/src/main/java/net/minecraft/server/Block.java -@@ -511,13 +511,13 @@ public class Block implements IMaterial { +@@ -236,13 +236,13 @@ public class Block extends BlockBase implements IMaterial { } } @@ -28,7 +28,7 @@ index 5de881371a485957fd8fadc7540a2b549b20dd65..5f261b9b92de4ca8638f41fa2947016c } diff --git a/src/main/java/net/minecraft/server/ContainerGrindstone.java b/src/main/java/net/minecraft/server/ContainerGrindstone.java -index 2d2cd09ad1126b3b6b7a979b8e4dd450806d58d3..ed88e208d00f3b19b5c5916cf87513ab511a5fb1 100644 +index 5bdb0c3a7a04a55cd5ddff8e375497e402408811..fe9a083b724a8657cac8462b3f44d3cc12a4db58 100644 --- a/src/main/java/net/minecraft/server/ContainerGrindstone.java +++ b/src/main/java/net/minecraft/server/ContainerGrindstone.java @@ -81,7 +81,7 @@ public class ContainerGrindstone extends Container { @@ -40,11 +40,24 @@ index 2d2cd09ad1126b3b6b7a979b8e4dd450806d58d3..ed88e208d00f3b19b5c5916cf87513ab } world.triggerEffect(1042, blockposition, 0); +diff --git a/src/main/java/net/minecraft/server/EntityAnimal.java b/src/main/java/net/minecraft/server/EntityAnimal.java +index b09d7bccf6faae08284e905a8bad0c8f75f59109..b1a41ca53462e50dc0d5cabfcd91579908c07b62 100644 +--- a/src/main/java/net/minecraft/server/EntityAnimal.java ++++ b/src/main/java/net/minecraft/server/EntityAnimal.java +@@ -237,7 +237,7 @@ public abstract class EntityAnimal extends EntityAgeable { + if (world.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) { + // CraftBukkit start - use event experience + if (experience > 0) { +- world.addEntity(new EntityExperienceOrb(world, this.locX(), this.locY(), this.locZ(), experience)); ++ world.addEntity(new EntityExperienceOrb(world, this.locX(), this.locY(), this.locZ(), experience, org.bukkit.entity.ExperienceOrb.SpawnReason.BREED, entityplayer, entityageable)); // Paper + } + // CraftBukkit end + } diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java -index 87625776963d6143d570cda8e72fda6b3f50047f..138e2ea56a91e519a34fd3be9c0ab111a4b17544 100644 +index 72a9430789301b264a36c5060ded31ccdc4a1ebf..05b7cdb33b45a4f503cd7fe4130b54d59e7b6452 100644 --- a/src/main/java/net/minecraft/server/EntityEnderDragon.java +++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java -@@ -616,7 +616,7 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster { +@@ -612,7 +612,7 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster { int j = EntityExperienceOrb.getOrbValue(i); i -= j; @@ -54,7 +67,7 @@ index 87625776963d6143d570cda8e72fda6b3f50047f..138e2ea56a91e519a34fd3be9c0ab111 } diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java -index 0447800d9dc341af647a928abd8b79938eddbd6f..d4275e733d9996d121efd95ae1ff4676a1ebfbb5 100644 +index c13a47382d0a7456fa5035a64f42a6ed5e9f1c8e..d9a0cd1e90445ff7a1d9e7cef2f71e27bd3686cb 100644 --- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java +++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java @@ -16,9 +16,59 @@ public class EntityExperienceOrb extends Entity { @@ -117,7 +130,7 @@ index 0447800d9dc341af647a928abd8b79938eddbd6f..d4275e733d9996d121efd95ae1ff4676 this.setPosition(d0, d1, d2); this.yaw = (float) (this.random.nextDouble() * 360.0D); this.setMot((this.random.nextDouble() * 0.20000000298023224D - 0.10000000149011612D) * 2.0D, this.random.nextDouble() * 0.2D * 2.0D, (this.random.nextDouble() * 0.20000000298023224D - 0.10000000149011612D) * 2.0D); -@@ -158,6 +208,7 @@ public class EntityExperienceOrb extends Entity { +@@ -153,6 +203,7 @@ public class EntityExperienceOrb extends Entity { nbttagcompound.setShort("Health", (short) this.e); nbttagcompound.setShort("Age", (short) this.c); nbttagcompound.setShort("Value", (short) this.value); @@ -125,7 +138,7 @@ index 0447800d9dc341af647a928abd8b79938eddbd6f..d4275e733d9996d121efd95ae1ff4676 } @Override -@@ -165,6 +216,7 @@ public class EntityExperienceOrb extends Entity { +@@ -160,6 +211,7 @@ public class EntityExperienceOrb extends Entity { this.e = nbttagcompound.getShort("Health"); this.c = nbttagcompound.getShort("Age"); this.value = nbttagcompound.getShort("Value"); @@ -134,23 +147,36 @@ index 0447800d9dc341af647a928abd8b79938eddbd6f..d4275e733d9996d121efd95ae1ff4676 @Override diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java -index 807ec3394db7bef29bf92f2c200fd76f96df03ab..73f5961aa331aa94fbbc57c5b4db9bc43ee5cdde 100644 +index 13b46c59b9a017bfa985ad74f80eca77608d1891..03c6a81346857392aacb22a0947bdc6391a260f2 100644 --- a/src/main/java/net/minecraft/server/EntityFishingHook.java +++ b/src/main/java/net/minecraft/server/EntityFishingHook.java -@@ -401,7 +401,7 @@ public class EntityFishingHook extends Entity { +@@ -454,7 +454,7 @@ public class EntityFishingHook extends IProjectile { this.world.addEntity(entityitem); // CraftBukkit start - this.random.nextInt(6) + 1 -> playerFishEvent.getExpToDrop() if (playerFishEvent.getExpToDrop() > 0) { -- this.owner.world.addEntity(new EntityExperienceOrb(this.owner.world, this.owner.locX(), this.owner.locY() + 0.5D, this.owner.locZ() + 0.5D, playerFishEvent.getExpToDrop())); -+ this.owner.world.addEntity(new EntityExperienceOrb(this.owner.world, this.owner.locX(), this.owner.locY() + 0.5D, this.owner.locZ() + 0.5D, playerFishEvent.getExpToDrop(), org.bukkit.entity.ExperienceOrb.SpawnReason.FISHING, this.owner, this)); // Paper +- entityhuman.world.addEntity(new EntityExperienceOrb(entityhuman.world, entityhuman.locX(), entityhuman.locY() + 0.5D, entityhuman.locZ() + 0.5D, playerFishEvent.getExpToDrop())); ++ entityhuman.world.addEntity(new EntityExperienceOrb(entityhuman.world, entityhuman.locX(), entityhuman.locY() + 0.5D, entityhuman.locZ() + 0.5D, playerFishEvent.getExpToDrop(), org.bukkit.entity.ExperienceOrb.SpawnReason.FISHING, this.getOwner(), this)); // Paper } // CraftBukkit end - if (itemstack1.getItem().a(TagsItem.FISHES)) { + if (itemstack1.getItem().a((Tag) TagsItem.FISHES)) { +diff --git a/src/main/java/net/minecraft/server/EntityFox.java b/src/main/java/net/minecraft/server/EntityFox.java +index c0c0187447976050ea57ae0c4bd62ba7f14c0f6b..95874526516291607a44ae2213d4d6d65edfe18d 100644 +--- a/src/main/java/net/minecraft/server/EntityFox.java ++++ b/src/main/java/net/minecraft/server/EntityFox.java +@@ -1234,7 +1234,7 @@ public class EntityFox extends EntityAnimal { + if (this.b.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) { + // CraftBukkit start - use event experience + if (experience > 0) { +- this.b.addEntity(new EntityExperienceOrb(this.b, this.animal.locX(), this.animal.locY(), this.animal.locZ(), experience)); ++ this.b.addEntity(new EntityExperienceOrb(this.b, this.animal.locX(), this.animal.locY(), this.animal.locZ(), experience, org.bukkit.entity.ExperienceOrb.SpawnReason.BREED, entityplayer, entityfox)); // Paper + } + // CraftBukkit end + } diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 56c8b56b06a67e90c05f21c8141e61df7c9aafb1..306435c1c6f28ad1a891d4ee8c124b14a83ae25b 100644 +index 9086712e1206a980a10c7cc36d3ae3a0b8f8bc79..7e4b79fcee2b5e9a2c24e0372cda7d71f38b22e3 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -1379,7 +1379,8 @@ public abstract class EntityLiving extends Entity { +@@ -1488,7 +1488,8 @@ public abstract class EntityLiving extends Entity { int j = EntityExperienceOrb.getOrbValue(i); i -= j; @@ -161,10 +187,10 @@ index 56c8b56b06a67e90c05f21c8141e61df7c9aafb1..306435c1c6f28ad1a891d4ee8c124b14 this.expToDrop = 0; } diff --git a/src/main/java/net/minecraft/server/EntityThrownExpBottle.java b/src/main/java/net/minecraft/server/EntityThrownExpBottle.java -index 0bfc0a773da3e26cb0188adc8369215dcc953b62..ba2f90cc6ae617fe9bb8e08656b64ded924afa60 100644 +index 7a80b341ee7734cc289abdff8755834447cbef75..2d3ca8c424f2088027d51066d634c48723e96214 100644 --- a/src/main/java/net/minecraft/server/EntityThrownExpBottle.java +++ b/src/main/java/net/minecraft/server/EntityThrownExpBottle.java -@@ -43,7 +43,7 @@ public class EntityThrownExpBottle extends EntityProjectileThrowable { +@@ -44,7 +44,7 @@ public class EntityThrownExpBottle extends EntityProjectileThrowable { int j = EntityExperienceOrb.getOrbValue(i); i -= j; @@ -174,10 +200,10 @@ index 0bfc0a773da3e26cb0188adc8369215dcc953b62..ba2f90cc6ae617fe9bb8e08656b64ded this.die(); diff --git a/src/main/java/net/minecraft/server/EntityTurtle.java b/src/main/java/net/minecraft/server/EntityTurtle.java -index c73cc9ae4b1f1f24e017b336b4e0e52275807c8b..76296119a197a433747ee2481079b36aebdb085c 100644 +index 13c8fab8a57eb3f90abb4bbc5a6c5b5f8bdad0d2..dd745894614982fad6277e77b98bed75fc2a2f55 100644 --- a/src/main/java/net/minecraft/server/EntityTurtle.java +++ b/src/main/java/net/minecraft/server/EntityTurtle.java -@@ -510,7 +510,7 @@ public class EntityTurtle extends EntityAnimal { +@@ -499,7 +499,7 @@ public class EntityTurtle extends EntityAnimal { Random random = this.animal.getRandom(); if (this.b.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) { @@ -187,10 +213,10 @@ index c73cc9ae4b1f1f24e017b336b4e0e52275807c8b..76296119a197a433747ee2481079b36a } diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java -index 5e3835851d8c5e804542c256a54187e4ed05bace..6ca4fa43c41ad555c093b90cf08cfdb1e73fda22 100644 +index d0b04707e830fbaf3a6bfe92637e4432172fd9c7..00183a7f6e2000ce045ce50454f1296c4c93b148 100644 --- a/src/main/java/net/minecraft/server/EntityVillager.java +++ b/src/main/java/net/minecraft/server/EntityVillager.java -@@ -509,7 +509,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation +@@ -532,7 +532,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation } if (merchantrecipe.isRewardExp()) { @@ -200,10 +226,10 @@ index 5e3835851d8c5e804542c256a54187e4ed05bace..6ca4fa43c41ad555c093b90cf08cfdb1 } diff --git a/src/main/java/net/minecraft/server/EntityVillagerTrader.java b/src/main/java/net/minecraft/server/EntityVillagerTrader.java -index 530c69996470ad79b93254ed39aa1b101c007c89..2ad8dba5c0f8424becacda44232813c5f4451fd4 100644 +index e3a80bddc59c8f148a6a195deb3e8fa85fba4c7b..a0841cfaf950508b73b43a5fadbc1796015e5dbb 100644 --- a/src/main/java/net/minecraft/server/EntityVillagerTrader.java +++ b/src/main/java/net/minecraft/server/EntityVillagerTrader.java -@@ -147,7 +147,7 @@ public class EntityVillagerTrader extends EntityVillagerAbstract { +@@ -144,7 +144,7 @@ public class EntityVillagerTrader extends EntityVillagerAbstract { if (merchantrecipe.isRewardExp()) { int i = 3 + this.random.nextInt(4); @@ -212,24 +238,11 @@ index 530c69996470ad79b93254ed39aa1b101c007c89..2ad8dba5c0f8424becacda44232813c5 } } -diff --git a/src/main/java/net/minecraft/server/PathfinderGoalBreed.java b/src/main/java/net/minecraft/server/PathfinderGoalBreed.java -index 1ab2668e910dca6c02d03b88b27fe709cbee785c..2b708761d0401ead80d8ff832decc8d725c5f61c 100644 ---- a/src/main/java/net/minecraft/server/PathfinderGoalBreed.java -+++ b/src/main/java/net/minecraft/server/PathfinderGoalBreed.java -@@ -117,7 +117,7 @@ public class PathfinderGoalBreed extends PathfinderGoal { - if (this.b.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) { - // CraftBukkit start - use event experience - if (experience > 0) { -- this.b.addEntity(new EntityExperienceOrb(this.b, this.animal.locX(), this.animal.locY(), this.animal.locZ(), experience)); -+ this.b.addEntity(new EntityExperienceOrb(this.b, this.animal.locX(), this.animal.locY(), this.animal.locZ(), experience, org.bukkit.entity.ExperienceOrb.SpawnReason.BREED, entityplayer, entityageable)); // Paper - } - // CraftBukkit end - } diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java -index f6c6ea4aaf16fae057c356bc4f42fb3a86c63f91..dff3eb118856bb4b79e4378b5c39100d65a09767 100644 +index 136bb85aace4efc34e1fe804bbccc78bf7495b41..ee59d76d31b8b8cfd39d612b1e6040891f2256f4 100644 --- a/src/main/java/net/minecraft/server/PlayerInteractManager.java +++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java -@@ -374,7 +374,7 @@ public class PlayerInteractManager { +@@ -377,7 +377,7 @@ public class PlayerInteractManager { // Drop event experience if (flag && event != null) { @@ -252,31 +265,31 @@ index d2698e847cfcbc4d2f91b4f5d66b38b47f86c10e..edc4a5c34e8064d900668d132b3496e3 public SlotFurnaceResult(EntityHuman entityhuman, IInventory iinventory, int i, int j, int k) { diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java -index 8dc47452a453023e332303575b36732417abd84e..560e2f42b702c5c4870640ad7da3aa48c3f4b1eb 100644 +index ba42ca08ca61832cb07bebcfa0b1e5422d7b30e9..623cd63711c6cb79dce7a46056e193fdb13334a5 100644 --- a/src/main/java/net/minecraft/server/TileEntityFurnace.java +++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java -@@ -554,7 +554,7 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I - while (i > 0) { - j = EntityExperienceOrb.getOrbValue(i); - i -= j; -- entityhuman.world.addEntity(new EntityExperienceOrb(entityhuman.world, entityhuman.locX(), entityhuman.locY() + 0.5D, entityhuman.locZ() + 0.5D, j)); -+ entityhuman.world.addEntity(new EntityExperienceOrb(entityhuman.world, entityhuman.locX(), entityhuman.locY() + 0.5D, entityhuman.locZ() + 0.5D, j, org.bukkit.entity.ExperienceOrb.SpawnReason.FURNACE, entityhuman)); // Paper +@@ -573,7 +573,7 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I + int k = EntityExperienceOrb.getOrbValue(j); + + j -= k; +- world.addEntity(new EntityExperienceOrb(world, vec3d.x, vec3d.y, vec3d.z, k)); ++ world.addEntity(new EntityExperienceOrb(world, vec3d.x, vec3d.y, vec3d.z, k, org.bukkit.entity.ExperienceOrb.SpawnReason.FURNACE, entityhuman)); // Paper } } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 4ca9ddacb7da760b31d405e77b691ef6d8ff534a..13a83f285126123811a148453ccaea6f9bf197b4 100644 +index ef3a539fd40555b1049131ee201569cabe2d6179..81f014977b95056020e9695dd49cbbf45d61b8ea 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -1797,7 +1797,7 @@ public class CraftWorld implements World { +@@ -1817,7 +1817,7 @@ public class CraftWorld implements World { } else if (TNTPrimed.class.isAssignableFrom(clazz)) { entity = new EntityTNTPrimed(world, x, y, z, null); } else if (ExperienceOrb.class.isAssignableFrom(clazz)) { - entity = new EntityExperienceOrb(world, x, y, z, 0); + entity = new EntityExperienceOrb(world, x, y, z, 0, org.bukkit.entity.ExperienceOrb.SpawnReason.CUSTOM, null, null); // Paper } else if (LightningStrike.class.isAssignableFrom(clazz)) { - entity = new EntityLightning(world, x, y, z, false); - } else if (Firework.class.isAssignableFrom(clazz)) { + entity = EntityTypes.LIGHTNING_BOLT.a(world); + } else if (AreaEffectCloud.class.isAssignableFrom(clazz)) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java index 1b512cc45c7a185b8a7950ff9882e1f2af171cc8..fbad0456757cadea4d7f50c63dbb07bad7e8baa9 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java diff --git a/Spigot-Server-Patches/0140-Cap-Entity-Collisions.patch b/Spigot-Server-Patches/0138-Cap-Entity-Collisions.patch similarity index 86% rename from Spigot-Server-Patches/0140-Cap-Entity-Collisions.patch rename to Spigot-Server-Patches/0138-Cap-Entity-Collisions.patch index fdb5db822..1c0ad7590 100644 --- a/Spigot-Server-Patches/0140-Cap-Entity-Collisions.patch +++ b/Spigot-Server-Patches/0138-Cap-Entity-Collisions.patch @@ -12,10 +12,10 @@ just as it does in Vanilla, but entity pushing logic will be capped. You can set this to 0 to disable collisions. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index f164844f339793860e773c499443ce160d0a6830..751551f173338217f6682532a9a5e1a269415177 100644 +index 255b4081314162cbe344b008158c6f4584795fb8..04ee0856a8c62e1afb438d4fddf40e605e82a074 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -322,4 +322,10 @@ public class PaperWorldConfig { +@@ -317,4 +317,10 @@ public class PaperWorldConfig { log("Treasure Maps will return already discovered locations"); } } @@ -27,7 +27,7 @@ index f164844f339793860e773c499443ce160d0a6830..751551f173338217f6682532a9a5e1a2 + } } diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 63649936525efd33f50c602f6d723085edb2896e..0b971ad8addd65850162e46707c15fbc1ba9b8b9 100644 +index bd270ea92404c2055c09324988e1ec28109a8815..912f5be0264b604df175f5825765b03b319a841c 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -188,6 +188,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -39,10 +39,10 @@ index 63649936525efd33f50c602f6d723085edb2896e..0b971ad8addd65850162e46707c15fbc // Spigot end diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 306435c1c6f28ad1a891d4ee8c124b14a83ae25b..639d113de3fa1bbb610c596b84121ccde58f2622 100644 +index 7e4b79fcee2b5e9a2c24e0372cda7d71f38b22e3..0799f3b025c25204fddfd818b314ec1452a1ba1a 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -2626,8 +2626,11 @@ public abstract class EntityLiving extends Entity { +@@ -2778,8 +2778,11 @@ public abstract class EntityLiving extends Entity { } } diff --git a/Spigot-Server-Patches/0141-Remove-CraftScheduler-Async-Task-Debugger.patch b/Spigot-Server-Patches/0139-Remove-CraftScheduler-Async-Task-Debugger.patch similarity index 87% rename from Spigot-Server-Patches/0141-Remove-CraftScheduler-Async-Task-Debugger.patch rename to Spigot-Server-Patches/0139-Remove-CraftScheduler-Async-Task-Debugger.patch index a602785ad..710f71c57 100644 --- a/Spigot-Server-Patches/0141-Remove-CraftScheduler-Async-Task-Debugger.patch +++ b/Spigot-Server-Patches/0139-Remove-CraftScheduler-Async-Task-Debugger.patch @@ -9,10 +9,10 @@ One report of a suspected memory leak with the system. This adds additional overhead to asynchronous task dispatching diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java -index e68533176a0c07560118531600304fa76a1c3fc6..ff855035ae55df37d68b284ac18976c46d388af2 100644 +index 343cdb06881fa8b0155b56d29c110bba489f9667..f7a977c342e564b3e24034c756c128068c143a65 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java -@@ -427,7 +427,7 @@ public class CraftScheduler implements BukkitScheduler { +@@ -430,7 +430,7 @@ public class CraftScheduler implements BukkitScheduler { } parsePending(); } else { @@ -21,7 +21,7 @@ index e68533176a0c07560118531600304fa76a1c3fc6..ff855035ae55df37d68b284ac18976c4 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) -@@ -444,7 +444,7 @@ public class CraftScheduler implements BukkitScheduler { +@@ -447,7 +447,7 @@ public class CraftScheduler implements BukkitScheduler { pending.addAll(temp); temp.clear(); MinecraftTimings.bukkitSchedulerFinishTimer.stopTiming(); @@ -30,7 +30,7 @@ index e68533176a0c07560118531600304fa76a1c3fc6..ff855035ae55df37d68b284ac18976c4 } private void addTask(final CraftTask task) { -@@ -504,10 +504,15 @@ public class CraftScheduler implements BukkitScheduler { +@@ -507,10 +507,15 @@ public class CraftScheduler implements BukkitScheduler { @Override public String toString() { diff --git a/Spigot-Server-Patches/0140-Make-targetSize-more-aggressive-in-the-chunk-unload-.patch b/Spigot-Server-Patches/0140-Make-targetSize-more-aggressive-in-the-chunk-unload-.patch new file mode 100644 index 000000000..293fd16f1 --- /dev/null +++ b/Spigot-Server-Patches/0140-Make-targetSize-more-aggressive-in-the-chunk-unload-.patch @@ -0,0 +1,47 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Brokkonaut +Date: Tue, 7 Feb 2017 16:55:35 -0600 +Subject: [PATCH] Make targetSize more aggressive in the chunk unload queue + + +diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java +index 2b4033cb2b3d42b776afb9c219d2f64b6c6b1e79..465beba397f05a31dcda9840375a0e9b97153e78 100644 +--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java +@@ -75,7 +75,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + private final PlayerMap playerMap; + public final Int2ObjectMap trackedEntities; + private final Long2ByteMap z; +- private final Queue A; ++ private final Queue A; private final Queue getUnloadQueueTasks() { return this.A; } // Paper - OBFHELPER + private int viewDistance; + + // CraftBukkit start - recursion-safe executor for Chunk loadCallback() and unloadCallback() +@@ -133,7 +133,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + this.playerMap = new PlayerMap(); + this.trackedEntities = new Int2ObjectOpenHashMap(); + this.z = new Long2ByteOpenHashMap(); +- this.A = Queues.newConcurrentLinkedQueue(); ++ this.A = new com.destroystokyo.paper.utils.CachedSizeConcurrentLinkedQueue<>(); // Paper - need constant-time size() + this.definedStructureManager = definedstructuremanager; + this.w = convertable_conversionsession.a(worldserver.getDimensionKey()); + this.world = worldserver; +@@ -391,7 +391,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + // Spigot start + org.spigotmc.SlackActivityAccountant activityAccountant = this.world.getMinecraftServer().slackActivityAccountant; + activityAccountant.startActivity(0.5); +- int targetSize = (int) (this.unloadQueue.size() * UNLOAD_QUEUE_RESIZE_FACTOR); ++ int targetSize = Math.min(this.unloadQueue.size() - 100, (int) (this.unloadQueue.size() * UNLOAD_QUEUE_RESIZE_FACTOR)); // Paper - Make more aggressive + // Spigot end + while (longiterator.hasNext()) { // Spigot + long j = longiterator.nextLong(); +@@ -413,7 +413,8 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + + Runnable runnable; + +- while ((booleansupplier.getAsBoolean() || this.A.size() > 2000) && (runnable = (Runnable) this.A.poll()) != null) { ++ int queueTarget = Math.min(this.getUnloadQueueTasks().size() - 100, (int) (this.getUnloadQueueTasks().size() * UNLOAD_QUEUE_RESIZE_FACTOR)); // Paper - Target this queue as well ++ while ((booleansupplier.getAsBoolean() || this.getUnloadQueueTasks().size() > queueTarget) && (runnable = (Runnable)this.getUnloadQueueTasks().poll()) != null) { // Paper - Target this queue as well + runnable.run(); + } + diff --git a/Spigot-Server-Patches/0143-Do-not-let-armorstands-drown.patch b/Spigot-Server-Patches/0141-Do-not-let-armorstands-drown.patch similarity index 70% rename from Spigot-Server-Patches/0143-Do-not-let-armorstands-drown.patch rename to Spigot-Server-Patches/0141-Do-not-let-armorstands-drown.patch index a23d9d8a1..7d674d774 100644 --- a/Spigot-Server-Patches/0143-Do-not-let-armorstands-drown.patch +++ b/Spigot-Server-Patches/0141-Do-not-let-armorstands-drown.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Do not let armorstands drown diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java -index 176af6c889fa29d5df7c822f888cdc26f81110e6..992d7bfb0fd26540fbdeaf8d7845e8c2c81d608b 100644 +index 3571ef9ac1299702ad274aad43070abf959bf9d9..0232ffba7b18174e0ce44d91285541a9869d07b9 100644 --- a/src/main/java/net/minecraft/server/EntityArmorStand.java +++ b/src/main/java/net/minecraft/server/EntityArmorStand.java @@ -826,5 +826,10 @@ public class EntityArmorStand extends EntityLiving { @@ -20,22 +20,22 @@ index 176af6c889fa29d5df7c822f888cdc26f81110e6..992d7bfb0fd26540fbdeaf8d7845e8c2 // Paper end } diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 639d113de3fa1bbb610c596b84121ccde58f2622..e6b48cc0eafc4612181495a1f412fd4f411ab0e5 100644 +index 0799f3b025c25204fddfd818b314ec1452a1ba1a..34f2821a64c7893ff0a8c33ae4b77ce883227f0c 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -227,6 +227,7 @@ public abstract class EntityLiving extends Entity { +@@ -244,6 +244,7 @@ public abstract class EntityLiving extends Entity { super.a(d0, flag, iblockdata, blockposition); } -+ public boolean canBreatheUnderwater() { return this.cB(); } // Paper - OBFHELPER - public boolean cB() { ++ public boolean canBreatheUnderwater() { return this.cL(); } // Paper - OBFHELPER + public boolean cL() { return this.getMonsterType() == EnumMonsterType.UNDEAD; } -@@ -266,7 +267,7 @@ public abstract class EntityLiving extends Entity { +@@ -287,7 +288,7 @@ public abstract class EntityLiving extends Entity { if (this.isAlive()) { - if (this.a(TagsFluid.WATER) && this.world.getType(new BlockPosition(this.locX(), this.getHeadY(), this.locZ())).getBlock() != Blocks.BUBBLE_COLUMN) { -- if (!this.cB() && !MobEffectUtil.c(this) && !flag1) { + if (this.a((Tag) TagsFluid.WATER) && !this.world.getType(new BlockPosition(this.locX(), this.getHeadY(), this.locZ())).a(Blocks.BUBBLE_COLUMN)) { +- if (!this.cL() && !MobEffectUtil.c(this) && !flag1) { + if (!this.canBreatheUnderwater() && !MobEffectUtil.c(this) && !flag1) { // Paper - use OBFHELPER so it can be overridden this.setAirTicks(this.l(this.getAirTicks())); if (this.getAirTicks() == -20) { diff --git a/Spigot-Server-Patches/0142-Make-targetSize-more-aggressive-in-the-chunk-unload-.patch b/Spigot-Server-Patches/0142-Make-targetSize-more-aggressive-in-the-chunk-unload-.patch deleted file mode 100644 index 05402127f..000000000 --- a/Spigot-Server-Patches/0142-Make-targetSize-more-aggressive-in-the-chunk-unload-.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Brokkonaut -Date: Tue, 7 Feb 2017 16:55:35 -0600 -Subject: [PATCH] Make targetSize more aggressive in the chunk unload queue - - -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 6374bf8785f7d99ab8750deba79867433d31eb5f..0edba596754c6d5379c3c1eb0469aee447b7113f 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -132,7 +132,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - this.u = new AtomicInteger(); - this.playerMap = new PlayerMap(); - this.trackedEntities = new Int2ObjectOpenHashMap(); -- this.z = Queues.newConcurrentLinkedQueue(); -+ this.z = new com.destroystokyo.paper.utils.CachedSizeConcurrentLinkedQueue<>(); // Paper - this.definedStructureManager = definedstructuremanager; - this.w = worldserver.getWorldProvider().getDimensionManager().a(file); - this.world = worldserver; -@@ -390,7 +390,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - // Spigot start - org.spigotmc.SlackActivityAccountant activityAccountant = this.world.getMinecraftServer().slackActivityAccountant; - activityAccountant.startActivity(0.5); -- int targetSize = (int) (this.unloadQueue.size() * UNLOAD_QUEUE_RESIZE_FACTOR); -+ int targetSize = Math.min(this.unloadQueue.size() - 100, (int) (this.unloadQueue.size() * UNLOAD_QUEUE_RESIZE_FACTOR)); // Paper - Make more aggressive - // Spigot end - while (longiterator.hasNext()) { // Spigot - long j = longiterator.nextLong(); -@@ -412,7 +412,8 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - - Runnable runnable; - -- while ((booleansupplier.getAsBoolean() || this.z.size() > 2000) && (runnable = (Runnable) this.z.poll()) != null) { -+ int queueTarget = Math.min(this.z.size() - 100, (int) (this.z.size() * UNLOAD_QUEUE_RESIZE_FACTOR)); // Paper - Target this queue as well -+ while ((booleansupplier.getAsBoolean() || this.z.size() > queueTarget) && (runnable = (Runnable) this.z.poll()) != null) { // Paper - Target this queue as well - runnable.run(); - } - diff --git a/Spigot-Server-Patches/0144-Properly-handle-async-calls-to-restart-the-server.patch b/Spigot-Server-Patches/0142-Properly-handle-async-calls-to-restart-the-server.patch similarity index 93% rename from Spigot-Server-Patches/0144-Properly-handle-async-calls-to-restart-the-server.patch rename to Spigot-Server-Patches/0142-Properly-handle-async-calls-to-restart-the-server.patch index 424206522..ecce73596 100644 --- a/Spigot-Server-Patches/0144-Properly-handle-async-calls-to-restart-the-server.patch +++ b/Spigot-Server-Patches/0142-Properly-handle-async-calls-to-restart-the-server.patch @@ -30,18 +30,18 @@ will have plugins and worlds saving to the disk has a high potential to result in corruption/dataloss. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 629304c403c596bf81dd8de919f0fcb5c77bd403..80d8b0b0eac47b8d8e62db60da9daf0da8671fb3 100644 +index 793d4d928bac4febf090291eb773871b492cdc6d..28478370fc182751178f7dd6c20435218174c700 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -88,6 +88,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant worldServer = Maps.newLinkedHashMap(); // CraftBukkit - keep order, k+v already use identity methods +@@ -91,6 +91,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant, WorldServer> worldServer; private PlayerList playerList; - private volatile boolean isRunning = true; + private volatile boolean isRunning; + private volatile boolean isRestarting = false; // Paper - flag to signify we're attempting to restart private boolean isStopped; private int ticks; protected final Proxy proxy; -@@ -723,7 +724,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant 0.5F || this.isInWater()) || this.abilities.isFlying || this.isSleeping()) { @@ -39,10 +39,10 @@ index 0e8ba05455161883c86df6606104fab3529c3c0c..ad79e4521cee699de86a94885b273563 } diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index fbaf234e8400dc14dc2421c87c80eb887ba44fef..08211fd37ab7916586c0579cfb9c014c29553991 100644 +index e04bb290a94f5cfc93b5bd2121e6b32610199237..f62357be4225fa48dd445f0843c99235276566c7 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1773,6 +1773,13 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -1818,6 +1818,13 @@ public class PlayerConnection implements PacketListenerPlayIn { switch (packetplayinentityaction.c()) { case PRESS_SHIFT_KEY: this.player.setSneaking(true); diff --git a/Spigot-Server-Patches/0147-Add-configuration-option-to-prevent-player-names-fro.patch b/Spigot-Server-Patches/0145-Add-configuration-option-to-prevent-player-names-fro.patch similarity index 83% rename from Spigot-Server-Patches/0147-Add-configuration-option-to-prevent-player-names-fro.patch rename to Spigot-Server-Patches/0145-Add-configuration-option-to-prevent-player-names-fro.patch index 4cbe763be..2cf160e8c 100644 --- a/Spigot-Server-Patches/0147-Add-configuration-option-to-prevent-player-names-fro.patch +++ b/Spigot-Server-Patches/0145-Add-configuration-option-to-prevent-player-names-fro.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Add configuration option to prevent player names from being diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 5a83fc21cb6801d597a01fb4a83d30488f30bdb6..295b8390cbc31fc1fcb225f80ec2ff8f0df44321 100644 +index c4086de778cc2ccc958b1a94dd6e9cdb5065076c..5fa63d7ca20b88a44d8800b3ebf74e4c0e376d0b 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -259,4 +259,9 @@ public class PaperConfig { +@@ -260,4 +260,9 @@ public class PaperConfig { flyingKickPlayerMessage = getString("messages.kick.flying-player", flyingKickPlayerMessage); flyingKickVehicleMessage = getString("messages.kick.flying-vehicle", flyingKickVehicleMessage); } @@ -20,10 +20,10 @@ index 5a83fc21cb6801d597a01fb4a83d30488f30bdb6..295b8390cbc31fc1fcb225f80ec2ff8f + } } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 3cb57c3b8ca8f29437bea52e9cf3512985f56eb5..9eb4acf93c65a1473e385be317e5d93cd4571d41 100644 +index d83e3be6f1997b993f6d4e65b190af5ad3056328..bd06db4fa4ea5d8db45f4f0bc1222bb1da8a3230 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2137,5 +2137,10 @@ public final class CraftServer implements Server { +@@ -2216,5 +2216,10 @@ public final class CraftServer implements Server { commandMap.registerServerAliases(); return true; } diff --git a/Spigot-Server-Patches/0148-Use-TerminalConsoleAppender-for-console-improvements.patch b/Spigot-Server-Patches/0146-Use-TerminalConsoleAppender-for-console-improvements.patch similarity index 91% rename from Spigot-Server-Patches/0148-Use-TerminalConsoleAppender-for-console-improvements.patch rename to Spigot-Server-Patches/0146-Use-TerminalConsoleAppender-for-console-improvements.patch index 561fe6d2d..cf1139180 100644 --- a/Spigot-Server-Patches/0148-Use-TerminalConsoleAppender-for-console-improvements.patch +++ b/Spigot-Server-Patches/0146-Use-TerminalConsoleAppender-for-console-improvements.patch @@ -19,7 +19,7 @@ Other changes: configuration diff --git a/pom.xml b/pom.xml -index 3554314526b3f33ad02df2adfd42d45118d75526..aeaceac771644ece5365d07be77f4481ced2fe13 100644 +index 52834690de9f07c9c4838dbef50031567c1a72dc..6b4f56744d11029bdbac5479b45c88736f338fa9 100644 --- a/pom.xml +++ b/pom.xml @@ -44,10 +44,27 @@ @@ -144,10 +144,10 @@ index 0000000000000000000000000000000000000000..685deaa0e5d1ddc13e3a7c0471b1cfcf + +} diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index 4b1f8c53737f998fa57859146d5ddb999cdc8d41..d34f772fae3543cec6a130831b1f3eaa67934944 100644 +index ce285b97cbdc9d74504d073fc659c295300dd720..af839f432d410601fbbe06b665e4e0fad801c17d 100644 --- a/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java -@@ -86,6 +86,9 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer +@@ -62,6 +62,9 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer if (!org.bukkit.craftbukkit.Main.useConsole) { return; } @@ -157,7 +157,7 @@ index 4b1f8c53737f998fa57859146d5ddb999cdc8d41..d34f772fae3543cec6a130831b1f3eaa jline.console.ConsoleReader bufferedreader = reader; // MC-33041, SPIGOT-5538: if System.in is not valid due to javaw, then return -@@ -125,6 +128,8 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer +@@ -101,6 +104,8 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer DedicatedServer.LOGGER.error("Exception handling console input", ioexception); } @@ -166,7 +166,7 @@ index 4b1f8c53737f998fa57859146d5ddb999cdc8d41..d34f772fae3543cec6a130831b1f3eaa } }; -@@ -136,6 +141,9 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer +@@ -112,6 +117,9 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer } global.addHandler(new org.bukkit.craftbukkit.util.ForwardLogHandler()); @@ -176,7 +176,7 @@ index 4b1f8c53737f998fa57859146d5ddb999cdc8d41..d34f772fae3543cec6a130831b1f3eaa final org.apache.logging.log4j.core.Logger logger = ((org.apache.logging.log4j.core.Logger) LogManager.getRootLogger()); for (org.apache.logging.log4j.core.Appender appender : logger.getAppenders().values()) { if (appender instanceof org.apache.logging.log4j.core.appender.ConsoleAppender) { -@@ -144,6 +152,8 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer +@@ -120,6 +128,8 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer } new org.bukkit.craftbukkit.util.TerminalConsoleWriterThread(System.out, this.reader).start(); @@ -186,19 +186,19 @@ index 4b1f8c53737f998fa57859146d5ddb999cdc8d41..d34f772fae3543cec6a130831b1f3eaa System.setOut(new PrintStream(new LoggerOutputStream(logger, Level.INFO), true)); System.setErr(new PrintStream(new LoggerOutputStream(logger, Level.WARN), true)); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 80d8b0b0eac47b8d8e62db60da9daf0da8671fb3..ed32242bd169e9f28607942aa31aa48a5799b215 100644 +index 28478370fc182751178f7dd6c20435218174c700..737159212c5139ba07dca2484c6cce8946167dba 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -57,7 +57,7 @@ import org.apache.commons.lang3.Validate; - import org.apache.logging.log4j.LogManager; +@@ -58,7 +58,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; // CraftBukkit start + import com.google.common.collect.ImmutableSet; -import jline.console.ConsoleReader; -+import joptsimple.OptionSet; ++// import jline.console.ConsoleReader; // Paper + import joptsimple.OptionSet; import org.bukkit.Bukkit; import org.bukkit.craftbukkit.CraftServer; - import org.bukkit.craftbukkit.Main; -@@ -161,7 +161,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant processQueue = new java.util.concurrent.ConcurrentLinkedQueue(); public int autosavePeriod; -@@ -212,7 +212,9 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant collection = this.getEffects(); diff --git a/Spigot-Server-Patches/0150-Item-canEntityPickup.patch b/Spigot-Server-Patches/0148-Item-canEntityPickup.patch similarity index 85% rename from Spigot-Server-Patches/0150-Item-canEntityPickup.patch rename to Spigot-Server-Patches/0148-Item-canEntityPickup.patch index cfb76ecb2..b8a554bc2 100644 --- a/Spigot-Server-Patches/0150-Item-canEntityPickup.patch +++ b/Spigot-Server-Patches/0148-Item-canEntityPickup.patch @@ -5,23 +5,23 @@ Subject: [PATCH] Item#canEntityPickup diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index 1732c1ae9537957c51da5e484b55febb6e9f0091..b5816dc89ede5f5f1780d3086d9b1a41fba2b19d 100644 +index 9715f10c790c0210435622ab9997ac40f98da185..a6aa7a1a8da787604b2d8f3f9ea119d4b6bc188d 100644 --- a/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java -@@ -521,6 +521,11 @@ public abstract class EntityInsentient extends EntityLiving { +@@ -539,6 +539,11 @@ public abstract class EntityInsentient extends EntityLiving { EntityItem entityitem = (EntityItem) iterator.next(); - if (!entityitem.dead && !entityitem.getItemStack().isEmpty() && !entityitem.p()) { + if (!entityitem.dead && !entityitem.getItemStack().isEmpty() && !entityitem.p() && this.i(entityitem.getItemStack())) { + // Paper Start + if (!entityitem.canMobPickup) { + continue; + } + // Paper End - this.a(entityitem); + this.b(entityitem); } } diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java -index 208dad2a34de2b898c3811af6e5363009f97a55f..97c6a8b6bd0bf9738428c2fda24b9e2586a783dd 100644 +index ca1cc67fea6f1607a2d3d7869a0a023616c02ff7..159552192c2a6d62fb205ed5973f89a16e619d94 100644 --- a/src/main/java/net/minecraft/server/EntityItem.java +++ b/src/main/java/net/minecraft/server/EntityItem.java @@ -20,6 +20,7 @@ public class EntityItem extends Entity { diff --git a/Spigot-Server-Patches/0151-PlayerPickupItemEvent-setFlyAtPlayer.patch b/Spigot-Server-Patches/0149-PlayerPickupItemEvent-setFlyAtPlayer.patch similarity index 88% rename from Spigot-Server-Patches/0151-PlayerPickupItemEvent-setFlyAtPlayer.patch rename to Spigot-Server-Patches/0149-PlayerPickupItemEvent-setFlyAtPlayer.patch index 5e6f47cba..b3d01ce2d 100644 --- a/Spigot-Server-Patches/0151-PlayerPickupItemEvent-setFlyAtPlayer.patch +++ b/Spigot-Server-Patches/0149-PlayerPickupItemEvent-setFlyAtPlayer.patch @@ -5,10 +5,10 @@ Subject: [PATCH] PlayerPickupItemEvent#setFlyAtPlayer diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java -index 97c6a8b6bd0bf9738428c2fda24b9e2586a783dd..8747dc7075ebe178f3b9ad3cb56f52847fd194b5 100644 +index 159552192c2a6d62fb205ed5973f89a16e619d94..2546a706ef107fd94e4c17c10091d6c0a7241a70 100644 --- a/src/main/java/net/minecraft/server/EntityItem.java +++ b/src/main/java/net/minecraft/server/EntityItem.java -@@ -322,6 +322,7 @@ public class EntityItem extends Entity { +@@ -331,6 +331,7 @@ public class EntityItem extends Entity { // CraftBukkit start - fire PlayerPickupItemEvent int canHold = entityhuman.inventory.canHold(itemstack); int remaining = i - canHold; @@ -16,7 +16,7 @@ index 97c6a8b6bd0bf9738428c2fda24b9e2586a783dd..8747dc7075ebe178f3b9ad3cb56f5284 if (this.pickupDelay <= 0 && canHold > 0) { itemstack.setCount(canHold); -@@ -329,8 +330,14 @@ public class EntityItem extends Entity { +@@ -338,8 +339,14 @@ public class EntityItem extends Entity { PlayerPickupItemEvent playerEvent = new PlayerPickupItemEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining); playerEvent.setCancelled(!entityhuman.canPickUpLoot); this.world.getServer().getPluginManager().callEvent(playerEvent); @@ -31,7 +31,7 @@ index 97c6a8b6bd0bf9738428c2fda24b9e2586a783dd..8747dc7075ebe178f3b9ad3cb56f5284 return; } -@@ -354,7 +361,11 @@ public class EntityItem extends Entity { +@@ -363,7 +370,11 @@ public class EntityItem extends Entity { // CraftBukkit end if (this.pickupDelay == 0 && (this.owner == null || this.owner.equals(entityhuman.getUniqueID())) && entityhuman.inventory.pickup(itemstack)) { diff --git a/Spigot-Server-Patches/0152-PlayerAttemptPickupItemEvent.patch b/Spigot-Server-Patches/0150-PlayerAttemptPickupItemEvent.patch similarity index 91% rename from Spigot-Server-Patches/0152-PlayerAttemptPickupItemEvent.patch rename to Spigot-Server-Patches/0150-PlayerAttemptPickupItemEvent.patch index ee15d11ed..59b70943d 100644 --- a/Spigot-Server-Patches/0152-PlayerAttemptPickupItemEvent.patch +++ b/Spigot-Server-Patches/0150-PlayerAttemptPickupItemEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] PlayerAttemptPickupItemEvent diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java -index 8747dc7075ebe178f3b9ad3cb56f52847fd194b5..5efcc50ab9e8a99d88a9d2e7f15ecbcc4439b93e 100644 +index 2546a706ef107fd94e4c17c10091d6c0a7241a70..cc173445caa0a064e724bc29b4955232a1dc1816 100644 --- a/src/main/java/net/minecraft/server/EntityItem.java +++ b/src/main/java/net/minecraft/server/EntityItem.java @@ -9,6 +9,7 @@ import javax.annotation.Nullable; @@ -16,7 +16,7 @@ index 8747dc7075ebe178f3b9ad3cb56f52847fd194b5..5efcc50ab9e8a99d88a9d2e7f15ecbcc public class EntityItem extends Entity { -@@ -324,6 +325,22 @@ public class EntityItem extends Entity { +@@ -333,6 +334,22 @@ public class EntityItem extends Entity { int remaining = i - canHold; boolean flyAtPlayer = false; // Paper diff --git a/Spigot-Server-Patches/0153-Add-UnknownCommandEvent.patch b/Spigot-Server-Patches/0151-Add-UnknownCommandEvent.patch similarity index 83% rename from Spigot-Server-Patches/0153-Add-UnknownCommandEvent.patch rename to Spigot-Server-Patches/0151-Add-UnknownCommandEvent.patch index 2dfe5a6c9..a630962a8 100644 --- a/Spigot-Server-Patches/0153-Add-UnknownCommandEvent.patch +++ b/Spigot-Server-Patches/0151-Add-UnknownCommandEvent.patch @@ -5,18 +5,18 @@ Subject: [PATCH] Add UnknownCommandEvent diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 681a84e5b3e7594a43fac0d47f1df2eef310bf81..f01bd38d0b600a69224f610fd77a542ec6d1c322 100644 +index aa7fd35d6fab1cbbf4c4cd0575bb5be788755fc0..33727f110d8025394536434fa2b474f653a1f16d 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -80,6 +80,7 @@ import net.minecraft.server.WorldServer; +@@ -105,6 +105,7 @@ import net.minecraft.server.WorldNBTStorage; + import net.minecraft.server.WorldServer; import net.minecraft.server.WorldSettings; - import net.minecraft.server.WorldType; import org.apache.commons.lang.Validate; +import org.apache.commons.lang3.StringUtils; import org.bukkit.BanList; import org.bukkit.Bukkit; import org.bukkit.ChatColor; -@@ -151,6 +152,7 @@ import org.bukkit.craftbukkit.util.Versioning; +@@ -177,6 +178,7 @@ import org.bukkit.craftbukkit.util.Versioning; import org.bukkit.craftbukkit.util.permissions.CraftDefaultPermissions; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; @@ -24,7 +24,7 @@ index 681a84e5b3e7594a43fac0d47f1df2eef310bf81..f01bd38d0b600a69224f610fd77a542e import org.bukkit.event.inventory.InventoryType; import org.bukkit.event.player.PlayerChatTabCompleteEvent; import org.bukkit.event.server.BroadcastMessageEvent; -@@ -751,7 +753,13 @@ public final class CraftServer implements Server { +@@ -785,7 +787,13 @@ public final class CraftServer implements Server { // Spigot start if (!org.spigotmc.SpigotConfig.unknownCommandMessage.isEmpty()) { diff --git a/Spigot-Server-Patches/0154-Basic-PlayerProfile-API.patch b/Spigot-Server-Patches/0152-Basic-PlayerProfile-API.patch similarity index 83% rename from Spigot-Server-Patches/0154-Basic-PlayerProfile-API.patch rename to Spigot-Server-Patches/0152-Basic-PlayerProfile-API.patch index e4374b050..d8a621027 100644 --- a/Spigot-Server-Patches/0154-Basic-PlayerProfile-API.patch +++ b/Spigot-Server-Patches/0152-Basic-PlayerProfile-API.patch @@ -310,23 +310,24 @@ index 0000000000000000000000000000000000000000..293b73f4747f48dbf8b6a8453d3fc777 +} diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperAuthenticationService.java b/src/main/java/com/destroystokyo/paper/profile/PaperAuthenticationService.java new file mode 100644 -index 0000000000000000000000000000000000000000..25836b975b51af701d4b9523ab398fbf157b82fd +index 0000000000000000000000000000000000000000..ef9f55afd6bffa8c02c6820295223e5465eed91e --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/profile/PaperAuthenticationService.java -@@ -0,0 +1,30 @@ +@@ -0,0 +1,31 @@ +package com.destroystokyo.paper.profile; + -+import com.mojang.authlib.Agent; -+import com.mojang.authlib.GameProfileRepository; -+import com.mojang.authlib.UserAuthentication; ++import com.mojang.authlib.*; +import com.mojang.authlib.minecraft.MinecraftSessionService; +import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; ++import com.mojang.authlib.yggdrasil.YggdrasilEnvironment; + +import java.net.Proxy; + +public class PaperAuthenticationService extends YggdrasilAuthenticationService { ++ private final Environment environment; + public PaperAuthenticationService(Proxy proxy, String clientToken) { + super(proxy, clientToken); ++ this.environment = (Environment)EnvironmentParser.getEnvironmentFromProperties().orElse(YggdrasilEnvironment.PROD);; + } + + @Override @@ -336,30 +337,31 @@ index 0000000000000000000000000000000000000000..25836b975b51af701d4b9523ab398fbf + + @Override + public MinecraftSessionService createMinecraftSessionService() { -+ return new PaperMinecraftSessionService(this); ++ return new PaperMinecraftSessionService(this, this.environment); + } + + @Override + public GameProfileRepository createProfileRepository() { -+ return new PaperGameProfileRepository(this); ++ return new PaperGameProfileRepository(this, this.environment); + } +} diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperGameProfileRepository.java b/src/main/java/com/destroystokyo/paper/profile/PaperGameProfileRepository.java new file mode 100644 -index 0000000000000000000000000000000000000000..3bcdb8f93f1930ee53395470ffb3833e2bd75222 +index 0000000000000000000000000000000000000000..582c169c85ac66f1f9430f79042e4655f776c157 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/profile/PaperGameProfileRepository.java -@@ -0,0 +1,17 @@ +@@ -0,0 +1,18 @@ +package com.destroystokyo.paper.profile; + +import com.mojang.authlib.Agent; ++import com.mojang.authlib.Environment; +import com.mojang.authlib.ProfileLookupCallback; +import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; +import com.mojang.authlib.yggdrasil.YggdrasilGameProfileRepository; + +public class PaperGameProfileRepository extends YggdrasilGameProfileRepository { -+ public PaperGameProfileRepository(YggdrasilAuthenticationService authenticationService) { -+ super(authenticationService); ++ public PaperGameProfileRepository(YggdrasilAuthenticationService authenticationService, Environment environment) { ++ super(authenticationService, environment); + } + + @Override @@ -369,12 +371,13 @@ index 0000000000000000000000000000000000000000..3bcdb8f93f1930ee53395470ffb3833e +} diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java b/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java new file mode 100644 -index 0000000000000000000000000000000000000000..4b2a67423f57b70d316115e4525e3841a415b1cc +index 0000000000000000000000000000000000000000..93d73c27340645c7502acafdc0b2cfbc1a759dd8 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java -@@ -0,0 +1,29 @@ +@@ -0,0 +1,30 @@ +package com.destroystokyo.paper.profile; + ++import com.mojang.authlib.Environment; +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.minecraft.MinecraftProfileTexture; +import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; @@ -383,8 +386,8 @@ index 0000000000000000000000000000000000000000..4b2a67423f57b70d316115e4525e3841 +import java.util.Map; + +public class PaperMinecraftSessionService extends YggdrasilMinecraftSessionService { -+ protected PaperMinecraftSessionService(YggdrasilAuthenticationService authenticationService) { -+ super(authenticationService); ++ protected PaperMinecraftSessionService(YggdrasilAuthenticationService authenticationService, Environment environment) { ++ super(authenticationService, environment); + } + + @Override @@ -420,7 +423,7 @@ index 0000000000000000000000000000000000000000..3aceb0ea8a1a3ed94dd8a9e954c52ecd + } +} diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java -index 16302c4ac6d3e40318a762cea0afcf3f94715216..148917547bb7a626d1b2bacce7385607043db7e2 100644 +index da7a325d070e194cd1664ed20dcb3a762c9a517a..797654c653ec6dc4d46b457cf8a6121b29eca7aa 100644 --- a/src/main/java/net/minecraft/server/MCUtil.java +++ b/src/main/java/net/minecraft/server/MCUtil.java @@ -1,8 +1,11 @@ @@ -446,71 +449,33 @@ index 16302c4ac6d3e40318a762cea0afcf3f94715216..148917547bb7a626d1b2bacce7385607 /** * Calculates distance between 2 entities * @param e1 -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index ed32242bd169e9f28607942aa31aa48a5799b215..54f80cb8e1b771f2a493543e04f8bc8346a391dc 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1304,7 +1304,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant() { - - @Override -@@ -178,7 +179,16 @@ public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Pa - } else if (MinecraftServer.getServer() == null) { - callback.apply(gameprofile); - } else { -- GameProfile profile = skinCache.getIfPresent(gameprofile.getName().toLowerCase(java.util.Locale.ROOT)); -+ // Paper start -+ com.destroystokyo.paper.profile.CraftPlayerProfile paperProfile = new com.destroystokyo.paper.profile.CraftPlayerProfile(gameprofile); -+ if (sync) { -+ // might complete by cache, but if not, go ahead and do it now, avoid the code below -+ paperProfile.complete(true, true); -+ } else { -+ paperProfile.completeFromCache(false, true); -+ } -+ GameProfile profile = paperProfile.getGameProfile(); -+ // Paper end - if (profile != null && Iterables.getFirst(profile.getProperties().get("textures"), (Object) null) != null) { - callback.apply(profile); - -@@ -187,7 +197,10 @@ public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Pa - Callable callable = new Callable() { - @Override - public GameProfile call() { -- final GameProfile profile = skinCache.getUnchecked(gameprofile.getName().toLowerCase(java.util.Locale.ROOT)); -+ // Paper start -+ paperProfile.complete(true, true); -+ final GameProfile profile = paperProfile.getGameProfile(); -+ // Paper end - MinecraftServer.getServer().processQueue.add(new Runnable() { - @Override - public void run() { diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java -index 581199e6dcddb3692ccc6b6cf6c42fa5ef1f5e7e..39d2f83531d539fb96824c2e6a9018c12ea75272 100644 +index 4f769211cf98c3da720a904da3dcdcd4c7611f0b..a038397028848edb4f43cd4f7262546666e32883 100644 --- a/src/main/java/net/minecraft/server/UserCache.java +++ b/src/main/java/net/minecraft/server/UserCache.java @@ -43,7 +43,7 @@ public class UserCache { @@ -522,7 +487,7 @@ index 581199e6dcddb3692ccc6b6cf6c42fa5ef1f5e7e..39d2f83531d539fb96824c2e6a9018c1 private final Map e = new java.util.concurrent.ConcurrentHashMap<>(); // Paper private final Deque f = new java.util.concurrent.LinkedBlockingDeque(); // CraftBukkit private final GameProfileRepository g; -@@ -104,6 +104,7 @@ public class UserCache { +@@ -93,6 +93,7 @@ public class UserCache { return UserCache.c; } @@ -530,7 +495,7 @@ index 581199e6dcddb3692ccc6b6cf6c42fa5ef1f5e7e..39d2f83531d539fb96824c2e6a9018c1 public void a(GameProfile gameprofile) { this.a(gameprofile, (Date) null); } -@@ -165,6 +166,13 @@ public class UserCache { +@@ -154,6 +155,13 @@ public class UserCache { return usercache_usercacheentry == null ? null : usercache_usercacheentry.a(); } @@ -544,7 +509,7 @@ index 581199e6dcddb3692ccc6b6cf6c42fa5ef1f5e7e..39d2f83531d539fb96824c2e6a9018c1 @Nullable public GameProfile getProfile(UUID uuid) { UserCache.UserCacheEntry usercache_usercacheentry = (UserCache.UserCacheEntry) this.e.get(uuid); -@@ -273,7 +281,7 @@ public class UserCache { +@@ -262,7 +270,7 @@ public class UserCache { class UserCacheEntry { @@ -554,10 +519,10 @@ index 581199e6dcddb3692ccc6b6cf6c42fa5ef1f5e7e..39d2f83531d539fb96824c2e6a9018c1 private UserCacheEntry(GameProfile gameprofile, Date date) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index f01bd38d0b600a69224f610fd77a542ec6d1c322..95f4abddf57eb8c59cb5a5410b8d551d39f94fd7 100644 +index 33727f110d8025394536434fa2b474f653a1f16d..73b69d4acda27995961306831c39696604559ad6 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -200,6 +200,9 @@ import org.yaml.snakeyaml.error.MarkedYAMLException; +@@ -227,6 +227,9 @@ import org.yaml.snakeyaml.error.MarkedYAMLException; import net.md_5.bungee.api.chat.BaseComponent; // Spigot @@ -567,7 +532,7 @@ index f01bd38d0b600a69224f610fd77a542ec6d1c322..95f4abddf57eb8c59cb5a5410b8d551d public final class CraftServer implements Server { private final String serverName = "Paper"; // Paper private final String serverVersion; -@@ -2154,5 +2157,24 @@ public final class CraftServer implements Server { +@@ -2233,5 +2236,24 @@ public final class CraftServer implements Server { public boolean suggestPlayerNamesWhenNullTabCompletions() { return com.destroystokyo.paper.PaperConfig.suggestPlayersWhenNullTabCompletions; } diff --git a/Spigot-Server-Patches/0155-Shoulder-Entities-Release-API.patch b/Spigot-Server-Patches/0153-Shoulder-Entities-Release-API.patch similarity index 92% rename from Spigot-Server-Patches/0155-Shoulder-Entities-Release-API.patch rename to Spigot-Server-Patches/0153-Shoulder-Entities-Release-API.patch index b7180c114..0306aff2d 100644 --- a/Spigot-Server-Patches/0155-Shoulder-Entities-Release-API.patch +++ b/Spigot-Server-Patches/0153-Shoulder-Entities-Release-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Shoulder Entities Release API diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index ad79e4521cee699de86a94885b27356339bcb866..8e5edd2c9b7cc9a441969efeb666061515188486 100644 +index 0dc2ffcfceeffed2cb949d31c4f976bce639f110..69c0a4c7bfb1c753d544dcd074ad832d3e5ef3a0 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -1901,20 +1901,44 @@ public abstract class EntityHuman extends EntityLiving { +@@ -1779,20 +1779,44 @@ public abstract class EntityHuman extends EntityLiving { } @@ -58,10 +58,10 @@ index ad79e4521cee699de86a94885b27356339bcb866..8e5edd2c9b7cc9a441969efeb6660615 @Override public abstract boolean isSpectator(); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -index 2c20a7b924e055794f6d3a296db754129052c3fe..191bb7345e06cbad7bef416e4e849df3727bdac0 100644 +index 60ef17fdb179c3236b8c9d196a17d719d5261fb4..1f715fb44b85f14664affcce9a11928dfc82991b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -@@ -518,6 +518,32 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { +@@ -487,6 +487,32 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { getHandle().getCooldownTracker().setCooldown(CraftMagicNumbers.getItem(material), ticks); } diff --git a/Spigot-Server-Patches/0156-Profile-Lookup-Events.patch b/Spigot-Server-Patches/0154-Profile-Lookup-Events.patch similarity index 90% rename from Spigot-Server-Patches/0156-Profile-Lookup-Events.patch rename to Spigot-Server-Patches/0154-Profile-Lookup-Events.patch index f2898230e..a9a4210f1 100644 --- a/Spigot-Server-Patches/0156-Profile-Lookup-Events.patch +++ b/Spigot-Server-Patches/0154-Profile-Lookup-Events.patch @@ -7,28 +7,27 @@ Adds a Pre Lookup Event and a Post Lookup Event so that plugins may prefill in p profiles that had to be looked up. diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperGameProfileRepository.java b/src/main/java/com/destroystokyo/paper/profile/PaperGameProfileRepository.java -index 3bcdb8f93f1930ee53395470ffb3833e2bd75222..bb9894318e1ff75f0c5611a65d3e4d9969eab1fb 100644 +index 582c169c85ac66f1f9430f79042e4655f776c157..08fdb681a68e8be6e4062af0630957ce3e524806 100644 --- a/src/main/java/com/destroystokyo/paper/profile/PaperGameProfileRepository.java +++ b/src/main/java/com/destroystokyo/paper/profile/PaperGameProfileRepository.java -@@ -1,17 +1,68 @@ +@@ -1,11 +1,16 @@ package com.destroystokyo.paper.profile; +import com.destroystokyo.paper.event.profile.LookupProfileEvent; +import com.destroystokyo.paper.event.profile.PreLookupProfileEvent; +import com.google.common.collect.Sets; import com.mojang.authlib.Agent; + import com.mojang.authlib.Environment; +import com.mojang.authlib.GameProfile; import com.mojang.authlib.ProfileLookupCallback; import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; import com.mojang.authlib.yggdrasil.YggdrasilGameProfileRepository; +import java.util.Set; -+ public class PaperGameProfileRepository extends YggdrasilGameProfileRepository { -+ - public PaperGameProfileRepository(YggdrasilAuthenticationService authenticationService) { - super(authenticationService); - } + public PaperGameProfileRepository(YggdrasilAuthenticationService authenticationService, Environment environment) { + super(authenticationService, environment); +@@ -13,6 +18,50 @@ public class PaperGameProfileRepository extends YggdrasilGameProfileRepository { @Override public void findProfilesByNames(String[] names, Agent agent, ProfileLookupCallback callback) { diff --git a/Spigot-Server-Patches/0157-Block-player-logins-during-server-shutdown.patch b/Spigot-Server-Patches/0155-Block-player-logins-during-server-shutdown.patch similarity index 85% rename from Spigot-Server-Patches/0157-Block-player-logins-during-server-shutdown.patch rename to Spigot-Server-Patches/0155-Block-player-logins-during-server-shutdown.patch index 6c06f3128..980f5758e 100644 --- a/Spigot-Server-Patches/0157-Block-player-logins-during-server-shutdown.patch +++ b/Spigot-Server-Patches/0155-Block-player-logins-during-server-shutdown.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Block player logins during server shutdown diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java -index 19e72da6d9a8bf43d1d25c1be3aa23c75dd6e5d7..234451ebc89fe47cffebdcbbc96a5163620b6124 100644 +index 7c016afc904d6d6958abf73fd0d87a25c9fa41ad..975499bca45acb4ba3196c48e3739310275cfc8b 100644 --- a/src/main/java/net/minecraft/server/LoginListener.java +++ b/src/main/java/net/minecraft/server/LoginListener.java -@@ -49,6 +49,12 @@ public class LoginListener implements PacketLoginInListener { +@@ -48,6 +48,12 @@ public class LoginListener implements PacketLoginInListener { } public void tick() { diff --git a/Spigot-Server-Patches/0158-Entity-fromMobSpawner.patch b/Spigot-Server-Patches/0156-Entity-fromMobSpawner.patch similarity index 83% rename from Spigot-Server-Patches/0158-Entity-fromMobSpawner.patch rename to Spigot-Server-Patches/0156-Entity-fromMobSpawner.patch index 91c632cc2..144ab6012 100644 --- a/Spigot-Server-Patches/0158-Entity-fromMobSpawner.patch +++ b/Spigot-Server-Patches/0156-Entity-fromMobSpawner.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Entity#fromMobSpawner() diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 0b971ad8addd65850162e46707c15fbc1ba9b8b9..7c6bf0b91cdf59f6dcf155ee8abfbab61938cc8b 100644 +index 912f5be0264b604df175f5825765b03b319a841c..2dfc881894753469080a5038c770e126cb19a806 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -188,6 +188,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -16,7 +16,7 @@ index 0b971ad8addd65850162e46707c15fbc1ba9b8b9..7c6bf0b91cdf59f6dcf155ee8abfbab6 protected int numCollisions = 0; // Paper public void inactiveTick() { } // Spigot end -@@ -1622,6 +1623,10 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -1582,6 +1583,10 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke if (this.origin != null) { nbttagcompound.set("Paper.Origin", this.createList(origin.getX(), origin.getY(), origin.getZ())); } @@ -27,9 +27,9 @@ index 0b971ad8addd65850162e46707c15fbc1ba9b8b9..7c6bf0b91cdf59f6dcf155ee8abfbab6 // Paper end return nbttagcompound; } catch (Throwable throwable) { -@@ -1742,6 +1747,8 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -1704,6 +1709,8 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke if (!originTag.isEmpty()) { - origin = new Location(world.getWorld(), originTag.getDoubleAt(0), originTag.getDoubleAt(1), originTag.getDoubleAt(2)); + origin = new org.bukkit.Location(world.getWorld(), originTag.getDoubleAt(0), originTag.getDoubleAt(1), originTag.getDoubleAt(2)); } + + spawnedViaMobSpawner = nbttagcompound.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status @@ -37,7 +37,7 @@ index 0b971ad8addd65850162e46707c15fbc1ba9b8b9..7c6bf0b91cdf59f6dcf155ee8abfbab6 } catch (Throwable throwable) { diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -index b249af20c4712a89e5f340eb922291557099058a..ab5d83d34d9314a253353d6d01fdcd2bed964933 100644 +index 2b7f020e00fc1ea456d0155e7e383969aee318b7..5fda5be52ee7dbf29ac791d0f49326dd74ff2d08 100644 --- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java @@ -140,6 +140,7 @@ public abstract class MobSpawnerAbstract { @@ -49,10 +49,10 @@ index b249af20c4712a89e5f340eb922291557099058a..ab5d83d34d9314a253353d6d01fdcd2b if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, blockposition).isCancelled()) { Entity vehicle = entity.getVehicle(); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 7a6df77f196db8ccdaf589b680de9aab09b0ef32..2d84f8410a7b8ff88d9dbab64741dcdf40fc1612 100644 +index 613081685e233074728366b9ff16642c04774c91..66edc6ae67084959503ffa0df2c04174fb29b8d8 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -1046,5 +1046,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { +@@ -1054,5 +1054,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { Location origin = getHandle().origin; return origin == null ? null : origin.clone(); } diff --git a/Spigot-Server-Patches/0159-Improve-the-Saddle-API-for-Horses.patch b/Spigot-Server-Patches/0157-Improve-the-Saddle-API-for-Horses.patch similarity index 94% rename from Spigot-Server-Patches/0159-Improve-the-Saddle-API-for-Horses.patch rename to Spigot-Server-Patches/0157-Improve-the-Saddle-API-for-Horses.patch index ddb33b7d9..ce9759840 100644 --- a/Spigot-Server-Patches/0159-Improve-the-Saddle-API-for-Horses.patch +++ b/Spigot-Server-Patches/0157-Improve-the-Saddle-API-for-Horses.patch @@ -7,10 +7,10 @@ Not all horses with Saddles have armor. This lets us break up the horses with sa and access their saddle state separately from an interface shared with Armor. diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java -index 09016e35473069ac61572c4edf97c06077b0cf3b..9952db3eb5ba94547f5e786c473fb59dfec616ab 100644 +index 339656c623a5af7fbf1a7e81952dec1dd3c18205..8c59b9ce12d4148b209c3824d44f6e9c736de16c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java -@@ -6,6 +6,7 @@ import net.minecraft.server.EntityHorseAbstract; +@@ -6,6 +6,7 @@ import net.minecraft.server.GenericAttributes; import org.apache.commons.lang.Validate; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.inventory.CraftInventoryAbstractHorse; diff --git a/Spigot-Server-Patches/0160-Implement-ensureServerConversions-API.patch b/Spigot-Server-Patches/0158-Implement-ensureServerConversions-API.patch similarity index 86% rename from Spigot-Server-Patches/0160-Implement-ensureServerConversions-API.patch rename to Spigot-Server-Patches/0158-Implement-ensureServerConversions-API.patch index e1ebc0e4e..93a0d5cd3 100644 --- a/Spigot-Server-Patches/0160-Implement-ensureServerConversions-API.patch +++ b/Spigot-Server-Patches/0158-Implement-ensureServerConversions-API.patch @@ -7,10 +7,10 @@ This will take a Bukkit ItemStack and run it through any conversions a server pr to ensure it meets latest minecraft expectations. diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java -index 01ab19434a39a7062c813b1696e8d35cb2712b46..8b219b5fa2746d73d6d3acb0b61d13218a2c6ea8 100644 +index 89a3617068421bb86baf4e8bfd9df2d0626adff7..bee1de72de76738d5eed2e0ca5ae8c0a65be7595 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java -@@ -335,4 +335,10 @@ public final class CraftItemFactory implements ItemFactory { +@@ -334,4 +334,10 @@ public final class CraftItemFactory implements ItemFactory { public Material updateMaterial(ItemMeta meta, Material material) throws IllegalArgumentException { return ((CraftMetaItem) meta).updateMaterial(material); } diff --git a/Spigot-Server-Patches/0161-Implement-getI18NDisplayName.patch b/Spigot-Server-Patches/0159-Implement-getI18NDisplayName.patch similarity index 64% rename from Spigot-Server-Patches/0161-Implement-getI18NDisplayName.patch rename to Spigot-Server-Patches/0159-Implement-getI18NDisplayName.patch index 60bfe7415..52f768cc4 100644 --- a/Spigot-Server-Patches/0161-Implement-getI18NDisplayName.patch +++ b/Spigot-Server-Patches/0159-Implement-getI18NDisplayName.patch @@ -8,27 +8,36 @@ Currently the server only supports the English language. To override this, You must replace the language file embedded in the server jar. diff --git a/src/main/java/net/minecraft/server/LocaleLanguage.java b/src/main/java/net/minecraft/server/LocaleLanguage.java -index c0c13798f84029565e623fdd8cb85ffcd3504559..6012739331add8a77c6684b58a669f39bf183f5b 100644 +index ea7cb9943dc6da7a05e0841985eb1be4b6bc5169..c83ba9d9869f8ba51df17963d530536d2a08c263 100644 --- a/src/main/java/net/minecraft/server/LocaleLanguage.java +++ b/src/main/java/net/minecraft/server/LocaleLanguage.java -@@ -65,10 +65,12 @@ public class LocaleLanguage { +@@ -29,7 +29,7 @@ public abstract class LocaleLanguage { + + private static LocaleLanguage c() { + Builder builder = ImmutableMap.builder(); +- BiConsumer biconsumer = builder::put; ++ BiConsumer biconsumer = builder::put; // Paper - decompile fix + + try { + InputStream inputstream = LocaleLanguage.class.getResourceAsStream("/assets/minecraft/lang/en_us.json"); +@@ -91,10 +91,12 @@ public abstract class LocaleLanguage { } + public static LocaleLanguage getInstance() { return a(); } // Paper - OBFHELPER public static LocaleLanguage a() { - return LocaleLanguage.c; + return LocaleLanguage.d; } -+ public synchronized String translateKey(String key) { return a(key); } // Paper - OBFHELPER - public synchronized String a(String s) { - return this.c(s); - } ++ public String translateKey(String key) { return a(key); } // Paper - OBFHELPER + public abstract String a(String s); + + public abstract boolean b(String s); diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java -index 8b219b5fa2746d73d6d3acb0b61d13218a2c6ea8..23d7756456fdd650914a3a49c653182a68924a5c 100644 +index bee1de72de76738d5eed2e0ca5ae8c0a65be7595..1c3e6e0c9abe681bf9e7305a74a68c1506ad8d0c 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java -@@ -340,5 +340,18 @@ public final class CraftItemFactory implements ItemFactory { +@@ -339,5 +339,18 @@ public final class CraftItemFactory implements ItemFactory { public ItemStack ensureServerConversions(ItemStack item) { return CraftItemStack.asCraftMirror(CraftItemStack.asNMSCopy(item)); } diff --git a/Spigot-Server-Patches/0162-ProfileWhitelistVerifyEvent.patch b/Spigot-Server-Patches/0160-ProfileWhitelistVerifyEvent.patch similarity index 88% rename from Spigot-Server-Patches/0162-ProfileWhitelistVerifyEvent.patch rename to Spigot-Server-Patches/0160-ProfileWhitelistVerifyEvent.patch index a57bf98a3..cff497198 100644 --- a/Spigot-Server-Patches/0162-ProfileWhitelistVerifyEvent.patch +++ b/Spigot-Server-Patches/0160-ProfileWhitelistVerifyEvent.patch @@ -5,22 +5,22 @@ Subject: [PATCH] ProfileWhitelistVerifyEvent diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 0b403f08bed136916969b927c04078c14697803e..1800a6c86b2150b8183acdce3a7f6daa1c9a350b 100644 +index b680c6c7d8f2349928b9eebfd62f4312ec8d1180..9d05320b132679ccd511422c2c187b0d5fa89c2c 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -509,9 +509,9 @@ public abstract class PlayerList { +@@ -540,9 +540,9 @@ public abstract class PlayerList { // return chatmessage; if (!gameprofilebanentry.hasExpired()) event.disallow(PlayerLoginEvent.Result.KICK_BANNED, CraftChatMessage.fromComponent(chatmessage)); // Spigot - } else if (!this.isWhitelisted(gameprofile)) { + } else if (!this.isWhitelisted(gameprofile, event)) { // Paper - chatmessage = new ChatMessage("multiplayer.disconnect.not_whitelisted", new Object[0]); + chatmessage = new ChatMessage("multiplayer.disconnect.not_whitelisted"); - event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig.whitelistMessage); // Spigot + //event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig.whitelistMessage); // Spigot // Paper - moved to isWhitelisted } else if (getIPBans().isBanned(socketaddress) && !getIPBans().get(socketaddress).hasExpired()) { IpBanEntry ipbanentry = this.l.get(socketaddress); -@@ -880,9 +880,25 @@ public abstract class PlayerList { +@@ -923,9 +923,25 @@ public abstract class PlayerList { this.server.getCommandDispatcher().a(entityplayer); } @@ -46,4 +46,4 @@ index 0b403f08bed136916969b927c04078c14697803e..1800a6c86b2150b8183acdce3a7f6daa + // Paper end public boolean isOp(GameProfile gameprofile) { - return this.operators.d(gameprofile) || this.server.a(gameprofile) && this.server.getWorldServer(DimensionManager.OVERWORLD).getWorldData().t() || this.u; + return this.operators.d(gameprofile) || this.server.a(gameprofile) && this.server.getSaveData().n() || this.v; diff --git a/Spigot-Server-Patches/0163-Fix-this-stupid-bullshit.patch b/Spigot-Server-Patches/0161-Fix-this-stupid-bullshit.patch similarity index 91% rename from Spigot-Server-Patches/0163-Fix-this-stupid-bullshit.patch rename to Spigot-Server-Patches/0161-Fix-this-stupid-bullshit.patch index e5fb521c2..12d66c24e 100644 --- a/Spigot-Server-Patches/0163-Fix-this-stupid-bullshit.patch +++ b/Spigot-Server-Patches/0161-Fix-this-stupid-bullshit.patch @@ -9,12 +9,12 @@ modified in order to prevent merge conflicts when Spigot changes/disables the wa and to provide some level of hint without being disruptive. diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index fc07fdb590475ccaa09875b8fcbb81adc0db5e66..bf0a020189425d6507fa75f68f8e754723c58818 100644 +index b77b051137f66106bac396debe0c0542ac86e257..05b647fbb360910b2961c9276c2928fe71dad90c 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -218,10 +218,12 @@ public class Main { Calendar deadline = Calendar.getInstance(); - deadline.add(Calendar.DAY_OF_YEAR, -21); + deadline.add(Calendar.DAY_OF_YEAR, -3); if (buildDate.before(deadline.getTime())) { - System.err.println("*** Error, this build is outdated ***"); + // Paper start - This is some stupid bullshit diff --git a/Spigot-Server-Patches/0164-Ocelot-despawns-should-honor-nametags-and-leash.patch b/Spigot-Server-Patches/0162-Ocelot-despawns-should-honor-nametags-and-leash.patch similarity index 85% rename from Spigot-Server-Patches/0164-Ocelot-despawns-should-honor-nametags-and-leash.patch rename to Spigot-Server-Patches/0162-Ocelot-despawns-should-honor-nametags-and-leash.patch index 459cbd7c0..6909dbae0 100644 --- a/Spigot-Server-Patches/0164-Ocelot-despawns-should-honor-nametags-and-leash.patch +++ b/Spigot-Server-Patches/0162-Ocelot-despawns-should-honor-nametags-and-leash.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Ocelot despawns should honor nametags and leash diff --git a/src/main/java/net/minecraft/server/EntityOcelot.java b/src/main/java/net/minecraft/server/EntityOcelot.java -index 06241145537d311b1994a2d672ca975177d03a53..d9a7b8ac1eac58e02607f4df0c9413239fcec3a4 100644 +index a88f15546e5cad8da5b342162c05228bdbbf5aad..9c1f019f911a1b91bbfa431e1558dec790624050 100644 --- a/src/main/java/net/minecraft/server/EntityOcelot.java +++ b/src/main/java/net/minecraft/server/EntityOcelot.java @@ -81,7 +81,7 @@ public class EntityOcelot extends EntityAnimal { @@ -16,4 +16,4 @@ index 06241145537d311b1994a2d672ca975177d03a53..d9a7b8ac1eac58e02607f4df0c941323 + return !this.isTrusting() && !this.hasCustomName() && !this.isLeashed() /*&& this.ticksLived > 2400*/; // CraftBukkit // Paper - honor name and leash } - @Override + public static AttributeProvider.Builder eL() { diff --git a/Spigot-Server-Patches/0165-Reset-spawner-timer-when-spawner-event-is-cancelled.patch b/Spigot-Server-Patches/0163-Reset-spawner-timer-when-spawner-event-is-cancelled.patch similarity index 93% rename from Spigot-Server-Patches/0165-Reset-spawner-timer-when-spawner-event-is-cancelled.patch rename to Spigot-Server-Patches/0163-Reset-spawner-timer-when-spawner-event-is-cancelled.patch index 931728e67..14e130675 100644 --- a/Spigot-Server-Patches/0165-Reset-spawner-timer-when-spawner-event-is-cancelled.patch +++ b/Spigot-Server-Patches/0163-Reset-spawner-timer-when-spawner-event-is-cancelled.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Reset spawner timer when spawner event is cancelled diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -index ab5d83d34d9314a253353d6d01fdcd2bed964933..c38295a09d99221cb196f9785ce674fe11120825 100644 +index 5fda5be52ee7dbf29ac791d0f49326dd74ff2d08..efd4d2844c4ad638837a1fd971927758908e7db1 100644 --- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java @@ -142,6 +142,7 @@ public abstract class MobSpawnerAbstract { diff --git a/Spigot-Server-Patches/0166-Fix-MC-117075-TE-Unload-Lag-Spike.patch b/Spigot-Server-Patches/0164-Fix-MC-117075-TE-Unload-Lag-Spike.patch similarity index 87% rename from Spigot-Server-Patches/0166-Fix-MC-117075-TE-Unload-Lag-Spike.patch rename to Spigot-Server-Patches/0164-Fix-MC-117075-TE-Unload-Lag-Spike.patch index 927fe6372..ec2290bc4 100644 --- a/Spigot-Server-Patches/0166-Fix-MC-117075-TE-Unload-Lag-Spike.patch +++ b/Spigot-Server-Patches/0164-Fix-MC-117075-TE-Unload-Lag-Spike.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix MC-117075: TE Unload Lag Spike diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 184ea74726078809ae1b6df320d37532fa0d26ab..08f22545393148e91bec3d4a091092eab6828711 100644 +index 5f23a7b952a5938ffa489bbf4f3d64caa8d0f4a6..15b1d9a82f8ced4d53a7848fa3cfdb835fbc3e5b 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -648,7 +648,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -709,7 +709,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable { gameprofilerfiller.enter("blockEntities"); timings.tileEntityTick.startTiming(); // Spigot if (!this.tileEntityListUnload.isEmpty()) { diff --git a/Spigot-Server-Patches/0167-Allow-specifying-a-custom-authentication-servers-dow.patch b/Spigot-Server-Patches/0165-Allow-specifying-a-custom-authentication-servers-dow.patch similarity index 85% rename from Spigot-Server-Patches/0167-Allow-specifying-a-custom-authentication-servers-dow.patch rename to Spigot-Server-Patches/0165-Allow-specifying-a-custom-authentication-servers-dow.patch index 20b70895a..f58baf0ea 100644 --- a/Spigot-Server-Patches/0167-Allow-specifying-a-custom-authentication-servers-dow.patch +++ b/Spigot-Server-Patches/0165-Allow-specifying-a-custom-authentication-servers-dow.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Allow specifying a custom "authentication servers down" kick diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 295b8390cbc31fc1fcb225f80ec2ff8f0df44321..5884b04f7e84048a9710736bd14237140ebf2cf7 100644 +index 5fa63d7ca20b88a44d8800b3ebf74e4c0e376d0b..cee8740e644c492e3d71fd58791e7d52d57e856d 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java @@ -1,5 +1,6 @@ @@ -16,7 +16,7 @@ index 295b8390cbc31fc1fcb225f80ec2ff8f0df44321..5884b04f7e84048a9710736bd1423714 import com.google.common.base.Throwables; import java.io.File; -@@ -264,4 +265,9 @@ public class PaperConfig { +@@ -265,4 +266,9 @@ public class PaperConfig { private static void suggestPlayersWhenNull() { suggestPlayersWhenNullTabCompletions = getBoolean("settings.suggest-player-names-when-null-tab-completions", suggestPlayersWhenNullTabCompletions); } @@ -27,10 +27,10 @@ index 295b8390cbc31fc1fcb225f80ec2ff8f0df44321..5884b04f7e84048a9710736bd1423714 + } } diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java -index 234451ebc89fe47cffebdcbbc96a5163620b6124..758fe774897245148befeb26ddd65cf4c1a8301b 100644 +index 975499bca45acb4ba3196c48e3739310275cfc8b..723c73a8056d34136c64cd038f274d3d94749314 100644 --- a/src/main/java/net/minecraft/server/LoginListener.java +++ b/src/main/java/net/minecraft/server/LoginListener.java -@@ -247,6 +247,10 @@ public class LoginListener implements PacketLoginInListener { +@@ -246,6 +246,10 @@ public class LoginListener implements PacketLoginInListener { LoginListener.this.i = LoginListener.this.a(gameprofile); LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT; } else { @@ -38,6 +38,6 @@ index 234451ebc89fe47cffebdcbbc96a5163620b6124..758fe774897245148befeb26ddd65cf4 + if (com.destroystokyo.paper.PaperConfig.authenticationServersDownKickMessage != null) { + LoginListener.this.disconnect(new ChatComponentText(com.destroystokyo.paper.PaperConfig.authenticationServersDownKickMessage)); + } else // Paper end - LoginListener.this.disconnect(new ChatMessage("multiplayer.disconnect.authservers_down", new Object[0])); + LoginListener.this.disconnect(new ChatMessage("multiplayer.disconnect.authservers_down")); LoginListener.LOGGER.error("Couldn't verify username because servers are unavailable"); } diff --git a/Spigot-Server-Patches/0168-LivingEntity-setKiller.patch b/Spigot-Server-Patches/0166-LivingEntity-setKiller.patch similarity index 82% rename from Spigot-Server-Patches/0168-LivingEntity-setKiller.patch rename to Spigot-Server-Patches/0166-LivingEntity-setKiller.patch index 7389c25b8..94fff6edc 100644 --- a/Spigot-Server-Patches/0168-LivingEntity-setKiller.patch +++ b/Spigot-Server-Patches/0166-LivingEntity-setKiller.patch @@ -5,23 +5,23 @@ Subject: [PATCH] LivingEntity#setKiller diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index e6b48cc0eafc4612181495a1f412fd4f411ab0e5..88688be66880d406705a89efabbd7c509b7e7b8c 100644 +index 34f2821a64c7893ff0a8c33ae4b77ce883227f0c..7ec1a572efd99928e8aae9b75c0eed73430aa337 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -80,7 +80,7 @@ public abstract class EntityLiving extends Entity { +@@ -86,7 +86,7 @@ public abstract class EntityLiving extends Entity { public float aL; - public float aM; + @Nullable public EntityHuman killer; - protected int lastDamageByPlayerTime; + public int lastDamageByPlayerTime; // Paper - protected -> public protected boolean killed; protected int ticksFarFromPlayer; - protected float aR; + protected float aQ; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index da86ee41499b02959755328544307aed39752483..1760dfa7a312b63d7608d890c977452ad995d7ae 100644 +index d5b165e8275c012d775b77b8440489716a6c3c08..5e2642b33d36e0695d6adc879f9595030adaaf31 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -318,6 +318,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -321,6 +321,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { return getHandle().killer == null ? null : (Player) getHandle().killer.getBukkitEntity(); } diff --git a/Spigot-Server-Patches/0169-Use-Log4j-IOStreams-to-redirect-System.out-err-to-lo.patch b/Spigot-Server-Patches/0167-Use-Log4j-IOStreams-to-redirect-System.out-err-to-lo.patch similarity index 88% rename from Spigot-Server-Patches/0169-Use-Log4j-IOStreams-to-redirect-System.out-err-to-lo.patch rename to Spigot-Server-Patches/0167-Use-Log4j-IOStreams-to-redirect-System.out-err-to-lo.patch index b74a6a937..b24ed0154 100644 --- a/Spigot-Server-Patches/0169-Use-Log4j-IOStreams-to-redirect-System.out-err-to-lo.patch +++ b/Spigot-Server-Patches/0167-Use-Log4j-IOStreams-to-redirect-System.out-err-to-lo.patch @@ -12,7 +12,7 @@ results in a separate line, even though it should not result in a line break. Log4j's implementation handles it correctly. diff --git a/pom.xml b/pom.xml -index aeaceac771644ece5365d07be77f4481ced2fe13..25e327c38cc3aa1f9ad9275faba481bdb4240e25 100644 +index 6b4f56744d11029bdbac5479b45c88736f338fa9..3ad7385df33fb9d4d6477648c847e6e0f8fc0469 100644 --- a/pom.xml +++ b/pom.xml @@ -66,6 +66,11 @@ @@ -28,10 +28,10 @@ index aeaceac771644ece5365d07be77f4481ced2fe13..25e327c38cc3aa1f9ad9275faba481bd org.ow2.asm asm diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index d34f772fae3543cec6a130831b1f3eaa67934944..ec257ba31f012d3d3576bbff41326df13ede6776 100644 +index af839f432d410601fbbe06b665e4e0fad801c17d..13ae03d48a2a838ee9eb016072f3486d3c7192ef 100644 --- a/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java -@@ -155,8 +155,10 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer +@@ -131,8 +131,10 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer */ // Paper end diff --git a/Spigot-Server-Patches/0170-Handle-plugin-prefixes-using-Log4J-configuration.patch b/Spigot-Server-Patches/0168-Handle-plugin-prefixes-using-Log4J-configuration.patch similarity index 97% rename from Spigot-Server-Patches/0170-Handle-plugin-prefixes-using-Log4J-configuration.patch rename to Spigot-Server-Patches/0168-Handle-plugin-prefixes-using-Log4J-configuration.patch index 373a195cb..70978a2b1 100644 --- a/Spigot-Server-Patches/0170-Handle-plugin-prefixes-using-Log4J-configuration.patch +++ b/Spigot-Server-Patches/0168-Handle-plugin-prefixes-using-Log4J-configuration.patch @@ -15,7 +15,7 @@ This may cause additional prefixes to be disabled for plugins bypassing the plugin logger. diff --git a/pom.xml b/pom.xml -index 25e327c38cc3aa1f9ad9275faba481bdb4240e25..daeb60a93cf0bbd1f6b731b9502a80c93b2e090b 100644 +index 3ad7385df33fb9d4d6477648c847e6e0f8fc0469..85fb15836cf4ca6a167d7a35f6df5e25056b13a9 100644 --- a/pom.xml +++ b/pom.xml @@ -64,7 +64,7 @@ diff --git a/Spigot-Server-Patches/0171-Include-Log4J2-SLF4J-implementation.patch b/Spigot-Server-Patches/0169-Include-Log4J2-SLF4J-implementation.patch similarity index 88% rename from Spigot-Server-Patches/0171-Include-Log4J2-SLF4J-implementation.patch rename to Spigot-Server-Patches/0169-Include-Log4J2-SLF4J-implementation.patch index 60c71fa5d..d018f2a25 100644 --- a/Spigot-Server-Patches/0171-Include-Log4J2-SLF4J-implementation.patch +++ b/Spigot-Server-Patches/0169-Include-Log4J2-SLF4J-implementation.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Include Log4J2 SLF4J implementation diff --git a/pom.xml b/pom.xml -index daeb60a93cf0bbd1f6b731b9502a80c93b2e090b..8ad07cf6e03cbc5354d2dd2b149b51bbb5067a9d 100644 +index 85fb15836cf4ca6a167d7a35f6df5e25056b13a9..accd4b6521b18495c933a50ed511b173cbb71861 100644 --- a/pom.xml +++ b/pom.xml @@ -66,6 +66,12 @@ diff --git a/Spigot-Server-Patches/0172-Improve-Log4J-Configuration-Plugin-Loggers.patch b/Spigot-Server-Patches/0170-Improve-Log4J-Configuration-Plugin-Loggers.patch similarity index 100% rename from Spigot-Server-Patches/0172-Improve-Log4J-Configuration-Plugin-Loggers.patch rename to Spigot-Server-Patches/0170-Improve-Log4J-Configuration-Plugin-Loggers.patch diff --git a/Spigot-Server-Patches/0173-Add-PlayerJumpEvent.patch b/Spigot-Server-Patches/0171-Add-PlayerJumpEvent.patch similarity index 90% rename from Spigot-Server-Patches/0173-Add-PlayerJumpEvent.patch rename to Spigot-Server-Patches/0171-Add-PlayerJumpEvent.patch index b9446e8ea..ecca21391 100644 --- a/Spigot-Server-Patches/0173-Add-PlayerJumpEvent.patch +++ b/Spigot-Server-Patches/0171-Add-PlayerJumpEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerJumpEvent diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 08211fd37ab7916586c0579cfb9c014c29553991..8da65ed9d96bc7fa3ebac27c2ac35c3bc97fd1f1 100644 +index f62357be4225fa48dd445f0843c99235276566c7..0eb28ad05372a5692412e05974045826fa24abbe 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -58,6 +58,8 @@ import org.bukkit.inventory.CraftingInventory; @@ -17,10 +17,10 @@ index 08211fd37ab7916586c0579cfb9c014c29553991..8da65ed9d96bc7fa3ebac27c2ac35c3b import co.aikar.timings.MinecraftTimings; // Paper // CraftBukkit end -@@ -925,7 +927,34 @@ public class PlayerConnection implements PacketListenerPlayIn { - } +@@ -945,7 +947,34 @@ public class PlayerConnection implements PacketListenerPlayIn { + boolean flag = d8 > 0.0D; - if (this.player.onGround && !packetplayinflying.b() && d8 > 0.0D) { + if (this.player.isOnGround() && !packetplayinflying.b() && flag) { - this.player.jump(); + // Paper start - Add player jump event + Player player = this.getPlayer(); diff --git a/Spigot-Server-Patches/0174-handle-PacketPlayInKeepAlive-async.patch b/Spigot-Server-Patches/0172-handle-PacketPlayInKeepAlive-async.patch similarity index 85% rename from Spigot-Server-Patches/0174-handle-PacketPlayInKeepAlive-async.patch rename to Spigot-Server-Patches/0172-handle-PacketPlayInKeepAlive-async.patch index f791ff0f8..930c72a6b 100644 --- a/Spigot-Server-Patches/0174-handle-PacketPlayInKeepAlive-async.patch +++ b/Spigot-Server-Patches/0172-handle-PacketPlayInKeepAlive-async.patch @@ -15,10 +15,10 @@ also adding some additional logging in order to help work out what is causing random disconnections for clients. diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 8da65ed9d96bc7fa3ebac27c2ac35c3bc97fd1f1..1e81032f3118fb0c572ffe1ac975e60d30f94d67 100644 +index 0eb28ad05372a5692412e05974045826fa24abbe..1d28b2b382877bb24958f28739e90bacfe8b9a94 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -2487,14 +2487,18 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -2530,14 +2530,18 @@ public class PlayerConnection implements PacketListenerPlayIn { @Override public void a(PacketPlayInKeepAlive packetplayinkeepalive) { @@ -30,10 +30,9 @@ index 8da65ed9d96bc7fa3ebac27c2ac35c3bc97fd1f1..1e81032f3118fb0c572ffe1ac975e60d this.player.ping = (this.player.ping * 3 + i) / 4; this.awaitingKeepAlive = false; } else if (!this.isExemptPlayer()) { -- this.disconnect(new ChatMessage("disconnect.timeout", new Object[0])); + // Paper start - This needs to be handled on the main thread for plugins + minecraftServer.scheduleOnMain(() -> { -+ this.disconnect(new ChatMessage("disconnect.timeout")); + this.disconnect(new ChatMessage("disconnect.timeout")); + }); + // Paper end } diff --git a/Spigot-Server-Patches/0175-Expose-client-protocol-version-and-virtual-host.patch b/Spigot-Server-Patches/0173-Expose-client-protocol-version-and-virtual-host.patch similarity index 86% rename from Spigot-Server-Patches/0175-Expose-client-protocol-version-and-virtual-host.patch rename to Spigot-Server-Patches/0173-Expose-client-protocol-version-and-virtual-host.patch index 8ae0d610a..82bfcbb45 100644 --- a/Spigot-Server-Patches/0175-Expose-client-protocol-version-and-virtual-host.patch +++ b/Spigot-Server-Patches/0173-Expose-client-protocol-version-and-virtual-host.patch @@ -61,18 +61,10 @@ index 0000000000000000000000000000000000000000..5caca6439d2135e34880d501397fe2ea + +} diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java -index d0b9c6e3dcae76d802e095731c78fb9693982f90..8928d93e49bec174e86a2b451ac40f3946193009 100644 +index c0e3d18b0a528d6bca878f354bf8b4b417522c29..12fb251dc96bf179e393046ecc256ea80fdd79de 100644 --- a/src/main/java/net/minecraft/server/HandshakeListener.java +++ b/src/main/java/net/minecraft/server/HandshakeListener.java -@@ -15,6 +15,7 @@ public class HandshakeListener implements PacketHandshakingInListener { - - private final MinecraftServer a; - private final NetworkManager b; -+ private NetworkManager getNetworkManager() { return b; } // Paper - OBFHELPER - - public HandshakeListener(MinecraftServer minecraftserver, NetworkManager networkmanager) { - this.a = minecraftserver; -@@ -129,6 +130,10 @@ public class HandshakeListener implements PacketHandshakingInListener { +@@ -133,6 +133,10 @@ public class HandshakeListener implements PacketHandshakingInListener { throw new UnsupportedOperationException("Invalid intention " + packethandshakinginsetprotocol.b()); } @@ -84,7 +76,7 @@ index d0b9c6e3dcae76d802e095731c78fb9693982f90..8928d93e49bec174e86a2b451ac40f39 @Override diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index 3ccf1663669c79a63a6b3a9f6dc17a6e25e91915..e2d8ed88f05bf8cb214329ea27ac2b67f43e071a 100644 +index c2fdccfb9192aa7ec55fd67c169cba71a695075c..33900c22d4123e0f8333b9bdb9601d302e26c972 100644 --- a/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java @@ -60,6 +60,10 @@ public class NetworkManager extends SimpleChannelInboundHandler> { @@ -111,10 +103,10 @@ index 4f008e4723d2cb0bcabb2d5621203d63c40c4923..8545146fb1f093f821e3b966d9337049 return this.a; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index a4afce71be0707c43700b73ae0107074448e3d4a..3d4a1065fbe38239743e485d078b76b47981baf1 100644 +index e7c42fb4fd1235a934c16f4cccc1b1a66b3672a0..758981757996a8c9aa5066640e5b6c293bb7fc64 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -182,6 +182,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -188,6 +188,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } } diff --git a/Spigot-Server-Patches/0176-revert-serverside-behavior-of-keepalives.patch b/Spigot-Server-Patches/0174-revert-serverside-behavior-of-keepalives.patch similarity index 93% rename from Spigot-Server-Patches/0176-revert-serverside-behavior-of-keepalives.patch rename to Spigot-Server-Patches/0174-revert-serverside-behavior-of-keepalives.patch index a39e2c78a..4c97ad9f5 100644 --- a/Spigot-Server-Patches/0176-revert-serverside-behavior-of-keepalives.patch +++ b/Spigot-Server-Patches/0174-revert-serverside-behavior-of-keepalives.patch @@ -17,7 +17,7 @@ from networking or during connections flood of chunk packets on slower clients, at the cost of dead connections being kept open for longer. diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 1e81032f3118fb0c572ffe1ac975e60d30f94d67..be52533ef59c7a21119b8308247a5c8092a7db26 100644 +index 1d28b2b382877bb24958f28739e90bacfe8b9a94..76cd3ea9512f4355a055d9c683d939680dc5a1b7 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -70,7 +70,7 @@ public class PlayerConnection implements PacketListenerPlayIn { @@ -37,7 +37,7 @@ index 1e81032f3118fb0c572ffe1ac975e60d30f94d67..be52533ef59c7a21119b8308247a5c80 public PlayerConnection(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer) { this.minecraftServer = minecraftserver; -@@ -182,18 +183,26 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -182,18 +183,25 @@ public class PlayerConnection implements PacketListenerPlayIn { } this.minecraftServer.getMethodProfiler().enter("keepAlive"); @@ -45,6 +45,12 @@ index 1e81032f3118fb0c572ffe1ac975e60d30f94d67..be52533ef59c7a21119b8308247a5c80 - - if (i - this.lastKeepAlive >= 25000L) { // CraftBukkit - if (this.awaitingKeepAlive) { +- this.disconnect(new ChatMessage("disconnect.timeout")); +- } else { +- this.awaitingKeepAlive = true; +- this.lastKeepAlive = i; +- this.h = i; +- this.sendPacket(new PacketPlayOutKeepAlive(this.h)); + // Paper Start - give clients a longer time to respond to pings as per pre 1.12.2 timings + // This should effectively place the keepalive handling back to "as it was" before 1.12.2 + long currentTime = SystemUtils.getMonotonicMillis(); @@ -53,12 +59,7 @@ index 1e81032f3118fb0c572ffe1ac975e60d30f94d67..be52533ef59c7a21119b8308247a5c80 + if (this.isPendingPing()) { + if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected + PlayerConnection.LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getName()); // more info - this.disconnect(new ChatMessage("disconnect.timeout", new Object[0])); -- } else { -- this.awaitingKeepAlive = true; -- this.lastKeepAlive = i; -- this.h = i; -- this.sendPacket(new PacketPlayOutKeepAlive(this.h)); ++ this.disconnect(new ChatMessage("disconnect.timeout", new Object[0])); + } + } else { + if (elapsedTime >= 15000L) { // 15 seconds @@ -66,7 +67,6 @@ index 1e81032f3118fb0c572ffe1ac975e60d30f94d67..be52533ef59c7a21119b8308247a5c80 + this.setLastPing(currentTime); + this.setKeepAliveID(currentTime); + this.sendPacket(new PacketPlayOutKeepAlive(this.getKeepAliveID())); -+ } } + // Paper end diff --git a/Spigot-Server-Patches/0177-Send-attack-SoundEffects-only-to-players-who-can-see.patch b/Spigot-Server-Patches/0175-Send-attack-SoundEffects-only-to-players-who-can-see.patch similarity index 89% rename from Spigot-Server-Patches/0177-Send-attack-SoundEffects-only-to-players-who-can-see.patch rename to Spigot-Server-Patches/0175-Send-attack-SoundEffects-only-to-players-who-can-see.patch index ecbbf5a65..5fc86613f 100644 --- a/Spigot-Server-Patches/0177-Send-attack-SoundEffects-only-to-players-who-can-see.patch +++ b/Spigot-Server-Patches/0175-Send-attack-SoundEffects-only-to-players-who-can-see.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Send attack SoundEffects only to players who can see the diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index 8e5edd2c9b7cc9a441969efeb666061515188486..542f935b4e7a027b3df82f037fcd6523286c5106 100644 +index 69c0a4c7bfb1c753d544dcd074ad832d3e5ef3a0..eaed020982bd19dab72872849170fa62d75699eb 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -1023,6 +1023,15 @@ public abstract class EntityHuman extends EntityLiving { +@@ -1002,6 +1002,15 @@ public abstract class EntityHuman extends EntityLiving { return vec3d; } @@ -23,9 +23,9 @@ index 8e5edd2c9b7cc9a441969efeb666061515188486..542f935b4e7a027b3df82f037fcd6523 + // Paper end + public void attack(Entity entity) { - if (entity.bA()) { + if (entity.bH()) { if (!entity.t(this)) { -@@ -1047,7 +1056,7 @@ public abstract class EntityHuman extends EntityLiving { +@@ -1026,7 +1035,7 @@ public abstract class EntityHuman extends EntityLiving { int i = b0 + EnchantmentManager.b((EntityLiving) this); if (this.isSprinting() && flag) { @@ -34,16 +34,16 @@ index 8e5edd2c9b7cc9a441969efeb666061515188486..542f935b4e7a027b3df82f037fcd6523 ++i; flag1 = true; } -@@ -1122,7 +1131,7 @@ public abstract class EntityHuman extends EntityLiving { +@@ -1101,7 +1110,7 @@ public abstract class EntityHuman extends EntityLiving { } } - this.world.playSound((EntityHuman) null, this.locX(), this.locY(), this.locZ(), SoundEffects.ENTITY_PLAYER_ATTACK_SWEEP, this.getSoundCategory(), 1.0F, 1.0F); + sendSoundEffect(this, this.locX(), this.locY(), this.locZ(), SoundEffects.ENTITY_PLAYER_ATTACK_SWEEP, this.getSoundCategory(), 1.0F, 1.0F); // Paper - send while respecting visibility - this.ea(); + this.ew(); } -@@ -1150,15 +1159,15 @@ public abstract class EntityHuman extends EntityLiving { +@@ -1129,15 +1138,15 @@ public abstract class EntityHuman extends EntityLiving { } if (flag2) { @@ -62,7 +62,7 @@ index 8e5edd2c9b7cc9a441969efeb666061515188486..542f935b4e7a027b3df82f037fcd6523 } } -@@ -1210,7 +1219,7 @@ public abstract class EntityHuman extends EntityLiving { +@@ -1189,7 +1198,7 @@ public abstract class EntityHuman extends EntityLiving { this.applyExhaustion(world.spigotConfig.combatExhaustion); // Spigot - Change to use configurable value } else { @@ -72,10 +72,10 @@ index 8e5edd2c9b7cc9a441969efeb666061515188486..542f935b4e7a027b3df82f037fcd6523 entity.extinguish(); } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 08f22545393148e91bec3d4a091092eab6828711..b3e01415110d6a714b6cd5a94bf747a1481d72ab 100644 +index 15b1d9a82f8ced4d53a7848fa3cfdb835fbc3e5b..8b6667eb3b1976b4c7ed22060e55ad5c5b8179ce 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -585,6 +585,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -646,6 +646,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable { this.playSound(entityhuman, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, soundeffect, soundcategory, f, f1); } diff --git a/Spigot-Server-Patches/0178-Option-for-maximum-exp-value-when-merging-orbs.patch b/Spigot-Server-Patches/0176-Option-for-maximum-exp-value-when-merging-orbs.patch similarity index 91% rename from Spigot-Server-Patches/0178-Option-for-maximum-exp-value-when-merging-orbs.patch rename to Spigot-Server-Patches/0176-Option-for-maximum-exp-value-when-merging-orbs.patch index 0cdf0fc35..dc2b8d99a 100644 --- a/Spigot-Server-Patches/0178-Option-for-maximum-exp-value-when-merging-orbs.patch +++ b/Spigot-Server-Patches/0176-Option-for-maximum-exp-value-when-merging-orbs.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Option for maximum exp value when merging orbs diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 39ab5457569684bc66cd67f5f9d2505ef9f304ab..d2582d981f859b55ba5086540963c01ed49e4c15 100644 +index e30f48caf2ce4f48f371b2594b765c27bc9e9778..2d8b354d707e8b5b0e7cd644fb93bc8f1c4009f1 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -340,4 +340,10 @@ public class PaperWorldConfig { +@@ -335,4 +335,10 @@ public class PaperWorldConfig { disableCreeperLingeringEffect = getBoolean("disable-creeper-lingering-effect", false); log("Creeper lingering effect: " + disableCreeperLingeringEffect); } @@ -20,10 +20,10 @@ index 39ab5457569684bc66cd67f5f9d2505ef9f304ab..d2582d981f859b55ba5086540963c01e + } } diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 48008ca8b7632a9cfbf78ee8a142af9c8e2e91b6..90349d76a77a13094ca6476cc0dafaf526187946 100644 +index ac5f492fd0d837da150e415bc007c10fe7ee3714..3e0b51db3d90b0039eee3375ac0fa4f96712b922 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -550,16 +550,32 @@ public class CraftEventFactory { +@@ -577,16 +577,32 @@ public class CraftEventFactory { EntityExperienceOrb xp = (EntityExperienceOrb) entity; double radius = world.spigotConfig.expMerge; if (radius > 0) { diff --git a/Spigot-Server-Patches/0177-Add-PlayerArmorChangeEvent.patch b/Spigot-Server-Patches/0177-Add-PlayerArmorChangeEvent.patch new file mode 100644 index 000000000..cc14fa55c --- /dev/null +++ b/Spigot-Server-Patches/0177-Add-PlayerArmorChangeEvent.patch @@ -0,0 +1,43 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: pkt77 +Date: Fri, 10 Nov 2017 23:46:34 -0500 +Subject: [PATCH] Add PlayerArmorChangeEvent + + +diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java +index 7ec1a572efd99928e8aae9b75c0eed73430aa337..26832d31cc64d26a9ca61a3bad21424ed366c74c 100644 +--- a/src/main/java/net/minecraft/server/EntityLiving.java ++++ b/src/main/java/net/minecraft/server/EntityLiving.java +@@ -1,5 +1,6 @@ + package net.minecraft.server; + ++import com.destroystokyo.paper.event.player.PlayerArmorChangeEvent; // Paper + import com.google.common.base.Objects; + import com.google.common.collect.ImmutableList; + import com.google.common.collect.ImmutableMap; +@@ -2523,6 +2524,13 @@ public abstract class EntityLiving extends Entity { + ItemStack itemstack1 = this.getEquipment(enumitemslot); + + if (!ItemStack.matches(itemstack1, itemstack)) { ++ // Paper start - PlayerArmorChangeEvent ++ if (this instanceof EntityPlayer && enumitemslot.getType() == EnumItemSlot.Function.ARMOR) { ++ final org.bukkit.inventory.ItemStack oldItem = CraftItemStack.asBukkitCopy(itemstack); ++ final org.bukkit.inventory.ItemStack newItem = CraftItemStack.asBukkitCopy(itemstack1); ++ new PlayerArmorChangeEvent((Player) this.getBukkitEntity(), PlayerArmorChangeEvent.SlotType.valueOf(enumitemslot.name()), oldItem, newItem).callEvent(); ++ } ++ // Paper end + if (map == null) { + map = Maps.newEnumMap(EnumItemSlot.class); + } +diff --git a/src/main/java/net/minecraft/server/EnumItemSlot.java b/src/main/java/net/minecraft/server/EnumItemSlot.java +index 02a7ae6785b0539e4aa567fca377d727184fd019..60b235f16f5e762d635efa1578b715db445513a5 100644 +--- a/src/main/java/net/minecraft/server/EnumItemSlot.java ++++ b/src/main/java/net/minecraft/server/EnumItemSlot.java +@@ -16,6 +16,7 @@ public enum EnumItemSlot { + this.j = s; + } + ++ public EnumItemSlot.Function getType() { return this.a(); } // Paper - OBFHELPER + public EnumItemSlot.Function a() { + return this.g; + } diff --git a/Spigot-Server-Patches/0180-Prevent-logins-from-being-processed-when-the-player-.patch b/Spigot-Server-Patches/0178-Prevent-logins-from-being-processed-when-the-player-.patch similarity index 83% rename from Spigot-Server-Patches/0180-Prevent-logins-from-being-processed-when-the-player-.patch rename to Spigot-Server-Patches/0178-Prevent-logins-from-being-processed-when-the-player-.patch index 9d33fdb2e..f3a5b4b02 100644 --- a/Spigot-Server-Patches/0180-Prevent-logins-from-being-processed-when-the-player-.patch +++ b/Spigot-Server-Patches/0178-Prevent-logins-from-being-processed-when-the-player-.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Prevent logins from being processed when the player has diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java -index 758fe774897245148befeb26ddd65cf4c1a8301b..1fb609dcfc61adfc63f0d32dc87a5e144a5013cf 100644 +index 723c73a8056d34136c64cd038f274d3d94749314..3cc12e7b75b8ed21a0ea44f8453553cf856fb786 100644 --- a/src/main/java/net/minecraft/server/LoginListener.java +++ b/src/main/java/net/minecraft/server/LoginListener.java -@@ -56,7 +56,11 @@ public class LoginListener implements PacketLoginInListener { +@@ -55,7 +55,11 @@ public class LoginListener implements PacketLoginInListener { } // Paper end if (this.g == LoginListener.EnumProtocolState.READY_TO_ACCEPT) { @@ -20,5 +20,5 @@ index 758fe774897245148befeb26ddd65cf4c1a8301b..1fb609dcfc61adfc63f0d32dc87a5e14 + } + // Paper end } else if (this.g == LoginListener.EnumProtocolState.DELAY_ACCEPT) { - EntityPlayer entityplayer = this.server.getPlayerList().a(this.i.getId()); + EntityPlayer entityplayer = this.server.getPlayerList().getPlayer(this.i.getId()); diff --git a/Spigot-Server-Patches/0179-Add-PlayerArmorChangeEvent.patch b/Spigot-Server-Patches/0179-Add-PlayerArmorChangeEvent.patch deleted file mode 100644 index 1100cc9e1..000000000 --- a/Spigot-Server-Patches/0179-Add-PlayerArmorChangeEvent.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: pkt77 -Date: Fri, 10 Nov 2017 23:46:34 -0500 -Subject: [PATCH] Add PlayerArmorChangeEvent - - -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 88688be66880d406705a89efabbd7c509b7e7b8c..c5c0fc3877fa6c8602e4468d5702612d986891f9 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -1,5 +1,6 @@ - package net.minecraft.server; - -+import com.destroystokyo.paper.event.player.PlayerArmorChangeEvent; - import com.google.common.base.Objects; - import com.google.common.collect.ImmutableList; - import com.google.common.collect.ImmutableSet; -@@ -2339,6 +2340,13 @@ public abstract class EntityLiving extends Entity { - ItemStack itemstack1 = this.getEquipment(enumitemslot); - - if (!ItemStack.matches(itemstack1, itemstack)) { -+ // Paper start - PlayerArmorChangeEvent -+ if (this instanceof EntityPlayer && enumitemslot.getType() == EnumItemSlot.Function.ARMOR) { -+ final org.bukkit.inventory.ItemStack oldItem = CraftItemStack.asBukkitCopy(itemstack); -+ final org.bukkit.inventory.ItemStack newItem = CraftItemStack.asBukkitCopy(itemstack1); -+ new PlayerArmorChangeEvent((Player) this.getBukkitEntity(), PlayerArmorChangeEvent.SlotType.valueOf(enumitemslot.name()), oldItem, newItem).callEvent(); -+ } -+ // Paper end - ((WorldServer) this.world).getChunkProvider().broadcast(this, new PacketPlayOutEntityEquipment(this.getId(), enumitemslot, itemstack1)); - if (!itemstack.isEmpty()) { - this.getAttributeMap().a(itemstack.a(enumitemslot)); -diff --git a/src/main/java/net/minecraft/server/EnumItemSlot.java b/src/main/java/net/minecraft/server/EnumItemSlot.java -index 02a7ae6785b0539e4aa567fca377d727184fd019..60b235f16f5e762d635efa1578b715db445513a5 100644 ---- a/src/main/java/net/minecraft/server/EnumItemSlot.java -+++ b/src/main/java/net/minecraft/server/EnumItemSlot.java -@@ -16,6 +16,7 @@ public enum EnumItemSlot { - this.j = s; - } - -+ public EnumItemSlot.Function getType() { return this.a(); } // Paper - OBFHELPER - public EnumItemSlot.Function a() { - return this.g; - } diff --git a/Spigot-Server-Patches/0181-use-CB-BlockState-implementations-for-captured-block.patch b/Spigot-Server-Patches/0179-use-CB-BlockState-implementations-for-captured-block.patch similarity index 87% rename from Spigot-Server-Patches/0181-use-CB-BlockState-implementations-for-captured-block.patch rename to Spigot-Server-Patches/0179-use-CB-BlockState-implementations-for-captured-block.patch index 89e508c6e..4a0637be0 100644 --- a/Spigot-Server-Patches/0181-use-CB-BlockState-implementations-for-captured-block.patch +++ b/Spigot-Server-Patches/0179-use-CB-BlockState-implementations-for-captured-block.patch @@ -18,10 +18,10 @@ the blockstate that will be valid for restoration, as opposed to dropping information on restoration when the event is cancelled. diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index b3e01415110d6a714b6cd5a94bf747a1481d72ab..08bed18ad6f78c6aad444eeb5a321887d90e5829 100644 +index 8b6667eb3b1976b4c7ed22060e55ad5c5b8179ce..324967c892ff8878326af4229668fcbde37ef202 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -66,7 +66,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -71,7 +71,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { public boolean captureBlockStates = false; public boolean captureTreeGeneration = false; @@ -30,8 +30,8 @@ index b3e01415110d6a714b6cd5a94bf747a1481d72ab..08bed18ad6f78c6aad444eeb5a321887 public Map capturedTileEntities = new HashMap<>(); public List captureDrops; public long ticksPerAnimalSpawns; -@@ -258,7 +258,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - public boolean setTypeAndData(BlockPosition blockposition, IBlockData iblockdata, int i) { +@@ -329,7 +329,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + public boolean a(BlockPosition blockposition, IBlockData iblockdata, int i, int j) { // CraftBukkit start - tree generation if (this.captureTreeGeneration) { - CapturedBlockState blockstate = capturedBlockStates.get(blockposition); @@ -39,7 +39,7 @@ index b3e01415110d6a714b6cd5a94bf747a1481d72ab..08bed18ad6f78c6aad444eeb5a321887 if (blockstate == null) { blockstate = CapturedBlockState.getTreeBlockState(this, blockposition, i); this.capturedBlockStates.put(blockposition.immutableCopy(), blockstate); -@@ -278,7 +278,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -349,7 +349,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { // CraftBukkit start - capture blockstates boolean captured = false; if (this.captureBlockStates && !this.capturedBlockStates.containsKey(blockposition)) { @@ -48,7 +48,7 @@ index b3e01415110d6a714b6cd5a94bf747a1481d72ab..08bed18ad6f78c6aad444eeb5a321887 this.capturedBlockStates.put(blockposition.immutableCopy(), blockstate); captured = true; } -@@ -546,7 +546,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -607,7 +607,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { public IBlockData getType(BlockPosition blockposition) { // CraftBukkit start - tree generation if (captureTreeGeneration) { diff --git a/Spigot-Server-Patches/0182-API-to-get-a-BlockState-without-a-snapshot.patch b/Spigot-Server-Patches/0180-API-to-get-a-BlockState-without-a-snapshot.patch similarity index 94% rename from Spigot-Server-Patches/0182-API-to-get-a-BlockState-without-a-snapshot.patch rename to Spigot-Server-Patches/0180-API-to-get-a-BlockState-without-a-snapshot.patch index cb6a1928f..ae64fe925 100644 --- a/Spigot-Server-Patches/0182-API-to-get-a-BlockState-without-a-snapshot.patch +++ b/Spigot-Server-Patches/0180-API-to-get-a-BlockState-without-a-snapshot.patch @@ -13,7 +13,7 @@ also Avoid NPE during CraftBlockEntityState load if could not get TE If Tile Entity was null, correct Sign to return empty lines instead of null diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index 630b279158f26902ebdcc6e5c810b189ce49c910..958279249fdadfe5c2808d2a046636f06c3bd500 100644 +index 5e5bb5aaa3d8f4e8f4b00ba8bee059ec79f82b43..2b06c95b4fac97513e706ef073fdd7418e1f092c 100644 --- a/src/main/java/net/minecraft/server/TileEntity.java +++ b/src/main/java/net/minecraft/server/TileEntity.java @@ -231,7 +231,12 @@ public abstract class TileEntity implements KeyedObject { // Paper @@ -39,7 +39,7 @@ index 630b279158f26902ebdcc6e5c810b189ce49c910..958279249fdadfe5c2808d2a046636f0 return null; } diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -index 6bf73af21ceb52708013b1e25373fa42ddbefb2b..30b7c9038d3a95b80304e052a5d629b461f76e99 100644 +index 606a89a905396a020a3497aa293f64a04c693c7b..12b8d544566888dc77bc2c8748d78f09c4bb3b76 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -308,6 +308,20 @@ public class CraftBlock implements Block { @@ -64,7 +64,7 @@ index 6bf73af21ceb52708013b1e25373fa42ddbefb2b..30b7c9038d3a95b80304e052a5d629b4 switch (material) { diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java -index 17d80b5c6e512e0c582b05c92bb795b004ba27c2..f6401e2cde9d56547cee7f8d9e4b2a58764ee895 100644 +index 26cc40e57f5b73b9c32859bff37c4a3d94904c56..feeae1a9eb309ae4101783b191bb2bffe9aeb7d3 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java @@ -26,20 +26,40 @@ public class CraftBlockEntityState extends CraftBlockState diff --git a/Spigot-Server-Patches/0183-AsyncTabCompleteEvent.patch b/Spigot-Server-Patches/0181-AsyncTabCompleteEvent.patch similarity index 83% rename from Spigot-Server-Patches/0183-AsyncTabCompleteEvent.patch rename to Spigot-Server-Patches/0181-AsyncTabCompleteEvent.patch index bbf50969b..cae2dcaad 100644 --- a/Spigot-Server-Patches/0183-AsyncTabCompleteEvent.patch +++ b/Spigot-Server-Patches/0181-AsyncTabCompleteEvent.patch @@ -14,10 +14,10 @@ completion, such as offline players. Also adds isCommand and getLocation to the sync TabCompleteEvent diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index be52533ef59c7a21119b8308247a5c8092a7db26..5cb402156dc29eb27b17266490f2a5ff88ba9dea 100644 +index 76cd3ea9512f4355a055d9c683d939680dc5a1b7..ccf083fbfa97b2a24338a3c1fe18e9a8c850feaf 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -524,10 +524,10 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -527,10 +527,10 @@ public class PlayerConnection implements PacketListenerPlayIn { @Override public void a(PacketPlayInTabComplete packetplayintabcomplete) { @@ -30,7 +30,7 @@ index be52533ef59c7a21119b8308247a5c8092a7db26..5cb402156dc29eb27b17266490f2a5ff return; } // CraftBukkit end -@@ -537,12 +537,37 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -540,12 +540,35 @@ public class PlayerConnection implements PacketListenerPlayIn { stringreader.skip(); } @@ -46,19 +46,20 @@ index be52533ef59c7a21119b8308247a5c8092a7db26..5cb402156dc29eb27b17266490f2a5ff + // If the event isn't handled, we can assume that we have no completions, and so we'll ask the server + if (!event.isHandled()) { + if (!event.isCancelled()) { -+ // Paper end - async tab completion -+ this.minecraftServer.scheduleOnMain(() -> { // Paper - This needs to be on main -+ ParseResults parseresults = this.minecraftServer.getCommandDispatcher().a().parse(stringreader, this.player.getCommandListener()); - this.minecraftServer.getCommandDispatcher().a().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> { - if (((Suggestions) suggestions).isEmpty()) return; // CraftBukkit - don't send through empty suggestions - prevents [] from showing for plugins with nothing more to offer -- this.networkManager.sendPacket(new PacketPlayOutTabComplete(packetplayintabcomplete.b(), (Suggestions) suggestions)); // CraftBukkit - decompile error +- this.minecraftServer.getCommandDispatcher().a().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> { +- if (suggestions.isEmpty()) return; // CraftBukkit - don't send through empty suggestions - prevents [] from showing for plugins with nothing more to offer +- this.networkManager.sendPacket(new PacketPlayOutTabComplete(packetplayintabcomplete.b(), suggestions)); - }); -+ this.networkManager.sendPacket(new PacketPlayOutTabComplete(packetplayintabcomplete.b(), (Suggestions) suggestions)); // CraftBukkit - decompile error -+ }); -+ }); // Paper - This needs to be on main ++ this.minecraftServer.scheduleOnMain(() -> { // Paper - This needs to be on main ++ ParseResults parseresults = this.minecraftServer.getCommandDispatcher().a().parse(stringreader, this.player.getCommandListener()); ++ ++ this.minecraftServer.getCommandDispatcher().a().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> { ++ if (suggestions.isEmpty()) return; // CraftBukkit - don't send through empty suggestions - prevents [] from showing for plugins with nothing more to offer ++ this.networkManager.sendPacket(new PacketPlayOutTabComplete(packetplayintabcomplete.b(), suggestions)); ++ }); ++ }); + } -+ // Paper start - async tab completion + } else if (!completions.isEmpty()) { + com.mojang.brigadier.suggestion.SuggestionsBuilder builder = new com.mojang.brigadier.suggestion.SuggestionsBuilder(packetplayintabcomplete.c(), stringreader.getTotalLength()); + @@ -67,15 +68,14 @@ index be52533ef59c7a21119b8308247a5c8092a7db26..5cb402156dc29eb27b17266490f2a5ff + player.playerConnection.sendPacket(new PacketPlayOutTabComplete(packetplayintabcomplete.b(), builder.buildFuture().join())); + } + // Paper end - async tab completion -+ } @Override diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 95f4abddf57eb8c59cb5a5410b8d551d39f94fd7..3697b3298feaec30c305e3da011790f2406e12d7 100644 +index 73b69d4acda27995961306831c39696604559ad6..bfe812fdb3aca643634281a57c4f94509dbe70b1 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1710,7 +1710,7 @@ public final class CraftServer implements Server { +@@ -1789,7 +1789,7 @@ public final class CraftServer implements Server { offers = tabCompleteChat(player, message); } diff --git a/Spigot-Server-Patches/0184-Avoid-NPE-in-PathfinderGoalTempt.patch b/Spigot-Server-Patches/0182-Avoid-NPE-in-PathfinderGoalTempt.patch similarity index 90% rename from Spigot-Server-Patches/0184-Avoid-NPE-in-PathfinderGoalTempt.patch rename to Spigot-Server-Patches/0182-Avoid-NPE-in-PathfinderGoalTempt.patch index 3fbc4202d..2e8bf4295 100644 --- a/Spigot-Server-Patches/0184-Avoid-NPE-in-PathfinderGoalTempt.patch +++ b/Spigot-Server-Patches/0182-Avoid-NPE-in-PathfinderGoalTempt.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Avoid NPE in PathfinderGoalTempt diff --git a/src/main/java/net/minecraft/server/PathfinderGoalTempt.java b/src/main/java/net/minecraft/server/PathfinderGoalTempt.java -index eafdcb916af55978672c139b7ccdf5feba383264..d37a2fa0ab3cbf4b76be90079c083e208843fe6e 100644 +index 351152ae32e162fa912d60e929abeec783140106..b115f40b0b11e89184960a5cce5b8295030469e9 100644 --- a/src/main/java/net/minecraft/server/PathfinderGoalTempt.java +++ b/src/main/java/net/minecraft/server/PathfinderGoalTempt.java @@ -55,7 +55,7 @@ public class PathfinderGoalTempt extends PathfinderGoal { diff --git a/Spigot-Server-Patches/0185-PlayerPickupExperienceEvent.patch b/Spigot-Server-Patches/0183-PlayerPickupExperienceEvent.patch similarity index 70% rename from Spigot-Server-Patches/0185-PlayerPickupExperienceEvent.patch rename to Spigot-Server-Patches/0183-PlayerPickupExperienceEvent.patch index 00a43cac8..1120cd9b7 100644 --- a/Spigot-Server-Patches/0185-PlayerPickupExperienceEvent.patch +++ b/Spigot-Server-Patches/0183-PlayerPickupExperienceEvent.patch @@ -6,15 +6,15 @@ Subject: [PATCH] PlayerPickupExperienceEvent Allows plugins to cancel a player picking up an experience orb diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java -index d4275e733d9996d121efd95ae1ff4676a1ebfbb5..b3edb69a967058392f5027fbdc7fadff7e1dc6e2 100644 +index d9a0cd1e90445ff7a1d9e7cef2f71e27bd3686cb..e7fb982913f391bafd608c4626086cd9cab7fad7 100644 --- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java +++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java -@@ -222,7 +222,7 @@ public class EntityExperienceOrb extends Entity { +@@ -217,7 +217,7 @@ public class EntityExperienceOrb extends Entity { @Override public void pickup(EntityHuman entityhuman) { if (!this.world.isClientSide) { -- if (this.d == 0 && entityhuman.bC == 0) { -+ if (this.d == 0 && entityhuman.bC == 0 && new com.destroystokyo.paper.event.player.PlayerPickupExperienceEvent(((EntityPlayer) entityhuman).getBukkitEntity(), (org.bukkit.entity.ExperienceOrb) this.getBukkitEntity()).callEvent()) { // Paper - entityhuman.bC = 2; +- if (this.d == 0 && entityhuman.bB == 0) { ++ if (this.d == 0 && entityhuman.bB == 0 && new com.destroystokyo.paper.event.player.PlayerPickupExperienceEvent(((EntityPlayer) entityhuman).getBukkitEntity(), (org.bukkit.entity.ExperienceOrb) this.getBukkitEntity()).callEvent()) { // Paper + entityhuman.bB = 2; entityhuman.receive(this, 1); - Entry entry = EnchantmentManager.b(Enchantments.MENDING, (EntityLiving) entityhuman); + Entry entry = EnchantmentManager.a(Enchantments.MENDING, (EntityLiving) entityhuman, ItemStack::f); diff --git a/Spigot-Server-Patches/0186-ExperienceOrbMergeEvent.patch b/Spigot-Server-Patches/0184-ExperienceOrbMergeEvent.patch similarity index 91% rename from Spigot-Server-Patches/0186-ExperienceOrbMergeEvent.patch rename to Spigot-Server-Patches/0184-ExperienceOrbMergeEvent.patch index fc73d734f..827877744 100644 --- a/Spigot-Server-Patches/0186-ExperienceOrbMergeEvent.patch +++ b/Spigot-Server-Patches/0184-ExperienceOrbMergeEvent.patch @@ -8,10 +8,10 @@ Plugins can cancel this if they want to ensure experience orbs do not lose impor metadata such as spawn reason, or conditionally move data from source to target. diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 90349d76a77a13094ca6476cc0dafaf526187946..43965bea87e5884fa0f6b7838abbade08ce5c536 100644 +index 3e0b51db3d90b0039eee3375ac0fa4f96712b922..7cadd8d55d0537b31969f421370c830e8925bed2 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -560,7 +560,7 @@ public class CraftEventFactory { +@@ -587,7 +587,7 @@ public class CraftEventFactory { if (e instanceof EntityExperienceOrb) { EntityExperienceOrb loopItem = (EntityExperienceOrb) e; // Paper start diff --git a/Spigot-Server-Patches/0187-Ability-to-apply-mending-to-XP-API.patch b/Spigot-Server-Patches/0185-Ability-to-apply-mending-to-XP-API.patch similarity index 87% rename from Spigot-Server-Patches/0187-Ability-to-apply-mending-to-XP-API.patch rename to Spigot-Server-Patches/0185-Ability-to-apply-mending-to-XP-API.patch index 8eff7f4dc..4930edc64 100644 --- a/Spigot-Server-Patches/0187-Ability-to-apply-mending-to-XP-API.patch +++ b/Spigot-Server-Patches/0185-Ability-to-apply-mending-to-XP-API.patch @@ -10,10 +10,10 @@ of giving the player experience points. Both an API To standalone mend, and apply mending logic to .giveExp has been added. diff --git a/src/main/java/net/minecraft/server/EnchantmentManager.java b/src/main/java/net/minecraft/server/EnchantmentManager.java -index 1822178e8dd67bb063f5eab60335de9852b9a71c..d96c03a1a164799f49fdb3309594e7592a8d2206 100644 +index cea65c1d80a7bd303cf28a6fe2bd73d542a19557..92ceb8bb7d7c47e395dfdcfe6d01f807c048ddc1 100644 --- a/src/main/java/net/minecraft/server/EnchantmentManager.java +++ b/src/main/java/net/minecraft/server/EnchantmentManager.java -@@ -246,6 +246,11 @@ public class EnchantmentManager { +@@ -251,6 +251,11 @@ public class EnchantmentManager { return getEnchantmentLevel(Enchantments.CHANNELING, itemstack) > 0; } @@ -24,12 +24,12 @@ index 1822178e8dd67bb063f5eab60335de9852b9a71c..d96c03a1a164799f49fdb3309594e759 + } @Nullable public static Entry b(Enchantment enchantment, EntityLiving entityliving) { - Map map = enchantment.a(entityliving); + return a(enchantment, entityliving, (itemstack) -> { diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java -index b3edb69a967058392f5027fbdc7fadff7e1dc6e2..87c6b77ce3b1446893a0d617b63f925a403e09cc 100644 +index e7fb982913f391bafd608c4626086cd9cab7fad7..7f2d8de12473c5413bbfc10ea0947d6a30802645 100644 --- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java +++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java -@@ -254,10 +254,12 @@ public class EntityExperienceOrb extends Entity { +@@ -249,10 +249,12 @@ public class EntityExperienceOrb extends Entity { } } @@ -43,10 +43,10 @@ index b3edb69a967058392f5027fbdc7fadff7e1dc6e2..87c6b77ce3b1446893a0d617b63f925a return i * 2; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 3d4a1065fbe38239743e485d078b76b47981baf1..5b088b21da2ca3945de9c5dcc4370114f930d739 100644 +index 758981757996a8c9aa5066640e5b6c293bb7fc64..e2f707e461e2e13f240a30a94c9acf191828219b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1017,8 +1017,37 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1073,8 +1073,37 @@ public class CraftPlayer extends CraftHumanEntity implements Player { return GameMode.getByValue(getHandle().playerInteractManager.getGameMode().getId()); } diff --git a/Spigot-Server-Patches/0188-Make-max-squid-spawn-height-configurable.patch b/Spigot-Server-Patches/0186-Make-max-squid-spawn-height-configurable.patch similarity index 86% rename from Spigot-Server-Patches/0188-Make-max-squid-spawn-height-configurable.patch rename to Spigot-Server-Patches/0186-Make-max-squid-spawn-height-configurable.patch index 5a0f752d2..e65224285 100644 --- a/Spigot-Server-Patches/0188-Make-max-squid-spawn-height-configurable.patch +++ b/Spigot-Server-Patches/0186-Make-max-squid-spawn-height-configurable.patch @@ -7,10 +7,10 @@ I don't know why upstream made only the minimum height configurable but whatever diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index d2582d981f859b55ba5086540963c01ed49e4c15..92e6891502ef6dc276ed5b371124f24d5237b26b 100644 +index 2d8b354d707e8b5b0e7cd644fb93bc8f1c4009f1..48fa2483fc657b36b8f2fd7d8b35703cff2698a5 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -346,4 +346,9 @@ public class PaperWorldConfig { +@@ -341,4 +341,9 @@ public class PaperWorldConfig { expMergeMaxValue = getInt("experience-merge-max-value", -1); log("Experience Merge Max Value: " + expMergeMaxValue); } @@ -21,10 +21,10 @@ index d2582d981f859b55ba5086540963c01ed49e4c15..92e6891502ef6dc276ed5b371124f24d + } } diff --git a/src/main/java/net/minecraft/server/EntitySquid.java b/src/main/java/net/minecraft/server/EntitySquid.java -index 8c4f3b2c2e6e4e354562e32931b3fbf3d705a278..1c1ff2069d6daaf866a3e80a9b3ce78b19941384 100644 +index 915a2736447b651ac892254ed6429bad5a56954e..9c9ec8226ab43beaae0ef4abc97632b503e2120c 100644 --- a/src/main/java/net/minecraft/server/EntitySquid.java +++ b/src/main/java/net/minecraft/server/EntitySquid.java -@@ -171,7 +171,8 @@ public class EntitySquid extends EntityWaterAnimal { +@@ -169,7 +169,8 @@ public class EntitySquid extends EntityWaterAnimal { } public static boolean b(EntityTypes entitytypes, GeneratorAccess generatoraccess, EnumMobSpawn enummobspawn, BlockPosition blockposition, Random random) { diff --git a/Spigot-Server-Patches/0187-PreCreatureSpawnEvent.patch b/Spigot-Server-Patches/0187-PreCreatureSpawnEvent.patch new file mode 100644 index 000000000..c4bc9d018 --- /dev/null +++ b/Spigot-Server-Patches/0187-PreCreatureSpawnEvent.patch @@ -0,0 +1,92 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Sun, 14 Jan 2018 17:01:31 -0500 +Subject: [PATCH] PreCreatureSpawnEvent + +Adds an event to fire before an Entity is created, so that plugins that need to cancel +CreatureSpawnEvent can do so from this event instead. + +Cancelling CreatureSpawnEvent rapidly causes a lot of garbage collection and CPU waste +as it's done after the Entity object has been fully created. + +Mob Limiting plugins and blanket "ban this type of monster" plugins should use this event +instead and save a lot of server resources. + +See: https://github.com/PaperMC/Paper/issues/917 + +diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +index efd4d2844c4ad638837a1fd971927758908e7db1..45cd44335427a818a580158d57025289f37079bf 100644 +--- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java ++++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +@@ -105,6 +105,27 @@ public abstract class MobSpawnerAbstract { + double d5 = j >= 3 ? nbttaglist.h(2) : (double) blockposition.getZ() + (world.random.nextDouble() - world.random.nextDouble()) * (double) this.spawnRange + 0.5D; + + if (world.b(((EntityTypes) optional.get()).a(d3, d4, d5)) && EntityPositionTypes.a((EntityTypes) optional.get(), world.getMinecraftWorld(), EnumMobSpawn.SPAWNER, new BlockPosition(d3, d4, d5), world.getRandom())) { ++ // Paper start ++ EntityTypes entityType = optional.get(); ++ String key = EntityTypes.getName(entityType).getKey(); ++ ++ org.bukkit.entity.EntityType type = org.bukkit.entity.EntityType.fromName(key); ++ if (type != null) { ++ com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event; ++ event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent( ++ MCUtil.toLocation(world, d3, d4, d5), ++ type, ++ org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER ++ ); ++ if (!event.callEvent()) { ++ flag = true; ++ if (event.shouldAbortSpawn()) { ++ break; ++ } ++ continue; ++ } ++ } ++ // Paper end + Entity entity = EntityTypes.a(nbttagcompound, world, (entity1) -> { + entity1.setPositionRotation(d3, d4, d5, entity1.yaw, entity1.pitch); + return entity1; +diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java +index e08de74543535072e63ecfc9bd3ada95c9dbfeb7..137fa3e51390e95f5939f2251e0d170accbfb469 100644 +--- a/src/main/java/net/minecraft/server/SpawnerCreature.java ++++ b/src/main/java/net/minecraft/server/SpawnerCreature.java +@@ -185,7 +185,12 @@ public final class SpawnerCreature { + j1 = biomebase_biomemeta.d + worldserver.random.nextInt(1 + biomebase_biomemeta.e - biomebase_biomemeta.d); + } + +- if (a(worldserver, enumcreaturetype, structuremanager, chunkgenerator, biomebase_biomemeta, blockposition_mutableblockposition, d2) && spawnercreature_c.test(biomebase_biomemeta.c, blockposition_mutableblockposition, ichunkaccess)) { ++ // Paper start ++ Boolean doSpawning = a(worldserver, enumcreaturetype, structuremanager, chunkgenerator, biomebase_biomemeta, blockposition_mutableblockposition, d2); ++ if (doSpawning == null) { ++ return; ++ } ++ if (doSpawning.booleanValue() && spawnercreature_c.test(biomebase_biomemeta.c, blockposition_mutableblockposition, ichunkaccess)) { // Paper end + EntityInsentient entityinsentient = a(worldserver, biomebase_biomemeta.c); + + if (entityinsentient == null) { +@@ -239,8 +244,24 @@ public final class SpawnerCreature { + } + } + +- private static boolean a(WorldServer worldserver, EnumCreatureType enumcreaturetype, StructureManager structuremanager, ChunkGenerator chunkgenerator, BiomeBase.BiomeMeta biomebase_biomemeta, BlockPosition.MutableBlockPosition blockposition_mutableblockposition, double d0) { ++ private static Boolean a(WorldServer worldserver, EnumCreatureType enumcreaturetype, StructureManager structuremanager, ChunkGenerator chunkgenerator, BiomeBase.BiomeMeta biomebase_biomemeta, BlockPosition.MutableBlockPosition blockposition_mutableblockposition, double d0) { // Paper + EntityTypes entitytypes = biomebase_biomemeta.c; ++ // Paper start ++ com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event; ++ org.bukkit.entity.EntityType type = org.bukkit.entity.EntityType.fromName(EntityTypes.getName(entitytypes).getKey()); ++ if (type != null) { ++ event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent( ++ MCUtil.toLocation(worldserver, blockposition_mutableblockposition), ++ type, SpawnReason.NATURAL ++ ); ++ if (!event.callEvent()) { ++ if (event.shouldAbortSpawn()) { ++ return null; ++ } ++ return false; // TODO is this handled correctly? ++ } ++ } ++ // Paper end + + if (entitytypes.e() == EnumCreatureType.MISC) { + return false; diff --git a/Spigot-Server-Patches/0190-PlayerNaturallySpawnCreaturesEvent.patch b/Spigot-Server-Patches/0188-PlayerNaturallySpawnCreaturesEvent.patch similarity index 82% rename from Spigot-Server-Patches/0190-PlayerNaturallySpawnCreaturesEvent.patch rename to Spigot-Server-Patches/0188-PlayerNaturallySpawnCreaturesEvent.patch index c21361276..e44d3c86f 100644 --- a/Spigot-Server-Patches/0190-PlayerNaturallySpawnCreaturesEvent.patch +++ b/Spigot-Server-Patches/0188-PlayerNaturallySpawnCreaturesEvent.patch @@ -9,27 +9,27 @@ from triggering monster spawns on a server. Also a highly more effecient way to blanket block spawns in a world diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 7464aeb4e2f2cbe177cfd2ac19c45aabac625632..261eff5bdb4f4dfae2f66eecad79b21fef69ea8f 100644 +index 7abd3683f9cc21b90dc74739954de2decddf6478..6921def2dc8dd7f2b8ba9d46ab697a9f9b62cf4e 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -599,6 +599,15 @@ public class ChunkProviderServer extends IChunkProvider { - - this.world.timings.countNaturalMobs.stopTiming(); // Paper - timings +@@ -589,6 +589,15 @@ public class ChunkProviderServer extends IChunkProvider { this.world.getMethodProfiler().exit(); + //List list = Lists.newArrayList(this.playerChunkMap.f()); // Paper + //Collections.shuffle(list); // Paper + //Paper start - call player naturally spawn event + int chunkRange = world.spigotConfig.mobSpawnRange; + chunkRange = (chunkRange > world.spigotConfig.viewDistance) ? (byte) world.spigotConfig.viewDistance : chunkRange; + chunkRange = Math.min(chunkRange, 8); -+ for (EntityPlayer entityPlayer : this.world.players) { ++ for (EntityPlayer entityPlayer : this.world.getPlayers()) { + entityPlayer.playerNaturallySpawnedEvent = new com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent(entityPlayer.getBukkitEntity(), (byte) chunkRange); + entityPlayer.playerNaturallySpawnedEvent.callEvent(); + }; + // Paper end - this.playerChunkMap.f().forEach((playerchunk) -> { - Optional optional = ((Either) playerchunk.b().getNow(PlayerChunk.UNLOADED_CHUNK)).left(); + this.playerChunkMap.f().forEach((playerchunk) -> { // Paper - no... just no... + Optional optional = ((Either) playerchunk.a().getNow(PlayerChunk.UNLOADED_CHUNK)).left(); diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index bf32997c422d478699c32ce0539a65c35fbf0d12..88692d9eaea57a4d172d537a6cf2a3bffe058d54 100644 +index 7d6b1893ae6b7a3e937f8f83fc222709c8120814..d2c61467b8373444609a6aad9688c5b747547d9c 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -1,5 +1,6 @@ @@ -39,7 +39,7 @@ index bf32997c422d478699c32ce0539a65c35fbf0d12..88692d9eaea57a4d172d537a6cf2a3bf import com.google.common.collect.Lists; import com.mojang.authlib.GameProfile; import com.mojang.datafixers.util.Either; -@@ -89,6 +90,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -93,6 +94,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public boolean sentListPacket = false; public Integer clientViewDistance; // CraftBukkit end @@ -48,10 +48,10 @@ index bf32997c422d478699c32ce0539a65c35fbf0d12..88692d9eaea57a4d172d537a6cf2a3bf public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet cachedSingleHashSet; // Paper diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 0edba596754c6d5379c3c1eb0469aee447b7113f..7804cc0f6a02d14f4adbe05b37e8470a382c0d26 100644 +index 465beba397f05a31dcda9840375a0e9b97153e78..4ae3e91677ecf9c2104a229b4e8b229d18b87aa4 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -882,12 +882,23 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -912,12 +912,23 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { chunkRange = (chunkRange > world.spigotConfig.viewDistance) ? (byte) world.spigotConfig.viewDistance : chunkRange; chunkRange = (chunkRange > 8) ? 8 : chunkRange; diff --git a/Spigot-Server-Patches/0191-Add-setPlayerProfile-API-for-Skulls.patch b/Spigot-Server-Patches/0189-Add-setPlayerProfile-API-for-Skulls.patch similarity index 97% rename from Spigot-Server-Patches/0191-Add-setPlayerProfile-API-for-Skulls.patch rename to Spigot-Server-Patches/0189-Add-setPlayerProfile-API-for-Skulls.patch index b2286d915..02559230e 100644 --- a/Spigot-Server-Patches/0191-Add-setPlayerProfile-API-for-Skulls.patch +++ b/Spigot-Server-Patches/0189-Add-setPlayerProfile-API-for-Skulls.patch @@ -48,7 +48,7 @@ index 20588598386a4f479e6a58b294149bed789c63ce..ecc32c2fb1e8e1ac03074102b982adb4 public BlockFace getRotation() { BlockData blockData = getBlockData(); diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java -index 35eda0a03cfec244103cfe4b998f9d2b9322fe69..109edb76618025651d05689d9db52248220550ca 100644 +index c31011ff91f4ea8368e3afbc5ec07eff84e93fe2..21e7a661739da84e6ec7a20c81cefcb0440484a2 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java @@ -3,6 +3,8 @@ package org.bukkit.craftbukkit.inventory; diff --git a/Spigot-Server-Patches/0189-PreCreatureSpawnEvent.patch b/Spigot-Server-Patches/0189-PreCreatureSpawnEvent.patch deleted file mode 100644 index db46076d7..000000000 --- a/Spigot-Server-Patches/0189-PreCreatureSpawnEvent.patch +++ /dev/null @@ -1,87 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sun, 14 Jan 2018 17:01:31 -0500 -Subject: [PATCH] PreCreatureSpawnEvent - -Adds an event to fire before an Entity is created, so that plugins that need to cancel -CreatureSpawnEvent can do so from this event instead. - -Cancelling CreatureSpawnEvent rapidly causes a lot of garbage collection and CPU waste -as it's done after the Entity object has been fully created. - -Mob Limiting plugins and blanket "ban this type of monster" plugins should use this event -instead and save a lot of server resources. - -See: https://github.com/PaperMC/Paper/issues/917 - -diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -index c38295a09d99221cb196f9785ce674fe11120825..43c491f71b7739c782b46ee77ff8debe44213f11 100644 ---- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -@@ -105,6 +105,27 @@ public abstract class MobSpawnerAbstract { - double d5 = j >= 3 ? nbttaglist.h(2) : (double) blockposition.getZ() + (world.random.nextDouble() - world.random.nextDouble()) * (double) this.spawnRange + 0.5D; - - if (world.a(((EntityTypes) optional.get()).a(d3, d4, d5)) && EntityPositionTypes.a((EntityTypes) optional.get(), world.getMinecraftWorld(), EnumMobSpawn.SPAWNER, new BlockPosition(d3, d4, d5), world.getRandom())) { -+ // Paper start -+ EntityTypes entityType = optional.get(); -+ String key = EntityTypes.getName(entityType).getKey(); -+ -+ org.bukkit.entity.EntityType type = org.bukkit.entity.EntityType.fromName(key); -+ if (type != null) { -+ com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event; -+ event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent( -+ MCUtil.toLocation(world, d3, d4, d5), -+ type, -+ org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER -+ ); -+ if (!event.callEvent()) { -+ flag = true; -+ if (event.shouldAbortSpawn()) { -+ break; -+ } -+ continue; -+ } -+ } -+ // Paper end - Entity entity = EntityTypes.a(nbttagcompound, world, (entity1) -> { - entity1.setPositionRotation(d3, d4, d5, entity1.yaw, entity1.pitch); - return entity1; -diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java -index 02157d051f3ecfc05f23ae8631cf01b6133ad159..224443e03c9e55af2744eebd7e754e2a1b3fa296 100644 ---- a/src/main/java/net/minecraft/server/SpawnerCreature.java -+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java -@@ -38,7 +38,7 @@ public final class SpawnerCreature { - BiomeBase.BiomeMeta biomebase_biomemeta = null; - GroupDataEntity groupdataentity = null; - int l1 = MathHelper.f(Math.random() * 4.0D); -- int i2 = 0; -+ int i2 = 0; // Paper - force diff on name change - int j2 = 0; - - while (true) { -@@ -77,6 +77,25 @@ public final class SpawnerCreature { - if (a(entitypositiontypes_surface, (IWorldReader) worldserver, (BlockPosition) blockposition_mutableblockposition, entitytypes) && EntityPositionTypes.a(entitytypes, worldserver, EnumMobSpawn.NATURAL, blockposition_mutableblockposition, worldserver.random) && worldserver.a(entitytypes.a((double) f, (double) k, (double) f1))) { - EntityInsentient entityinsentient; - -+ // Paper start -+ com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event; -+ EntityTypes cls = biomebase_biomemeta.b; -+ org.bukkit.entity.EntityType type = org.bukkit.entity.EntityType.fromName(EntityTypes.getName(cls).getKey()); -+ if (type != null) { -+ event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent( -+ MCUtil.toLocation(worldserver, blockposition_mutableblockposition), -+ type, SpawnReason.NATURAL -+ ); -+ if (!event.callEvent()) { -+ if (event.shouldAbortSpawn()) { -+ return; -+ } -+ ++i2; -+ continue; -+ } -+ } -+ // Paper end -+ - try { - Entity entity = entitytypes.a((World) worldserver); - diff --git a/Spigot-Server-Patches/0192-Fill-Profile-Property-Events.patch b/Spigot-Server-Patches/0190-Fill-Profile-Property-Events.patch similarity index 90% rename from Spigot-Server-Patches/0192-Fill-Profile-Property-Events.patch rename to Spigot-Server-Patches/0190-Fill-Profile-Property-Events.patch index b70eaeb17..30643d081 100644 --- a/Spigot-Server-Patches/0192-Fill-Profile-Property-Events.patch +++ b/Spigot-Server-Patches/0190-Fill-Profile-Property-Events.patch @@ -11,18 +11,19 @@ If Mojang API does need to be hit, event fire so you can get the results. This is useful for implementing a ProfileCache for Player Skulls diff --git a/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java b/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java -index 4b2a67423f57b70d316115e4525e3841a415b1cc..61cfdf73c8a5b0dcf2f9903ebbb2f4132ba1f0dd 100644 +index 93d73c27340645c7502acafdc0b2cfbc1a759dd8..5c7d2ee19243d0911a3a00af3ae42078a2ccba94 100644 --- a/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java +++ b/src/main/java/com/destroystokyo/paper/profile/PaperMinecraftSessionService.java -@@ -1,5 +1,7 @@ +@@ -1,6 +1,8 @@ package com.destroystokyo.paper.profile; + import com.mojang.authlib.Environment; +import com.destroystokyo.paper.event.profile.FillProfileEvent; +import com.destroystokyo.paper.event.profile.PreFillProfileEvent; import com.mojang.authlib.GameProfile; import com.mojang.authlib.minecraft.MinecraftProfileTexture; import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; -@@ -19,7 +21,15 @@ public class PaperMinecraftSessionService extends YggdrasilMinecraftSessionServi +@@ -20,7 +22,15 @@ public class PaperMinecraftSessionService extends YggdrasilMinecraftSessionServi @Override public GameProfile fillProfileProperties(GameProfile profile, boolean requireSecure) { diff --git a/Spigot-Server-Patches/0193-PlayerAdvancementCriterionGrantEvent.patch b/Spigot-Server-Patches/0191-PlayerAdvancementCriterionGrantEvent.patch similarity index 83% rename from Spigot-Server-Patches/0193-PlayerAdvancementCriterionGrantEvent.patch rename to Spigot-Server-Patches/0191-PlayerAdvancementCriterionGrantEvent.patch index c1c57794e..28973e775 100644 --- a/Spigot-Server-Patches/0193-PlayerAdvancementCriterionGrantEvent.patch +++ b/Spigot-Server-Patches/0191-PlayerAdvancementCriterionGrantEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] PlayerAdvancementCriterionGrantEvent diff --git a/src/main/java/net/minecraft/server/AdvancementDataPlayer.java b/src/main/java/net/minecraft/server/AdvancementDataPlayer.java -index ca661f3933dad81150654551de4679fe2baeb138..c41e1384724ab150f43dc43fe2a453c9b1262e48 100644 +index 12fc641299342a317177cf0ab876186fb8a2b760..57b9d13447a4f7804827c1bd41121c3069c696bd 100644 --- a/src/main/java/net/minecraft/server/AdvancementDataPlayer.java +++ b/src/main/java/net/minecraft/server/AdvancementDataPlayer.java -@@ -276,6 +276,12 @@ public class AdvancementDataPlayer { +@@ -279,6 +279,12 @@ public class AdvancementDataPlayer { boolean flag1 = advancementprogress.isDone(); if (advancementprogress.a(s)) { @@ -19,5 +19,5 @@ index ca661f3933dad81150654551de4679fe2baeb138..c41e1384724ab150f43dc43fe2a453c9 + } + // Paper end this.d(advancement); - this.i.add(advancement); + this.j.add(advancement); flag = true; diff --git a/Spigot-Server-Patches/0194-Add-ArmorStand-Item-Meta.patch b/Spigot-Server-Patches/0192-Add-ArmorStand-Item-Meta.patch similarity index 85% rename from Spigot-Server-Patches/0194-Add-ArmorStand-Item-Meta.patch rename to Spigot-Server-Patches/0192-Add-ArmorStand-Item-Meta.patch index bd6648dd4..d5e982e37 100644 --- a/Spigot-Server-Patches/0194-Add-ArmorStand-Item-Meta.patch +++ b/Spigot-Server-Patches/0192-Add-ArmorStand-Item-Meta.patch @@ -13,10 +13,10 @@ starting point for future additions in this area. Fixes GH-559 diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmorStand.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmorStand.java -index f700522840ee0dfd90871b1b0c8973d7d62a9353..3723faccac00afe19e59d71008ba1604fc9d8630 100644 +index 1a3549480be056368bd6c9d1a98335b3bb07d1d5..25b310ad3f1bcefd04406b7efd1ffa82519250e1 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmorStand.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmorStand.java -@@ -8,13 +8,39 @@ import org.bukkit.Material; +@@ -8,9 +8,22 @@ import org.bukkit.Material; import org.bukkit.configuration.serialization.DelegateDeserialization; @DelegateDeserialization(CraftMetaItem.SerializableMeta.class) @@ -40,24 +40,21 @@ index f700522840ee0dfd90871b1b0c8973d7d62a9353..3723faccac00afe19e59d71008ba1604 NBTTagCompound entityTag; CraftMetaArmorStand(CraftMetaItem meta) { - super(meta); -+ +@@ -21,6 +34,13 @@ public class CraftMetaArmorStand extends CraftMetaItem { + } + + CraftMetaArmorStand armorStand = (CraftMetaArmorStand) meta; + // Paper start -+ if (!(meta instanceof CraftMetaArmorStand)) { -+ return; -+ } -+ -+ CraftMetaArmorStand standMeta = (CraftMetaArmorStand) meta; -+ this.invisible = standMeta.invisible; -+ this.noBasePlate = standMeta.noBasePlate; -+ this.showArms = standMeta.showArms; -+ this.small = standMeta.small; -+ this.marker = standMeta.marker; ++ this.invisible = armorStand.invisible; ++ this.noBasePlate = armorStand.noBasePlate; ++ this.showArms = armorStand.showArms; ++ this.small = armorStand.small; ++ this.marker = armorStand.marker; + // Paper end + this.entityTag = armorStand.entityTag; } - CraftMetaArmorStand(NBTTagCompound tag) { -@@ -22,11 +48,47 @@ public class CraftMetaArmorStand extends CraftMetaItem { +@@ -29,11 +49,47 @@ public class CraftMetaArmorStand extends CraftMetaItem { if (tag.hasKey(ENTITY_TAG.NBT)) { entityTag = tag.getCompound(ENTITY_TAG.NBT); @@ -105,7 +102,7 @@ index f700522840ee0dfd90871b1b0c8973d7d62a9353..3723faccac00afe19e59d71008ba1604 } @Override -@@ -49,6 +111,32 @@ public class CraftMetaArmorStand extends CraftMetaItem { +@@ -56,6 +112,32 @@ public class CraftMetaArmorStand extends CraftMetaItem { void applyToItem(NBTTagCompound tag) { super.applyToItem(tag); @@ -138,7 +135,7 @@ index f700522840ee0dfd90871b1b0c8973d7d62a9353..3723faccac00afe19e59d71008ba1604 if (entityTag != null) { tag.set(ENTITY_TAG.NBT, entityTag); } -@@ -70,7 +158,7 @@ public class CraftMetaArmorStand extends CraftMetaItem { +@@ -77,7 +159,7 @@ public class CraftMetaArmorStand extends CraftMetaItem { } boolean isArmorStandEmpty() { @@ -147,7 +144,7 @@ index f700522840ee0dfd90871b1b0c8973d7d62a9353..3723faccac00afe19e59d71008ba1604 } @Override -@@ -81,7 +169,13 @@ public class CraftMetaArmorStand extends CraftMetaItem { +@@ -88,7 +170,13 @@ public class CraftMetaArmorStand extends CraftMetaItem { if (meta instanceof CraftMetaArmorStand) { CraftMetaArmorStand that = (CraftMetaArmorStand) meta; @@ -162,7 +159,7 @@ index f700522840ee0dfd90871b1b0c8973d7d62a9353..3723faccac00afe19e59d71008ba1604 } return true; } -@@ -96,9 +190,14 @@ public class CraftMetaArmorStand extends CraftMetaItem { +@@ -103,9 +191,14 @@ public class CraftMetaArmorStand extends CraftMetaItem { final int original; int hash = original = super.applyHash(); @@ -180,7 +177,7 @@ index f700522840ee0dfd90871b1b0c8973d7d62a9353..3723faccac00afe19e59d71008ba1604 return original != hash ? CraftMetaArmorStand.class.hashCode() ^ hash : hash; } -@@ -107,6 +206,28 @@ public class CraftMetaArmorStand extends CraftMetaItem { +@@ -114,6 +207,28 @@ public class CraftMetaArmorStand extends CraftMetaItem { Builder serialize(Builder builder) { super.serialize(builder); @@ -209,7 +206,7 @@ index f700522840ee0dfd90871b1b0c8973d7d62a9353..3723faccac00afe19e59d71008ba1604 return builder; } -@@ -120,4 +241,56 @@ public class CraftMetaArmorStand extends CraftMetaItem { +@@ -127,4 +242,56 @@ public class CraftMetaArmorStand extends CraftMetaItem { return clone; } @@ -267,28 +264,26 @@ index f700522840ee0dfd90871b1b0c8973d7d62a9353..3723faccac00afe19e59d71008ba1604 + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index b9435bbd51764f75b8d24171513f3dddc48906f8..b87d2581754fde163a7b5532b9d5e21b48d3e243 100644 +index be39fbc1433e03e2f0e562095fea590691d7a062..c0858aeac0c9709a79590a0ca8db32d64efe7523 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -@@ -1428,7 +1428,15 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { - CraftMetaTropicalFishBucket.VARIANT.NBT, +@@ -1430,6 +1430,14 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { CraftMetaCrossbow.CHARGED.NBT, CraftMetaCrossbow.CHARGED_PROJECTILES.NBT, -- CraftMetaSuspiciousStew.EFFECTS.NBT -+ CraftMetaSuspiciousStew.EFFECTS.NBT, + CraftMetaSuspiciousStew.EFFECTS.NBT, + // Paper start + CraftMetaArmorStand.ENTITY_TAG.NBT, + CraftMetaArmorStand.INVISIBLE.NBT, + CraftMetaArmorStand.NO_BASE_PLATE.NBT, + CraftMetaArmorStand.SHOW_ARMS.NBT, + CraftMetaArmorStand.SMALL.NBT, -+ CraftMetaArmorStand.MARKER.NBT ++ CraftMetaArmorStand.MARKER.NBT, + // Paper end - )); - } - return HANDLED_TAGS; + CraftMetaCompass.LODESTONE_DIMENSION.NBT, + CraftMetaCompass.LODESTONE_POS.NBT, + CraftMetaCompass.LODESTONE_TRACKED.NBT diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java -index e4305ce522e1cec438baae50487d2a737c75051a..ba4cc98f1ec39ccfd433aeadf4b5c7018a1d40cc 100644 +index a33cb37f934f74865c49dd3fd483cf4ca5de85cf..ddbcbd565d5dcb5b1c8d46558e06887e85d589c5 100644 --- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java +++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java @@ -6,6 +6,7 @@ import java.util.ArrayList; diff --git a/Spigot-Server-Patches/0195-Extend-Player-Interact-cancellation.patch b/Spigot-Server-Patches/0193-Extend-Player-Interact-cancellation.patch similarity index 73% rename from Spigot-Server-Patches/0195-Extend-Player-Interact-cancellation.patch rename to Spigot-Server-Patches/0193-Extend-Player-Interact-cancellation.patch index 74811bc0f..7ddec9164 100644 --- a/Spigot-Server-Patches/0195-Extend-Player-Interact-cancellation.patch +++ b/Spigot-Server-Patches/0193-Extend-Player-Interact-cancellation.patch @@ -13,10 +13,10 @@ Update adjacent blocks of doors, double plants, pistons and beds when cancelling interaction. diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java -index dff3eb118856bb4b79e4378b5c39100d65a09767..e2e5c17c24c8f5e9807ca879b1025d13cb195226 100644 +index ee59d76d31b8b8cfd39d612b1e6040891f2256f4..36cf4c332054a350ae193637f895a45a8b04da9b 100644 --- a/src/main/java/net/minecraft/server/PlayerInteractManager.java +++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java -@@ -137,6 +137,11 @@ public class PlayerInteractManager { +@@ -148,6 +148,11 @@ public class PlayerInteractManager { PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, blockposition, enumdirection, this.player.inventory.getItemInHand(), EnumHand.MAIN_HAND); if (event.isCancelled()) { // Let the client know the block still exists @@ -28,15 +28,22 @@ index dff3eb118856bb4b79e4378b5c39100d65a09767..e2e5c17c24c8f5e9807ca879b1025d13 this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(this.world, blockposition)); // Update any tile entity data for this block TileEntity tileentity = this.world.getTileEntity(blockposition); -@@ -449,7 +454,25 @@ public class PlayerInteractManager { - ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutBlockChange(world, bottom ? blockposition.up() : blockposition.down())); +@@ -446,13 +451,32 @@ public class PlayerInteractManager { + interactResult = event.useItemInHand() == Event.Result.DENY; + + if (event.useInteractedBlock() == Event.Result.DENY) { ++ + // If we denied a door from opening, we need to send a correcting update to the client, as it already opened the door. + if (iblockdata.getBlock() instanceof BlockDoor) { + boolean bottom = iblockdata.get(BlockDoor.HALF) == BlockPropertyDoubleBlockHalf.LOWER; + entityplayer.playerConnection.sendPacket(new PacketPlayOutBlockChange(world, bottom ? blockposition.up() : blockposition.down())); } else if (iblockdata.getBlock() instanceof BlockCake) { - ((EntityPlayer) entityhuman).getBukkitEntity().sendHealthUpdate(); // SPIGOT-1341 - reset health for cake + entityplayer.getBukkitEntity().sendHealthUpdate(); // SPIGOT-1341 - reset health for cake + // Paper start - extend Player Interact cancellation // TODO: consider merging this into the extracted method + } else if (iblockdata.getBlock() instanceof BlockStructure) { -+ ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutCloseWindow()); ++ entityplayer.playerConnection.sendPacket(new PacketPlayOutCloseWindow()); + } else if (iblockdata.getBlock() instanceof BlockCommand) { -+ ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutCloseWindow()); ++ entityplayer.playerConnection.sendPacket(new PacketPlayOutCloseWindow()); + } else if (iblockdata.getBlock() instanceof BlockFlowerPot) { + // Send a block change to air and then send back the correct block, just to make the client happy + PacketPlayOutBlockChange packet = new PacketPlayOutBlockChange(this.world, blockposition); @@ -51,6 +58,6 @@ index dff3eb118856bb4b79e4378b5c39100d65a09767..e2e5c17c24c8f5e9807ca879b1025d13 + } } + // Paper end - extend Player Interact cancellation - ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); // SPIGOT-2867 + entityplayer.getBukkitEntity().updateInventory(); // SPIGOT-2867 enuminteractionresult = (event.useItemInHand() != Event.Result.ALLOW) ? EnumInteractionResult.SUCCESS : EnumInteractionResult.PASS; } else if (this.gamemode == EnumGamemode.SPECTATOR) { diff --git a/Spigot-Server-Patches/0196-Tameable-getOwnerUniqueId-API.patch b/Spigot-Server-Patches/0194-Tameable-getOwnerUniqueId-API.patch similarity index 88% rename from Spigot-Server-Patches/0196-Tameable-getOwnerUniqueId-API.patch rename to Spigot-Server-Patches/0194-Tameable-getOwnerUniqueId-API.patch index d27adf73e..2951cd45d 100644 --- a/Spigot-Server-Patches/0196-Tameable-getOwnerUniqueId-API.patch +++ b/Spigot-Server-Patches/0194-Tameable-getOwnerUniqueId-API.patch @@ -7,7 +7,7 @@ This is faster if all you need is the UUID, as .getOwner() will cause an OfflinePlayer to be loaded from disk. diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java -index 9952db3eb5ba94547f5e786c473fb59dfec616ab..1aea5f3f05794b444ca592cf518e29f76ccbd397 100644 +index 8c59b9ce12d4148b209c3824d44f6e9c736de16c..218a2190d1203ca0fbc2a5ad87e145f436aac314 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java @@ -90,6 +90,9 @@ public abstract class CraftAbstractHorse extends CraftAnimals implements Abstrac @@ -21,7 +21,7 @@ index 9952db3eb5ba94547f5e786c473fb59dfec616ab..1aea5f3f05794b444ca592cf518e29f7 return getHandle().getOwnerUUID(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java -index bff9854f3088649e6718ba8096abb170915f9d84..286d1194f2d46a8715a095ecaed276f657e5214b 100644 +index 58d9cd8172dcb8d3df93355d8ff51053b7469c45..6a642155cf387f7d0e2cf9bdf1a78c62aef8205b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTameableAnimal.java @@ -17,6 +17,9 @@ public class CraftTameableAnimal extends CraftAnimals implements Tameable, Creat diff --git a/Spigot-Server-Patches/0197-Toggleable-player-crits-helps-mitigate-hacked-client.patch b/Spigot-Server-Patches/0195-Toggleable-player-crits-helps-mitigate-hacked-client.patch similarity index 86% rename from Spigot-Server-Patches/0197-Toggleable-player-crits-helps-mitigate-hacked-client.patch rename to Spigot-Server-Patches/0195-Toggleable-player-crits-helps-mitigate-hacked-client.patch index d9c9f0df7..5e0ca8f08 100644 --- a/Spigot-Server-Patches/0197-Toggleable-player-crits-helps-mitigate-hacked-client.patch +++ b/Spigot-Server-Patches/0195-Toggleable-player-crits-helps-mitigate-hacked-client.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Toggleable player crits, helps mitigate hacked clients. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 92e6891502ef6dc276ed5b371124f24d5237b26b..77cdbfadf9c3eddb6a02460c321fa816d1bab8ac 100644 +index 48fa2483fc657b36b8f2fd7d8b35703cff2698a5..3804c7cf96087cdf94fd5fbdce4ebcdafa9e0019 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -187,6 +187,11 @@ public class PaperWorldConfig { @@ -21,10 +21,10 @@ index 92e6891502ef6dc276ed5b371124f24d5237b26b..77cdbfadf9c3eddb6a02460c321fa816 private void allChunksAreSlimeChunks() { allChunksAreSlimeChunks = getBoolean("all-chunks-are-slime-chunks", false); diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index 542f935b4e7a027b3df82f037fcd6523286c5106..55d08d77480fda81e0155aa1e0287fddc827b67a 100644 +index eaed020982bd19dab72872849170fa62d75699eb..5326e7433dc0a4ff0e1d0ca30aad95b1ec718d6a 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -1063,6 +1063,7 @@ public abstract class EntityHuman extends EntityLiving { +@@ -1042,6 +1042,7 @@ public abstract class EntityHuman extends EntityLiving { boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround && !this.isClimbing() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && entity instanceof EntityLiving; diff --git a/Spigot-Server-Patches/0198-Fix-NPE-when-getting-location-from-InventoryEnderChe.patch b/Spigot-Server-Patches/0196-Fix-NPE-when-getting-location-from-InventoryEnderChe.patch similarity index 92% rename from Spigot-Server-Patches/0198-Fix-NPE-when-getting-location-from-InventoryEnderChe.patch rename to Spigot-Server-Patches/0196-Fix-NPE-when-getting-location-from-InventoryEnderChe.patch index 87e6aa309..2745dde43 100644 --- a/Spigot-Server-Patches/0198-Fix-NPE-when-getting-location-from-InventoryEnderChe.patch +++ b/Spigot-Server-Patches/0196-Fix-NPE-when-getting-location-from-InventoryEnderChe.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Fix NPE when getting location from InventoryEnderChest opened diff --git a/src/main/java/net/minecraft/server/InventoryEnderChest.java b/src/main/java/net/minecraft/server/InventoryEnderChest.java -index 5a9ac3960de199b166ba481794529f8801cdebb7..fd31b9a6dcf6aba4041f9f08e49a9b464b956843 100644 +index ce74a5ff2905042e54615439b8e5369d6a921a27..bf8c5436b6cc9f661e7b607fa4696e7ae55b3a13 100644 --- a/src/main/java/net/minecraft/server/InventoryEnderChest.java +++ b/src/main/java/net/minecraft/server/InventoryEnderChest.java @@ -5,7 +5,7 @@ import org.bukkit.inventory.InventoryHolder; diff --git a/Spigot-Server-Patches/0197-Prevent-Frosted-Ice-from-loading-holding-chunks.patch b/Spigot-Server-Patches/0197-Prevent-Frosted-Ice-from-loading-holding-chunks.patch new file mode 100644 index 000000000..5dc72b261 --- /dev/null +++ b/Spigot-Server-Patches/0197-Prevent-Frosted-Ice-from-loading-holding-chunks.patch @@ -0,0 +1,31 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Sat, 10 Mar 2018 16:33:15 -0500 +Subject: [PATCH] Prevent Frosted Ice from loading/holding chunks + + +diff --git a/src/main/java/net/minecraft/server/BlockIceFrost.java b/src/main/java/net/minecraft/server/BlockIceFrost.java +index 061b157f66999a733c3c4e990371b6f8d7860de2..77f5f835c60c181a0a2d6fc782d756338bc2ccb0 100644 +--- a/src/main/java/net/minecraft/server/BlockIceFrost.java ++++ b/src/main/java/net/minecraft/server/BlockIceFrost.java +@@ -28,7 +28,8 @@ public class BlockIceFrost extends BlockIce { + EnumDirection enumdirection = aenumdirection[j]; + + blockposition_mutableblockposition.a((BaseBlockPosition) blockposition, enumdirection); +- IBlockData iblockdata1 = worldserver.getType(blockposition_mutableblockposition); ++ IBlockData iblockdata1 = worldserver.getTypeIfLoaded(blockposition_mutableblockposition); // Paper ++ if (iblockdata1 == null) { continue; } // Paper + + if (iblockdata1.a((Block) this) && !this.e(iblockdata1, (World) worldserver, blockposition_mutableblockposition)) { + worldserver.getBlockTickList().a(blockposition_mutableblockposition, this, MathHelper.nextInt(random, worldserver.paperConfig.frostedIceDelayMin, worldserver.paperConfig.frostedIceDelayMax)); // Paper - use configurable min/max delay +@@ -71,7 +72,9 @@ public class BlockIceFrost extends BlockIce { + EnumDirection enumdirection = aenumdirection[l]; + + blockposition_mutableblockposition.a((BaseBlockPosition) blockposition, enumdirection); +- if (iblockaccess.getType(blockposition_mutableblockposition).a((Block) this)) { ++ // Paper start ++ IBlockData type = iblockaccess.getTypeIfLoaded(blockposition_mutableblockposition); ++ if (type != null && type.a((Block) this)) { // Paper end + ++j; + if (j >= i) { + return false; diff --git a/Spigot-Server-Patches/0200-Disable-Explicit-Network-Manager-Flushing.patch b/Spigot-Server-Patches/0198-Disable-Explicit-Network-Manager-Flushing.patch similarity index 90% rename from Spigot-Server-Patches/0200-Disable-Explicit-Network-Manager-Flushing.patch rename to Spigot-Server-Patches/0198-Disable-Explicit-Network-Manager-Flushing.patch index dfe29e706..d7aad3619 100644 --- a/Spigot-Server-Patches/0200-Disable-Explicit-Network-Manager-Flushing.patch +++ b/Spigot-Server-Patches/0198-Disable-Explicit-Network-Manager-Flushing.patch @@ -12,7 +12,7 @@ flushing on the netty event loop, so it won't do the flush on the main thread. Renable flushing by passing -Dpaper.explicit-flush=true diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index e2d8ed88f05bf8cb214329ea27ac2b67f43e071a..08e314af7cbd6523bbd0bd5a5ad0a0fff2f080be 100644 +index 33900c22d4123e0f8333b9bdb9601d302e26c972..8cb29ddc0d5a5951ea35e1a16c023efb9b0be42d 100644 --- a/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java @@ -63,6 +63,7 @@ public class NetworkManager extends SimpleChannelInboundHandler> { @@ -23,7 +23,7 @@ index e2d8ed88f05bf8cb214329ea27ac2b67f43e071a..08e314af7cbd6523bbd0bd5a5ad0a0ff // Paper end public NetworkManager(EnumProtocolDirection enumprotocoldirection) { -@@ -231,7 +232,7 @@ public class NetworkManager extends SimpleChannelInboundHandler> { +@@ -230,7 +231,7 @@ public class NetworkManager extends SimpleChannelInboundHandler> { } if (this.channel != null) { diff --git a/Spigot-Server-Patches/0201-Implement-extended-PaperServerListPingEvent.patch b/Spigot-Server-Patches/0199-Implement-extended-PaperServerListPingEvent.patch similarity index 92% rename from Spigot-Server-Patches/0201-Implement-extended-PaperServerListPingEvent.patch rename to Spigot-Server-Patches/0199-Implement-extended-PaperServerListPingEvent.patch index 14a54576e..988ed183f 100644 --- a/Spigot-Server-Patches/0201-Implement-extended-PaperServerListPingEvent.patch +++ b/Spigot-Server-Patches/0199-Implement-extended-PaperServerListPingEvent.patch @@ -60,7 +60,7 @@ index 0000000000000000000000000000000000000000..a2a409e635dde08f7c53e67164b967a0 +} diff --git a/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java b/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java new file mode 100644 -index 0000000000000000000000000000000000000000..a85466bc7e0a8aa54b9eff14077fe6c992ae2902 +index 0000000000000000000000000000000000000000..26ddf92f86fccc2b2562f7abf4788d1ed6b73205 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java @@ -0,0 +1,112 @@ @@ -71,11 +71,11 @@ index 0000000000000000000000000000000000000000..a85466bc7e0a8aa54b9eff14077fe6c9 +import com.google.common.base.MoreObjects; +import com.google.common.base.Strings; +import com.mojang.authlib.GameProfile; -+import net.minecraft.server.ChatComponentText; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.NetworkManager; +import net.minecraft.server.PacketStatusOutServerInfo; +import net.minecraft.server.ServerPing; ++import org.bukkit.craftbukkit.util.CraftChatMessage; + +import java.util.List; +import java.util.UUID; @@ -155,7 +155,7 @@ index 0000000000000000000000000000000000000000..a85466bc7e0a8aa54b9eff14077fe6c9 + ServerPing ping = new ServerPing(); + + // Description -+ ping.setMOTD(new ChatComponentText(event.getMotd())); ++ ping.setMOTD(CraftChatMessage.fromString(event.getMotd(), true)[0]); + + // Players + if (!event.shouldHidePlayers()) { @@ -177,33 +177,33 @@ index 0000000000000000000000000000000000000000..a85466bc7e0a8aa54b9eff14077fe6c9 + +} diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 4a513aaea587414cf6abc1c136e52420d59688d8..d1667eba3398efecc8913c2778931030a90d6195 100644 +index 5a5fc0626562d46f1ea6ce3e779e75de55611548..1698b42ed56a2932c5c1d60c655c9fd4cf5bed66 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1,6 +1,9 @@ - package net.minecraft.server; +@@ -2,6 +2,9 @@ package net.minecraft.server; import com.google.common.base.Splitter; + import com.google.common.collect.ImmutableList; +import co.aikar.timings.Timings; +import com.destroystokyo.paper.event.server.PaperServerListPingEvent; +import com.google.common.base.Stopwatch; import com.google.common.collect.Lists; import com.google.common.collect.Maps; - import com.google.gson.JsonElement; -@@ -1095,7 +1098,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant= 5000000000L) { - this.Z = i; + import com.google.common.collect.Sets; +@@ -1120,7 +1123,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant= 5000000000L) { + this.T = i; this.serverPing.setPlayerSample(new ServerPing.ServerPingPlayerSample(this.getMaxPlayers(), this.getPlayerCount())); - GameProfile[] agameprofile = new GameProfile[Math.min(this.getPlayerCount(), 12)]; + GameProfile[] agameprofile = new GameProfile[Math.min(this.getPlayerCount(), org.spigotmc.SpigotConfig.playerSample)]; // Paper - int j = MathHelper.nextInt(this.q, 0, this.getPlayerCount() - agameprofile.length); + int j = MathHelper.nextInt(this.r, 0, this.getPlayerCount() - agameprofile.length); for (int k = 0; k < agameprofile.length; ++k) { diff --git a/src/main/java/net/minecraft/server/PacketStatusListener.java b/src/main/java/net/minecraft/server/PacketStatusListener.java -index 658ea609cb4927b29a3d5303006f2adf2847e06b..4bb21c48bd50353370ec3c3546a00a5d20e4b9d8 100644 +index 055555cb5ce63d41cb9a7f4114341b0685879b9e..9beb6fad228ccb3081b661c845836f4f29404d86 100644 --- a/src/main/java/net/minecraft/server/PacketStatusListener.java +++ b/src/main/java/net/minecraft/server/PacketStatusListener.java -@@ -37,6 +37,8 @@ public class PacketStatusListener implements PacketStatusInListener { +@@ -35,6 +35,8 @@ public class PacketStatusListener implements PacketStatusInListener { this.networkManager.close(PacketStatusListener.a); } else { this.d = true; @@ -212,7 +212,7 @@ index 658ea609cb4927b29a3d5303006f2adf2847e06b..4bb21c48bd50353370ec3c3546a00a5d // CraftBukkit start // this.networkManager.sendPacket(new PacketStatusOutServerInfo(this.minecraftServer.getServerPing())); final Object[] players = minecraftServer.getPlayerList().players.toArray(); -@@ -132,6 +134,9 @@ public class PacketStatusListener implements PacketStatusInListener { +@@ -130,6 +132,9 @@ public class PacketStatusListener implements PacketStatusInListener { ping.setServerInfo(new ServerPing.ServerData(minecraftServer.getServerModName() + " " + minecraftServer.getVersion(), version)); this.networkManager.sendPacket(new PacketStatusOutServerInfo(ping)); diff --git a/Spigot-Server-Patches/0199-Prevent-Frosted-Ice-from-loading-holding-chunks.patch b/Spigot-Server-Patches/0199-Prevent-Frosted-Ice-from-loading-holding-chunks.patch deleted file mode 100644 index bb2a2bba4..000000000 --- a/Spigot-Server-Patches/0199-Prevent-Frosted-Ice-from-loading-holding-chunks.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sat, 10 Mar 2018 16:33:15 -0500 -Subject: [PATCH] Prevent Frosted Ice from loading/holding chunks - - -diff --git a/src/main/java/net/minecraft/server/BlockIceFrost.java b/src/main/java/net/minecraft/server/BlockIceFrost.java -index 5e414138e4e542c16508d679e571aac72c082e7b..638a0aa5ae80da2df9e640060272b83c6fc986ae 100644 ---- a/src/main/java/net/minecraft/server/BlockIceFrost.java -+++ b/src/main/java/net/minecraft/server/BlockIceFrost.java -@@ -26,8 +26,8 @@ public class BlockIceFrost extends BlockIce { - EnumDirection enumdirection = aenumdirection[j]; - - blockposition_pooledblockposition.g(blockposition).c(enumdirection); -- IBlockData iblockdata1 = worldserver.getType(blockposition_pooledblockposition); -- -+ IBlockData iblockdata1 = worldserver.getTypeIfLoaded(blockposition_pooledblockposition); // Paper - don't load chunks -+ if (iblockdata1 == null) continue; // Paper - if (iblockdata1.getBlock() == this && !this.e(iblockdata1, (World) worldserver, blockposition_pooledblockposition)) { - worldserver.getBlockTickList().a(blockposition_pooledblockposition, this, MathHelper.nextInt(random, worldserver.paperConfig.frostedIceDelayMin, worldserver.paperConfig.frostedIceDelayMax)); // Paper - use configurable min/max delay - } -@@ -89,7 +89,7 @@ public class BlockIceFrost extends BlockIce { - EnumDirection enumdirection = aenumdirection[l]; - - blockposition_pooledblockposition.g(blockposition).c(enumdirection); -- if (iblockaccess.getType(blockposition_pooledblockposition).getBlock() == this) { -+ if (((World) iblockaccess).getBlockIfLoaded(blockposition_pooledblockposition) == this) { // Paper - don't load chunks - ++j; - if (j >= i) { - boolean flag = false; diff --git a/Spigot-Server-Patches/0202-Improved-Async-Task-Scheduler.patch b/Spigot-Server-Patches/0200-Improved-Async-Task-Scheduler.patch similarity index 97% rename from Spigot-Server-Patches/0202-Improved-Async-Task-Scheduler.patch rename to Spigot-Server-Patches/0200-Improved-Async-Task-Scheduler.patch index 00807953f..e01a0db40 100644 --- a/Spigot-Server-Patches/0202-Improved-Async-Task-Scheduler.patch +++ b/Spigot-Server-Patches/0200-Improved-Async-Task-Scheduler.patch @@ -159,7 +159,7 @@ index 0000000000000000000000000000000000000000..3c1992e212a6d6f1db4d5b807b38d719 + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java -index ff855035ae55df37d68b284ac18976c46d388af2..99ea0aabadfac2a68ec67a7d49831025820de2c3 100644 +index f7a977c342e564b3e24034c756c128068c143a65..7532bbd82559763cfaf5433a07914b5fb906122c 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java @@ -63,7 +63,7 @@ public class CraftScheduler implements BukkitScheduler { @@ -315,7 +315,7 @@ index ff855035ae55df37d68b284ac18976c46d388af2..99ea0aabadfac2a68ec67a7d49831025 this.currentTick = currentTick; final List temp = this.temp; parsePending(); -@@ -428,7 +486,7 @@ public class CraftScheduler implements BukkitScheduler { +@@ -431,7 +489,7 @@ public class CraftScheduler implements BukkitScheduler { parsePending(); } else { //debugTail = debugTail.setNext(new CraftAsyncDebugger(currentTick + RECENT_TICKS, task.getOwner(), task.getTaskClass())); // Paper @@ -324,7 +324,7 @@ index ff855035ae55df37d68b284ac18976c46d388af2..99ea0aabadfac2a68ec67a7d49831025 // 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) } -@@ -447,7 +505,7 @@ public class CraftScheduler implements BukkitScheduler { +@@ -450,7 +508,7 @@ public class CraftScheduler implements BukkitScheduler { //debugHead = debugHead.getNextHead(currentTick); // Paper } @@ -333,7 +333,7 @@ index ff855035ae55df37d68b284ac18976c46d388af2..99ea0aabadfac2a68ec67a7d49831025 final AtomicReference tail = this.tail; CraftTask tailTask = tail.get(); while (!tail.compareAndSet(tailTask, task)) { -@@ -456,7 +514,13 @@ public class CraftScheduler implements BukkitScheduler { +@@ -459,7 +517,13 @@ public class CraftScheduler implements BukkitScheduler { tailTask.setNext(task); } @@ -348,7 +348,7 @@ index ff855035ae55df37d68b284ac18976c46d388af2..99ea0aabadfac2a68ec67a7d49831025 task.setNextRun(currentTick + delay); addTask(task); return task; -@@ -475,8 +539,8 @@ public class CraftScheduler implements BukkitScheduler { +@@ -478,8 +542,8 @@ public class CraftScheduler implements BukkitScheduler { return ids.incrementAndGet(); } @@ -359,7 +359,7 @@ index ff855035ae55df37d68b284ac18976c46d388af2..99ea0aabadfac2a68ec67a7d49831025 CraftTask head = this.head; CraftTask task = head.getNext(); CraftTask lastTask = head; -@@ -495,7 +559,7 @@ public class CraftScheduler implements BukkitScheduler { +@@ -498,7 +562,7 @@ public class CraftScheduler implements BukkitScheduler { task.setNext(null); } this.head = lastTask; diff --git a/Spigot-Server-Patches/0203-Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch b/Spigot-Server-Patches/0201-Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch similarity index 89% rename from Spigot-Server-Patches/0203-Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch rename to Spigot-Server-Patches/0201-Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch index 9081b53c9..1e599aa25 100644 --- a/Spigot-Server-Patches/0203-Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch +++ b/Spigot-Server-Patches/0201-Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Ability to change PlayerProfile in AsyncPreLoginEvent This will allow you to change the players name or skin on login. diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java -index 1fb609dcfc61adfc63f0d32dc87a5e144a5013cf..1b43f921646e3c1bfdca22ef7d3719c72aaf4520 100644 +index 3cc12e7b75b8ed21a0ea44f8453553cf856fb786..80a21dbc05ed3007f2e827f7a320131244c3044b 100644 --- a/src/main/java/net/minecraft/server/LoginListener.java +++ b/src/main/java/net/minecraft/server/LoginListener.java @@ -1,5 +1,7 @@ @@ -16,8 +16,8 @@ index 1fb609dcfc61adfc63f0d32dc87a5e144a5013cf..1b43f921646e3c1bfdca22ef7d3719c7 +import com.destroystokyo.paper.profile.PlayerProfile; import com.mojang.authlib.GameProfile; import com.mojang.authlib.exceptions.AuthenticationUnavailableException; - import io.netty.channel.ChannelFuture; -@@ -19,6 +21,7 @@ import org.apache.logging.log4j.LogManager; + import java.math.BigInteger; +@@ -18,6 +20,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; // CraftBukkit start @@ -25,7 +25,7 @@ index 1fb609dcfc61adfc63f0d32dc87a5e144a5013cf..1b43f921646e3c1bfdca22ef7d3719c7 import org.bukkit.craftbukkit.util.Waitable; import org.bukkit.event.player.AsyncPlayerPreLoginEvent; import org.bukkit.event.player.PlayerPreLoginEvent; -@@ -287,8 +290,16 @@ public class LoginListener implements PacketLoginInListener { +@@ -286,8 +289,16 @@ public class LoginListener implements PacketLoginInListener { java.util.UUID uniqueId = i.getId(); final org.bukkit.craftbukkit.CraftServer server = LoginListener.this.server.server; diff --git a/Spigot-Server-Patches/0204-Player.setPlayerProfile-API.patch b/Spigot-Server-Patches/0202-Player.setPlayerProfile-API.patch similarity index 78% rename from Spigot-Server-Patches/0204-Player.setPlayerProfile-API.patch rename to Spigot-Server-Patches/0202-Player.setPlayerProfile-API.patch index 8f5e84114..f39292e3b 100644 --- a/Spigot-Server-Patches/0204-Player.setPlayerProfile-API.patch +++ b/Spigot-Server-Patches/0202-Player.setPlayerProfile-API.patch @@ -6,23 +6,23 @@ Subject: [PATCH] Player.setPlayerProfile API This can be useful for changing name or skins after a player has logged in. diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index 55d08d77480fda81e0155aa1e0287fddc827b67a..fda1b3d91b14080bf04a02c1340c63a6eb37911d 100644 +index 5326e7433dc0a4ff0e1d0ca30aad95b1ec718d6a..74950d74e6a11d5552369e830f9fdd63c4306221 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -66,7 +66,7 @@ public abstract class EntityHuman extends EntityLiving { - protected int bO; - protected final float bP = 0.02F; - private int bS; -- private final GameProfile bT; -+ private GameProfile bT; public final void setProfile(final GameProfile profile) { this.bT = profile; } // Paper - OBFHELPER - private ItemStack bV; - private final ItemCooldown bW; +@@ -65,7 +65,7 @@ public abstract class EntityHuman extends EntityLiving { + protected int bN; + protected final float bO = 0.02F; + private int g; +- private final GameProfile bQ; ++ private GameProfile bQ; public final void setProfile(final GameProfile profile) { this.bQ = profile; } // Paper - OBFHELPER + private ItemStack bS; + private final ItemCooldown bT; @Nullable diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java -index 1b43f921646e3c1bfdca22ef7d3719c72aaf4520..1c4ac7bf7ac4d864ba6efd46d8c562c238dad2bc 100644 +index 80a21dbc05ed3007f2e827f7a320131244c3044b..e0f0a1e91a037f93b239e779aa8fd92be8a8c01f 100644 --- a/src/main/java/net/minecraft/server/LoginListener.java +++ b/src/main/java/net/minecraft/server/LoginListener.java -@@ -37,7 +37,7 @@ public class LoginListener implements PacketLoginInListener { +@@ -36,7 +36,7 @@ public class LoginListener implements PacketLoginInListener { public final NetworkManager networkManager; private LoginListener.EnumProtocolState g; private int h; @@ -31,7 +31,7 @@ index 1b43f921646e3c1bfdca22ef7d3719c72aaf4520..1c4ac7bf7ac4d864ba6efd46d8c562c2 private final String j; private SecretKey loginKey; private EntityPlayer l; -@@ -291,12 +291,12 @@ public class LoginListener implements PacketLoginInListener { +@@ -290,12 +290,12 @@ public class LoginListener implements PacketLoginInListener { final org.bukkit.craftbukkit.CraftServer server = LoginListener.this.server.server; // Paper start @@ -48,7 +48,7 @@ index 1b43f921646e3c1bfdca22ef7d3719c72aaf4520..1c4ac7bf7ac4d864ba6efd46d8c562c2 uniqueId = i.getId(); // 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 5b088b21da2ca3945de9c5dcc4370114f930d739..d571248f597cbad63d26bc1bdf91cc263f88947f 100644 +index e2f707e461e2e13f240a30a94c9acf191828219b..13c19f2a779caa9ff27b135fdf4ad720e5c9cce7 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1,6 +1,8 @@ @@ -60,7 +60,15 @@ index 5b088b21da2ca3945de9c5dcc4370114f930d739..d571248f597cbad63d26bc1bdf91cc26 import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableSet; import com.google.common.io.BaseEncoding; -@@ -1175,8 +1177,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -41,6 +43,7 @@ import net.minecraft.server.EnumColor; + import net.minecraft.server.EnumGamemode; + import net.minecraft.server.GenericAttributes; + import net.minecraft.server.IChatBaseComponent; ++import net.minecraft.server.MCUtil; + import net.minecraft.server.MapIcon; + import net.minecraft.server.MinecraftKey; + import net.minecraft.server.NBTTagCompound; +@@ -1231,8 +1234,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { hiddenPlayers.put(player.getUniqueId(), hidingPlugins); // Remove this player from the hidden player's EntityTrackerEntry @@ -75,7 +83,7 @@ index 5b088b21da2ca3945de9c5dcc4370114f930d739..d571248f597cbad63d26bc1bdf91cc26 PlayerChunkMap.EntityTracker entry = tracker.trackedEntities.get(other.getId()); if (entry != null) { entry.clear(getHandle()); -@@ -1217,8 +1224,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1273,8 +1281,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } hiddenPlayers.remove(player.getUniqueId()); @@ -90,7 +98,7 @@ index 5b088b21da2ca3945de9c5dcc4370114f930d739..d571248f597cbad63d26bc1bdf91cc26 getHandle().playerConnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, other)); -@@ -1227,6 +1239,49 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1283,6 +1296,50 @@ public class CraftPlayer extends CraftHumanEntity implements Player { entry.updatePlayer(getHandle()); } } @@ -126,7 +134,8 @@ index 5b088b21da2ca3945de9c5dcc4370114f930d739..d571248f597cbad63d26bc1bdf91cc26 + reregisterPlayer(handle); + + //Respawn the player then update their position and selected slot -+ connection.sendPacket(new net.minecraft.server.PacketPlayOutRespawn(handle.dimension, net.minecraft.server.WorldData.c(handle.world.getWorldData().getSeed()), handle.world.getWorldData().getType(), handle.playerInteractManager.getGameMode())); ++ WorldServer worldserver = handle.getWorldServer(); ++ connection.sendPacket(new net.minecraft.server.PacketPlayOutRespawn(worldserver.getTypeKey(), worldserver.getDimensionKey(), net.minecraft.server.BiomeManager.a(worldserver.getSeed()), handle.playerInteractManager.getGameMode(), handle.playerInteractManager.c(), worldserver.isDebugWorld(), worldserver.isFlatWorld(), true)); + handle.updateAbilities(); + connection.sendPacket(new net.minecraft.server.PacketPlayOutPosition(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch(), new HashSet<>(), 0)); + net.minecraft.server.MinecraftServer.getServer().getPlayerList().updateClient(handle); diff --git a/Spigot-Server-Patches/0205-Fix-Dragon-Server-Crashes.patch b/Spigot-Server-Patches/0203-Fix-Dragon-Server-Crashes.patch similarity index 92% rename from Spigot-Server-Patches/0205-Fix-Dragon-Server-Crashes.patch rename to Spigot-Server-Patches/0203-Fix-Dragon-Server-Crashes.patch index 3de215fd6..018a36e91 100644 --- a/Spigot-Server-Patches/0205-Fix-Dragon-Server-Crashes.patch +++ b/Spigot-Server-Patches/0203-Fix-Dragon-Server-Crashes.patch @@ -7,7 +7,7 @@ If the dragon tries to find "ground" and hits a hole, or off edge, it will infinitely keep looking for non air and eventually crash. diff --git a/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java b/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java -index c42de9771e96f0b1bc8fbe9fe76572ab18d5d98c..40a8beff556873a5db108e44fd053e8de80e36a6 100644 +index d70a45f2530d9dd5e10aa48f20db33a97bbe952e..fbc2ec88f7c71c853c492301986a23dafc8fa7a6 100644 --- a/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java +++ b/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java @@ -54,7 +54,7 @@ public class DragonControllerLandedFlame extends AbstractDragonControllerLanded diff --git a/Spigot-Server-Patches/0206-getPlayerUniqueId-API.patch b/Spigot-Server-Patches/0204-getPlayerUniqueId-API.patch similarity index 91% rename from Spigot-Server-Patches/0206-getPlayerUniqueId-API.patch rename to Spigot-Server-Patches/0204-getPlayerUniqueId-API.patch index 1646869da..05932a190 100644 --- a/Spigot-Server-Patches/0206-getPlayerUniqueId-API.patch +++ b/Spigot-Server-Patches/0204-getPlayerUniqueId-API.patch @@ -9,10 +9,10 @@ In Offline Mode, will return an Offline UUID This is a more performant way to obtain a UUID for a name than loading an OfflinePlayer diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 3697b3298feaec30c305e3da011790f2406e12d7..0ec84609896dd53a0c2c232f45e5c8f83558a37c 100644 +index bfe812fdb3aca643634281a57c4f94509dbe70b1..79c4ed5aa074b00d7026311f22d5a9e44666ed62 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1403,6 +1403,26 @@ public final class CraftServer implements Server { +@@ -1485,6 +1485,26 @@ public final class CraftServer implements Server { return recipients.size(); } diff --git a/Spigot-Server-Patches/0207-Make-player-data-saving-configurable.patch b/Spigot-Server-Patches/0205-Make-player-data-saving-configurable.patch similarity index 79% rename from Spigot-Server-Patches/0207-Make-player-data-saving-configurable.patch rename to Spigot-Server-Patches/0205-Make-player-data-saving-configurable.patch index e096021cc..87ddc9131 100644 --- a/Spigot-Server-Patches/0207-Make-player-data-saving-configurable.patch +++ b/Spigot-Server-Patches/0205-Make-player-data-saving-configurable.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Make player data saving configurable diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 5884b04f7e84048a9710736bd14237140ebf2cf7..ba341e0174cdc3b5b8bc83b7430270181ea92793 100644 +index cee8740e644c492e3d71fd58791e7d52d57e856d..f22bed69f690f6e4754b87dd61cebe9c6627b12d 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -270,4 +270,13 @@ public class PaperConfig { +@@ -271,4 +271,13 @@ public class PaperConfig { private static void authenticationServersDownKickMessage() { authenticationServersDownKickMessage = Strings.emptyToNull(getString("messages.kick.authentication-servers-down", authenticationServersDownKickMessage)); } @@ -23,14 +23,14 @@ index 5884b04f7e84048a9710736bd14237140ebf2cf7..ba341e0174cdc3b5b8bc83b743027018 + } } diff --git a/src/main/java/net/minecraft/server/WorldNBTStorage.java b/src/main/java/net/minecraft/server/WorldNBTStorage.java -index a0254d8e519fa8b19dc282f3abf33b8ebe4f0aba..e60e10c57d5acaecb70e89c83c34f1f8870091c2 100644 +index ef9719bf20db92a7e6690bccb00cc54293d392a9..ae43d8d2af0daa68f13528d25bac1d94964662bc 100644 --- a/src/main/java/net/minecraft/server/WorldNBTStorage.java +++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java -@@ -138,6 +138,7 @@ public class WorldNBTStorage implements IPlayerFileData { +@@ -27,6 +27,7 @@ public class WorldNBTStorage { + } - @Override public void save(EntityHuman entityhuman) { + if(!com.destroystokyo.paper.PaperConfig.savePlayerData) return; // Paper - Make player data saving configurable try { NBTTagCompound nbttagcompound = entityhuman.save(new NBTTagCompound()); - File file = new File(this.playerDir, entityhuman.getUniqueIDString() + ".dat.tmp"); + File file = File.createTempFile(entityhuman.getUniqueIDString() + "-", ".dat", this.playerDir); diff --git a/Spigot-Server-Patches/0208-Make-legacy-ping-handler-more-reliable.patch b/Spigot-Server-Patches/0206-Make-legacy-ping-handler-more-reliable.patch similarity index 100% rename from Spigot-Server-Patches/0208-Make-legacy-ping-handler-more-reliable.patch rename to Spigot-Server-Patches/0206-Make-legacy-ping-handler-more-reliable.patch diff --git a/Spigot-Server-Patches/0209-Call-PaperServerListPingEvent-for-legacy-pings.patch b/Spigot-Server-Patches/0207-Call-PaperServerListPingEvent-for-legacy-pings.patch similarity index 100% rename from Spigot-Server-Patches/0209-Call-PaperServerListPingEvent-for-legacy-pings.patch rename to Spigot-Server-Patches/0207-Call-PaperServerListPingEvent-for-legacy-pings.patch diff --git a/Spigot-Server-Patches/0210-Flag-to-disable-the-channel-limit.patch b/Spigot-Server-Patches/0208-Flag-to-disable-the-channel-limit.patch similarity index 88% rename from Spigot-Server-Patches/0210-Flag-to-disable-the-channel-limit.patch rename to Spigot-Server-Patches/0208-Flag-to-disable-the-channel-limit.patch index 6422b74f2..84b589d04 100644 --- a/Spigot-Server-Patches/0210-Flag-to-disable-the-channel-limit.patch +++ b/Spigot-Server-Patches/0208-Flag-to-disable-the-channel-limit.patch @@ -9,10 +9,10 @@ e.g. servers which allow and support the usage of mod packs. provide an optional flag to disable this check, at your own risk. diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index d571248f597cbad63d26bc1bdf91cc263f88947f..f5c722644a1955c9bc68c89fdbb84526f9bbb7a0 100644 +index 13c19f2a779caa9ff27b135fdf4ad720e5c9cce7..b19072c26a37d577888cfefce612487d61aadd61 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -137,6 +137,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -144,6 +144,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { // Paper start private org.bukkit.event.player.PlayerResourcePackStatusEvent.Status resourcePackStatus; private String resourcePackHash; @@ -20,7 +20,7 @@ index d571248f597cbad63d26bc1bdf91cc263f88947f..f5c722644a1955c9bc68c89fdbb84526 // Paper end public CraftPlayer(CraftServer server, EntityPlayer entity) { -@@ -1444,7 +1445,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1502,7 +1503,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } public void addChannel(String channel) { diff --git a/Spigot-Server-Patches/0211-Add-method-to-open-already-placed-sign.patch b/Spigot-Server-Patches/0209-Add-method-to-open-already-placed-sign.patch similarity index 88% rename from Spigot-Server-Patches/0211-Add-method-to-open-already-placed-sign.patch rename to Spigot-Server-Patches/0209-Add-method-to-open-already-placed-sign.patch index 159ab07d6..b1d6073ea 100644 --- a/Spigot-Server-Patches/0211-Add-method-to-open-already-placed-sign.patch +++ b/Spigot-Server-Patches/0209-Add-method-to-open-already-placed-sign.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add method to open already placed sign diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -index 191bb7345e06cbad7bef416e4e849df3727bdac0..20f0783025516048851aedef0a70759c2953ae47 100644 +index 1f715fb44b85f14664affcce9a11928dfc82991b..fe8a21202340c5892f5166ec294212c6e44ed3a5 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -@@ -617,4 +617,17 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { +@@ -596,4 +596,17 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { entity.remove(); } } diff --git a/Spigot-Server-Patches/0212-Configurable-sprint-interruption-on-attack.patch b/Spigot-Server-Patches/0210-Configurable-sprint-interruption-on-attack.patch similarity index 85% rename from Spigot-Server-Patches/0212-Configurable-sprint-interruption-on-attack.patch rename to Spigot-Server-Patches/0210-Configurable-sprint-interruption-on-attack.patch index 4ccc72a2c..cb50a1f5d 100644 --- a/Spigot-Server-Patches/0212-Configurable-sprint-interruption-on-attack.patch +++ b/Spigot-Server-Patches/0210-Configurable-sprint-interruption-on-attack.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Configurable sprint interruption on attack If the sprint interruption is disabled players continue sprinting when they attack entities. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 77cdbfadf9c3eddb6a02460c321fa816d1bab8ac..171c8e3031cf4bf4da062663089cc0cb4552fab6 100644 +index 3804c7cf96087cdf94fd5fbdce4ebcdafa9e0019..873f81c74a94f6d76edd45e34ddc476dc525b47c 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -356,4 +356,9 @@ public class PaperWorldConfig { +@@ -351,4 +351,9 @@ public class PaperWorldConfig { private void squidMaxSpawnHeight() { squidMaxSpawnHeight = getDouble("squid-spawn-height.maximum", 0.0D); } @@ -20,10 +20,10 @@ index 77cdbfadf9c3eddb6a02460c321fa816d1bab8ac..171c8e3031cf4bf4da062663089cc0cb + } } diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index fda1b3d91b14080bf04a02c1340c63a6eb37911d..14a0e3d41ccd896da3b1126a403b0b684cada907 100644 +index 74950d74e6a11d5552369e830f9fdd63c4306221..e05e56f464c643925abfdf04bd745e3932ca001d 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -1112,7 +1112,11 @@ public abstract class EntityHuman extends EntityLiving { +@@ -1091,7 +1091,11 @@ public abstract class EntityHuman extends EntityLiving { } this.setMot(this.getMot().d(0.6D, 1.0D, 0.6D)); diff --git a/Spigot-Server-Patches/0213-Fix-exploit-that-allowed-colored-signs-to-be-created.patch b/Spigot-Server-Patches/0211-Fix-exploit-that-allowed-colored-signs-to-be-created.patch similarity index 79% rename from Spigot-Server-Patches/0213-Fix-exploit-that-allowed-colored-signs-to-be-created.patch rename to Spigot-Server-Patches/0211-Fix-exploit-that-allowed-colored-signs-to-be-created.patch index 545295c55..7d7c87ca1 100644 --- a/Spigot-Server-Patches/0213-Fix-exploit-that-allowed-colored-signs-to-be-created.patch +++ b/Spigot-Server-Patches/0211-Fix-exploit-that-allowed-colored-signs-to-be-created.patch @@ -5,14 +5,14 @@ Subject: [PATCH] Fix exploit that allowed colored signs to be created diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 5cb402156dc29eb27b17266490f2a5ff88ba9dea..ab9ab7a88dde29ac141753e1f1e9c0ff87d199cd 100644 +index ccf083fbfa97b2a24338a3c1fe18e9a8c850feaf..411e6ff17ac50a410da038ad538ad56ba3aef8a8 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -2502,7 +2502,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -2542,7 +2542,7 @@ public class PlayerConnection implements PacketListenerPlayIn { String[] lines = new String[4]; for (int i = 0; i < astring.length; ++i) { -- lines[i] = EnumChatFormat.b(new ChatComponentText(EnumChatFormat.b(astring[i])).getString()); +- lines[i] = EnumChatFormat.a(new ChatComponentText(EnumChatFormat.a(astring[i])).getString()); + lines[i] = SharedConstants.a(astring[i]); //Paper - Replaced with anvil color stripping method to stop exploits that allow colored signs to be created. } SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.server.getPlayer(this.player), lines); diff --git a/Spigot-Server-Patches/0214-EndermanEscapeEvent.patch b/Spigot-Server-Patches/0212-EndermanEscapeEvent.patch similarity index 62% rename from Spigot-Server-Patches/0214-EndermanEscapeEvent.patch rename to Spigot-Server-Patches/0212-EndermanEscapeEvent.patch index 925873536..1002240ce 100644 --- a/Spigot-Server-Patches/0214-EndermanEscapeEvent.patch +++ b/Spigot-Server-Patches/0212-EndermanEscapeEvent.patch @@ -8,7 +8,7 @@ Fires an event anytime an enderman intends to teleport away from the player You may cancel this, enabling ranged attacks to damage the enderman for example. diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java -index 538c2169cd53d364b941ad1251df3731f77b3a2c..2893f75bdff91e810431c64899b64047c372aa62 100644 +index 37a4bce1cd24e04b70367484c1ad3beae047ab08..888e66520548a47dbfa1c452b0d3fa5dcbe2002c 100644 --- a/src/main/java/net/minecraft/server/EntityEnderman.java +++ b/src/main/java/net/minecraft/server/EntityEnderman.java @@ -2,6 +2,7 @@ package net.minecraft.server; @@ -19,7 +19,7 @@ index 538c2169cd53d364b941ad1251df3731f77b3a2c..2893f75bdff91e810431c64899b64047 import java.util.Random; import java.util.UUID; import java.util.function.Predicate; -@@ -56,6 +57,12 @@ public class EntityEnderman extends EntityMonster { +@@ -56,6 +57,12 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { setGoalTarget(entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason.UNKNOWN, true); } @@ -32,37 +32,37 @@ index 538c2169cd53d364b941ad1251df3731f77b3a2c..2893f75bdff91e810431c64899b64047 @Override public boolean setGoalTarget(EntityLiving entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fireEvent) { if (!super.setGoalTarget(entityliving, reason, fireEvent)) { -@@ -177,7 +184,7 @@ public class EntityEnderman extends EntityMonster { - if (this.world.isDay() && this.ticksLived >= this.bA + 600) { - float f = this.aI(); +@@ -209,7 +216,7 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { + if (this.world.isDay() && this.ticksLived >= this.bz + 600) { + float f = this.aO(); -- if (f > 0.5F && this.world.f(new BlockPosition(this)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) { -+ if (f > 0.5F && this.world.f(new BlockPosition(this)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.tryEscape(EndermanEscapeEvent.Reason.RUNAWAY)) { // Paper +- if (f > 0.5F && this.world.f(this.getChunkCoordinates()) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) { ++ if (f > 0.5F && this.world.f(this.getChunkCoordinates()) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.tryEscape(EndermanEscapeEvent.Reason.RUNAWAY)) { // Paper this.setGoalTarget((EntityLiving) null); - this.eq(); + this.eM(); } -@@ -277,17 +284,19 @@ public class EntityEnderman extends EntityMonster { - } else if (!(damagesource instanceof EntityDamageSourceIndirect) && damagesource != DamageSource.FIREWORKS) { - boolean flag = super.damageEntity(damagesource, f); - -- if (!this.world.p_() && damagesource.ignoresArmor() && this.random.nextInt(10) != 0) { -+ if (!this.world.p_() && damagesource.ignoresArmor() && this.random.nextInt(10) != 0 && this.tryEscape(damagesource == DamageSource.DROWN ? EndermanEscapeEvent.Reason.DROWN : EndermanEscapeEvent.Reason.CRITICAL_HIT)) { // Paper - this.eq(); - } - - return flag; - } else { +@@ -307,17 +314,19 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { + if (this.isInvulnerable(damagesource)) { + return false; + } else if (damagesource instanceof EntityDamageSourceIndirect) { + if (this.tryEscape(EndermanEscapeEvent.Reason.INDIRECT)) { // Paper start for (int i = 0; i < 64; ++i) { - if (this.eq()) { + if (this.eM()) { return true; } } + } // Paper end return false; - } -@@ -422,7 +431,7 @@ public class EntityEnderman extends EntityMonster { + } else { + boolean flag = super.damageEntity(damagesource, f); + +- if (!this.world.s_() && this.random.nextInt(10) != 0) { ++ if (!this.world.s_() && this.random.nextInt(10) != 0 && this.tryEscape(damagesource == DamageSource.DROWN ? EndermanEscapeEvent.Reason.DROWN : EndermanEscapeEvent.Reason.CRITICAL_HIT)) { // Paper + this.eM(); + } + +@@ -459,7 +468,7 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { static class PathfinderGoalPlayerWhoLookedAtTarget extends PathfinderGoalNearestAttackableTarget { @@ -71,12 +71,12 @@ index 538c2169cd53d364b941ad1251df3731f77b3a2c..2893f75bdff91e810431c64899b64047 private EntityHuman j; private int k; private int l; -@@ -481,7 +490,7 @@ public class EntityEnderman extends EntityMonster { +@@ -522,7 +531,7 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { } else { if (this.c != null && !this.i.isPassenger()) { - if (this.i.f((EntityHuman) this.c)) { + if (this.i.g((EntityHuman) this.c)) { - if (this.c.h((Entity) this.i) < 16.0D) { + if (this.c.h((Entity) this.i) < 16.0D && this.getEnderman().tryEscape(EndermanEscapeEvent.Reason.STARE)) { - this.i.eq(); + this.i.eM(); } diff --git a/Spigot-Server-Patches/0215-Enderman.teleportRandomly.patch b/Spigot-Server-Patches/0213-Enderman.teleportRandomly.patch similarity index 80% rename from Spigot-Server-Patches/0215-Enderman.teleportRandomly.patch rename to Spigot-Server-Patches/0213-Enderman.teleportRandomly.patch index 4121c3f53..a068e22b2 100644 --- a/Spigot-Server-Patches/0215-Enderman.teleportRandomly.patch +++ b/Spigot-Server-Patches/0213-Enderman.teleportRandomly.patch @@ -6,16 +6,16 @@ Subject: [PATCH] Enderman.teleportRandomly() Ability to trigger the vanilla "teleport randomly" mechanic of an enderman. diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java -index 2893f75bdff91e810431c64899b64047c372aa62..f279c9b1482d3b3d632a762affff425139920b66 100644 +index 888e66520548a47dbfa1c452b0d3fa5dcbe2002c..67a678eceea5304d8ad1eaaee62c57c1088096f5 100644 --- a/src/main/java/net/minecraft/server/EntityEnderman.java +++ b/src/main/java/net/minecraft/server/EntityEnderman.java -@@ -193,6 +193,7 @@ public class EntityEnderman extends EntityMonster { +@@ -225,6 +225,7 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { super.mobTick(); } -+ public final boolean teleportRandomly() { return this.eq(); } // Paper - OBFHELPER - protected boolean eq() { - if (!this.world.p_() && this.isAlive()) { ++ public final boolean teleportRandomly() { return this.eM(); } // Paper - OBFHELPER + protected boolean eM() { + if (!this.world.s_() && this.isAlive()) { double d0 = this.locX() + (this.random.nextDouble() - 0.5D) * 64.0D; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java index 970efabd37d380ee1028c80a8e967e0f7aee9760..0c5f35934617529e92c02729687b524c3796128c 100644 diff --git a/Spigot-Server-Patches/0216-Block-Enderpearl-Travel-Exploit.patch b/Spigot-Server-Patches/0214-Block-Enderpearl-Travel-Exploit.patch similarity index 57% rename from Spigot-Server-Patches/0216-Block-Enderpearl-Travel-Exploit.patch rename to Spigot-Server-Patches/0214-Block-Enderpearl-Travel-Exploit.patch index 3f7e94345..f988c17ca 100644 --- a/Spigot-Server-Patches/0216-Block-Enderpearl-Travel-Exploit.patch +++ b/Spigot-Server-Patches/0214-Block-Enderpearl-Travel-Exploit.patch @@ -12,10 +12,10 @@ This disables that by not saving the thrower when the chunk is unloaded. This is mainly useful for survival servers that do not allow freeform teleporting. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 171c8e3031cf4bf4da062663089cc0cb4552fab6..9c52e31f4cf1e64a37c65c021da219fc26dda137 100644 +index 873f81c74a94f6d76edd45e34ddc476dc525b47c..69009246f12cc3acb0055af746e01097fa668e1b 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -361,4 +361,10 @@ public class PaperWorldConfig { +@@ -356,4 +356,10 @@ public class PaperWorldConfig { private void disableSprintInterruptionOnAttack() { disableSprintInterruptionOnAttack = getBoolean("game-mechanics.disable-sprint-interruption-on-attack", false); } @@ -26,15 +26,15 @@ index 171c8e3031cf4bf4da062663089cc0cb4552fab6..9c52e31f4cf1e64a37c65c021da219fc + log("Disable Unloaded Chunk Enderpearl Exploit: " + (disableEnderpearlExploit ? "enabled" : "disabled")); + } } -diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java -index 724b78b5d2d7f4ce8de31c763d2d95b986c1b7f6..9eed1dce3e48683b751ebbaac0487a046354622e 100644 ---- a/src/main/java/net/minecraft/server/EntityProjectile.java -+++ b/src/main/java/net/minecraft/server/EntityProjectile.java -@@ -201,6 +201,7 @@ public abstract class EntityProjectile extends Entity implements IProjectile { - if (nbttagcompound.hasKeyOfType("owner", 10)) { - this.shooterId = GameProfileSerializer.b(nbttagcompound.getCompound("owner")); +diff --git a/src/main/java/net/minecraft/server/IProjectile.java b/src/main/java/net/minecraft/server/IProjectile.java +index 8ce491fc155450a94582f94c78c8c296f8eeb864..cdf80e50de0840002f62f4c1df4fbcc4e13675d7 100644 +--- a/src/main/java/net/minecraft/server/IProjectile.java ++++ b/src/main/java/net/minecraft/server/IProjectile.java +@@ -48,6 +48,7 @@ public abstract class IProjectile extends Entity { + protected void loadData(NBTTagCompound nbttagcompound) { + if (nbttagcompound.b("Owner")) { + this.shooter = nbttagcompound.a("Owner"); ++ if (this instanceof EntityEnderPearl && this.world != null && this.world.paperConfig.disableEnderpearlExploit) { this.shooter = null; } // Paper - Don't store shooter name for pearls to block enderpearl travel exploit } -+ if (this instanceof EntityEnderPearl && this.world != null && this.world.paperConfig.disableEnderpearlExploit) { this.shooterId = null; } // Paper - Don't store shooter name for pearls to block enderpearl travel exploit - - } + this.d = nbttagcompound.getBoolean("LeftOwner"); diff --git a/Spigot-Server-Patches/0217-Expand-World.spawnParticle-API-and-add-Builder.patch b/Spigot-Server-Patches/0215-Expand-World.spawnParticle-API-and-add-Builder.patch similarity index 89% rename from Spigot-Server-Patches/0217-Expand-World.spawnParticle-API-and-add-Builder.patch rename to Spigot-Server-Patches/0215-Expand-World.spawnParticle-API-and-add-Builder.patch index f01c7fe61..021a009a9 100644 --- a/Spigot-Server-Patches/0217-Expand-World.spawnParticle-API-and-add-Builder.patch +++ b/Spigot-Server-Patches/0215-Expand-World.spawnParticle-API-and-add-Builder.patch @@ -10,19 +10,19 @@ Adds an option to control the force mode of the particle. This adds a new Builder API which is much friendlier to use. diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index e428b3cb8c8ca5a662a0e867bf74d08775f1bacd..a834a77b2de8f7287be69fd5d002ff43261a9a85 100644 +index 809ae79c0febf8a6de8bf0ca4d996b68bff8a2b6..10eb83bec33050ec1054de493960c87f67d4ec66 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -56,7 +56,7 @@ public class WorldServer extends World { +@@ -56,7 +56,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { public final Int2ObjectMap entitiesById = new Int2ObjectLinkedOpenHashMap(); private final Map entitiesByUUID = Maps.newHashMap(); private final Queue entitiesToAdd = Queues.newArrayDeque(); - private final List players = Lists.newArrayList(); + public final List players = Lists.newArrayList(); // Paper - private -> public + public final ChunkProviderServer chunkProvider; // Paper - public boolean tickingEntities; private final MinecraftServer server; - private final WorldNBTStorage dataManager; -@@ -1392,12 +1392,17 @@ public class WorldServer extends World { +@@ -1310,12 +1310,17 @@ public class WorldServer extends World implements GeneratorAccessSeed { } public int sendParticles(EntityPlayer sender, T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6, boolean force) { @@ -43,10 +43,10 @@ index e428b3cb8c8ca5a662a0e867bf74d08775f1bacd..a834a77b2de8f7287be69fd5d002ff43 if (this.a(entityplayer, force, d0, d1, d2, packetplayoutworldparticles)) { // CraftBukkit diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 13a83f285126123811a148453ccaea6f9bf197b4..1a3ca48485ebce128ae1288e6a50308c76ee0452 100644 +index 81f014977b95056020e9695dd49cbbf45d61b8ea..0a280692e6dc6b0a9e47bfd12f70774d49628398 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -2287,11 +2287,17 @@ public class CraftWorld implements World { +@@ -2329,11 +2329,17 @@ public class CraftWorld implements World { @Override public void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data, boolean force) { diff --git a/Spigot-Server-Patches/0218-EndermanAttackPlayerEvent.patch b/Spigot-Server-Patches/0216-EndermanAttackPlayerEvent.patch similarity index 73% rename from Spigot-Server-Patches/0218-EndermanAttackPlayerEvent.patch rename to Spigot-Server-Patches/0216-EndermanAttackPlayerEvent.patch index 3642aff6f..0328ba25f 100644 --- a/Spigot-Server-Patches/0218-EndermanAttackPlayerEvent.patch +++ b/Spigot-Server-Patches/0216-EndermanAttackPlayerEvent.patch @@ -8,21 +8,21 @@ Allow control over whether or not an enderman aggros a player. This allows you to override/extend the pumpkin/stare logic. diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java -index f279c9b1482d3b3d632a762affff425139920b66..b7c67f0cdb3d02c7a2dbe85f9a432836cb34bb6e 100644 +index 67a678eceea5304d8ad1eaaee62c57c1088096f5..7c13e5b711706c8aaa363d80350597a52920f12b 100644 --- a/src/main/java/net/minecraft/server/EntityEnderman.java +++ b/src/main/java/net/minecraft/server/EntityEnderman.java -@@ -141,7 +141,15 @@ public class EntityEnderman extends EntityMonster { - this.setCarried(iblockdata); +@@ -168,7 +168,15 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { + this.a((WorldServer) this.world, nbttagcompound); } + // Paper start - OBFHELPER - ok not really, but verify this on updates - private boolean f(EntityHuman entityhuman) { -+ boolean shouldAttack = f_real(entityhuman); + private boolean g(EntityHuman entityhuman) { ++ boolean shouldAttack = g_real(entityhuman); + com.destroystokyo.paper.event.entity.EndermanAttackPlayerEvent event = new com.destroystokyo.paper.event.entity.EndermanAttackPlayerEvent((org.bukkit.entity.Enderman) getBukkitEntity(), (org.bukkit.entity.Player) entityhuman.getBukkitEntity()); + event.setCancelled(!shouldAttack); + return event.callEvent(); + } -+ private boolean f_real(EntityHuman entityhuman) { ++ private boolean g_real(EntityHuman entityhuman) { + // Paper end ItemStack itemstack = (ItemStack) entityhuman.inventory.armor.get(3); diff --git a/Spigot-Server-Patches/0219-WitchConsumePotionEvent.patch b/Spigot-Server-Patches/0217-WitchConsumePotionEvent.patch similarity index 89% rename from Spigot-Server-Patches/0219-WitchConsumePotionEvent.patch rename to Spigot-Server-Patches/0217-WitchConsumePotionEvent.patch index a76d06b13..164db395a 100644 --- a/Spigot-Server-Patches/0219-WitchConsumePotionEvent.patch +++ b/Spigot-Server-Patches/0217-WitchConsumePotionEvent.patch @@ -6,12 +6,12 @@ Subject: [PATCH] WitchConsumePotionEvent Fires when a witch consumes the potion in their hand diff --git a/src/main/java/net/minecraft/server/EntityWitch.java b/src/main/java/net/minecraft/server/EntityWitch.java -index ddff0b57869c3511346510a91336045ec1469bdc..aa90111716c69379df250f06957a2db5178bbe92 100644 +index e146957d219960d0b6371b9460e73fb0ea150dde..a364ab990883bcdf84d8d92385a738200630864d 100644 --- a/src/main/java/net/minecraft/server/EntityWitch.java +++ b/src/main/java/net/minecraft/server/EntityWitch.java -@@ -88,7 +88,11 @@ public class EntityWitch extends EntityRaider implements IRangedEntity { +@@ -85,7 +85,11 @@ public class EntityWitch extends EntityRaider implements IRangedEntity { - this.setSlot(EnumItemSlot.MAINHAND, ItemStack.a); + this.setSlot(EnumItemSlot.MAINHAND, ItemStack.b); if (itemstack.getItem() == Items.POTION) { - List list = PotionUtil.getEffects(itemstack); + // Paper start diff --git a/Spigot-Server-Patches/0220-WitchThrowPotionEvent.patch b/Spigot-Server-Patches/0218-WitchThrowPotionEvent.patch similarity index 84% rename from Spigot-Server-Patches/0220-WitchThrowPotionEvent.patch rename to Spigot-Server-Patches/0218-WitchThrowPotionEvent.patch index d1d7c110e..19bc42b80 100644 --- a/Spigot-Server-Patches/0220-WitchThrowPotionEvent.patch +++ b/Spigot-Server-Patches/0218-WitchThrowPotionEvent.patch @@ -6,7 +6,7 @@ Subject: [PATCH] WitchThrowPotionEvent Fired when a witch throws a potion at a player diff --git a/src/main/java/net/minecraft/server/EntityWitch.java b/src/main/java/net/minecraft/server/EntityWitch.java -index aa90111716c69379df250f06957a2db5178bbe92..1f2759e95e6a8382c5d27899b05a993beee25f5a 100644 +index a364ab990883bcdf84d8d92385a738200630864d..75d014ad49c701e4c693be4e2f8e7dc6d592fa5f 100644 --- a/src/main/java/net/minecraft/server/EntityWitch.java +++ b/src/main/java/net/minecraft/server/EntityWitch.java @@ -185,9 +185,16 @@ public class EntityWitch extends EntityRaider implements IRangedEntity { @@ -27,4 +27,4 @@ index aa90111716c69379df250f06957a2db5178bbe92..1f2759e95e6a8382c5d27899b05a993b + // Paper end entitypotion.pitch -= -20.0F; entitypotion.shoot(d0, d1 + (double) (f1 * 0.2F), d2, 0.75F, 8.0F); - this.world.playSound((EntityHuman) null, this.locX(), this.locY(), this.locZ(), SoundEffects.ENTITY_WITCH_THROW, this.getSoundCategory(), 1.0F, 0.8F + this.random.nextFloat() * 0.4F); + if (!this.isSilent()) { diff --git a/Spigot-Server-Patches/0221-Allow-spawning-Item-entities-with-World.spawnEntity.patch b/Spigot-Server-Patches/0219-Allow-spawning-Item-entities-with-World.spawnEntity.patch similarity index 88% rename from Spigot-Server-Patches/0221-Allow-spawning-Item-entities-with-World.spawnEntity.patch rename to Spigot-Server-Patches/0219-Allow-spawning-Item-entities-with-World.spawnEntity.patch index 69f7bafb3..0ef27ea3a 100644 --- a/Spigot-Server-Patches/0221-Allow-spawning-Item-entities-with-World.spawnEntity.patch +++ b/Spigot-Server-Patches/0219-Allow-spawning-Item-entities-with-World.spawnEntity.patch @@ -8,10 +8,10 @@ This API has more capabilities than .dropItem with the Consumer function Item can be set inside of the Consumer pre spawn function. diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 1a3ca48485ebce128ae1288e6a50308c76ee0452..28a94e473482b414b50ca793564acd409a5dc133 100644 +index 0a280692e6dc6b0a9e47bfd12f70774d49628398..5b4afa9998c7e156353abe80e3ccc3efb4a2d390 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -1489,6 +1489,10 @@ public class CraftWorld implements World { +@@ -1499,6 +1499,10 @@ public class CraftWorld implements World { if (Boat.class.isAssignableFrom(clazz)) { entity = new EntityBoat(world, x, y, z); entity.setPositionRotation(x, y, z, yaw, pitch); diff --git a/Spigot-Server-Patches/0222-WitchReadyPotionEvent.patch b/Spigot-Server-Patches/0220-WitchReadyPotionEvent.patch similarity index 71% rename from Spigot-Server-Patches/0222-WitchReadyPotionEvent.patch rename to Spigot-Server-Patches/0220-WitchReadyPotionEvent.patch index 946197585..b609ec17f 100644 --- a/Spigot-Server-Patches/0222-WitchReadyPotionEvent.patch +++ b/Spigot-Server-Patches/0220-WitchReadyPotionEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] WitchReadyPotionEvent diff --git a/src/main/java/net/minecraft/server/EntityWitch.java b/src/main/java/net/minecraft/server/EntityWitch.java -index 1f2759e95e6a8382c5d27899b05a993beee25f5a..be6ecfb08aaba3fc5d96e918b7540fc75c92e89e 100644 +index 75d014ad49c701e4c693be4e2f8e7dc6d592fa5f..a6142ef24bc5bfa15a0ec84fbd8267ffab4e25bf 100644 --- a/src/main/java/net/minecraft/server/EntityWitch.java +++ b/src/main/java/net/minecraft/server/EntityWitch.java -@@ -121,7 +121,11 @@ public class EntityWitch extends EntityRaider implements IRangedEntity { +@@ -118,7 +118,11 @@ public class EntityWitch extends EntityRaider implements IRangedEntity { } if (potionregistry != null) { @@ -18,6 +18,6 @@ index 1f2759e95e6a8382c5d27899b05a993beee25f5a..be6ecfb08aaba3fc5d96e918b7540fc7 + org.bukkit.inventory.ItemStack bukkitStack = com.destroystokyo.paper.event.entity.WitchReadyPotionEvent.process((org.bukkit.entity.Witch) this.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(potion)); + this.setSlot(EnumItemSlot.MAINHAND, org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(bukkitStack)); + // Paper end - this.by = this.getItemInMainHand().k(); - this.t(true); - this.world.playSound((EntityHuman) null, this.locX(), this.locY(), this.locZ(), SoundEffects.ENTITY_WITCH_DRINK, this.getSoundCategory(), 1.0F, 0.8F + this.random.nextFloat() * 0.4F); + this.bx = this.getItemInMainHand().k(); + this.v(true); + if (!this.isSilent()) { diff --git a/Spigot-Server-Patches/0223-ItemStack-getMaxItemUseDuration.patch b/Spigot-Server-Patches/0221-ItemStack-getMaxItemUseDuration.patch similarity index 83% rename from Spigot-Server-Patches/0223-ItemStack-getMaxItemUseDuration.patch rename to Spigot-Server-Patches/0221-ItemStack-getMaxItemUseDuration.patch index 68d6b7276..d96b867b6 100644 --- a/Spigot-Server-Patches/0223-ItemStack-getMaxItemUseDuration.patch +++ b/Spigot-Server-Patches/0221-ItemStack-getMaxItemUseDuration.patch @@ -6,19 +6,19 @@ Subject: [PATCH] ItemStack#getMaxItemUseDuration Allows you to determine how long it takes to use a usable/consumable item diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java -index 854cffe6c98956cbafa2ead9b831e39209a76c8d..641a52b968ef04a142b32703b61c8b75643b36a6 100644 +index c4d034c6a6ff176bc954c00c328512bdf67455a6..7b2010ec4955fb5788c60178c6e306ea3098e9ba 100644 --- a/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java -@@ -548,6 +548,7 @@ public final class ItemStack { +@@ -552,6 +552,7 @@ public final class ItemStack { this.getItem().b(this, world, entityhuman); } + public int getItemUseMaxDuration() { return k(); } // Paper - OBFHELPER public int k() { - return this.getItem().f_(this); + return this.getItem().e_(this); } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java -index 3dd912abe3fec22adb29d8edfd66b9f5f3bee4f6..a41be8fdaebe7cf61537c638392b3dc7c7f5b371 100644 +index 9913d0136841dac35b6649cb1afbe1e93b36bf4c..d315a102a5ae2a79189b39c3b534b8fd733cc9e4 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java @@ -174,6 +174,13 @@ public final class CraftItemStack extends ItemStack { diff --git a/Spigot-Server-Patches/0224-Implement-EntityTeleportEndGatewayEvent.patch b/Spigot-Server-Patches/0222-Implement-EntityTeleportEndGatewayEvent.patch similarity index 84% rename from Spigot-Server-Patches/0224-Implement-EntityTeleportEndGatewayEvent.patch rename to Spigot-Server-Patches/0222-Implement-EntityTeleportEndGatewayEvent.patch index 2d432ec5a..4cf75627a 100644 --- a/Spigot-Server-Patches/0224-Implement-EntityTeleportEndGatewayEvent.patch +++ b/Spigot-Server-Patches/0222-Implement-EntityTeleportEndGatewayEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Implement EntityTeleportEndGatewayEvent diff --git a/src/main/java/net/minecraft/server/TileEntityEndGateway.java b/src/main/java/net/minecraft/server/TileEntityEndGateway.java -index 78fba79378173dc2c4290e048c3497e206332458..c71f76004ed934e9e921efc4cb637f2e77af92d2 100644 +index 4686880e1f37841ae0217654ed6aa8f813ad90a6..ea61a473d8e47428ed5cd4541a5855f0e2c50815 100644 --- a/src/main/java/net/minecraft/server/TileEntityEndGateway.java +++ b/src/main/java/net/minecraft/server/TileEntityEndGateway.java -@@ -145,8 +145,19 @@ public class TileEntityEndGateway extends TileEntityEnderPortal implements ITick +@@ -163,8 +163,19 @@ public class TileEntityEndGateway extends TileEntityEnderPortal implements ITick } // CraftBukkit end @@ -23,7 +23,7 @@ index 78fba79378173dc2c4290e048c3497e206332458..c71f76004ed934e9e921efc4cb637f2e + return; + } -- entity.enderTeleportAndLoad((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D); +- entity1.enderTeleportAndLoad((double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D); + entity.enderTeleportAndLoad(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ()); + // Paper end - EntityTeleportEndGatewayEvent } diff --git a/Spigot-Server-Patches/0225-Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch b/Spigot-Server-Patches/0223-Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch similarity index 88% rename from Spigot-Server-Patches/0225-Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch rename to Spigot-Server-Patches/0223-Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch index eb594324e..4f6734723 100644 --- a/Spigot-Server-Patches/0225-Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch +++ b/Spigot-Server-Patches/0223-Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Unset Ignited flag on cancel of Explosion Event Otherwise the creeper infinite explodes diff --git a/src/main/java/net/minecraft/server/EntityCreeper.java b/src/main/java/net/minecraft/server/EntityCreeper.java -index 374cf28fb42b13152f58fd63c4f0cb25eae6a2d9..b89530079751c13894527f21572cc37e3a5548b8 100644 +index af9ac84c2caf42d0714d6050ee7db7e39a47878b..e4c1a7c152b2c1202c77e5d5d1c386d84007bc97 100644 --- a/src/main/java/net/minecraft/server/EntityCreeper.java +++ b/src/main/java/net/minecraft/server/EntityCreeper.java @@ -12,7 +12,7 @@ public class EntityCreeper extends EntityMonster { @@ -15,10 +15,10 @@ index 374cf28fb42b13152f58fd63c4f0cb25eae6a2d9..b89530079751c13894527f21572cc37e private static final DataWatcherObject POWERED = DataWatcher.a(EntityCreeper.class, DataWatcherRegistry.i); - private static final DataWatcherObject d = DataWatcher.a(EntityCreeper.class, DataWatcherRegistry.i); + private static final DataWatcherObject d = DataWatcher.a(EntityCreeper.class, DataWatcherRegistry.i); private static final DataWatcherObject isIgnitedDW = d; // Paper OBFHELPER - private int bw; + private int bv; private int fuseTicks; public int maxFuseTicks = 30; -@@ -219,6 +219,7 @@ public class EntityCreeper extends EntityMonster { +@@ -217,6 +217,7 @@ public class EntityCreeper extends EntityMonster { this.createEffectCloud(); } else { fuseTicks = 0; diff --git a/Spigot-Server-Patches/0226-Fix-CraftEntity-hashCode.patch b/Spigot-Server-Patches/0224-Fix-CraftEntity-hashCode.patch similarity index 91% rename from Spigot-Server-Patches/0226-Fix-CraftEntity-hashCode.patch rename to Spigot-Server-Patches/0224-Fix-CraftEntity-hashCode.patch index b1800dac5..6e4af9b3f 100644 --- a/Spigot-Server-Patches/0226-Fix-CraftEntity-hashCode.patch +++ b/Spigot-Server-Patches/0224-Fix-CraftEntity-hashCode.patch @@ -21,10 +21,10 @@ check is essentially the same as this.getHandle() == other.getHandle() However, replaced it too to make it clearer of intent. diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 2d84f8410a7b8ff88d9dbab64741dcdf40fc1612..5f16dea1a543607e76f7ef70fe44e9a3f12e9132 100644 +index 66edc6ae67084959503ffa0df2c04174fb29b8d8..51f027e8f98240fec989ea877095031bab087bda 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -724,14 +724,15 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { +@@ -732,14 +732,15 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { return false; } final CraftEntity other = (CraftEntity) obj; diff --git a/Spigot-Server-Patches/0227-Configurable-Alternative-LootPool-Luck-Formula.patch b/Spigot-Server-Patches/0225-Configurable-Alternative-LootPool-Luck-Formula.patch similarity index 86% rename from Spigot-Server-Patches/0227-Configurable-Alternative-LootPool-Luck-Formula.patch rename to Spigot-Server-Patches/0225-Configurable-Alternative-LootPool-Luck-Formula.patch index ca7762f85..cfcfb0363 100644 --- a/Spigot-Server-Patches/0227-Configurable-Alternative-LootPool-Luck-Formula.patch +++ b/Spigot-Server-Patches/0225-Configurable-Alternative-LootPool-Luck-Formula.patch @@ -36,10 +36,10 @@ This change will result in some major changes to fishing formulas. I would love to see this change in Vanilla, so Mojang please pull :) diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index ba341e0174cdc3b5b8bc83b7430270181ea92793..26ab855dcf38446a3d8577108bd16fdbb76126b2 100644 +index f22bed69f690f6e4754b87dd61cebe9c6627b12d..c8a7d8092a2849b62a8d83d7970756fd76100025 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -279,4 +279,12 @@ public class PaperConfig { +@@ -280,4 +280,12 @@ public class PaperConfig { "such as inventories, experience points, advancements and the like will not be saved when they log out."); } } @@ -53,21 +53,21 @@ index ba341e0174cdc3b5b8bc83b7430270181ea92793..26ab855dcf38446a3d8577108bd16fdb + } } diff --git a/src/main/java/net/minecraft/server/LootSelectorEntry.java b/src/main/java/net/minecraft/server/LootSelectorEntry.java -index 3ed6a1e785f68c4bb6c5afe024c43150915968a3..03398ce8fdcc68cf5aa7caa3c8fd51c9e8e178eb 100644 +index ee9069c744df63cbb7f21dd9d28d6d554593674c..ca18d3156fd2b10f8ee48ff02f6f47e6e649200b 100644 --- a/src/main/java/net/minecraft/server/LootSelectorEntry.java +++ b/src/main/java/net/minecraft/server/LootSelectorEntry.java @@ -11,8 +11,8 @@ import org.apache.commons.lang3.ArrayUtils; public abstract class LootSelectorEntry extends LootEntryAbstract { +- protected final int c; - protected final int e; -- protected final int f; -+ protected final int e; public int getWeight() { return e; } // Paper - OBFHELPER -+ protected final int f; public int getQuality() { return f; } // Paper - OBFHELPER - protected final LootItemFunction[] g; - private final BiFunction c; ++ protected final int c; public int getWeight() { return c; } // Paper - OBFHELPER ++ protected final int e; public int getQuality() { return e; } // Paper - OBFHELPER + protected final LootItemFunction[] f; + private final BiFunction g; private final LootEntry h = new LootSelectorEntry.c() { -@@ -145,11 +145,38 @@ public abstract class LootSelectorEntry extends LootEntryAbstract { +@@ -143,11 +143,38 @@ public abstract class LootSelectorEntry extends LootEntryAbstract { public abstract class c implements LootEntry { @@ -77,7 +77,7 @@ index 3ed6a1e785f68c4bb6c5afe024c43150915968a3..03398ce8fdcc68cf5aa7caa3c8fd51c9 @Override public int a(float f) { -- return Math.max(MathHelper.d((float) LootSelectorEntry.this.e + (float) LootSelectorEntry.this.f * f), 0); +- return Math.max(MathHelper.d((float) LootSelectorEntry.this.c + (float) LootSelectorEntry.this.e * f), 0); + // Paper start - Offer an alternative loot formula to refactor how luck bonus applies + // SEE: https://luckformula.emc.gs for details and data + if (lastLuck != null && lastLuck == f) { @@ -104,7 +104,7 @@ index 3ed6a1e785f68c4bb6c5afe024c43150915968a3..03398ce8fdcc68cf5aa7caa3c8fd51c9 + return lastWeight; } } -+ private Float lastLuck = null; -+ private int lastWeight = 0; -+ // Paper end ++ private Float lastLuck = null; ++ private int lastWeight = 0; ++ // Paper end } diff --git a/Spigot-Server-Patches/0228-Print-Error-details-when-failing-to-save-player-data.patch b/Spigot-Server-Patches/0226-Print-Error-details-when-failing-to-save-player-data.patch similarity index 78% rename from Spigot-Server-Patches/0228-Print-Error-details-when-failing-to-save-player-data.patch rename to Spigot-Server-Patches/0226-Print-Error-details-when-failing-to-save-player-data.patch index 599b081cd..763ac896a 100644 --- a/Spigot-Server-Patches/0228-Print-Error-details-when-failing-to-save-player-data.patch +++ b/Spigot-Server-Patches/0226-Print-Error-details-when-failing-to-save-player-data.patch @@ -5,12 +5,12 @@ Subject: [PATCH] Print Error details when failing to save player data diff --git a/src/main/java/net/minecraft/server/WorldNBTStorage.java b/src/main/java/net/minecraft/server/WorldNBTStorage.java -index e60e10c57d5acaecb70e89c83c34f1f8870091c2..350ac42d6b45a1023f6254de7706818775b7957b 100644 +index ae43d8d2af0daa68f13528d25bac1d94964662bc..41a1b93a9e0f16ed9415dfeccd490496650163cb 100644 --- a/src/main/java/net/minecraft/server/WorldNBTStorage.java +++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java -@@ -151,7 +151,7 @@ public class WorldNBTStorage implements IPlayerFileData { +@@ -38,7 +38,7 @@ public class WorldNBTStorage { - file.renameTo(file1); + SystemUtils.a(file1, file, file2); } catch (Exception exception) { - WorldNBTStorage.LOGGER.warn("Failed to save player data for {}", entityhuman.getDisplayName().getString()); + WorldNBTStorage.LOGGER.error("Failed to save player data for {}", entityhuman.getName(), exception); // Paper diff --git a/Spigot-Server-Patches/0229-Make-shield-blocking-delay-configurable.patch b/Spigot-Server-Patches/0227-Make-shield-blocking-delay-configurable.patch similarity index 77% rename from Spigot-Server-Patches/0229-Make-shield-blocking-delay-configurable.patch rename to Spigot-Server-Patches/0227-Make-shield-blocking-delay-configurable.patch index 84c8cf61a..43064f93f 100644 --- a/Spigot-Server-Patches/0229-Make-shield-blocking-delay-configurable.patch +++ b/Spigot-Server-Patches/0227-Make-shield-blocking-delay-configurable.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Make shield blocking delay configurable diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 9c52e31f4cf1e64a37c65c021da219fc26dda137..33ce9a500430a01650e69a3568c8b03db325a936 100644 +index 69009246f12cc3acb0055af746e01097fa668e1b..35075ffac394153e28039809e0ed48fe066a6223 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -367,4 +367,9 @@ public class PaperWorldConfig { +@@ -362,4 +362,9 @@ public class PaperWorldConfig { disableEnderpearlExploit = getBoolean("game-mechanics.disable-unloaded-chunk-enderpearl-exploit", disableEnderpearlExploit); log("Disable Unloaded Chunk Enderpearl Exploit: " + (disableEnderpearlExploit ? "enabled" : "disabled")); } @@ -19,19 +19,19 @@ index 9c52e31f4cf1e64a37c65c021da219fc26dda137..33ce9a500430a01650e69a3568c8b03d + } } diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index f5da67fd8908f027835b837a8b847e27c3638790..1a1d608f5acfc92e3e55e53f63c9da6ab0aa6a0a 100644 +index 26832d31cc64d26a9ca61a3bad21424ed366c74c..2ffc8eb4615abfaa6a9e99c45ea436cdf6a461c8 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -3002,7 +3002,7 @@ public abstract class EntityLiving extends Entity { +@@ -3171,7 +3171,7 @@ public abstract class EntityLiving extends Entity { if (this.isHandRaised() && !this.activeItem.isEmpty()) { Item item = this.activeItem.getItem(); -- return item.e_(this.activeItem) != EnumAnimation.BLOCK ? false : item.f_(this.activeItem) - this.bl >= 5; -+ return item.e_(this.activeItem) != EnumAnimation.BLOCK ? false : item.f_(this.activeItem) - this.bl >= getShieldBlockingDelay(); // Paper - shieldBlockingDelay +- return item.d_(this.activeItem) != EnumAnimation.BLOCK ? false : item.e_(this.activeItem) - this.bk >= 5; ++ return item.d_(this.activeItem) != EnumAnimation.BLOCK ? false : item.e_(this.activeItem) - this.bk >= getShieldBlockingDelay(); // Paper - shieldBlockingDelay } else { return false; } -@@ -3241,4 +3241,15 @@ public abstract class EntityLiving extends Entity { +@@ -3423,4 +3423,15 @@ public abstract class EntityLiving extends Entity { public void broadcastItemBreak(EnumHand enumhand) { this.broadcastItemBreak(enumhand == EnumHand.MAIN_HAND ? EnumItemSlot.MAINHAND : EnumItemSlot.OFFHAND); } @@ -48,10 +48,10 @@ index f5da67fd8908f027835b837a8b847e27c3638790..1a1d608f5acfc92e3e55e53f63c9da6a + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 1760dfa7a312b63d7608d890c977452ad995d7ae..a8e44e95d6115833f4e20e6bb007842bdc52f1ef 100644 +index 5e2642b33d36e0695d6adc879f9595030adaaf31..38eb8fbac1d5131249dd9ba8b9942b4c85de2c7f 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -644,5 +644,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -657,5 +657,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { public void setArrowsStuck(int arrows) { getHandle().setArrowCount(arrows); } diff --git a/Spigot-Server-Patches/0230-EntityShootBowEvent-consumeArrow-and-getArrowItem-AP.patch b/Spigot-Server-Patches/0228-EntityShootBowEvent-consumeArrow-and-getArrowItem-AP.patch similarity index 83% rename from Spigot-Server-Patches/0230-EntityShootBowEvent-consumeArrow-and-getArrowItem-AP.patch rename to Spigot-Server-Patches/0228-EntityShootBowEvent-consumeArrow-and-getArrowItem-AP.patch index 62612213b..794dd655e 100644 --- a/Spigot-Server-Patches/0230-EntityShootBowEvent-consumeArrow-and-getArrowItem-AP.patch +++ b/Spigot-Server-Patches/0228-EntityShootBowEvent-consumeArrow-and-getArrowItem-AP.patch @@ -6,10 +6,10 @@ Subject: [PATCH] EntityShootBowEvent consumeArrow and getArrowItem API Adds ability to get what arrow was shot, and control if it should be consumed. diff --git a/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java b/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java -index fb9656afde07a871216a4c5e414777603be590d1..3c95c0428b211b14db65be16a95446debda789e6 100644 +index 05ffe8af6a59e05d2c2e9567c675fd020d6b0723..84f83d48a8c41a26289ce0995aa9f5fd332c0ccb 100644 --- a/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java +++ b/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java -@@ -157,7 +157,7 @@ public abstract class EntitySkeletonAbstract extends EntityMonster implements IR +@@ -155,7 +155,7 @@ public abstract class EntitySkeletonAbstract extends EntityMonster implements IR entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.world.getDifficulty().a() * 4)); // CraftBukkit start @@ -19,10 +19,10 @@ index fb9656afde07a871216a4c5e414777603be590d1..3c95c0428b211b14db65be16a95446de event.getProjectile().remove(); return; diff --git a/src/main/java/net/minecraft/server/ItemBow.java b/src/main/java/net/minecraft/server/ItemBow.java -index 83aa70c295f93b1c19d81fb0b90876e62fe58c23..26899916d3f5274691386685d13d18f587e4ec28 100644 +index 987b59dfcd3a69886e2722477300d313340690bb..b3cb832be6db70922c5495476e89124d75c9ed6d 100644 --- a/src/main/java/net/minecraft/server/ItemBow.java +++ b/src/main/java/net/minecraft/server/ItemBow.java -@@ -36,6 +36,7 @@ public class ItemBow extends ItemProjectileWeapon { +@@ -26,6 +26,7 @@ public class ItemBow extends ItemProjectileWeapon implements ItemVanishable { if ((double) f >= 0.1D) { boolean flag1 = flag && itemstack1.getItem() == Items.ARROW; @@ -30,7 +30,7 @@ index 83aa70c295f93b1c19d81fb0b90876e62fe58c23..26899916d3f5274691386685d13d18f5 if (!world.isClientSide) { ItemArrow itemarrow = (ItemArrow) ((ItemArrow) (itemstack1.getItem() instanceof ItemArrow ? itemstack1.getItem() : Items.ARROW)); EntityArrow entityarrow = itemarrow.a(world, itemstack1, (EntityLiving) entityhuman); -@@ -61,7 +62,7 @@ public class ItemBow extends ItemProjectileWeapon { +@@ -51,7 +52,7 @@ public class ItemBow extends ItemProjectileWeapon implements ItemVanishable { entityarrow.setOnFire(100); } // CraftBukkit start @@ -39,7 +39,7 @@ index 83aa70c295f93b1c19d81fb0b90876e62fe58c23..26899916d3f5274691386685d13d18f5 if (event.isCancelled()) { event.getProjectile().remove(); return; -@@ -71,7 +72,8 @@ public class ItemBow extends ItemProjectileWeapon { +@@ -61,7 +62,8 @@ public class ItemBow extends ItemProjectileWeapon implements ItemVanishable { itemstack.damage(1, entityhuman, (entityhuman1) -> { entityhuman1.broadcastItemBreak(entityhuman.getRaisedHand()); }); @@ -49,20 +49,20 @@ index 83aa70c295f93b1c19d81fb0b90876e62fe58c23..26899916d3f5274691386685d13d18f5 entityarrow.fromPlayer = EntityArrow.PickupStatus.CREATIVE_ONLY; } -@@ -88,7 +90,7 @@ public class ItemBow extends ItemProjectileWeapon { +@@ -78,7 +80,7 @@ public class ItemBow extends ItemProjectileWeapon implements ItemVanishable { } - world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_ARROW_SHOOT, SoundCategory.PLAYERS, 1.0F, 1.0F / (ItemBow.i.nextFloat() * 0.4F + 1.2F) + f * 0.5F); + world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_ARROW_SHOOT, SoundCategory.PLAYERS, 1.0F, 1.0F / (ItemBow.RANDOM.nextFloat() * 0.4F + 1.2F) + f * 0.5F); - if (!flag1 && !entityhuman.abilities.canInstantlyBuild) { + if (!flag1 && !entityhuman.abilities.canInstantlyBuild && consumeArrow) { // Paper itemstack1.subtract(1); if (itemstack1.isEmpty()) { entityhuman.inventory.f(itemstack1); diff --git a/src/main/java/net/minecraft/server/ItemCrossbow.java b/src/main/java/net/minecraft/server/ItemCrossbow.java -index 7be41c8698e86727978db7d72b3dd3fbfe6b7272..60a47bccca5bc77039c0bec94eb329b3f2f0937f 100644 +index 1592e94c78611a4b968bfb24daf68570e778fadd..31c80bb0a2e403c34fb9cd4b3ee4e903d90dc356 100644 --- a/src/main/java/net/minecraft/server/ItemCrossbow.java +++ b/src/main/java/net/minecraft/server/ItemCrossbow.java -@@ -221,7 +221,7 @@ public class ItemCrossbow extends ItemProjectileWeapon { +@@ -205,7 +205,7 @@ public class ItemCrossbow extends ItemProjectileWeapon implements ItemVanishable ((IProjectile) object).shoot((double) vector3fa.a(), (double) vector3fa.b(), (double) vector3fa.c(), f1, f2); } // CraftBukkit start @@ -72,18 +72,10 @@ index 7be41c8698e86727978db7d72b3dd3fbfe6b7272..60a47bccca5bc77039c0bec94eb329b3 event.getProjectile().remove(); return; diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 43965bea87e5884fa0f6b7838abbade08ce5c536..3a897cf5903539e1099f1a9ec98f1e157437fee0 100644 +index 7cadd8d55d0537b31969f421370c830e8925bed2..5bcf38d3fcfa569c50d66ed67ad22db7e7d36207 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -52,6 +52,7 @@ import net.minecraft.server.GeneratorAccess; - import net.minecraft.server.IBlockData; - import net.minecraft.server.IChatBaseComponent; - import net.minecraft.server.IInventory; -+import net.minecraft.server.IProjectile; - import net.minecraft.server.ItemActionContext; - import net.minecraft.server.ItemStack; - import net.minecraft.server.Items; -@@ -478,16 +479,16 @@ public class CraftEventFactory { +@@ -505,16 +505,16 @@ public class CraftEventFactory { /** * EntityShootBowEvent */ diff --git a/Spigot-Server-Patches/0231-PlayerReadyArrowEvent.patch b/Spigot-Server-Patches/0229-PlayerReadyArrowEvent.patch similarity index 83% rename from Spigot-Server-Patches/0231-PlayerReadyArrowEvent.patch rename to Spigot-Server-Patches/0229-PlayerReadyArrowEvent.patch index f3c28c9ab..a5613c468 100644 --- a/Spigot-Server-Patches/0231-PlayerReadyArrowEvent.patch +++ b/Spigot-Server-Patches/0229-PlayerReadyArrowEvent.patch @@ -7,11 +7,11 @@ Called when a player is firing a bow and the server is choosing an arrow to use. Plugins can skip selection of certain arrows and control which is used. diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index 14a0e3d41ccd896da3b1126a403b0b684cada907..6e9dd4d3717567f54ac706715d75bf53d48c5f7d 100644 +index e05e56f464c643925abfdf04bd745e3932ca001d..a1cfa610eb3cc368b9641feeab709a4f5985ffbe 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -2157,6 +2157,17 @@ public abstract class EntityHuman extends EntityLiving { - return (EntitySize) EntityHuman.b.getOrDefault(entitypose, EntityHuman.bp); +@@ -2045,6 +2045,17 @@ public abstract class EntityHuman extends EntityLiving { + return ImmutableList.of(EntityPose.STANDING, EntityPose.CROUCHING, EntityPose.SWIMMING); } + // Paper start @@ -28,7 +28,7 @@ index 14a0e3d41ccd896da3b1126a403b0b684cada907..6e9dd4d3717567f54ac706715d75bf53 @Override public ItemStack f(ItemStack itemstack) { if (!(itemstack.getItem() instanceof ItemProjectileWeapon)) { -@@ -2173,7 +2184,7 @@ public abstract class EntityHuman extends EntityLiving { +@@ -2061,7 +2072,7 @@ public abstract class EntityHuman extends EntityLiving { for (int i = 0; i < this.inventory.getSize(); ++i) { ItemStack itemstack2 = this.inventory.getItem(i); diff --git a/Spigot-Server-Patches/0232-Fire-EntityShootBowEvent-for-Illusioner.patch b/Spigot-Server-Patches/0230-Fire-EntityShootBowEvent-for-Illusioner.patch similarity index 82% rename from Spigot-Server-Patches/0232-Fire-EntityShootBowEvent-for-Illusioner.patch rename to Spigot-Server-Patches/0230-Fire-EntityShootBowEvent-for-Illusioner.patch index d3093ac83..947d34853 100644 --- a/Spigot-Server-Patches/0232-Fire-EntityShootBowEvent-for-Illusioner.patch +++ b/Spigot-Server-Patches/0230-Fire-EntityShootBowEvent-for-Illusioner.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fire EntityShootBowEvent for Illusioner diff --git a/src/main/java/net/minecraft/server/EntityIllagerIllusioner.java b/src/main/java/net/minecraft/server/EntityIllagerIllusioner.java -index 2ea0583a3e9f2f13d84673cc412a3f4c9bfaf6f7..81b7cd06f2e1f1f2ce75ba84d47cc18723c2bfb6 100644 +index 350c7f73e7c9dc43c57f6fb29b40760bf00826a3..76fd0513f3c89678809a28b9f1b22940fb5e5f23 100644 --- a/src/main/java/net/minecraft/server/EntityIllagerIllusioner.java +++ b/src/main/java/net/minecraft/server/EntityIllagerIllusioner.java -@@ -138,8 +138,18 @@ public class EntityIllagerIllusioner extends EntityIllagerWizard implements IRan +@@ -134,8 +134,18 @@ public class EntityIllagerIllusioner extends EntityIllagerWizard implements IRan double d3 = (double) MathHelper.sqrt(d0 * d0 + d2 * d2); entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.world.getDifficulty().a() * 4)); @@ -22,7 +22,7 @@ index 2ea0583a3e9f2f13d84673cc412a3f4c9bfaf6f7..81b7cd06f2e1f1f2ce75ba84d47cc187 + if (event.getProjectile() == entityarrow.getBukkitEntity()) { + this.world.addEntity(entityarrow); + } - this.a(SoundEffects.ENTITY_SKELETON_SHOOT, 1.0F, 1.0F / (this.getRandom().nextFloat() * 0.4F + 0.8F)); + this.playSound(SoundEffects.ENTITY_SKELETON_SHOOT, 1.0F, 1.0F / (this.getRandom().nextFloat() * 0.4F + 0.8F)); - this.world.addEntity(entityarrow); + // Paper end } diff --git a/Spigot-Server-Patches/0231-Implement-EntityKnockbackByEntityEvent.patch b/Spigot-Server-Patches/0231-Implement-EntityKnockbackByEntityEvent.patch new file mode 100644 index 000000000..ee17ade14 --- /dev/null +++ b/Spigot-Server-Patches/0231-Implement-EntityKnockbackByEntityEvent.patch @@ -0,0 +1,93 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Brokkonaut +Date: Mon, 18 Jun 2018 15:46:23 +0200 +Subject: [PATCH] Implement EntityKnockbackByEntityEvent + +This event is called when an entity receives knockback by another entity. + +diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java +index a1cfa610eb3cc368b9641feeab709a4f5985ffbe..08141147f9795546e9397abed95834ed5e69a126 100644 +--- a/src/main/java/net/minecraft/server/EntityHuman.java ++++ b/src/main/java/net/minecraft/server/EntityHuman.java +@@ -1085,7 +1085,7 @@ public abstract class EntityHuman extends EntityLiving { + if (flag5) { + if (i > 0) { + if (entity instanceof EntityLiving) { +- ((EntityLiving) entity).a((float) i * 0.5F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F))); ++ ((EntityLiving) entity).doKnockback((float) i * 0.5F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F)), this); // Paper + } else { + entity.h((double) (-MathHelper.sin(this.yaw * 0.017453292F) * (float) i * 0.5F), 0.1D, (double) (MathHelper.cos(this.yaw * 0.017453292F) * (float) i * 0.5F)); + } +@@ -1109,7 +1109,7 @@ public abstract class EntityHuman extends EntityLiving { + if (entityliving != this && entityliving != entity && !this.r(entityliving) && (!(entityliving instanceof EntityArmorStand) || !((EntityArmorStand) entityliving).isMarker()) && this.h((Entity) entityliving) < 9.0D) { + // CraftBukkit start - Only apply knockback if the damage hits + if (entityliving.damageEntity(DamageSource.playerAttack(this).sweep(), f4)) { +- entityliving.a(0.4F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F))); ++ entityliving.doKnockback(0.4F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F)), this); + } + // CraftBukkit end + } +diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java +index a6aa7a1a8da787604b2d8f3f9ea119d4b6bc188d..bb831658d91ffa7d78cd8597509e61f3f14b0890 100644 +--- a/src/main/java/net/minecraft/server/EntityInsentient.java ++++ b/src/main/java/net/minecraft/server/EntityInsentient.java +@@ -1474,7 +1474,7 @@ public abstract class EntityInsentient extends EntityLiving { + + if (flag) { + if (f1 > 0.0F && entity instanceof EntityLiving) { +- ((EntityLiving) entity).a(f1 * 0.5F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F))); ++ ((EntityLiving) entity).doKnockback(f1 * 0.5F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F)), this); + this.setMot(this.getMot().d(0.6D, 1.0D, 0.6D)); + } + +diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java +index 2ffc8eb4615abfaa6a9e99c45ea436cdf6a461c8..a62f769ab509edd30717cfca785449acecdf295e 100644 +--- a/src/main/java/net/minecraft/server/EntityLiving.java ++++ b/src/main/java/net/minecraft/server/EntityLiving.java +@@ -1239,7 +1239,7 @@ public abstract class EntityLiving extends Entity { + } + + this.aw = (float) (MathHelper.d(d1, d0) * 57.2957763671875D - (double) this.yaw); +- this.a(0.4F, d0, d1); ++ this.doKnockback(0.4F, d0, d1, entity1); // Paper + } else { + this.aw = (float) ((int) (Math.random() * 2.0D) * 180); + } +@@ -1287,7 +1287,7 @@ public abstract class EntityLiving extends Entity { + } + + protected void f(EntityLiving entityliving) { +- entityliving.a(0.5F, entityliving.locX() - this.locX(), entityliving.locZ() - this.locZ()); ++ entityliving.doKnockback(0.5F, entityliving.locX() - this.locX(), entityliving.locZ() - this.locZ(), this); + } + + private boolean f(DamageSource damagesource) { +@@ -1524,6 +1524,11 @@ public abstract class EntityLiving extends Entity { + } + + public void a(float f, double d0, double d1) { ++ // Paper start - add knockbacking entity parameter ++ this.doKnockback(f, d0, d1, null); ++ } ++ public void doKnockback(float f, double d0, double d1, Entity knockingBackEntity) { ++ // Paper end - add knockbacking entity parameter + f = (float) ((double) f * (1.0D - this.b(GenericAttributes.KNOCKBACK_RESISTANCE))); + if (f > 0.0F) { + this.impulse = true; +@@ -1531,6 +1536,16 @@ public abstract class EntityLiving extends Entity { + Vec3D vec3d1 = (new Vec3D(d0, 0.0D, d1)).d().a((double) f); + + this.setMot(vec3d.x / 2.0D - vec3d1.x, this.onGround ? Math.min(0.4D, vec3d.y / 2.0D + (double) f) : vec3d.y, vec3d.z / 2.0D - vec3d1.z); ++ ++ // Paper start - call EntityKnockbackByEntityEvent ++ Vec3D currentMot = this.getMot(); ++ org.bukkit.util.Vector delta = new org.bukkit.util.Vector(currentMot.x - vec3d.x, currentMot.y - vec3d.y, currentMot.z - vec3d.z); ++ // Restore old velocity to be able to access it in the event ++ this.setMot(vec3d); ++ if (knockingBackEntity == null || new com.destroystokyo.paper.event.entity.EntityKnockbackByEntityEvent((LivingEntity) getBukkitEntity(), knockingBackEntity.getBukkitEntity(), f, delta).callEvent()) { ++ this.setMot(vec3d.x + delta.getX(), vec3d.y + delta.getY(), vec3d.z + delta.getZ()); ++ } ++ // Paper end + } + } + diff --git a/Spigot-Server-Patches/0234-Expand-Explosions-API.patch b/Spigot-Server-Patches/0232-Expand-Explosions-API.patch similarity index 89% rename from Spigot-Server-Patches/0234-Expand-Explosions-API.patch rename to Spigot-Server-Patches/0232-Expand-Explosions-API.patch index 7f70c3921..a2adaddbe 100644 --- a/Spigot-Server-Patches/0234-Expand-Explosions-API.patch +++ b/Spigot-Server-Patches/0232-Expand-Explosions-API.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Expand Explosions API Add Entity as a Source capability, and add more API choices, and on Location. diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 28a94e473482b414b50ca793564acd409a5dc133..8968bf92b6c2718cbf9519c724bc85d27de54e72 100644 +index 5b4afa9998c7e156353abe80e3ccc3efb4a2d390..efb569b5add5dc7456665fccccc2396d7c3af046 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -877,6 +877,11 @@ public class CraftWorld implements World { +@@ -891,6 +891,11 @@ public class CraftWorld implements World { public boolean createExplosion(double x, double y, double z, float power, boolean setFire, boolean breakBlocks, Entity source) { return !world.createExplosion(source == null ? null : ((CraftEntity) source).getHandle(), x, y, z, power, setFire, breakBlocks ? Explosion.Effect.BREAK : Explosion.Effect.NONE).wasCanceled; } diff --git a/Spigot-Server-Patches/0233-Implement-EntityKnockbackByEntityEvent.patch b/Spigot-Server-Patches/0233-Implement-EntityKnockbackByEntityEvent.patch deleted file mode 100644 index 2b57a2e33..000000000 --- a/Spigot-Server-Patches/0233-Implement-EntityKnockbackByEntityEvent.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Brokkonaut -Date: Mon, 18 Jun 2018 15:46:23 +0200 -Subject: [PATCH] Implement EntityKnockbackByEntityEvent - -This event is called when an entity receives knockback by another entity. - -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 8f6fe004a40b693d1a9945dcab0625c5e9346c01..c1e6792e0d75647108127bcf43bdc9e7bf18aea3 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -1421,6 +1421,16 @@ public abstract class EntityLiving extends Entity { - Vec3D vec3d1 = (new Vec3D(d0, 0.0D, d1)).d().a((double) f); - - this.setMot(vec3d.x / 2.0D - vec3d1.x, this.onGround ? Math.min(0.4D, vec3d.y / 2.0D + (double) f) : vec3d.y, vec3d.z / 2.0D - vec3d1.z); -+ -+ // Paper start - call EntityKnockbackByEntityEvent -+ Vec3D currentMot = this.getMot(); -+ org.bukkit.util.Vector delta = new org.bukkit.util.Vector(currentMot.x - vec3d.x, currentMot.y - vec3d.y, currentMot.z - vec3d.z); -+ // Restore old velocity to be able to access it in the event -+ this.setMot(vec3d); -+ if (entity == null || new com.destroystokyo.paper.event.entity.EntityKnockbackByEntityEvent((LivingEntity) getBukkitEntity(), entity.getBukkitEntity(), f, delta).callEvent()) { -+ this.setMot(vec3d.x + delta.getX(), vec3d.y + delta.getY(), vec3d.z + delta.getZ()); -+ } -+ // Paper end - } - } - diff --git a/Spigot-Server-Patches/0235-LivingEntity-Hand-Raised-Item-Use-API.patch b/Spigot-Server-Patches/0233-LivingEntity-Hand-Raised-Item-Use-API.patch similarity index 74% rename from Spigot-Server-Patches/0235-LivingEntity-Hand-Raised-Item-Use-API.patch rename to Spigot-Server-Patches/0233-LivingEntity-Hand-Raised-Item-Use-API.patch index 98f1be53e..a39fa8287 100644 --- a/Spigot-Server-Patches/0235-LivingEntity-Hand-Raised-Item-Use-API.patch +++ b/Spigot-Server-Patches/0233-LivingEntity-Hand-Raised-Item-Use-API.patch @@ -6,36 +6,36 @@ Subject: [PATCH] LivingEntity Hand Raised/Item Use API How long an entity has raised hands to charge an attack or use an item diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 2a567dca19034ed9071ef09b5371eabb5fff557c..d604728db71d4e61a11fb1ccb7f02b6f6b914a51 100644 +index a62f769ab509edd30717cfca785449acecdf295e..92fcaf425b5ef398fcac6ecf115502a5cf657ebb 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -112,7 +112,7 @@ public abstract class EntityLiving extends Entity { +@@ -118,7 +118,7 @@ public abstract class EntityLiving extends Entity { private float bB; private int jumpTicks; private float bD; - protected ItemStack activeItem; + public ItemStack activeItem; // Paper - public + protected int bk; protected int bl; - protected int bm; private BlockPosition bE; -@@ -2980,10 +2980,12 @@ public abstract class EntityLiving extends Entity { +@@ -3154,10 +3154,12 @@ public abstract class EntityLiving extends Entity { return this.activeItem; } -+ public int getItemUseRemainingTime() { return this.dE(); } // Paper - OBFHELPER - public int dE() { - return this.bl; ++ public int getItemUseRemainingTime() { return this.dY(); } // Paper - OBFHELPER + public int dY() { + return this.bk; } -+ public int getHandRaisedTime() { return this.dF(); } // Paper - OBFHELPER - public int dF() { - return this.isHandRaised() ? this.activeItem.k() - this.dE() : 0; ++ public int getHandRaisedTime() { return this.dZ(); } // Paper - OBFHELPER + public int dZ() { + return this.isHandRaised() ? this.activeItem.k() - this.dY() : 0; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index a8e44e95d6115833f4e20e6bb007842bdc52f1ef..3a87c6574bbad9e6c2d7573eb447194c931d7ec4 100644 +index 38eb8fbac1d5131249dd9ba8b9942b4c85de2c7f..bbe6188f50dd3c456dec5c3239bdcffbfceb3589 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -654,5 +654,25 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -667,5 +667,25 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { public void setShieldBlockingDelay(int delay) { getHandle().setShieldBlockingDelay(delay); } diff --git a/Spigot-Server-Patches/0236-RangedEntity-API.patch b/Spigot-Server-Patches/0234-RangedEntity-API.patch similarity index 97% rename from Spigot-Server-Patches/0236-RangedEntity-API.patch rename to Spigot-Server-Patches/0234-RangedEntity-API.patch index 4d28a1104..3996603c6 100644 --- a/Spigot-Server-Patches/0236-RangedEntity-API.patch +++ b/Spigot-Server-Patches/0234-RangedEntity-API.patch @@ -32,7 +32,7 @@ index 0000000000000000000000000000000000000000..696660b089ba355f865e5051237eefd0 + } +} diff --git a/src/main/java/net/minecraft/server/IRangedEntity.java b/src/main/java/net/minecraft/server/IRangedEntity.java -index b4178ce1e86ad40b64a229e066f058a8e848324d..9b79ac77db880930fcb86744924bf0baa92bef31 100644 +index b4178ce1e86ad40b64a229e066f058a8e848324d..fbfed5140539384bdd31e0f2777a3f92690d2576 100644 --- a/src/main/java/net/minecraft/server/IRangedEntity.java +++ b/src/main/java/net/minecraft/server/IRangedEntity.java @@ -2,5 +2,8 @@ package net.minecraft.server; @@ -43,7 +43,7 @@ index b4178ce1e86ad40b64a229e066f058a8e848324d..9b79ac77db880930fcb86744924bf0ba + void a(EntityLiving entityliving, float f); default void rangedAttack(EntityLiving entityliving, float f) { a(entityliving, f); } // Paper - OBFHELPER + + // - see EntitySkeletonAbstract melee goal -+ void q(boolean flag); default void setChargingAttack(boolean charging) { q(charging); }; // Paper ++ void setAggressive(boolean flag); default void setChargingAttack(boolean charging) { setAggressive(charging); }; // Paper } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftDrowned.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftDrowned.java index 6e41dfd92344e3de71642879993cf25a5dd8b30a..390183fffd952e583a7d7df9ae618458fb48d278 100644 diff --git a/Spigot-Server-Patches/0237-Add-config-to-disable-ender-dragon-legacy-check.patch b/Spigot-Server-Patches/0235-Add-config-to-disable-ender-dragon-legacy-check.patch similarity index 65% rename from Spigot-Server-Patches/0237-Add-config-to-disable-ender-dragon-legacy-check.patch rename to Spigot-Server-Patches/0235-Add-config-to-disable-ender-dragon-legacy-check.patch index 94736ffd2..166e3a275 100644 --- a/Spigot-Server-Patches/0237-Add-config-to-disable-ender-dragon-legacy-check.patch +++ b/Spigot-Server-Patches/0235-Add-config-to-disable-ender-dragon-legacy-check.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add config to disable ender dragon legacy check diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 33ce9a500430a01650e69a3568c8b03db325a936..cea15d50ed89430ee8d8cff9de21e1fc7982e1d8 100644 +index 35075ffac394153e28039809e0ed48fe066a6223..6352051ab937d4d365e823a7112e76dc3ec34225 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -372,4 +372,9 @@ public class PaperWorldConfig { +@@ -367,4 +367,9 @@ public class PaperWorldConfig { private void shieldBlockingDelay() { shieldBlockingDelay = getInt("game-mechanics.shield-blocking-delay", 5); } @@ -19,30 +19,30 @@ index 33ce9a500430a01650e69a3568c8b03db325a936..cea15d50ed89430ee8d8cff9de21e1fc + } } diff --git a/src/main/java/net/minecraft/server/EnderDragonBattle.java b/src/main/java/net/minecraft/server/EnderDragonBattle.java -index 06748118494f2cc8cd692511e3b0bfd269fd249c..687efa022df41c23b5ffcce2efc2edcd8bd12dd6 100644 +index 356defd19ebba5b051b7dbdcc21f0139bbdc4a84..69faefbdbf338b38311cd2a5d3183a104ec36f86 100644 --- a/src/main/java/net/minecraft/server/EnderDragonBattle.java +++ b/src/main/java/net/minecraft/server/EnderDragonBattle.java @@ -28,10 +28,10 @@ public class EnderDragonBattle { private int h; private int i; private int j; -- private boolean k; -+ private boolean k; private void setDragonKilled(boolean dragonKilled) { this.k = dragonKilled; } // Paper - OBFHELPER - private boolean l; - public UUID m; // CraftBukkit PAIL private -> public, rename dragonUUID +- private boolean dragonKilled; ++ private boolean dragonKilled; private void setDragonKilled(boolean dragonKilled) { this.dragonKilled = dragonKilled; } // Paper - OBFHELPER + private boolean previouslyKilled; + public UUID dragonUUID; - private boolean n; + private boolean n; private void setScanForLegacyFight(boolean scanForLegacyFight) { this.n = scanForLegacyFight; } private boolean scanForLegacyFight() { return this.n; } // Paper - OBFHELPER - public BlockPosition o; // CraftBukkit PAIL private -> public, rename portalLocation - public EnumDragonRespawn p; // CraftBukkit PAIL private -> public, rename respawnPhase + public BlockPosition exitPortalLocation; + public EnumDragonRespawn respawnPhase; private int q; @@ -41,6 +41,10 @@ public class EnderDragonBattle { - this.bossBattle = (BossBattleServer) (new BossBattleServer(new ChatMessage("entity.minecraft.ender_dragon", new Object[0]), BossBattle.BarColor.PINK, BossBattle.BarStyle.PROGRESS)).setPlayMusic(true).c(true); - this.e = Lists.newArrayList(); + this.bossBattle = (BossBattleServer) (new BossBattleServer(new ChatMessage("entity.minecraft.ender_dragon"), BossBattle.BarColor.PINK, BossBattle.BarStyle.PROGRESS)).setPlayMusic(true).c(true); + this.gateways = Lists.newArrayList(); this.n = true; + // Paper start + setScanForLegacyFight(worldserver.paperConfig.scanForLegacyEnderDragon); + if (!scanForLegacyFight()) setDragonKilled(true); + // Paper end - this.d = worldserver; + this.world = worldserver; if (nbttagcompound.hasKeyOfType("DragonKilled", 99)) { - if (nbttagcompound.b("DragonUUID")) { + if (nbttagcompound.b("Dragon")) { diff --git a/Spigot-Server-Patches/0238-Implement-World.getEntity-UUID-API.patch b/Spigot-Server-Patches/0236-Implement-World.getEntity-UUID-API.patch similarity index 84% rename from Spigot-Server-Patches/0238-Implement-World.getEntity-UUID-API.patch rename to Spigot-Server-Patches/0236-Implement-World.getEntity-UUID-API.patch index e0c5971e1..277d25275 100644 --- a/Spigot-Server-Patches/0238-Implement-World.getEntity-UUID-API.patch +++ b/Spigot-Server-Patches/0236-Implement-World.getEntity-UUID-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Implement World.getEntity(UUID) API diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 8968bf92b6c2718cbf9519c724bc85d27de54e72..a59172ff043e5220ffdd363582c38ae53c429f1a 100644 +index efb569b5add5dc7456665fccccc2396d7c3af046..0bfe87fe4ff0fbb94a3339ab8f8d62ca32d659a0 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -1291,6 +1291,15 @@ public class CraftWorld implements World { +@@ -1305,6 +1305,15 @@ public class CraftWorld implements World { return list; } diff --git a/Spigot-Server-Patches/0239-InventoryCloseEvent-Reason-API.patch b/Spigot-Server-Patches/0237-InventoryCloseEvent-Reason-API.patch similarity index 83% rename from Spigot-Server-Patches/0239-InventoryCloseEvent-Reason-API.patch rename to Spigot-Server-Patches/0237-InventoryCloseEvent-Reason-API.patch index 7a662125a..40722aa0a 100644 --- a/Spigot-Server-Patches/0239-InventoryCloseEvent-Reason-API.patch +++ b/Spigot-Server-Patches/0237-InventoryCloseEvent-Reason-API.patch @@ -7,11 +7,11 @@ Allows you to determine why an inventory was closed, enabling plugin developers to "confirm" things based on if it was player triggered close or not. diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index 6e9dd4d3717567f54ac706715d75bf53d48c5f7d..684978be7ccc401b71b0594828a7783b209a5210 100644 +index 08141147f9795546e9397abed95834ed5e69a126..d9e5d71a87140c90b79902887bd2f481f02956dc 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -164,7 +164,7 @@ public abstract class EntityHuman extends EntityLiving { - this.dW(); +@@ -155,7 +155,7 @@ public abstract class EntityHuman extends EntityLiving { + this.es(); super.tick(); if (!this.world.isClientSide && this.activeContainer != null && !this.activeContainer.canUse(this)) { - this.closeInventory(); @@ -19,7 +19,7 @@ index 6e9dd4d3717567f54ac706715d75bf53d48c5f7d..684978be7ccc401b71b0594828a7783b this.activeContainer = this.defaultContainer; } -@@ -363,6 +363,13 @@ public abstract class EntityHuman extends EntityLiving { +@@ -350,6 +350,13 @@ public abstract class EntityHuman extends EntityLiving { return 20; } @@ -34,10 +34,10 @@ index 6e9dd4d3717567f54ac706715d75bf53d48c5f7d..684978be7ccc401b71b0594828a7783b this.activeContainer = this.defaultContainer; } diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 88692d9eaea57a4d172d537a6cf2a3bffe058d54..f35d23340665ab323732915efc0c0ad7fe4d964d 100644 +index d2c61467b8373444609a6aad9688c5b747547d9c..dc8f88d102c06d8fb28ffd66de36f32efec54ff2 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -368,7 +368,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -408,7 +408,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } // Paper end if (!this.world.isClientSide && !this.activeContainer.canUse(this)) { @@ -46,7 +46,7 @@ index 88692d9eaea57a4d172d537a6cf2a3bffe058d54..f35d23340665ab323732915efc0c0ad7 this.activeContainer = this.defaultContainer; } -@@ -542,7 +542,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -582,7 +582,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { // SPIGOT-943 - only call if they have an inventory open if (this.activeContainer != this.defaultContainer) { @@ -55,7 +55,7 @@ index 88692d9eaea57a4d172d537a6cf2a3bffe058d54..f35d23340665ab323732915efc0c0ad7 } String deathMessage = event.getDeathMessage(); -@@ -1057,7 +1057,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -1163,7 +1163,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { return OptionalInt.empty(); } else { if (this.activeContainer != this.defaultContainer) { @@ -64,7 +64,7 @@ index 88692d9eaea57a4d172d537a6cf2a3bffe058d54..f35d23340665ab323732915efc0c0ad7 } this.nextContainerCounter(); -@@ -1117,7 +1117,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -1223,7 +1223,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } // CraftBukkit end if (this.activeContainer != this.defaultContainer) { @@ -73,7 +73,7 @@ index 88692d9eaea57a4d172d537a6cf2a3bffe058d54..f35d23340665ab323732915efc0c0ad7 } // this.nextContainerCounter(); // CraftBukkit - moved up -@@ -1181,7 +1181,12 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -1287,7 +1287,12 @@ public class EntityPlayer extends EntityHuman implements ICrafting { @Override public void closeInventory() { @@ -85,26 +85,26 @@ index 88692d9eaea57a4d172d537a6cf2a3bffe058d54..f35d23340665ab323732915efc0c0ad7 + CraftEventFactory.handleInventoryCloseEvent(this, reason); // CraftBukkit + // Paper end this.playerConnection.sendPacket(new PacketPlayOutCloseWindow(this.activeContainer.windowId)); - this.m(); + this.o(); } diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index a357b6167405be4034cf3dad4124827e04278366..0c9e46a8973436a4438730a49986c88f12829be1 100644 +index 411e6ff17ac50a410da038ad538ad56ba3aef8a8..201b2b0dcbaf6765390c18052f3b3450e63066e4 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -2040,7 +2040,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -2080,7 +2080,7 @@ public class PlayerConnection implements PacketListenerPlayIn { PlayerConnectionUtils.ensureMainThread(packetplayinclosewindow, this, this.player.getWorldServer()); if (this.player.isFrozen()) return; // CraftBukkit - CraftEventFactory.handleInventoryCloseEvent(this.player); // CraftBukkit + CraftEventFactory.handleInventoryCloseEvent(this.player, org.bukkit.event.inventory.InventoryCloseEvent.Reason.PLAYER); // CraftBukkit // Paper - this.player.m(); + this.player.o(); } diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 46ea6d8e487d0c051780b0bdb06622e515cd987f..950afb131bbea53e46393fa19b0bfbb9d5c647f5 100644 +index 9d05320b132679ccd511422c2c187b0d5fa89c2c..4c11aa13b725b2bb502701f2d5fb3878ff162f05 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -390,7 +390,7 @@ public abstract class PlayerList { +@@ -420,7 +420,7 @@ public abstract class PlayerList { entityplayer.a(StatisticList.LEAVE_GAME); // CraftBukkit start - Quitting must be before we do final save of data, in case plugins need to modify it @@ -114,10 +114,10 @@ index 46ea6d8e487d0c051780b0bdb06622e515cd987f..950afb131bbea53e46393fa19b0bfbb9 PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(cserver.getPlayer(entityplayer), "\u00A7e" + entityplayer.getName() + " left the game"); cserver.getPluginManager().callEvent(playerQuitEvent); diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index a834a77b2de8f7287be69fd5d002ff43261a9a85..d4e963c169f847acce882dfba067be0d64638ec4 100644 +index 10eb83bec33050ec1054de493960c87f67d4ec66..4675ddb1f7c989521dfc9fbd0367e6fbbaa7abda 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1045,7 +1045,7 @@ public class WorldServer extends World { +@@ -967,7 +967,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { for (TileEntity tileentity : chunk.getTileEntities().values()) { if (tileentity instanceof IInventory) { for (org.bukkit.entity.HumanEntity h : Lists.newArrayList(((IInventory) tileentity).getViewers())) { @@ -126,7 +126,7 @@ index a834a77b2de8f7287be69fd5d002ff43261a9a85..d4e963c169f847acce882dfba067be0d } } } -@@ -1103,7 +1103,7 @@ public class WorldServer extends World { +@@ -1025,7 +1025,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { // Spigot Start if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder) { for (org.bukkit.entity.HumanEntity h : Lists.newArrayList(((org.bukkit.inventory.InventoryHolder) entity.getBukkitEntity()).getInventory().getViewers())) { @@ -136,10 +136,10 @@ index a834a77b2de8f7287be69fd5d002ff43261a9a85..d4e963c169f847acce882dfba067be0d } // Spigot End diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -index 20f0783025516048851aedef0a70759c2953ae47..a6d75c0e07a25fdb59dde2e3eb2a0213c7112515 100644 +index fe8a21202340c5892f5166ec294212c6e44ed3a5..00d67c9911c52ddcdf48fda7998bcd2a8a35f0eb 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -@@ -467,8 +467,13 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { +@@ -436,8 +436,13 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { @Override public void closeInventory() { @@ -155,10 +155,10 @@ index 20f0783025516048851aedef0a70759c2953ae47..a6d75c0e07a25fdb59dde2e3eb2a0213 @Override public boolean isBlocking() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index f5c722644a1955c9bc68c89fdbb84526f9bbb7a0..368f786300573ff24a8dc46d96a6fb6bac26b35a 100644 +index b19072c26a37d577888cfefce612487d61aadd61..c7e43f5015851d44870986c6cd6c43b3332cf9be 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -784,7 +784,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -791,7 +791,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { // Close any foreign inventory if (getHandle().activeContainer != getHandle().defaultContainer) { @@ -168,10 +168,10 @@ index f5c722644a1955c9bc68c89fdbb84526f9bbb7a0..368f786300573ff24a8dc46d96a6fb6b // Check if the fromWorld and toWorld are the same. diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index b9e011256f0c8f67808ebebb5e9dc63d3358849f..4a76402c01dfe6525bae8728da2dde6e5d673765 100644 +index 5bcf38d3fcfa569c50d66ed67ad22db7e7d36207..72f495327fe56e7d7ba41e39e99a69622a6861b2 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -1301,12 +1301,22 @@ public class CraftEventFactory { +@@ -1334,12 +1334,22 @@ public class CraftEventFactory { return event; } diff --git a/Spigot-Server-Patches/0240-Configurable-Bed-Search-Radius.patch b/Spigot-Server-Patches/0238-Configurable-Bed-Search-Radius.patch similarity index 89% rename from Spigot-Server-Patches/0240-Configurable-Bed-Search-Radius.patch rename to Spigot-Server-Patches/0238-Configurable-Bed-Search-Radius.patch index b56a18a87..4e8d577fb 100644 --- a/Spigot-Server-Patches/0240-Configurable-Bed-Search-Radius.patch +++ b/Spigot-Server-Patches/0238-Configurable-Bed-Search-Radius.patch @@ -10,10 +10,10 @@ player at their bed should it of became obstructed. Defaults to vanilla 1. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index cea15d50ed89430ee8d8cff9de21e1fc7982e1d8..387e0dcb9f01ad947daaa19211331a96742ce004 100644 +index 6352051ab937d4d365e823a7112e76dc3ec34225..d6a3d882e375ac5a2b6ec8920532db615f4fe4ef 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -377,4 +377,15 @@ public class PaperWorldConfig { +@@ -372,4 +372,15 @@ public class PaperWorldConfig { private void scanForLegacyEnderDragon() { scanForLegacyEnderDragon = getBoolean("game-mechanics.scan-for-legacy-ender-dragon", true); } @@ -30,24 +30,23 @@ index cea15d50ed89430ee8d8cff9de21e1fc7982e1d8..387e0dcb9f01ad947daaa19211331a96 + } } diff --git a/src/main/java/net/minecraft/server/BlockBed.java b/src/main/java/net/minecraft/server/BlockBed.java -index 7947563426f7f1cc9364d7b6f71256bf3beea463..e0bc6080ef29258473ec3ef7ffa7c246f08ac146 100644 +index 7604d79468ce8d7d1a4f45872a5db0c700419029..e7bd9061cceba284443b75cc5506e1b9f2ef42e8 100644 --- a/src/main/java/net/minecraft/server/BlockBed.java +++ b/src/main/java/net/minecraft/server/BlockBed.java -@@ -196,6 +196,9 @@ public class BlockBed extends BlockFacingHorizontal implements ITileEntity { +@@ -199,6 +199,8 @@ public class BlockBed extends BlockFacingHorizontal implements ITileEntity { public static Optional a(EntityTypes entitytypes, IWorldReader iworldreader, BlockPosition blockposition, int i) { EnumDirection enumdirection = (EnumDirection) iworldreader.getType(blockposition).get(BlockBed.FACING); + // Paper start - configurable bed search radius + if (entitytypes == EntityTypes.PLAYER) return findSafePosition(entitytypes, (World) iworldreader, enumdirection, blockposition); -+ int j = blockposition.getX(); int k = blockposition.getY(); int l = blockposition.getZ(); -@@ -225,7 +228,104 @@ public class BlockBed extends BlockFacingHorizontal implements ITileEntity { +@@ -228,7 +230,104 @@ public class BlockBed extends BlockFacingHorizontal implements ITileEntity { return Optional.empty(); } -- protected static Optional a(EntityTypes entitytypes, IWorldReader iworldreader, BlockPosition blockposition) { +- public static Optional a(EntityTypes entitytypes, IWorldReader iworldreader, BlockPosition blockposition) { + private static Optional findSafePosition(EntityTypes entitytypes, World world, EnumDirection updirection, BlockPosition blockposition){ + int radius = world.paperConfig.bedSearchRadius; + double angle = Math.PI / 2; @@ -143,15 +142,15 @@ index 7947563426f7f1cc9364d7b6f71256bf3beea463..e0bc6080ef29258473ec3ef7ffa7c246 + // Paper end + + // Paper start -- add maxBelow param -+ protected static Optional a(EntityTypes entitytypes, IWorldReader iworldreader, BlockPosition blockposition) { return isSafeRespawn(entitytypes, iworldreader, blockposition, 2); } -+ protected static Optional isSafeRespawn(EntityTypes entitytypes, IWorldReader iworldreader, BlockPosition blockposition, int maxBelow) { ++ public static Optional a(EntityTypes entitytypes, IWorldReader iworldreader, BlockPosition blockposition) { return isSafeRespawn(entitytypes, iworldreader, blockposition, 2); } ++ public static Optional isSafeRespawn(EntityTypes entitytypes, IWorldReader iworldreader, BlockPosition blockposition, int maxBelow) { + // Paper end VoxelShape voxelshape = iworldreader.getType(blockposition).getCollisionShape(iworldreader, blockposition); if (voxelshape.c(EnumDirection.EnumAxis.Y) > 0.4375D) { -@@ -233,7 +333,7 @@ public class BlockBed extends BlockFacingHorizontal implements ITileEntity { +@@ -236,7 +335,7 @@ public class BlockBed extends BlockFacingHorizontal implements ITileEntity { } else { - BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition(blockposition); + BlockPosition.MutableBlockPosition blockposition_mutableblockposition = blockposition.i(); - while (blockposition_mutableblockposition.getY() >= 0 && blockposition.getY() - blockposition_mutableblockposition.getY() <= 2 && iworldreader.getType(blockposition_mutableblockposition).getCollisionShape(iworldreader, blockposition_mutableblockposition).isEmpty()) { + while (blockposition_mutableblockposition.getY() >= 0 && blockposition.getY() - blockposition_mutableblockposition.getY() <= maxBelow && iworldreader.getType(blockposition_mutableblockposition).getCollisionShape(iworldreader, blockposition_mutableblockposition).isEmpty()) { // Paper -- configurable max distance to search below diff --git a/Spigot-Server-Patches/0241-Vex-getSummoner-API.patch b/Spigot-Server-Patches/0239-Vex-getSummoner-API.patch similarity index 85% rename from Spigot-Server-Patches/0241-Vex-getSummoner-API.patch rename to Spigot-Server-Patches/0239-Vex-getSummoner-API.patch index 07dedcc9c..82527c6c5 100644 --- a/Spigot-Server-Patches/0241-Vex-getSummoner-API.patch +++ b/Spigot-Server-Patches/0239-Vex-getSummoner-API.patch @@ -6,15 +6,15 @@ Subject: [PATCH] Vex#getSummoner API Get's the NPC that summoned this Vex diff --git a/src/main/java/net/minecraft/server/EntityVex.java b/src/main/java/net/minecraft/server/EntityVex.java -index cd9fb3aabfca254ca522d39a25e54ceda0b6f5fc..a46730460e5d9f6e52d63ba1950d1e7195fe87cd 100644 +index 1eb39fd5cc4fd3b070dcaf64c467da76f99456fc..ab4ac736f8fcda1ed6b58abe0a4ecba58d3b5d43 100644 --- a/src/main/java/net/minecraft/server/EntityVex.java +++ b/src/main/java/net/minecraft/server/EntityVex.java -@@ -92,6 +92,7 @@ public class EntityVex extends EntityMonster { +@@ -89,6 +89,7 @@ public class EntityVex extends EntityMonster { } -+ public EntityInsentient getOwner() { return l(); } // Paper - OBFHELPER - public EntityInsentient l() { ++ public EntityInsentient getOwner() { return eL(); } // Paper - OBFHELPER + public EntityInsentient eL() { return this.c; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java diff --git a/Spigot-Server-Patches/0242-Refresh-player-inventory-when-cancelling-PlayerInter.patch b/Spigot-Server-Patches/0240-Refresh-player-inventory-when-cancelling-PlayerInter.patch similarity index 89% rename from Spigot-Server-Patches/0242-Refresh-player-inventory-when-cancelling-PlayerInter.patch rename to Spigot-Server-Patches/0240-Refresh-player-inventory-when-cancelling-PlayerInter.patch index cdd72c5f1..ffd4555d0 100644 --- a/Spigot-Server-Patches/0242-Refresh-player-inventory-when-cancelling-PlayerInter.patch +++ b/Spigot-Server-Patches/0240-Refresh-player-inventory-when-cancelling-PlayerInter.patch @@ -16,10 +16,10 @@ Refresh the player inventory when PlayerInteractEntityEvent is cancelled to avoid this problem. diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index eb53d8bb5c36482c39afeb6c324a620d2c7b21fb..4fb5c47fc8505c6a6e68d21a240887a0cbe10d14 100644 +index 201b2b0dcbaf6765390c18052f3b3450e63066e4..e3391017b3dcfbfc942b84118391928a6a5b807c 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1950,6 +1950,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -1989,6 +1989,7 @@ public class PlayerConnection implements PacketListenerPlayIn { } if (event.isCancelled()) { diff --git a/Spigot-Server-Patches/0243-Don-t-change-the-Entity-Random-seed-for-squids.patch b/Spigot-Server-Patches/0241-Don-t-change-the-Entity-Random-seed-for-squids.patch similarity index 82% rename from Spigot-Server-Patches/0243-Don-t-change-the-Entity-Random-seed-for-squids.patch rename to Spigot-Server-Patches/0241-Don-t-change-the-Entity-Random-seed-for-squids.patch index aba93c9b6..6b945b033 100644 --- a/Spigot-Server-Patches/0243-Don-t-change-the-Entity-Random-seed-for-squids.patch +++ b/Spigot-Server-Patches/0241-Don-t-change-the-Entity-Random-seed-for-squids.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Don't change the Entity Random seed for squids diff --git a/src/main/java/net/minecraft/server/EntitySquid.java b/src/main/java/net/minecraft/server/EntitySquid.java -index 1c1ff2069d6daaf866a3e80a9b3ce78b19941384..92efe4e7f50fa10bcdff52fb51a9b814d995c8c9 100644 +index 9c9ec8226ab43beaae0ef4abc97632b503e2120c..c9c0b2ab265666986cdedf920955ee55ebbedaf3 100644 --- a/src/main/java/net/minecraft/server/EntitySquid.java +++ b/src/main/java/net/minecraft/server/EntitySquid.java @@ -21,7 +21,7 @@ public class EntitySquid extends EntityWaterAnimal { @@ -14,6 +14,6 @@ index 1c1ff2069d6daaf866a3e80a9b3ce78b19941384..92efe4e7f50fa10bcdff52fb51a9b814 super(entitytypes, world); - this.random.setSeed((long) this.getId()); + //this.random.setSeed((long) this.getId()); // Paper - this.bC = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F; + this.bB = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F; } diff --git a/Spigot-Server-Patches/0244-Re-add-vanilla-entity-warnings-for-duplicates.patch b/Spigot-Server-Patches/0242-Re-add-vanilla-entity-warnings-for-duplicates.patch similarity index 86% rename from Spigot-Server-Patches/0244-Re-add-vanilla-entity-warnings-for-duplicates.patch rename to Spigot-Server-Patches/0242-Re-add-vanilla-entity-warnings-for-duplicates.patch index 7fca9a213..04fb42eb8 100644 --- a/Spigot-Server-Patches/0244-Re-add-vanilla-entity-warnings-for-duplicates.patch +++ b/Spigot-Server-Patches/0242-Re-add-vanilla-entity-warnings-for-duplicates.patch @@ -8,10 +8,10 @@ These are a critical sign that somethin went wrong, and you've lost some data... We should kind of know about these things you know. diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index d4e963c169f847acce882dfba067be0d64638ec4..1019f180397abef5ec28d00c432415a7270026e2 100644 +index 4675ddb1f7c989521dfc9fbd0367e6fbbaa7abda..57be6e9c0062cfe94ad551abd7e8bea1213a10b6 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1035,7 +1035,8 @@ public class WorldServer extends World { +@@ -957,7 +957,8 @@ public class WorldServer extends World implements GeneratorAccessSeed { if (entity1 == null) { return false; } else { diff --git a/Spigot-Server-Patches/0245-Avoid-item-merge-if-stack-size-above-max-stack-size.patch b/Spigot-Server-Patches/0243-Avoid-item-merge-if-stack-size-above-max-stack-size.patch similarity index 83% rename from Spigot-Server-Patches/0245-Avoid-item-merge-if-stack-size-above-max-stack-size.patch rename to Spigot-Server-Patches/0243-Avoid-item-merge-if-stack-size-above-max-stack-size.patch index 8c3350c02..84e8774cb 100644 --- a/Spigot-Server-Patches/0245-Avoid-item-merge-if-stack-size-above-max-stack-size.patch +++ b/Spigot-Server-Patches/0243-Avoid-item-merge-if-stack-size-above-max-stack-size.patch @@ -5,13 +5,13 @@ Subject: [PATCH] Avoid item merge if stack size above max stack size diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java -index 5efcc50ab9e8a99d88a9d2e7f15ecbcc4439b93e..e5c9bac88a59d52c9b2f05df3e4f373edbe009ca 100644 +index cc173445caa0a064e724bc29b4955232a1dc1816..aad23b2c6cd674e05e609c4c019205978c6741f2 100644 --- a/src/main/java/net/minecraft/server/EntityItem.java +++ b/src/main/java/net/minecraft/server/EntityItem.java -@@ -170,6 +170,10 @@ public class EntityItem extends Entity { +@@ -177,6 +177,10 @@ public class EntityItem extends Entity { private void mergeNearby() { - if (this.w()) { + if (this.z()) { + // Paper start - avoid item merge if stack size above max stack size + ItemStack stack = getItemStack(); + if (stack.getCount() >= stack.getMaxStackSize()) return; diff --git a/Spigot-Server-Patches/0246-Use-asynchronous-Log4j-2-loggers.patch b/Spigot-Server-Patches/0244-Use-asynchronous-Log4j-2-loggers.patch similarity index 95% rename from Spigot-Server-Patches/0246-Use-asynchronous-Log4j-2-loggers.patch rename to Spigot-Server-Patches/0244-Use-asynchronous-Log4j-2-loggers.patch index 7ddc8755f..a4a182558 100644 --- a/Spigot-Server-Patches/0246-Use-asynchronous-Log4j-2-loggers.patch +++ b/Spigot-Server-Patches/0244-Use-asynchronous-Log4j-2-loggers.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Use asynchronous Log4j 2 loggers diff --git a/pom.xml b/pom.xml -index 8ad07cf6e03cbc5354d2dd2b149b51bbb5067a9d..fc2921e9783f2db63b71c6e244e24c9416cdbf76 100644 +index accd4b6521b18495c933a50ed511b173cbb71861..6cde6f7dcbb3ff2fda0189a06573640777548d27 100644 --- a/pom.xml +++ b/pom.xml @@ -77,6 +77,13 @@ diff --git a/Spigot-Server-Patches/0245-add-more-information-to-Entity.toString.patch b/Spigot-Server-Patches/0245-add-more-information-to-Entity.toString.patch new file mode 100644 index 000000000..e888f67d6 --- /dev/null +++ b/Spigot-Server-Patches/0245-add-more-information-to-Entity.toString.patch @@ -0,0 +1,20 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Thu, 19 Jul 2018 01:13:28 -0400 +Subject: [PATCH] add more information to Entity.toString() + +UUID, ticks lived, valid, dead + +diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +index 2dfc881894753469080a5038c770e126cb19a806..50f9d217494ab2823596523839d5992fc480912d 100644 +--- a/src/main/java/net/minecraft/server/Entity.java ++++ b/src/main/java/net/minecraft/server/Entity.java +@@ -2435,7 +2435,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke + } + + public String toString() { +- return String.format(Locale.ROOT, "%s['%s'/%d, l='%s', x=%.2f, y=%.2f, z=%.2f]", this.getClass().getSimpleName(), this.getDisplayName().getString(), this.id, this.world == null ? "~NULL~" : this.world.toString(), this.locX(), this.locY(), this.locZ()); ++ return String.format(Locale.ROOT, "%s['%s'/%d, uuid='%s', l='%s', x=%.2f, y=%.2f, z=%.2f, cx=%d, cz=%d, tl=%d, v=%b, d=%b]", new Object[] { this.getClass().getSimpleName(), this.getDisplayName().getString(), Integer.valueOf(this.id), this.uniqueID.toString(), this.world == null ? "~NULL~" : this.world.toString(), Double.valueOf(this.locX()), Double.valueOf(this.locY()), Double.valueOf(this.locZ()), getChunkX(), getChunkZ(), this.ticksLived, this.valid, this.dead}); // Paper - add more information + } + + public boolean isInvulnerable(DamageSource damagesource) { diff --git a/Spigot-Server-Patches/0248-Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch b/Spigot-Server-Patches/0246-Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch similarity index 75% rename from Spigot-Server-Patches/0248-Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch rename to Spigot-Server-Patches/0246-Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch index 18a7c9930..931987389 100644 --- a/Spigot-Server-Patches/0248-Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch +++ b/Spigot-Server-Patches/0246-Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Add Debug Entities option to debug dupe uuid issues Add -Ddebug.entities=true to your JVM flags to gain more information diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index fe730cd301e6bae46320355ee8cb67d406a72a9f..5fd57a3d30972d86c62025d63cd57b56a147cc94 100644 +index 50f9d217494ab2823596523839d5992fc480912d..8e128fa303b345a10535630fd58442435ef1e439 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -76,6 +76,8 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -19,18 +19,18 @@ index fe730cd301e6bae46320355ee8cb67d406a72a9f..5fd57a3d30972d86c62025d63cd57b56 if (bukkitEntity == null) { bukkitEntity = CraftEntity.getEntity(world.getServer(), this); diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 7804cc0f6a02d14f4adbe05b37e8470a382c0d26..4ee26ff08f7a058648ab54f0dcd81b466a9aced1 100644 +index 4ae3e91677ecf9c2104a229b4e8b229d18b87aa4..458802dc4b1f923b159168efff0546bb731da07b 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -1064,6 +1064,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - } else { - PlayerChunkMap.EntityTracker playerchunkmap_entitytracker = new PlayerChunkMap.EntityTracker(entity, i, j, entitytypes.isDeltaTracking()); +@@ -1093,6 +1093,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + } else { + PlayerChunkMap.EntityTracker playerchunkmap_entitytracker = new PlayerChunkMap.EntityTracker(entity, i, j, entitytypes.isDeltaTracking()); -+ entity.tracker = playerchunkmap_entitytracker; // Paper - Fast access to tracker - this.trackedEntities.put(entity.getId(), playerchunkmap_entitytracker); - playerchunkmap_entitytracker.track(this.world.getPlayers()); - if (entity instanceof EntityPlayer) { -@@ -1106,7 +1107,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { ++ entity.tracker = playerchunkmap_entitytracker; // Paper - Fast access to tracker + this.trackedEntities.put(entity.getId(), playerchunkmap_entitytracker); + playerchunkmap_entitytracker.track(this.world.getPlayers()); + if (entity instanceof EntityPlayer) { +@@ -1134,7 +1135,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { if (playerchunkmap_entitytracker1 != null) { playerchunkmap_entitytracker1.a(); } @@ -40,10 +40,10 @@ index 7804cc0f6a02d14f4adbe05b37e8470a382c0d26..4ee26ff08f7a058648ab54f0dcd81b46 protected void g() { diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 08bed18ad6f78c6aad444eeb5a321887d90e5829..9a001a2a7934dc87f3e57d3388a8a888ec43908b 100644 +index 324967c892ff8878326af4229668fcbde37ef202..5540fc6eee8115400774b7a792b9d3b45eb01e34 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -63,6 +63,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -68,6 +68,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { public boolean pvpMode; public boolean keepSpawnInMemory = true; public org.bukkit.generator.ChunkGenerator generator; @@ -52,20 +52,20 @@ index 08bed18ad6f78c6aad444eeb5a321887d90e5829..9a001a2a7934dc87f3e57d3388a8a888 public boolean captureBlockStates = false; public boolean captureTreeGeneration = false; diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 1019f180397abef5ec28d00c432415a7270026e2..5086a854b84b05e5b9c0f5677051d19dfa42f343 100644 +index 57be6e9c0062cfe94ad551abd7e8bea1213a10b6..fc6639d9729b2714389f191de7a21cb1aa853c75 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -76,6 +76,9 @@ public class WorldServer extends World { - // CraftBukkit start - private int tickPosition; +@@ -83,6 +83,9 @@ public class WorldServer extends World implements GeneratorAccessSeed { + public final Convertable.ConversionSession convertable; + public final UUID uuid; boolean hasPhysicsEvent = true; // Paper + private static Throwable getAddToWorldStackTrace(Entity entity) { + return new Throwable(entity + " Added to world at " + new java.util.Date()); + } - // Add env and gen to constructor - public WorldServer(MinecraftServer minecraftserver, Executor executor, WorldNBTStorage worldnbtstorage, WorldData worlddata, DimensionManager dimensionmanager, GameProfilerFiller gameprofilerfiller, WorldLoadListener worldloadlistener, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { -@@ -997,8 +1000,28 @@ public class WorldServer extends World { + @Override public Chunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI + return this.chunkProvider.getChunkAt(x, z, false); +@@ -919,8 +922,28 @@ public class WorldServer extends World implements GeneratorAccessSeed { // CraftBukkit start private boolean addEntity0(Entity entity, CreatureSpawnEvent.SpawnReason spawnReason) { org.spigotmc.AsyncCatcher.catchOp("entity add"); // Spigot @@ -95,7 +95,7 @@ index 1019f180397abef5ec28d00c432415a7270026e2..5086a854b84b05e5b9c0f5677051d19d // WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getName(entity.getEntityType())); // CraftBukkit return false; } else if (this.isUUIDTaken(entity)) { -@@ -1158,7 +1181,24 @@ public class WorldServer extends World { +@@ -1080,7 +1103,24 @@ public class WorldServer extends World implements GeneratorAccessSeed { } } diff --git a/Spigot-Server-Patches/0249-EnderDragon-Events.patch b/Spigot-Server-Patches/0247-EnderDragon-Events.patch similarity index 86% rename from Spigot-Server-Patches/0249-EnderDragon-Events.patch rename to Spigot-Server-Patches/0247-EnderDragon-Events.patch index eb756a610..b02fa9d77 100644 --- a/Spigot-Server-Patches/0249-EnderDragon-Events.patch +++ b/Spigot-Server-Patches/0247-EnderDragon-Events.patch @@ -5,7 +5,7 @@ Subject: [PATCH] EnderDragon Events diff --git a/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java b/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java -index 40a8beff556873a5db108e44fd053e8de80e36a6..18fdcd453af5dc22a5b0e3c41e77e3d3dbb70fea 100644 +index fbc2ec88f7c71c853c492301986a23dafc8fa7a6..274ebd7dab74ca9bff3d5ea941b7335bdf601db8 100644 --- a/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java +++ b/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java @@ -71,7 +71,11 @@ public class DragonControllerLandedFlame extends AbstractDragonControllerLanded @@ -29,10 +29,10 @@ index 40a8beff556873a5db108e44fd053e8de80e36a6..18fdcd453af5dc22a5b0e3c41e77e3d3 public void e() { if (this.d != null) { diff --git a/src/main/java/net/minecraft/server/DragonControllerStrafe.java b/src/main/java/net/minecraft/server/DragonControllerStrafe.java -index a2c36548caea7c6a0050bb3b18675567a61fb96e..a9d20ee3bbaf4dd77204df9c28a233a0d36cdbd2 100644 +index 7c94faa59c2b9887292c6d88fa2e3bb46e3e67c7..ac546ff959510a2d0120c24c90bf13ff83873161 100644 --- a/src/main/java/net/minecraft/server/DragonControllerStrafe.java +++ b/src/main/java/net/minecraft/server/DragonControllerStrafe.java -@@ -68,7 +68,9 @@ public class DragonControllerStrafe extends AbstractDragonController { +@@ -71,7 +71,9 @@ public class DragonControllerStrafe extends AbstractDragonController { EntityDragonFireball entitydragonfireball = new EntityDragonFireball(this.a.world, this.a, d9, d10, d11); entitydragonfireball.setPositionRotation(d6, d7, d8, 0.0F, 0.0F); @@ -43,15 +43,15 @@ index a2c36548caea7c6a0050bb3b18675567a61fb96e..a9d20ee3bbaf4dd77204df9c28a233a0 if (this.d != null) { while (!this.d.b()) { diff --git a/src/main/java/net/minecraft/server/EntityDragonFireball.java b/src/main/java/net/minecraft/server/EntityDragonFireball.java -index bc08b53fcdd411f15afb939702d68c98ed697479..db43ac1cc4ae959a432eedd3efee891b4e141c7f 100644 +index 743a08d18df8890a61eeb48984c0882bb353e15c..96fdf9d068c2df154dbc2fb7978b0ba7a030c834 100644 --- a/src/main/java/net/minecraft/server/EntityDragonFireball.java +++ b/src/main/java/net/minecraft/server/EntityDragonFireball.java -@@ -41,8 +41,10 @@ public class EntityDragonFireball extends EntityFireball { +@@ -46,8 +46,10 @@ public class EntityDragonFireball extends EntityFireball { } } + if (new com.destroystokyo.paper.event.entity.EnderDragonFireballHitEvent((org.bukkit.entity.DragonFireball) this.getBukkitEntity(), list.stream().map(EntityLiving::getBukkitLivingEntity).collect(java.util.stream.Collectors.toList()), (org.bukkit.entity.AreaEffectCloud) entityareaeffectcloud.getBukkitEntity()).callEvent()) { // Paper - this.world.triggerEffect(2006, new BlockPosition(this), 0); + this.world.triggerEffect(2006, this.getChunkCoordinates(), this.isSilent() ? -1 : 1); this.world.addEntity(entityareaeffectcloud); + } else entityareaeffectcloud.die(); // Paper this.die(); diff --git a/Spigot-Server-Patches/0247-add-more-information-to-Entity.toString.patch b/Spigot-Server-Patches/0247-add-more-information-to-Entity.toString.patch deleted file mode 100644 index 9a10692fc..000000000 --- a/Spigot-Server-Patches/0247-add-more-information-to-Entity.toString.patch +++ /dev/null @@ -1,20 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Thu, 19 Jul 2018 01:13:28 -0400 -Subject: [PATCH] add more information to Entity.toString() - -UUID, ticks lived, valid, dead - -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 7c6bf0b91cdf59f6dcf155ee8abfbab61938cc8b..fe730cd301e6bae46320355ee8cb67d406a72a9f 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -2505,7 +2505,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - } - - public String toString() { -- return String.format(Locale.ROOT, "%s['%s'/%d, l='%s', x=%.2f, y=%.2f, z=%.2f]", this.getClass().getSimpleName(), this.getDisplayName().getText(), this.id, this.world == null ? "~NULL~" : this.world.getWorldData().getName(), this.locX(), this.locY(), this.locZ()); -+ return String.format(Locale.ROOT, "%s[\'%s\'/%d, uuid=\'%s\', l=\'%s\', x=%.2f, y=%.2f, z=%.2f, cx=%d, cz=%d, tl=%d, v=%b, d=%b]", new Object[] { this.getClass().getSimpleName(), this.getDisplayName().getText(), Integer.valueOf(this.id), this.uniqueID.toString(), this.world == null ? "~NULL~" : this.world.getWorldData().getName(), Double.valueOf(this.locX), Double.valueOf(this.locY), Double.valueOf(this.locZ), getChunkX(), getChunkZ(), this.ticksLived, this.valid, this.dead}); // Paper - add more information - } - - public boolean isInvulnerable(DamageSource damagesource) { diff --git a/Spigot-Server-Patches/0250-PlayerElytraBoostEvent.patch b/Spigot-Server-Patches/0248-PlayerElytraBoostEvent.patch similarity index 90% rename from Spigot-Server-Patches/0250-PlayerElytraBoostEvent.patch rename to Spigot-Server-Patches/0248-PlayerElytraBoostEvent.patch index 3a30f4949..f53dfa1f0 100644 --- a/Spigot-Server-Patches/0250-PlayerElytraBoostEvent.patch +++ b/Spigot-Server-Patches/0248-PlayerElytraBoostEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] PlayerElytraBoostEvent diff --git a/src/main/java/net/minecraft/server/ItemFireworks.java b/src/main/java/net/minecraft/server/ItemFireworks.java -index 92dac35ec4eefe0d5794d8205bc872d23a62e3cb..bd524a35bb11005adfed12f66465fa8466a155f0 100644 +index 6cc243025f5bdac9be39f8a88a018893a9941dba..885c03f62da3b14bf7aeb31f1ae6a95bc9f86de1 100644 --- a/src/main/java/net/minecraft/server/ItemFireworks.java +++ b/src/main/java/net/minecraft/server/ItemFireworks.java @@ -36,11 +36,16 @@ public class ItemFireworks extends Item { @@ -28,4 +28,4 @@ index 92dac35ec4eefe0d5794d8205bc872d23a62e3cb..bd524a35bb11005adfed12f66465fa84 + // Paper end } - return InteractionResultWrapper.success(entityhuman.b(enumhand)); + return InteractionResultWrapper.a(entityhuman.b(enumhand), world.s_()); diff --git a/Spigot-Server-Patches/0249-Improve-BlockPosition-inlining.patch b/Spigot-Server-Patches/0249-Improve-BlockPosition-inlining.patch new file mode 100644 index 000000000..340f7147c --- /dev/null +++ b/Spigot-Server-Patches/0249-Improve-BlockPosition-inlining.patch @@ -0,0 +1,75 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Techcable +Date: Wed, 30 Nov 2016 20:56:58 -0600 +Subject: [PATCH] Improve BlockPosition 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 microbenchmarks. +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 8b202b342f899a38b989b683bd8be4f5c4061f48..1842e69839a65e7b8d2c47fd30ec8f3179f04470 100644 +--- a/src/main/java/net/minecraft/server/BaseBlockPosition.java ++++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java +@@ -39,7 +39,7 @@ public class BaseBlockPosition implements Comparable { + this(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2)); + } + +- public boolean equals(Object object) { ++ public final boolean equals(Object object) { // Paper + if (this == object) { + return true; + } else if (!(object instanceof BaseBlockPosition)) { +@@ -51,7 +51,7 @@ public class BaseBlockPosition implements Comparable { + } + } + +- public int hashCode() { ++ public final int hashCode() { // Paper + return (this.getY() + this.getZ() * 31) * 31 + this.getX(); + } + +@@ -59,15 +59,15 @@ 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() { ++ public final int getX() { // Paper + return this.a; + } + +- public int getY() { ++ public final int getY() { // Paper + return this.b; + } + +- public int getZ() { ++ public final int getZ() { // Paper + return this.e; + } + +diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java +index f1ad6ad22a59b28d2e8aeb2c0f4c21bce6070bc5..48410cfbfe203dbe533294a7e4f261dba9c327cb 100644 +--- a/src/main/java/net/minecraft/server/BlockPosition.java ++++ b/src/main/java/net/minecraft/server/BlockPosition.java +@@ -81,6 +81,7 @@ public class BlockPosition extends BaseBlockPosition { + return a(this.getX(), this.getY(), this.getZ()); + } + ++ public static long asLong(int x, int y, int z) { return a(x, y, z); } // Paper - OBFHELPER + public static long a(int i, int j, int k) { + long l = 0L; + diff --git a/Spigot-Server-Patches/0252-Optimize-RegistryID.c.patch b/Spigot-Server-Patches/0250-Optimize-RegistryID.c.patch similarity index 84% rename from Spigot-Server-Patches/0252-Optimize-RegistryID.c.patch rename to Spigot-Server-Patches/0250-Optimize-RegistryID.c.patch index 7fc144505..73cc0f829 100644 --- a/Spigot-Server-Patches/0252-Optimize-RegistryID.c.patch +++ b/Spigot-Server-Patches/0250-Optimize-RegistryID.c.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Optimize RegistryID.c() This is a frequent hotspot for world loading/saving. diff --git a/src/main/java/net/minecraft/server/RegistryID.java b/src/main/java/net/minecraft/server/RegistryID.java -index e15d286710ed66a01bfb6b60f8735b837efb3fd7..e8a48b9a4c999281869dfb85577c2b44d6e30eb7 100644 +index 6cdd4d46d987132c3c241800b5d59cee2dfa25e2..f9692408a1d177ba4668261070d7610ecfb53a7b 100644 --- a/src/main/java/net/minecraft/server/RegistryID.java +++ b/src/main/java/net/minecraft/server/RegistryID.java @@ -14,12 +14,14 @@ public class RegistryID implements Registry { @@ -24,7 +24,7 @@ index e15d286710ed66a01bfb6b60f8735b837efb3fd7..e8a48b9a4c999281869dfb85577c2b44 } public int getId(@Nullable K k0) { -@@ -44,9 +46,14 @@ public class RegistryID implements Registry { +@@ -48,9 +50,14 @@ public class RegistryID implements Registry { } private int c() { @@ -39,7 +39,7 @@ index e15d286710ed66a01bfb6b60f8735b837efb3fd7..e8a48b9a4c999281869dfb85577c2b44 return this.e; } -@@ -60,6 +67,7 @@ public class RegistryID implements Registry { +@@ -64,6 +71,7 @@ public class RegistryID implements Registry { this.d = (K[]) (new Object[i]); // Paper - decompile fix this.e = 0; this.f = 0; @@ -47,7 +47,7 @@ index e15d286710ed66a01bfb6b60f8735b837efb3fd7..e8a48b9a4c999281869dfb85577c2b44 for (int j = 0; j < ak.length; ++j) { if (ak[j] != null) { -@@ -85,6 +93,7 @@ public class RegistryID implements Registry { +@@ -89,6 +97,7 @@ public class RegistryID implements Registry { this.b[k] = k0; this.c[k] = i; this.d[i] = k0; @@ -55,7 +55,7 @@ index e15d286710ed66a01bfb6b60f8735b837efb3fd7..e8a48b9a4c999281869dfb85577c2b44 ++this.f; if (i == this.e) { ++this.e; -@@ -149,6 +158,7 @@ public class RegistryID implements Registry { +@@ -153,6 +162,7 @@ public class RegistryID implements Registry { Arrays.fill(this.d, (Object) null); this.e = 0; this.f = 0; diff --git a/Spigot-Server-Patches/0251-Improve-BlockPosition-inlining.patch b/Spigot-Server-Patches/0251-Improve-BlockPosition-inlining.patch deleted file mode 100644 index 2ef2c618a..000000000 --- a/Spigot-Server-Patches/0251-Improve-BlockPosition-inlining.patch +++ /dev/null @@ -1,275 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Techcable -Date: Wed, 30 Nov 2016 20:56:58 -0600 -Subject: [PATCH] Improve BlockPosition 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 microbenchmarks. -They had 'callq' (invoke) instead of 'mov' (get from memory) instructions. - -In addition, manually inline PooledBlockPosition#d(int, int, int) as it is a hot method that doesn't get inlined due to -invokespecial instructions. - -diff --git a/src/main/java/net/minecraft/server/BaseBlockPosition.java b/src/main/java/net/minecraft/server/BaseBlockPosition.java -index 7b05bb9edcd059a134cef12cc9fea570217bc601..a0450a7ddf21659c5636b3f298e6bf4f0a93fc4d 100644 ---- a/src/main/java/net/minecraft/server/BaseBlockPosition.java -+++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java -@@ -7,32 +7,30 @@ import javax.annotation.concurrent.Immutable; - public class BaseBlockPosition implements Comparable { - - public static final BaseBlockPosition ZERO = new BaseBlockPosition(0, 0, 0); -- @Deprecated -- private final int a; -- @Deprecated -- private final int b; -- @Deprecated -- private final int c; - // Paper start -- public boolean isValidLocation() { -- return a >= -30000000 && c >= -30000000 && a < 30000000 && c < 30000000 && b >= 0 && b < 256; -+ protected int x; -+ protected int y; -+ protected int z; -+ -+ public final boolean isValidLocation() { -+ return x >= -30000000 && z >= -30000000 && x < 30000000 && z < 30000000 && y >= 0 && y < 256; - } -- public boolean isInvalidYLocation() { -- return b < 0 || b >= 256; -+ public final boolean isInvalidYLocation() { -+ return y < 0 || y >= 256; - } - // Paper end - - public BaseBlockPosition(int i, int j, int k) { -- this.a = i; -- this.b = j; -- this.c = k; -+ this.x = i; -+ this.y = j; -+ this.z = k; - } - - public BaseBlockPosition(double d0, double d1, double d2) { - this(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2)); - } - -- public boolean equals(Object object) { -+ public final boolean equals(Object object) { // Paper - if (this == object) { - return true; - } else if (!(object instanceof BaseBlockPosition)) { -@@ -40,29 +38,31 @@ public class BaseBlockPosition implements Comparable { - } else { - BaseBlockPosition baseblockposition = (BaseBlockPosition) object; - -- return this.getX() != baseblockposition.getX() ? false : (this.getY() != baseblockposition.getY() ? false : this.getZ() == baseblockposition.getZ()); -+ return x == baseblockposition.x && z == baseblockposition.z && y == baseblockposition.y; // Paper - } - } - -- public int hashCode() { -- return (this.getY() + this.getZ() * 31) * 31 + this.getX(); -+ public final int hashCode() { // Paper -+ return (this.y + this.z * 31) * 31 + this.x; // Paper - } - - public int compareTo(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; -+ // Paper start -+ public final int getX() { -+ return this.x; - } - -- public int getY() { -- return this.b; -+ public final int getY() { -+ return this.y; - } - -- public int getZ() { -- return this.c; -+ public final int getZ() { -+ return this.z; - } -+ // Paper end - - public BaseBlockPosition down() { - return this.down(1); -@@ -75,13 +75,14 @@ public class BaseBlockPosition implements Comparable { - public BaseBlockPosition shift(EnumDirection enumdirection, int i) { - return i == 0 ? this : new BaseBlockPosition(this.getX() + enumdirection.getAdjacentX() * i, this.getY() + enumdirection.getAdjacentY() * i, this.getZ() + enumdirection.getAdjacentZ() * i); - } -+ // Paper 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()); - } - - public boolean a(BaseBlockPosition baseblockposition, double d0) { -- return this.distanceSquared((double) baseblockposition.getX(), (double) baseblockposition.getY(), (double) baseblockposition.getZ(), false) < d0 * d0; -+ return this.distanceSquared((double) baseblockposition.x, (double) baseblockposition.y, (double) baseblockposition.z, false) < d0 * d0; // Paper - } - - public boolean a(IPosition iposition, double d0) { -@@ -107,9 +108,9 @@ public class BaseBlockPosition implements Comparable { - } - - public int n(BaseBlockPosition baseblockposition) { -- float f = (float) Math.abs(baseblockposition.getX() - this.getX()); -- float f1 = (float) Math.abs(baseblockposition.getY() - this.getY()); -- float f2 = (float) Math.abs(baseblockposition.getZ() - this.getZ()); -+ float f = (float) Math.abs(baseblockposition.getX() - this.x); // Paper -+ float f1 = (float) Math.abs(baseblockposition.getY() - this.y); // Paper -+ float f2 = (float) Math.abs(baseblockposition.getZ() - this.z); // Paper - - return (int) (f + f1 + f2); - } -diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java -index f8ac39e1b019b0918996f745d99f6ed09db0fd11..9e523157f9daf8930afd96ab8701e500eb078f42 100644 ---- a/src/main/java/net/minecraft/server/BlockPosition.java -+++ b/src/main/java/net/minecraft/server/BlockPosition.java -@@ -99,6 +99,7 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali - return new BlockPosition(b(i), c(i), d(i)); - } - -+ public static long asLong(int x, int y, int z) { return a(x, y, z); } // Paper - OBFHELPER - public static long a(int i, int j, int k) { - long l = 0L; - -@@ -113,7 +114,7 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali - } - - public long asLong() { -- return a(this.getX(), this.getY(), this.getZ()); -+ return a(this.x, this.y, this.z); // Paper - } - - public BlockPosition a(double d0, double d1, double d2) { -@@ -298,7 +299,13 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali - - @Override - public BlockPosition.PooledBlockPosition d(int i, int j, int k) { -- return (BlockPosition.PooledBlockPosition) super.d(i, j, k); -+ // Paper start - manually inline this hot method -+ //return (BlockPosition.PooledBlockPosition) super.d(i, j, k); -+ this.x = i; -+ this.y = j; -+ this.z = k; -+ return this; -+ // Paper end - } - - @Override -@@ -343,11 +350,13 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali - } - - public static class MutableBlockPosition extends BlockPosition { -- -+ // Paper start - comment out -+ /* - protected int b; - protected int c; - protected int d; -- -+ */ -+ // Paper end - public MutableBlockPosition() { - this(0, 0, 0); - } -@@ -357,10 +366,13 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali - } - - public MutableBlockPosition(int i, int j, int k) { -- super(0, 0, 0); -+ // Paper start -+ super(i, j, k); -+ /* - this.b = i; - this.c = j; -- this.d = k; -+ this.d = k;*/ -+ // Paper end - } - - public MutableBlockPosition(double d0, double d1, double d2) { -@@ -391,6 +403,9 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali - return super.a(enumblockrotation).immutableCopy(); - } - -+ -+ /* -+ // Paper start - use parent getters - @Override - public int getX() { - return this.b; -@@ -404,13 +419,16 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali - @Override - public int getZ() { - return this.d; -- } -+ }*/ -+ // Paper end - - public BlockPosition.MutableBlockPosition setValues(int i, int j, int k) { return d(i, j, k);} // Paper - OBFHELPER - public BlockPosition.MutableBlockPosition d(int i, int j, int k) { -- this.b = i; -- this.c = j; -- this.d = k; -+ // Paper start - use xyz -+ this.x = i; -+ this.y = j; -+ this.z = k; -+ // Paper end - return this; - } - -@@ -440,26 +458,26 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali - } - - public BlockPosition.MutableBlockPosition c(EnumDirection enumdirection, int i) { -- return this.d(this.b + enumdirection.getAdjacentX() * i, this.c + enumdirection.getAdjacentY() * i, this.d + enumdirection.getAdjacentZ() * i); -+ return this.d(this.x + enumdirection.getAdjacentX() * i, this.y + enumdirection.getAdjacentY() * i, this.z + enumdirection.getAdjacentZ() * i); - } - - public BlockPosition.MutableBlockPosition e(int i, int j, int k) { -- return this.d(this.b + i, this.c + j, this.d + k); -+ return this.d(this.x + i, this.y + j, this.z + k); - } - - public final void setX(final int x) { this.o(x); } // Paper - OBFHELPER - public void o(int i) { -- this.b = i; -+ this.x = i; // Paper change to x - } - - public final void setY(final int y) { this.p(y); } // Paper - OBFHELPER - public void p(int i) { -- this.c = i; -+ this.y = i; // Paper change to y - } - - public final void setZ(final int z) { this.q(z); } // Paper - OBFHELPER - public void q(int i) { -- this.d = i; -+ this.z = i; // Paper change to z - } - - @Override diff --git a/Spigot-Server-Patches/0253-Option-to-prevent-armor-stands-from-doing-entity-loo.patch b/Spigot-Server-Patches/0251-Option-to-prevent-armor-stands-from-doing-entity-loo.patch similarity index 70% rename from Spigot-Server-Patches/0253-Option-to-prevent-armor-stands-from-doing-entity-loo.patch rename to Spigot-Server-Patches/0251-Option-to-prevent-armor-stands-from-doing-entity-loo.patch index 036d18d06..d4131ade1 100644 --- a/Spigot-Server-Patches/0253-Option-to-prevent-armor-stands-from-doing-entity-loo.patch +++ b/Spigot-Server-Patches/0251-Option-to-prevent-armor-stands-from-doing-entity-loo.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Option to prevent armor stands from doing entity lookups diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 387e0dcb9f01ad947daaa19211331a96742ce004..eaaa51e4bf761f41fd516402ce1ad0f903c6ab71 100644 +index d6a3d882e375ac5a2b6ec8920532db615f4fe4ef..14bb9d843f05058cae5cc64de8149d2c97264f1a 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -388,4 +388,9 @@ public class PaperWorldConfig { +@@ -383,4 +383,9 @@ public class PaperWorldConfig { log("Bed Search Radius: " + bedSearchRadius); } } @@ -19,13 +19,13 @@ index 387e0dcb9f01ad947daaa19211331a96742ce004..eaaa51e4bf761f41fd516402ce1ad0f9 + } } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 9a001a2a7934dc87f3e57d3388a8a888ec43908b..688d98dd1e6e5d2e17c8fc04e105fdc0ee649574 100644 +index 5540fc6eee8115400774b7a792b9d3b45eb01e34..2e19fbddb6ede4abf02c79b4e72d11f89db05433 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -782,6 +782,14 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -842,6 +842,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + // Paper end } } - + // Paper start - Prevent armor stands from doing entity lookups + @Override + public boolean getCubes(@Nullable Entity entity, AxisAlignedBB axisAlignedBB) { @@ -33,7 +33,6 @@ index 9a001a2a7934dc87f3e57d3388a8a888ec43908b..688d98dd1e6e5d2e17c8fc04e105fdc0 + return GeneratorAccess.super.getCubes(entity, axisAlignedBB); + } + // Paper end -+ - public boolean b(AxisAlignedBB axisalignedbb) { - int i = MathHelper.floor(axisalignedbb.minX); - int j = MathHelper.f(axisalignedbb.maxX); + + public Explosion explode(@Nullable Entity entity, double d0, double d1, double d2, float f, Explosion.Effect explosion_effect) { + return this.createExplosion(entity, (DamageSource) null, (ExplosionDamageCalculator) null, d0, d1, d2, f, false, explosion_effect); diff --git a/Spigot-Server-Patches/0254-Vanished-players-don-t-have-rights.patch b/Spigot-Server-Patches/0252-Vanished-players-don-t-have-rights.patch similarity index 66% rename from Spigot-Server-Patches/0254-Vanished-players-don-t-have-rights.patch rename to Spigot-Server-Patches/0252-Vanished-players-don-t-have-rights.patch index 9d2d19bd0..adb94d4d0 100644 --- a/Spigot-Server-Patches/0254-Vanished-players-don-t-have-rights.patch +++ b/Spigot-Server-Patches/0252-Vanished-players-don-t-have-rights.patch @@ -4,8 +4,20 @@ Date: Mon, 23 Jul 2018 14:22:26 +0200 Subject: [PATCH] Vanished players don't have rights +diff --git a/src/main/java/net/minecraft/server/BlockBase.java b/src/main/java/net/minecraft/server/BlockBase.java +index 26d446077bb563ca3c5bb0339695b3364a3e41bf..88a1db211286fc8a6164312d7eb0839c00969e0e 100644 +--- a/src/main/java/net/minecraft/server/BlockBase.java ++++ b/src/main/java/net/minecraft/server/BlockBase.java +@@ -453,6 +453,7 @@ public abstract class BlockBase { + return this.a != null ? this.a.b : this.b(iblockaccess, blockposition, VoxelShapeCollision.a()); + } + ++ public final VoxelShape getCollisionShape(IBlockAccess iblockaccess, BlockPosition blockposition, VoxelShapeCollision voxelshapecollision) { return this.b(iblockaccess, blockposition, voxelshapecollision); } // Paper - OBFHELPER + public VoxelShape b(IBlockAccess iblockaccess, BlockPosition blockposition, VoxelShapeCollision voxelshapecollision) { + return this.getBlock().c(this.p(), iblockaccess, blockposition, voxelshapecollision); + } diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 5fd57a3d30972d86c62025d63cd57b56a147cc94..653e6d9a1640bedf08aaa5b436ac93e4cb1cb5b7 100644 +index 8e128fa303b345a10535630fd58442435ef1e439..af6f0c391e6e410f0bf4e4e6ddf6fd18bb4d26ed 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -98,7 +98,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -18,54 +30,53 @@ index 5fd57a3d30972d86c62025d63cd57b56a147cc94..653e6d9a1640bedf08aaa5b436ac93e4 protected int j; @Nullable diff --git a/src/main/java/net/minecraft/server/EntityFireworks.java b/src/main/java/net/minecraft/server/EntityFireworks.java -index 278ef79d8962cc5d337e34891c7ea3a606336cbb..5c3731f68a31b73b886b872eba69de483f78a2aa 100644 +index 5ac7957016d1ca6bc78ced0bcf3767d358677f45..ca92579304d060e2b718aab6f3e3f006d52f93e5 100644 --- a/src/main/java/net/minecraft/server/EntityFireworks.java +++ b/src/main/java/net/minecraft/server/EntityFireworks.java -@@ -110,6 +110,16 @@ public class EntityFireworks extends Entity implements IProjectile { +@@ -118,7 +118,6 @@ public class EntityFireworks extends IProjectile { + this.move(EnumMoveType.SELF, vec3d); + this.setMot(vec3d); + } +- + MovingObjectPosition movingobjectposition = ProjectileHelper.a(this, this::a, RayTrace.BlockCollisionOption.COLLIDER); - vec3d = this.getMot(); - MovingObjectPosition movingobjectposition = ProjectileHelper.a(this, this.getBoundingBox().a(vec3d).g(1.0D), (entity) -> { + if (!this.noclip) { +diff --git a/src/main/java/net/minecraft/server/IProjectile.java b/src/main/java/net/minecraft/server/IProjectile.java +index cdf80e50de0840002f62f4c1df4fbcc4e13675d7..ea5f5845a8d202e62da3ae1bfb1e4dbd7f5e185e 100644 +--- a/src/main/java/net/minecraft/server/IProjectile.java ++++ b/src/main/java/net/minecraft/server/IProjectile.java +@@ -129,8 +129,14 @@ public abstract class IProjectile extends Entity { + protected boolean a(Entity entity) { + if (!entity.isSpectator() && entity.isAlive() && entity.isInteractable()) { + Entity entity1 = this.getShooter(); +- + // Paper start - Cancel hit for vanished players -+ if (this.spawningEntity != null && entity instanceof EntityPlayer && this.world instanceof WorldServer) { -+ Entity spawningEntity = ((WorldServer) this.world).getEntity(this.spawningEntity); -+ if (spawningEntity instanceof EntityPlayer) { -+ org.bukkit.entity.Player collided = (org.bukkit.entity.Player) entity.getBukkitEntity(); -+ org.bukkit.entity.Player shooter = (org.bukkit.entity.Player) spawningEntity.getBukkitEntity(); -+ if (!shooter.canSee(collided)) return false; -+ } ++ if (entity1 instanceof EntityPlayer && entity instanceof EntityPlayer) { ++ org.bukkit.entity.Player collided = (org.bukkit.entity.Player) entity.getBukkitEntity(); ++ org.bukkit.entity.Player shooter = (org.bukkit.entity.Player) entity1.getBukkitEntity(); ++ if (!shooter.canSee(collided)) return false; + } + return entity1 == null || this.d || !entity1.isSameVehicle(entity); + // Paper end - return !entity.isSpectator() && entity.isAlive() && entity.isInteractable(); - }, RayTrace.BlockCollisionOption.COLLIDER, true); - -diff --git a/src/main/java/net/minecraft/server/IBlockData.java b/src/main/java/net/minecraft/server/IBlockData.java -index 181661fc8fe9d46cb36cfffac38c58f0d5003192..c5fddef030489bff0de9e0efb4f11c83bcfee628 100644 ---- a/src/main/java/net/minecraft/server/IBlockData.java -+++ b/src/main/java/net/minecraft/server/IBlockData.java -@@ -147,6 +147,7 @@ public class IBlockData extends BlockDataAbstract implements - return this.c != null ? this.c.g : this.b(iblockaccess, blockposition, VoxelShapeCollision.a()); - } - -+ public final VoxelShape getCollisionShape(IBlockAccess iblockaccess, BlockPosition blockposition, VoxelShapeCollision voxelshapecollision) { return this.b(iblockaccess, blockposition, voxelshapecollision); } // Paper - OBFHELPER - public VoxelShape b(IBlockAccess iblockaccess, BlockPosition blockposition, VoxelShapeCollision voxelshapecollision) { - return this.getBlock().b(this, iblockaccess, blockposition, voxelshapecollision); - } + } else { + return false; + } diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java -index ab875a7365693264ea8e5002d9d115e16320dbc8..aed353365bfdf1a133997f47cb458edc78af6c8b 100644 +index d83bd0169bb4b8c25f44ae3582e58b8fea97ecbd..63d2294da4f0da628e62b782b71e34cb3eb959b5 100644 --- a/src/main/java/net/minecraft/server/ItemBlock.java +++ b/src/main/java/net/minecraft/server/ItemBlock.java -@@ -136,7 +136,8 @@ public class ItemBlock extends Item { +@@ -154,7 +154,8 @@ public class ItemBlock extends Item { EntityHuman entityhuman = blockactioncontext.getEntity(); VoxelShapeCollision voxelshapecollision = entityhuman == null ? VoxelShapeCollision.a() : VoxelShapeCollision.a((Entity) entityhuman); // CraftBukkit start - store default return -- boolean defaultReturn = (!this.T_() || iblockdata.canPlace(blockactioncontext.getWorld(), blockactioncontext.getClickPosition())) && blockactioncontext.getWorld().a(iblockdata, blockactioncontext.getClickPosition(), voxelshapecollision); +- boolean defaultReturn = (!this.isCheckCollisions() || iblockdata.canPlace(blockactioncontext.getWorld(), blockactioncontext.getClickPosition())) && blockactioncontext.getWorld().a(iblockdata, blockactioncontext.getClickPosition(), voxelshapecollision); + World world = blockactioncontext.getWorld(); // Paper -+ boolean defaultReturn = (!this.T_() || iblockdata.canPlace(blockactioncontext.getWorld(), blockactioncontext.getClickPosition())) && world.checkEntityCollision(iblockdata, entityhuman, voxelshapecollision, blockactioncontext.getClickPosition(), true); // Paper ++ boolean defaultReturn = (!this.isCheckCollisions() || iblockdata.canPlace(blockactioncontext.getWorld(), blockactioncontext.getClickPosition())) && world.checkEntityCollision(iblockdata, entityhuman, voxelshapecollision, blockactioncontext.getClickPosition(), true); // Paper org.bukkit.entity.Player player = (blockactioncontext.getEntity() instanceof EntityPlayer) ? (org.bukkit.entity.Player) blockactioncontext.getEntity().getBukkitEntity() : null; BlockCanBuildEvent event = new BlockCanBuildEvent(CraftBlock.at(blockactioncontext.getWorld(), blockactioncontext.getClickPosition()), player, CraftBlockData.fromData(iblockdata), defaultReturn); diff --git a/src/main/java/net/minecraft/server/VoxelShape.java b/src/main/java/net/minecraft/server/VoxelShape.java -index 0f64a3c0569a778cd5b8c60f253c77681a83308d..0f95bcbccb96f9d525583f6bb6c0c0ed7fb7561b 100644 +index e985b0efc20f7d271be1c7ffc2670ab89fc3a6a7..c2b8c9820663f95f58f0c3a62cd9ec99c835a82f 100644 --- a/src/main/java/net/minecraft/server/VoxelShape.java +++ b/src/main/java/net/minecraft/server/VoxelShape.java @@ -46,6 +46,7 @@ public abstract class VoxelShape { @@ -77,7 +88,7 @@ index 0f64a3c0569a778cd5b8c60f253c77681a83308d..0f95bcbccb96f9d525583f6bb6c0c0ed return (VoxelShape) (this.isEmpty() ? VoxelShapes.a() : new VoxelShapeArray(this.a, new DoubleListOffset(this.a(EnumDirection.EnumAxis.X), d0), new DoubleListOffset(this.a(EnumDirection.EnumAxis.Y), d1), new DoubleListOffset(this.a(EnumDirection.EnumAxis.Z), d2))); } diff --git a/src/main/java/net/minecraft/server/VoxelShapes.java b/src/main/java/net/minecraft/server/VoxelShapes.java -index 0e30d8c9933dc6595b9715ef6dc99cc8910892cb..335142ec0dfad822cfe40877e99dec0f307e1a58 100644 +index 86f6f082fe2991ea9065b09c9680b76ca1cf7154..b6e2a3d8d0cf510f497c6f974356fafaf2adc13b 100644 --- a/src/main/java/net/minecraft/server/VoxelShapes.java +++ b/src/main/java/net/minecraft/server/VoxelShapes.java @@ -35,6 +35,7 @@ public final class VoxelShapes { @@ -97,10 +108,10 @@ index 0e30d8c9933dc6595b9715ef6dc99cc8910892cb..335142ec0dfad822cfe40877e99dec0f if (operatorboolean.apply(false, false)) { throw (IllegalArgumentException) SystemUtils.c(new IllegalArgumentException()); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 688d98dd1e6e5d2e17c8fc04e105fdc0ee649574..037770cde15a72192f0f45fdac33f8bd66ba646c 100644 +index 2e19fbddb6ede4abf02c79b4e72d11f89db05433..ca3e831e3191dd8ffe7f2b6ab9ecc05acfe1b0af 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -153,6 +153,46 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -172,6 +172,46 @@ public abstract class World implements GeneratorAccess, AutoCloseable { this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime); } @@ -145,13 +156,13 @@ index 688d98dd1e6e5d2e17c8fc04e105fdc0ee649574..037770cde15a72192f0f45fdac33f8bd + // Paper end + @Override - public boolean p_() { + public boolean s_() { return this.isClientSide; diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 6ca6ba46d0dd511072f518baa3aae6dc8281ef66..0125bf43e3383fddf7c36d831d19cca3f1ee3fae 100644 +index 72f495327fe56e7d7ba41e39e99a69622a6861b2..cf25906786e246cb8dfdb5f2cb39f6dc08c4d7ca 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -1179,6 +1179,14 @@ public class CraftEventFactory { +@@ -1205,6 +1205,14 @@ public class CraftEventFactory { Projectile projectile = (Projectile) entity.getBukkitEntity(); org.bukkit.entity.Entity collided = position.getEntity().getBukkitEntity(); com.destroystokyo.paper.event.entity.ProjectileCollideEvent event = new com.destroystokyo.paper.event.entity.ProjectileCollideEvent(projectile, collided); diff --git a/Spigot-Server-Patches/0255-Mark-chunk-dirty-anytime-entities-change-to-guarante.patch b/Spigot-Server-Patches/0253-Mark-chunk-dirty-anytime-entities-change-to-guarante.patch similarity index 79% rename from Spigot-Server-Patches/0255-Mark-chunk-dirty-anytime-entities-change-to-guarante.patch rename to Spigot-Server-Patches/0253-Mark-chunk-dirty-anytime-entities-change-to-guarante.patch index fd3744a59..3cf45230b 100644 --- a/Spigot-Server-Patches/0255-Mark-chunk-dirty-anytime-entities-change-to-guarante.patch +++ b/Spigot-Server-Patches/0253-Mark-chunk-dirty-anytime-entities-change-to-guarante.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Mark chunk dirty anytime entities change to guarantee it diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 87e94693f6db07d1273854ad55e5f263f2f2239e..f0a8142b7477fde211b522e3982e614fc94e20f8 100644 +index fdc02b512f2d4bc968977564d520bc7ec7189c69..a27f91e6c3d1f5dd0adf8a3b48a640cc63676114 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -518,6 +518,7 @@ public class Chunk implements IChunkAccess { +@@ -519,6 +519,7 @@ public class Chunk implements IChunkAccess { entity.chunkZ = this.loc.z; this.entities.add(entity); // Paper - per chunk entity list this.entitySlices[k].add(entity); @@ -17,7 +17,7 @@ index 87e94693f6db07d1273854ad55e5f263f2f2239e..f0a8142b7477fde211b522e3982e614f } @Override -@@ -545,6 +546,7 @@ public class Chunk implements IChunkAccess { +@@ -546,6 +547,7 @@ public class Chunk implements IChunkAccess { return; } entityCounts.decrement(entity.getMinecraftKeyString()); diff --git a/Spigot-Server-Patches/0256-Add-some-Debug-to-Chunk-Entity-slices.patch b/Spigot-Server-Patches/0254-Add-some-Debug-to-Chunk-Entity-slices.patch similarity index 88% rename from Spigot-Server-Patches/0256-Add-some-Debug-to-Chunk-Entity-slices.patch rename to Spigot-Server-Patches/0254-Add-some-Debug-to-Chunk-Entity-slices.patch index 0975e2af1..3bb6f213f 100644 --- a/Spigot-Server-Patches/0256-Add-some-Debug-to-Chunk-Entity-slices.patch +++ b/Spigot-Server-Patches/0254-Add-some-Debug-to-Chunk-Entity-slices.patch @@ -9,10 +9,10 @@ This should hopefully avoid duplicate entities ever being created if the entity was to end up in 2 different chunk slices diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index f0a8142b7477fde211b522e3982e614fc94e20f8..9f369f932ca0a63bde246420cfde7949f3e78ca2 100644 +index a27f91e6c3d1f5dd0adf8a3b48a640cc63676114..3ba19f75d24a1539c94f4fed9b8f90aecc918cdc 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -509,6 +509,25 @@ public class Chunk implements IChunkAccess { +@@ -510,6 +510,25 @@ public class Chunk implements IChunkAccess { if (k >= this.entitySlices.length) { k = this.entitySlices.length - 1; } @@ -38,7 +38,7 @@ index f0a8142b7477fde211b522e3982e614fc94e20f8..9f369f932ca0a63bde246420cfde7949 if (!entity.inChunk || entity.getCurrentChunk() != this) entityCounts.increment(entity.getMinecraftKeyString()); // Paper entity.inChunk = true; -@@ -518,6 +537,7 @@ public class Chunk implements IChunkAccess { +@@ -519,6 +538,7 @@ public class Chunk implements IChunkAccess { entity.chunkZ = this.loc.z; this.entities.add(entity); // Paper - per chunk entity list this.entitySlices[k].add(entity); @@ -46,7 +46,7 @@ index f0a8142b7477fde211b522e3982e614fc94e20f8..9f369f932ca0a63bde246420cfde7949 this.markDirty(); // Paper } -@@ -542,6 +562,10 @@ public class Chunk implements IChunkAccess { +@@ -543,6 +563,10 @@ public class Chunk implements IChunkAccess { // Paper start if (entity.currentChunk != null && entity.currentChunk.get() == this) entity.setCurrentChunk(null); @@ -58,7 +58,7 @@ index f0a8142b7477fde211b522e3982e614fc94e20f8..9f369f932ca0a63bde246420cfde7949 return; } diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 653e6d9a1640bedf08aaa5b436ac93e4cb1cb5b7..84d36ea84e25a701af22900af6cd3099adf6cd54 100644 +index af6f0c391e6e410f0bf4e4e6ddf6fd18bb4d26ed..b0338278f3cfecdb30e1d2febf1ff2a04d0cc66d 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -71,6 +71,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke diff --git a/Spigot-Server-Patches/0257-EntityTransformedEvent.patch b/Spigot-Server-Patches/0255-EntityTransformedEvent.patch similarity index 50% rename from Spigot-Server-Patches/0257-EntityTransformedEvent.patch rename to Spigot-Server-Patches/0255-EntityTransformedEvent.patch index 5b5b04366..a48a90a43 100644 --- a/Spigot-Server-Patches/0257-EntityTransformedEvent.patch +++ b/Spigot-Server-Patches/0255-EntityTransformedEvent.patch @@ -4,43 +4,47 @@ Date: Thu, 26 Jul 2018 15:30:03 -0400 Subject: [PATCH] EntityTransformedEvent +diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java +index bb831658d91ffa7d78cd8597509e61f3f14b0890..8a79302b9cc178bfe4e0909293e3a87c01d344ca 100644 +--- a/src/main/java/net/minecraft/server/EntityInsentient.java ++++ b/src/main/java/net/minecraft/server/EntityInsentient.java +@@ -1244,6 +1244,7 @@ public abstract class EntityInsentient extends EntityLiving { + if (CraftEventFactory.callEntityTransformEvent(this, t0, EntityTransformEvent.TransformReason.DROWNED).isCancelled()) { + return null; + } ++ if (!new com.destroystokyo.paper.event.entity.EntityTransformedEvent(this.getBukkitEntity(), t0.getBukkitEntity(), com.destroystokyo.paper.event.entity.EntityTransformedEvent.TransformedReason.DROWNED).callEvent()) return null; // Paper + this.world.addEntity(t0, CreatureSpawnEvent.SpawnReason.DROWNED); + // CraftBukkit end + this.die(); diff --git a/src/main/java/net/minecraft/server/EntityMushroomCow.java b/src/main/java/net/minecraft/server/EntityMushroomCow.java -index 1d96ecb2fda1b567866f620b183a5811f75fa7f2..8b199971bd67a196168afb2e63d4c72919fec8d2 100644 +index 48d7e0f971d3147218e3be774a75cdb10d8b55a6..23ef033067e388b7b7b2a981df8655e240a30594 100644 --- a/src/main/java/net/minecraft/server/EntityMushroomCow.java +++ b/src/main/java/net/minecraft/server/EntityMushroomCow.java -@@ -112,6 +112,7 @@ public class EntityMushroomCow extends EntityCow { - if (CraftEventFactory.callEntityTransformEvent(this, entitycow, EntityTransformEvent.TransformReason.SHEARED).isCancelled()) { - return false; - } -+ if (!new com.destroystokyo.paper.event.entity.EntityTransformedEvent(this.getBukkitEntity(), entitycow.getBukkitEntity(), com.destroystokyo.paper.event.entity.EntityTransformedEvent.TransformedReason.SHEARED).callEvent()) return false; // Paper - this.world.addEntity(entitycow, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SHEARED); - - this.die(); // CraftBukkit - from above -diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java -index 6ca4fa43c41ad555c093b90cf08cfdb1e73fda22..6e0020ae0b4d2f2597843129b83fff0d194de337 100644 ---- a/src/main/java/net/minecraft/server/EntityVillager.java -+++ b/src/main/java/net/minecraft/server/EntityVillager.java -@@ -699,6 +699,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation - if (CraftEventFactory.callEntityTransformEvent(this, entitywitch, EntityTransformEvent.TransformReason.LIGHTNING).isCancelled()) { - return; - } -+ if (!new com.destroystokyo.paper.event.entity.EntityTransformedEvent(this.getBukkitEntity(), entitywitch.getBukkitEntity(), com.destroystokyo.paper.event.entity.EntityTransformedEvent.TransformedReason.LIGHTNING).callEvent()) return; // Paper - this.world.addEntity(entitywitch, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING); - // CraftBukkit end - this.die(); -diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java -index 0240cef74aaa7f9fcfea40106267ee2e8d39f133..31aba6bfc3c196cc0c664c0e139f0f8eb7c804b4 100644 ---- a/src/main/java/net/minecraft/server/EntityZombie.java -+++ b/src/main/java/net/minecraft/server/EntityZombie.java -@@ -257,6 +257,7 @@ public class EntityZombie extends EntityMonster { +@@ -150,6 +150,7 @@ public class EntityMushroomCow extends EntityCow implements IShearable { + if (CraftEventFactory.callEntityTransformEvent(this, entitycow, EntityTransformEvent.TransformReason.SHEARED).isCancelled()) { return; } ++ if (!new com.destroystokyo.paper.event.entity.EntityTransformedEvent(this.getBukkitEntity(), entitycow.getBukkitEntity(), com.destroystokyo.paper.event.entity.EntityTransformedEvent.TransformedReason.SHEARED).callEvent()) return; // Paper + this.world.addEntity(entitycow, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SHEARED); + + this.die(); // CraftBukkit - from above +diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java +index 00183a7f6e2000ce045ce50454f1296c4c93b148..a23c8d54a30a1ed1a3ed4d158da08229f59ca4c5 100644 +--- a/src/main/java/net/minecraft/server/EntityVillager.java ++++ b/src/main/java/net/minecraft/server/EntityVillager.java +@@ -733,6 +733,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation + if (CraftEventFactory.callEntityTransformEvent(this, entitywitch, EntityTransformEvent.TransformReason.LIGHTNING).isCancelled()) { + return; + } ++ if (!new com.destroystokyo.paper.event.entity.EntityTransformedEvent(this.getBukkitEntity(), entitywitch.getBukkitEntity(), com.destroystokyo.paper.event.entity.EntityTransformedEvent.TransformedReason.LIGHTNING).callEvent()) return; // Paper + this.world.addEntity(entitywitch, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING); // CraftBukkit end -+ if (!new com.destroystokyo.paper.event.entity.EntityTransformedEvent(this.getBukkitEntity(), entityzombie.getBukkitEntity(), com.destroystokyo.paper.event.entity.EntityTransformedEvent.TransformedReason.DROWNED).callEvent()) return; // Paper - this.world.addEntity(entityzombie, CreatureSpawnEvent.SpawnReason.DROWNED); // CraftBukkit - added spawn reason this.die(); - } -@@ -463,6 +464,7 @@ public class EntityZombie extends EntityMonster { +diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java +index 951cf5546af11434971a26dca15c20c25e6c555e..bb7f62fa52b758ed83db7def9053b79da3d97dcd 100644 +--- a/src/main/java/net/minecraft/server/EntityZombie.java ++++ b/src/main/java/net/minecraft/server/EntityZombie.java +@@ -399,6 +399,7 @@ public class EntityZombie extends EntityMonster { if (CraftEventFactory.callEntityTransformEvent(this, entityzombievillager, EntityTransformEvent.TransformReason.INFECTION).isCancelled()) { return; } @@ -49,10 +53,10 @@ index 0240cef74aaa7f9fcfea40106267ee2e8d39f133..31aba6bfc3c196cc0c664c0e139f0f8e this.world.addEntity(entityzombievillager, CreatureSpawnEvent.SpawnReason.INFECTION); // CraftBukkit - add SpawnReason // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/EntityZombieVillager.java b/src/main/java/net/minecraft/server/EntityZombieVillager.java -index 91cac5d53035d5ba6fca14549bc373bc36347f23..8082fa617a10448ce81b82045e1619311aca2f4b 100644 +index 2fb6356940b57e112d1ef35bfd3aee9cd98e5754..9b920332bd397f9711f0c99702245d54b9d3841b 100644 --- a/src/main/java/net/minecraft/server/EntityZombieVillager.java +++ b/src/main/java/net/minecraft/server/EntityZombieVillager.java -@@ -197,6 +197,7 @@ public class EntityZombieVillager extends EntityZombie implements VillagerDataHo +@@ -212,6 +212,7 @@ public class EntityZombieVillager extends EntityZombie implements VillagerDataHo ((ZombieVillager) getBukkitEntity()).setConversionTime(-1); // SPIGOT-5208: End conversion to stop event spam return; } diff --git a/Spigot-Server-Patches/0258-SkeletonHorse-Additions.patch b/Spigot-Server-Patches/0256-SkeletonHorse-Additions.patch similarity index 76% rename from Spigot-Server-Patches/0258-SkeletonHorse-Additions.patch rename to Spigot-Server-Patches/0256-SkeletonHorse-Additions.patch index fae66f94e..4699e1810 100644 --- a/Spigot-Server-Patches/0258-SkeletonHorse-Additions.patch +++ b/Spigot-Server-Patches/0256-SkeletonHorse-Additions.patch @@ -5,33 +5,33 @@ Subject: [PATCH] SkeletonHorse Additions diff --git a/src/main/java/net/minecraft/server/EntityHorseSkeleton.java b/src/main/java/net/minecraft/server/EntityHorseSkeleton.java -index 621f2afee599e82806d54de15ff413674523815c..290cb9337c868fa3b9cbef0545886f44a00ef804 100644 +index 2aee4c592cbf7e083c522a35846735bdb7a2e448..43e605f682709708f5b79c70398691dc195ef925 100644 --- a/src/main/java/net/minecraft/server/EntityHorseSkeleton.java +++ b/src/main/java/net/minecraft/server/EntityHorseSkeleton.java @@ -6,7 +6,7 @@ public class EntityHorseSkeleton extends EntityHorseAbstract { - private final PathfinderGoalHorseTrap bF = new PathfinderGoalHorseTrap(this); - private boolean bG; -- private int bH; -+ private int bH; public int getTrapTime() { return this.bH; } // Paper - OBFHELPER + private final PathfinderGoalHorseTrap bD = new PathfinderGoalHorseTrap(this); + private boolean bE; +- private int bF; ++ private int bF; public int getTrapTime() { return this.bF; } // Paper - OBFHELPER public EntityHorseSkeleton(EntityTypes entitytypes, World world) { super(entitytypes, world); -@@ -124,10 +124,12 @@ public class EntityHorseSkeleton extends EntityHorseAbstract { +@@ -125,10 +125,12 @@ public class EntityHorseSkeleton extends EntityHorseAbstract { return 0.96F; } -+ public boolean isTrap() { return this.eq(); } // Paper - OBFHELPER - public boolean eq() { - return this.bG; ++ public boolean isTrap() { return this.eN(); } // Paper - OBFHELPER + public boolean eN() { + return this.bE; } -+ public void setTrap(boolean trap) { this.r(trap); } // Paper - OBFHELPER - public void r(boolean flag) { - if (flag != this.bG) { - this.bG = flag; ++ public void setTrap(boolean trap) { this.t(trap); } // Paper - OBFHELPER + public void t(boolean flag) { + if (flag != this.bE) { + this.bE = flag; diff --git a/src/main/java/net/minecraft/server/PathfinderGoalHorseTrap.java b/src/main/java/net/minecraft/server/PathfinderGoalHorseTrap.java -index dfe5a63583d8c14c82cc778ee004f2877e43776d..37626f925fb7838e41f7bfab352c9360b3786b4a 100644 +index d6b02adf9fe8287d600d76fb1c3be86fdee1fa77..b37e4aa37b35863d74cb6ef95562fba65486bdf9 100644 --- a/src/main/java/net/minecraft/server/PathfinderGoalHorseTrap.java +++ b/src/main/java/net/minecraft/server/PathfinderGoalHorseTrap.java @@ -15,6 +15,7 @@ public class PathfinderGoalHorseTrap extends PathfinderGoal { @@ -39,9 +39,9 @@ index dfe5a63583d8c14c82cc778ee004f2877e43776d..37626f925fb7838e41f7bfab352c9360 @Override public void e() { + if (!new com.destroystokyo.paper.event.entity.SkeletonHorseTrapEvent((org.bukkit.entity.SkeletonHorse) this.a.getBukkitEntity()).callEvent()) return; // Paper - DifficultyDamageScaler difficultydamagescaler = this.a.world.getDamageScaler(new BlockPosition(this.a)); + DifficultyDamageScaler difficultydamagescaler = this.a.world.getDamageScaler(this.a.getChunkCoordinates()); - this.a.r(false); + this.a.t(false); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeletonHorse.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeletonHorse.java index e822c2200d6270ca538eadd9637b748fc3602cb6..2a7d1d4ec2c1ff16840614165c6f0c37dc534d87 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeletonHorse.java diff --git a/Spigot-Server-Patches/0259-Prevent-Saving-Bad-entities-to-chunks.patch b/Spigot-Server-Patches/0257-Prevent-Saving-Bad-entities-to-chunks.patch similarity index 89% rename from Spigot-Server-Patches/0259-Prevent-Saving-Bad-entities-to-chunks.patch rename to Spigot-Server-Patches/0257-Prevent-Saving-Bad-entities-to-chunks.patch index b6bda37c0..32c50a9dc 100644 --- a/Spigot-Server-Patches/0259-Prevent-Saving-Bad-entities-to-chunks.patch +++ b/Spigot-Server-Patches/0257-Prevent-Saving-Bad-entities-to-chunks.patch @@ -18,10 +18,10 @@ an invalid entity. This should reduce log occurrences of dupe uuid messages. diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index 13d99de2cd08de02215031a1f699110c13ef35ff..f54572773c25b6716a68166efa8d3fc8b22b6258 100644 +index 28039aa8421207ce04840cc90e03d21bc8b7269f..17b8c4445af2bd2ed907d05ed3c396d4290dc63d 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -@@ -300,6 +300,7 @@ public class ChunkRegionLoader { +@@ -301,6 +301,7 @@ public class ChunkRegionLoader { nbttagcompound1.set("TileEntities", nbttaglist1); NBTTagList nbttaglist2 = new NBTTagList(); @@ -29,7 +29,7 @@ index 13d99de2cd08de02215031a1f699110c13ef35ff..f54572773c25b6716a68166efa8d3fc8 if (ichunkaccess.getChunkStatus().getType() == ChunkStatus.Type.LEVELCHUNK) { Chunk chunk = (Chunk) ichunkaccess; -@@ -311,13 +312,28 @@ public class ChunkRegionLoader { +@@ -312,13 +313,28 @@ public class ChunkRegionLoader { while (iterator1.hasNext()) { Entity entity = (Entity) iterator1.next(); NBTTagCompound nbttagcompound4 = new NBTTagCompound(); @@ -59,7 +59,7 @@ index 13d99de2cd08de02215031a1f699110c13ef35ff..f54572773c25b6716a68166efa8d3fc8 } else { ProtoChunk protochunk = (ProtoChunk) ichunkaccess; -@@ -373,6 +389,19 @@ public class ChunkRegionLoader { +@@ -377,6 +393,19 @@ public class ChunkRegionLoader { nbttagcompound1.set("Structures", a(chunkcoordintpair, ichunkaccess.h(), ichunkaccess.v())); return nbttagcompound; } @@ -80,10 +80,10 @@ index 13d99de2cd08de02215031a1f699110c13ef35ff..f54572773c25b6716a68166efa8d3fc8 public static ChunkStatus.Type a(@Nullable NBTTagCompound nbttagcompound) { if (nbttagcompound != null) { diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 5086a854b84b05e5b9c0f5677051d19dfa42f343..426ca12970e0c75ba75eee6c3e3cdbf833730737 100644 +index fc6639d9729b2714389f191de7a21cb1aa853c75..e5fff59efc2d2794024eae93854a296d2b82cf3e 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1078,6 +1078,7 @@ public class WorldServer extends World { +@@ -1000,6 +1000,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { List[] aentityslice = chunk.getEntitySlices(); // Spigot int i = aentityslice.length; @@ -91,7 +91,7 @@ index 5086a854b84b05e5b9c0f5677051d19dfa42f343..426ca12970e0c75ba75eee6c3e3cdbf8 for (int j = 0; j < i; ++j) { List entityslice = aentityslice[j]; // Spigot Iterator iterator = entityslice.iterator(); -@@ -1090,11 +1091,25 @@ public class WorldServer extends World { +@@ -1012,11 +1013,25 @@ public class WorldServer extends World implements GeneratorAccessSeed { throw (IllegalStateException) SystemUtils.c(new IllegalStateException("Removing entity while ticking!")); } diff --git a/Spigot-Server-Patches/0260-Don-t-call-getItemMeta-on-hasItemMeta.patch b/Spigot-Server-Patches/0258-Don-t-call-getItemMeta-on-hasItemMeta.patch similarity index 93% rename from Spigot-Server-Patches/0260-Don-t-call-getItemMeta-on-hasItemMeta.patch rename to Spigot-Server-Patches/0258-Don-t-call-getItemMeta-on-hasItemMeta.patch index 291655028..69fb6e318 100644 --- a/Spigot-Server-Patches/0260-Don-t-call-getItemMeta-on-hasItemMeta.patch +++ b/Spigot-Server-Patches/0258-Don-t-call-getItemMeta-on-hasItemMeta.patch @@ -11,10 +11,10 @@ Returns true if getDamage() == 0 or has damage tag or other tag is set. Check the `ItemMetaTest#testTaggedButNotMeta` method to see how this method behaves. diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java -index a41be8fdaebe7cf61537c638392b3dc7c7f5b371..d5e8a7ee6de22d09e563ad1c124a18810a38a0c5 100644 +index d315a102a5ae2a79189b39c3b534b8fd733cc9e4..addb8ef990de3dfbf74969ef4c22276d2fa2614a 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java -@@ -553,7 +553,7 @@ public final class CraftItemStack extends ItemStack { +@@ -570,7 +570,7 @@ public final class CraftItemStack extends ItemStack { @Override public boolean hasItemMeta() { @@ -24,7 +24,7 @@ index a41be8fdaebe7cf61537c638392b3dc7c7f5b371..d5e8a7ee6de22d09e563ad1c124a1881 static boolean hasItemMeta(net.minecraft.server.ItemStack item) { diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java -index ba4cc98f1ec39ccfd433aeadf4b5c7018a1d40cc..3504bcac57f973dc56f991d6006c06fa8de5c64b 100644 +index ddbcbd565d5dcb5b1c8d46558e06887e85d589c5..b0edd62eb9066d145cfc52272c71d5f00b7e928d 100644 --- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java +++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java @@ -2,10 +2,9 @@ package org.bukkit.craftbukkit.inventory; diff --git a/Spigot-Server-Patches/0261-Ignore-Dead-Entities-in-entityList-iteration.patch b/Spigot-Server-Patches/0259-Ignore-Dead-Entities-in-entityList-iteration.patch similarity index 76% rename from Spigot-Server-Patches/0261-Ignore-Dead-Entities-in-entityList-iteration.patch rename to Spigot-Server-Patches/0259-Ignore-Dead-Entities-in-entityList-iteration.patch index f73a9fa20..2a7aba294 100644 --- a/Spigot-Server-Patches/0261-Ignore-Dead-Entities-in-entityList-iteration.patch +++ b/Spigot-Server-Patches/0259-Ignore-Dead-Entities-in-entityList-iteration.patch @@ -23,18 +23,18 @@ index b839769ceae8932bb121a0b96fde1e7d129a1f63..5acad8e44f024d3ddf5ef4fd320460ac MutablePair> info = list.computeIfAbsent(key, k -> MutablePair.of(0, Maps.newHashMap())); ChunkCoordIntPair chunk = new ChunkCoordIntPair(e.getChunkX(), e.getChunkZ()); diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 9f369f932ca0a63bde246420cfde7949f3e78ca2..c84d90a9a0c67b5ff518ce3fbc21344c808a3cf1 100644 +index 3ba19f75d24a1539c94f4fed9b8f90aecc918cdc..f7be161c8557ae3848227b1a61e27374770ad243 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -816,6 +816,7 @@ public class Chunk implements IChunkAccess { +@@ -818,6 +818,7 @@ public class Chunk implements IChunkAccess { - while (iterator.hasNext()) { - Entity entity1 = (Entity) iterator.next(); -+ if (entity1.shouldBeRemoved) continue; // Paper + for (int i1 = 0; i1 < l; ++i1) { + Entity entity1 = (Entity) list1.get(i1); ++ if (entity1.shouldBeRemoved) continue; // Paper - if (entity1.getBoundingBox().c(axisalignedbb) && entity1 != entity) { - if (predicate == null || predicate.test(entity1)) { -@@ -853,6 +854,7 @@ public class Chunk implements IChunkAccess { + if (entity1.getBoundingBox().c(axisalignedbb) && entity1 != entity) { + if (predicate == null || predicate.test(entity1)) { +@@ -854,6 +855,7 @@ public class Chunk implements IChunkAccess { while (iterator.hasNext()) { T entity = (T) iterator.next(); // CraftBukkit - decompile error @@ -42,7 +42,7 @@ index 9f369f932ca0a63bde246420cfde7949f3e78ca2..c84d90a9a0c67b5ff518ce3fbc21344c if ((entitytypes == null || entity.getEntityType() == entitytypes) && entity.getBoundingBox().c(axisalignedbb) && predicate.test(entity)) { list.add(entity); -@@ -874,6 +876,7 @@ public class Chunk implements IChunkAccess { +@@ -875,6 +877,7 @@ public class Chunk implements IChunkAccess { while (iterator.hasNext()) { T t0 = (T) iterator.next(); // CraftBukkit - decompile error @@ -51,7 +51,7 @@ index 9f369f932ca0a63bde246420cfde7949f3e78ca2..c84d90a9a0c67b5ff518ce3fbc21344c if (oclass.isInstance(t0) && t0.getBoundingBox().c(axisalignedbb) && (predicate == null || predicate.test(t0))) { // Spigot - instance check list.add(t0); diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 84d36ea84e25a701af22900af6cd3099adf6cd54..6e87ff52df30f4de8cfb11d1dbfb71211d656831 100644 +index b0338278f3cfecdb30e1d2febf1ff2a04d0cc66d..55f8863f823836065f4de8240bfeb490bd391a55 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -195,6 +195,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -63,19 +63,10 @@ index 84d36ea84e25a701af22900af6cd3099adf6cd54..6e87ff52df30f4de8cfb11d1dbfb7121 public float getBukkitYaw() { return this.yaw; diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 426ca12970e0c75ba75eee6c3e3cdbf833730737..3067ab76d94c58fbfd52fac6754bf6d6d7f01d09 100644 +index e5fff59efc2d2794024eae93854a296d2b82cf3e..1a103dd830109e119acc1a371b37386e228586b5 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -908,7 +908,7 @@ public class WorldServer extends World { - - while (objectiterator.hasNext()) { - Entity entity = (Entity) objectiterator.next(); -- -+ if (entity.shouldBeRemoved) continue; // Paper - if (entity instanceof EntityInsentient) { - EntityInsentient entityinsentient = (EntityInsentient) entity; - -@@ -1230,6 +1230,7 @@ public class WorldServer extends World { +@@ -1152,6 +1152,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { entity.origin = entity.getBukkitEntity().getLocation(); } // Paper end @@ -83,7 +74,7 @@ index 426ca12970e0c75ba75eee6c3e3cdbf833730737..3067ab76d94c58fbfd52fac6754bf6d6 new com.destroystokyo.paper.event.entity.EntityAddToWorldEvent(entity.getBukkitEntity()).callEvent(); // Paper - fire while valid } -@@ -1242,6 +1243,7 @@ public class WorldServer extends World { +@@ -1164,6 +1165,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { this.removeEntityFromChunk(entity); this.entitiesById.remove(entity.getId()); this.unregisterEntity(entity); @@ -92,10 +83,10 @@ index 426ca12970e0c75ba75eee6c3e3cdbf833730737..3067ab76d94c58fbfd52fac6754bf6d6 } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index a59172ff043e5220ffdd363582c38ae53c429f1a..6c3cd51d92d2271cd216c42c18733d549fbe668d 100644 +index 0bfe87fe4ff0fbb94a3339ab8f8d62ca32d659a0..265822138eee71daa1d6858adc17985d941d9d4c 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -1027,6 +1027,7 @@ public class CraftWorld implements World { +@@ -1041,6 +1041,7 @@ public class CraftWorld implements World { for (Object o : world.entitiesById.values()) { if (o instanceof net.minecraft.server.Entity) { net.minecraft.server.Entity mcEnt = (net.minecraft.server.Entity) o; @@ -103,7 +94,7 @@ index a59172ff043e5220ffdd363582c38ae53c429f1a..6c3cd51d92d2271cd216c42c18733d54 Entity bukkitEntity = mcEnt.getBukkitEntity(); // Assuming that bukkitEntity isn't null -@@ -1046,6 +1047,7 @@ public class CraftWorld implements World { +@@ -1060,6 +1061,7 @@ public class CraftWorld implements World { for (Object o : world.entitiesById.values()) { if (o instanceof net.minecraft.server.Entity) { net.minecraft.server.Entity mcEnt = (net.minecraft.server.Entity) o; @@ -111,7 +102,7 @@ index a59172ff043e5220ffdd363582c38ae53c429f1a..6c3cd51d92d2271cd216c42c18733d54 Entity bukkitEntity = mcEnt.getBukkitEntity(); // Assuming that bukkitEntity isn't null -@@ -1072,6 +1074,7 @@ public class CraftWorld implements World { +@@ -1086,6 +1088,7 @@ public class CraftWorld implements World { for (Object entity: world.entitiesById.values()) { if (entity instanceof net.minecraft.server.Entity) { @@ -119,7 +110,7 @@ index a59172ff043e5220ffdd363582c38ae53c429f1a..6c3cd51d92d2271cd216c42c18733d54 Entity bukkitEntity = ((net.minecraft.server.Entity) entity).getBukkitEntity(); if (bukkitEntity == null) { -@@ -1095,6 +1098,7 @@ public class CraftWorld implements World { +@@ -1109,6 +1112,7 @@ public class CraftWorld implements World { for (Object entity: world.entitiesById.values()) { if (entity instanceof net.minecraft.server.Entity) { diff --git a/Spigot-Server-Patches/0262-Implement-Expanded-ArmorStand-API.patch b/Spigot-Server-Patches/0260-Implement-Expanded-ArmorStand-API.patch similarity index 94% rename from Spigot-Server-Patches/0262-Implement-Expanded-ArmorStand-API.patch rename to Spigot-Server-Patches/0260-Implement-Expanded-ArmorStand-API.patch index 46045bd25..f305f31ce 100644 --- a/Spigot-Server-Patches/0262-Implement-Expanded-ArmorStand-API.patch +++ b/Spigot-Server-Patches/0260-Implement-Expanded-ArmorStand-API.patch @@ -8,15 +8,15 @@ Add the following: - Enable/Disable slot interactions diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java -index 992d7bfb0fd26540fbdeaf8d7845e8c2c81d608b..61d7d507aaac3e7e5a885387ae89c67dfb1c9844 100644 +index 0232ffba7b18174e0ce44d91285541a9869d07b9..a70b1a17fe884980ef7c3c0a36e567a0e69ef7f0 100644 --- a/src/main/java/net/minecraft/server/EntityArmorStand.java +++ b/src/main/java/net/minecraft/server/EntityArmorStand.java @@ -36,7 +36,7 @@ public class EntityArmorStand extends EntityLiving { private final NonNullList armorItems; private boolean armorStandInvisible; - public long bq; -- private int bB; -+ private int bB; public void setDisabledSlots(int i) { bB = i; } public int getDisabledSlots() { return bB; } // Paper - OBFHELPER + public long bp; +- private int bA; ++ private int bA; public void setDisabledSlots(int i) { bA = i; } public int getDisabledSlots() { return bA; } // Paper - OBFHELPER public Vector3f headPose; public Vector3f bodyPose; public Vector3f leftArmPose; @@ -26,7 +26,7 @@ index 992d7bfb0fd26540fbdeaf8d7845e8c2c81d608b..61d7d507aaac3e7e5a885387ae89c67d + public boolean isSlotDisabled(EnumItemSlot slot) { return this.d(slot); } // Paper - OBFHELPER private boolean d(EnumItemSlot enumitemslot) { - return (this.bB & 1 << enumitemslot.c()) != 0 || enumitemslot.a() == EnumItemSlot.Function.HAND && !this.hasArms(); + return (this.bA & 1 << enumitemslot.c()) != 0 || enumitemslot.a() == EnumItemSlot.Function.HAND && !this.hasArms(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java index 124c3185bc5c344555f684629c8818130d80ab3d..d1d689e5d78c569313c4059c4652724605dc07d2 100644 diff --git a/Spigot-Server-Patches/0261-AnvilDamageEvent.patch b/Spigot-Server-Patches/0261-AnvilDamageEvent.patch new file mode 100644 index 000000000..d8bc4d00a --- /dev/null +++ b/Spigot-Server-Patches/0261-AnvilDamageEvent.patch @@ -0,0 +1,28 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BillyGalbreath +Date: Fri, 20 Jul 2018 23:37:03 -0500 +Subject: [PATCH] AnvilDamageEvent + + +diff --git a/src/main/java/net/minecraft/server/ContainerAnvil.java b/src/main/java/net/minecraft/server/ContainerAnvil.java +index 6b98557f59cb92db9987a58db58cfa3adbd6de48..24631b2bcb2a1d057c1fb6596ff401133c8b548a 100644 +--- a/src/main/java/net/minecraft/server/ContainerAnvil.java ++++ b/src/main/java/net/minecraft/server/ContainerAnvil.java +@@ -67,7 +67,16 @@ public class ContainerAnvil extends ContainerAnvilAbstract { + + if (!entityhuman.abilities.canInstantlyBuild && iblockdata.a((Tag) TagsBlock.ANVIL) && entityhuman.getRandom().nextFloat() < 0.12F) { + IBlockData iblockdata1 = BlockAnvil.c(iblockdata); +- ++ // Paper start ++ com.destroystokyo.paper.event.block.AnvilDamagedEvent event = new com.destroystokyo.paper.event.block.AnvilDamagedEvent(getBukkitView(), iblockdata1 != null ? org.bukkit.craftbukkit.block.data.CraftBlockData.fromData(iblockdata1) : null); ++ if (!event.callEvent()) { ++ return; ++ } else if (event.getDamageState() == com.destroystokyo.paper.event.block.AnvilDamagedEvent.DamageState.BROKEN) { ++ iblockdata1 = null; ++ } else { ++ iblockdata1 = ((org.bukkit.craftbukkit.block.data.CraftBlockData) event.getDamageState().getMaterial().createBlockData()).getState().set(BlockAnvil.FACING, iblockdata.get(BlockAnvil.FACING)); ++ } ++ // Paper end + if (iblockdata1 == null) { + world.a(blockposition, false); + world.triggerEffect(1029, blockposition, 0); diff --git a/Spigot-Server-Patches/0264-Add-TNTPrimeEvent.patch b/Spigot-Server-Patches/0262-Add-TNTPrimeEvent.patch similarity index 84% rename from Spigot-Server-Patches/0264-Add-TNTPrimeEvent.patch rename to Spigot-Server-Patches/0262-Add-TNTPrimeEvent.patch index 10dd1a6d1..86b01ed81 100644 --- a/Spigot-Server-Patches/0264-Add-TNTPrimeEvent.patch +++ b/Spigot-Server-Patches/0262-Add-TNTPrimeEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add TNTPrimeEvent diff --git a/src/main/java/net/minecraft/server/BlockFire.java b/src/main/java/net/minecraft/server/BlockFire.java -index d32857c8724f97c7625208cf815c275264179209..b41de95a6390910ba8bb21bfa12ab61c85900218 100644 +index 9c3b79c1314dedae06278328b6ca722d5ff1e60d..a11a775a929c5f868f1b84c56d7e1715a91db236 100644 --- a/src/main/java/net/minecraft/server/BlockFire.java +++ b/src/main/java/net/minecraft/server/BlockFire.java @@ -2,6 +2,7 @@ package net.minecraft.server; @@ -15,17 +15,17 @@ index d32857c8724f97c7625208cf815c275264179209..b41de95a6390910ba8bb21bfa12ab61c +import com.destroystokyo.paper.event.block.TNTPrimeEvent; // Paper - TNTPrimeEvent import java.util.Map; import java.util.Random; - import java.util.Map.Entry; -@@ -237,7 +238,7 @@ public class BlockFire extends Block { - world.setTypeAndData(blockposition, (IBlockData) this.a((IBlockAccess) world, blockposition).set(BlockFire.AGE, l), 3); +@@ -253,7 +254,7 @@ public class BlockFire extends BlockFireAbstract { + + world.setTypeAndData(blockposition, this.a(world, blockposition, l), 3); } else { - world.a(blockposition, false); + if(iblockdata.getBlock() != Blocks.TNT) world.a(blockposition, false); // Paper - TNTPrimeEvent - We might be cancelling it below, move the setAir down } Block block = iblockdata.getBlock(); -@@ -245,6 +246,13 @@ public class BlockFire extends Block { +@@ -261,6 +262,13 @@ public class BlockFire extends BlockFireAbstract { if (block instanceof BlockTNT) { BlockTNT blocktnt = (BlockTNT) block; @@ -40,7 +40,7 @@ index d32857c8724f97c7625208cf815c275264179209..b41de95a6390910ba8bb21bfa12ab61c } } diff --git a/src/main/java/net/minecraft/server/BlockTNT.java b/src/main/java/net/minecraft/server/BlockTNT.java -index 6cb82420b428fdc7bbcd4f22f1f65ba085a7f3c2..592fcd538a4e25d7779328d6d6cd8efda238b55d 100644 +index c6fe9c1f7ef06c4524533130b493ca5e72bd1693..7b601955f3fd36f06c838b896b455a606954d980 100644 --- a/src/main/java/net/minecraft/server/BlockTNT.java +++ b/src/main/java/net/minecraft/server/BlockTNT.java @@ -1,6 +1,7 @@ @@ -53,7 +53,7 @@ index 6cb82420b428fdc7bbcd4f22f1f65ba085a7f3c2..592fcd538a4e25d7779328d6d6cd8efd @@ -15,6 +16,11 @@ public class BlockTNT extends Block { public void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag) { - if (iblockdata1.getBlock() != iblockdata.getBlock()) { + if (!iblockdata1.a(iblockdata.getBlock())) { if (world.isBlockIndirectlyPowered(blockposition)) { + // Paper start - TNTPrimeEvent + org.bukkit.block.Block tntBlock = MCUtil.toBukkitBlock(world, blockposition);; @@ -80,12 +80,12 @@ index 6cb82420b428fdc7bbcd4f22f1f65ba085a7f3c2..592fcd538a4e25d7779328d6d6cd8efd public void wasExploded(World world, BlockPosition blockposition, Explosion explosion) { if (!world.isClientSide) { + // Paper start - TNTPrimeEvent -+ org.bukkit.block.Block tntBlock = MCUtil.toBukkitBlock(world, blockposition);; ++ org.bukkit.block.Block tntBlock = MCUtil.toBukkitBlock(world, blockposition); + org.bukkit.entity.Entity source = explosion.source != null ? explosion.source.getBukkitEntity() : null; + if(!new TNTPrimeEvent(tntBlock, TNTPrimeEvent.PrimeReason.EXPLOSION, source).callEvent()) + return; + // Paper end - EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) blockposition.getX() + 0.5F), (double) blockposition.getY(), (double) ((float) blockposition.getZ() + 0.5F), explosion.getSource()); + EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, explosion.getSource()); entitytntprimed.setFuseTicks((short) (world.random.nextInt(entitytntprimed.getFuseTicks() / 4) + entitytntprimed.getFuseTicks() / 8)); @@ -71,6 +88,11 @@ public class BlockTNT extends Block { @@ -100,22 +100,22 @@ index 6cb82420b428fdc7bbcd4f22f1f65ba085a7f3c2..592fcd538a4e25d7779328d6d6cd8efd a(world, blockposition, (EntityLiving) entityhuman); world.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 11); if (!entityhuman.isCreative()) { -@@ -101,6 +123,13 @@ public class BlockTNT extends Block { +@@ -100,6 +122,13 @@ public class BlockTNT extends Block { } // CraftBukkit end + // Paper start - TNTPrimeEvent + org.bukkit.block.Block tntBlock = MCUtil.toBukkitBlock(world, blockposition); -+ if (!new TNTPrimeEvent(tntBlock, TNTPrimeEvent.PrimeReason.PROJECTILE, entityarrow.getBukkitEntity()).callEvent()) { ++ if (!new TNTPrimeEvent(tntBlock, TNTPrimeEvent.PrimeReason.PROJECTILE, iprojectile.getBukkitEntity()).callEvent()) { + return; + } + // Paper end + - a(world, blockposition, entity1 instanceof EntityLiving ? (EntityLiving) entity1 : null); + a(world, blockposition, entity instanceof EntityLiving ? (EntityLiving) entity : null); world.a(blockposition, false); } diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java -index 138e2ea56a91e519a34fd3be9c0ab111a4b17544..6a4ccaeb0fef2cabab87b33bf89b5a68608800e9 100644 +index 05b7cdb33b45a4f503cd7fe4130b54d59e7b6452..3cb8ce58c4675564fb239338d6c40ea511a9a97c 100644 --- a/src/main/java/net/minecraft/server/EntityEnderDragon.java +++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java @@ -11,6 +11,7 @@ import org.bukkit.craftbukkit.block.CraftBlock; @@ -126,12 +126,12 @@ index 138e2ea56a91e519a34fd3be9c0ab111a4b17544..6a4ccaeb0fef2cabab87b33bf89b5a68 // PAIL: Fixme public class EntityEnderDragon extends EntityInsentient implements IMonster { -@@ -468,6 +469,11 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster { +@@ -466,6 +467,11 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster { }); - craftBlock.getNMS().dropNaturally(world, blockposition, ItemStack.a); + craftBlock.getNMS().dropNaturally(world, blockposition, ItemStack.b); } + // Paper start - TNTPrimeEvent -+ org.bukkit.block.Block tntBlock = world.getWorld().getBlockAt(blockposition.x, blockposition.y, blockposition.z); ++ org.bukkit.block.Block tntBlock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); + if(!new TNTPrimeEvent(tntBlock, TNTPrimeEvent.PrimeReason.EXPLOSION, explosionSource.getSource().getBukkitEntity()).callEvent()) + continue; + // Paper end diff --git a/Spigot-Server-Patches/0263-AnvilDamageEvent.patch b/Spigot-Server-Patches/0263-AnvilDamageEvent.patch deleted file mode 100644 index 80bbc3bcb..000000000 --- a/Spigot-Server-Patches/0263-AnvilDamageEvent.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: BillyGalbreath -Date: Fri, 20 Jul 2018 23:37:03 -0500 -Subject: [PATCH] AnvilDamageEvent - - -diff --git a/src/main/java/net/minecraft/server/ContainerAnvil.java b/src/main/java/net/minecraft/server/ContainerAnvil.java -index 1d9ce5ef1cc0158e8218d4cf15bc1e84017e7620..286b930ddb7224fa3929cb0ef0b94f5f5205b104 100644 ---- a/src/main/java/net/minecraft/server/ContainerAnvil.java -+++ b/src/main/java/net/minecraft/server/ContainerAnvil.java -@@ -85,6 +85,16 @@ public class ContainerAnvil extends Container { - - if (!entityhuman.abilities.canInstantlyBuild && iblockdata.a(TagsBlock.ANVIL) && entityhuman.getRandom().nextFloat() < 0.12F) { - IBlockData iblockdata1 = BlockAnvil.e(iblockdata); -+ // Paper start -+ com.destroystokyo.paper.event.block.AnvilDamagedEvent event = new com.destroystokyo.paper.event.block.AnvilDamagedEvent(getBukkitView(), iblockdata1 != null ? org.bukkit.craftbukkit.block.data.CraftBlockData.fromData(iblockdata1) : null); -+ if (!event.callEvent()) { -+ return; -+ } else if (event.getDamageState() == com.destroystokyo.paper.event.block.AnvilDamagedEvent.DamageState.BROKEN) { -+ iblockdata1 = null; -+ } else { -+ iblockdata1 = ((org.bukkit.craftbukkit.block.data.CraftBlockData) event.getDamageState().getMaterial().createBlockData()).getState().set(BlockAnvil.FACING, iblockdata.get(BlockAnvil.FACING)); -+ } -+ // Paper end - - if (iblockdata1 == null) { - world.a(blockposition, false); diff --git a/Spigot-Server-Patches/0265-Break-up-and-make-tab-spam-limits-configurable.patch b/Spigot-Server-Patches/0263-Break-up-and-make-tab-spam-limits-configurable.patch similarity index 92% rename from Spigot-Server-Patches/0265-Break-up-and-make-tab-spam-limits-configurable.patch rename to Spigot-Server-Patches/0263-Break-up-and-make-tab-spam-limits-configurable.patch index b078dbfe9..d3b964a7a 100644 --- a/Spigot-Server-Patches/0265-Break-up-and-make-tab-spam-limits-configurable.patch +++ b/Spigot-Server-Patches/0263-Break-up-and-make-tab-spam-limits-configurable.patch @@ -22,10 +22,10 @@ to take the burden of this into their own hand without having to rely on plugins doing unsafe things. diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 26ab855dcf38446a3d8577108bd16fdbb76126b2..adef07d4d521b4aaa6f3389b04aa27e29bec0229 100644 +index c8a7d8092a2849b62a8d83d7970756fd76100025..2e5c71d6b7d120a308076d95a3d5b73c5aca8bc9 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -287,4 +287,18 @@ public class PaperConfig { +@@ -288,4 +288,18 @@ public class PaperConfig { Bukkit.getLogger().log(Level.INFO, "Using Aikar's Alternative Luck Formula to apply Luck attribute to all loot pool calculations. See https://luckformula.emc.gs"); } } @@ -45,7 +45,7 @@ index 26ab855dcf38446a3d8577108bd16fdbb76126b2..adef07d4d521b4aaa6f3389b04aa27e2 + } } diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 4fb5c47fc8505c6a6e68d21a240887a0cbe10d14..94469cf71f6617cd4fd9682781c8a3ef04ff3f9b 100644 +index e3391017b3dcfbfc942b84118391928a6a5b807c..351cb9643b05e83f97a7976979346325e76f44da 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -76,6 +76,7 @@ public class PlayerConnection implements PacketListenerPlayIn { @@ -56,7 +56,7 @@ index 4fb5c47fc8505c6a6e68d21a240887a0cbe10d14..94469cf71f6617cd4fd9682781c8a3ef // CraftBukkit end private int j; private final Int2ShortMap k = new Int2ShortOpenHashMap(); -@@ -207,6 +208,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -206,6 +207,7 @@ public class PlayerConnection implements PacketListenerPlayIn { this.minecraftServer.getMethodProfiler().exit(); // CraftBukkit start for (int spam; (spam = this.chatThrottle) > 0 && !chatSpamField.compareAndSet(this, spam, spam - 1); ) ; @@ -64,7 +64,7 @@ index 4fb5c47fc8505c6a6e68d21a240887a0cbe10d14..94469cf71f6617cd4fd9682781c8a3ef /* Use thread-safe field access instead if (this.chatThrottle > 0) { --this.chatThrottle; -@@ -526,7 +528,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -529,7 +531,7 @@ public class PlayerConnection implements PacketListenerPlayIn { public void a(PacketPlayInTabComplete packetplayintabcomplete) { // PlayerConnectionUtils.ensureMainThread(packetplayintabcomplete, this, this.player.getWorldServer()); // Paper - run this async // CraftBukkit start diff --git a/Spigot-Server-Patches/0264-Add-hand-to-bucket-events.patch b/Spigot-Server-Patches/0264-Add-hand-to-bucket-events.patch new file mode 100644 index 000000000..5db5c21d1 --- /dev/null +++ b/Spigot-Server-Patches/0264-Add-hand-to-bucket-events.patch @@ -0,0 +1,174 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: BillyGalbreath +Date: Thu, 2 Aug 2018 08:44:35 -0500 +Subject: [PATCH] Add hand to bucket events + + +diff --git a/src/main/java/net/minecraft/server/EntityCow.java b/src/main/java/net/minecraft/server/EntityCow.java +index 28f97aea9c64678c6e6f821482ad47388af83089..30ee6df6b47c7cfa555a757a01270b986e4fdf9e 100644 +--- a/src/main/java/net/minecraft/server/EntityCow.java ++++ b/src/main/java/net/minecraft/server/EntityCow.java +@@ -58,7 +58,7 @@ public class EntityCow extends EntityAnimal { + + if (itemstack.getItem() == Items.BUCKET && !this.isBaby()) { + // CraftBukkit start - Got milk? +- org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((WorldServer) entityhuman.world, entityhuman, this.getChunkCoordinates(), this.getChunkCoordinates(), null, itemstack, Items.MILK_BUCKET); ++ org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((WorldServer) entityhuman.world, entityhuman, this.getChunkCoordinates(), this.getChunkCoordinates(), null, itemstack, Items.MILK_BUCKET, enumhand); // Paper - add enumHand + + if (event.isCancelled()) { + return EnumInteractionResult.PASS; +diff --git a/src/main/java/net/minecraft/server/ItemBucket.java b/src/main/java/net/minecraft/server/ItemBucket.java +index 48958308a89cbe39e1b4dddcdd8d1d0b5ece6339..120bf8436fd82294c339add2e7bff1cda8311aea 100644 +--- a/src/main/java/net/minecraft/server/ItemBucket.java ++++ b/src/main/java/net/minecraft/server/ItemBucket.java +@@ -41,7 +41,7 @@ public class ItemBucket extends Item { + if (iblockdata.getBlock() instanceof IFluidSource) { + // CraftBukkit start + FluidType dummyFluid = ((IFluidSource) iblockdata.getBlock()).removeFluid(DummyGeneratorAccess.INSTANCE, blockposition, iblockdata); +- PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((WorldServer) world, entityhuman, blockposition, blockposition, movingobjectpositionblock.getDirection(), itemstack, dummyFluid.a()); ++ PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((WorldServer) world, entityhuman, blockposition, blockposition, movingobjectpositionblock.getDirection(), itemstack, dummyFluid.a(), enumhand); // Paper - add enumhand + + if (event.isCancelled()) { + ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutBlockChange(world, blockposition)); // SPIGOT-5163 (see PlayerInteractManager) +@@ -69,7 +69,7 @@ public class ItemBucket extends Item { + iblockdata = world.getType(blockposition); + BlockPosition blockposition2 = iblockdata.getBlock() instanceof IFluidContainer && this.fluidType == FluidTypes.WATER ? blockposition : blockposition1; + +- if (this.a(entityhuman, world, blockposition2, movingobjectpositionblock1, movingobjectpositionblock1.getDirection(), blockposition, itemstack)) { // CraftBukkit ++ if (this.a(entityhuman, world, blockposition2, movingobjectpositionblock1, movingobjectpositionblock1.getDirection(), blockposition, itemstack, enumhand)) { // CraftBukkit // Paper - add enumhand + this.a(world, itemstack, blockposition2); + if (entityhuman instanceof EntityPlayer) { + CriterionTriggers.y.a((EntityPlayer) entityhuman, blockposition2, itemstack); +@@ -94,10 +94,12 @@ public class ItemBucket extends Item { + public void a(World world, ItemStack itemstack, BlockPosition blockposition) {} + + public boolean a(@Nullable EntityHuman entityhuman, World world, BlockPosition blockposition, @Nullable MovingObjectPositionBlock movingobjectpositionblock) { +- return a(entityhuman, world, blockposition, movingobjectpositionblock, null, null, null); ++ // Paper start - add enumHand ++ return a(entityhuman, world, blockposition, movingobjectpositionblock, null, null, null, null); + } + +- public boolean a(EntityHuman entityhuman, World world, BlockPosition blockposition, @Nullable MovingObjectPositionBlock movingobjectpositionblock, EnumDirection enumdirection, BlockPosition clicked, ItemStack itemstack) { ++ public boolean a(EntityHuman entityhuman, World world, BlockPosition blockposition, @Nullable MovingObjectPositionBlock movingobjectpositionblock, EnumDirection enumdirection, BlockPosition clicked, ItemStack itemstack, EnumHand enumhand) { ++ // Paper end + // CraftBukkit end + if (!(this.fluidType instanceof FluidTypeFlowing)) { + return false; +@@ -110,7 +112,7 @@ public class ItemBucket extends Item { + + // CraftBukkit start + if (flag1 && entityhuman != null) { +- PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent((WorldServer) world, entityhuman, blockposition, clicked, enumdirection, itemstack); ++ PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent((WorldServer) world, entityhuman, blockposition, clicked, enumdirection, itemstack, enumhand); // Paper - add enumhand + if (event.isCancelled()) { + ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutBlockChange(world, blockposition)); // SPIGOT-4238: needed when looking through entity + ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); // SPIGOT-4541 +@@ -119,7 +121,7 @@ public class ItemBucket extends Item { + } + // CraftBukkit end + if (!flag1) { +- return movingobjectpositionblock != null && this.a(entityhuman, world, movingobjectpositionblock.getBlockPosition().shift(movingobjectpositionblock.getDirection()), (MovingObjectPositionBlock) null, enumdirection, clicked, itemstack); // CraftBukkit ++ return movingobjectpositionblock != null && this.a(entityhuman, world, movingobjectpositionblock.getBlockPosition().shift(movingobjectpositionblock.getDirection()), (MovingObjectPositionBlock) null, enumdirection, clicked, itemstack, enumhand); // CraftBukkit // Paper - add enumhand + } else if (world.getDimensionManager().isNether() && this.fluidType.a((Tag) TagsFluid.WATER)) { + int i = blockposition.getX(); + int j = blockposition.getY(); +diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java +index ca3e831e3191dd8ffe7f2b6ab9ecc05acfe1b0af..cc4421aa61d7d87c164c1f88ad8b5fa0df7176f1 100644 +--- a/src/main/java/net/minecraft/server/World.java ++++ b/src/main/java/net/minecraft/server/World.java +@@ -212,6 +212,17 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + } + // Paper end + ++ // Paper start - moved up from WorldServer ++ public BlockPosition getSpawn() { ++ BlockPosition blockposition = new BlockPosition(this.worldData.a(), this.worldData.b(), this.worldData.c()); ++ ++ if (!this.getWorldBorder().a(blockposition)) { ++ blockposition = this.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING, new BlockPosition(this.getWorldBorder().getCenterX(), 0.0D, this.getWorldBorder().getCenterZ())); ++ } ++ ++ return blockposition; ++ } ++ // Paper end + @Override + public boolean s_() { + return this.isClientSide; +diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java +index 1a103dd830109e119acc1a371b37386e228586b5..a343cba51850bb7214c241a92db0694d3c1aaf60 100644 +--- a/src/main/java/net/minecraft/server/WorldServer.java ++++ b/src/main/java/net/minecraft/server/WorldServer.java +@@ -1483,15 +1483,17 @@ public class WorldServer extends World implements GeneratorAccessSeed { + this.getMinecraftServer().getPlayerList().sendAll(new PacketPlayOutSpawnPosition(blockposition)); + } + +- public BlockPosition getSpawn() { +- BlockPosition blockposition = new BlockPosition(this.worldData.a(), this.worldData.b(), this.worldData.c()); +- +- if (!this.getWorldBorder().a(blockposition)) { +- blockposition = this.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING, new BlockPosition(this.getWorldBorder().getCenterX(), 0.0D, this.getWorldBorder().getCenterZ())); +- } +- +- return blockposition; +- } ++ // Paper - moved up to World ++ //public BlockPosition getSpawn() { ++ // BlockPosition blockposition = new BlockPosition(this.worldData.a(), this.worldData.b(), this.worldData.c()); ++ // ++ // if (!this.getWorldBorder().a(blockposition)) { ++ // blockposition = this.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING, new BlockPosition(this.getWorldBorder().getCenterX(), 0.0D, this.getWorldBorder().getCenterZ())); ++ // } ++ // ++ // return blockposition; ++ //} ++ // Paper end + + public LongSet getForceLoadedChunks() { + ForcedChunk forcedchunk = (ForcedChunk) this.getWorldPersistentData().b(ForcedChunk::new, "chunks"); +diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +index cf25906786e246cb8dfdb5f2cb39f6dc08c4d7ca..f6c8c371e22272983f80268dab8009ee029bed2a 100644 +--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java ++++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +@@ -228,7 +228,7 @@ public class CraftEventFactory { + public static Entity entityDamage; // For use in EntityDamageByEntityEvent + + // helper methods +- private static boolean canBuild(WorldServer world, Player player, int x, int z) { ++ private static boolean canBuild(World world, Player player, int x, int z) { + int spawnSize = Bukkit.getServer().getSpawnRadius(); + + if (world.getDimensionKey() != World.OVERWORLD) return true; +@@ -407,6 +407,20 @@ public class CraftEventFactory { + } + + private static PlayerEvent getPlayerBucketEvent(boolean isFilling, WorldServer world, EntityHuman who, BlockPosition changed, BlockPosition clicked, EnumDirection clickedFace, ItemStack itemstack, net.minecraft.server.Item item) { ++ // Paper start - add enumHand ++ return getPlayerBucketEvent(isFilling, world, who, changed, clicked, clickedFace, itemstack, item, null); ++ } ++ ++ public static PlayerBucketEmptyEvent callPlayerBucketEmptyEvent(World world, EntityHuman who, BlockPosition changed, BlockPosition clicked, EnumDirection clickedFace, ItemStack itemstack, EnumHand enumHand) { ++ return (PlayerBucketEmptyEvent) getPlayerBucketEvent(false, world, who, changed, clicked, clickedFace, itemstack, Items.BUCKET, enumHand); ++ } ++ ++ public static PlayerBucketFillEvent callPlayerBucketFillEvent(World world, EntityHuman who, BlockPosition changed, BlockPosition clicked, EnumDirection clickedFace, ItemStack itemInHand, net.minecraft.server.Item bucket, EnumHand enumHand) { ++ return (PlayerBucketFillEvent) getPlayerBucketEvent(true, world, who, clicked, changed, clickedFace, itemInHand, bucket, enumHand); ++ } ++ ++ private static PlayerEvent getPlayerBucketEvent(boolean isFilling, World world, EntityHuman who, BlockPosition changed, BlockPosition clicked, EnumDirection clickedFace, ItemStack itemstack, net.minecraft.server.Item item, EnumHand enumHand) { ++ // Paper end + Player player = (Player) who.getBukkitEntity(); + CraftItemStack itemInHand = CraftItemStack.asNewCraftStack(item); + Material bucket = CraftMagicNumbers.getMaterial(itemstack.getItem()); +@@ -419,10 +433,10 @@ public class CraftEventFactory { + + PlayerEvent event; + if (isFilling) { +- event = new PlayerBucketFillEvent(player, block, blockClicked, blockFace, bucket, itemInHand); ++ event = new PlayerBucketFillEvent(player, block, blockClicked, blockFace, bucket, itemInHand, enumHand == null ? null : enumHand == EnumHand.OFF_HAND ? EquipmentSlot.OFF_HAND : EquipmentSlot.HAND); // Paper - add enumHand + ((PlayerBucketFillEvent) event).setCancelled(!canBuild(world, player, changed.getX(), changed.getZ())); + } else { +- event = new PlayerBucketEmptyEvent(player, block, blockClicked, blockFace, bucket, itemInHand); ++ event = new PlayerBucketEmptyEvent(player, block, blockClicked, blockFace, bucket, itemInHand, enumHand == null ? null : enumHand == EnumHand.OFF_HAND ? EquipmentSlot.OFF_HAND : EquipmentSlot.HAND); // Paper - add enumHand + ((PlayerBucketEmptyEvent) event).setCancelled(!canBuild(world, player, changed.getX(), changed.getZ())); + } + diff --git a/Spigot-Server-Patches/0267-MC-135506-Experience-should-save-as-Integers.patch b/Spigot-Server-Patches/0265-MC-135506-Experience-should-save-as-Integers.patch similarity index 76% rename from Spigot-Server-Patches/0267-MC-135506-Experience-should-save-as-Integers.patch rename to Spigot-Server-Patches/0265-MC-135506-Experience-should-save-as-Integers.patch index 7d74291ab..d04dfa6a4 100644 --- a/Spigot-Server-Patches/0267-MC-135506-Experience-should-save-as-Integers.patch +++ b/Spigot-Server-Patches/0265-MC-135506-Experience-should-save-as-Integers.patch @@ -5,11 +5,11 @@ Subject: [PATCH] MC-135506: Experience should save as Integers diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java -index 87c6b77ce3b1446893a0d617b63f925a403e09cc..53c6c3389216c1fc5c0789b4a1621acb239cc9ec 100644 +index 7f2d8de12473c5413bbfc10ea0947d6a30802645..2396b4d6ffda648c24fc39cef22792c7d9247456 100644 --- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java +++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java -@@ -207,7 +207,7 @@ public class EntityExperienceOrb extends Entity { - public void b(NBTTagCompound nbttagcompound) { +@@ -202,7 +202,7 @@ public class EntityExperienceOrb extends Entity { + public void saveData(NBTTagCompound nbttagcompound) { nbttagcompound.setShort("Health", (short) this.e); nbttagcompound.setShort("Age", (short) this.c); - nbttagcompound.setShort("Value", (short) this.value); @@ -17,8 +17,8 @@ index 87c6b77ce3b1446893a0d617b63f925a403e09cc..53c6c3389216c1fc5c0789b4a1621acb this.savePaperNBT(nbttagcompound); // Paper } -@@ -215,7 +215,7 @@ public class EntityExperienceOrb extends Entity { - public void a(NBTTagCompound nbttagcompound) { +@@ -210,7 +210,7 @@ public class EntityExperienceOrb extends Entity { + public void loadData(NBTTagCompound nbttagcompound) { this.e = nbttagcompound.getShort("Health"); this.c = nbttagcompound.getShort("Age"); - this.value = nbttagcompound.getShort("Value"); diff --git a/Spigot-Server-Patches/0266-Add-hand-to-bucket-events.patch b/Spigot-Server-Patches/0266-Add-hand-to-bucket-events.patch deleted file mode 100644 index 6ef868cfa..000000000 --- a/Spigot-Server-Patches/0266-Add-hand-to-bucket-events.patch +++ /dev/null @@ -1,108 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: BillyGalbreath -Date: Thu, 2 Aug 2018 08:44:35 -0500 -Subject: [PATCH] Add hand to bucket events - - -diff --git a/src/main/java/net/minecraft/server/EntityCow.java b/src/main/java/net/minecraft/server/EntityCow.java -index 6e385b53048da91a0f50bf02f6510de2a685baab..2c8bbf20ae7f9be2c57822833bb285b86ea1a901 100644 ---- a/src/main/java/net/minecraft/server/EntityCow.java -+++ b/src/main/java/net/minecraft/server/EntityCow.java -@@ -61,7 +61,7 @@ public class EntityCow extends EntityAnimal { - - if (itemstack.getItem() == Items.BUCKET && !entityhuman.abilities.canInstantlyBuild && !this.isBaby()) { - // CraftBukkit start - Got milk? -- org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(entityhuman.world, entityhuman, this.getChunkCoordinates(), this.getChunkCoordinates(), null, itemstack, Items.MILK_BUCKET); -+ org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(entityhuman.world, entityhuman, this.getChunkCoordinates(), this.getChunkCoordinates(), null, itemstack, Items.MILK_BUCKET, enumhand); // Paper - add enumHand - - if (event.isCancelled()) { - return false; -diff --git a/src/main/java/net/minecraft/server/ItemBucket.java b/src/main/java/net/minecraft/server/ItemBucket.java -index 7c5c0498435e3fae6a7997e34f197d402daa3bd8..ffe4b9eb868ecd9582ba1d3fc3aef0f82372e852 100644 ---- a/src/main/java/net/minecraft/server/ItemBucket.java -+++ b/src/main/java/net/minecraft/server/ItemBucket.java -@@ -41,7 +41,7 @@ public class ItemBucket extends Item { - if (iblockdata.getBlock() instanceof IFluidSource) { - // CraftBukkit start - FluidType dummyFluid = ((IFluidSource) iblockdata.getBlock()).removeFluid(DummyGeneratorAccess.INSTANCE, blockposition, iblockdata); -- PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(world, entityhuman, blockposition, blockposition, movingobjectpositionblock.getDirection(), itemstack, dummyFluid.a()); -+ PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(world, entityhuman, blockposition, blockposition, movingobjectpositionblock.getDirection(), itemstack, dummyFluid.a(), enumhand); - - if (event.isCancelled()) { - ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutBlockChange(world, blockposition)); // SPIGOT-5163 (see PlayerInteractManager) -@@ -69,7 +69,7 @@ public class ItemBucket extends Item { - iblockdata = world.getType(blockposition); - BlockPosition blockposition2 = iblockdata.getBlock() instanceof IFluidContainer && this.fluidType == FluidTypes.WATER ? blockposition : blockposition1; - -- if (this.a(entityhuman, world, blockposition2, movingobjectpositionblock, movingobjectpositionblock.getDirection(), blockposition, itemstack)) { // CraftBukkit -+ if (this.a(entityhuman, world, blockposition2, movingobjectpositionblock, movingobjectpositionblock.getDirection(), blockposition, itemstack, enumhand)) { // CraftBukkit // Paper - add enumhand - this.a(world, itemstack, blockposition2); - if (entityhuman instanceof EntityPlayer) { - CriterionTriggers.y.a((EntityPlayer) entityhuman, blockposition2, itemstack); -@@ -115,10 +115,12 @@ public class ItemBucket extends Item { - - // CraftBukkit start - public boolean a(@Nullable EntityHuman entityhuman, World world, BlockPosition blockposition, @Nullable MovingObjectPositionBlock movingobjectpositionblock) { -- return a(entityhuman, world, blockposition, movingobjectpositionblock, null, null, null); -+ // Paper start - add enumHand -+ return a(entityhuman, world, blockposition, movingobjectpositionblock, null, null, null, null); - } - -- public boolean a(EntityHuman entityhuman, World world, BlockPosition blockposition, @Nullable MovingObjectPositionBlock movingobjectpositionblock, EnumDirection enumdirection, BlockPosition clicked, ItemStack itemstack) { -+ public boolean a(EntityHuman entityhuman, World world, BlockPosition blockposition, @Nullable MovingObjectPositionBlock movingobjectpositionblock, EnumDirection enumdirection, BlockPosition clicked, ItemStack itemstack, EnumHand enumhand) { -+ // Paper end - // CraftBukkit end - if (!(this.fluidType instanceof FluidTypeFlowing)) { - return false; -@@ -128,11 +130,11 @@ public class ItemBucket extends Item { - boolean flag = iblockdata.a(this.fluidType); - - if (!iblockdata.isAir() && !flag && (!(iblockdata.getBlock() instanceof IFluidContainer) || !((IFluidContainer) iblockdata.getBlock()).canPlace(world, blockposition, iblockdata, this.fluidType))) { -- return movingobjectpositionblock == null ? false : this.a(entityhuman, world, movingobjectpositionblock.getBlockPosition().shift(movingobjectpositionblock.getDirection()), (MovingObjectPositionBlock) null, enumdirection, clicked, itemstack); // CraftBukkit -+ return movingobjectpositionblock == null ? false : this.a(entityhuman, world, movingobjectpositionblock.getBlockPosition().shift(movingobjectpositionblock.getDirection()), (MovingObjectPositionBlock) null, enumdirection, clicked, itemstack, enumhand); // CraftBukkit - } else { - // CraftBukkit start - if (entityhuman != null) { -- PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent(world, entityhuman, blockposition, clicked, enumdirection, itemstack); -+ PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent(world, entityhuman, blockposition, clicked, enumdirection, itemstack, enumhand); - if (event.isCancelled()) { - ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutBlockChange(world, blockposition)); // SPIGOT-4238: needed when looking through entity - ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); // SPIGOT-4541 -diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 0125bf43e3383fddf7c36d831d19cca3f1ee3fae..4329780e9de3337fd8fcca78b1ed8804e4687552 100644 ---- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -381,6 +381,20 @@ public class CraftEventFactory { - } - - private static PlayerEvent getPlayerBucketEvent(boolean isFilling, World world, EntityHuman who, BlockPosition changed, BlockPosition clicked, EnumDirection clickedFace, ItemStack itemstack, net.minecraft.server.Item item) { -+ // Paper start - add enumHand -+ return getPlayerBucketEvent(isFilling, world, who, changed, clicked, clickedFace, itemstack, item, null); -+ } -+ -+ public static PlayerBucketEmptyEvent callPlayerBucketEmptyEvent(World world, EntityHuman who, BlockPosition changed, BlockPosition clicked, EnumDirection clickedFace, ItemStack itemstack, EnumHand enumHand) { -+ return (PlayerBucketEmptyEvent) getPlayerBucketEvent(false, world, who, changed, clicked, clickedFace, itemstack, Items.BUCKET, enumHand); -+ } -+ -+ public static PlayerBucketFillEvent callPlayerBucketFillEvent(World world, EntityHuman who, BlockPosition changed, BlockPosition clicked, EnumDirection clickedFace, ItemStack itemInHand, net.minecraft.server.Item bucket, EnumHand enumHand) { -+ return (PlayerBucketFillEvent) getPlayerBucketEvent(true, world, who, clicked, changed, clickedFace, itemInHand, bucket, enumHand); -+ } -+ -+ private static PlayerEvent getPlayerBucketEvent(boolean isFilling, World world, EntityHuman who, BlockPosition changed, BlockPosition clicked, EnumDirection clickedFace, ItemStack itemstack, net.minecraft.server.Item item, EnumHand enumHand) { -+ // Paper end - Player player = (Player) who.getBukkitEntity(); - CraftItemStack itemInHand = CraftItemStack.asNewCraftStack(item); - Material bucket = CraftMagicNumbers.getMaterial(itemstack.getItem()); -@@ -393,10 +407,10 @@ public class CraftEventFactory { - - PlayerEvent event; - if (isFilling) { -- event = new PlayerBucketFillEvent(player, block, blockClicked, blockFace, bucket, itemInHand); -+ event = new PlayerBucketFillEvent(player, block, blockClicked, blockFace, bucket, itemInHand, enumHand == null ? null : enumHand == EnumHand.OFF_HAND ? EquipmentSlot.OFF_HAND : EquipmentSlot.HAND); // Paper - add enumHand - ((PlayerBucketFillEvent) event).setCancelled(!canBuild(world, player, changed.getX(), changed.getZ())); - } else { -- event = new PlayerBucketEmptyEvent(player, block, blockClicked, blockFace, bucket, itemInHand); -+ event = new PlayerBucketEmptyEvent(player, block, blockClicked, blockFace, bucket, itemInHand, enumHand == null ? null : enumHand == EnumHand.OFF_HAND ? EquipmentSlot.OFF_HAND : EquipmentSlot.HAND); // Paper - add enumHand - ((PlayerBucketEmptyEvent) event).setCancelled(!canBuild(world, player, changed.getX(), changed.getZ())); - } - diff --git a/Spigot-Server-Patches/0268-Fix-client-rendering-skulls-from-same-user.patch b/Spigot-Server-Patches/0266-Fix-client-rendering-skulls-from-same-user.patch similarity index 76% rename from Spigot-Server-Patches/0268-Fix-client-rendering-skulls-from-same-user.patch rename to Spigot-Server-Patches/0266-Fix-client-rendering-skulls-from-same-user.patch index d26dddde1..4fd155690 100644 --- a/Spigot-Server-Patches/0268-Fix-client-rendering-skulls-from-same-user.patch +++ b/Spigot-Server-Patches/0266-Fix-client-rendering-skulls-from-same-user.patch @@ -12,24 +12,24 @@ This allows the client to render multiple skull textures from the same user, for when different skins were used when skull was made. diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java -index 641a52b968ef04a142b32703b61c8b75643b36a6..0b0c3c681c07cf8506df1b91b1feaf130891a440 100644 +index 7b2010ec4955fb5788c60178c6e306ea3098e9ba..95e801a9a7ca405ff7e80c920fa78493d0ef5374 100644 --- a/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java -@@ -54,7 +54,7 @@ public final class ItemStack { - // Paper end +@@ -60,7 +60,7 @@ public final class ItemStack { + private int g; @Deprecated private Item item; - private NBTTagCompound tag; + NBTTagCompound tag; // Paper -> package private - private boolean h; - private EntityItemFrame i; - private ShapeDetectorBlock j; + private boolean j; + private Entity k; + private ShapeDetectorBlock l; diff --git a/src/main/java/net/minecraft/server/PacketDataSerializer.java b/src/main/java/net/minecraft/server/PacketDataSerializer.java -index d9574a9ace96d8c5666e62a5aed96a67021b91d8..e810da87977b441cc329066e3cb158ef3bc62a66 100644 +index 6e049c2e2a142ce022b9dc278a3bb302f723e42c..7e116d83a62ef42e241ee9e05fdd7ecb30a2ed95 100644 --- a/src/main/java/net/minecraft/server/PacketDataSerializer.java +++ b/src/main/java/net/minecraft/server/PacketDataSerializer.java -@@ -250,9 +250,18 @@ public class PacketDataSerializer extends ByteBuf { - if (item.usesDurability() || item.o()) { +@@ -274,9 +274,18 @@ public class PacketDataSerializer extends ByteBuf { + if (item.usesDurability() || item.n()) { // Spigot start - filter itemstack = itemstack.cloneItemStack(); - CraftItemStack.setItemMeta(itemstack, CraftItemStack.getItemMeta(itemstack)); @@ -39,8 +39,8 @@ index d9574a9ace96d8c5666e62a5aed96a67021b91d8..e810da87977b441cc329066e3cb158ef + // Paper start + if (nbttagcompound != null && nbttagcompound.hasKeyOfType("SkullOwner", 10)) { + NBTTagCompound owner = nbttagcompound.getCompound("SkullOwner"); -+ if (owner.hasKey("Id")) { -+ nbttagcompound.setString("SkullOwnerOrig", owner.getString("Id")); ++ if (owner.hasUUID("Id")) { ++ nbttagcompound.setUUID("SkullOwnerOrig", owner.getUUID("Id")); + TileEntitySkull.sanitizeUUID(owner); + } + } @@ -48,7 +48,7 @@ index d9574a9ace96d8c5666e62a5aed96a67021b91d8..e810da87977b441cc329066e3cb158ef } this.a(nbttagcompound); -@@ -272,7 +281,17 @@ public class PacketDataSerializer extends ByteBuf { +@@ -296,7 +305,16 @@ public class PacketDataSerializer extends ByteBuf { itemstack.setTag(this.l()); // CraftBukkit start if (itemstack.getTag() != null) { @@ -56,11 +56,10 @@ index d9574a9ace96d8c5666e62a5aed96a67021b91d8..e810da87977b441cc329066e3cb158ef + // Paper start - Fix skulls of same owner - restore orig ID since we changed it on send to client + if (itemstack.tag.hasKey("SkullOwnerOrig")) { + NBTTagCompound owner = itemstack.tag.getCompound("SkullOwner"); -+ String ownerOrig = itemstack.tag.getString("SkullOwnerOrig"); -+ if (!owner.isEmpty() && !ownerOrig.isEmpty()) { -+ owner.setString("Id", ownerOrig); ++ if (itemstack.tag.hasKey("SkullOwnerOrig")) { ++ owner.map.put("Id", itemstack.tag.map.get("SkullOwnerOrig")); ++ itemstack.tag.remove("SkullOwnerOrig"); + } -+ itemstack.tag.remove("SkullOwnerOrig"); + } + // Paper end + // CraftItemStack.setItemMeta(itemstack, CraftItemStack.getItemMeta(itemstack)); // Paper - This is no longer needed due to NBT being supported @@ -68,10 +67,10 @@ index d9574a9ace96d8c5666e62a5aed96a67021b91d8..e810da87977b441cc329066e3cb158ef // CraftBukkit end return itemstack; diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -index 3a1d0deb0dec880d73185690e2a7c769a2731479..1fcbbd698a7e1b9ae3e8b5fa0328b85c43019bea 100644 +index e336437207f9d6adbab69ef2785c129ff2ec1b36..72ff0a1e6428a1776f49c26e1715f5f2428ba242 100644 --- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java +++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -@@ -58,6 +58,7 @@ public class PacketPlayOutMapChunk implements Packet { +@@ -60,6 +60,7 @@ public class PacketPlayOutMapChunk implements Packet { if (this.f() || (i & 1 << j) != 0) { NBTTagCompound nbttagcompound = tileentity.b(); @@ -80,10 +79,10 @@ index 3a1d0deb0dec880d73185690e2a7c769a2731479..1fcbbd698a7e1b9ae3e8b5fa0328b85c this.g.add(nbttagcompound); } diff --git a/src/main/java/net/minecraft/server/TileEntitySkull.java b/src/main/java/net/minecraft/server/TileEntitySkull.java -index 177cceb77f8783fe93ba7e4342de9c589f155c1b..0882d82cef92382cd4639ee7c9858fa5d59b3e5a 100644 +index 4fae1b3274a96b871b39de083e9b28ab6129533f..579a81e521fdfabfa0318d06c6760a8ab7a88c1e 100644 --- a/src/main/java/net/minecraft/server/TileEntitySkull.java +++ b/src/main/java/net/minecraft/server/TileEntitySkull.java -@@ -142,9 +142,37 @@ public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Pa +@@ -145,9 +145,37 @@ public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Pa @Nullable @Override public PacketPlayOutTileEntityData getUpdatePacket() { @@ -110,12 +109,12 @@ index 177cceb77f8783fe93ba7e4342de9c589f155c1b..0882d82cef92382cd4639ee7c9858fa5 + if (list != null && !list.isEmpty()) { + String textures = ((NBTTagCompound)list.get(0)).getString("Value"); + if (textures != null && textures.length() > 3) { -+ String uuid = UUID.nameUUIDFromBytes(textures.getBytes()).toString(); -+ owner.setString("Id", uuid); ++ UUID uuid = UUID.nameUUIDFromBytes(textures.getBytes()); ++ owner.setUUID("Id", uuid); + return; + } + } -+ owner.setString("Id", UUID.randomUUID().toString()); ++ owner.setUUID("Id", UUID.randomUUID()); + } + // Paper end + diff --git a/Spigot-Server-Patches/0269-Add-Early-Warning-Feature-to-WatchDog.patch b/Spigot-Server-Patches/0267-Add-Early-Warning-Feature-to-WatchDog.patch similarity index 94% rename from Spigot-Server-Patches/0269-Add-Early-Warning-Feature-to-WatchDog.patch rename to Spigot-Server-Patches/0267-Add-Early-Warning-Feature-to-WatchDog.patch index 736e84fac..e0738f591 100644 --- a/Spigot-Server-Patches/0269-Add-Early-Warning-Feature-to-WatchDog.patch +++ b/Spigot-Server-Patches/0267-Add-Early-Warning-Feature-to-WatchDog.patch @@ -9,10 +9,10 @@ thread dumps at an interval until the point of crash. This will help diagnose what was going on in that time before the crash. diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index adef07d4d521b4aaa6f3389b04aa27e29bec0229..214b577b326bc794fa3721deb6171228dd4f25e6 100644 +index 2e5c71d6b7d120a308076d95a3d5b73c5aca8bc9..1b21911c3e4fd1d4a3305176bb8477c370256906 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -24,6 +24,7 @@ import org.bukkit.configuration.file.YamlConfiguration; +@@ -25,6 +25,7 @@ import org.bukkit.configuration.file.YamlConfiguration; import co.aikar.timings.Timings; import co.aikar.timings.TimingsManager; import org.spigotmc.SpigotConfig; @@ -20,7 +20,7 @@ index adef07d4d521b4aaa6f3389b04aa27e29bec0229..214b577b326bc794fa3721deb6171228 public class PaperConfig { -@@ -288,6 +289,14 @@ public class PaperConfig { +@@ -289,6 +290,14 @@ public class PaperConfig { } } @@ -36,10 +36,10 @@ index adef07d4d521b4aaa6f3389b04aa27e29bec0229..214b577b326bc794fa3721deb6171228 public static int tabSpamLimit = 500; private static void tabSpamLimiters() { diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index d1667eba3398efecc8913c2778931030a90d6195..b7c83cd82ca1c9b6bdaaf566e800b8d15ad7d966 100644 +index 1698b42ed56a2932c5c1d60c655c9fd4cf5bed66..b13d8ec9aa0a51d5432129f1b0ecef3beb5b7276 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -873,6 +873,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant> { +@@ -12,6 +12,8 @@ import java.io.BufferedReader; + import java.io.BufferedWriter; + import java.io.File; + import java.io.IOException; ++import java.lang.reflect.ParameterizedType; // Paper ++import java.lang.reflect.Type; // Paper + import java.nio.charset.StandardCharsets; + import java.util.Collection; + import java.util.Iterator; +@@ -26,7 +28,22 @@ public abstract class JsonList> { protected static final Logger LOGGER = LogManager.getLogger(); - protected final Gson b; + private static final Gson b = (new GsonBuilder()).setPrettyPrinting().create(); private final File c; - private final Map d = Maps.newHashMap(); + // Paper - replace HashMap is ConcurrentHashMap + private final Map d = Maps.newConcurrentMap(); private final Map getBackingMap() { return this.d; } // Paper - OBFHELPER - private boolean e = true; - private static final ParameterizedType f = new ParameterizedType() { - public Type[] getActualTypeArguments() { -@@ -84,8 +85,13 @@ public class JsonList> { ++ private boolean e = true; ++ private static final ParameterizedType f = new ParameterizedType() { ++ public Type[] getActualTypeArguments() { ++ return new Type[]{JsonListEntry.class}; ++ } ++ ++ public Type getRawType() { ++ return List.class; ++ } ++ ++ public Type getOwnerType() { ++ return null; ++ } ++ }; + + public JsonList(File file) { + this.c = file; +@@ -49,8 +66,13 @@ public abstract class JsonList> { @Nullable public V get(K k0) { -- this.h(); +- this.g(); - return (V) this.d.get(this.a(k0)); // CraftBukkit - fix decompile error + // Paper start -+ // this.h(); ++ // this.g(); + // return (V) this.d.get(this.a(k0)); // CraftBukkit - fix decompile error + return (V) this.getBackingMap().computeIfPresent(this.getMappingKey(k0), (k, v) -> { + return v.hasExpired() ? null : v; @@ -54,7 +77,7 @@ index 734e7ecf630aa13a30d72ff96e57e5d0faf35013..8570e38f42e2f489e2899ac2f0c4a7b8 } public void remove(K k0) { -@@ -114,9 +120,11 @@ public class JsonList> { +@@ -79,9 +101,11 @@ public abstract class JsonList> { // CraftBukkit end public boolean isEmpty() { @@ -67,18 +90,18 @@ index 734e7ecf630aa13a30d72ff96e57e5d0faf35013..8570e38f42e2f489e2899ac2f0c4a7b8 protected String a(K k0) { return k0.toString(); } -@@ -125,8 +133,9 @@ public class JsonList> { +@@ -90,8 +114,9 @@ public abstract class JsonList> { return this.d.containsKey(this.a(k0)); } -+ private void removeStaleEntries() { h(); } // Paper - OBFHELPER - private void h() { ++ private void removeStaleEntries() { g(); } // Paper - OBFHELPER + private void g() { - List list = Lists.newArrayList(); + /*List list = Lists.newArrayList(); Iterator iterator = this.d.values().iterator(); while (iterator.hasNext()) { -@@ -143,8 +152,10 @@ public class JsonList> { +@@ -108,8 +133,10 @@ public abstract class JsonList> { K k0 = (K) iterator.next(); // CraftBukkit - decompile error this.d.remove(this.a(k0)); @@ -89,22 +112,22 @@ index 734e7ecf630aa13a30d72ff96e57e5d0faf35013..8570e38f42e2f489e2899ac2f0c4a7b8 + // Paper end } - protected JsonListEntry a(JsonObject jsonobject) { -@@ -156,6 +167,7 @@ public class JsonList> { + protected abstract JsonListEntry a(JsonObject jsonobject); +@@ -119,6 +146,7 @@ public abstract class JsonList> { } public void save() throws IOException { + this.removeStaleEntries(); // Paper - remove expired values before saving - Collection collection = this.d.values(); - String s = this.b.toJson(collection); - BufferedWriter bufferedwriter = null; + JsonArray jsonarray = new JsonArray(); + + this.d.values().stream().map((jsonlistentry) -> { diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index b69cff40922ba2d1a44c11bcae86f9439130ad96..22f18be4627fefe500239f7a35eee3b019bcffcc 100644 +index 4c11aa13b725b2bb502701f2d5fb3878ff162f05..50fbf3e3fb82c25ab5f3b258206f324c8616dae7 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -512,7 +512,7 @@ public abstract class PlayerList { +@@ -543,7 +543,7 @@ public abstract class PlayerList { } else if (!this.isWhitelisted(gameprofile, event)) { // Paper - chatmessage = new ChatMessage("multiplayer.disconnect.not_whitelisted", new Object[0]); + chatmessage = new ChatMessage("multiplayer.disconnect.not_whitelisted"); //event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig.whitelistMessage); // Spigot // Paper - moved to isWhitelisted - } else if (getIPBans().isBanned(socketaddress) && !getIPBans().get(socketaddress).hasExpired()) { + } else if (getIPBans().isBanned(socketaddress) && getIPBans().get(socketaddress) != null && !getIPBans().get(socketaddress).hasExpired()) { // Paper - fix NPE with temp ip bans diff --git a/Spigot-Server-Patches/0272-Use-a-Queue-for-Queueing-Commands.patch b/Spigot-Server-Patches/0270-Use-a-Queue-for-Queueing-Commands.patch similarity index 80% rename from Spigot-Server-Patches/0272-Use-a-Queue-for-Queueing-Commands.patch rename to Spigot-Server-Patches/0270-Use-a-Queue-for-Queueing-Commands.patch index bd5a8bbf6..e805d87b6 100644 --- a/Spigot-Server-Patches/0272-Use-a-Queue-for-Queueing-Commands.patch +++ b/Spigot-Server-Patches/0270-Use-a-Queue-for-Queueing-Commands.patch @@ -6,19 +6,19 @@ Subject: [PATCH] Use a Queue for Queueing Commands Lists are bad as Queues mmmkay. diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index ec257ba31f012d3d3576bbff41326df13ede6776..349a0ea213f7f45e927d439985e121e8fa66c041 100644 +index 13ae03d48a2a838ee9eb016072f3486d3c7192ef..e923835634f7440e5b88a9d5c62a70fcec8b688a 100644 --- a/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java -@@ -44,7 +44,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer +@@ -38,7 +38,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer private static final Logger LOGGER = LogManager.getLogger(); - private static final Pattern i = Pattern.compile("^[a-fA-F0-9]{40}$"); + private static final Pattern k = Pattern.compile("^[a-fA-F0-9]{40}$"); - private final List serverCommandQueue = Collections.synchronizedList(Lists.newArrayList()); -+ private final java.util.Queue serverCommandQueue = new java.util.concurrent.ConcurrentLinkedQueue(); // Paper - use a proper queue ++ private final java.util.Queue serverCommandQueue = new java.util.concurrent.ConcurrentLinkedQueue<>(); // Paper - use a proper queue private RemoteStatusListener remoteStatusListener; public final RemoteControlCommandListener remoteControlCommandListener; private RemoteControlListener remoteControlListener; -@@ -454,8 +454,10 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer +@@ -395,8 +395,10 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer public void handleCommandQueue() { MinecraftTimings.serverCommandTimer.startTiming(); // Spigot diff --git a/Spigot-Server-Patches/0273-Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch b/Spigot-Server-Patches/0271-Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch similarity index 85% rename from Spigot-Server-Patches/0273-Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch rename to Spigot-Server-Patches/0271-Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch index d5aa53b9a..0d6ca14a7 100644 --- a/Spigot-Server-Patches/0273-Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch +++ b/Spigot-Server-Patches/0271-Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Ability to get Tile Entities from a chunk without snapshots diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -index a843c66dfa032d041e6df498746a66bd2cb4506e..a53bb7295c5d510f2976ff3787d68857548e11cc 100644 +index e34ecdeb21f262046fe5d4cf9f1d6ecd57d72ba9..2bd7d7959ce2845dbc09e198122e3574593dca58 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -@@ -126,9 +126,16 @@ public class CraftChunk implements Chunk { +@@ -128,9 +128,16 @@ public class CraftChunk implements Chunk { @Override public BlockState[] getTileEntities() { @@ -25,7 +25,7 @@ index a843c66dfa032d041e6df498746a66bd2cb4506e..a53bb7295c5d510f2976ff3787d68857 int index = 0; net.minecraft.server.Chunk chunk = getHandle(); -@@ -140,7 +147,7 @@ public class CraftChunk implements Chunk { +@@ -142,7 +149,7 @@ public class CraftChunk implements Chunk { } BlockPosition position = (BlockPosition) obj; diff --git a/Spigot-Server-Patches/0274-Allow-disabling-armour-stand-ticking.patch b/Spigot-Server-Patches/0272-Allow-disabling-armour-stand-ticking.patch similarity index 54% rename from Spigot-Server-Patches/0274-Allow-disabling-armour-stand-ticking.patch rename to Spigot-Server-Patches/0272-Allow-disabling-armour-stand-ticking.patch index dca49d795..7b562f594 100644 --- a/Spigot-Server-Patches/0274-Allow-disabling-armour-stand-ticking.patch +++ b/Spigot-Server-Patches/0272-Allow-disabling-armour-stand-ticking.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Allow disabling armour stand ticking diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index eaaa51e4bf761f41fd516402ce1ad0f903c6ab71..bc3df01aab3e79be9c2836820e0eacc69ea6c1f4 100644 +index 14bb9d843f05058cae5cc64de8149d2c97264f1a..661694da6cfbed5e3e26de2355e67a5a6d17a3fc 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -393,4 +393,10 @@ public class PaperWorldConfig { +@@ -388,4 +388,10 @@ public class PaperWorldConfig { private void armorStandEntityLookups() { armorStandEntityLookups = getBoolean("armor-stands-do-collision-entity-lookups", true); } @@ -20,7 +20,7 @@ index eaaa51e4bf761f41fd516402ce1ad0f903c6ab71..bc3df01aab3e79be9c2836820e0eacc6 + } } diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java -index 61d7d507aaac3e7e5a885387ae89c67dfb1c9844..42b9a339e9c35db596ec78881c32c801c2d739f4 100644 +index a70b1a17fe884980ef7c3c0a36e567a0e69ef7f0..d5c09152acc93b25d626284071599afdbd76b709 100644 --- a/src/main/java/net/minecraft/server/EntityArmorStand.java +++ b/src/main/java/net/minecraft/server/EntityArmorStand.java @@ -44,6 +44,12 @@ public class EntityArmorStand extends EntityLiving { @@ -37,11 +37,11 @@ index 61d7d507aaac3e7e5a885387ae89c67dfb1c9844..42b9a339e9c35db596ec78881c32c801 public EntityArmorStand(EntityTypes entitytypes, World world) { super(entitytypes, world); @@ -55,6 +61,7 @@ public class EntityArmorStand extends EntityLiving { - this.rightArmPose = EntityArmorStand.bu; - this.leftLegPose = EntityArmorStand.bv; - this.rightLegPose = EntityArmorStand.bw; + this.rightArmPose = EntityArmorStand.bt; + this.leftLegPose = EntityArmorStand.bu; + this.rightLegPose = EntityArmorStand.bv; + if (world != null) this.canTick = world.paperConfig.armorStandTick; // Paper - armour stand ticking - this.H = 0.0F; + this.G = 0.0F; } @@ -135,6 +142,7 @@ public class EntityArmorStand extends EntityLiving { @@ -136,124 +136,22 @@ index 61d7d507aaac3e7e5a885387ae89c67dfb1c9844..42b9a339e9c35db596ec78881c32c801 public void setRightLegPose(Vector3f vector3f) { this.rightLegPose = vector3f; - this.datawatcher.set(EntityArmorStand.bp, vector3f); + this.datawatcher.set(EntityArmorStand.bo, vector3f); + this.noTickPoseDirty = true; // Paper - Allow updates when not ticking } public Vector3f r() { diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index a4051c1f0cdcf179e7afe60d301982412da7ed64..990aea604d02db723193722ed692c3a3725f987d 100644 +index 92fcaf425b5ef398fcac6ecf115502a5cf657ebb..f2604e867321ca5d84fe0cd7aeed7cf6e5741919 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -2329,52 +2329,7 @@ public abstract class EntityLiving extends Entity { - } - } - -- EnumItemSlot[] aenumitemslot = EnumItemSlot.values(); -- int k = aenumitemslot.length; -- -- for (int l = 0; l < k; ++l) { -- EnumItemSlot enumitemslot = aenumitemslot[l]; -- ItemStack itemstack; -- -- switch (enumitemslot.a()) { -- case HAND: -- itemstack = (ItemStack) this.bu.get(enumitemslot.b()); -- break; -- case ARMOR: -- itemstack = (ItemStack) this.bv.get(enumitemslot.b()); -- break; -- default: -- continue; -- } -- -- ItemStack itemstack1 = this.getEquipment(enumitemslot); -- -- if (!ItemStack.matches(itemstack1, itemstack)) { -- // Paper start - PlayerArmorChangeEvent -- if (this instanceof EntityPlayer && enumitemslot.getType() == EnumItemSlot.Function.ARMOR) { -- final org.bukkit.inventory.ItemStack oldItem = CraftItemStack.asBukkitCopy(itemstack); -- final org.bukkit.inventory.ItemStack newItem = CraftItemStack.asBukkitCopy(itemstack1); -- new PlayerArmorChangeEvent((Player) this.getBukkitEntity(), PlayerArmorChangeEvent.SlotType.valueOf(enumitemslot.name()), oldItem, newItem).callEvent(); -- } -- // Paper end -- ((WorldServer) this.world).getChunkProvider().broadcast(this, new PacketPlayOutEntityEquipment(this.getId(), enumitemslot, itemstack1)); -- if (!itemstack.isEmpty()) { -- this.getAttributeMap().a(itemstack.a(enumitemslot)); -- } -- -- if (!itemstack1.isEmpty()) { -- this.getAttributeMap().b(itemstack1.a(enumitemslot)); -- } -- -- switch (enumitemslot.a()) { -- case HAND: -- this.bu.set(enumitemslot.b(), itemstack1.cloneItemStack()); -- break; -- case ARMOR: -- this.bv.set(enumitemslot.b(), itemstack1.cloneItemStack()); -- } -- } -- } -+ updateEntityEquipment(); // Paper - split into own method - - if (this.ticksLived % 20 == 0) { - this.getCombatTracker().g(); -@@ -2475,6 +2430,55 @@ public abstract class EntityLiving extends Entity { +@@ -2503,6 +2503,7 @@ public abstract class EntityLiving extends Entity { } } -+ // Paper start - split into own method from above -+ public void updateEntityEquipment() { -+ EnumItemSlot[] aenumitemslot = EnumItemSlot.values(); -+ int k = aenumitemslot.length; -+ for (int l = 0; l < k; ++l) { -+ EnumItemSlot enumitemslot = aenumitemslot[l]; -+ ItemStack itemstack; -+ -+ switch (enumitemslot.a()) { -+ case HAND: -+ itemstack = (ItemStack) this.bu.get(enumitemslot.b()); -+ break; -+ case ARMOR: -+ itemstack = (ItemStack) this.bv.get(enumitemslot.b()); -+ break; -+ default: -+ continue; -+ } -+ -+ ItemStack itemstack1 = this.getEquipment(enumitemslot); -+ -+ if (!ItemStack.matches(itemstack1, itemstack)) { -+ // Paper start - PlayerArmorChangeEvent -+ if (this instanceof EntityPlayer && enumitemslot.getType() == EnumItemSlot.Function.ARMOR) { -+ final org.bukkit.inventory.ItemStack oldItem = CraftItemStack.asBukkitCopy(itemstack); -+ final org.bukkit.inventory.ItemStack newItem = CraftItemStack.asBukkitCopy(itemstack1); -+ new PlayerArmorChangeEvent((Player) this.getBukkitEntity(), PlayerArmorChangeEvent.SlotType.valueOf(enumitemslot.name()), oldItem, newItem).callEvent(); -+ } -+ // Paper end -+ ((WorldServer) this.world).getChunkProvider().broadcast(this, new PacketPlayOutEntityEquipment(this.getId(), enumitemslot, itemstack1)); -+ if (!itemstack.isEmpty()) { -+ this.getAttributeMap().a(itemstack.a(enumitemslot)); -+ } -+ -+ if (!itemstack1.isEmpty()) { -+ this.getAttributeMap().b(itemstack1.a(enumitemslot)); -+ } -+ -+ switch (enumitemslot.a()) { -+ case HAND: -+ this.bu.set(enumitemslot.b(), itemstack1.cloneItemStack()); -+ break; -+ case ARMOR: -+ this.bv.set(enumitemslot.b(), itemstack1.cloneItemStack()); -+ } -+ } -+ } -+ } -+ - protected float f(float f, float f1) { - float f2 = MathHelper.g(f - this.aI); ++ public void updateEntityEquipment() { q(); }; // Paper + private void q() { + Map map = this.r(); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java index d1d689e5d78c569313c4059c4652724605dc07d2..ac105270d5c7e2070f52782fc7dbdcd381db33a5 100644 diff --git a/Spigot-Server-Patches/0275-Optimize-BlockPosition-helper-methods.patch b/Spigot-Server-Patches/0273-Optimize-BlockPosition-helper-methods.patch similarity index 95% rename from Spigot-Server-Patches/0275-Optimize-BlockPosition-helper-methods.patch rename to Spigot-Server-Patches/0273-Optimize-BlockPosition-helper-methods.patch index f54af3c8c..5547e3f88 100644 --- a/Spigot-Server-Patches/0275-Optimize-BlockPosition-helper-methods.patch +++ b/Spigot-Server-Patches/0273-Optimize-BlockPosition-helper-methods.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Optimize BlockPosition helper methods Resolves #1338 diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java -index ec0e8f970dba64561afd6477a5df2821d9a8889a..a3a376e35eaf17b128048bd26a22eef713e7d535 100644 +index 48410cfbfe203dbe533294a7e4f261dba9c327cb..b50d86b39d2296e1dfb9aaaeb8f8f6f62a4e7430 100644 --- a/src/main/java/net/minecraft/server/BlockPosition.java +++ b/src/main/java/net/minecraft/server/BlockPosition.java -@@ -135,57 +135,74 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali +@@ -113,57 +113,74 @@ public class BlockPosition extends BaseBlockPosition { } public BlockPosition up() { diff --git a/Spigot-Server-Patches/0277-Restore-vanlla-default-mob-spawn-range.patch b/Spigot-Server-Patches/0274-Restore-vanlla-default-mob-spawn-range.patch similarity index 88% rename from Spigot-Server-Patches/0277-Restore-vanlla-default-mob-spawn-range.patch rename to Spigot-Server-Patches/0274-Restore-vanlla-default-mob-spawn-range.patch index 85bd7774f..85e977619 100644 --- a/Spigot-Server-Patches/0277-Restore-vanlla-default-mob-spawn-range.patch +++ b/Spigot-Server-Patches/0274-Restore-vanlla-default-mob-spawn-range.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Restore vanlla default mob-spawn-range diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index 98ed975a6241395b6119d5b3a62d24329aa1f05b..37ef07338e0e7ebb778b4446c8e7a630f597c7be 100644 +index 5c394d26e2d2dbc5d65e38c1273b7e5d02464f3a..f0ad5fa235adfd165b8e56be7352568a3b3ae54a 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java +++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -165,7 +165,7 @@ public class SpigotWorldConfig diff --git a/Spigot-Server-Patches/0279-Fix-MC-124320.patch b/Spigot-Server-Patches/0275-Fix-MC-124320.patch similarity index 80% rename from Spigot-Server-Patches/0279-Fix-MC-124320.patch rename to Spigot-Server-Patches/0275-Fix-MC-124320.patch index 58b272062..7e383aa39 100644 --- a/Spigot-Server-Patches/0279-Fix-MC-124320.patch +++ b/Spigot-Server-Patches/0275-Fix-MC-124320.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Fix MC-124320 diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java -index 5f261b9b92de4ca8638f41fa2947016cf590cf05..b9b750c3695699520c736d57cbd88c8d52254c7a 100644 +index 247d9300a755aa22c2ca3bcef86b3b25f3ed75ee..bbd2e1be0f401d7e267dcfa2c905f42c2a475dd7 100644 --- a/src/main/java/net/minecraft/server/Block.java +++ b/src/main/java/net/minecraft/server/Block.java -@@ -170,6 +170,7 @@ public class Block implements IMaterial { - return tag.isTagged(this); +@@ -93,6 +93,7 @@ public class Block extends BlockBase implements IMaterial { + return this == block; } + public static IBlockData getValidBlockForPosition(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition) { return Block.b(iblockdata, generatoraccess, blockposition); } // Paper - OBFHELPER @@ -17,11 +17,11 @@ index 5f261b9b92de4ca8638f41fa2947016cf590cf05..b9b750c3695699520c736d57cbd88c8d IBlockData iblockdata1 = iblockdata; BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition(); diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java -index b7c67f0cdb3d02c7a2dbe85f9a432836cb34bb6e..d86f76f30be54767d0243df716fe743e24db6726 100644 +index 7c13e5b711706c8aaa363d80350597a52920f12b..8da3b10cd6db379cf5d9d667154dd8911813284b 100644 --- a/src/main/java/net/minecraft/server/EntityEnderman.java +++ b/src/main/java/net/minecraft/server/EntityEnderman.java -@@ -354,8 +354,9 @@ public class EntityEnderman extends EntityMonster { - if (block.a(TagsBlock.ENDERMAN_HOLDABLE) && flag) { +@@ -391,8 +391,9 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { + if (block.a((Tag) TagsBlock.ENDERMAN_HOLDABLE) && flag) { // CraftBukkit start - Pickup event if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.enderman, blockposition, Blocks.AIR.getBlockData()).isCancelled()) { - this.enderman.setCarried(iblockdata); @@ -31,7 +31,7 @@ index b7c67f0cdb3d02c7a2dbe85f9a432836cb34bb6e..d86f76f30be54767d0243df716fe743e } // CraftBukkit end } -@@ -365,6 +366,7 @@ public class EntityEnderman extends EntityMonster { +@@ -402,6 +403,7 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { static class PathfinderGoalEndermanPlaceBlock extends PathfinderGoal { @@ -39,7 +39,7 @@ index b7c67f0cdb3d02c7a2dbe85f9a432836cb34bb6e..d86f76f30be54767d0243df716fe743e private final EntityEnderman a; public PathfinderGoalEndermanPlaceBlock(EntityEnderman entityenderman) { -@@ -387,7 +389,7 @@ public class EntityEnderman extends EntityMonster { +@@ -424,7 +426,7 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { IBlockData iblockdata = world.getType(blockposition); BlockPosition blockposition1 = blockposition.down(); IBlockData iblockdata1 = world.getType(blockposition1); diff --git a/Spigot-Server-Patches/0280-Slime-Pathfinder-Events.patch b/Spigot-Server-Patches/0276-Slime-Pathfinder-Events.patch similarity index 84% rename from Spigot-Server-Patches/0280-Slime-Pathfinder-Events.patch rename to Spigot-Server-Patches/0276-Slime-Pathfinder-Events.patch index dac983bd1..ba88f01bb 100644 --- a/Spigot-Server-Patches/0280-Slime-Pathfinder-Events.patch +++ b/Spigot-Server-Patches/0276-Slime-Pathfinder-Events.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Slime Pathfinder Events diff --git a/src/main/java/net/minecraft/server/EntitySlime.java b/src/main/java/net/minecraft/server/EntitySlime.java -index 3ecf732192f7f1bd20b9d766bedef08e64434fda..2efc18df945bcaa6eba59f561733b9fd6b217d6d 100644 +index 9c83389c56083d9febf604bf30da47c89330902e..a4642cc7390b08580d00689a853d59e3e1ef6496 100644 --- a/src/main/java/net/minecraft/server/EntitySlime.java +++ b/src/main/java/net/minecraft/server/EntitySlime.java @@ -3,6 +3,14 @@ package net.minecraft.server; @@ -23,18 +23,18 @@ index 3ecf732192f7f1bd20b9d766bedef08e64434fda..2efc18df945bcaa6eba59f561733b9fd // CraftBukkit start import java.util.ArrayList; import java.util.List; -@@ -71,6 +79,7 @@ public class EntitySlime extends EntityInsentient implements IMonster { - super.b(nbttagcompound); +@@ -65,6 +73,7 @@ public class EntitySlime extends EntityInsentient implements IMonster { + super.saveData(nbttagcompound); nbttagcompound.setInt("Size", this.getSize() - 1); - nbttagcompound.setBoolean("wasOnGround", this.bx); + nbttagcompound.setBoolean("wasOnGround", this.bw); + nbttagcompound.setBoolean("Paper.canWander", this.canWander); // Paper } @Override -@@ -84,6 +93,11 @@ public class EntitySlime extends EntityInsentient implements IMonster { +@@ -78,6 +87,11 @@ public class EntitySlime extends EntityInsentient implements IMonster { this.setSize(i + 1, false); - super.a(nbttagcompound); - this.bx = nbttagcompound.getBoolean("wasOnGround"); + super.loadData(nbttagcompound); + this.bw = nbttagcompound.getBoolean("wasOnGround"); + // Paper start - check exists before loading or this will be loaded as false + if (nbttagcompound.hasKey("Paper.canWander")) { + this.canWander = nbttagcompound.getBoolean("Paper.canWander"); @@ -42,8 +42,8 @@ index 3ecf732192f7f1bd20b9d766bedef08e64434fda..2efc18df945bcaa6eba59f561733b9fd + // Paper end } - public boolean ev() { -@@ -357,7 +371,7 @@ public class EntitySlime extends EntityInsentient implements IMonster { + public boolean eR() { +@@ -358,7 +372,7 @@ public class EntitySlime extends EntityInsentient implements IMonster { @Override public boolean a() { @@ -52,21 +52,21 @@ index 3ecf732192f7f1bd20b9d766bedef08e64434fda..2efc18df945bcaa6eba59f561733b9fd } @Override -@@ -378,7 +392,7 @@ public class EntitySlime extends EntityInsentient implements IMonster { +@@ -379,7 +393,7 @@ public class EntitySlime extends EntityInsentient implements IMonster { @Override public boolean a() { -- return (this.a.isInWater() || this.a.aH()) && this.a.getControllerMove() instanceof EntitySlime.ControllerMoveSlime; -+ return (this.a.isInWater() || this.a.aH()) && this.a.getControllerMove() instanceof EntitySlime.ControllerMoveSlime && this.a.canWander && new SlimeSwimEvent((Slime) this.a.getBukkitEntity()).callEvent(); // Paper +- return (this.a.isInWater() || this.a.aN()) && this.a.getControllerMove() instanceof EntitySlime.ControllerMoveSlime; ++ return (this.a.isInWater() || this.a.aN()) && this.a.getControllerMove() instanceof EntitySlime.ControllerMoveSlime && this.a.canWander && new SlimeSwimEvent((Slime) this.a.getBukkitEntity()).callEvent(); // Paper } @Override -@@ -404,14 +418,18 @@ public class EntitySlime extends EntityInsentient implements IMonster { +@@ -405,14 +419,18 @@ public class EntitySlime extends EntityInsentient implements IMonster { @Override public boolean a() { -- return this.a.getGoalTarget() == null && (this.a.onGround || this.a.isInWater() || this.a.aH() || this.a.hasEffect(MobEffects.LEVITATION)) && this.a.getControllerMove() instanceof EntitySlime.ControllerMoveSlime; -+ return this.a.canWander && this.a.getGoalTarget() == null && (this.a.onGround || this.a.isInWater() || this.a.aH() || this.a.hasEffect(MobEffects.LEVITATION)) && this.a.getControllerMove() instanceof EntitySlime.ControllerMoveSlime; +- return this.a.getGoalTarget() == null && (this.a.onGround || this.a.isInWater() || this.a.aN() || this.a.hasEffect(MobEffects.LEVITATION)) && this.a.getControllerMove() instanceof EntitySlime.ControllerMoveSlime; ++ return this.a.canWander && this.a.getGoalTarget() == null && (this.a.onGround || this.a.isInWater() || this.a.aN() || this.a.hasEffect(MobEffects.LEVITATION)) && this.a.getControllerMove() instanceof EntitySlime.ControllerMoveSlime; } @Override @@ -82,7 +82,7 @@ index 3ecf732192f7f1bd20b9d766bedef08e64434fda..2efc18df945bcaa6eba59f561733b9fd } ((EntitySlime.ControllerMoveSlime) this.a.getControllerMove()).a(this.b, false); -@@ -432,7 +450,15 @@ public class EntitySlime extends EntityInsentient implements IMonster { +@@ -433,7 +451,15 @@ public class EntitySlime extends EntityInsentient implements IMonster { public boolean a() { EntityLiving entityliving = this.a.getGoalTarget(); @@ -99,7 +99,7 @@ index 3ecf732192f7f1bd20b9d766bedef08e64434fda..2efc18df945bcaa6eba59f561733b9fd } @Override -@@ -445,7 +471,15 @@ public class EntitySlime extends EntityInsentient implements IMonster { +@@ -446,7 +472,15 @@ public class EntitySlime extends EntityInsentient implements IMonster { public boolean b() { EntityLiving entityliving = this.a.getGoalTarget(); @@ -116,9 +116,9 @@ index 3ecf732192f7f1bd20b9d766bedef08e64434fda..2efc18df945bcaa6eba59f561733b9fd } @Override -@@ -453,6 +487,13 @@ public class EntitySlime extends EntityInsentient implements IMonster { +@@ -454,6 +488,13 @@ public class EntitySlime extends EntityInsentient implements IMonster { this.a.a((Entity) this.a.getGoalTarget(), 10.0F, 10.0F); - ((EntitySlime.ControllerMoveSlime) this.a.getControllerMove()).a(this.a.yaw, this.a.eq()); + ((EntitySlime.ControllerMoveSlime) this.a.getControllerMove()).a(this.a.yaw, this.a.eM()); } + + // Paper start - clear timer and target when goal resets @@ -130,7 +130,7 @@ index 3ecf732192f7f1bd20b9d766bedef08e64434fda..2efc18df945bcaa6eba59f561733b9fd } static class ControllerMoveSlime extends ControllerMove { -@@ -511,4 +552,15 @@ public class EntitySlime extends EntityInsentient implements IMonster { +@@ -512,4 +553,15 @@ public class EntitySlime extends EntityInsentient implements IMonster { } } } diff --git a/Spigot-Server-Patches/0281-Configurable-speed-for-water-flowing-over-lava.patch b/Spigot-Server-Patches/0277-Configurable-speed-for-water-flowing-over-lava.patch similarity index 85% rename from Spigot-Server-Patches/0281-Configurable-speed-for-water-flowing-over-lava.patch rename to Spigot-Server-Patches/0277-Configurable-speed-for-water-flowing-over-lava.patch index 78b5705a1..f5c9d3c60 100644 --- a/Spigot-Server-Patches/0281-Configurable-speed-for-water-flowing-over-lava.patch +++ b/Spigot-Server-Patches/0277-Configurable-speed-for-water-flowing-over-lava.patch @@ -5,10 +5,10 @@ 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 bc3df01aab3e79be9c2836820e0eacc69ea6c1f4..487b0d5cd608e84a793eba5fdbd50a9f3d95c79b 100644 +index 661694da6cfbed5e3e26de2355e67a5a6d17a3fc..37bd28f18d3f48767d8141bde3395b8443d5650a 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -399,4 +399,10 @@ public class PaperWorldConfig { +@@ -394,4 +394,10 @@ public class PaperWorldConfig { this.armorStandTick = this.getBoolean("armor-stands-tick", this.armorStandTick); log("ArmorStand ticking is " + (this.armorStandTick ? "enabled" : "disabled") + " by default"); } @@ -20,14 +20,14 @@ index bc3df01aab3e79be9c2836820e0eacc69ea6c1f4..487b0d5cd608e84a793eba5fdbd50a9f + } } diff --git a/src/main/java/net/minecraft/server/BlockFluids.java b/src/main/java/net/minecraft/server/BlockFluids.java -index f56e14e1e2fd974e409a324572c2d17e1533da41..6d351f0979ecfa8e500edf8dd03b4a455fd5d180 100644 +index f00b403e1e12acbb8eb6ad55da219b257219a8f4..a28ac8b00b22a8c7afc2b64f9720a4e32b653e5f 100644 --- a/src/main/java/net/minecraft/server/BlockFluids.java +++ b/src/main/java/net/minecraft/server/BlockFluids.java -@@ -70,11 +70,28 @@ public class BlockFluids extends Block implements IFluidSource { +@@ -76,11 +76,28 @@ public class BlockFluids extends Block implements IFluidSource { @Override public void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag) { if (this.a(world, blockposition, iblockdata)) { -- world.getFluidTickList().a(blockposition, iblockdata.getFluid().getType(), this.a((IWorldReader) world)); +- world.getFluidTickList().a(blockposition, iblockdata.getFluid().getType(), this.b.a((IWorldReader) world)); + world.getFluidTickList().a(blockposition, iblockdata.getFluid().getType(), this.getFlowSpeed(world, blockposition)); // Paper } @@ -45,7 +45,7 @@ index f56e14e1e2fd974e409a324572c2d17e1533da41..6d351f0979ecfa8e500edf8dd03b4a45 + return world.paperConfig.waterOverLavaFlowSpeed; + } + } -+ return this.a(world); ++ return this.b.a(world); + } + // Paper end + @@ -53,11 +53,11 @@ index f56e14e1e2fd974e409a324572c2d17e1533da41..6d351f0979ecfa8e500edf8dd03b4a45 @Override public IBlockData updateState(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) { if (iblockdata.getFluid().isSource() || iblockdata1.getFluid().isSource()) { -@@ -87,7 +104,7 @@ public class BlockFluids extends Block implements IFluidSource { +@@ -93,7 +110,7 @@ public class BlockFluids extends Block implements IFluidSource { @Override public void doPhysics(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1, boolean flag) { if (this.a(world, blockposition, iblockdata)) { -- world.getFluidTickList().a(blockposition, iblockdata.getFluid().getType(), this.a((IWorldReader) world)); +- world.getFluidTickList().a(blockposition, iblockdata.getFluid().getType(), this.b.a((IWorldReader) world)); + world.getFluidTickList().a(blockposition, iblockdata.getFluid().getType(), this.getFlowSpeed(world, blockposition)); // Paper } diff --git a/Spigot-Server-Patches/0278-Optimize-CraftBlockData-Creation.patch b/Spigot-Server-Patches/0278-Optimize-CraftBlockData-Creation.patch index 7bda590b2..637c01089 100644 --- a/Spigot-Server-Patches/0278-Optimize-CraftBlockData-Creation.patch +++ b/Spigot-Server-Patches/0278-Optimize-CraftBlockData-Creation.patch @@ -6,40 +6,30 @@ Subject: [PATCH] Optimize CraftBlockData Creation Avoids a hashmap lookup by cacheing a reference to the CraftBlockData and cloning it when one is needed. -diff --git a/src/main/java/net/minecraft/server/IBlockData.java b/src/main/java/net/minecraft/server/IBlockData.java -index c5fddef030489bff0de9e0efb4f11c83bcfee628..cca2bf1045c1305a9defa5241909b50711b85d4c 100644 ---- a/src/main/java/net/minecraft/server/IBlockData.java -+++ b/src/main/java/net/minecraft/server/IBlockData.java -@@ -4,6 +4,8 @@ import com.google.common.collect.ImmutableMap; - import com.mojang.datafixers.Dynamic; - import com.mojang.datafixers.types.DynamicOps; - import com.mojang.datafixers.util.Pair; -+import org.bukkit.craftbukkit.block.data.CraftBlockData; +diff --git a/src/main/java/net/minecraft/server/BlockBase.java b/src/main/java/net/minecraft/server/BlockBase.java +index 88a1db211286fc8a6164312d7eb0839c00969e0e..aa4bfc9fe8e917c1c19838b0a7b045a11fc9300b 100644 +--- a/src/main/java/net/minecraft/server/BlockBase.java ++++ b/src/main/java/net/minecraft/server/BlockBase.java +@@ -323,6 +323,14 @@ public abstract class BlockBase { + this.o = blockbase_info.t; + this.p = blockbase_info.u; + } ++ // Paper start - impl cached craft block data, lazy load to fix issue with loading at the wrong time ++ private org.bukkit.craftbukkit.block.data.CraftBlockData cachedCraftBlockData; + - import java.util.Arrays; - import java.util.Iterator; - import java.util.List; -@@ -38,6 +40,15 @@ public class IBlockData extends BlockDataAbstract implements - return (Block) this.a; - } ++ public org.bukkit.craftbukkit.block.data.CraftBlockData createCraftBlockData() { ++ if (cachedCraftBlockData == null) cachedCraftBlockData = org.bukkit.craftbukkit.block.data.CraftBlockData.createData(getBlockData()); ++ return (org.bukkit.craftbukkit.block.data.CraftBlockData) cachedCraftBlockData.clone(); ++ } ++ // Paper end -+ // Paper start - impl cached craft block data, lazy load to fix issue with loading at the wrong time -+ private CraftBlockData cachedCraftBlockData; -+ -+ public CraftBlockData createCraftBlockData() { -+ if(cachedCraftBlockData == null) cachedCraftBlockData = CraftBlockData.createData(this); -+ return (CraftBlockData) cachedCraftBlockData.clone(); -+ } -+ // Paper end -+ - public Material getMaterial() { - return this.getBlock().k(this); - } + public void a() { + if (!this.getBlock().o()) { diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java -index 683b17a0c9f09d90c2fc30aad6516b4d01d2f34f..a0746a1694a01996eab44a91b078ba14996f3d13 100644 +index c7eed6b572cef2c735b1eb2f587c24876047cf94..bbded5671e986be34ebe3100e4c10ee0d5741764 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java +++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java -@@ -549,7 +549,17 @@ public class CraftBlockData implements BlockData { +@@ -553,7 +553,17 @@ public class CraftBlockData implements BlockData { return craft; } diff --git a/Spigot-Server-Patches/0279-Optimize-RegistryMaterials.patch b/Spigot-Server-Patches/0279-Optimize-RegistryMaterials.patch new file mode 100644 index 000000000..3a6e2f060 --- /dev/null +++ b/Spigot-Server-Patches/0279-Optimize-RegistryMaterials.patch @@ -0,0 +1,53 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Sun, 26 Aug 2018 20:49:50 -0400 +Subject: [PATCH] Optimize RegistryMaterials + +Use larger initial sizes to increase bucket capacity on the BiMap + +BiMap.get was seen to be using a good bit of CPU time. + +diff --git a/src/main/java/net/minecraft/server/RegistryMaterials.java b/src/main/java/net/minecraft/server/RegistryMaterials.java +index c60140a283df47edf23fe4f54a2c1d2fca7593f8..79817e3ffcac372e00b92c5b6bcb44653fcb73db 100644 +--- a/src/main/java/net/minecraft/server/RegistryMaterials.java ++++ b/src/main/java/net/minecraft/server/RegistryMaterials.java +@@ -25,9 +25,9 @@ import org.apache.logging.log4j.Logger; + public class RegistryMaterials extends IRegistryWritable { + + protected static final Logger LOGGER = LogManager.getLogger(); +- protected final RegistryID b = new RegistryID<>(256); +- protected final BiMap c = HashBiMap.create(); +- private final BiMap, T> bb = HashBiMap.create(); ++ protected final RegistryID b = new RegistryID<>(2048); // Paper - use bigger expected size to reduce collisions ++ protected final BiMap c = HashBiMap.create(2048); // Paper - use bigger expected size to reduce collisions ++ private final BiMap, T> bb = HashBiMap.create(2048); // Paper - use bigger expected size to reduce collisions + private final Set> bc = Sets.newIdentityHashSet(); + protected Object[] d; + private int bd; +@@ -124,7 +124,7 @@ public class RegistryMaterials extends IRegistryWritable { + this.d = collection.toArray(new Object[collection.size()]); + } + +- return SystemUtils.a(this.d, random); ++ return (T) SystemUtils.a(this.d, random); // Paper - Decompile fix + } + + @Override +@@ -164,7 +164,7 @@ public class RegistryMaterials extends IRegistryWritable { + Iterator iterator = registrymaterials.b.iterator(); + + while (iterator.hasNext()) { +- T t0 = iterator.next(); ++ T t0 = (T) iterator.next(); // Paper - Decompile fix + + builder.add(Pair.of(registrymaterials.c(t0).get(), t0)); + } +@@ -191,7 +191,7 @@ public class RegistryMaterials extends IRegistryWritable { + + registrymaterials.bb.entrySet().stream().filter((entry) -> { + return registrymaterials.c((ResourceKey) entry.getKey()); +- }).forEach(com_google_common_collect_immutablemap_builder::put); ++ }).forEach(entry1 -> com_google_common_collect_immutablemap_builder.put((java.util.Map.Entry,? extends T>) entry1)); // Paper - compiler fix (expand method reference + add cast) + return com_google_common_collect_immutablemap_builder.build(); + }); + } diff --git a/Spigot-Server-Patches/0283-Add-PhantomPreSpawnEvent.patch b/Spigot-Server-Patches/0280-Add-PhantomPreSpawnEvent.patch similarity index 90% rename from Spigot-Server-Patches/0283-Add-PhantomPreSpawnEvent.patch rename to Spigot-Server-Patches/0280-Add-PhantomPreSpawnEvent.patch index 7598814be..1fa24c5c4 100644 --- a/Spigot-Server-Patches/0283-Add-PhantomPreSpawnEvent.patch +++ b/Spigot-Server-Patches/0280-Add-PhantomPreSpawnEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add PhantomPreSpawnEvent diff --git a/src/main/java/net/minecraft/server/EntityPhantom.java b/src/main/java/net/minecraft/server/EntityPhantom.java -index b62a8227b264b768f6ed5d1ef191b68c604e18a5..82323bf4acc140d279c399cc64fa393a0db90136 100644 +index 457be7b726ccfdd7723a8eb5da69af96abc86870..47d82722e15c5b91a86af1a09807ccc37a1b37be 100644 --- a/src/main/java/net/minecraft/server/EntityPhantom.java +++ b/src/main/java/net/minecraft/server/EntityPhantom.java -@@ -130,6 +130,11 @@ public class EntityPhantom extends EntityFlying implements IMonster { +@@ -125,6 +125,11 @@ public class EntityPhantom extends EntityFlying implements IMonster { } this.setSize(nbttagcompound.getInt("Size")); @@ -20,7 +20,7 @@ index b62a8227b264b768f6ed5d1ef191b68c604e18a5..82323bf4acc140d279c399cc64fa393a } @Override -@@ -139,6 +144,11 @@ public class EntityPhantom extends EntityFlying implements IMonster { +@@ -134,6 +139,11 @@ public class EntityPhantom extends EntityFlying implements IMonster { nbttagcompound.setInt("AY", this.d.getY()); nbttagcompound.setInt("AZ", this.d.getZ()); nbttagcompound.setInt("Size", this.getSize()); @@ -32,7 +32,7 @@ index b62a8227b264b768f6ed5d1ef191b68c604e18a5..82323bf4acc140d279c399cc64fa393a } @Override -@@ -185,6 +195,14 @@ public class EntityPhantom extends EntityFlying implements IMonster { +@@ -180,6 +190,14 @@ public class EntityPhantom extends EntityFlying implements IMonster { return entitysize.a(f); } @@ -48,10 +48,10 @@ index b62a8227b264b768f6ed5d1ef191b68c604e18a5..82323bf4acc140d279c399cc64fa393a private final PathfinderTargetCondition b; diff --git a/src/main/java/net/minecraft/server/MobSpawnerPhantom.java b/src/main/java/net/minecraft/server/MobSpawnerPhantom.java -index add566ea4f476e0c4750c0f9a1080a99ea74e5d1..f488c22ed64a9fa1ce7746942b2a9ff4bc296703 100644 +index c1ea64e2a474d58139a217d271c44f219b9ef0b6..39c5350373f6a5ad30f41e8886573d6b315924c6 100644 --- a/src/main/java/net/minecraft/server/MobSpawnerPhantom.java +++ b/src/main/java/net/minecraft/server/MobSpawnerPhantom.java -@@ -52,8 +52,17 @@ public class MobSpawnerPhantom { +@@ -53,8 +53,17 @@ public class MobSpawnerPhantom implements MobSpawner { int k = 1 + random.nextInt(difficultydamagescaler.a().a() + 1); for (int l = 0; l < k; ++l) { diff --git a/Spigot-Server-Patches/0284-Add-More-Creeper-API.patch b/Spigot-Server-Patches/0281-Add-More-Creeper-API.patch similarity index 92% rename from Spigot-Server-Patches/0284-Add-More-Creeper-API.patch rename to Spigot-Server-Patches/0281-Add-More-Creeper-API.patch index 018f0f8a2..e6f7752c8 100644 --- a/Spigot-Server-Patches/0284-Add-More-Creeper-API.patch +++ b/Spigot-Server-Patches/0281-Add-More-Creeper-API.patch @@ -5,19 +5,19 @@ Subject: [PATCH] Add More Creeper API diff --git a/src/main/java/net/minecraft/server/EntityCreeper.java b/src/main/java/net/minecraft/server/EntityCreeper.java -index b89530079751c13894527f21572cc37e3a5548b8..45dfc8104a75f9893c6ee03d507cac80b893249c 100644 +index e4c1a7c152b2c1202c77e5d5d1c386d84007bc97..5e7f3af37b7cb068183fc2a7637b4c770fd5f936 100644 --- a/src/main/java/net/minecraft/server/EntityCreeper.java +++ b/src/main/java/net/minecraft/server/EntityCreeper.java @@ -14,7 +14,7 @@ public class EntityCreeper extends EntityMonster { private static final DataWatcherObject POWERED = DataWatcher.a(EntityCreeper.class, DataWatcherRegistry.i); private static final DataWatcherObject d = DataWatcher.a(EntityCreeper.class, DataWatcherRegistry.i); private static final DataWatcherObject isIgnitedDW = d; // Paper OBFHELPER - private int bw; + private int bv; - private int fuseTicks; + public int fuseTicks; // Paper - public public int maxFuseTicks = 30; public int explosionRadius = 3; - private int bA; -@@ -256,7 +256,18 @@ public class EntityCreeper extends EntityMonster { + private int bz; +@@ -254,7 +254,18 @@ public class EntityCreeper extends EntityMonster { } public void ignite() { diff --git a/Spigot-Server-Patches/0285-Inventory-removeItemAnySlot.patch b/Spigot-Server-Patches/0282-Inventory-removeItemAnySlot.patch similarity index 96% rename from Spigot-Server-Patches/0285-Inventory-removeItemAnySlot.patch rename to Spigot-Server-Patches/0282-Inventory-removeItemAnySlot.patch index 7abcfeaa9..7950dac2d 100644 --- a/Spigot-Server-Patches/0285-Inventory-removeItemAnySlot.patch +++ b/Spigot-Server-Patches/0282-Inventory-removeItemAnySlot.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Inventory#removeItemAnySlot diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java -index acc2a57ff295aa56a0fd47339299489d0617ddc7..47827fbf1b80f88ffff8a252df10d70758c68703 100644 +index 98aea6b2917faa73ac2f1a070545449a4a195cf2..a04213325b8266623b076f1233539512a0a0207f 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java @@ -223,10 +223,16 @@ public class CraftInventory implements Inventory { diff --git a/Spigot-Server-Patches/0282-Optimize-RegistryMaterials.patch b/Spigot-Server-Patches/0282-Optimize-RegistryMaterials.patch deleted file mode 100644 index 78841bbe8..000000000 --- a/Spigot-Server-Patches/0282-Optimize-RegistryMaterials.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sun, 26 Aug 2018 20:49:50 -0400 -Subject: [PATCH] Optimize RegistryMaterials - -Use larger initial sizes to increase bucket capacity on the BiMap - -BiMap.get was seen to be using a good bit of CPU time. - -diff --git a/src/main/java/net/minecraft/server/RegistryMaterials.java b/src/main/java/net/minecraft/server/RegistryMaterials.java -index 2d6a7b3a47895a32903eaf132eb44820c2623c4c..8477febca23b575da21023b4d7c18bb679cf3b30 100644 ---- a/src/main/java/net/minecraft/server/RegistryMaterials.java -+++ b/src/main/java/net/minecraft/server/RegistryMaterials.java -@@ -16,8 +16,8 @@ import org.apache.logging.log4j.Logger; - public class RegistryMaterials extends IRegistryWritable { - - protected static final Logger LOGGER = LogManager.getLogger(); -- protected final RegistryID b = new RegistryID<>(256); -- protected final BiMap c = HashBiMap.create(); -+ protected final RegistryID b = new RegistryID<>(2048); // Paper - use bigger expected size to reduce collisions -+ protected final BiMap c = HashBiMap.create(2048); // Paper - use bigger expected size to reduce collisions - protected Object[] d; - private int V; - -@@ -101,6 +101,6 @@ public class RegistryMaterials extends IRegistryWritable { - this.d = collection.toArray(new Object[collection.size()]); - } - -- return this.d[random.nextInt(this.d.length)]; -+ return (T) this.d[random.nextInt(this.d.length)]; // Paper - Decompile fix - } - } diff --git a/Spigot-Server-Patches/0286-Make-CraftWorld-loadChunk-int-int-false-load-unconve.patch b/Spigot-Server-Patches/0283-Make-CraftWorld-loadChunk-int-int-false-load-unconve.patch similarity index 87% rename from Spigot-Server-Patches/0286-Make-CraftWorld-loadChunk-int-int-false-load-unconve.patch rename to Spigot-Server-Patches/0283-Make-CraftWorld-loadChunk-int-int-false-load-unconve.patch index ee5898d3e..9bc56a00d 100644 --- a/Spigot-Server-Patches/0286-Make-CraftWorld-loadChunk-int-int-false-load-unconve.patch +++ b/Spigot-Server-Patches/0283-Make-CraftWorld-loadChunk-int-int-false-load-unconve.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Make CraftWorld#loadChunk(int, int, false) load unconverted diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index ad951812835b1fa786e964c533efc4547c57b7a2..4e7b11af047c267ce87549e0ba178d7223c03b63 100644 +index 265822138eee71daa1d6858adc17985d941d9d4c..2cc284b81d8ee17e19342a6cd849ff018c031a92 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -499,7 +499,7 @@ public class CraftWorld implements World { +@@ -502,7 +502,7 @@ public class CraftWorld implements World { @Override public boolean loadChunk(int x, int z, boolean generate) { org.spigotmc.AsyncCatcher.catchOp("chunk load"); // Spigot diff --git a/Spigot-Server-Patches/0287-Add-ray-tracing-methods-to-LivingEntity.patch b/Spigot-Server-Patches/0284-Add-ray-tracing-methods-to-LivingEntity.patch similarity index 92% rename from Spigot-Server-Patches/0287-Add-ray-tracing-methods-to-LivingEntity.patch rename to Spigot-Server-Patches/0284-Add-ray-tracing-methods-to-LivingEntity.patch index 07fcc4eab..e9dee421a 100644 --- a/Spigot-Server-Patches/0287-Add-ray-tracing-methods-to-LivingEntity.patch +++ b/Spigot-Server-Patches/0284-Add-ray-tracing-methods-to-LivingEntity.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add ray tracing methods to LivingEntity diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 0c3a776e207d84943fd90482a650d0c74b5ca65d..516631b4f4b8d7a9dd5d9d558d199f71d0d7ced6 100644 +index f2604e867321ca5d84fe0cd7aeed7cf6e5741919..4b249a644c680a7cc64b0d31cf453f94ff2b6a0c 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -3258,6 +3258,23 @@ public abstract class EntityLiving extends Entity { +@@ -3442,6 +3442,23 @@ public abstract class EntityLiving extends Entity { this.broadcastItemBreak(enumhand == EnumHand.MAIN_HAND ? EnumItemSlot.MAINHAND : EnumItemSlot.OFFHAND); } // Paper start @@ -33,10 +33,10 @@ index 0c3a776e207d84943fd90482a650d0c74b5ca65d..516631b4f4b8d7a9dd5d9d558d199f71 public int getShieldBlockingDelay() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 3a87c6574bbad9e6c2d7573eb447194c931d7ec4..9e082d4514eb57667cb50a390bef7ab72b94e838 100644 +index bbe6188f50dd3c456dec5c3239bdcffbfceb3589..2e7bacff55f57fda8b5644fb9d7934a615e5f550 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -196,6 +196,28 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -199,6 +199,28 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { return blocks.get(0); } diff --git a/Spigot-Server-Patches/0288-Expose-attack-cooldown-methods-for-Player.patch b/Spigot-Server-Patches/0285-Expose-attack-cooldown-methods-for-Player.patch similarity index 65% rename from Spigot-Server-Patches/0288-Expose-attack-cooldown-methods-for-Player.patch rename to Spigot-Server-Patches/0285-Expose-attack-cooldown-methods-for-Player.patch index cae32fafa..5ffe7886c 100644 --- a/Spigot-Server-Patches/0288-Expose-attack-cooldown-methods-for-Player.patch +++ b/Spigot-Server-Patches/0285-Expose-attack-cooldown-methods-for-Player.patch @@ -5,32 +5,32 @@ Subject: [PATCH] Expose attack cooldown methods for Player diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index 684978be7ccc401b71b0594828a7783b209a5210..f41975165a6a66479bc8fc1811c1d271bb2a6113 100644 +index d9e5d71a87140c90b79902887bd2f481f02956dc..afc665bfe9d527ca8d19f3ab9df0900d87f2d3f2 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -2123,14 +2123,17 @@ public abstract class EntityHuman extends EntityLiving { - this.datawatcher.set(EntityHuman.bt, nbttagcompound); +@@ -2006,14 +2006,17 @@ public abstract class EntityHuman extends EntityLiving { + this.datawatcher.set(EntityHuman.bs, nbttagcompound); } -+ public float getCooldownPeriod() { return this.ex(); } // Paper - OBFHELPER - public float ex() { - return (float) (1.0D / this.getAttributeInstance(GenericAttributes.ATTACK_SPEED).getValue() * 20.0D); ++ public float getCooldownPeriod() { return this.eR(); } // Paper - OBFHELPER + public float eR() { + return (float) (1.0D / this.b(GenericAttributes.ATTACK_SPEED) * 20.0D); } -+ public float getCooledAttackStrength(float adjustTicks) { return s(adjustTicks); } // Paper - OBFHELPER - public float s(float f) { - return MathHelper.a(((float) this.aB + f) / this.ex(), 0.0F, 1.0F); ++ public float getCooledAttackStrength(float adjustTicks) { return getAttackCooldown(adjustTicks); } // Paper - OBFHELPER + public float getAttackCooldown(float f) { + return MathHelper.a(((float) this.aA + f) / this.eR(), 0.0F, 1.0F); } + public void resetCooldown() { this.ey(); } // Paper - OBFHELPER - public void ey() { - this.aB = 0; + public void resetAttackCooldown() { + this.aA = 0; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 368f786300573ff24a8dc46d96a6fb6bac26b35a..fefe3b67ae62daedeb214d53d0c1f9d806356792 100644 +index c7e43f5015851d44870986c6cd6c43b3332cf9be..21aa19081ca3d9c20ea8e401c2a4b830ba667a51 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1904,6 +1904,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1971,6 +1971,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player { getInventory().setItemInMainHand(hand); } diff --git a/Spigot-Server-Patches/0289-Improve-death-events.patch b/Spigot-Server-Patches/0286-Improve-death-events.patch similarity index 82% rename from Spigot-Server-Patches/0289-Improve-death-events.patch rename to Spigot-Server-Patches/0286-Improve-death-events.patch index 0df0db2e0..3eebcabb1 100644 --- a/Spigot-Server-Patches/0289-Improve-death-events.patch +++ b/Spigot-Server-Patches/0286-Improve-death-events.patch @@ -15,10 +15,10 @@ items and experience which is otherwise only properly possible by using internal code. diff --git a/src/main/java/net/minecraft/server/CombatTracker.java b/src/main/java/net/minecraft/server/CombatTracker.java -index 6daa400d277bdaa441bf5719a273eacbe64feff9..38fe29f8a290550d1e5fa5451aadaf0f28cc4034 100644 +index 6281f7900afab3ef1c9ba3c034b91cbfa1900f50..3c2f8407906879c8dca07b538f59f4bbd31b278f 100644 --- a/src/main/java/net/minecraft/server/CombatTracker.java +++ b/src/main/java/net/minecraft/server/CombatTracker.java -@@ -175,6 +175,7 @@ public class CombatTracker { +@@ -192,6 +192,7 @@ public class CombatTracker { this.h = null; } @@ -27,27 +27,27 @@ index 6daa400d277bdaa441bf5719a273eacbe64feff9..38fe29f8a290550d1e5fa5451aadaf0f int i = this.f ? 300 : 100; diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 6e87ff52df30f4de8cfb11d1dbfb71211d656831..0f74ec89b3e85c918c95f9d8fef6d68403ed1107 100644 +index 55f8863f823836065f4de8240bfeb490bd391a55..a9664f03b8b7d2c12565b8c08891c7021aa5482b 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -1504,6 +1504,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - return false; +@@ -1460,6 +1460,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke } + // CraftBukkit end + public void runKillTrigger(Entity entity, int kills, DamageSource damageSource) { this.a(entity, kills, damageSource); } // Paper - OBFHELPER public void a(Entity entity, int i, DamageSource damagesource) { if (entity instanceof EntityPlayer) { CriterionTriggers.c.a((EntityPlayer) entity, this, damagesource); -@@ -2419,6 +2420,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -2349,6 +2350,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke this.fallDistance = 0.0F; } -+ public void onKill(EntityLiving entityLiving) { this.b(entityLiving); } // Paper - OBFHELPER - public void b(EntityLiving entityliving) {} ++ public void onKill(EntityLiving entityLiving) { this.a_(entityLiving); } // Paper - OBFHELPER + public void a_(EntityLiving entityliving) {} protected void k(double d0, double d1, double d2) { diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java -index 42b9a339e9c35db596ec78881c32c801c2d739f4..8ad131e4fc20efc61b938a5f6ab64379da23bf0d 100644 +index d5c09152acc93b25d626284071599afdbd76b709..51e9f4a6e09474a7489d2872a800308ee3f02e46 100644 --- a/src/main/java/net/minecraft/server/EntityArmorStand.java +++ b/src/main/java/net/minecraft/server/EntityArmorStand.java @@ -701,7 +701,8 @@ public class EntityArmorStand extends EntityLiving { @@ -61,10 +61,10 @@ index 42b9a339e9c35db596ec78881c32c801c2d739f4..8ad131e4fc20efc61b938a5f6ab64379 } diff --git a/src/main/java/net/minecraft/server/EntityFox.java b/src/main/java/net/minecraft/server/EntityFox.java -index 2be6c7bde9597d6d6d0c9ad63665b9aa74c74964..82a32d5dbf162b8c67c701d0c9647ddca103ddef 100644 +index 95874526516291607a44ae2213d4d6d65edfe18d..e6275a9fe6cd988fe4661966fd48149c3e73408c 100644 --- a/src/main/java/net/minecraft/server/EntityFox.java +++ b/src/main/java/net/minecraft/server/EntityFox.java -@@ -571,15 +571,25 @@ public class EntityFox extends EntityAnimal { +@@ -576,15 +576,25 @@ public class EntityFox extends EntityAnimal { } @Override @@ -85,7 +85,7 @@ index 2be6c7bde9597d6d6d0c9ad63665b9aa74c74964..82a32d5dbf162b8c67c701d0c9647ddc if (!itemstack.isEmpty()) { this.a(itemstack); - this.setSlot(EnumItemSlot.MAINHAND, ItemStack.a); + this.setSlot(EnumItemSlot.MAINHAND, ItemStack.b); } - super.d(damagesource); @@ -94,10 +94,10 @@ index 2be6c7bde9597d6d6d0c9ad63665b9aa74c74964..82a32d5dbf162b8c67c701d0c9647ddc public static boolean a(EntityFox entityfox, EntityLiving entityliving) { diff --git a/src/main/java/net/minecraft/server/EntityHorseChestedAbstract.java b/src/main/java/net/minecraft/server/EntityHorseChestedAbstract.java -index 80717ad9ac3d45fb2d25fac4fa1b61446aebd453..53aac5bccd2b1a36941a6744bbeece6a2f724cda 100644 +index c2a3bd8f25e91f79723074d93f6a646a8ce76d8c..4934e71225fe1242615660a379e797e212040ed3 100644 --- a/src/main/java/net/minecraft/server/EntityHorseChestedAbstract.java +++ b/src/main/java/net/minecraft/server/EntityHorseChestedAbstract.java -@@ -55,11 +55,19 @@ public abstract class EntityHorseChestedAbstract extends EntityHorseAbstract { +@@ -50,11 +50,19 @@ public abstract class EntityHorseChestedAbstract extends EntityHorseAbstract { this.a((IMaterial) Blocks.CHEST); } @@ -116,42 +116,42 @@ index 80717ad9ac3d45fb2d25fac4fa1b61446aebd453..53aac5bccd2b1a36941a6744bbeece6a + // Paper end + @Override - public void b(NBTTagCompound nbttagcompound) { - super.b(nbttagcompound); + public void saveData(NBTTagCompound nbttagcompound) { + super.saveData(nbttagcompound); diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 93625dea9ca6a13f311dd5ecc5c0d09060c418c8..3d5668271954ede03220354985851603669a61d4 100644 +index 4b249a644c680a7cc64b0d31cf453f94ff2b6a0c..d6a98bb7fc107649c179cded2d37c06a41146a89 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -89,7 +89,7 @@ public abstract class EntityLiving extends Entity { +@@ -95,7 +95,7 @@ public abstract class EntityLiving extends Entity { + protected float aS; protected float aT; protected float aU; - protected float aV; -- protected int aW; -+ protected int aW; protected int getKillCount() { return this.aW; } // Paper - OBFHELPER +- protected int aV; ++ protected int aV; protected int getKillCount() { return this.aV; } // Paper - OBFHELPER public float lastDamage; protected boolean jumping; - public float aZ; -@@ -131,6 +131,7 @@ public abstract class EntityLiving extends Entity { - public boolean collides = true; + public float aY; +@@ -139,6 +139,7 @@ public abstract class EntityLiving extends Entity { + public Set collidableExemptions = new HashSet<>(); public boolean canPickUpLoot; public org.bukkit.craftbukkit.entity.CraftLivingEntity getBukkitLivingEntity() { return (org.bukkit.craftbukkit.entity.CraftLivingEntity) super.getBukkitEntity(); } // Paper + public boolean silentDeath = false; // Paper - mark entity as dying silently for cancellable death event @Override public float getBukkitYaw() { -@@ -1139,13 +1140,17 @@ public abstract class EntityLiving extends Entity { - - if (this.getHealth() <= 0.0F) { +@@ -1248,13 +1249,17 @@ public abstract class EntityLiving extends Entity { + if (knockbackCancelled) this.world.broadcastEntityEffect(this, (byte) 2); // Paper - Disable explosion knockback + if (this.dk()) { if (!this.f(damagesource)) { - SoundEffect soundeffect = this.getSoundDeath(); + // Paper start - moved into CraftEventFactory event caller for cancellable death event + //SoundEffect soundeffect = this.getSoundDeath(); - if (flag1 && soundeffect != null) { -- this.a(soundeffect, this.getSoundVolume(), this.dn()); +- this.playSound(soundeffect, this.getSoundVolume(), this.dG()); - } +// if (flag1 && soundeffect != null) { -+// this.a(soundeffect, this.getSoundVolume(), this.dn()); ++// this.playSound(soundeffect, this.getSoundVolume(), this.dG()); +// } + this.silentDeath = !flag1; // mark entity as dying silently + // Paper end @@ -161,15 +161,15 @@ index 93625dea9ca6a13f311dd5ecc5c0d09060c418c8..3d5668271954ede03220354985851603 } } else if (flag1) { this.c(damagesource); -@@ -1283,6 +1288,7 @@ public abstract class EntityLiving extends Entity { +@@ -1392,6 +1397,7 @@ public abstract class EntityLiving extends Entity { Entity entity = damagesource.getEntity(); EntityLiving entityliving = this.getKillingEntity(); + /* // Paper - move down to make death event cancellable - if (this.aW >= 0 && entityliving != null) { - entityliving.a(this, this.aW, damagesource); + if (this.aV >= 0 && entityliving != null) { + entityliving.a(this, this.aV, damagesource); } -@@ -1294,16 +1300,36 @@ public abstract class EntityLiving extends Entity { +@@ -1403,16 +1409,36 @@ public abstract class EntityLiving extends Entity { if (this.isSleeping()) { this.entityWakeup(); } @@ -177,7 +177,7 @@ index 93625dea9ca6a13f311dd5ecc5c0d09060c418c8..3d5668271954ede03220354985851603 this.killed = true; - this.getCombatTracker().g(); -+ //this.getCombatTracker().g(); ++ //this.getCombatTracker().g(); // Paper if (!this.world.isClientSide) { - this.d(damagesource); + org.bukkit.event.entity.EntityDeathEvent deathEvent = this.d(damagesource); @@ -198,7 +198,7 @@ index 93625dea9ca6a13f311dd5ecc5c0d09060c418c8..3d5668271954ede03220354985851603 + } + // Paper end + - this.f(entityliving); + this.g(entityliving); } + if (this.killed) { // Paper @@ -208,16 +208,16 @@ index 93625dea9ca6a13f311dd5ecc5c0d09060c418c8..3d5668271954ede03220354985851603 } } -@@ -1311,7 +1337,7 @@ public abstract class EntityLiving extends Entity { +@@ -1420,7 +1446,7 @@ public abstract class EntityLiving extends Entity { if (!this.world.isClientSide) { boolean flag = false; - if (entityliving instanceof EntityWither) { + if (this.killed && entityliving instanceof EntityWither) { // Paper if (this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING)) { - BlockPosition blockposition = new BlockPosition(this); + BlockPosition blockposition = this.getChunkCoordinates(); IBlockData iblockdata = Blocks.WITHER_ROSE.getBlockData(); -@@ -1332,7 +1358,8 @@ public abstract class EntityLiving extends Entity { +@@ -1441,7 +1467,8 @@ public abstract class EntityLiving extends Entity { } } @@ -227,12 +227,12 @@ index 93625dea9ca6a13f311dd5ecc5c0d09060c418c8..3d5668271954ede03220354985851603 Entity entity = damagesource.getEntity(); int i; -@@ -1345,22 +1372,26 @@ public abstract class EntityLiving extends Entity { +@@ -1454,22 +1481,26 @@ public abstract class EntityLiving extends Entity { boolean flag = this.lastDamageByPlayerTime > 0; this.dropInventory(); // CraftBukkit - from below + org.bukkit.event.entity.EntityDeathEvent deathEvent; // Paper - if (this.isDropExperience() && this.world.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) { + if (this.cV() && this.world.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) { this.a(damagesource, flag); this.dropDeathLoot(damagesource, i, flag); // CraftBukkit start - Call death event @@ -257,7 +257,7 @@ index 93625dea9ca6a13f311dd5ecc5c0d09060c418c8..3d5668271954ede03220354985851603 // CraftBukkit start public int getExpReward() { -@@ -1439,6 +1470,7 @@ public abstract class EntityLiving extends Entity { +@@ -1554,6 +1585,7 @@ public abstract class EntityLiving extends Entity { return SoundEffects.ENTITY_GENERIC_HURT; } @@ -265,7 +265,7 @@ index 93625dea9ca6a13f311dd5ecc5c0d09060c418c8..3d5668271954ede03220354985851603 @Nullable protected SoundEffect getSoundDeath() { return SoundEffects.ENTITY_GENERIC_DEATH; -@@ -1924,10 +1956,12 @@ public abstract class EntityLiving extends Entity { +@@ -2073,10 +2105,12 @@ public abstract class EntityLiving extends Entity { } @@ -274,15 +274,15 @@ index 93625dea9ca6a13f311dd5ecc5c0d09060c418c8..3d5668271954ede03220354985851603 return 1.0F; } -+ public float getSoundPitch() { return dn();} // Paper - OBFHELPER - protected float dn() { ++ public float getSoundPitch() { return dG();} // Paper - OBFHELPER + protected float dG() { return this.isBaby() ? (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.5F : (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F; } diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index f35d23340665ab323732915efc0c0ad7fe4d964d..f43584f0e31a1c3d0e9b4356b7021cd79226d8b5 100644 +index dc8f88d102c06d8fb28ffd66de36f32efec54ff2..650579eb1bb73416b629229fce897d2941bd3b0d 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -76,6 +76,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -80,6 +80,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public int ping; public boolean viewingCredits; private int containerUpdateDelay; // Paper @@ -293,7 +293,7 @@ index f35d23340665ab323732915efc0c0ad7fe4d964d..f43584f0e31a1c3d0e9b4356b7021cd7 // CraftBukkit start public String displayName; -@@ -539,6 +543,15 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -579,6 +583,15 @@ public class EntityPlayer extends EntityHuman implements ICrafting { String deathmessage = defaultMessage.getString(); org.bukkit.event.entity.PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(this, loot, deathmessage, keepInventory); @@ -309,7 +309,7 @@ index f35d23340665ab323732915efc0c0ad7fe4d964d..f43584f0e31a1c3d0e9b4356b7021cd7 // SPIGOT-943 - only call if they have an inventory open if (this.activeContainer != this.defaultContainer) { -@@ -677,8 +690,17 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -730,8 +743,17 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } } } @@ -330,10 +330,10 @@ index f35d23340665ab323732915efc0c0ad7fe4d964d..f43584f0e31a1c3d0e9b4356b7021cd7 } } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftSound.java b/src/main/java/org/bukkit/craftbukkit/CraftSound.java -index 90fdf89c811620d3c26486cd55c8cdb14ce9654c..b761a41dcd899b6556f07d3b835ce7e56da3cfbb 100644 +index 7b565ddfffd0b9c78392ee115ef9c20ab89a3380..d78b9fd608da691220f1edeff506b36e3a88f515 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftSound.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftSound.java -@@ -821,6 +821,22 @@ public enum CraftSound { +@@ -996,6 +996,22 @@ public enum CraftSound { WEATHER_RAIN_ABOVE("weather.rain.above"); private final String minecraftKey; @@ -357,10 +357,10 @@ index 90fdf89c811620d3c26486cd55c8cdb14ce9654c..b761a41dcd899b6556f07d3b835ce7e5 this.minecraftKey = minecraftKey; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index fefe3b67ae62daedeb214d53d0c1f9d806356792..5445554b18c22b85cf9b3427c22d693a24bc596b 100644 +index 21aa19081ca3d9c20ea8e401c2a4b830ba667a51..1398d911456b6e685bf7292687c5f5a4dcea5b7e 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1697,7 +1697,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1762,7 +1762,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } public void sendHealthUpdate() { @@ -376,12 +376,12 @@ index fefe3b67ae62daedeb214d53d0c1f9d806356792..5445554b18c22b85cf9b3427c22d693a + // Paper end } - public void injectScaledMaxHealth(Collection collection, boolean force) { + public void injectScaledMaxHealth(Collection collection, boolean force) { diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 4329780e9de3337fd8fcca78b1ed8804e4687552..91cfc6966e19a8d3d3b2cafdb0464162c9a94de5 100644 +index f6c8c371e22272983f80268dab8009ee029bed2a..37f6fdf1be6d0f8a4ec4b9998fa710876b5515c9 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -757,9 +757,16 @@ public class CraftEventFactory { +@@ -783,9 +783,16 @@ public class CraftEventFactory { public static EntityDeathEvent callEntityDeathEvent(EntityLiving victim, List drops) { CraftLivingEntity entity = (CraftLivingEntity) victim.getBukkitEntity(); EntityDeathEvent event = new EntityDeathEvent(entity, drops, victim.getExpReward()); @@ -398,7 +398,7 @@ index 4329780e9de3337fd8fcca78b1ed8804e4687552..91cfc6966e19a8d3d3b2cafdb0464162 victim.expToDrop = event.getDroppedExp(); for (org.bukkit.inventory.ItemStack stack : event.getDrops()) { -@@ -775,8 +782,15 @@ public class CraftEventFactory { +@@ -801,8 +808,15 @@ public class CraftEventFactory { CraftPlayer entity = victim.getBukkitEntity(); PlayerDeathEvent event = new PlayerDeathEvent(entity, drops, victim.getExpReward(), 0, deathMessage); event.setKeepInventory(keepInventory); @@ -414,7 +414,7 @@ index 4329780e9de3337fd8fcca78b1ed8804e4687552..91cfc6966e19a8d3d3b2cafdb0464162 victim.keepLevel = event.getKeepLevel(); victim.newLevel = event.getNewLevel(); -@@ -793,6 +807,31 @@ public class CraftEventFactory { +@@ -819,6 +833,31 @@ public class CraftEventFactory { return event; } diff --git a/Spigot-Server-Patches/0290-Allow-chests-to-be-placed-with-NBT-data.patch b/Spigot-Server-Patches/0287-Allow-chests-to-be-placed-with-NBT-data.patch similarity index 85% rename from Spigot-Server-Patches/0290-Allow-chests-to-be-placed-with-NBT-data.patch rename to Spigot-Server-Patches/0287-Allow-chests-to-be-placed-with-NBT-data.patch index 5f1e4fec7..9ed2eeb58 100644 --- a/Spigot-Server-Patches/0290-Allow-chests-to-be-placed-with-NBT-data.patch +++ b/Spigot-Server-Patches/0287-Allow-chests-to-be-placed-with-NBT-data.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Allow chests to be placed with NBT data diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java -index 0b0c3c681c07cf8506df1b91b1feaf130891a440..d953cdef14a9b62833a35a4fe94a22b5e9b19c2d 100644 +index 95e801a9a7ca405ff7e80c920fa78493d0ef5374..a075a41d954836864a5186b383e967a9ac262df8 100644 --- a/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java -@@ -240,6 +240,7 @@ public final class ItemStack { +@@ -244,6 +244,7 @@ public final class ItemStack { enuminteractionresult = EnumInteractionResult.FAIL; // cancel placement // PAIL: Remove this when MC-99075 fixed placeEvent.getPlayer().updateInventory(); @@ -17,7 +17,7 @@ index 0b0c3c681c07cf8506df1b91b1feaf130891a440..d953cdef14a9b62833a35a4fe94a22b5 for (BlockState blockstate : blocks) { blockstate.update(true, false); diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/java/net/minecraft/server/TileEntityChest.java -index c4766f729fed7c9da9e456cae044400e2d08400c..b22bd06e27b3e07f1eb3e729686c394602a0ba5c 100644 +index a016d97be93c4218136f803cc9a7f986d70309d2..f6f2743892b5b933e6ba0cc25b24e0d471b305c9 100644 --- a/src/main/java/net/minecraft/server/TileEntityChest.java +++ b/src/main/java/net/minecraft/server/TileEntityChest.java @@ -292,7 +292,7 @@ public class TileEntityChest extends TileEntityLootable { // Paper - Remove ITic diff --git a/Spigot-Server-Patches/0291-Mob-Pathfinding-API.patch b/Spigot-Server-Patches/0288-Mob-Pathfinding-API.patch similarity index 90% rename from Spigot-Server-Patches/0291-Mob-Pathfinding-API.patch rename to Spigot-Server-Patches/0288-Mob-Pathfinding-API.patch index 23c2b858b..6f0d89713 100644 --- a/Spigot-Server-Patches/0291-Mob-Pathfinding-API.patch +++ b/Spigot-Server-Patches/0288-Mob-Pathfinding-API.patch @@ -153,10 +153,10 @@ index 0000000000000000000000000000000000000000..af1bac9680028130e99c5e7130f258c1 + } +} diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java -index bdd092e49da13960cd8a65e989a351d65cb620f7..f06764973feaa29ccbb4731b65372c544dcf3032 100644 +index b06c76a369f1dc9de8d782272c3ff0573af89361..cca6242e38fc286eea810eb8f2e4d1ab5429b9df 100644 --- a/src/main/java/net/minecraft/server/NavigationAbstract.java +++ b/src/main/java/net/minecraft/server/NavigationAbstract.java -@@ -80,7 +80,7 @@ public abstract class NavigationAbstract { +@@ -78,7 +78,7 @@ public abstract class NavigationAbstract { } @Nullable @@ -165,16 +165,16 @@ index bdd092e49da13960cd8a65e989a351d65cb620f7..f06764973feaa29ccbb4731b65372c54 return this.a(new BlockPosition(d0, d1, d2), i); } -@@ -100,7 +100,7 @@ public abstract class NavigationAbstract { +@@ -103,7 +103,7 @@ public abstract class NavigationAbstract { } @Nullable - public PathEntity a(Entity entity, int i) { + public final PathEntity calculateDestination(Entity entity) { return a(entity, 0); } public PathEntity a(Entity entity, int i) { - return this.a(ImmutableSet.of(new BlockPosition(entity)), entity, 16, true, i); // Paper + return this.a(ImmutableSet.of(entity.getChunkCoordinates()), entity, 16, true, i); // Paper } -@@ -164,6 +164,7 @@ public abstract class NavigationAbstract { +@@ -168,6 +168,7 @@ public abstract class NavigationAbstract { return pathentity != null && this.a(pathentity, d0); } @@ -182,7 +182,7 @@ index bdd092e49da13960cd8a65e989a351d65cb620f7..f06764973feaa29ccbb4731b65372c54 public boolean a(@Nullable PathEntity pathentity, double d0) { if (pathentity == null) { this.c = null; -@@ -191,7 +192,7 @@ public abstract class NavigationAbstract { +@@ -195,7 +196,7 @@ public abstract class NavigationAbstract { } } @@ -191,7 +191,7 @@ index bdd092e49da13960cd8a65e989a351d65cb620f7..f06764973feaa29ccbb4731b65372c54 public PathEntity k() { return this.c; } -@@ -281,6 +282,7 @@ public abstract class NavigationAbstract { +@@ -311,6 +312,7 @@ public abstract class NavigationAbstract { return !this.m(); } @@ -200,7 +200,7 @@ index bdd092e49da13960cd8a65e989a351d65cb620f7..f06764973feaa29ccbb4731b65372c54 this.c = null; } diff --git a/src/main/java/net/minecraft/server/PathEntity.java b/src/main/java/net/minecraft/server/PathEntity.java -index 312352ef848e20c210b1d32e3c362f94d78e2cca..dcb4e250803b8605f9bfb6d590c4e316dfee97d1 100644 +index 662932360bc7a9391fde99a88b60aac47f29467e..9154c01a22bc7b6d2dd390bb7b6e21ef52c8006c 100644 --- a/src/main/java/net/minecraft/server/PathEntity.java +++ b/src/main/java/net/minecraft/server/PathEntity.java @@ -5,13 +5,14 @@ import javax.annotation.Nullable; @@ -234,13 +234,13 @@ index 312352ef848e20c210b1d32e3c362f94d78e2cca..dcb4e250803b8605f9bfb6d590c4e316 return this.a(entity, this.e); } -- public Vec3D g() { -+ public Vec3D getNext() { return g(); } public Vec3D g() { // Paper - OBFHELPER - PathPoint pathpoint = (PathPoint) this.a.get(this.e); +- public BaseBlockPosition g() { ++ public BaseBlockPosition getNext() { return g(); } public BaseBlockPosition g() { // Paper - OBFHELPER + PathPoint pathpoint = this.h(); - return new Vec3D((double) pathpoint.a, (double) pathpoint.b, (double) pathpoint.c); + return new BaseBlockPosition(pathpoint.a, pathpoint.b, pathpoint.c); diff --git a/src/main/java/net/minecraft/server/PathPoint.java b/src/main/java/net/minecraft/server/PathPoint.java -index b1db95daa976f61da07a37ec1787ef49785e016a..18cdd2a6f290bf1f00db58efdb9a42f81c8e109b 100644 +index b69d6bc433711e94e3fbfa2a89c091209c95484d..e9fb295bdf727cd4543cbe5a18447ceba3d41ee0 100644 --- a/src/main/java/net/minecraft/server/PathPoint.java +++ b/src/main/java/net/minecraft/server/PathPoint.java @@ -2,9 +2,9 @@ package net.minecraft.server; @@ -257,7 +257,7 @@ index b1db95daa976f61da07a37ec1787ef49785e016a..18cdd2a6f290bf1f00db58efdb9a42f8 public int d = -1; public float e; diff --git a/src/main/java/net/minecraft/server/PathfinderAbstract.java b/src/main/java/net/minecraft/server/PathfinderAbstract.java -index af3b09f59a38020c1a45403526fca81c1da144d5..477b762e9c0c51cb3f387f70ba7ec9d35dc04132 100644 +index fca9ed99d6c11badb85e0c06cd6872dca85d6f8d..5cfcac3bc29e3f3d139b10209f5082cba292a434 100644 --- a/src/main/java/net/minecraft/server/PathfinderAbstract.java +++ b/src/main/java/net/minecraft/server/PathfinderAbstract.java @@ -11,9 +11,9 @@ public abstract class PathfinderAbstract { diff --git a/Spigot-Server-Patches/0292-Prevent-chunk-loading-from-Fluid-Flowing.patch b/Spigot-Server-Patches/0289-Prevent-chunk-loading-from-Fluid-Flowing.patch similarity index 92% rename from Spigot-Server-Patches/0292-Prevent-chunk-loading-from-Fluid-Flowing.patch rename to Spigot-Server-Patches/0289-Prevent-chunk-loading-from-Fluid-Flowing.patch index 6aad0026a..d90ae0901 100644 --- a/Spigot-Server-Patches/0292-Prevent-chunk-loading-from-Fluid-Flowing.patch +++ b/Spigot-Server-Patches/0289-Prevent-chunk-loading-from-Fluid-Flowing.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Prevent chunk loading from Fluid Flowing diff --git a/src/main/java/net/minecraft/server/FluidTypeFlowing.java b/src/main/java/net/minecraft/server/FluidTypeFlowing.java -index 3099a5e654d343fba1a61d6be3477df0866feb47..376dca1889f1eca4ce9993e0e067a94eb293103d 100644 +index 663731a5e7ad3990d1ffac3e0a3028dba37f2b07..d72a88e9275eb00eed35b6467538a46e5cee32d5 100644 --- a/src/main/java/net/minecraft/server/FluidTypeFlowing.java +++ b/src/main/java/net/minecraft/server/FluidTypeFlowing.java -@@ -178,7 +178,8 @@ public abstract class FluidTypeFlowing extends FluidType { +@@ -154,7 +154,8 @@ public abstract class FluidTypeFlowing extends FluidType { EnumDirection enumdirection = (EnumDirection) entry.getKey(); Fluid fluid1 = (Fluid) entry.getValue(); BlockPosition blockposition1 = blockposition.shift(enumdirection); @@ -18,7 +18,7 @@ index 3099a5e654d343fba1a61d6be3477df0866feb47..376dca1889f1eca4ce9993e0e067a94e if (this.a(generatoraccess, blockposition, iblockdata, enumdirection, blockposition1, iblockdata1, generatoraccess.getFluid(blockposition1), fluid1.getType())) { // CraftBukkit start -@@ -205,7 +206,8 @@ public abstract class FluidTypeFlowing extends FluidType { +@@ -181,7 +182,8 @@ public abstract class FluidTypeFlowing extends FluidType { while (iterator.hasNext()) { EnumDirection enumdirection = (EnumDirection) iterator.next(); BlockPosition blockposition1 = blockposition.shift(enumdirection); @@ -28,7 +28,7 @@ index 3099a5e654d343fba1a61d6be3477df0866feb47..376dca1889f1eca4ce9993e0e067a94e Fluid fluid = iblockdata1.getFluid(); if (fluid.getType().a((FluidType) this) && this.a(enumdirection, (IBlockAccess) iworldreader, blockposition, iblockdata, blockposition1, iblockdata1)) { -@@ -322,11 +324,18 @@ public abstract class FluidTypeFlowing extends FluidType { +@@ -298,11 +300,18 @@ public abstract class FluidTypeFlowing extends FluidType { if (enumdirection1 != enumdirection) { BlockPosition blockposition2 = blockposition.shift(enumdirection1); short short0 = a(blockposition1, blockposition2); @@ -51,7 +51,7 @@ index 3099a5e654d343fba1a61d6be3477df0866feb47..376dca1889f1eca4ce9993e0e067a94e IBlockData iblockdata1 = (IBlockData) pair.getFirst(); Fluid fluid = (Fluid) pair.getSecond(); -@@ -398,11 +407,16 @@ public abstract class FluidTypeFlowing extends FluidType { +@@ -374,11 +383,16 @@ public abstract class FluidTypeFlowing extends FluidType { EnumDirection enumdirection = (EnumDirection) iterator.next(); BlockPosition blockposition1 = blockposition.shift(enumdirection); short short0 = a(blockposition, blockposition1); diff --git a/Spigot-Server-Patches/0293-Implement-an-API-for-CanPlaceOn-and-CanDestroy-NBT-v.patch b/Spigot-Server-Patches/0290-Implement-an-API-for-CanPlaceOn-and-CanDestroy-NBT-v.patch similarity index 92% rename from Spigot-Server-Patches/0293-Implement-an-API-for-CanPlaceOn-and-CanDestroy-NBT-v.patch rename to Spigot-Server-Patches/0290-Implement-an-API-for-CanPlaceOn-and-CanDestroy-NBT-v.patch index e4b9c7182..d6eace323 100644 --- a/Spigot-Server-Patches/0293-Implement-an-API-for-CanPlaceOn-and-CanDestroy-NBT-v.patch +++ b/Spigot-Server-Patches/0290-Implement-an-API-for-CanPlaceOn-and-CanDestroy-NBT-v.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Implement an API for CanPlaceOn and CanDestroy NBT values diff --git a/src/main/java/net/minecraft/server/ArgumentBlock.java b/src/main/java/net/minecraft/server/ArgumentBlock.java -index 005ebec266032dd873cc2e7d8919d9bd018457f7..97d85f8451a7a6cd17ac272492da52c55161789d 100644 +index b986a8e318733bdae766202bef93d4d25f18b58d..1f74602ff13a9f89c8dc40170353a79a41085649 100644 --- a/src/main/java/net/minecraft/server/ArgumentBlock.java +++ b/src/main/java/net/minecraft/server/ArgumentBlock.java -@@ -43,7 +43,7 @@ public class ArgumentBlock { +@@ -45,7 +45,7 @@ public class ArgumentBlock { private final boolean j; private final Map, Comparable> k = Maps.newLinkedHashMap(); // CraftBukkit - stable private final Map l = Maps.newHashMap(); @@ -17,7 +17,7 @@ index 005ebec266032dd873cc2e7d8919d9bd018457f7..97d85f8451a7a6cd17ac272492da52c5 private BlockStateList n; private IBlockData o; @Nullable -@@ -72,11 +72,13 @@ public class ArgumentBlock { +@@ -74,11 +74,13 @@ public class ArgumentBlock { return this.p; } @@ -32,10 +32,10 @@ index 005ebec266032dd873cc2e7d8919d9bd018457f7..97d85f8451a7a6cd17ac272492da52c5 this.s = this::l; if (this.i.canRead() && this.i.peek() == '#') { diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index b87d2581754fde163a7b5532b9d5e21b48d3e243..706f1bd66c79dddc26794cad818679473e20382f 100644 +index c0858aeac0c9709a79590a0ca8db32d64efe7523..fe4aa562aa5a938dea9cd083ccff8c9cb28a7159 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -@@ -86,6 +86,12 @@ import org.bukkit.persistence.PersistentDataContainer; +@@ -85,6 +85,12 @@ import org.bukkit.persistence.PersistentDataContainer; import static org.spigotmc.ValidateUtils.*; // Spigot end @@ -48,7 +48,7 @@ index b87d2581754fde163a7b5532b9d5e21b48d3e243..706f1bd66c79dddc26794cad81867947 /** * Children must include the following: * -@@ -267,6 +273,10 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -268,6 +274,10 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @Specific(Specific.To.NBT) static final ItemMetaKey BLOCK_DATA = new ItemMetaKey("BlockStateTag"); static final ItemMetaKey BUKKIT_CUSTOM_TAG = new ItemMetaKey("PublicBukkitValues"); @@ -59,7 +59,7 @@ index b87d2581754fde163a7b5532b9d5e21b48d3e243..706f1bd66c79dddc26794cad81867947 private IChatBaseComponent displayName; private IChatBaseComponent locName; -@@ -279,6 +289,10 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -280,6 +290,10 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { private int hideFlag; private boolean unbreakable; private int damage; @@ -70,7 +70,7 @@ index b87d2581754fde163a7b5532b9d5e21b48d3e243..706f1bd66c79dddc26794cad81867947 private static final Set HANDLED_TAGS = Sets.newHashSet(); private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry(); -@@ -316,6 +330,15 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -317,6 +331,15 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { this.hideFlag = meta.hideFlag; this.unbreakable = meta.unbreakable; this.damage = meta.damage; @@ -86,7 +86,7 @@ index b87d2581754fde163a7b5532b9d5e21b48d3e243..706f1bd66c79dddc26794cad81867947 this.unhandledTags.putAll(meta.unhandledTags); this.persistentDataContainer.putAll(meta.persistentDataContainer.getRaw()); -@@ -392,6 +415,31 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -393,6 +416,31 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { persistentDataContainer.put(key, compound.get(key)); } } @@ -118,7 +118,7 @@ index b87d2581754fde163a7b5532b9d5e21b48d3e243..706f1bd66c79dddc26794cad81867947 Set keys = tag.getKeys(); for (String key : keys) { -@@ -529,6 +577,34 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -530,6 +578,34 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { setDamage(damage); } @@ -153,7 +153,7 @@ index b87d2581754fde163a7b5532b9d5e21b48d3e243..706f1bd66c79dddc26794cad81867947 String internal = SerializableMeta.getString(map, "internal", true); if (internal != null) { ByteArrayInputStream buf = new ByteArrayInputStream(Base64.decodeBase64(internal)); -@@ -657,6 +733,23 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -658,6 +734,23 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { if (hasDamage()) { itemTag.setInt(DAMAGE.NBT, damage); } @@ -177,7 +177,7 @@ index b87d2581754fde163a7b5532b9d5e21b48d3e243..706f1bd66c79dddc26794cad81867947 for (Map.Entry e : unhandledTags.entrySet()) { itemTag.set(e.getKey(), e.getValue()); -@@ -673,6 +766,21 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -674,6 +767,21 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { } } @@ -199,7 +199,7 @@ index b87d2581754fde163a7b5532b9d5e21b48d3e243..706f1bd66c79dddc26794cad81867947 NBTTagList createStringList(List list) { if (list == null || list.isEmpty()) { return null; -@@ -756,7 +864,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -757,7 +865,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @Overridden boolean isEmpty() { @@ -208,7 +208,7 @@ index b87d2581754fde163a7b5532b9d5e21b48d3e243..706f1bd66c79dddc26794cad81867947 } @Override -@@ -1156,7 +1264,11 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1157,7 +1265,11 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { && (this.hideFlag == that.hideFlag) && (this.isUnbreakable() == that.isUnbreakable()) && (this.hasDamage() ? that.hasDamage() && this.damage == that.damage : !that.hasDamage()) @@ -221,7 +221,7 @@ index b87d2581754fde163a7b5532b9d5e21b48d3e243..706f1bd66c79dddc26794cad81867947 } /** -@@ -1191,6 +1303,10 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1192,6 +1304,10 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { hash = 61 * hash + (hasDamage() ? this.damage : 0); hash = 61 * hash + (hasAttributeModifiers() ? this.attributeModifiers.hashCode() : 0); hash = 61 * hash + version; @@ -232,7 +232,7 @@ index b87d2581754fde163a7b5532b9d5e21b48d3e243..706f1bd66c79dddc26794cad81867947 return hash; } -@@ -1215,6 +1331,14 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1216,6 +1332,14 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { clone.unbreakable = this.unbreakable; clone.damage = this.damage; clone.version = this.version; @@ -247,7 +247,7 @@ index b87d2581754fde163a7b5532b9d5e21b48d3e243..706f1bd66c79dddc26794cad81867947 return clone; } catch (CloneNotSupportedException e) { throw new Error(e); -@@ -1272,6 +1396,24 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1273,6 +1397,24 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { builder.put(DAMAGE.BUKKIT, damage); } @@ -272,18 +272,16 @@ index b87d2581754fde163a7b5532b9d5e21b48d3e243..706f1bd66c79dddc26794cad81867947 final Map internalTags = new HashMap(unhandledTags); serializeInternal(internalTags); if (!internalTags.isEmpty()) { -@@ -1435,7 +1577,9 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { - CraftMetaArmorStand.NO_BASE_PLATE.NBT, +@@ -1437,6 +1579,8 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { CraftMetaArmorStand.SHOW_ARMS.NBT, CraftMetaArmorStand.SMALL.NBT, -- CraftMetaArmorStand.MARKER.NBT -+ CraftMetaArmorStand.MARKER.NBT, + CraftMetaArmorStand.MARKER.NBT, + CAN_DESTROY.NBT, -+ CAN_PLACE_ON.NBT ++ CAN_PLACE_ON.NBT, // Paper end - )); - } -@@ -1460,4 +1604,147 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { + CraftMetaCompass.LODESTONE_DIMENSION.NBT, + CraftMetaCompass.LODESTONE_POS.NBT, +@@ -1464,4 +1608,147 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { } // Paper end diff --git a/Spigot-Server-Patches/0294-Prevent-Mob-AI-Rules-from-Loading-Chunks.patch b/Spigot-Server-Patches/0291-Prevent-Mob-AI-Rules-from-Loading-Chunks.patch similarity index 78% rename from Spigot-Server-Patches/0294-Prevent-Mob-AI-Rules-from-Loading-Chunks.patch rename to Spigot-Server-Patches/0291-Prevent-Mob-AI-Rules-from-Loading-Chunks.patch index 175b21d02..147617e73 100644 --- a/Spigot-Server-Patches/0294-Prevent-Mob-AI-Rules-from-Loading-Chunks.patch +++ b/Spigot-Server-Patches/0291-Prevent-Mob-AI-Rules-from-Loading-Chunks.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Prevent Mob AI Rules from Loading Chunks diff --git a/src/main/java/net/minecraft/server/PathfinderGoalRemoveBlock.java b/src/main/java/net/minecraft/server/PathfinderGoalRemoveBlock.java -index bf8ca9b32aa8d7d797c430cbb98466ae9dcf738f..7ccb3d5c065d39b3a859d87a8462b6542fe40f3b 100644 +index ed29186791ac615c7d23ef8e7b8aea6a3ab8222d..29efbdd2ca77833e6be59e5b5b4c38633e43588d 100644 --- a/src/main/java/net/minecraft/server/PathfinderGoalRemoveBlock.java +++ b/src/main/java/net/minecraft/server/PathfinderGoalRemoveBlock.java @@ -12,11 +12,13 @@ public class PathfinderGoalRemoveBlock extends PathfinderGoalGotoTarget { @@ -26,10 +26,10 @@ index bf8ca9b32aa8d7d797c430cbb98466ae9dcf738f..7ccb3d5c065d39b3a859d87a8462b654 @Nullable private BlockPosition a(BlockPosition blockposition, IBlockAccess iblockaccess) { -- if (iblockaccess.getType(blockposition).getBlock() == this.g) { +- if (iblockaccess.getType(blockposition).a(this.g)) { + Block block = world.getBlockIfLoaded(blockposition); // Paper + if (block == null) return null; // Paper -+ if (block == this.g) { // Paper ++ if (block.a(this.g)) { // Paper return blockposition; } else { BlockPosition[] ablockposition = new BlockPosition[]{blockposition.down(), blockposition.west(), blockposition.east(), blockposition.north(), blockposition.south(), blockposition.down().down()}; @@ -37,8 +37,8 @@ index bf8ca9b32aa8d7d797c430cbb98466ae9dcf738f..7ccb3d5c065d39b3a859d87a8462b654 for (int j = 0; j < i; ++j) { BlockPosition blockposition1 = ablockposition1[j]; -- if (iblockaccess.getType(blockposition1).getBlock() == this.g) { -+ if (world.getBlockIfLoaded(blockposition1) == this.g) { // Paper +- if (iblockaccess.getType(blockposition1).a(this.g)) { ++ if (iblockaccess.getBlockIfLoaded(blockposition1).a(this.g)) { // Paper return blockposition1; } } @@ -49,13 +49,13 @@ index bf8ca9b32aa8d7d797c430cbb98466ae9dcf738f..7ccb3d5c065d39b3a859d87a8462b654 - IChunkAccess ichunkaccess = iworldreader.getChunkAt(blockposition.getX() >> 4, blockposition.getZ() >> 4, ChunkStatus.FULL, false); + IChunkAccess ichunkaccess = iworldreader.getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4); // Paper - return ichunkaccess == null ? false : ichunkaccess.getType(blockposition).getBlock() == this.g && ichunkaccess.getType(blockposition.up()).isAir() && ichunkaccess.getType(blockposition.up(2)).isAir(); + return ichunkaccess == null ? false : ichunkaccess.getType(blockposition).a(this.g) && ichunkaccess.getType(blockposition.up()).isAir() && ichunkaccess.getType(blockposition.up(2)).isAir(); } diff --git a/src/main/java/net/minecraft/server/RandomPositionGenerator.java b/src/main/java/net/minecraft/server/RandomPositionGenerator.java -index d4cd50918b63e4ff503536fabb9d60b880473d23..d6a3b993394b34ddebc55a952d09df490884558d 100644 +index 39b08086d111f614286675fd4a993da12cf24ccc..dc89c707b10c5544eca06a634a625bce0dd778f0 100644 --- a/src/main/java/net/minecraft/server/RandomPositionGenerator.java +++ b/src/main/java/net/minecraft/server/RandomPositionGenerator.java -@@ -109,6 +109,7 @@ public class RandomPositionGenerator { +@@ -116,6 +116,7 @@ public class RandomPositionGenerator { } blockposition2 = new BlockPosition((double) k1 + entitycreature.locX(), (double) l1 + entitycreature.locY(), (double) i2 + entitycreature.locZ()); @@ -63,13 +63,13 @@ index d4cd50918b63e4ff503536fabb9d60b880473d23..d6a3b993394b34ddebc55a952d09df49 if (blockposition2.getY() >= 0 && blockposition2.getY() <= entitycreature.world.getBuildHeight() && (!flag3 || entitycreature.a(blockposition2)) && (!flag2 || navigationabstract.a(blockposition2))) { if (flag1) { blockposition2 = a(blockposition2, random.nextInt(l + 1) + i1, entitycreature.world.getBuildHeight(), (blockposition3) -> { -@@ -116,7 +117,8 @@ public class RandomPositionGenerator { +@@ -123,7 +124,8 @@ public class RandomPositionGenerator { }); } -- if (flag || !entitycreature.world.getFluid(blockposition2).a(TagsFluid.WATER)) { +- if (flag || !entitycreature.world.getFluid(blockposition2).a((Tag) TagsFluid.WATER)) { + Fluid fluid = entitycreature.world.getFluidIfLoaded(blockposition2); // Paper -+ if (flag || (fluid != null && !fluid.a(TagsFluid.WATER))) { // Paper - PathType pathtype = PathfinderNormal.b(entitycreature.world, blockposition2.getX(), blockposition2.getY(), blockposition2.getZ()); ++ if (flag || (fluid != null && !fluid.a((Tag) TagsFluid.WATER))) { // Paper + PathType pathtype = PathfinderNormal.a((IBlockAccess) entitycreature.world, blockposition2.i()); if (entitycreature.a(pathtype) == 0.0F) { diff --git a/Spigot-Server-Patches/0292-Prevent-mob-spawning-from-loading-generating-chunks.patch b/Spigot-Server-Patches/0292-Prevent-mob-spawning-from-loading-generating-chunks.patch new file mode 100644 index 000000000..8a09eb039 --- /dev/null +++ b/Spigot-Server-Patches/0292-Prevent-mob-spawning-from-loading-generating-chunks.patch @@ -0,0 +1,32 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Wed, 12 Sep 2018 21:12:57 -0400 +Subject: [PATCH] Prevent mob spawning from loading/generating chunks + +also prevents if out of world border bounds + +diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java +index 137fa3e51390e95f5939f2251e0d170accbfb469..6426f67afb3cc3522ff79b1c8515c1f97cd2f0c1 100644 +--- a/src/main/java/net/minecraft/server/SpawnerCreature.java ++++ b/src/main/java/net/minecraft/server/SpawnerCreature.java +@@ -144,9 +144,9 @@ public final class SpawnerCreature { + StructureManager structuremanager = worldserver.getStructureManager(); + ChunkGenerator chunkgenerator = worldserver.getChunkProvider().getChunkGenerator(); + int i = blockposition.getY(); +- IBlockData iblockdata = ichunkaccess.getType(blockposition); ++ IBlockData iblockdata = worldserver.getTypeIfLoadedAndInBounds(blockposition); // Paper - don't load chunks for mob spawn + +- if (!iblockdata.isOccluding(ichunkaccess, blockposition)) { ++ if (iblockdata != null && !iblockdata.isOccluding(ichunkaccess, blockposition)) { // Paper - don't load chunks for mob spawn + BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition(); + int j = 0; + int k = 0; +@@ -175,7 +175,7 @@ public final class SpawnerCreature { + if (entityhuman != null) { + double d2 = entityhuman.g(d0, (double) i, d1); + +- if (a(worldserver, ichunkaccess, blockposition_mutableblockposition, d2)) { ++ if (a(worldserver, ichunkaccess, blockposition_mutableblockposition, d2) && worldserver.isLoadedAndInBounds(blockposition_mutableblockposition)) { // Paper - don't load chunks for mob spawn + if (biomebase_biomemeta == null) { + biomebase_biomemeta = a(worldserver, structuremanager, chunkgenerator, enumcreaturetype, worldserver.random, (BlockPosition) blockposition_mutableblockposition); + if (biomebase_biomemeta == null) { diff --git a/Spigot-Server-Patches/0296-Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch b/Spigot-Server-Patches/0293-Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch similarity index 58% rename from Spigot-Server-Patches/0296-Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch rename to Spigot-Server-Patches/0293-Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch index c7ccaeee3..9e95ad585 100644 --- a/Spigot-Server-Patches/0296-Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch +++ b/Spigot-Server-Patches/0293-Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch @@ -6,19 +6,19 @@ Subject: [PATCH] Optimize Biome Mob Lookups for Mob Spawning Uses an EnumMap as well as a Set paired List for O(1) contains calls. diff --git a/src/main/java/net/minecraft/server/BiomeBase.java b/src/main/java/net/minecraft/server/BiomeBase.java -index 253890e53702f9ba1c6628cc860a4ca10756626a..0102a170dc333fb4af01efa0aaa66df85271f1e0 100644 +index ae0ac8d383ca11a683465d8c83a8b8a66e567079..30aeb45d63394b7d91c2dd7b92cfc9cefa3c088c 100644 --- a/src/main/java/net/minecraft/server/BiomeBase.java +++ b/src/main/java/net/minecraft/server/BiomeBase.java -@@ -40,7 +40,7 @@ public abstract class BiomeBase { - protected final Map>> r = Maps.newHashMap(); - protected final List> s = Lists.newArrayList(); - protected final Map, WorldGenFeatureConfiguration> t = Maps.newHashMap(); -- private final Map> v = Maps.newHashMap(); -+ private final java.util.EnumMap> v = Maps.newEnumMap(EnumCreatureType.class); // Paper - private final ThreadLocal w = ThreadLocal.withInitial(() -> { - return (Long2FloatLinkedOpenHashMap) SystemUtils.a(() -> { - Long2FloatLinkedOpenHashMap long2floatlinkedopenhashmap = new Long2FloatLinkedOpenHashMap(1024, 0.25F) { -@@ -92,7 +92,7 @@ public abstract class BiomeBase { +@@ -119,7 +119,7 @@ public class BiomeBase { + this.r.put(worldgenstage_decoration, Lists.newArrayList()); + } + +- this.v = Maps.newHashMap(); ++ this.v = Maps.newEnumMap(EnumCreatureType.class); // Paper + EnumCreatureType[] aenumcreaturetype = EnumCreatureType.values(); + + i = aenumcreaturetype.length; +@@ -127,7 +127,7 @@ public class BiomeBase { for (j = 0; j < i; ++j) { EnumCreatureType enumcreaturetype = aenumcreaturetype[j]; @@ -27,8 +27,17 @@ index 253890e53702f9ba1c6628cc860a4ca10756626a..0102a170dc333fb4af01efa0aaa66df8 } } else { -@@ -327,6 +327,38 @@ public abstract class BiomeBase { - return this.m; +@@ -150,7 +150,7 @@ public class BiomeBase { + this.u = (Map) list.stream().collect(Collectors.toMap((structurefeature) -> { + return structurefeature.b; + }, Function.identity())); +- this.v = map2; ++ this.v = Maps.newEnumMap(EnumCreatureType.class); this.v.putAll(map2); // Paper + this.x = list1; + this.l = (String) optional.orElse(null); // Paper - decompile fix + Stream stream = map1.values().stream().flatMap(Collection::stream).filter((worldgenfeatureconfigured) -> { +@@ -433,6 +433,38 @@ public class BiomeBase { + return this.l; } + // Paper start - keep track of data in a pair set to give O(1) contains calls - we have to hook removals incase plugins mess with it @@ -63,6 +72,6 @@ index 253890e53702f9ba1c6628cc860a4ca10756626a..0102a170dc333fb4af01efa0aaa66df8 + } + // Paper end + - public static class a { + public static class d { - @Nullable + public static final Codec a = RecordCodecBuilder.create((instance) -> { diff --git a/Spigot-Server-Patches/0297-Implement-furnace-cook-speed-multiplier-API.patch b/Spigot-Server-Patches/0294-Implement-furnace-cook-speed-multiplier-API.patch similarity index 86% rename from Spigot-Server-Patches/0297-Implement-furnace-cook-speed-multiplier-API.patch rename to Spigot-Server-Patches/0294-Implement-furnace-cook-speed-multiplier-API.patch index a2cb14df3..9acaf329a 100644 --- a/Spigot-Server-Patches/0297-Implement-furnace-cook-speed-multiplier-API.patch +++ b/Spigot-Server-Patches/0294-Implement-furnace-cook-speed-multiplier-API.patch @@ -6,18 +6,18 @@ Subject: [PATCH] Implement furnace cook speed multiplier API Signed-off-by: Tassu diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java -index 560e2f42b702c5c4870640ad7da3aa48c3f4b1eb..d5432bfeb727baadd8614384d3e50314de5f8dc4 100644 +index 623cd63711c6cb79dce7a46056e193fdb13334a5..f4f50fb8375fec3f6868bbccc50bc78a5cd81965 100644 --- a/src/main/java/net/minecraft/server/TileEntityFurnace.java +++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java -@@ -8,6 +8,7 @@ import java.util.Map; - import java.util.Map.Entry; +@@ -10,6 +10,7 @@ import java.util.List; + import java.util.Map; import javax.annotation.Nullable; // CraftBukkit start +import java.util.List; import org.bukkit.craftbukkit.block.CraftBlock; import org.bukkit.craftbukkit.entity.CraftHumanEntity; import org.bukkit.craftbukkit.inventory.CraftItemStack; -@@ -26,6 +27,7 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I +@@ -28,6 +29,7 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I protected NonNullList items; public int burnTime; private int ticksForCurrentFuel; @@ -25,8 +25,8 @@ index 560e2f42b702c5c4870640ad7da3aa48c3f4b1eb..d5432bfeb727baadd8614384d3e50314 public int cookTime; public int cookTimeTotal; protected final IContainerProperties b; -@@ -212,6 +214,11 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I - this.n.put(minecraftkey, j); +@@ -228,6 +230,11 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I + this.n.put(new MinecraftKey(s), nbttagcompound1.getInt(s)); } + // Paper start - cook speed API @@ -37,15 +37,15 @@ index 560e2f42b702c5c4870640ad7da3aa48c3f4b1eb..d5432bfeb727baadd8614384d3e50314 } @Override -@@ -220,6 +227,7 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I +@@ -236,6 +243,7 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I nbttagcompound.setShort("BurnTime", (short) this.burnTime); nbttagcompound.setShort("CookTime", (short) this.cookTime); nbttagcompound.setShort("CookTimeTotal", (short) this.cookTimeTotal); + nbttagcompound.setDouble("Paper.CookSpeedMultiplier", this.cookSpeedMultiplier); // Paper - cook speed multiplier API ContainerUtil.a(nbttagcompound, this.items); - nbttagcompound.setShort("RecipesUsedSize", (short) this.n.size()); - int i = 0; -@@ -283,8 +291,8 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); + +@@ -295,8 +303,8 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I } if (this.isBurning() && this.canBurn(irecipe)) { diff --git a/Spigot-Server-Patches/0300-PreSpawnerSpawnEvent.patch b/Spigot-Server-Patches/0295-PreSpawnerSpawnEvent.patch similarity index 94% rename from Spigot-Server-Patches/0300-PreSpawnerSpawnEvent.patch rename to Spigot-Server-Patches/0295-PreSpawnerSpawnEvent.patch index 3b94d0fa0..7126767cc 100644 --- a/Spigot-Server-Patches/0300-PreSpawnerSpawnEvent.patch +++ b/Spigot-Server-Patches/0295-PreSpawnerSpawnEvent.patch @@ -9,7 +9,7 @@ SpawnerSpawnEvent gets called instead of the CreatureSpawnEvent for spawners. diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -index 43c491f71b7739c782b46ee77ff8debe44213f11..cb7cb789b82461093fbbb4c8ae6d03fcbfe57383 100644 +index 45cd44335427a818a580158d57025289f37079bf..e2f5354709819e56f9bc66b8c8d5e095bc8387b4 100644 --- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java @@ -111,11 +111,11 @@ public abstract class MobSpawnerAbstract { diff --git a/Spigot-Server-Patches/0295-Prevent-mob-spawning-from-loading-generating-chunks.patch b/Spigot-Server-Patches/0295-Prevent-mob-spawning-from-loading-generating-chunks.patch deleted file mode 100644 index 249b8e6f6..000000000 --- a/Spigot-Server-Patches/0295-Prevent-mob-spawning-from-loading-generating-chunks.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Wed, 12 Sep 2018 21:12:57 -0400 -Subject: [PATCH] Prevent mob spawning from loading/generating chunks - -also prevents if out of world border bounds - -diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java -index 224443e03c9e55af2744eebd7e754e2a1b3fa296..fdac5bb3a2d4a73035e1d914979b87fc224b6b20 100644 ---- a/src/main/java/net/minecraft/server/SpawnerCreature.java -+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java -@@ -25,9 +25,9 @@ public final class SpawnerCreature { - int l = blockposition1.getZ(); - - if (k >= 1) { -- IBlockData iblockdata = chunk.getType(blockposition1); -+ IBlockData iblockdata = worldserver.getTypeIfLoadedAndInBounds(blockposition1); // Paper - don't load chunks for mob spawn - -- if (!iblockdata.isOccluding(chunk, blockposition1)) { -+ if (iblockdata != null && !iblockdata.isOccluding(chunk, blockposition1)) { // Paper - don't load chunks for mob spawn - BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition(); - int i1 = 0; - -@@ -55,7 +55,7 @@ public final class SpawnerCreature { - if (entityhuman != null) { - double d0 = entityhuman.g((double) f, (double) k, (double) f1); - -- if (d0 > 576.0D && !blockposition.a((IPosition) (new Vec3D((double) f, (double) k, (double) f1)), 24.0D)) { -+ if (d0 > 576.0D && !blockposition.a((IPosition) (new Vec3D((double) f, (double) k, (double) f1)), 24.0D) && worldserver.isLoadedAndInBounds(blockposition_mutableblockposition)) { // Paper - don't load chunks for mob spawn - ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(blockposition_mutableblockposition); - - if (Objects.equals(chunkcoordintpair, chunk.getPos()) || worldserver.getChunkProvider().a(chunkcoordintpair)) { diff --git a/Spigot-Server-Patches/0301-Catch-JsonParseException-in-Entity-and-TE-names.patch b/Spigot-Server-Patches/0296-Catch-JsonParseException-in-Entity-and-TE-names.patch similarity index 69% rename from Spigot-Server-Patches/0301-Catch-JsonParseException-in-Entity-and-TE-names.patch rename to Spigot-Server-Patches/0296-Catch-JsonParseException-in-Entity-and-TE-names.patch index 0547b7b89..26c0bd7f9 100644 --- a/Spigot-Server-Patches/0301-Catch-JsonParseException-in-Entity-and-TE-names.patch +++ b/Spigot-Server-Patches/0296-Catch-JsonParseException-in-Entity-and-TE-names.patch @@ -13,10 +13,10 @@ Shulkers) may need to be changed in order for it to re-save properly No more crashing though. diff --git a/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java b/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java -index 786712297435fed5247abd577efd092bcb9c44cb..ef2a496eda45ae5ee8fe52ef09e77c2906069d2e 100644 +index 850e79b764513bd68a28b675e075f804f59b75a8..7e13b1cf6d92c3e0f2dab1ba1d42bd4f250e256c 100644 --- a/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java +++ b/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java -@@ -59,7 +59,7 @@ public abstract class CommandBlockListenerAbstract implements ICommandListener { +@@ -60,7 +60,7 @@ public abstract class CommandBlockListenerAbstract implements ICommandListener { this.command = nbttagcompound.getString("Command"); this.successCount = nbttagcompound.getInt("SuccessCount"); if (nbttagcompound.hasKeyOfType("CustomName", 8)) { @@ -25,24 +25,11 @@ index 786712297435fed5247abd577efd092bcb9c44cb..ef2a496eda45ae5ee8fe52ef09e77c29 } if (nbttagcompound.hasKeyOfType("TrackOutput", 1)) { -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 0f74ec89b3e85c918c95f9d8fef6d68403ed1107..4609e402b419ed21e17ad34d02dca55b47c1c95e 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -1680,7 +1680,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - this.Z(); - this.setYawPitch(this.yaw, this.pitch); - if (nbttagcompound.hasKeyOfType("CustomName", 8)) { -- this.setCustomName(IChatBaseComponent.ChatSerializer.a(nbttagcompound.getString("CustomName"))); -+ this.setCustomName(MCUtil.getBaseComponentFromNbt("CustomName", nbttagcompound)); // Paper - Catch ParseException - } - - this.setCustomNameVisible(nbttagcompound.getBoolean("CustomNameVisible")); diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java -index 148917547bb7a626d1b2bacce7385607043db7e2..49178cbcebe7e7af9e9a2485ae11058fd1c6b20f 100644 +index 797654c653ec6dc4d46b457cf8a6121b29eca7aa..2eacc5de340ca5558d9a0cba9baa26bbebef714d 100644 --- a/src/main/java/net/minecraft/server/MCUtil.java +++ b/src/main/java/net/minecraft/server/MCUtil.java -@@ -518,4 +518,19 @@ public final class MCUtil { +@@ -506,4 +506,19 @@ public final class MCUtil { return null; } } @@ -63,12 +50,12 @@ index 148917547bb7a626d1b2bacce7385607043db7e2..49178cbcebe7e7af9e9a2485ae11058f + } } diff --git a/src/main/java/net/minecraft/server/TileEntityBanner.java b/src/main/java/net/minecraft/server/TileEntityBanner.java -index 93911a825154d04dd3f1495b1bab5a3ab2aea30b..d35604edb21441032bce87d658b76b39fea917fc 100644 +index 4f886c4145325d8fd8217ae3f681632f0396689f..5397d8a69a0326cf73fe0ee1175d1871cac3769d 100644 --- a/src/main/java/net/minecraft/server/TileEntityBanner.java +++ b/src/main/java/net/minecraft/server/TileEntityBanner.java @@ -60,7 +60,7 @@ public class TileEntityBanner extends TileEntity implements INamableTileEntity { - public void load(NBTTagCompound nbttagcompound) { - super.load(nbttagcompound); + public void load(IBlockData iblockdata, NBTTagCompound nbttagcompound) { + super.load(iblockdata, nbttagcompound); if (nbttagcompound.hasKeyOfType("CustomName", 8)) { - this.a = IChatBaseComponent.ChatSerializer.a(nbttagcompound.getString("CustomName")); + this.a = MCUtil.getBaseComponentFromNbt("CustomName", nbttagcompound); // Paper - Catch ParseException @@ -76,11 +63,11 @@ index 93911a825154d04dd3f1495b1bab5a3ab2aea30b..d35604edb21441032bce87d658b76b39 if (this.hasWorld()) { diff --git a/src/main/java/net/minecraft/server/TileEntityContainer.java b/src/main/java/net/minecraft/server/TileEntityContainer.java -index 473ec2cbde5b31398f57bf9ab7034139572fa666..ab6b86e4e9f99a60140187c06480cf511327a710 100644 +index 8f94b9c52c3842b9c32280499aee1b551dc16095..74390aebd353c969353a6efc0904bafe30774d65 100644 --- a/src/main/java/net/minecraft/server/TileEntityContainer.java +++ b/src/main/java/net/minecraft/server/TileEntityContainer.java @@ -17,7 +17,7 @@ public abstract class TileEntityContainer extends TileEntity implements IInvento - super.load(nbttagcompound); + super.load(iblockdata, nbttagcompound); this.chestLock = ChestLock.b(nbttagcompound); if (nbttagcompound.hasKeyOfType("CustomName", 8)) { - this.customName = IChatBaseComponent.ChatSerializer.a(nbttagcompound.getString("CustomName")); diff --git a/Spigot-Server-Patches/0303-Honor-EntityAgeable.ageLock.patch b/Spigot-Server-Patches/0297-Honor-EntityAgeable.ageLock.patch similarity index 77% rename from Spigot-Server-Patches/0303-Honor-EntityAgeable.ageLock.patch rename to Spigot-Server-Patches/0297-Honor-EntityAgeable.ageLock.patch index 85785a67e..f25452fae 100644 --- a/Spigot-Server-Patches/0303-Honor-EntityAgeable.ageLock.patch +++ b/Spigot-Server-Patches/0297-Honor-EntityAgeable.ageLock.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Honor EntityAgeable.ageLock diff --git a/src/main/java/net/minecraft/server/EntityAgeable.java b/src/main/java/net/minecraft/server/EntityAgeable.java -index cec938436d2fb4ba9cafa57af7b447b2a0df0f9f..3d27f0964a5808af5fd6d1519c91071e50bc239d 100644 +index 8665ac06c6d2eb70127f1a12cb8c44de569a97f9..d861a96b4cb5a5480deb93708207002da782bb51 100644 --- a/src/main/java/net/minecraft/server/EntityAgeable.java +++ b/src/main/java/net/minecraft/server/EntityAgeable.java -@@ -101,6 +101,7 @@ public abstract class EntityAgeable extends EntityCreature { +@@ -73,6 +73,7 @@ public abstract class EntityAgeable extends EntityCreature { } public void setAge(int i, boolean flag) { diff --git a/Spigot-Server-Patches/0304-Configurable-connection-throttle-kick-message.patch b/Spigot-Server-Patches/0298-Configurable-connection-throttle-kick-message.patch similarity index 75% rename from Spigot-Server-Patches/0304-Configurable-connection-throttle-kick-message.patch rename to Spigot-Server-Patches/0298-Configurable-connection-throttle-kick-message.patch index 2537b2ac2..2f52cbd80 100644 --- a/Spigot-Server-Patches/0304-Configurable-connection-throttle-kick-message.patch +++ b/Spigot-Server-Patches/0298-Configurable-connection-throttle-kick-message.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Configurable connection throttle kick message diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 559e6b42ba5bf0ea92cccbabd2ef1d4c27b03064..092bff78ab5288ede0cdeaa94a59190b79aea239 100644 +index 1b21911c3e4fd1d4a3305176bb8477c370256906..d5c97bb6503c9bfafd819dd62397b9decd515df5 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -274,6 +274,11 @@ public class PaperConfig { +@@ -273,6 +273,11 @@ public class PaperConfig { authenticationServersDownKickMessage = Strings.emptyToNull(getString("messages.kick.authentication-servers-down", authenticationServersDownKickMessage)); } @@ -21,15 +21,15 @@ index 559e6b42ba5bf0ea92cccbabd2ef1d4c27b03064..092bff78ab5288ede0cdeaa94a59190b private static void savePlayerData() { savePlayerData = getBoolean("settings.save-player-data", savePlayerData); diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java -index 8928d93e49bec174e86a2b451ac40f3946193009..0532f975b7af5b3f2916c26141221cd3701765d0 100644 +index 12fb251dc96bf179e393046ecc256ea80fdd79de..1672c48c106d95e588b251727cbdb1f6002dc62a 100644 --- a/src/main/java/net/minecraft/server/HandshakeListener.java +++ b/src/main/java/net/minecraft/server/HandshakeListener.java -@@ -38,7 +38,7 @@ public class HandshakeListener implements PacketHandshakingInListener { +@@ -37,7 +37,7 @@ public class HandshakeListener implements PacketHandshakingInListener { synchronized (throttleTracker) { if (throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - throttleTracker.get(address) < connectionThrottle) { throttleTracker.put(address, currentTime); - chatmessage = new ChatMessage("Connection throttled! Please wait before reconnecting."); -+ chatmessage = new ChatMessage(com.destroystokyo.paper.PaperConfig.connectionThrottleKickMessage); // Paper - Configurable connection throttle kick message - this.b.sendPacket(new PacketLoginOutDisconnect(chatmessage)); - this.b.close(chatmessage); ++ chatmessage = new ChatMessage(com.destroystokyo.paper.PaperConfig.connectionThrottleKickMessage); // Paper - Configurable connection throttle kick message + this.c.sendPacket(new PacketLoginOutDisconnect(chatmessage)); + this.c.close(chatmessage); return; diff --git a/Spigot-Server-Patches/0305-Hook-into-CB-plugin-rewrites.patch b/Spigot-Server-Patches/0299-Hook-into-CB-plugin-rewrites.patch similarity index 87% rename from Spigot-Server-Patches/0305-Hook-into-CB-plugin-rewrites.patch rename to Spigot-Server-Patches/0299-Hook-into-CB-plugin-rewrites.patch index 7ce2295ff..fc0c5bd6f 100644 --- a/Spigot-Server-Patches/0305-Hook-into-CB-plugin-rewrites.patch +++ b/Spigot-Server-Patches/0299-Hook-into-CB-plugin-rewrites.patch @@ -7,21 +7,8 @@ Allows us to do fun stuff like rewrite the OBC util fastutil location to our own relocation. Also lets us rewrite NMS calls for when we're debugging in an IDE pre-relocate. -diff --git a/pom.xml b/pom.xml -index fc2921e9783f2db63b71c6e244e24c9416cdbf76..64bd667e8b11263e483364efc3414396819a255c 100644 ---- a/pom.xml -+++ b/pom.xml -@@ -87,7 +87,7 @@ - - org.ow2.asm - asm -- 7.3.1 -+ 8.0.1 - compile - - diff --git a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java -index 9b4a0f0678a7e8e347ef062ad15562484a74452b..4ae41fd2557dcc2a8e31d39ed978b2b26093dd06 100644 +index ac48431777b70c200f9e4113c8a0c03957126e90..6ef2baa62cdc36c2363973f4b9235085cfb8aba6 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/Commodore.java +++ b/src/main/java/org/bukkit/craftbukkit/util/Commodore.java @@ -6,7 +6,9 @@ import java.io.FileOutputStream; @@ -93,12 +80,9 @@ index 9b4a0f0678a7e8e347ef062ad15562484a74452b..4ae41fd2557dcc2a8e31d39ed978b2b2 public static void main(String[] args) { OptionParser parser = new OptionParser(); -@@ -128,17 +171,92 @@ public class Commodore - ClassReader cr = new ClassReader( b ); - ClassWriter cw = new ClassWriter( cr, 0 ); +@@ -130,15 +173,86 @@ public class Commodore -- cr.accept( new ClassVisitor( Opcodes.ASM7, cw ) -+ cr.accept( new ClassVisitor( Opcodes.ASM8, cw) // Paper + cr.accept( new ClassVisitor( Opcodes.ASM8, cw ) { + // Paper start - Rewrite plugins + @Override @@ -160,8 +144,6 @@ index 9b4a0f0678a7e8e347ef062ad15562484a74452b..4ae41fd2557dcc2a8e31d39ed978b2b2 + super.visitFrame( type, nLocal, local, nStack, stack ); + } + -+ -+ + @Override + public void visitLocalVariable(String name, String descriptor, String signature, Label start, Label end, int index) + { @@ -170,8 +152,6 @@ index 9b4a0f0678a7e8e347ef062ad15562484a74452b..4ae41fd2557dcc2a8e31d39ed978b2b2 + super.visitLocalVariable( name, descriptor, signature, start, end, index ); + } + // Paper end -+ -+ @Override public void visitFieldInsn(int opcode, String owner, String name, String desc) @@ -184,10 +164,10 @@ index 9b4a0f0678a7e8e347ef062ad15562484a74452b..4ae41fd2557dcc2a8e31d39ed978b2b2 + } + // Paper end + - if ( modern ) + if ( owner.equals( "org/bukkit/block/Biome" ) ) { - if ( owner.equals( "org/bukkit/Material" ) ) -@@ -237,6 +355,14 @@ public class Commodore + switch ( name ) +@@ -260,6 +374,14 @@ public class Commodore return; } diff --git a/Spigot-Server-Patches/0299-Optimize-Server-World-Map.patch b/Spigot-Server-Patches/0299-Optimize-Server-World-Map.patch deleted file mode 100644 index aa9325a88..000000000 --- a/Spigot-Server-Patches/0299-Optimize-Server-World-Map.patch +++ /dev/null @@ -1,248 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Mon, 17 Sep 2018 23:37:31 -0400 -Subject: [PATCH] Optimize Server World Map - -Minecraft moved worlds to a hashmap in 1.13.1. -This creates inconsistent order for iteration of the map. - -This patch restores World management to be back as an Array. - -.values() will allow us to iterate as it was pre 1.13.1 by -ArrayList, giving consistent ordering and effecient iteration performance. - -KeySet and EntrySet iteration is proxied to the List iterator, -and should retain manipulation behavior but nothing should be doing that. - -Getting a World by dimension ID is now back a constant time operation. - -Hopefully no other plugins try to mess with this map, as we are only handling -known NMS used methods, but we can add more if naughty plugins are found later. - -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldMap.java b/src/main/java/com/destroystokyo/paper/PaperWorldMap.java -new file mode 100644 -index 0000000000000000000000000000000000000000..6bb2f98b4574bff7ac50ed44833726544f2c6011 ---- /dev/null -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldMap.java -@@ -0,0 +1,191 @@ -+package com.destroystokyo.paper; -+ -+import net.minecraft.server.DimensionManager; -+import net.minecraft.server.WorldServer; -+ -+import javax.annotation.Nonnull; -+import java.util.AbstractSet; -+import java.util.ArrayList; -+import java.util.Collection; -+import java.util.HashMap; -+import java.util.Iterator; -+import java.util.List; -+import java.util.Map; -+import java.util.Set; -+ -+public class PaperWorldMap extends HashMap { -+ private final List worlds = new ArrayList<>(); -+ private final List worldsIterable = new ArrayList() { -+ @Override -+ public Iterator iterator() { -+ Iterator iterator = super.iterator(); -+ return new Iterator() { -+ private WorldServer last; -+ -+ @Override -+ public boolean hasNext() { -+ return iterator.hasNext(); -+ } -+ -+ @Override -+ public WorldServer next() { -+ this.last = iterator.next(); -+ return last; -+ } -+ -+ @Override -+ public void remove() { -+ worlds.set(last.worldProvider.getDimensionManager().getDimensionID() + 1, null); -+ } -+ }; -+ } -+ }; -+ @Override -+ public int size() { -+ return worldsIterable.size(); -+ } -+ -+ @Override -+ public boolean isEmpty() { -+ return worldsIterable.isEmpty(); -+ } -+ -+ @Override -+ public WorldServer get(Object key) { -+ // Will hit the below method -+ return key instanceof DimensionManager ? get((DimensionManager) key) : null; -+ } -+ -+ public WorldServer get(DimensionManager key) { -+ int id = key.getDimensionID()+1; -+ return worlds.size() > id ? worlds.get(id) : null; -+ } -+ -+ @Override -+ public boolean containsKey(Object key) { -+ // will hit below method -+ return key instanceof DimensionManager && containsKey((DimensionManager) key); -+ } -+ public boolean containsKey(DimensionManager key) { -+ return get(key) != null; -+ } -+ -+ @Override -+ public WorldServer put(DimensionManager key, WorldServer value) { -+ while (worlds.size() <= key.getDimensionID()+1) { -+ worlds.add(null); -+ } -+ WorldServer old = worlds.set(key.getDimensionID()+1, value); -+ if (old != null) { -+ worldsIterable.remove(old); -+ } -+ worldsIterable.add(value); -+ return old; -+ } -+ -+ @Override -+ public void putAll(Map m) { -+ for (Entry e : m.entrySet()) { -+ put(e.getKey(), e.getValue()); -+ } -+ } -+ -+ @Override -+ public WorldServer remove(Object key) { -+ return key instanceof DimensionManager ? remove((DimensionManager) key) : null; -+ } -+ -+ public WorldServer remove(DimensionManager key) { -+ WorldServer old; -+ if (key.getDimensionID()+1 == worlds.size() - 1) { -+ old = worlds.remove(key.getDimensionID()+1); -+ } else { -+ old = worlds.set(key.getDimensionID() + 1, null); -+ } -+ if (old != null) { -+ worldsIterable.remove(old); -+ } -+ return old; -+ } -+ -+ @Override -+ public void clear() { -+ throw new RuntimeException("What the hell are you doing?"); -+ } -+ -+ @Override -+ public boolean containsValue(Object value) { -+ return value instanceof WorldServer && get(((WorldServer) value).worldProvider.getDimensionManager()) != null; -+ } -+ -+ @Nonnull -+ @Override -+ public Set keySet() { -+ return new AbstractSet() { -+ @Override -+ public Iterator iterator() { -+ Iterator iterator = worldsIterable.iterator(); -+ return new Iterator() { -+ -+ @Override -+ public boolean hasNext() { -+ return iterator.hasNext(); -+ } -+ -+ @Override -+ public DimensionManager next() { -+ return iterator.next().worldProvider.getDimensionManager(); -+ } -+ -+ @Override -+ public void remove() { -+ iterator.remove(); -+ } -+ }; -+ } -+ -+ @Override -+ public int size() { -+ return worlds.size(); -+ } -+ }; -+ } -+ -+ @Override -+ public Collection values() { -+ return worldsIterable; -+ } -+ -+ @Override -+ public Set> entrySet() { -+ return new AbstractSet>() { -+ @Override -+ public Iterator> iterator() { -+ Iterator iterator = worldsIterable.iterator(); -+ return new Iterator>() { -+ -+ @Override -+ public boolean hasNext() { -+ return iterator.hasNext(); -+ } -+ -+ @Override -+ public Entry next() { -+ WorldServer entry = iterator.next(); -+ return new SimpleEntry<>(entry.worldProvider.getDimensionManager(), entry); -+ } -+ -+ @Override -+ public void remove() { -+ iterator.remove(); -+ } -+ }; -+ } -+ -+ @Override -+ public int size() { -+ return worldsIterable.size(); -+ } -+ }; -+ } -+} -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index acc5f01d022e49348de0079a9a89455cffc255ee..66097d8cbc916d459ac0ab3b69fbac91a5b57ed3 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -88,7 +88,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant worldServer = Maps.newLinkedHashMap(); // CraftBukkit - keep order, k+v already use identity methods -+ public final Map worldServer = new com.destroystokyo.paper.PaperWorldMap(); // Paper; - private PlayerList playerList; - private volatile boolean isRunning = true; - private volatile boolean isRestarting = false; // Paper - flag to signify we're attempting to restart -@@ -459,7 +459,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant 200) { + } else if (this.g.bC > 200) { World world = this.g.world; // CraftBukkit start @@ -92,13 +81,13 @@ index 76296119a197a433747ee2481079b36aebdb085c..dd02cb3485021c3afd23c2985a71e93c + world.setTypeAndData(this.e.up(), (IBlockData) Blocks.TURTLE_EGG.getBlockData().set(BlockTurtleEgg.b, layEggEvent.getEggCount()), 3); } // CraftBukkit end - this.g.r(false); -@@ -585,7 +600,7 @@ public class EntityTurtle extends EntityAnimal { + this.g.setHasEgg(false); +@@ -574,7 +585,7 @@ public class EntityTurtle extends EntityAnimal { @Override public boolean a() { -- return this.a.isBaby() ? false : (this.a.eq() ? true : (this.a.getRandom().nextInt(700) != 0 ? false : !this.a.es().a((IPosition) this.a.getPositionVector(), 64.0D))); -+ return this.a.isBaby() ? false : (this.a.eq() ? true : (this.a.getRandom().nextInt(700) != 0 ? false : !this.a.es().a((IPosition) this.a.getPositionVector(), 64.0D))) && new com.destroystokyo.paper.event.entity.TurtleGoHomeEvent((org.bukkit.entity.Turtle) this.a.getBukkitEntity()).callEvent(); // Paper +- return this.a.isBaby() ? false : (this.a.hasEgg() ? true : (this.a.getRandom().nextInt(700) != 0 ? false : !this.a.getHomePos().a((IPosition) this.a.getPositionVector(), 64.0D))); ++ return this.a.isBaby() ? false : (this.a.hasEgg() ? true : (this.a.getRandom().nextInt(700) != 0 ? false : !this.a.getHomePos().a((IPosition) this.a.getPositionVector(), 64.0D))) && new com.destroystokyo.paper.event.entity.TurtleGoHomeEvent((org.bukkit.entity.Turtle) this.a.getBukkitEntity()).callEvent(); // Paper } @Override diff --git a/Spigot-Server-Patches/0303-MC-50319-Check-other-worlds-for-shooter-of-projectil.patch b/Spigot-Server-Patches/0303-MC-50319-Check-other-worlds-for-shooter-of-projectil.patch new file mode 100644 index 000000000..b9d23093d --- /dev/null +++ b/Spigot-Server-Patches/0303-MC-50319-Check-other-worlds-for-shooter-of-projectil.patch @@ -0,0 +1,36 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Wed, 17 Oct 2018 19:17:27 -0400 +Subject: [PATCH] MC-50319: Check other worlds for shooter of projectiles + +Say a player shoots an arrow through a nether portal, the game +would lose the shooter for determining things such as Player Kills, +because the entity is in another world. + +If the projectile fails to find the shooter in the current world, check +other worlds. + +diff --git a/src/main/java/net/minecraft/server/IProjectile.java b/src/main/java/net/minecraft/server/IProjectile.java +index ea5f5845a8d202e62da3ae1bfb1e4dbd7f5e185e..ef7e036943bfbd869bd5d71bcb2ecc6c35c18294 100644 +--- a/src/main/java/net/minecraft/server/IProjectile.java ++++ b/src/main/java/net/minecraft/server/IProjectile.java +@@ -29,7 +29,18 @@ public abstract class IProjectile extends Entity { + + @Nullable + public Entity getShooter() { +- return this.shooter != null && this.world instanceof WorldServer ? ((WorldServer) this.world).getEntity(this.shooter) : (this.c != 0 ? this.world.getEntity(this.c) : null); ++ // Paper start - MC-50319 - shooter might be in another world (arrows through portals) ++ Entity entity = this.shooter != null && this.world instanceof WorldServer ? ((WorldServer) this.world).getEntity(this.shooter) : (this.c != 0 ? this.world.getEntity(this.c) : null); ++ if (entity == null) { ++ for (WorldServer world : world.getMinecraftServer().getWorlds()) { ++ entity = world.getEntity(this.shooter); ++ if (entity != null) { ++ break; ++ } ++ } ++ } ++ return entity; ++ // Paper end + } + + @Override diff --git a/Spigot-Server-Patches/0313-Call-player-spectator-target-events-and-improve-impl.patch b/Spigot-Server-Patches/0304-Call-player-spectator-target-events-and-improve-impl.patch similarity index 94% rename from Spigot-Server-Patches/0313-Call-player-spectator-target-events-and-improve-impl.patch rename to Spigot-Server-Patches/0304-Call-player-spectator-target-events-and-improve-impl.patch index 669cdd256..16f59decc 100644 --- a/Spigot-Server-Patches/0313-Call-player-spectator-target-events-and-improve-impl.patch +++ b/Spigot-Server-Patches/0304-Call-player-spectator-target-events-and-improve-impl.patch @@ -19,10 +19,10 @@ spectate the target entity. Co-authored-by: Spottedleaf diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index f43584f0e31a1c3d0e9b4356b7021cd79226d8b5..3175b0735f3b5f4d7e3e02dc083d32262d463de7 100644 +index 650579eb1bb73416b629229fce897d2941bd3b0d..91de641e52693d2a776ae68810965b6e4643220f 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -1586,15 +1586,59 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -1694,15 +1694,59 @@ public class EntityPlayer extends EntityHuman implements ICrafting { return (Entity) (this.spectatedEntity == null ? this : this.spectatedEntity); } @@ -88,10 +88,10 @@ index f43584f0e31a1c3d0e9b4356b7021cd79226d8b5..3175b0735f3b5f4d7e3e02dc083d3226 @Override diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 94469cf71f6617cd4fd9682781c8a3ef04ff3f9b..d9188f422eb3424f82ed54e9be0d9964f25a5b80 100644 +index 351cb9643b05e83f97a7976979346325e76f44da..d33657d94a4e9c6563fbc7826e18624528c498f5 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1110,6 +1110,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -1133,6 +1133,7 @@ public class PlayerConnection implements PacketListenerPlayIn { } // CraftBukkit start - Delegate to teleport(Location) diff --git a/Spigot-Server-Patches/0314-Add-Velocity-IP-Forwarding-Support.patch b/Spigot-Server-Patches/0305-Add-Velocity-IP-Forwarding-Support.patch similarity index 89% rename from Spigot-Server-Patches/0314-Add-Velocity-IP-Forwarding-Support.patch rename to Spigot-Server-Patches/0305-Add-Velocity-IP-Forwarding-Support.patch index 5c21db060..59515d1ae 100644 --- a/Spigot-Server-Patches/0314-Add-Velocity-IP-Forwarding-Support.patch +++ b/Spigot-Server-Patches/0305-Add-Velocity-IP-Forwarding-Support.patch @@ -14,7 +14,7 @@ forwarding, and is integrated into the Minecraft login process by using the 1.13 login plugin message packet. diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 092bff78ab5288ede0cdeaa94a59190b79aea239..79cf4e598fedf75e5ee943acb7930cb265dd11f6 100644 +index d5c97bb6503c9bfafd819dd62397b9decd515df5..478856f190a8d0177dee39dab4692fc54f9c8ed4 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java @@ -8,6 +8,7 @@ import java.io.IOException; @@ -25,7 +25,7 @@ index 092bff78ab5288ede0cdeaa94a59190b79aea239..79cf4e598fedf75e5ee943acb7930cb2 import java.util.HashMap; import java.util.List; import java.util.Map; -@@ -245,7 +246,7 @@ public class PaperConfig { +@@ -244,7 +245,7 @@ public class PaperConfig { } public static boolean isProxyOnlineMode() { @@ -34,9 +34,9 @@ index 092bff78ab5288ede0cdeaa94a59190b79aea239..79cf4e598fedf75e5ee943acb7930cb2 } public static int packetInSpamThreshold = 300; -@@ -336,4 +337,21 @@ public class PaperConfig { - } +@@ -316,4 +317,21 @@ public class PaperConfig { } + tabSpamLimit = getInt("settings.spam-limiter.tab-spam-limit", tabSpamLimit); } + + public static boolean velocitySupport; @@ -130,10 +130,18 @@ index 0000000000000000000000000000000000000000..fdd8708f974700c7cde6e436c2f189d9 + } +} diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java -index 1c4ac7bf7ac4d864ba6efd46d8c562c238dad2bc..47cf105019b3ea28f413274d234a34cdb41941dd 100644 +index e0f0a1e91a037f93b239e779aa8fd92be8a8c01f..7d65ce89622b00a121ce0353f697b07d9e99d0ce 100644 --- a/src/main/java/net/minecraft/server/LoginListener.java +++ b/src/main/java/net/minecraft/server/LoginListener.java -@@ -42,6 +42,7 @@ public class LoginListener implements PacketLoginInListener { +@@ -25,6 +25,7 @@ import org.bukkit.craftbukkit.util.Waitable; + import org.bukkit.event.player.AsyncPlayerPreLoginEvent; + import org.bukkit.event.player.PlayerPreLoginEvent; + // CraftBukkit end ++import io.netty.buffer.Unpooled; // Paper + + public class LoginListener implements PacketLoginInListener { + +@@ -41,6 +42,7 @@ public class LoginListener implements PacketLoginInListener { private SecretKey loginKey; private EntityPlayer l; public String hostname = ""; // CraftBukkit - add field @@ -141,14 +149,14 @@ index 1c4ac7bf7ac4d864ba6efd46d8c562c238dad2bc..47cf105019b3ea28f413274d234a34cd public LoginListener(MinecraftServer minecraftserver, NetworkManager networkmanager) { this.g = LoginListener.EnumProtocolState.HELLO; -@@ -193,6 +194,14 @@ public class LoginListener implements PacketLoginInListener { +@@ -192,6 +194,14 @@ public class LoginListener implements PacketLoginInListener { this.g = LoginListener.EnumProtocolState.KEY; this.networkManager.sendPacket(new PacketLoginOutEncryptionBegin("", this.server.getKeyPair().getPublic(), this.e)); } else { + // Paper start - Velocity support + if (com.destroystokyo.paper.PaperConfig.velocitySupport) { + this.velocityLoginMessageId = java.util.concurrent.ThreadLocalRandom.current().nextInt(); -+ PacketLoginOutCustomPayload packet = new PacketLoginOutCustomPayload(this.velocityLoginMessageId, com.destroystokyo.paper.proxy.VelocityProxy.PLAYER_INFO_CHANNEL, new PacketDataSerializer(io.netty.buffer.Unpooled.EMPTY_BUFFER)); ++ PacketLoginOutCustomPayload packet = new PacketLoginOutCustomPayload(this.velocityLoginMessageId, com.destroystokyo.paper.proxy.VelocityProxy.PLAYER_INFO_CHANNEL, new PacketDataSerializer(Unpooled.EMPTY_BUFFER)); + this.networkManager.sendPacket(packet); + return; + } @@ -156,7 +164,7 @@ index 1c4ac7bf7ac4d864ba6efd46d8c562c238dad2bc..47cf105019b3ea28f413274d234a34cd // Spigot start // Paper start - Cache authenticator threads authenticatorPool.execute(new Runnable() { -@@ -285,6 +294,12 @@ public class LoginListener implements PacketLoginInListener { +@@ -284,6 +294,12 @@ public class LoginListener implements PacketLoginInListener { public class LoginHandler { public void fireEvents() throws Exception { @@ -169,7 +177,7 @@ index 1c4ac7bf7ac4d864ba6efd46d8c562c238dad2bc..47cf105019b3ea28f413274d234a34cd String playerName = i.getName(); java.net.InetAddress address = ((java.net.InetSocketAddress) networkManager.getSocketAddress()).getAddress(); java.util.UUID uniqueId = i.getId(); -@@ -332,6 +347,35 @@ public class LoginListener implements PacketLoginInListener { +@@ -331,6 +347,35 @@ public class LoginListener implements PacketLoginInListener { // Spigot end public void a(PacketLoginInCustomPayload packetloginincustompayload) { @@ -202,11 +210,11 @@ index 1c4ac7bf7ac4d864ba6efd46d8c562c238dad2bc..47cf105019b3ea28f413274d234a34cd + return; + } + // Paper end - this.disconnect(new ChatMessage("multiplayer.disconnect.unexpected_query_response", new Object[0])); + this.disconnect(new ChatMessage("multiplayer.disconnect.unexpected_query_response")); } diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index 08e314af7cbd6523bbd0bd5a5ad0a0fff2f080be..046196d54df35ceafb8bc477e740e1dc834345d5 100644 +index 8cb29ddc0d5a5951ea35e1a16c023efb9b0be42d..2916119507ec5ecd9266569b0003d0504a79f6c4 100644 --- a/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java @@ -44,7 +44,7 @@ public class NetworkManager extends SimpleChannelInboundHandler> { @@ -219,10 +227,10 @@ index 08e314af7cbd6523bbd0bd5a5ad0a0fff2f080be..046196d54df35ceafb8bc477e740e1dc public java.util.UUID spoofedUUID; public com.mojang.authlib.properties.Property[] spoofedProfile; diff --git a/src/main/java/net/minecraft/server/PacketDataSerializer.java b/src/main/java/net/minecraft/server/PacketDataSerializer.java -index e810da87977b441cc329066e3cb158ef3bc62a66..c9a2d42d4fed56db4a1177b0d52292fe591a2540 100644 +index 7e116d83a62ef42e241ee9e05fdd7ecb30a2ed95..31e7fb56206a522a335f5e78afd09324d1c38864 100644 --- a/src/main/java/net/minecraft/server/PacketDataSerializer.java +++ b/src/main/java/net/minecraft/server/PacketDataSerializer.java -@@ -140,6 +140,7 @@ public class PacketDataSerializer extends ByteBuf { +@@ -164,6 +164,7 @@ public class PacketDataSerializer extends ByteBuf { return this.d(oenum.ordinal()); } @@ -230,7 +238,7 @@ index e810da87977b441cc329066e3cb158ef3bc62a66..c9a2d42d4fed56db4a1177b0d52292fe public int i() { int i = 0; int j = 0; -@@ -180,6 +181,7 @@ public class PacketDataSerializer extends ByteBuf { +@@ -204,6 +205,7 @@ public class PacketDataSerializer extends ByteBuf { return this; } @@ -238,7 +246,7 @@ index e810da87977b441cc329066e3cb158ef3bc62a66..c9a2d42d4fed56db4a1177b0d52292fe public UUID k() { return new UUID(this.readLong(), this.readLong()); } -@@ -298,6 +300,7 @@ public class PacketDataSerializer extends ByteBuf { +@@ -321,6 +323,7 @@ public class PacketDataSerializer extends ByteBuf { } } @@ -281,10 +289,10 @@ index ae74dc9e183e66062455cf2a18ab43ae87976046..7eb230f1b27eddf48f1b12fc78877a36 public void a(PacketDataSerializer packetdataserializer) throws IOException { this.a = packetdataserializer.i(); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 3c43f318c4cff914128e2f7060516ce7ebb6e1c9..7b53ebb6d7cf241c6b89ec04acd0bcc25e1c105a 100644 +index d12dc8e7df24dc94ec4b1845444c9aced92a189b..86f881b76453c974cf648beaf7dbcc52df38abda 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -648,7 +648,7 @@ public final class CraftServer implements Server { +@@ -677,7 +677,7 @@ public final class CraftServer implements Server { @Override public long getConnectionThrottle() { // Spigot Start - Automatically set connection throttle for bungee configurations diff --git a/Spigot-Server-Patches/0315-Add-more-Witch-API.patch b/Spigot-Server-Patches/0306-Add-more-Witch-API.patch similarity index 60% rename from Spigot-Server-Patches/0315-Add-more-Witch-API.patch rename to Spigot-Server-Patches/0306-Add-more-Witch-API.patch index b4e2d91dc..34eb5813c 100644 --- a/Spigot-Server-Patches/0315-Add-more-Witch-API.patch +++ b/Spigot-Server-Patches/0306-Add-more-Witch-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add more Witch API diff --git a/src/main/java/net/minecraft/server/EntityWitch.java b/src/main/java/net/minecraft/server/EntityWitch.java -index be6ecfb08aaba3fc5d96e918b7540fc75c92e89e..7b6b1ad17b600b688d16c4208f4e2ac17b36a257 100644 +index a6142ef24bc5bfa15a0ec84fbd8267ffab4e25bf..e8d8935b8ef2db0d4405ee1ff8e2f0f2e17a91b3 100644 --- a/src/main/java/net/minecraft/server/EntityWitch.java +++ b/src/main/java/net/minecraft/server/EntityWitch.java @@ -1,5 +1,11 @@ @@ -24,28 +24,28 @@ index be6ecfb08aaba3fc5d96e918b7540fc75c92e89e..7b6b1ad17b600b688d16c4208f4e2ac1 public class EntityWitch extends EntityRaider implements IRangedEntity { private static final UUID b = UUID.fromString("5CD17E52-A79A-43D3-A529-90FDE04B181E"); -- private static final AttributeModifier bw = (new AttributeModifier(EntityWitch.b, "Drinking speed penalty", -0.25D, AttributeModifier.Operation.ADDITION)).a(false); -+ private static final AttributeModifier bw = (new AttributeModifier(EntityWitch.b, "Drinking speed penalty", -0.25D, AttributeModifier.Operation.ADDITION)).a(false); private static final AttributeModifier DRINKING_SPEED = bw; // Paper - OBFHELPER - private static final DataWatcherObject bx = DataWatcher.a(EntityWitch.class, DataWatcherRegistry.i); -- private int by; -+ private int by; public int getPotionUseTimeLeft() { return by; } public void setPotionUseTimeLeft(int timeLeft) { by = timeLeft; } // Paper - OBFHELPER - private PathfinderGoalNearestHealableRaider bz; - private PathfinderGoalNearestAttackableTargetWitch bA; +- private static final AttributeModifier bv = new AttributeModifier(EntityWitch.b, "Drinking speed penalty", -0.25D, AttributeModifier.Operation.ADDITION); ++ private static final AttributeModifier bv = new AttributeModifier(EntityWitch.b, "Drinking speed penalty", -0.25D, AttributeModifier.Operation.ADDITION); private static final AttributeModifier DRINKING_SPEED = bv; // Paper - OBFHELPER + private static final DataWatcherObject bw = DataWatcher.a(EntityWitch.class, DataWatcherRegistry.i); +- private int bx; ++ private int bx; public int getPotionUseTimeLeft() { return bx; } public void setPotionUseTimeLeft(int timeLeft) { bx = timeLeft; } // Paper - OBFHELPER + private PathfinderGoalNearestHealableRaider by; + private PathfinderGoalNearestAttackableTargetWitch bz; @@ -56,10 +62,12 @@ public class EntityWitch extends EntityRaider implements IRangedEntity { return SoundEffects.ENTITY_WITCH_DEATH; } -+ public void setDrinkingPotion(boolean drinkingPotion) { t(drinkingPotion); } // Paper - OBFHELPER - public void t(boolean flag) { - this.getDataWatcher().set(EntityWitch.bx, flag); ++ public void setDrinkingPotion(boolean drinkingPotion) { v(drinkingPotion); } // Paper - OBFHELPER + public void v(boolean flag) { + this.getDataWatcher().set(EntityWitch.bw, flag); } -+ public boolean isDrinkingPotion() { return l(); } // Paper - OBFHELPER - public boolean l() { - return (Boolean) this.getDataWatcher().get(EntityWitch.bx); ++ public boolean isDrinkingPotion() { return m(); } // Paper - OBFHELPER + public boolean m() { + return (Boolean) this.getDataWatcher().get(EntityWitch.bw); } -@@ -121,18 +129,20 @@ public class EntityWitch extends EntityRaider implements IRangedEntity { +@@ -118,21 +126,22 @@ public class EntityWitch extends EntityRaider implements IRangedEntity { } if (potionregistry != null) { @@ -53,48 +53,56 @@ index be6ecfb08aaba3fc5d96e918b7540fc75c92e89e..7b6b1ad17b600b688d16c4208f4e2ac1 - ItemStack potion = PotionUtil.a(new ItemStack(Items.POTION), potionregistry); - org.bukkit.inventory.ItemStack bukkitStack = com.destroystokyo.paper.event.entity.WitchReadyPotionEvent.process((org.bukkit.entity.Witch) this.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(potion)); - this.setSlot(EnumItemSlot.MAINHAND, org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(bukkitStack)); -+ // Paper start - move all this down into its own method -+// ItemStack potion = PotionUtil.a(new ItemStack(Items.POTION), potionregistry); -+// org.bukkit.inventory.ItemStack bukkitStack = com.destroystokyo.paper.event.entity.WitchReadyPotionEvent.process((org.bukkit.entity.Witch) this.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(potion)); -+// this.setSlot(EnumItemSlot.MAINHAND, org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(bukkitStack)); -+// // Paper end -+// this.bB = this.getItemInMainHand().k(); -+// this.s(true); -+// this.world.playSound((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_WITCH_DRINK, this.getSoundCategory(), 1.0F, 0.8F + this.random.nextFloat() * 0.4F); -+// AttributeInstance attributeinstance = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED); -+// -+// attributeinstance.removeModifier(EntityWitch.bz); -+// attributeinstance.addModifier(EntityWitch.bz); -+ this.setDrinkingPotion(PotionUtil.addPotionToItemStack(new ItemStack(Items.POTION), potionregistry)); - // Paper end -- this.by = this.getItemInMainHand().k(); -- this.t(true); -- this.world.playSound((EntityHuman) null, this.locX(), this.locY(), this.locZ(), SoundEffects.ENTITY_WITCH_DRINK, this.getSoundCategory(), 1.0F, 0.8F + this.random.nextFloat() * 0.4F); -- AttributeInstance attributeinstance = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED); +- // Paper end +- this.bx = this.getItemInMainHand().k(); +- this.v(true); +- if (!this.isSilent()) { +- this.world.playSound((EntityHuman) null, this.locX(), this.locY(), this.locZ(), SoundEffects.ENTITY_WITCH_DRINK, this.getSoundCategory(), 1.0F, 0.8F + this.random.nextFloat() * 0.4F); +- } - -- attributeinstance.removeModifier(EntityWitch.bw); -- attributeinstance.addModifier(EntityWitch.bw); +- AttributeModifiable attributemodifiable = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED); +- +- attributemodifiable.removeModifier(EntityWitch.bv); +- attributemodifiable.b(EntityWitch.bv); ++ //// Paper start ++ //ItemStack potion = PotionUtil.a(new ItemStack(Items.POTION), potionregistry); ++ //org.bukkit.inventory.ItemStack bukkitStack = com.destroystokyo.paper.event.entity.WitchReadyPotionEvent.process((org.bukkit.entity.Witch) this.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(potion)); ++ //this.setSlot(EnumItemSlot.MAINHAND, org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(bukkitStack)); ++ //// Paper end ++ //this.bx = this.getItemInMainHand().k(); ++ //this.v(true); ++ //if (!this.isSilent()) { ++ // this.world.playSound((EntityHuman) null, this.locX(), this.locY(), this.locZ(), SoundEffects.ENTITY_WITCH_DRINK, this.getSoundCategory(), 1.0F, 0.8F + this.random.nextFloat() * 0.4F); ++ //} ++ // ++ //AttributeModifiable attributemodifiable = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED); ++ // ++ //attributemodifiable.removeModifier(EntityWitch.bv); ++ //attributemodifiable.b(EntityWitch.bv); ++ this.setDrinkingPotion(PotionUtil.addPotionToItemStack(new ItemStack(Items.POTION), potionregistry)); } } -@@ -144,6 +154,18 @@ public class EntityWitch extends EntityRaider implements IRangedEntity { +@@ -144,6 +153,20 @@ public class EntityWitch extends EntityRaider implements IRangedEntity { super.movementTick(); } -+ // Paper start ++ // Paper start - moved to its own method + public void setDrinkingPotion(ItemStack potion) { + setSlot(EnumItemSlot.MAINHAND, CraftItemStack.asNMSCopy(WitchReadyPotionEvent.process((Witch) getBukkitEntity(), CraftItemStack.asCraftMirror(potion)))); + setPotionUseTimeLeft(getItemInMainHand().getItemUseMaxDuration()); + setDrinkingPotion(true); -+ world.sendSoundEffect(null, locX(), locY(), locZ(), SoundEffects.ENTITY_WITCH_DRINK, getSoundCategory(), 1.0F, 0.8F + random.nextFloat() * 0.4F); -+ AttributeInstance attributeinstance = getAttributeInstance(GenericAttributes.MOVEMENT_SPEED); -+ attributeinstance.removeModifier(EntityWitch.DRINKING_SPEED); -+ attributeinstance.addModifier(EntityWitch.DRINKING_SPEED); ++ if (!this.isSilent()) { ++ this.world.playSound((EntityHuman) null, this.locX(), this.locY(), this.locZ(), SoundEffects.ENTITY_WITCH_DRINK, this.getSoundCategory(), 1.0F, 0.8F + this.random.nextFloat() * 0.4F); ++ } ++ AttributeModifiable attributemodifiable = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED); ++ attributemodifiable.removeModifier(EntityWitch.bv); ++ attributemodifiable.b(EntityWitch.bv); + } + // Paper end + @Override - public SoundEffect eq() { + public SoundEffect eM() { return SoundEffects.ENTITY_WITCH_CELEBRATE; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java index bae107e76e4c8df446d4a7be8dda291d820074d7..b43a2bbd5bfd613887a7ae1519f6e729faf9bcc2 100644 diff --git a/Spigot-Server-Patches/0308-Check-Drowned-for-Villager-Aggression-Config.patch b/Spigot-Server-Patches/0307-Check-Drowned-for-Villager-Aggression-Config.patch similarity index 89% rename from Spigot-Server-Patches/0308-Check-Drowned-for-Villager-Aggression-Config.patch rename to Spigot-Server-Patches/0307-Check-Drowned-for-Villager-Aggression-Config.patch index ccfa4c8ed..7a253dc8f 100644 --- a/Spigot-Server-Patches/0308-Check-Drowned-for-Villager-Aggression-Config.patch +++ b/Spigot-Server-Patches/0307-Check-Drowned-for-Villager-Aggression-Config.patch @@ -5,15 +5,15 @@ Subject: [PATCH] Check Drowned for Villager Aggression Config diff --git a/src/main/java/net/minecraft/server/EntityDrowned.java b/src/main/java/net/minecraft/server/EntityDrowned.java -index 70c06ca775a6955459f36b36dbb48ad3cd1bdef0..77885f67ffa907f7b6dced5d0040d9a9a73454f4 100644 +index 1f1f77776d840c6fa1156239a1da9bb97a328fb1..e6425bdf1a85e773f5555db1aebe7e159f7cd37c 100644 --- a/src/main/java/net/minecraft/server/EntityDrowned.java +++ b/src/main/java/net/minecraft/server/EntityDrowned.java @@ -29,7 +29,7 @@ public class EntityDrowned extends EntityZombie implements IRangedEntity { this.goalSelector.a(7, new PathfinderGoalRandomStroll(this, 1.0D)); this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[]{EntityDrowned.class})).a(EntityPigZombie.class)); - this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, 10, true, false, this::i)); + this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, 10, true, false, this::j)); - this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityVillagerAbstract.class, false)); + if ( world.spigotConfig.zombieAggressiveTowardsVillager ) this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityVillagerAbstract.class, false)); // Paper this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityIronGolem.class, true)); - this.targetSelector.a(5, new PathfinderGoalNearestAttackableTarget<>(this, EntityTurtle.class, 10, true, false, EntityTurtle.bw)); + this.targetSelector.a(5, new PathfinderGoalNearestAttackableTarget<>(this, EntityTurtle.class, 10, true, false, EntityTurtle.bv)); } diff --git a/Spigot-Server-Patches/0309-Here-s-Johnny.patch b/Spigot-Server-Patches/0308-Here-s-Johnny.patch similarity index 86% rename from Spigot-Server-Patches/0309-Here-s-Johnny.patch rename to Spigot-Server-Patches/0308-Here-s-Johnny.patch index f608a431f..ce187e9c8 100644 --- a/Spigot-Server-Patches/0309-Here-s-Johnny.patch +++ b/Spigot-Server-Patches/0308-Here-s-Johnny.patch @@ -5,15 +5,15 @@ Subject: [PATCH] Here's Johnny! diff --git a/src/main/java/net/minecraft/server/EntityVindicator.java b/src/main/java/net/minecraft/server/EntityVindicator.java -index 73ecdd22ea1157abe00795d90c3e7b748650dbc8..c974c02e92345fdc43f4acc9b02d40c735b677df 100644 +index 9c152b79164710d3d4175d0acbc9548d61390097..58315906b641ba46ce73b6fefc43ea333bb0a088 100644 --- a/src/main/java/net/minecraft/server/EntityVindicator.java +++ b/src/main/java/net/minecraft/server/EntityVindicator.java @@ -11,7 +11,7 @@ public class EntityVindicator extends EntityIllagerAbstract { private static final Predicate b = (enumdifficulty) -> { return enumdifficulty == EnumDifficulty.NORMAL || enumdifficulty == EnumDifficulty.HARD; }; -- private boolean bw; -+ private boolean bw; public boolean isJohnny() { return bw; } public void setJohnny(boolean johnny) { bw = johnny; } // Paper - OBFHELPER +- private boolean bv; ++ private boolean bv; public boolean isJohnny() { return bv; } public void setJohnny(boolean johnny) { bv = johnny; } // Paper - OBFHELPER public EntityVindicator(EntityTypes entitytypes, World world) { super(entitytypes, world); diff --git a/Spigot-Server-Patches/0317-Add-option-to-prevent-players-from-moving-into-unloa.patch b/Spigot-Server-Patches/0309-Add-option-to-prevent-players-from-moving-into-unloa.patch similarity index 90% rename from Spigot-Server-Patches/0317-Add-option-to-prevent-players-from-moving-into-unloa.patch rename to Spigot-Server-Patches/0309-Add-option-to-prevent-players-from-moving-into-unloa.patch index 74a64133d..f69f424d7 100644 --- a/Spigot-Server-Patches/0317-Add-option-to-prevent-players-from-moving-into-unloa.patch +++ b/Spigot-Server-Patches/0309-Add-option-to-prevent-players-from-moving-into-unloa.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Add option to prevent players from moving into unloaded diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index b8789c8ecc5a6e4117bb7ce0d5487a6e5774b67f..0862a1d629435dea92178fb5473068f23a15adf2 100644 +index 37bd28f18d3f48767d8141bde3395b8443d5650a..a73b88d51608ce94f6e4c9013c8c4de97523fe42 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -427,4 +427,9 @@ public class PaperWorldConfig { +@@ -400,4 +400,9 @@ public class PaperWorldConfig { waterOverLavaFlowSpeed = getInt("water-over-lava-flow-speed", 5); log("Water over lava flow speed: " + waterOverLavaFlowSpeed); } @@ -20,10 +20,10 @@ index b8789c8ecc5a6e4117bb7ce0d5487a6e5774b67f..0862a1d629435dea92178fb5473068f2 + } } diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index d9188f422eb3424f82ed54e9be0d9964f25a5b80..146efc064b6238f902c49402dbd9ebfc5aad4f52 100644 +index d33657d94a4e9c6563fbc7826e18624528c498f5..b1bad421650a8c93cdc38d1f4f83ab1c39e2f624 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -351,6 +351,13 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -350,6 +350,13 @@ public class PlayerConnection implements PacketListenerPlayIn { } speed *= 2f; // TODO: Get the speed of the vehicle instead of the player @@ -37,7 +37,7 @@ index d9188f422eb3424f82ed54e9be0d9964f25a5b80..146efc064b6238f902c49402dbd9ebfc if (d10 - d9 > Math.max(100.0D, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isExemptPlayer()) { // CraftBukkit end PlayerConnection.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", entity.getDisplayName().getString(), this.player.getDisplayName().getString(), d6, d7, d8); -@@ -900,9 +907,9 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -919,9 +926,9 @@ public class PlayerConnection implements PacketListenerPlayIn { double d1 = this.player.locY(); double d2 = this.player.locZ(); double d3 = this.player.locY(); @@ -49,7 +49,7 @@ index d9188f422eb3424f82ed54e9be0d9964f25a5b80..146efc064b6238f902c49402dbd9ebfc float f = packetplayinflying.a(this.player.yaw); float f1 = packetplayinflying.b(this.player.pitch); double d7 = d4 - this.l; -@@ -941,6 +948,12 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -960,6 +967,12 @@ public class PlayerConnection implements PacketListenerPlayIn { } else { speed = player.abilities.walkSpeed * 10f; } diff --git a/Spigot-Server-Patches/0318-Reset-players-airTicks-on-respawn.patch b/Spigot-Server-Patches/0310-Reset-players-airTicks-on-respawn.patch similarity index 71% rename from Spigot-Server-Patches/0318-Reset-players-airTicks-on-respawn.patch rename to Spigot-Server-Patches/0310-Reset-players-airTicks-on-respawn.patch index b81bcd787..e2bcd3917 100644 --- a/Spigot-Server-Patches/0318-Reset-players-airTicks-on-respawn.patch +++ b/Spigot-Server-Patches/0310-Reset-players-airTicks-on-respawn.patch @@ -5,22 +5,22 @@ Subject: [PATCH] Reset players airTicks on respawn diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 4609e402b419ed21e17ad34d02dca55b47c1c95e..ce0eadbae95a9f6b4e5a46a9d0ee1ccf69c6779a 100644 +index a9664f03b8b7d2c12565b8c08891c7021aa5482b..1a677783baa0b9a3dcfcd84caccba61d76fad2fb 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -2332,6 +2332,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -2262,6 +2262,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke } -+ public int getMaxAirTicks() { return bw(); } // Paper - OBFHELPER - public int bw() { ++ public int getMaxAirTicks() { return bD(); } // Paper - OBFHELPER + public int bD() { return 300; } diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 3175b0735f3b5f4d7e3e02dc083d32262d463de7..8c1cd0673e4b070ebbc9ecf7d9d4acf01d33ba3b 100644 +index 91de641e52693d2a776ae68810965b6e4643220f..2a4fc3d633924fbdfa166b3c3a39e0bae8a07310 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -1887,6 +1887,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -2025,6 +2025,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } this.setHealth(this.getMaxHealth()); diff --git a/Spigot-Server-Patches/0319-Don-t-sleep-after-profile-lookups-if-not-needed.patch b/Spigot-Server-Patches/0311-Don-t-sleep-after-profile-lookups-if-not-needed.patch similarity index 87% rename from Spigot-Server-Patches/0319-Don-t-sleep-after-profile-lookups-if-not-needed.patch rename to Spigot-Server-Patches/0311-Don-t-sleep-after-profile-lookups-if-not-needed.patch index dc184c36c..01be147e2 100644 --- a/Spigot-Server-Patches/0319-Don-t-sleep-after-profile-lookups-if-not-needed.patch +++ b/Spigot-Server-Patches/0311-Don-t-sleep-after-profile-lookups-if-not-needed.patch @@ -7,10 +7,10 @@ Mojang was sleeping even if we had no more requests to go after the current one finished, resulting in 100ms lost per profile lookup diff --git a/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.java b/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.java -index 71e48e87b4280f8913d762e8b4fc9bea4c7f7d29..23f1447cfcef89683a9bc98f0f912d76a1f93012 100644 +index a3ab666b5fa89aad7ee167d9aeff2f62019a4a78..8e182fdd69dba6e1c52e2f6a893534d77fb3bfaa 100644 --- a/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.java +++ b/src/main/java/com/mojang/authlib/yggdrasil/YggdrasilGameProfileRepository.java -@@ -42,6 +42,7 @@ public class YggdrasilGameProfileRepository implements GameProfileRepository { +@@ -43,6 +43,7 @@ public class YggdrasilGameProfileRepository implements GameProfileRepository { } final int page = 0; @@ -18,7 +18,7 @@ index 71e48e87b4280f8913d762e8b4fc9bea4c7f7d29..23f1447cfcef89683a9bc98f0f912d76 for (final List request : Iterables.partition(criteria, ENTRIES_PER_PAGE)) { int failCount = 0; -@@ -67,6 +68,12 @@ public class YggdrasilGameProfileRepository implements GameProfileRepository { +@@ -68,6 +69,12 @@ public class YggdrasilGameProfileRepository implements GameProfileRepository { LOGGER.debug("Couldn't find profile {}", name); callback.onProfileLookupFailed(new GameProfile(null, name), new ProfileNotFoundException("Server did not find the requested profile")); } diff --git a/Spigot-Server-Patches/0320-Improve-Server-Thread-Pool-and-Thread-Priorities.patch b/Spigot-Server-Patches/0312-Improve-Server-Thread-Pool-and-Thread-Priorities.patch similarity index 77% rename from Spigot-Server-Patches/0320-Improve-Server-Thread-Pool-and-Thread-Priorities.patch rename to Spigot-Server-Patches/0312-Improve-Server-Thread-Pool-and-Thread-Priorities.patch index 3e29ce957..7e86a5ff2 100644 --- a/Spigot-Server-Patches/0320-Improve-Server-Thread-Pool-and-Thread-Priorities.patch +++ b/Spigot-Server-Patches/0312-Improve-Server-Thread-Pool-and-Thread-Priorities.patch @@ -12,23 +12,23 @@ server threads Allow usage of a single thread executor by not using ForkJoin so single core CPU's. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index bbda856c148588402731c03cd166acd2e1f4eee3..5d54825171d5214d504b3fad03342c0769ff50f9 100644 +index b13d8ec9aa0a51d5432129f1b0ecef3beb5b7276..f4c93a65c28eeca4a07aaf9b00507d5c6649d137 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1361,6 +1361,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant { ++ thread.setDaemon(true); + if (throwable instanceof CompletionException) { + throwable = throwable.getCause(); + } @@ -54,13 +56,13 @@ index 0000000000000000000000000000000000000000..59cfb76d737f923c7e424743ef370c96 + } +} diff --git a/src/main/java/net/minecraft/server/SystemUtils.java b/src/main/java/net/minecraft/server/SystemUtils.java -index 7e224ebeff3bf34270df173a47b08d3290c00670..20d803ad68ea65fd725d6eb3317b998c1692a7b3 100644 +index d72ba7f76c42fd525a5b59a999a0c08e35d0ef78..5579044782f155f587de1e2ea5115bde6053f722 100644 --- a/src/main/java/net/minecraft/server/SystemUtils.java +++ b/src/main/java/net/minecraft/server/SystemUtils.java -@@ -66,14 +66,17 @@ public class SystemUtils { +@@ -76,14 +76,17 @@ public class SystemUtils { } - private static ExecutorService k() { + private static ExecutorService a(String s) { - int i = MathHelper.clamp(Runtime.getRuntime().availableProcessors() - 1, 1, 7); - Object object; + // Paper start - use simpler thread pool that allows 1 thread @@ -79,11 +81,10 @@ index 7e224ebeff3bf34270df173a47b08d3290c00670..20d803ad68ea65fd725d6eb3317b998c protected void onTermination(Throwable throwable) { if (throwable != null) { SystemUtils.LOGGER.warn("{} died", this.getName(), throwable); -@@ -100,7 +103,7 @@ public class SystemUtils { - - SystemUtils.LOGGER.error(String.format("Caught exception in thread %s", thread), throwable); - }, true); -- } +@@ -99,6 +102,7 @@ public class SystemUtils { + return forkjoinworkerthread; + }, SystemUtils::a, true); + } + }*/ // Paper end return (ExecutorService) object; diff --git a/Spigot-Server-Patches/0312-MC-50319-Check-other-worlds-for-shooter-of-projectil.patch b/Spigot-Server-Patches/0312-MC-50319-Check-other-worlds-for-shooter-of-projectil.patch deleted file mode 100644 index 675f3fc9c..000000000 --- a/Spigot-Server-Patches/0312-MC-50319-Check-other-worlds-for-shooter-of-projectil.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Wed, 17 Oct 2018 19:17:27 -0400 -Subject: [PATCH] MC-50319: Check other worlds for shooter of projectiles - -Say a player shoots an arrow through a nether portal, the game -would lose the shooter for determining things such as Player Kills, -because the entity is in another world. - -If the projectile fails to find the shooter in the current world, check -other worlds. - -diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java -index 9eed1dce3e48683b751ebbaac0487a046354622e..6c091b68087d60b0b916871eb0ce06c6a2776bf8 100644 ---- a/src/main/java/net/minecraft/server/EntityProjectile.java -+++ b/src/main/java/net/minecraft/server/EntityProjectile.java -@@ -209,6 +209,16 @@ public abstract class EntityProjectile extends Entity implements IProjectile { - public EntityLiving getShooter() { - if ((this.shooter == null || this.shooter.dead) && this.shooterId != null && this.world instanceof WorldServer) { - Entity entity = ((WorldServer) this.world).getEntity(this.shooterId); -+ // Paper start - MC-50319 - shooter might be in another world (arrows through portals) -+ if (entity == null) { -+ for (WorldServer world : world.getMinecraftServer().getWorlds()) { -+ entity = world.getEntity(this.shooterId); -+ if (entity != null) { -+ break; -+ } -+ } -+ } -+ // Paper end - - if (entity instanceof EntityLiving) { - this.shooter = (EntityLiving) entity; diff --git a/Spigot-Server-Patches/0321-Optimize-World-Time-Updates.patch b/Spigot-Server-Patches/0313-Optimize-World-Time-Updates.patch similarity index 94% rename from Spigot-Server-Patches/0321-Optimize-World-Time-Updates.patch rename to Spigot-Server-Patches/0313-Optimize-World-Time-Updates.patch index d56e20489..30b4a8791 100644 --- a/Spigot-Server-Patches/0321-Optimize-World-Time-Updates.patch +++ b/Spigot-Server-Patches/0313-Optimize-World-Time-Updates.patch @@ -8,10 +8,10 @@ the updates per world, so that we can re-use the same packet object for every player unless they have per-player time enabled. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 66097d8cbc916d459ac0ab3b69fbac91a5b57ed3..207dd30539fa3961ba96aafe1e3cfef5020a885c 100644 +index f4c93a65c28eeca4a07aaf9b00507d5c6649d137..60067369f1d708ba53da9ad74be5a8330062a684 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1169,12 +1169,24 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant { diff --git a/src/main/java/net/minecraft/server/BlockSponge.java b/src/main/java/net/minecraft/server/BlockSponge.java -index 685a30f3f14232dba88e22ec86e2e66f7da86d0b..9edf937a652a5b463ff049c414f3230bb0ecd9ed 100644 +index e3e4837dab995dba3c509d0e192bbfed5a1b8bc1..362750bd85bc65c304f5fece344ecdeddebaf4ee 100644 --- a/src/main/java/net/minecraft/server/BlockSponge.java +++ b/src/main/java/net/minecraft/server/BlockSponge.java @@ -115,8 +115,11 @@ public class BlockSponge extends Block { diff --git a/Spigot-Server-Patches/0325-Don-t-allow-digging-into-unloaded-chunks.patch b/Spigot-Server-Patches/0317-Don-t-allow-digging-into-unloaded-chunks.patch similarity index 64% rename from Spigot-Server-Patches/0325-Don-t-allow-digging-into-unloaded-chunks.patch rename to Spigot-Server-Patches/0317-Don-t-allow-digging-into-unloaded-chunks.patch index 295dbcf52..9529562b8 100644 --- a/Spigot-Server-Patches/0325-Don-t-allow-digging-into-unloaded-chunks.patch +++ b/Spigot-Server-Patches/0317-Don-t-allow-digging-into-unloaded-chunks.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Don't allow digging into unloaded chunks diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 146efc064b6238f902c49402dbd9ebfc5aad4f52..aaa365ef648f2582723c42a06f594adc3c1f5423 100644 +index b1bad421650a8c93cdc38d1f4f83ab1c39e2f624..a628f6b2aa792e53f223d40b2fd6a51826bc5c2a 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1273,6 +1273,11 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -1297,6 +1297,11 @@ public class PlayerConnection implements PacketListenerPlayIn { case START_DESTROY_BLOCK: case ABORT_DESTROY_BLOCK: case STOP_DESTROY_BLOCK: @@ -21,48 +21,48 @@ index 146efc064b6238f902c49402dbd9ebfc5aad4f52..aaa365ef648f2582723c42a06f594adc return; default: diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java -index e2e5c17c24c8f5e9807ca879b1025d13cb195226..ed3f3362b640746649455f8dd2255ac2da03df7c 100644 +index 36cf4c332054a350ae193637f895a45a8b04da9b..a32490f0eb754b065ee34c41465176db78b1625d 100644 --- a/src/main/java/net/minecraft/server/PlayerInteractManager.java +++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java -@@ -69,8 +69,8 @@ public class PlayerInteractManager { +@@ -80,8 +80,8 @@ public class PlayerInteractManager { IBlockData iblockdata; - if (this.i) { -- iblockdata = this.world.getType(this.j); + if (this.j) { +- iblockdata = this.world.getType(this.k); - if (iblockdata.isAir()) { -+ iblockdata = this.world.getTypeIfLoaded(this.j); // Paper ++ iblockdata = this.world.getTypeIfLoaded(this.k); // Paper + if (iblockdata == null || iblockdata.isAir()) { // Paper - this.i = false; + this.j = false; } else { - float f = this.a(iblockdata, this.j, this.k); -@@ -81,7 +81,13 @@ public class PlayerInteractManager { + float f = this.a(iblockdata, this.k, this.l); +@@ -92,7 +92,13 @@ public class PlayerInteractManager { } } - } else if (this.e) { -- iblockdata = this.world.getType(this.g); + } else if (this.f) { +- iblockdata = this.world.getType(this.h); + // Paper start - don't want to do same logic as above, return instead -+ iblockdata = this.world.getTypeIfLoaded(this.g); ++ iblockdata = this.world.getTypeIfLoaded(this.h); + if (iblockdata == null) { -+ this.e = false; ++ this.f = false; + return; + } + // Paper end if (iblockdata.isAir()) { - this.world.a(this.player.getId(), this.g, -1); - this.l = -1; -@@ -253,10 +259,12 @@ public class PlayerInteractManager { + this.world.a(this.player.getId(), this.h, -1); + this.m = -1; +@@ -256,10 +262,12 @@ public class PlayerInteractManager { this.player.playerConnection.sendPacket(new PacketPlayOutBlockBreak(blockposition, this.world.getType(blockposition), packetplayinblockdig_enumplayerdigtype, true, "stopped destroying")); } else if (packetplayinblockdig_enumplayerdigtype == PacketPlayInBlockDig.EnumPlayerDigType.ABORT_DESTROY_BLOCK) { - this.e = false; -- if (!Objects.equals(this.g, blockposition)) { -+ if (!Objects.equals(this.g, blockposition) && !BlockPosition.ZERO.equals(this.g)) { // Paper - PlayerInteractManager.LOGGER.debug("Mismatch in destroy block pos: " + this.g + " " + blockposition); // CraftBukkit - SPIGOT-5457 sent by client when interact event cancelled -- this.world.a(this.player.getId(), this.g, -1); -- this.player.playerConnection.sendPacket(new PacketPlayOutBlockBreak(this.g, this.world.getType(this.g), packetplayinblockdig_enumplayerdigtype, true, "aborted mismatched destroying")); -+ IBlockData type = this.world.getTypeIfLoaded(this.g); // Paper - don't load unloaded chunks for stale records here -+ if (type != null) this.world.a(this.player.getId(), this.g, -1); // Paper -+ if (type != null) this.player.playerConnection.sendPacket(new PacketPlayOutBlockBreak(this.g, type, packetplayinblockdig_enumplayerdigtype, true, "aborted mismatched destroying")); // Paper -+ this.g = BlockPosition.ZERO; // Paper + this.f = false; +- if (!Objects.equals(this.h, blockposition)) { ++ if (!Objects.equals(this.h, blockposition) && !BlockPosition.ZERO.equals(this.h)) { + PlayerInteractManager.LOGGER.debug("Mismatch in destroy block pos: " + this.h + " " + blockposition); // CraftBukkit - SPIGOT-5457 sent by client when interact event cancelled +- this.world.a(this.player.getId(), this.h, -1); +- this.player.playerConnection.sendPacket(new PacketPlayOutBlockBreak(this.h, this.world.getType(this.h), packetplayinblockdig_enumplayerdigtype, true, "aborted mismatched destroying")); ++ IBlockData type = this.world.getTypeIfLoaded(this.h); // Paper - don't load unloaded chunks for stale records here ++ if (type != null) this.world.a(this.player.getId(), this.h, -1); // Paper ++ if (type != null) this.player.playerConnection.sendPacket(new PacketPlayOutBlockBreak(this.h, type, packetplayinblockdig_enumplayerdigtype, true, "aborted mismatched destroying")); // Paper ++ this.h = BlockPosition.ZERO; // Paper } this.world.a(this.player.getId(), blockposition, -1); diff --git a/Spigot-Server-Patches/0328-Book-Size-Limits.patch b/Spigot-Server-Patches/0318-Book-Size-Limits.patch similarity index 90% rename from Spigot-Server-Patches/0328-Book-Size-Limits.patch rename to Spigot-Server-Patches/0318-Book-Size-Limits.patch index 8c09340c9..c40a9f428 100644 --- a/Spigot-Server-Patches/0328-Book-Size-Limits.patch +++ b/Spigot-Server-Patches/0318-Book-Size-Limits.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Book Size Limits Puts some limits on the size of books. diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 79cf4e598fedf75e5ee943acb7930cb265dd11f6..6d069c73d0058f58e908f351a849ec3a753f2d22 100644 +index 478856f190a8d0177dee39dab4692fc54f9c8ed4..01d48da8b2f89ad3a615ad10c044c5f0a08ee4ed 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -354,4 +354,11 @@ public class PaperConfig { +@@ -334,4 +334,11 @@ public class PaperConfig { velocitySecretKey = secret.getBytes(StandardCharsets.UTF_8); } } @@ -22,18 +22,18 @@ index 79cf4e598fedf75e5ee943acb7930cb265dd11f6..6d069c73d0058f58e908f351a849ec3a + } } diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index aaa365ef648f2582723c42a06f594adc3c1f5423..52a6738bdbffb3344717709281ac09da84e7a525 100644 +index a628f6b2aa792e53f223d40b2fd6a51826bc5c2a..148d5037db35437136242af07f6cb5aacee6177f 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -14,6 +14,7 @@ import java.util.Iterator; - import java.util.Optional; +@@ -14,6 +14,7 @@ import java.util.Optional; import java.util.Set; + import java.util.stream.Stream; import javax.annotation.Nullable; +import org.apache.commons.lang3.StringEscapeUtils; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -@@ -795,6 +796,42 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -814,6 +815,42 @@ public class PlayerConnection implements PacketListenerPlayIn { @Override public void a(PacketPlayInBEdit packetplayinbedit) { diff --git a/Spigot-Server-Patches/0329-Make-the-default-permission-message-configurable.patch b/Spigot-Server-Patches/0319-Make-the-default-permission-message-configurable.patch similarity index 85% rename from Spigot-Server-Patches/0329-Make-the-default-permission-message-configurable.patch rename to Spigot-Server-Patches/0319-Make-the-default-permission-message-configurable.patch index 1acf2eb72..cba93be65 100644 --- a/Spigot-Server-Patches/0329-Make-the-default-permission-message-configurable.patch +++ b/Spigot-Server-Patches/0319-Make-the-default-permission-message-configurable.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Make the default permission message configurable diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 6d069c73d0058f58e908f351a849ec3a753f2d22..dbd14399707cdd43f98af40191be8ff3e76edf43 100644 +index 01d48da8b2f89ad3a615ad10c044c5f0a08ee4ed..f9b1b198299166759fe0bd0a36d8d88c626e06a4 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -20,6 +20,7 @@ import java.util.regex.Pattern; +@@ -19,6 +19,7 @@ import java.util.regex.Pattern; import com.google.common.collect.Lists; import net.minecraft.server.MinecraftServer; import org.bukkit.Bukkit; @@ -16,7 +16,7 @@ index 6d069c73d0058f58e908f351a849ec3a753f2d22..dbd14399707cdd43f98af40191be8ff3 import org.bukkit.command.Command; import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.InvalidConfigurationException; -@@ -280,6 +281,11 @@ public class PaperConfig { +@@ -279,6 +280,11 @@ public class PaperConfig { connectionThrottleKickMessage = getString("messages.kick.connection-throttle", connectionThrottleKickMessage); } @@ -29,10 +29,10 @@ index 6d069c73d0058f58e908f351a849ec3a753f2d22..dbd14399707cdd43f98af40191be8ff3 private static void savePlayerData() { savePlayerData = getBoolean("settings.save-player-data", savePlayerData); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 7b53ebb6d7cf241c6b89ec04acd0bcc25e1c105a..811e676e4f9f1f8beb8eb9e20cef3ef03633a856 100644 +index 86f881b76453c974cf648beaf7dbcc52df38abda..5f3ca7ffeefcc5ea825b66f86763e3dc550c01af 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2180,6 +2180,11 @@ public final class CraftServer implements Server { +@@ -2259,6 +2259,11 @@ public final class CraftServer implements Server { return com.destroystokyo.paper.PaperConfig.suggestPlayersWhenNullTabCompletions; } diff --git a/Spigot-Server-Patches/0331-Prevent-rayTrace-from-loading-chunks.patch b/Spigot-Server-Patches/0320-Prevent-rayTrace-from-loading-chunks.patch similarity index 90% rename from Spigot-Server-Patches/0331-Prevent-rayTrace-from-loading-chunks.patch rename to Spigot-Server-Patches/0320-Prevent-rayTrace-from-loading-chunks.patch index 8e75d4a3c..125c3c3bc 100644 --- a/Spigot-Server-Patches/0331-Prevent-rayTrace-from-loading-chunks.patch +++ b/Spigot-Server-Patches/0320-Prevent-rayTrace-from-loading-chunks.patch @@ -7,10 +7,10 @@ ray tracing into an unloaded chunk should be treated as a miss this saves a ton of lag for when AI tries to raytrace near unloaded chunks. diff --git a/src/main/java/net/minecraft/server/IBlockAccess.java b/src/main/java/net/minecraft/server/IBlockAccess.java -index 0dff023529ba9e44a7406ad6388cad35730917ba..29cdc00875aa5004132820f36e781c7bf4573162 100644 +index 077fcb67f6248156aaebe7545e370ade4311b9e4..a59df0e48a9bcbb32c51ec0013f634d474f68e52 100644 --- a/src/main/java/net/minecraft/server/IBlockAccess.java +++ b/src/main/java/net/minecraft/server/IBlockAccess.java -@@ -41,7 +41,15 @@ public interface IBlockAccess { +@@ -46,7 +46,15 @@ public interface IBlockAccess { // CraftBukkit start - moved block handling into separate method for use by Block#rayTrace default MovingObjectPositionBlock rayTraceBlock(RayTrace raytrace1, BlockPosition blockposition) { diff --git a/Spigot-Server-Patches/0332-Handle-Large-Packets-disconnecting-client.patch b/Spigot-Server-Patches/0321-Handle-Large-Packets-disconnecting-client.patch similarity index 83% rename from Spigot-Server-Patches/0332-Handle-Large-Packets-disconnecting-client.patch rename to Spigot-Server-Patches/0321-Handle-Large-Packets-disconnecting-client.patch index f6bdcd6bc..60c1f1ac6 100644 --- a/Spigot-Server-Patches/0332-Handle-Large-Packets-disconnecting-client.patch +++ b/Spigot-Server-Patches/0321-Handle-Large-Packets-disconnecting-client.patch @@ -7,15 +7,23 @@ If a players inventory is too big to send in a single packet, split the inventory set into multiple packets instead. diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index 046196d54df35ceafb8bc477e740e1dc834345d5..d4aad8a5b7dd8ee837fa7f9b70271e0554bb04e1 100644 +index 2916119507ec5ecd9266569b0003d0504a79f6c4..e7b4c7f2d7b0eed4c145f6476f35b637d861551e 100644 --- a/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java -@@ -97,6 +97,15 @@ public class NetworkManager extends SimpleChannelInboundHandler> { +@@ -12,6 +12,7 @@ import io.netty.channel.epoll.EpollEventLoopGroup; + import io.netty.channel.local.LocalChannel; + import io.netty.channel.local.LocalServerChannel; + import io.netty.channel.nio.NioEventLoopGroup; ++import io.netty.handler.codec.EncoderException; // Paper + import io.netty.handler.timeout.TimeoutException; + import io.netty.util.AttributeKey; + import io.netty.util.concurrent.Future; +@@ -97,6 +98,15 @@ public class NetworkManager extends SimpleChannelInboundHandler> { } public void exceptionCaught(ChannelHandlerContext channelhandlercontext, Throwable throwable) { + // Paper start -+ if (throwable instanceof io.netty.handler.codec.EncoderException && throwable.getCause() instanceof PacketEncoder.PacketTooLargeException) { ++ if (throwable instanceof EncoderException && throwable.getCause() instanceof PacketEncoder.PacketTooLargeException) { + if (((PacketEncoder.PacketTooLargeException) throwable.getCause()).getPacket().packetTooLarge(this)) { + return; + } else { @@ -80,10 +88,10 @@ index 63c4dbd327beb7b6ab42eb44650d68accd3b0de6..b0cfef52cbb5e23beae528668e4e98ce + // Paper end } diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -index 1fcbbd698a7e1b9ae3e8b5fa0328b85c43019bea..a0b87f89df77ba8ac6ce3f135d4f3a34ed2b3543 100644 +index 72ff0a1e6428a1776f49c26e1715f5f2428ba242..6e1426127fc5b5ddc205603b8d03b98a046f9741 100644 --- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java +++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -@@ -79,7 +79,7 @@ public class PacketPlayOutMapChunk implements Packet { +@@ -82,7 +82,7 @@ public class PacketPlayOutMapChunk implements Packet { int i = packetdataserializer.i(); @@ -93,7 +101,7 @@ index 1fcbbd698a7e1b9ae3e8b5fa0328b85c43019bea..a0b87f89df77ba8ac6ce3f135d4f3a34 } else { this.f = new byte[i]; diff --git a/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java b/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java -index f7c3655671cb75a7e78796bcddc3cfd9817e2b90..631234324d5c53015b3cef21b20bb3211e335af8 100644 +index ac42c913246f1aa9425fdf6eca48adf29e917c90..901a5df3f7d3f9ee60485ec1044a05e8aff89ccb 100644 --- a/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java +++ b/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java @@ -9,6 +9,15 @@ public class PacketPlayOutWindowItems implements Packet { diff --git a/Spigot-Server-Patches/0327-force-entity-dismount-during-teleportation.patch b/Spigot-Server-Patches/0322-force-entity-dismount-during-teleportation.patch similarity index 79% rename from Spigot-Server-Patches/0327-force-entity-dismount-during-teleportation.patch rename to Spigot-Server-Patches/0322-force-entity-dismount-during-teleportation.patch index e4ad0bb9a..6c862d1fc 100644 --- a/Spigot-Server-Patches/0327-force-entity-dismount-during-teleportation.patch +++ b/Spigot-Server-Patches/0322-force-entity-dismount-during-teleportation.patch @@ -20,16 +20,16 @@ this is going to be the best soultion all around. Improvements/suggestions welcome! diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index ce0eadbae95a9f6b4e5a46a9d0ee1ccf69c6779a..3d44188e68df31d188f25820000e2c39aa5b6ce0 100644 +index 1a677783baa0b9a3dcfcd84caccba61d76fad2fb..5c37d6f2523ead3eee082dc615d9b0c9fbd71443 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -2033,12 +2033,15 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -1948,12 +1948,15 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke } -- public void stopRiding() { +- public void bb() { + // Paper start -+ public void stopRiding() { stopRiding(false); } ++ public void bb() { stopRiding(false); } + public void stopRiding(boolean suppressCancellation) { + // Paper end if (this.vehicle != null) { @@ -41,7 +41,7 @@ index ce0eadbae95a9f6b4e5a46a9d0ee1ccf69c6779a..3d44188e68df31d188f25820000e2c39 } } -@@ -2089,7 +2092,10 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -2008,7 +2011,10 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke return true; // CraftBukkit } @@ -53,37 +53,37 @@ index ce0eadbae95a9f6b4e5a46a9d0ee1ccf69c6779a..3d44188e68df31d188f25820000e2c39 if (entity.getVehicle() == this) { throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)"); } else { -@@ -2099,7 +2105,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -2018,7 +2024,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke if (getBukkitEntity() instanceof Vehicle && entity.getBukkitEntity() instanceof LivingEntity) { VehicleExitEvent event = new VehicleExitEvent( (Vehicle) getBukkitEntity(), - (LivingEntity) entity.getBukkitEntity() + (LivingEntity) entity.getBukkitEntity(), !suppressCancellation // Paper ); - Bukkit.getPluginManager().callEvent(event); - CraftEntity craftn = (CraftEntity) entity.getBukkitEntity().getVehicle(); -@@ -2110,7 +2116,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke + // Suppress during worldgen + if (this.valid) { +@@ -2032,7 +2038,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke } // CraftBukkit end // Spigot start - org.spigotmc.event.entity.EntityDismountEvent event = new org.spigotmc.event.entity.EntityDismountEvent(entity.getBukkitEntity(), this.getBukkitEntity()); + org.spigotmc.event.entity.EntityDismountEvent event = new org.spigotmc.event.entity.EntityDismountEvent(entity.getBukkitEntity(), this.getBukkitEntity(), !suppressCancellation); // Paper - Bukkit.getPluginManager().callEvent(event); - if (event.isCancelled()) { - return false; + // Suppress during worldgen + if (this.valid) { + Bukkit.getPluginManager().callEvent(event); diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index f41975165a6a66479bc8fc1811c1d271bb2a6113..61c9e030a105ee78a7e59fbf36cf7a77f87a0e88 100644 +index afc665bfe9d527ca8d19f3ab9df0900d87f2d3f2..7916421fe1dd8eadfd1c9bd15c4bbbb7331faca6 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -968,9 +968,11 @@ public abstract class EntityHuman extends EntityLiving { +@@ -942,9 +942,11 @@ public abstract class EntityHuman extends EntityLiving { return -0.35D; } - @Override -- public void stopRiding() { -- super.stopRiding(); +- public void bb() { +- super.bb(); + // Paper start -+ @Override public void stopRiding() { stopRiding(false); } ++ @Override public void bb() { stopRiding(false); } + @Override public void stopRiding(boolean suppressCancellation) { + // Paper end + super.stopRiding(suppressCancellation); // Paper - suppress @@ -91,11 +91,11 @@ index f41975165a6a66479bc8fc1811c1d271bb2a6113..61c9e030a105ee78a7e59fbf36cf7a77 } diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 3d5668271954ede03220354985851603669a61d4..c7c248f63f8cfef6d6b095a926028c519ec3ffd4 100644 +index d6a98bb7fc107649c179cded2d37c06a41146a89..84de18a6c207612ec3d3cca61749934b1d421155 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -2738,11 +2738,13 @@ public abstract class EntityLiving extends Entity { - return ((Byte) this.datawatcher.get(EntityLiving.ao) & 4) != 0; +@@ -2892,11 +2892,13 @@ public abstract class EntityLiving extends Entity { + return ((Byte) this.datawatcher.get(EntityLiving.an) & 4) != 0; } - @Override @@ -112,10 +112,10 @@ index 3d5668271954ede03220354985851603669a61d4..c7c248f63f8cfef6d6b095a926028c51 this.a(entity); } diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 8c1cd0673e4b070ebbc9ecf7d9d4acf01d33ba3b..ab5e502a293c514bc0a71bb47b921a6a23a3c95a 100644 +index 2a4fc3d633924fbdfa166b3c3a39e0bae8a07310..fa975d4788281b66e63b4e8b9ad05c8a0f78c40a 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -1023,11 +1023,13 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -1131,11 +1131,13 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } } diff --git a/Spigot-Server-Patches/0330-Add-more-Zombie-API.patch b/Spigot-Server-Patches/0323-Add-more-Zombie-API.patch similarity index 81% rename from Spigot-Server-Patches/0330-Add-more-Zombie-API.patch rename to Spigot-Server-Patches/0323-Add-more-Zombie-API.patch index e0f36ab04..b1b358f71 100644 --- a/Spigot-Server-Patches/0330-Add-more-Zombie-API.patch +++ b/Spigot-Server-Patches/0323-Add-more-Zombie-API.patch @@ -5,31 +5,31 @@ Subject: [PATCH] Add more Zombie API diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index bed15873b675bbd05c0149d655f9fb165bbbc73e..6d53254f8381f3a957673930c7fdf42d4b9d2f36 100644 +index e0ecdb8f87ec82b97a056c8f6d91d6a86f37bd34..5e9a05dfe822c42b83da84a154fe881d57ac1689 100644 --- a/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java -@@ -1260,6 +1260,8 @@ public abstract class EntityInsentient extends EntityLiving { +@@ -1418,6 +1418,8 @@ public abstract class EntityInsentient extends EntityLiving { this.datawatcher.set(EntityInsentient.b, flag ? (byte) (b0 | 2) : (byte) (b0 & -3)); } + public boolean isArmsRaisedZombie() { return (this.datawatcher.get(EntityInsentient.b) & 4) != 0; } // Paper - OBFHELPER -+ public void setArmsRaisedZombie(boolean flag) { this.q(flag); } // Paper - OBFHELPER - public void q(boolean flag) { ++ public void setArmsRaisedZombie(boolean flag) { this.setAggressive(flag); } // Paper - OBFHELPER + public void setAggressive(boolean flag) { byte b0 = (Byte) this.datawatcher.get(EntityInsentient.b); diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java -index 31aba6bfc3c196cc0c664c0e139f0f8eb7c804b4..2d4f8aac8fac1c414d18593c79f767202c757af2 100644 +index bb7f62fa52b758ed83db7def9053b79da3d97dcd..c9f212b586662856f1503bb0ca8d91900f2e9c5f 100644 --- a/src/main/java/net/minecraft/server/EntityZombie.java +++ b/src/main/java/net/minecraft/server/EntityZombie.java @@ -33,6 +33,7 @@ public class EntityZombie extends EntityMonster { - private int bC; + private int bA; public int drownedConversionTime; private int lastTick = MinecraftServer.currentTick; // CraftBukkit - add field + private boolean shouldBurnInDay = true; // Paper public EntityZombie(EntityTypes entitytypes, World world) { super(entitytypes, world); -@@ -80,6 +81,7 @@ public class EntityZombie extends EntityMonster { +@@ -74,6 +75,7 @@ public class EntityZombie extends EntityMonster { this.getDataWatcher().register(EntityZombie.DROWN_CONVERTING, false); } @@ -37,7 +37,7 @@ index 31aba6bfc3c196cc0c664c0e139f0f8eb7c804b4..2d4f8aac8fac1c414d18593c79f76720 public boolean isDrownConverting() { return (Boolean) this.getDataWatcher().get(EntityZombie.DROWN_CONVERTING); } -@@ -212,6 +214,13 @@ public class EntityZombie extends EntityMonster { +@@ -206,6 +208,13 @@ public class EntityZombie extends EntityMonster { this.getDataWatcher().set(EntityZombie.DROWN_CONVERTING, true); } @@ -48,15 +48,15 @@ index 31aba6bfc3c196cc0c664c0e139f0f8eb7c804b4..2d4f8aac8fac1c414d18593c79f76720 + } + // Paper end + - protected void ev() { - this.b(EntityTypes.DROWNED); - this.world.a((EntityHuman) null, 1040, new BlockPosition(this), 0); -@@ -292,10 +301,17 @@ public class EntityZombie extends EntityMonster { - } + protected void eQ() { + this.c(EntityTypes.DROWNED); + if (!this.isSilent()) { +@@ -225,10 +234,17 @@ public class EntityZombie extends EntityMonster { + } -+ public boolean shouldBurnInDay() { return K_(); } // Paper - OBFHELPER - protected boolean K_() { ++ public boolean shouldBurnInDay() { return U_(); } // Paper - OBFHELPER + protected boolean U_() { - return true; + return shouldBurnInDay; } @@ -70,15 +70,15 @@ index 31aba6bfc3c196cc0c664c0e139f0f8eb7c804b4..2d4f8aac8fac1c414d18593c79f76720 @Override public boolean damageEntity(DamageSource damagesource, float f) { if (super.damageEntity(damagesource, f)) { -@@ -413,6 +429,7 @@ public class EntityZombie extends EntityMonster { - nbttagcompound.setBoolean("CanBreakDoors", this.ey()); - nbttagcompound.setInt("InWaterTime", this.isInWater() ? this.bC : -1); +@@ -348,6 +364,7 @@ public class EntityZombie extends EntityMonster { + nbttagcompound.setBoolean("CanBreakDoors", this.eV()); + nbttagcompound.setInt("InWaterTime", this.isInWater() ? this.bA : -1); nbttagcompound.setInt("DrownedConversionTime", this.isDrownConverting() ? this.drownedConversionTime : -1); + nbttagcompound.setBoolean("Paper.ShouldBurnInDay", shouldBurnInDay); // Paper } @Override -@@ -427,7 +444,11 @@ public class EntityZombie extends EntityMonster { +@@ -362,7 +379,11 @@ public class EntityZombie extends EntityMonster { if (nbttagcompound.hasKeyOfType("DrownedConversionTime", 99) && nbttagcompound.getInt("DrownedConversionTime") > -1) { this.startDrownedConversion(nbttagcompound.getInt("DrownedConversionTime")); } diff --git a/Spigot-Server-Patches/0334-Add-PlayerConnectionCloseEvent.patch b/Spigot-Server-Patches/0324-Add-PlayerConnectionCloseEvent.patch similarity index 95% rename from Spigot-Server-Patches/0334-Add-PlayerConnectionCloseEvent.patch rename to Spigot-Server-Patches/0324-Add-PlayerConnectionCloseEvent.patch index 0197eb474..c87e62b8a 100644 --- a/Spigot-Server-Patches/0334-Add-PlayerConnectionCloseEvent.patch +++ b/Spigot-Server-Patches/0324-Add-PlayerConnectionCloseEvent.patch @@ -34,7 +34,7 @@ how PlayerPreLoginEvent interacts with PlayerConnectionCloseEvent is undefined. diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java -index 47cf105019b3ea28f413274d234a34cdb41941dd..f1222fcb2bd52b8781d0f92c94e1472fa7b1e493 100644 +index 7d65ce89622b00a121ce0353f697b07d9e99d0ce..50163f7291474062bde81631c9220e8a9f5bb718 100644 --- a/src/main/java/net/minecraft/server/LoginListener.java +++ b/src/main/java/net/minecraft/server/LoginListener.java @@ -35,9 +35,9 @@ public class LoginListener implements PacketLoginInListener { @@ -50,11 +50,11 @@ index 47cf105019b3ea28f413274d234a34cdb41941dd..f1222fcb2bd52b8781d0f92c94e1472f private SecretKey loginKey; private EntityPlayer l; diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index d4aad8a5b7dd8ee837fa7f9b70271e0554bb04e1..b1dededc15cce686ead74a99bee64c89ac1de22c 100644 +index e7b4c7f2d7b0eed4c145f6476f35b637d861551e..c84ee96cbed69cca311dd546e562a5322a03fd20 100644 --- a/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java @@ -336,6 +336,26 @@ public class NetworkManager extends SimpleChannelInboundHandler> { - this.i().a(new ChatMessage("multiplayer.disconnect.generic", new Object[0])); + this.i().a(new ChatMessage("multiplayer.disconnect.generic")); } this.packetQueue.clear(); // Free up packet queue. + // Paper start - Add PlayerConnectionCloseEvent diff --git a/Spigot-Server-Patches/0335-Prevent-Enderman-from-loading-chunks.patch b/Spigot-Server-Patches/0325-Prevent-Enderman-from-loading-chunks.patch similarity index 86% rename from Spigot-Server-Patches/0335-Prevent-Enderman-from-loading-chunks.patch rename to Spigot-Server-Patches/0325-Prevent-Enderman-from-loading-chunks.patch index 40f98fe85..b94647d3d 100644 --- a/Spigot-Server-Patches/0335-Prevent-Enderman-from-loading-chunks.patch +++ b/Spigot-Server-Patches/0325-Prevent-Enderman-from-loading-chunks.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Prevent Enderman from loading chunks diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java -index d86f76f30be54767d0243df716fe743e24db6726..212636dcb2107816340f40784f9f89a7daf50ad2 100644 +index 8da3b10cd6db379cf5d9d667154dd8911813284b..b61de33513989a9097e2729f0bd733dda687644d 100644 --- a/src/main/java/net/minecraft/server/EntityEnderman.java +++ b/src/main/java/net/minecraft/server/EntityEnderman.java -@@ -344,7 +344,8 @@ public class EntityEnderman extends EntityMonster { +@@ -381,7 +381,8 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { int j = MathHelper.floor(this.enderman.locY() + random.nextDouble() * 3.0D); int k = MathHelper.floor(this.enderman.locZ() - 2.0D + random.nextDouble() * 4.0D); BlockPosition blockposition = new BlockPosition(i, j, k); @@ -18,7 +18,7 @@ index d86f76f30be54767d0243df716fe743e24db6726..212636dcb2107816340f40784f9f89a7 Block block = iblockdata.getBlock(); Vec3D vec3d = new Vec3D((double) MathHelper.floor(this.enderman.locX()) + 0.5D, (double) j + 0.5D, (double) MathHelper.floor(this.enderman.locZ()) + 0.5D); Vec3D vec3d1 = new Vec3D((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D); -@@ -386,7 +387,8 @@ public class EntityEnderman extends EntityMonster { +@@ -423,7 +424,8 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { int j = MathHelper.floor(this.a.locY() + random.nextDouble() * 2.0D); int k = MathHelper.floor(this.a.locZ() - 1.0D + random.nextDouble() * 2.0D); BlockPosition blockposition = new BlockPosition(i, j, k); diff --git a/Spigot-Server-Patches/0336-Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch b/Spigot-Server-Patches/0326-Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch similarity index 88% rename from Spigot-Server-Patches/0336-Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch rename to Spigot-Server-Patches/0326-Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch index ed0ecc1a2..12d9d4d35 100644 --- a/Spigot-Server-Patches/0336-Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch +++ b/Spigot-Server-Patches/0326-Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch @@ -16,10 +16,10 @@ intent to remove) and replace it with two new methods, clearly named and documented as to their purpose. diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index ab5e502a293c514bc0a71bb47b921a6a23a3c95a..98d480165ff3446317b4c9358a936cd7276cf908 100644 +index fa975d4788281b66e63b4e8b9ad05c8a0f78c40a..b9125ca724c60026f0dcff40f570f6a5da8c993b 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -76,6 +76,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -80,6 +80,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public int ping; public boolean viewingCredits; private int containerUpdateDelay; // Paper @@ -28,10 +28,10 @@ index ab5e502a293c514bc0a71bb47b921a6a23a3c95a..98d480165ff3446317b4c9358a936cd7 public boolean queueHealthUpdatePacket = false; public net.minecraft.server.PacketPlayOutUpdateHealth queuedHealthUpdatePacket; diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 085b70508bb116a1082a9fd79a389199a263109b..3cf4f3b88157e3c174146e5ee30052686b57c768 100644 +index 50fbf3e3fb82c25ab5f3b258206f324c8616dae7..2b5dda81b467cf1d813359faaa5c81d4aeb6ee1c 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -94,6 +94,7 @@ public abstract class PlayerList { +@@ -97,6 +97,7 @@ public abstract class PlayerList { } public void a(NetworkManager networkmanager, EntityPlayer entityplayer) { @@ -40,10 +40,10 @@ index 085b70508bb116a1082a9fd79a389199a263109b..3cf4f3b88157e3c174146e5ee3005268 UserCache usercache = this.server.getUserCache(); GameProfile gameprofile1 = usercache.getProfile(gameprofile.getId()); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java -index 0e8a21b80371dd5ce833da3daf12fdcd9aabae9f..32e02af96e8f8db68509022f742a1239c9b7b4c7 100644 +index 00333548b470435aa89fb0f4b29047eb1461e992..5770d4183c1b9ab6119a25930283c0235250ed6e 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java -@@ -260,6 +260,61 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa +@@ -244,6 +244,61 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa return getData() != null; } @@ -106,10 +106,10 @@ index 0e8a21b80371dd5ce833da3daf12fdcd9aabae9f..32e02af96e8f8db68509022f742a1239 public Location getBedSpawnLocation() { NBTTagCompound data = getData(); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 5445554b18c22b85cf9b3427c22d693a24bc596b..2b18f158b14ca3968f4382fc1436e04d155e04a4 100644 +index 1398d911456b6e685bf7292687c5f5a4dcea5b7e..305deccc0343563ba6080ad75d7397c7c8dd7435 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -138,6 +138,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -145,6 +145,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { private org.bukkit.event.player.PlayerResourcePackStatusEvent.Status resourcePackStatus; private String resourcePackHash; private static final boolean DISABLE_CHANNEL_LIMIT = System.getProperty("paper.disableChannelLimit") != null; // Paper - add a flag to disable the channel limit @@ -117,7 +117,7 @@ index 5445554b18c22b85cf9b3427c22d693a24bc596b..2b18f158b14ca3968f4382fc1436e04d // Paper end public CraftPlayer(CraftServer server, EntityPlayer entity) { -@@ -1348,6 +1349,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1406,6 +1407,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player { this.firstPlayed = firstPlayed; } @@ -136,7 +136,7 @@ index 5445554b18c22b85cf9b3427c22d693a24bc596b..2b18f158b14ca3968f4382fc1436e04d public void readExtraData(NBTTagCompound nbttagcompound) { hasPlayedBefore = true; if (nbttagcompound.hasKey("bukkit")) { -@@ -1370,6 +1383,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1428,6 +1441,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } public void setExtraData(NBTTagCompound nbttagcompound) { @@ -145,7 +145,7 @@ index 5445554b18c22b85cf9b3427c22d693a24bc596b..2b18f158b14ca3968f4382fc1436e04d if (!nbttagcompound.hasKey("bukkit")) { nbttagcompound.set("bukkit", new NBTTagCompound()); } -@@ -1384,6 +1399,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -1442,6 +1457,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player { data.setLong("firstPlayed", getFirstPlayed()); data.setLong("lastPlayed", System.currentTimeMillis()); data.setString("lastKnownName", handle.getName()); diff --git a/Spigot-Server-Patches/0337-Fix-PlayerEditBookEvent.patch b/Spigot-Server-Patches/0327-Fix-PlayerEditBookEvent.patch similarity index 91% rename from Spigot-Server-Patches/0337-Fix-PlayerEditBookEvent.patch rename to Spigot-Server-Patches/0327-Fix-PlayerEditBookEvent.patch index 6a0578a9f..cd794ac62 100644 --- a/Spigot-Server-Patches/0337-Fix-PlayerEditBookEvent.patch +++ b/Spigot-Server-Patches/0327-Fix-PlayerEditBookEvent.patch @@ -10,10 +10,10 @@ it impossible to properly cancel the event or modify the book meta cancelled writing diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 52a6738bdbffb3344717709281ac09da84e7a525..81d40e1dbc6c03033612e04a20cd18e0aa304d2e 100644 +index 148d5037db35437136242af07f6cb5aacee6177f..6787046ca28e6942794abfae1a23e75314bd3435 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -871,9 +871,11 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -890,9 +890,11 @@ public class PlayerConnection implements PacketListenerPlayIn { itemstack2.a("pages", (NBTBase) nbttaglist); this.player.a(packetplayinbedit.d(), CraftEventFactory.handleEditBookEvent(player, enumitemslot, itemstack1, itemstack2)); // CraftBukkit } else { diff --git a/Spigot-Server-Patches/0338-Workaround-for-vehicle-tracking-issue-on-disconnect.patch b/Spigot-Server-Patches/0328-Workaround-for-vehicle-tracking-issue-on-disconnect.patch similarity index 80% rename from Spigot-Server-Patches/0338-Workaround-for-vehicle-tracking-issue-on-disconnect.patch rename to Spigot-Server-Patches/0328-Workaround-for-vehicle-tracking-issue-on-disconnect.patch index 855b157d7..3a605f8c2 100644 --- a/Spigot-Server-Patches/0338-Workaround-for-vehicle-tracking-issue-on-disconnect.patch +++ b/Spigot-Server-Patches/0328-Workaround-for-vehicle-tracking-issue-on-disconnect.patch @@ -5,12 +5,12 @@ Subject: [PATCH] Workaround for vehicle tracking issue on disconnect diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 98d480165ff3446317b4c9358a936cd7276cf908..2f09034fd9ee037987de06bbd130b379089ff306 100644 +index b9125ca724c60026f0dcff40f570f6a5da8c993b..4f24399e4a37b1cf14c5c05b82515cc961764fd9 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -1291,6 +1291,13 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - public void n() { - this.cq = true; +@@ -1397,6 +1397,13 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + public void p() { + this.co = true; this.ejectPassengers(); + + // Paper start - Workaround an issue where the vehicle doesn't track the passenger disconnection dismount. diff --git a/Spigot-Server-Patches/0339-Fire-BlockPistonRetractEvent-for-all-empty-pistons.patch b/Spigot-Server-Patches/0329-Fire-BlockPistonRetractEvent-for-all-empty-pistons.patch similarity index 91% rename from Spigot-Server-Patches/0339-Fire-BlockPistonRetractEvent-for-all-empty-pistons.patch rename to Spigot-Server-Patches/0329-Fire-BlockPistonRetractEvent-for-all-empty-pistons.patch index bd4dfeec9..d40aa8bc3 100644 --- a/Spigot-Server-Patches/0339-Fire-BlockPistonRetractEvent-for-all-empty-pistons.patch +++ b/Spigot-Server-Patches/0329-Fire-BlockPistonRetractEvent-for-all-empty-pistons.patch @@ -24,10 +24,10 @@ Instead we opt to remove the check entirely so that the event fires for all piston types. diff --git a/src/main/java/net/minecraft/server/BlockPiston.java b/src/main/java/net/minecraft/server/BlockPiston.java -index 1170a28107bee73c32cedd6a0a3d1d7c65129b10..b29525c40dc8e3ae747b8ddf5a3bd79b7cc0b792 100644 +index d4e2c68d32aa7113cf344a154777f2314ca03cca..c068a4115e3b82f4886d822d2472e8b522946674 100644 --- a/src/main/java/net/minecraft/server/BlockPiston.java +++ b/src/main/java/net/minecraft/server/BlockPiston.java -@@ -122,7 +122,7 @@ public class BlockPiston extends BlockDirectional { +@@ -112,7 +112,7 @@ public class BlockPiston extends BlockDirectional { } // CraftBukkit start @@ -36,7 +36,7 @@ index 1170a28107bee73c32cedd6a0a3d1d7c65129b10..b29525c40dc8e3ae747b8ddf5a3bd79b org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); BlockPistonRetractEvent event = new BlockPistonRetractEvent(block, ImmutableList.of(), CraftBlock.notchToBlockFace(enumdirection)); world.getServer().getPluginManager().callEvent(event); -@@ -130,7 +130,7 @@ public class BlockPiston extends BlockDirectional { +@@ -120,7 +120,7 @@ public class BlockPiston extends BlockDirectional { if (event.isCancelled()) { return; } @@ -44,4 +44,4 @@ index 1170a28107bee73c32cedd6a0a3d1d7c65129b10..b29525c40dc8e3ae747b8ddf5a3bd79b + //} // Paper // PAIL: checkME - what happened to setTypeAndData? // CraftBukkit end - world.playBlockAction(blockposition, this, b0, enumdirection.b()); + world.playBlockAction(blockposition, this, b0, enumdirection.c()); diff --git a/Spigot-Server-Patches/0340-Block-Entity-remove-from-being-called-on-Players.patch b/Spigot-Server-Patches/0330-Block-Entity-remove-from-being-called-on-Players.patch similarity index 89% rename from Spigot-Server-Patches/0340-Block-Entity-remove-from-being-called-on-Players.patch rename to Spigot-Server-Patches/0330-Block-Entity-remove-from-being-called-on-Players.patch index 8c99ab2b4..d812f7765 100644 --- a/Spigot-Server-Patches/0340-Block-Entity-remove-from-being-called-on-Players.patch +++ b/Spigot-Server-Patches/0330-Block-Entity-remove-from-being-called-on-Players.patch @@ -12,10 +12,10 @@ Player we will look at limiting the scope of this change. It appears to be unintentional in the few cases we've seen so far. diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 2b18f158b14ca3968f4382fc1436e04d155e04a4..a614db834dfe8096ec0a7e6bc6e0348bfb300a1d 100644 +index 305deccc0343563ba6080ad75d7397c7c8dd7435..ea083f0987fb85afdf23d894bdd8980cc6707e51 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1949,6 +1949,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2016,6 +2016,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { public void resetCooldown() { getHandle().resetCooldown(); } diff --git a/Spigot-Server-Patches/0341-BlockDestroyEvent.patch b/Spigot-Server-Patches/0331-BlockDestroyEvent.patch similarity index 77% rename from Spigot-Server-Patches/0341-BlockDestroyEvent.patch rename to Spigot-Server-Patches/0331-BlockDestroyEvent.patch index a9bd1c15c..775199189 100644 --- a/Spigot-Server-Patches/0341-BlockDestroyEvent.patch +++ b/Spigot-Server-Patches/0331-BlockDestroyEvent.patch @@ -11,10 +11,10 @@ floating in the air. This can replace many uses of BlockPhysicsEvent diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index e3253bd36b08dc0963a69d8bd417c9f666ea4406..98ea9bb98a1a447e1ab8a54839d263ee1cad58ff 100644 +index cc4421aa61d7d87c164c1f88ad8b5fa0df7176f1..86636d09699bff4c0c90b8b484df03668b8d5584 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -453,8 +453,20 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -535,8 +535,20 @@ public abstract class World implements GeneratorAccess, AutoCloseable { return false; } else { Fluid fluid = this.getFluid(blockposition); @@ -31,8 +31,8 @@ index e3253bd36b08dc0963a69d8bd417c9f666ea4406..98ea9bb98a1a447e1ab8a54839d263ee + } + // Paper end -- this.triggerEffect(2001, blockposition, Block.getCombinedId(iblockdata)); -+ if (playEffect) this.triggerEffect(2001, blockposition, Block.getCombinedId(iblockdata)); // Paper - if (flag) { - TileEntity tileentity = iblockdata.getBlock().isTileEntity() ? this.getTileEntity(blockposition) : null; +- if (!(iblockdata.getBlock() instanceof BlockFireAbstract)) { ++ if (playEffect && !(iblockdata.getBlock() instanceof BlockFireAbstract)) { // Paper + this.triggerEffect(2001, blockposition, Block.getCombinedId(iblockdata)); + } diff --git a/Spigot-Server-Patches/0342-Fix-Custom-Shapeless-Custom-Crafting-Recipes.patch b/Spigot-Server-Patches/0332-Fix-Custom-Shapeless-Custom-Crafting-Recipes.patch similarity index 100% rename from Spigot-Server-Patches/0342-Fix-Custom-Shapeless-Custom-Crafting-Recipes.patch rename to Spigot-Server-Patches/0332-Fix-Custom-Shapeless-Custom-Crafting-Recipes.patch diff --git a/Spigot-Server-Patches/0343-Fix-sign-edit-memory-leak.patch b/Spigot-Server-Patches/0333-Fix-sign-edit-memory-leak.patch similarity index 74% rename from Spigot-Server-Patches/0343-Fix-sign-edit-memory-leak.patch rename to Spigot-Server-Patches/0333-Fix-sign-edit-memory-leak.patch index 4d9b73d06..d0b11be34 100644 --- a/Spigot-Server-Patches/0343-Fix-sign-edit-memory-leak.patch +++ b/Spigot-Server-Patches/0333-Fix-sign-edit-memory-leak.patch @@ -6,31 +6,31 @@ Subject: [PATCH] Fix sign edit memory leak when a player edits a sign, a reference to their Entity is never cleand up. diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 81d40e1dbc6c03033612e04a20cd18e0aa304d2e..75933d494737b71904b1a49646c17f84380ac267 100644 +index 6787046ca28e6942794abfae1a23e75314bd3435..1c843fb1f877855117b5e20bdc0d040da1752295 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -2547,7 +2547,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -2587,7 +2587,7 @@ public class PlayerConnection implements PacketListenerPlayIn { TileEntitySign tileentitysign = (TileEntitySign) tileentity; - if (!tileentitysign.d() || tileentitysign.f() != this.player) { + if (!tileentitysign.d() || tileentitysign.signEditor == null || !tileentitysign.signEditor.equals(this.player.getUniqueID())) { - this.minecraftServer.warning("Player " + this.player.getDisplayName().getString() + " just tried to change non-editable sign"); + PlayerConnection.LOGGER.warn("Player {} just tried to change non-editable sign", this.player.getDisplayName().getString()); this.sendPacket(tileentity.getUpdatePacket()); // CraftBukkit return; diff --git a/src/main/java/net/minecraft/server/TileEntitySign.java b/src/main/java/net/minecraft/server/TileEntitySign.java -index 03f6ddf0003f0ef44ede31cf7a3491580ff0b5de..a934020190da937adaf2a0599259f85d3cbda269 100644 +index 8e77c662f7d970d8ff86f6c5b9bccc598442594d..2746cb4d4950b303f4d6b4822223d26b51ebe5a4 100644 --- a/src/main/java/net/minecraft/server/TileEntitySign.java +++ b/src/main/java/net/minecraft/server/TileEntitySign.java -@@ -10,6 +10,7 @@ public class TileEntitySign extends TileEntity implements ICommandListener { // +@@ -11,6 +11,7 @@ public class TileEntitySign extends TileEntity implements ICommandListener { // private EntityHuman c; - private final String[] g = new String[4]; + private final IChatFormatted[] g; private EnumColor color; + public java.util.UUID signEditor; // Paper public TileEntitySign() { super(TileEntityTypes.SIGN); -@@ -108,7 +109,10 @@ public class TileEntitySign extends TileEntity implements ICommandListener { // +@@ -112,7 +113,10 @@ public class TileEntitySign extends TileEntity implements ICommandListener { // } public void a(EntityHuman entityhuman) { diff --git a/Spigot-Server-Patches/0333-Lazy-init-world-storage-in-CraftOfflinePlayer.patch b/Spigot-Server-Patches/0333-Lazy-init-world-storage-in-CraftOfflinePlayer.patch deleted file mode 100644 index 6b1e4eb6e..000000000 --- a/Spigot-Server-Patches/0333-Lazy-init-world-storage-in-CraftOfflinePlayer.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zach Brown -Date: Tue, 11 Dec 2018 22:25:07 -0500 -Subject: [PATCH] Lazy init world storage in CraftOfflinePlayer - -Allows access to some offline player properties even when there are no -worlds loaded. This is typically a rare occurrence but probably one that -should be covered as best we can. - -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java -index 58e10381c898afc676b64cb02a16fbcedf151041..0e8a21b80371dd5ce833da3daf12fdcd9aabae9f 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java -@@ -29,12 +29,12 @@ import org.bukkit.plugin.Plugin; - public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializable { - private final GameProfile profile; - private final CraftServer server; -- private final WorldNBTStorage storage; -+ private WorldNBTStorage storage; // Paper - lazy init - - protected CraftOfflinePlayer(CraftServer server, GameProfile profile) { - this.server = server; - this.profile = profile; -- this.storage = (WorldNBTStorage) (server.console.getWorldServer(DimensionManager.OVERWORLD).getDataManager()); -+ //this.storage = (WorldNBTStorage) (server.console.getWorldServer(DimensionManager.OVERWORLD).getDataManager()); // Paper - lazy init - - } - -@@ -181,8 +181,23 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa - return hash; - } - -+ // Paper - lazy -+ private WorldNBTStorage getStorageLazy() { -+ if (this.storage == null) { -+ net.minecraft.server.WorldServer worldServer = server.console.getWorldServer(DimensionManager.OVERWORLD); -+ if (worldServer == null) { -+ throw new IllegalStateException("Cannot get world storage when there are no worlds loaded!"); -+ } else { -+ this.storage = (WorldNBTStorage) worldServer.getDataManager(); -+ } -+ } -+ -+ return this.storage; -+ } -+ // Paper end -+ - private NBTTagCompound getData() { -- return storage.getPlayerData(getUniqueId().toString()); -+ return getStorageLazy().getPlayerData(getUniqueId().toString()); - } - - private NBTTagCompound getBukkitData() { -@@ -199,7 +214,7 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa - } - - private File getDataFile() { -- return new File(storage.getPlayerDir(), getUniqueId() + ".dat"); -+ return new File(getStorageLazy().getPlayerDir(), getUniqueId() + ".dat"); - } - - @Override diff --git a/Spigot-Server-Patches/0344-Limit-Client-Sign-length-more.patch b/Spigot-Server-Patches/0334-Limit-Client-Sign-length-more.patch similarity index 94% rename from Spigot-Server-Patches/0344-Limit-Client-Sign-length-more.patch rename to Spigot-Server-Patches/0334-Limit-Client-Sign-length-more.patch index c1fd02891..3643dfba9 100644 --- a/Spigot-Server-Patches/0344-Limit-Client-Sign-length-more.patch +++ b/Spigot-Server-Patches/0334-Limit-Client-Sign-length-more.patch @@ -22,7 +22,7 @@ it only impacts data sent from the client. Set -DPaper.maxSignLength=XX to change limit or -1 to disable diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 75933d494737b71904b1a49646c17f84380ac267..34e5806cff6f0779603800c1b7839e7768f9d4e0 100644 +index 1c843fb1f877855117b5e20bdc0d040da1752295..0aac20a6a1e72f0528532edb9421b89e8461e23e 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -103,6 +103,7 @@ public class PlayerConnection implements PacketListenerPlayIn { @@ -33,7 +33,7 @@ index 75933d494737b71904b1a49646c17f84380ac267..34e5806cff6f0779603800c1b7839e77 private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit public PlayerConnection(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer) { -@@ -2563,6 +2564,15 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -2603,6 +2604,15 @@ public class PlayerConnection implements PacketListenerPlayIn { String[] lines = new String[4]; for (int i = 0; i < astring.length; ++i) { diff --git a/Spigot-Server-Patches/0345-Don-t-check-ConvertSigns-boolean-every-sign-save.patch b/Spigot-Server-Patches/0335-Don-t-check-ConvertSigns-boolean-every-sign-save.patch similarity index 80% rename from Spigot-Server-Patches/0345-Don-t-check-ConvertSigns-boolean-every-sign-save.patch rename to Spigot-Server-Patches/0335-Don-t-check-ConvertSigns-boolean-every-sign-save.patch index 5b34219b5..e334dde49 100644 --- a/Spigot-Server-Patches/0345-Don-t-check-ConvertSigns-boolean-every-sign-save.patch +++ b/Spigot-Server-Patches/0335-Don-t-check-ConvertSigns-boolean-every-sign-save.patch @@ -7,18 +7,18 @@ property lookups arent super cheap. they synchronize, validate and check security managers. diff --git a/src/main/java/net/minecraft/server/TileEntitySign.java b/src/main/java/net/minecraft/server/TileEntitySign.java -index a934020190da937adaf2a0599259f85d3cbda269..0e9a90b70f84b8da530814ac0b9b4b5fef458729 100644 +index 2746cb4d4950b303f4d6b4822223d26b51ebe5a4..c4b0d8720e71c7bf2cac7ed962b8fd33cf0b49b3 100644 --- a/src/main/java/net/minecraft/server/TileEntitySign.java +++ b/src/main/java/net/minecraft/server/TileEntitySign.java -@@ -11,6 +11,7 @@ public class TileEntitySign extends TileEntity implements ICommandListener { // - private final String[] g = new String[4]; +@@ -12,6 +12,7 @@ public class TileEntitySign extends TileEntity implements ICommandListener { // + private final IChatFormatted[] g; private EnumColor color; public java.util.UUID signEditor; // Paper + private static final boolean CONVERT_LEGACY_SIGNS = Boolean.getBoolean("convertLegacySigns"); // Paper public TileEntitySign() { super(TileEntityTypes.SIGN); -@@ -28,7 +29,7 @@ public class TileEntitySign extends TileEntity implements ICommandListener { // +@@ -32,7 +33,7 @@ public class TileEntitySign extends TileEntity implements ICommandListener { // } // CraftBukkit start diff --git a/Spigot-Server-Patches/0346-Optimize-Network-Manager-and-add-advanced-packet-sup.patch b/Spigot-Server-Patches/0336-Optimize-Network-Manager-and-add-advanced-packet-sup.patch similarity index 85% rename from Spigot-Server-Patches/0346-Optimize-Network-Manager-and-add-advanced-packet-sup.patch rename to Spigot-Server-Patches/0336-Optimize-Network-Manager-and-add-advanced-packet-sup.patch index 319488608..32bcf9e78 100644 --- a/Spigot-Server-Patches/0346-Optimize-Network-Manager-and-add-advanced-packet-sup.patch +++ b/Spigot-Server-Patches/0336-Optimize-Network-Manager-and-add-advanced-packet-sup.patch @@ -28,10 +28,10 @@ and then catch exceptions and close if they fire. Part of this commit was authored by: Spottedleaf diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index b1dededc15cce686ead74a99bee64c89ac1de22c..32886109d03f9991446381160d5406056d2bf860 100644 +index c84ee96cbed69cca311dd546e562a5322a03fd20..bd33f85cfe00cda72efb871f1fc11bebfb0ce700 100644 --- a/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java -@@ -64,6 +64,10 @@ public class NetworkManager extends SimpleChannelInboundHandler> { +@@ -65,6 +65,10 @@ public class NetworkManager extends SimpleChannelInboundHandler> { public int protocolVersion; public java.net.InetSocketAddress virtualHost; private static boolean enableExplicitFlush = Boolean.getBoolean("paper.explicit-flush"); @@ -42,7 +42,7 @@ index b1dededc15cce686ead74a99bee64c89ac1de22c..32886109d03f9991446381160d540605 // Paper end public NetworkManager(EnumProtocolDirection enumprotocoldirection) { -@@ -87,6 +91,7 @@ public class NetworkManager extends SimpleChannelInboundHandler> { +@@ -88,6 +92,7 @@ public class NetworkManager extends SimpleChannelInboundHandler> { } public void setProtocol(EnumProtocol enumprotocol) { @@ -51,7 +51,7 @@ index b1dededc15cce686ead74a99bee64c89ac1de22c..32886109d03f9991446381160d540605 this.channel.config().setAutoRead(true); NetworkManager.LOGGER.debug("Enabled auto read"); @@ -158,19 +163,82 @@ public class NetworkManager extends SimpleChannelInboundHandler> { - NetworkManager.LOGGER.debug("Set listener of {} to {}", this, packetlistener); + Validate.notNull(packetlistener, "packetListener", new Object[0]); this.packetListener = packetlistener; } + // Paper start @@ -84,7 +84,7 @@ index b1dededc15cce686ead74a99bee64c89ac1de22c..32886109d03f9991446381160d540605 + } + // Paper start + private static boolean canSendImmediate(NetworkManager networkManager, Packet packet) { -+ return networkManager.isPending || networkManager.protocol != EnumProtocol.PLAY || networkManager.queueImmunity || ++ return networkManager.isPending || networkManager.protocol != EnumProtocol.PLAY || + packet instanceof PacketPlayOutKeepAlive || + packet instanceof PacketPlayOutChat || + packet instanceof PacketPlayOutTabComplete; @@ -298,7 +298,7 @@ index b1dededc15cce686ead74a99bee64c89ac1de22c..32886109d03f9991446381160d540605 if (this.j() != null) { @@ -335,7 +480,7 @@ public class NetworkManager extends SimpleChannelInboundHandler> { } else if (this.i() != null) { - this.i().a(new ChatMessage("multiplayer.disconnect.generic", new Object[0])); + this.i().a(new ChatMessage("multiplayer.disconnect.generic")); } - this.packetQueue.clear(); // Free up packet queue. + clearPacketQueue(); // Paper @@ -306,10 +306,17 @@ index b1dededc15cce686ead74a99bee64c89ac1de22c..32886109d03f9991446381160d540605 final PacketListener packetListener = this.i(); if (packetListener instanceof PlayerConnection) { diff --git a/src/main/java/net/minecraft/server/Packet.java b/src/main/java/net/minecraft/server/Packet.java -index 2d8e6a2f4a0c3c5d74a647d7164b0028781d3bf5..c5edf8c4b01cc7ddac06797133e6fd13ec5b6592 100644 +index 2d8e6a2f4a0c3c5d74a647d7164b0028781d3bf5..545dbe6ddcce1d172f465b4a7ab85654ee5fdbb4 100644 --- a/src/main/java/net/minecraft/server/Packet.java +++ b/src/main/java/net/minecraft/server/Packet.java -@@ -11,6 +11,20 @@ public interface Packet { +@@ -1,5 +1,6 @@ + package net.minecraft.server; + ++import io.netty.channel.ChannelFuture; // Paper + import java.io.IOException; + + public interface Packet { +@@ -11,6 +12,20 @@ public interface Packet { void a(T t0); // Paper start @@ -323,38 +330,26 @@ index 2d8e6a2f4a0c3c5d74a647d7164b0028781d3bf5..c5edf8c4b01cc7ddac06797133e6fd13 + * @param player Null if not at PLAY stage yet + * @param future Can be null if packet was cancelled + */ -+ default void onPacketDispatchFinish(@javax.annotation.Nullable EntityPlayer player, @javax.annotation.Nullable io.netty.channel.ChannelFuture future) {} ++ default void onPacketDispatchFinish(@javax.annotation.Nullable EntityPlayer player, @javax.annotation.Nullable ChannelFuture future) {} + default boolean hasFinishListener() { return false; } + default boolean isReady() { return true; } + default java.util.List getExtraPackets() { return null; } default boolean packetTooLarge(NetworkManager manager) { return false; } -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 707b4523536dd6c3192451982e6e33ea4e263053..dc86dae6ff15d38fcc3af2a5f65119aa2daf08f0 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -143,6 +143,7 @@ public abstract class PlayerList { - - // CraftBukkit - getType() - // Spigot - view distance -+ networkmanager.queueImmunity = true; // Paper - playerconnection.sendPacket(new PacketPlayOutLogin(entityplayer.getId(), entityplayer.playerInteractManager.getGameMode(), WorldData.c(worlddata.getSeed()), worlddata.isHardcore(), worldserver.worldProvider.getDimensionManager().getType(), this.getMaxPlayers(), worlddata.getType(), worldserver.spigotConfig.viewDistance, flag1, !flag)); - entityplayer.getBukkitEntity().sendSupportedChannels(); // CraftBukkit - playerconnection.sendPacket(new PacketPlayOutCustomPayload(PacketPlayOutCustomPayload.a, (new PacketDataSerializer(Unpooled.buffer())).a(this.getServer().getServerModName()))); -@@ -152,6 +153,7 @@ public abstract class PlayerList { - playerconnection.sendPacket(new PacketPlayOutRecipeUpdate(this.server.getCraftingManager().b())); - playerconnection.sendPacket(new PacketPlayOutTags(this.server.getTagRegistry())); - playerconnection.sendPacket(new PacketPlayOutEntityStatus(entityplayer, (byte) (worldserver.getGameRules().getBoolean(GameRules.REDUCED_DEBUG_INFO) ? 22 : 23))); // Paper - fix this rule not being initialized on the client -+ networkmanager.queueImmunity = false; // Paper - this.d(entityplayer); - entityplayer.getStatisticManager().c(); - entityplayer.B().a(entityplayer); diff --git a/src/main/java/net/minecraft/server/ServerConnection.java b/src/main/java/net/minecraft/server/ServerConnection.java -index 37a22ba6f7a2ac54759428d23d5ea9787bb557f7..ceecb78ff879e4d6a3295b05d04deb01b7fb1da6 100644 +index 7abb122943b8a5ce0e888d16d1592a127bb9bb6f..0438126662e7c635d9a4f7b8c54fe7c50403ffe8 100644 --- a/src/main/java/net/minecraft/server/ServerConnection.java +++ b/src/main/java/net/minecraft/server/ServerConnection.java -@@ -41,10 +41,12 @@ public class ServerConnection { +@@ -15,6 +15,7 @@ import io.netty.channel.epoll.EpollServerSocketChannel; + import io.netty.channel.nio.NioEventLoopGroup; + import io.netty.channel.socket.ServerSocketChannel; + import io.netty.channel.socket.nio.NioServerSocketChannel; ++import io.netty.handler.flush.FlushConsolidationHandler; // Paper + import io.netty.handler.timeout.ReadTimeoutHandler; + import java.io.IOException; + import java.net.InetAddress; +@@ -40,10 +41,12 @@ public class ServerConnection { private final List connectedChannels = Collections.synchronizedList(Lists.newArrayList()); // Paper start - prevent blocking on adding a new network manager while the server is ticking private final java.util.Queue pending = new java.util.concurrent.ConcurrentLinkedQueue<>(); @@ -367,11 +362,11 @@ index 37a22ba6f7a2ac54759428d23d5ea9787bb557f7..ceecb78ff879e4d6a3295b05d04deb01 } } // Paper end -@@ -79,6 +81,7 @@ public class ServerConnection { +@@ -78,6 +81,7 @@ public class ServerConnection { ; } -+ if (!disableFlushConsolidation) channel.pipeline().addFirst(new io.netty.handler.flush.FlushConsolidationHandler()); // Paper ++ if (!disableFlushConsolidation) channel.pipeline().addFirst(new FlushConsolidationHandler()); // Paper channel.pipeline().addLast("timeout", new ReadTimeoutHandler(30)).addLast("legacy_query", new LegacyPingHandler(ServerConnection.this)).addLast("splitter", new PacketSplitter()).addLast("decoder", new PacketDecoder(EnumProtocolDirection.SERVERBOUND)).addLast("prepender", new PacketPrepender()).addLast("encoder", new PacketEncoder(EnumProtocolDirection.CLIENTBOUND)); NetworkManager networkmanager = new NetworkManager(EnumProtocolDirection.SERVERBOUND); diff --git a/Spigot-Server-Patches/0347-Handle-Oversized-Tile-Entities-in-chunks.patch b/Spigot-Server-Patches/0337-Handle-Oversized-Tile-Entities-in-chunks.patch similarity index 83% rename from Spigot-Server-Patches/0347-Handle-Oversized-Tile-Entities-in-chunks.patch rename to Spigot-Server-Patches/0337-Handle-Oversized-Tile-Entities-in-chunks.patch index 8303b5647..0adb9b89e 100644 --- a/Spigot-Server-Patches/0347-Handle-Oversized-Tile-Entities-in-chunks.patch +++ b/Spigot-Server-Patches/0337-Handle-Oversized-Tile-Entities-in-chunks.patch @@ -9,10 +9,10 @@ creating too large of a packet to sed. Co authored by Spottedleaf diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -index a0b87f89df77ba8ac6ce3f135d4f3a34ed2b3543..23223f3f45210cf23f44f9012f292db80df781a0 100644 +index 6e1426127fc5b5ddc205603b8d03b98a046f9741..900f16efde29ace3f073b1cbc01df8bafc360a9a 100644 --- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java +++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -@@ -23,6 +23,15 @@ public class PacketPlayOutMapChunk implements Packet { +@@ -24,6 +24,15 @@ public class PacketPlayOutMapChunk implements Packet { public PacketPlayOutMapChunk() {} @@ -25,18 +25,18 @@ index a0b87f89df77ba8ac6ce3f135d4f3a34ed2b3543..23223f3f45210cf23f44f9012f292db8 + return extraPackets; + } + // Paper end - public PacketPlayOutMapChunk(Chunk chunk, int i) { + public PacketPlayOutMapChunk(Chunk chunk, int i, boolean flag) { ChunkCoordIntPair chunkcoordintpair = chunk.getPos(); -@@ -49,6 +58,7 @@ public class PacketPlayOutMapChunk implements Packet { - this.c = this.a(new PacketDataSerializer(this.j()), chunk, i); +@@ -51,6 +60,7 @@ public class PacketPlayOutMapChunk implements Packet { + this.c = this.a(new PacketDataSerializer(this.k()), chunk, i); this.g = Lists.newArrayList(); iterator = chunk.getTileEntities().entrySet().iterator(); + int totalTileEntities = 0; // Paper while (iterator.hasNext()) { entry = (Entry) iterator.next(); -@@ -57,6 +67,15 @@ public class PacketPlayOutMapChunk implements Packet { +@@ -59,6 +69,15 @@ public class PacketPlayOutMapChunk implements Packet { int j = blockposition.getY() >> 4; if (this.f() || (i & 1 << j) != 0) { diff --git a/Spigot-Server-Patches/0348-MC-145260-Fix-Whitelist-On-Off-inconsistency.patch b/Spigot-Server-Patches/0338-MC-145260-Fix-Whitelist-On-Off-inconsistency.patch similarity index 52% rename from Spigot-Server-Patches/0348-MC-145260-Fix-Whitelist-On-Off-inconsistency.patch rename to Spigot-Server-Patches/0338-MC-145260-Fix-Whitelist-On-Off-inconsistency.patch index 813a7040f..8555f4b01 100644 --- a/Spigot-Server-Patches/0348-MC-145260-Fix-Whitelist-On-Off-inconsistency.patch +++ b/Spigot-Server-Patches/0338-MC-145260-Fix-Whitelist-On-Off-inconsistency.patch @@ -10,32 +10,11 @@ everything to the Whitelist object. https://github.com/PaperMC/Paper/issues/1880 -diff --git a/src/main/java/net/minecraft/server/JsonList.java b/src/main/java/net/minecraft/server/JsonList.java -index 8570e38f42e2f489e2899ac2f0c4a7b8dda3bb75..c97be42dd7b4c6ea2cadcc97f47185c7f02e2cce 100644 ---- a/src/main/java/net/minecraft/server/JsonList.java -+++ b/src/main/java/net/minecraft/server/JsonList.java -@@ -64,6 +64,7 @@ public class JsonList> { - return this.e; - } - -+ public void setEnabled(boolean flag) { this.a(flag); } // Paper - OBFHeLPER - public void a(boolean flag) { - this.e = flag; - } diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 53bd078594797f0e879305c14fd0731f6d348e42..88373b1081e69e8f81947682b68c40869b962b15 100644 +index 2b5dda81b467cf1d813359faaa5c81d4aeb6ee1c..2c90e1d04447f0d34fe500a78449435c295c88e3 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -62,7 +62,7 @@ public abstract class PlayerList { - // private final Map p; - // CraftBukkit end - public IPlayerFileData playerFileData; -- private boolean hasWhitelist; -+ //private boolean hasWhitelist; - protected final int maxPlayers; - private int viewDistance; - private EnumGamemode t; -@@ -889,9 +889,9 @@ public abstract class PlayerList { +@@ -930,9 +930,9 @@ public abstract class PlayerList { } public boolean isWhitelisted(GameProfile gameprofile, org.bukkit.event.player.PlayerLoginEvent loginEvent) { boolean isOp = this.operators.d(gameprofile); @@ -47,17 +26,3 @@ index 53bd078594797f0e879305c14fd0731f6d348e42..88373b1081e69e8f81947682b68c4086 event.callEvent(); if (!event.isWhitelisted()) { if (loginEvent != null) { -@@ -1022,11 +1022,11 @@ public abstract class PlayerList { - } - - public boolean getHasWhitelist() { -- return this.hasWhitelist; -+ return this.whitelist.isEnabled(); // Paper - } - - public void setHasWhitelist(boolean flag) { -- this.hasWhitelist = flag; -+ this.whitelist.setEnabled(flag); // Paper - } - - public List b(String s) { diff --git a/Spigot-Server-Patches/0349-Set-Zombie-last-tick-at-start-of-drowning-process.patch b/Spigot-Server-Patches/0339-Set-Zombie-last-tick-at-start-of-drowning-process.patch similarity index 72% rename from Spigot-Server-Patches/0349-Set-Zombie-last-tick-at-start-of-drowning-process.patch rename to Spigot-Server-Patches/0339-Set-Zombie-last-tick-at-start-of-drowning-process.patch index a7e687c11..a954bfffb 100644 --- a/Spigot-Server-Patches/0349-Set-Zombie-last-tick-at-start-of-drowning-process.patch +++ b/Spigot-Server-Patches/0339-Set-Zombie-last-tick-at-start-of-drowning-process.patch @@ -6,14 +6,14 @@ Subject: [PATCH] Set Zombie last tick at start of drowning process Fixes GH-1887 diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java -index d64c03f006af1c829862d02d1fc4fde007dd9a5b..e8b9a21baf74645cc07cd9daf741bf9f65deff08 100644 +index c9f212b586662856f1503bb0ca8d91900f2e9c5f..05d19850538b7d853b270d952739d5d1b151690c 100644 --- a/src/main/java/net/minecraft/server/EntityZombie.java +++ b/src/main/java/net/minecraft/server/EntityZombie.java -@@ -168,6 +168,7 @@ public class EntityZombie extends EntityMonster { - ++this.bC; - if (this.bC >= 600) { +@@ -162,6 +162,7 @@ public class EntityZombie extends EntityMonster { + ++this.bA; + if (this.bA >= 600) { this.startDrownedConversion(300); + this.lastTick = MinecraftServer.currentTick; // Paper - Make sure this is set at start of process - GH-1887 } } else { - this.bC = -1; + this.bA = -1; diff --git a/Spigot-Server-Patches/0350-Allow-Saving-of-Oversized-Chunks.patch b/Spigot-Server-Patches/0340-Allow-Saving-of-Oversized-Chunks.patch similarity index 93% rename from Spigot-Server-Patches/0350-Allow-Saving-of-Oversized-Chunks.patch rename to Spigot-Server-Patches/0340-Allow-Saving-of-Oversized-Chunks.patch index 93dccd951..b0975133d 100644 --- a/Spigot-Server-Patches/0350-Allow-Saving-of-Oversized-Chunks.patch +++ b/Spigot-Server-Patches/0340-Allow-Saving-of-Oversized-Chunks.patch @@ -31,10 +31,10 @@ this fix, as the data will remain in the oversized file. Once the server returns to a jar with this fix, the data will be restored. diff --git a/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java -index db66d4ac7dc1bede8b674cd9ad8f56dd989b6693..2322c0c8c5aacebb6317eab8ce4245554f6d9d55 100644 +index c9be8c7f40917056091f63d36311a10d6302acbb..f48b62af436de47484eb1cf496e97a29168586b0 100644 --- a/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java +++ b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java -@@ -69,6 +69,7 @@ public class NBTCompressedStreamTools { +@@ -70,6 +70,7 @@ public class NBTCompressedStreamTools { } @@ -42,7 +42,7 @@ index db66d4ac7dc1bede8b674cd9ad8f56dd989b6693..2322c0c8c5aacebb6317eab8ce424555 public static NBTTagCompound a(DataInputStream datainputstream) throws IOException { return a((DataInput) datainputstream, NBTReadLimiter.a); } -@@ -89,6 +90,7 @@ public class NBTCompressedStreamTools { +@@ -90,6 +91,7 @@ public class NBTCompressedStreamTools { } } @@ -51,7 +51,7 @@ index db66d4ac7dc1bede8b674cd9ad8f56dd989b6693..2322c0c8c5aacebb6317eab8ce424555 a((NBTBase) nbttagcompound, dataoutput); } diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java -index cee1ea8f43e3135cd72a67c1c8067174feaf956e..6b543f89d4e32fb79bfe9aa7b815e4117dbea602 100644 +index 26b55108ecf4cd48762b00da625b0ce1d2f42c67..f781bb12a1c37d8b3088d0f638eae80d5b80aca4 100644 --- a/src/main/java/net/minecraft/server/RegionFile.java +++ b/src/main/java/net/minecraft/server/RegionFile.java @@ -17,6 +17,8 @@ import java.nio.file.Files; @@ -69,18 +69,18 @@ index cee1ea8f43e3135cd72a67c1c8067174feaf956e..6b543f89d4e32fb79bfe9aa7b815e411 private final RegionFileBitSet freeSectors; + public final File file; - public RegionFile(File file, File file1) throws IOException { - this(file.toPath(), file1.toPath(), RegionFileCompression.b); + public RegionFile(File file, File file1, boolean flag) throws IOException { + this(file.toPath(), file1.toPath(), RegionFileCompression.b, flag); } - public RegionFile(java.nio.file.Path java_nio_file_path, java.nio.file.Path java_nio_file_path1, RegionFileCompression regionfilecompression) throws IOException { + public RegionFile(java.nio.file.Path java_nio_file_path, java.nio.file.Path java_nio_file_path1, RegionFileCompression regionfilecompression, boolean flag) throws IOException { + this.file = java_nio_file_path.toFile(); // Paper this.f = ByteBuffer.allocateDirect(8192); + initOversizedState(); this.freeSectors = new RegionFileBitSet(); this.e = regionfilecompression; if (!Files.isDirectory(java_nio_file_path1, new LinkOption[0])) { -@@ -384,6 +389,74 @@ public class RegionFile implements AutoCloseable { +@@ -389,6 +394,74 @@ public class RegionFile implements AutoCloseable { void run() throws IOException; } @@ -156,10 +156,10 @@ index cee1ea8f43e3135cd72a67c1c8067174feaf956e..6b543f89d4e32fb79bfe9aa7b815e411 private final ChunkCoordIntPair b; diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java -index 5065ece393a47add3c4e888fd7fb3d9ba47acfed..942b7d323936a872d83c536c1901b4b436aa7e7c 100644 +index 0305f3c93e8485552890dd5eca8e79277e2bb886..02bd568af727633a6e834d5328683a9ff67b9dd7 100644 --- a/src/main/java/net/minecraft/server/RegionFileCache.java +++ b/src/main/java/net/minecraft/server/RegionFileCache.java -@@ -42,6 +42,74 @@ public final class RegionFileCache implements AutoCloseable { +@@ -44,6 +44,74 @@ public final class RegionFileCache implements AutoCloseable { } } @@ -234,7 +234,7 @@ index 5065ece393a47add3c4e888fd7fb3d9ba47acfed..942b7d323936a872d83c536c1901b4b4 @Nullable public NBTTagCompound read(ChunkCoordIntPair chunkcoordintpair) throws IOException { // CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing -@@ -51,6 +119,12 @@ public final class RegionFileCache implements AutoCloseable { +@@ -53,6 +121,12 @@ public final class RegionFileCache implements AutoCloseable { } // CraftBukkit end DataInputStream datainputstream = regionfile.a(chunkcoordintpair); @@ -247,7 +247,7 @@ index 5065ece393a47add3c4e888fd7fb3d9ba47acfed..942b7d323936a872d83c536c1901b4b4 Throwable throwable = null; NBTTagCompound nbttagcompound; -@@ -91,6 +165,7 @@ public final class RegionFileCache implements AutoCloseable { +@@ -93,6 +167,7 @@ public final class RegionFileCache implements AutoCloseable { try { NBTCompressedStreamTools.a(nbttagcompound, (DataOutput) dataoutputstream); diff --git a/Spigot-Server-Patches/0351-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch b/Spigot-Server-Patches/0341-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch similarity index 75% rename from Spigot-Server-Patches/0351-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch rename to Spigot-Server-Patches/0341-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch index 3bcf03981..dcb1f88c7 100644 --- a/Spigot-Server-Patches/0351-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch +++ b/Spigot-Server-Patches/0341-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch @@ -5,14 +5,14 @@ Subject: [PATCH] Call WhitelistToggleEvent when whitelist is toggled diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 88373b1081e69e8f81947682b68c40869b962b15..68ec2ef427bee5940c62b61964b5436e6ef425f6 100644 +index 2c90e1d04447f0d34fe500a78449435c295c88e3..61d29dabf6ae8be8f8b5b6da9b801e84adda7dfb 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -1026,6 +1026,7 @@ public abstract class PlayerList { +@@ -1048,6 +1048,7 @@ public abstract class PlayerList { } public void setHasWhitelist(boolean flag) { + new com.destroystokyo.paper.event.server.WhitelistToggleEvent(flag).callEvent(); - this.whitelist.setEnabled(flag); // Paper + this.hasWhitelist = flag; } diff --git a/Spigot-Server-Patches/0352-Add-LivingEntity-getTargetEntity.patch b/Spigot-Server-Patches/0342-Add-LivingEntity-getTargetEntity.patch similarity index 84% rename from Spigot-Server-Patches/0352-Add-LivingEntity-getTargetEntity.patch rename to Spigot-Server-Patches/0342-Add-LivingEntity-getTargetEntity.patch index 9266f6472..a160dd46e 100644 --- a/Spigot-Server-Patches/0352-Add-LivingEntity-getTargetEntity.patch +++ b/Spigot-Server-Patches/0342-Add-LivingEntity-getTargetEntity.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add LivingEntity#getTargetEntity diff --git a/src/main/java/net/minecraft/server/AxisAlignedBB.java b/src/main/java/net/minecraft/server/AxisAlignedBB.java -index 3e90b57b6fd5dcb6cb1325861306e2ff84d0cccb..1a466e92956e1eee5c0a7d30f89177e4b189fcb8 100644 +index 02c09f39848399a86d46bd17569b4f01a7b5ab1f..ed9b2f9adfecdc6d1b9925579ec510657adde11f 100644 --- a/src/main/java/net/minecraft/server/AxisAlignedBB.java +++ b/src/main/java/net/minecraft/server/AxisAlignedBB.java -@@ -108,6 +108,7 @@ public class AxisAlignedBB { +@@ -112,6 +112,7 @@ public class AxisAlignedBB { return this.b(vec3d.x, vec3d.y, vec3d.z); } @@ -16,7 +16,7 @@ index 3e90b57b6fd5dcb6cb1325861306e2ff84d0cccb..1a466e92956e1eee5c0a7d30f89177e4 public AxisAlignedBB b(double d0, double d1, double d2) { double d3 = this.minX; double d4 = this.minY; -@@ -137,6 +138,12 @@ public class AxisAlignedBB { +@@ -141,6 +142,12 @@ public class AxisAlignedBB { return new AxisAlignedBB(d3, d4, d5, d6, d7, d8); } @@ -29,15 +29,15 @@ index 3e90b57b6fd5dcb6cb1325861306e2ff84d0cccb..1a466e92956e1eee5c0a7d30f89177e4 public AxisAlignedBB grow(double d0, double d1, double d2) { double d3 = this.minX - d0; double d4 = this.minY - d1; -@@ -196,6 +203,7 @@ public class AxisAlignedBB { +@@ -200,6 +207,7 @@ public class AxisAlignedBB { return this.minX < d3 && this.maxX > d0 && this.minY < d4 && this.maxY > d1 && this.minZ < d5 && this.maxZ > d2; } -+ public final boolean contains(Vec3D vec3d) { return c(vec3d); } // Paper - OBFHELPER - public boolean c(Vec3D vec3d) { ++ public final boolean contains(Vec3D vec3d) { return d(vec3d); } // Paper - OBFHELPER + public boolean d(Vec3D vec3d) { return this.e(vec3d.x, vec3d.y, vec3d.z); } -@@ -229,6 +237,7 @@ public class AxisAlignedBB { +@@ -233,6 +241,7 @@ public class AxisAlignedBB { return this.g(-d0); } @@ -46,10 +46,10 @@ index 3e90b57b6fd5dcb6cb1325861306e2ff84d0cccb..1a466e92956e1eee5c0a7d30f89177e4 double[] adouble = new double[]{1.0D}; double d0 = vec3d1.x - vec3d.x; diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 3d44188e68df31d188f25820000e2c39aa5b6ce0..9368c4afa7bbb336894d73069b3c0858231d1e81 100644 +index 5c37d6f2523ead3eee082dc615d9b0c9fbd71443..c5abac3eb3f98a948ff7a3423cfcad70abae86ff 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -1476,6 +1476,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -1426,6 +1426,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke return this.c(f - 90.0F, f1); } @@ -57,19 +57,19 @@ index 3d44188e68df31d188f25820000e2c39aa5b6ce0..9368c4afa7bbb336894d73069b3c0858 public final Vec3D j(float f) { if (f == 1.0F) { return new Vec3D(this.locX(), this.getHeadY(), this.locZ()); -@@ -2132,6 +2133,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -2057,6 +2058,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke return this.getPassengers().size() < 1; } -+ public final float getCollisionBorderSize() { return aV(); } // Paper - OBFHELPER - public float aV() { ++ public final float getCollisionBorderSize() { return bc(); } // Paper - OBFHELPER + public float bc() { return 0.0F; } diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 347d4abdecddf0c92f81b2958fbaccc22cf16b26..0a31f2e931bba74ecda40c3792718a530acec3af 100644 +index 84de18a6c207612ec3d3cca61749934b1d421155..eeca12bd7c6e59b872303fda1378a69d03dcf783 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -3311,6 +3311,37 @@ public abstract class EntityLiving extends Entity { +@@ -3495,6 +3495,37 @@ public abstract class EntityLiving extends Entity { return world.rayTrace(raytrace); } @@ -108,7 +108,7 @@ index 347d4abdecddf0c92f81b2958fbaccc22cf16b26..0a31f2e931bba74ecda40c3792718a53 public int getShieldBlockingDelay() { diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java -index c1f462d9d3eefdab767bea28da484bfb1dfda06a..498f381099b2cf9460104688e12afc5f586e057a 100644 +index d7e3580067bcbca09b66f05f02e8736863bd7ef5..28f10ab2e427872c04bc97ebc392cf6d58854cf9 100644 --- a/src/main/java/net/minecraft/server/IEntitySelector.java +++ b/src/main/java/net/minecraft/server/IEntitySelector.java @@ -18,6 +18,7 @@ public final class IEntitySelector { @@ -117,13 +117,13 @@ index c1f462d9d3eefdab767bea28da484bfb1dfda06a..498f381099b2cf9460104688e12afc5f }; + public static Predicate notSpectator() { return f; } // Paper - OBFHELPER public static final Predicate f = (entity) -> { - return !entity.isSpectator(); + return !(entity instanceof EntityHuman) || !entity.isSpectator() && !((EntityHuman) entity).isCreative() && entity.world.getDifficulty() != EnumDifficulty.PEACEFUL; }; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 9e082d4514eb57667cb50a390bef7ab72b94e838..7d101d9630848b68b15acc5efdc16ae51dc1f132 100644 +index 2e7bacff55f57fda8b5644fb9d7934a615e5f550..39b8ab223bc708e5ee3dc967e489fdc76d944416 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -216,6 +216,33 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -219,6 +219,33 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { new com.destroystokyo.paper.block.TargetBlockInfo(org.bukkit.craftbukkit.block.CraftBlock.at(getHandle().world, ((net.minecraft.server.MovingObjectPositionBlock)rayTrace).getBlockPosition()), net.minecraft.server.MCUtil.toBukkitBlockFace(((net.minecraft.server.MovingObjectPositionBlock)rayTrace).getDirection())); } diff --git a/Spigot-Server-Patches/0353-Use-proper-max-length-when-serialising-BungeeCord-te.patch b/Spigot-Server-Patches/0343-Use-proper-max-length-when-serialising-BungeeCord-te.patch similarity index 91% rename from Spigot-Server-Patches/0353-Use-proper-max-length-when-serialising-BungeeCord-te.patch rename to Spigot-Server-Patches/0343-Use-proper-max-length-when-serialising-BungeeCord-te.patch index feae128d0..2918d2ee6 100644 --- a/Spigot-Server-Patches/0353-Use-proper-max-length-when-serialising-BungeeCord-te.patch +++ b/Spigot-Server-Patches/0343-Use-proper-max-length-when-serialising-BungeeCord-te.patch @@ -6,11 +6,11 @@ Subject: [PATCH] Use proper max length when serialising BungeeCord text diff --git a/src/main/java/net/minecraft/server/PacketPlayOutChat.java b/src/main/java/net/minecraft/server/PacketPlayOutChat.java -index 0ab611564edc3cd9322e0dbe21832510e9c35bbf..f7b2095bb75ac4533133cf6ad547ccf53492f215 100644 +index 6ae26f8c3637e0c9e56ed3e14aaac0e3f781cb43..b9b2ddc1acadb96a0c750aeba0c0f6928f74e2fe 100644 --- a/src/main/java/net/minecraft/server/PacketPlayOutChat.java +++ b/src/main/java/net/minecraft/server/PacketPlayOutChat.java -@@ -3,7 +3,7 @@ package net.minecraft.server; - import java.io.IOException; +@@ -4,7 +4,7 @@ import java.io.IOException; + import java.util.UUID; public class PacketPlayOutChat implements Packet { - diff --git a/Spigot-Server-Patches/0354-Entity-getEntitySpawnReason.patch b/Spigot-Server-Patches/0344-Entity-getEntitySpawnReason.patch similarity index 86% rename from Spigot-Server-Patches/0354-Entity-getEntitySpawnReason.patch rename to Spigot-Server-Patches/0344-Entity-getEntitySpawnReason.patch index b942d30a2..54596e523 100644 --- a/Spigot-Server-Patches/0354-Entity-getEntitySpawnReason.patch +++ b/Spigot-Server-Patches/0344-Entity-getEntitySpawnReason.patch @@ -10,7 +10,7 @@ persistenting Living Entity, SPAWNER for spawners, or DEFAULT since data was not stored. diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 9368c4afa7bbb336894d73069b3c0858231d1e81..ae0f5e5a71502c432a4dcaa42a3fc9eeffe28e72 100644 +index c5abac3eb3f98a948ff7a3423cfcad70abae86ff..4502ea222d98872a4c33714a8c3149c6d42dee46 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -72,6 +72,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -21,7 +21,7 @@ index 9368c4afa7bbb336894d73069b3c0858231d1e81..ae0f5e5a71502c432a4dcaa42a3fc9ee // Paper end public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper -@@ -1629,6 +1630,9 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -1589,6 +1590,9 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke if (this.origin != null) { nbttagcompound.set("Paper.Origin", this.createList(origin.getX(), origin.getY(), origin.getZ())); } @@ -31,7 +31,7 @@ index 9368c4afa7bbb336894d73069b3c0858231d1e81..ae0f5e5a71502c432a4dcaa42a3fc9ee // Save entity's from mob spawner status if (spawnedViaMobSpawner) { nbttagcompound.setBoolean("Paper.FromMobSpawner", true); -@@ -1755,6 +1759,26 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -1717,6 +1721,26 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke } spawnedViaMobSpawner = nbttagcompound.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status @@ -59,12 +59,12 @@ index 9368c4afa7bbb336894d73069b3c0858231d1e81..ae0f5e5a71502c432a4dcaa42a3fc9ee } catch (Throwable throwable) { diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 68ec2ef427bee5940c62b61964b5436e6ef425f6..79ab45540081c8e2f5dd1d84c6ae602f3664920f 100644 +index 61d29dabf6ae8be8f8b5b6da9b801e84adda7dfb..6a00d1dcd62034c595723547afb4637e9d7c18a0 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -240,7 +240,7 @@ public abstract class PlayerList { +@@ -262,7 +262,7 @@ public abstract class PlayerList { // CraftBukkit start - WorldServer finalWorldServer = worldserver; + WorldServer finalWorldServer = worldserver1; Entity entity = EntityTypes.a(nbttagcompound1.getCompound("Entity"), finalWorldServer, (entity1) -> { - return !finalWorldServer.addEntitySerialized(entity1) ? null : entity1; + return !finalWorldServer.addEntitySerialized(entity1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.MOUNT) ? null : entity1; // Paper @@ -72,10 +72,10 @@ index 68ec2ef427bee5940c62b61964b5436e6ef425f6..79ab45540081c8e2f5dd1d84c6ae602f }); diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 271a1ef3d0aae7c1d0b373963504e70f2843cd24..0decbee892c532c0188b373728d8458c8cbbc0d9 100644 +index a343cba51850bb7214c241a92db0694d3c1aaf60..a76178da7c923b2dc47bf97f848f7455fe275891 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1000,6 +1000,7 @@ public class WorldServer extends World { +@@ -922,6 +922,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { // CraftBukkit start private boolean addEntity0(Entity entity, CreatureSpawnEvent.SpawnReason spawnReason) { org.spigotmc.AsyncCatcher.catchOp("entity add"); // Spigot @@ -84,10 +84,10 @@ index 271a1ef3d0aae7c1d0b373963504e70f2843cd24..0decbee892c532c0188b373728d8458c if (entity.valid) { MinecraftServer.LOGGER.error("Attempted Double World add on " + entity, new Throwable()); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 5f16dea1a543607e76f7ef70fe44e9a3f12e9132..d16d3fe58e6a45e3023946174d2e137a0670e455 100644 +index 51f027e8f98240fec989ea877095031bab087bda..821417610fdb23791bd83e263977026b9d09e31a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -1052,5 +1052,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { +@@ -1060,5 +1060,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { public boolean fromMobSpawner() { return getHandle().spawnedViaMobSpawner; } diff --git a/Spigot-Server-Patches/0355-Update-entity-Metadata-for-all-tracked-players.patch b/Spigot-Server-Patches/0345-Update-entity-Metadata-for-all-tracked-players.patch similarity index 86% rename from Spigot-Server-Patches/0355-Update-entity-Metadata-for-all-tracked-players.patch rename to Spigot-Server-Patches/0345-Update-entity-Metadata-for-all-tracked-players.patch index 1b9bd1174..5acf6c5f9 100644 --- a/Spigot-Server-Patches/0355-Update-entity-Metadata-for-all-tracked-players.patch +++ b/Spigot-Server-Patches/0345-Update-entity-Metadata-for-all-tracked-players.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Update entity Metadata for all tracked players diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -index 3ff7a7b4a853068eba2fb034246a58116a846523..3a88c9a67062eb73ad8257ea786efca7e7e99f65 100644 +index b5a76f37c27cde25b2561a23c7c0fe7bdd992fee..9b89c0c8a3f1dada4e9b2aaeed0b92e56229b7ca 100644 --- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java +++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -@@ -387,6 +387,12 @@ public class EntityTrackerEntry { +@@ -392,6 +392,12 @@ public class EntityTrackerEntry { return PacketPlayOutEntity.a(this.xLoc, this.yLoc, this.zLoc); } @@ -22,10 +22,10 @@ index 3ff7a7b4a853068eba2fb034246a58116a846523..3a88c9a67062eb73ad8257ea786efca7 this.f.accept(packet); if (this.tracker instanceof EntityPlayer) { diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 34e5806cff6f0779603800c1b7839e7768f9d4e0..20cc434b2120c52c9a5786c67b773f65d286c4a9 100644 +index 0aac20a6a1e72f0528532edb9421b89e8461e23e..c03ddd05032c75bf723bcdc12d37cc3dbfebc9cc 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -2007,7 +2007,14 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -2046,7 +2046,14 @@ public class PlayerConnection implements PacketListenerPlayIn { if (event.isCancelled() || this.player.inventory.getItemInHand() == null || this.player.inventory.getItemInHand().getItem() != origItem) { // Refresh the current entity metadata diff --git a/Spigot-Server-Patches/0357-Implement-PlayerPostRespawnEvent.patch b/Spigot-Server-Patches/0346-Implement-PlayerPostRespawnEvent.patch similarity index 63% rename from Spigot-Server-Patches/0357-Implement-PlayerPostRespawnEvent.patch rename to Spigot-Server-Patches/0346-Implement-PlayerPostRespawnEvent.patch index 03a17298e..608650cf0 100644 --- a/Spigot-Server-Patches/0357-Implement-PlayerPostRespawnEvent.patch +++ b/Spigot-Server-Patches/0346-Implement-PlayerPostRespawnEvent.patch @@ -5,12 +5,12 @@ Subject: [PATCH] Implement PlayerPostRespawnEvent diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 79ab45540081c8e2f5dd1d84c6ae602f3664920f..7b2514355d26681ddd69c040ad6a7bc4d6aaaac2 100644 +index 6a00d1dcd62034c595723547afb4637e9d7c18a0..dd05e753942d2f50ba0af41d59b4cb962df4cd1b 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -627,9 +627,14 @@ public abstract class PlayerList { - - // this.a(entityplayer1, entityplayer, worldserver); // CraftBukkit - removed +@@ -664,9 +664,14 @@ public abstract class PlayerList { + // this.a(entityplayer1, entityplayer, worldserver1); // CraftBukkit - removed + boolean flag2 = false; + // Paper start + boolean isBedSpawn = false; @@ -20,19 +20,19 @@ index 79ab45540081c8e2f5dd1d84c6ae602f3664920f..7b2514355d26681ddd69c040ad6a7bc4 // CraftBukkit start - fire PlayerRespawnEvent if (location == null) { - boolean isBedSpawn = false; -+ //boolean isBedSpawn = false; Paper - moved up - CraftWorld cworld = (CraftWorld) this.server.server.getWorld(entityplayer.spawnWorld); - if (cworld != null && blockposition != null) { - Optional optional = EntityHuman.getBed(cworld.getHandle(), blockposition, flag1); -@@ -662,6 +667,7 @@ public abstract class PlayerList { ++ // boolean isBedSpawn = false; // Paper - moved up + WorldServer worldserver1 = this.server.getWorldServer(entityplayer.getSpawnDimension()); + if (worldserver1 != null) { + Optional optional; +@@ -707,6 +712,7 @@ public abstract class PlayerList { location = respawnEvent.getRespawnLocation(); if (!flag) entityplayer.reset(); // SPIGOT-4785 + isRespawn = true; // Paper } else { - location.setWorld(server.getWorldServer(dimensionmanager).getWorld()); + location.setWorld(worldserver.getWorld()); } -@@ -723,6 +729,13 @@ public abstract class PlayerList { +@@ -764,6 +770,13 @@ public abstract class PlayerList { if (entityplayer.playerConnection.isDisconnected()) { this.savePlayerFile(entityplayer); } diff --git a/Spigot-Server-Patches/0358-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch b/Spigot-Server-Patches/0347-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch similarity index 90% rename from Spigot-Server-Patches/0358-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch rename to Spigot-Server-Patches/0347-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch index 1fecfc749..761fcc493 100644 --- a/Spigot-Server-Patches/0358-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch +++ b/Spigot-Server-Patches/0347-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch @@ -6,7 +6,7 @@ Subject: [PATCH] don't go below 0 for pickupDelay, breaks picking up items vanilla checks for == 0 diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java -index e5c9bac88a59d52c9b2f05df3e4f373edbe009ca..ef2cf6565b5935b1f1a80f12670609017aebb2c8 100644 +index aad23b2c6cd674e05e609c4c019205978c6741f2..465550656356394074ebf4cc8d6188455daded88 100644 --- a/src/main/java/net/minecraft/server/EntityItem.java +++ b/src/main/java/net/minecraft/server/EntityItem.java @@ -60,6 +60,7 @@ public class EntityItem extends Entity { @@ -17,7 +17,7 @@ index e5c9bac88a59d52c9b2f05df3e4f373edbe009ca..ef2cf6565b5935b1f1a80f1267060901 if (this.age != -32768) this.age += elapsedTicks; this.lastTick = MinecraftServer.currentTick; // CraftBukkit end -@@ -146,6 +147,7 @@ public class EntityItem extends Entity { +@@ -147,6 +148,7 @@ public class EntityItem extends Entity { // CraftBukkit start - Use wall time for pickup and despawn timers int elapsedTicks = MinecraftServer.currentTick - this.lastTick; if (this.pickupDelay != 32767) this.pickupDelay -= elapsedTicks; diff --git a/Spigot-Server-Patches/0359-Implement-getters-and-setters-for-EntityItem-owner-a.patch b/Spigot-Server-Patches/0348-Implement-getters-and-setters-for-EntityItem-owner-a.patch similarity index 100% rename from Spigot-Server-Patches/0359-Implement-getters-and-setters-for-EntityItem-owner-a.patch rename to Spigot-Server-Patches/0348-Implement-getters-and-setters-for-EntityItem-owner-a.patch diff --git a/Spigot-Server-Patches/0360-Server-Tick-Events.patch b/Spigot-Server-Patches/0349-Server-Tick-Events.patch similarity index 81% rename from Spigot-Server-Patches/0360-Server-Tick-Events.patch rename to Spigot-Server-Patches/0349-Server-Tick-Events.patch index 981bed288..0ebe46e85 100644 --- a/Spigot-Server-Patches/0360-Server-Tick-Events.patch +++ b/Spigot-Server-Patches/0349-Server-Tick-Events.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Server Tick Events Fires event at start and end of a server tick diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 207dd30539fa3961ba96aafe1e3cfef5020a885c..ae4d62d52c0763849d06709fc405018711db6f90 100644 +index 60067369f1d708ba53da9ad74be5a8330062a684..a97e6bc15dd07594379475e5dec0fc957ca1314a 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1092,6 +1092,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant= -30000000 && j >= -30000000 && i < 30000000 && j < 30000000) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index db31b17b87084c47402f5452872f385629c58382..0d5731429abe7b4ff97d6644ff088063dde19e60 100644 +index f5660806b8162cd8c3a1072601f6d3a99d526cc4..4b9d33d51c82575ad65056e8d314a60ae0e5bb0b 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -339,6 +339,29 @@ public class CraftWorld implements World { +@@ -342,6 +342,29 @@ public class CraftWorld implements World { return getHighestBlockYAt(x, z, org.bukkit.HeightMap.MOTION_BLOCKING); } diff --git a/Spigot-Server-Patches/0364-Mob-Spawner-API-Enhancements.patch b/Spigot-Server-Patches/0353-Mob-Spawner-API-Enhancements.patch similarity index 98% rename from Spigot-Server-Patches/0364-Mob-Spawner-API-Enhancements.patch rename to Spigot-Server-Patches/0353-Mob-Spawner-API-Enhancements.patch index a36af687a..513265985 100644 --- a/Spigot-Server-Patches/0364-Mob-Spawner-API-Enhancements.patch +++ b/Spigot-Server-Patches/0353-Mob-Spawner-API-Enhancements.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Mob Spawner API Enhancements diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -index cb7cb789b82461093fbbb4c8ae6d03fcbfe57383..41001b02a654194c4a8e25ad5f7af8fdd91090b2 100644 +index e2f5354709819e56f9bc66b8c8d5e095bc8387b4..921abae4914c7b3f28d387f7a682d991293c4798 100644 --- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java @@ -47,6 +47,7 @@ public abstract class MobSpawnerAbstract { diff --git a/Spigot-Server-Patches/0354-Per-Player-View-Distance-API-placeholders.patch b/Spigot-Server-Patches/0354-Per-Player-View-Distance-API-placeholders.patch new file mode 100644 index 000000000..a7b20bc41 --- /dev/null +++ b/Spigot-Server-Patches/0354-Per-Player-View-Distance-API-placeholders.patch @@ -0,0 +1,62 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Zach Brown +Date: Mon, 6 May 2019 01:29:25 -0400 +Subject: [PATCH] Per-Player View Distance API placeholders + +I hope to look at this more in-depth soon. It appears doable. +However this should not block the update. + +diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java +index 3cb8ce58c4675564fb239338d6c40ea511a9a97c..96f898acdeae1917a4aaf99ec4a48bccf3904488 100644 +--- a/src/main/java/net/minecraft/server/EntityEnderDragon.java ++++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java +@@ -576,9 +576,10 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster { + if (this.deathAnimationTicks == 1 && !this.isSilent()) { + // CraftBukkit start - Use relative location for far away sounds + // this.world.b(1028, this.getChunkCoordinates(), 0); +- //int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API ++ int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API + for (EntityPlayer player : (List) ((WorldServer)world).getPlayers()) { +- final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch ++ // final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch ++ // Paper end + double deltaX = this.locX() - player.locX(); + double deltaZ = this.locZ() - player.locZ(); + double distanceSquared = deltaX * deltaX + deltaZ * deltaZ; +diff --git a/src/main/java/net/minecraft/server/EntityWither.java b/src/main/java/net/minecraft/server/EntityWither.java +index 9331f96f68f121b41ce74904d624520291b7c72e..1074995e8c8a83f6cdb94019123fbffa309d5e08 100644 +--- a/src/main/java/net/minecraft/server/EntityWither.java ++++ b/src/main/java/net/minecraft/server/EntityWither.java +@@ -208,9 +208,9 @@ public class EntityWither extends EntityMonster implements IRangedEntity { + if (!this.isSilent()) { + // CraftBukkit start - Use relative location for far away sounds + // this.world.b(1023, new BlockPosition(this), 0); +- //int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API ++ int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API + for (EntityPlayer player : (List)this.world.getPlayers()) { +- final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch ++ // final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch + double deltaX = this.locX() - player.locX(); + double deltaZ = this.locZ() - player.locZ(); + double distanceSquared = deltaX * deltaX + deltaZ * deltaZ; +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +index ea083f0987fb85afdf23d894bdd8980cc6707e51..93bf15984f541b4daf05e4c27f105f9787cb0347 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +@@ -2025,6 +2025,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + super.remove(); + } + } ++ ++ @Override ++ public int getViewDistance() { ++ throw new NotImplementedException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO ++ } ++ ++ @Override ++ public void setViewDistance(int viewDistance) { ++ throw new NotImplementedException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO ++ } + // Paper end + + // Spigot start diff --git a/Spigot-Server-Patches/0366-Fix-CB-call-to-changed-postToMainThread-method.patch b/Spigot-Server-Patches/0355-Fix-CB-call-to-changed-postToMainThread-method.patch similarity index 82% rename from Spigot-Server-Patches/0366-Fix-CB-call-to-changed-postToMainThread-method.patch rename to Spigot-Server-Patches/0355-Fix-CB-call-to-changed-postToMainThread-method.patch index 66621d2e8..d128cf841 100644 --- a/Spigot-Server-Patches/0366-Fix-CB-call-to-changed-postToMainThread-method.patch +++ b/Spigot-Server-Patches/0355-Fix-CB-call-to-changed-postToMainThread-method.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix CB call to changed postToMainThread method diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 20cc434b2120c52c9a5786c67b773f65d286c4a9..96d26b45851c4066978186d49eed7ee131cc9140 100644 +index c03ddd05032c75bf723bcdc12d37cc3dbfebc9cc..62a0db6c08047be4ab28f5c23f4ae12694cf003f 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -286,7 +286,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -285,7 +285,7 @@ public class PlayerConnection implements PacketListenerPlayIn { this.networkManager.getClass(); // CraftBukkit - Don't wait diff --git a/Spigot-Server-Patches/0367-Fix-sounds-when-item-frames-are-modified-MC-123450.patch b/Spigot-Server-Patches/0356-Fix-sounds-when-item-frames-are-modified-MC-123450.patch similarity index 81% rename from Spigot-Server-Patches/0367-Fix-sounds-when-item-frames-are-modified-MC-123450.patch rename to Spigot-Server-Patches/0356-Fix-sounds-when-item-frames-are-modified-MC-123450.patch index b74fb1507..60c5a17ac 100644 --- a/Spigot-Server-Patches/0367-Fix-sounds-when-item-frames-are-modified-MC-123450.patch +++ b/Spigot-Server-Patches/0356-Fix-sounds-when-item-frames-are-modified-MC-123450.patch @@ -6,20 +6,20 @@ Subject: [PATCH] Fix sounds when item frames are modified (MC-123450) This also fixes the adding sound playing when the item frame direction is changed. diff --git a/src/main/java/net/minecraft/server/EntityItemFrame.java b/src/main/java/net/minecraft/server/EntityItemFrame.java -index 9b1e07452f9e7e9a6d069d6e62112a487ff288d4..f8a2f32f1d93e3cdbc7c40783beef05f5f05794f 100644 +index bb40f21d969e8166c9af365eabcc2fcb7511eef4..e20915578720f6d18955a4ddc6fb436af807acb3 100644 --- a/src/main/java/net/minecraft/server/EntityItemFrame.java +++ b/src/main/java/net/minecraft/server/EntityItemFrame.java -@@ -224,7 +224,7 @@ public class EntityItemFrame extends EntityHanging { +@@ -247,7 +247,7 @@ public class EntityItemFrame extends EntityHanging { } this.getDataWatcher().set(EntityItemFrame.ITEM, itemstack); - if (!itemstack.isEmpty() && playSound) { // CraftBukkit + if (!itemstack.isEmpty() && flag && playSound) { // CraftBukkit // Paper - only play sound when update flag is set - this.a(SoundEffects.ENTITY_ITEM_FRAME_ADD_ITEM, 1.0F, 1.0F); + this.playSound(SoundEffects.ENTITY_ITEM_FRAME_ADD_ITEM, 1.0F, 1.0F); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java -index 2873ff9d1f006b76c27f5d2a4b943e3fe3df7d9b..a3613edcbb538721bc850e04c8e8d27556a17aa6 100644 +index 79d443abb7975a1c181dee3cd17f8aa9164ad05d..8a43416ae2a9b923e3fa2b207931cb48cdb6bbd2 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java @@ -49,7 +49,7 @@ public class CraftItemFrame extends CraftHanging implements ItemFrame { diff --git a/Spigot-Server-Patches/0368-Fix-CraftServer-isPrimaryThread-and-MinecraftServer-.patch b/Spigot-Server-Patches/0357-Fix-CraftServer-isPrimaryThread-and-MinecraftServer-.patch similarity index 84% rename from Spigot-Server-Patches/0368-Fix-CraftServer-isPrimaryThread-and-MinecraftServer-.patch rename to Spigot-Server-Patches/0357-Fix-CraftServer-isPrimaryThread-and-MinecraftServer-.patch index 24bf94882..d2dc06e49 100644 --- a/Spigot-Server-Patches/0368-Fix-CraftServer-isPrimaryThread-and-MinecraftServer-.patch +++ b/Spigot-Server-Patches/0357-Fix-CraftServer-isPrimaryThread-and-MinecraftServer-.patch @@ -16,10 +16,10 @@ handling that should have been handled synchronously will be handled synchronously when the server gets shut down. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 992c03d799f9dbbb9f63559d787124b04b00283e..eabca3975af61b669fd31a23cb7c27883db7833e 100644 +index a97e6bc15dd07594379475e5dec0fc957ca1314a..b9e047643e1c3f84f26d936fcb067f607018ef34 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -2221,7 +2221,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant, PlayerChunk.Failure>> completablefuture = this.a(chunkcoordintpair, 1, (i) -> { diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index a699c5e0b240fac3066e874e7d52f061d01e0c5a..55c0b5dc30cff8de5a83a97ae17fec7624cbe3d9 100644 +index 576f5c8c4d702dae7f2db9fb221365394542fcfb..a243dc63eb4c811065c742e61b334864ad582fbe 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -3,6 +3,8 @@ package net.minecraft.server; - import com.google.common.annotations.VisibleForTesting; +@@ -5,6 +5,8 @@ import com.google.common.collect.ImmutableList; + import com.google.common.collect.Iterables; import co.aikar.timings.TimingHistory; // Paper import co.aikar.timings.Timings; // Paper + @@ -209,7 +209,7 @@ index a699c5e0b240fac3066e874e7d52f061d01e0c5a..55c0b5dc30cff8de5a83a97ae17fec76 import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Queues; -@@ -1062,8 +1064,24 @@ public class WorldServer extends World { +@@ -988,8 +990,24 @@ public class WorldServer extends World implements GeneratorAccessSeed { if (entity1 == null) { return false; } else { diff --git a/Spigot-Server-Patches/0371-improve-CraftWorld-isChunkLoaded.patch b/Spigot-Server-Patches/0360-improve-CraftWorld-isChunkLoaded.patch similarity index 90% rename from Spigot-Server-Patches/0371-improve-CraftWorld-isChunkLoaded.patch rename to Spigot-Server-Patches/0360-improve-CraftWorld-isChunkLoaded.patch index 38c1e0435..2da82bf6d 100644 --- a/Spigot-Server-Patches/0371-improve-CraftWorld-isChunkLoaded.patch +++ b/Spigot-Server-Patches/0360-improve-CraftWorld-isChunkLoaded.patch @@ -9,10 +9,10 @@ waiting for the execution queue to get to our request; We can just query the chunk status and get a response now, vs having to wait diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 2a3d133e51326b0088af2ce53e09bf2fe4b0c3c6..568eca9d3c499e33290aa8ab8548d9c64c97ce5f 100644 +index 4b9d33d51c82575ad65056e8d314a60ae0e5bb0b..3549404ec211e88f6d91bdcf07c661e2d2ac4875 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -405,13 +405,13 @@ public class CraftWorld implements World { +@@ -408,13 +408,13 @@ public class CraftWorld implements World { @Override public boolean isChunkLoaded(int x, int z) { diff --git a/Spigot-Server-Patches/0372-Configurable-Keep-Spawn-Loaded-range-per-world.patch b/Spigot-Server-Patches/0361-Configurable-Keep-Spawn-Loaded-range-per-world.patch similarity index 89% rename from Spigot-Server-Patches/0372-Configurable-Keep-Spawn-Loaded-range-per-world.patch rename to Spigot-Server-Patches/0361-Configurable-Keep-Spawn-Loaded-range-per-world.patch index 1aeb58ac8..862cfa085 100644 --- a/Spigot-Server-Patches/0372-Configurable-Keep-Spawn-Loaded-range-per-world.patch +++ b/Spigot-Server-Patches/0361-Configurable-Keep-Spawn-Loaded-range-per-world.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Configurable Keep Spawn Loaded range per world This lets you disable it for some worlds and lower it for others. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 572679e4d1ca0d84a08a5c48542fa40d426461e5..071e5e7f729d6c3ffb70506e7ef32eebee1e9118 100644 +index 6e29e3294d0661cc35d53b4201d980a2db4f5c93..6e1756eb90b6237100612527f69c995246d53ed1 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -481,4 +481,10 @@ public class PaperWorldConfig { +@@ -444,4 +444,10 @@ public class PaperWorldConfig { break; } } @@ -21,10 +21,10 @@ index 572679e4d1ca0d84a08a5c48542fa40d426461e5..071e5e7f729d6c3ffb70506e7ef32eeb + } } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index eabca3975af61b669fd31a23cb7c27883db7833e..257adcf4d5387fc18d5c48e0fa221f68539ad8f9 100644 +index b9e047643e1c3f84f26d936fcb067f607018ef34..d6a3c51826ac82fd46b8f6c98be7bf405ffa3f38 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -586,6 +586,14 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant pendingChunkUpdates = Sets.newHashSet(); @@ -61,7 +61,7 @@ index ae661297774f51c8b61fc08ca43e13ba368d0021..83da76fdc495225b563cecbdb71422ae } else { if (!this.l.isEmpty()) { diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index 6e9f402fb0faccc222b4289deb36e2d85a66eb7c..980044b9a81232e7d0eab8e4947db6ca1f845c1c 100644 +index ca41e420a1ab22f097dd0b98e156fd51434733d8..5efd611859648ed3c1bcda70728ea6106bd4bf4c 100644 --- a/src/main/java/net/minecraft/server/PlayerChunk.java +++ b/src/main/java/net/minecraft/server/PlayerChunk.java @@ -18,6 +18,7 @@ public class PlayerChunk { diff --git a/Spigot-Server-Patches/0376-Implement-CraftBlockSoundGroup.patch b/Spigot-Server-Patches/0364-Implement-CraftBlockSoundGroup.patch similarity index 63% rename from Spigot-Server-Patches/0376-Implement-CraftBlockSoundGroup.patch rename to Spigot-Server-Patches/0364-Implement-CraftBlockSoundGroup.patch index 17fbd8dcb..ae2bcae16 100644 --- a/Spigot-Server-Patches/0376-Implement-CraftBlockSoundGroup.patch +++ b/Spigot-Server-Patches/0364-Implement-CraftBlockSoundGroup.patch @@ -48,58 +48,46 @@ index 0000000000000000000000000000000000000000..99f99330d01fc61ce8ede9f225b0c42b + return CraftSound.getSoundByEffect(soundEffectType.getFallSound()); + } +} -diff --git a/src/main/java/net/minecraft/server/IBlockData.java b/src/main/java/net/minecraft/server/IBlockData.java -index cca2bf1045c1305a9defa5241909b50711b85d4c..321eae23c575528788b1b575f17593580d6ba737 100644 ---- a/src/main/java/net/minecraft/server/IBlockData.java -+++ b/src/main/java/net/minecraft/server/IBlockData.java -@@ -276,6 +276,7 @@ public class IBlockData extends BlockDataAbstract implements - return this.getBlock().isTicking(this); - } - -+ public final SoundEffectType getStepSound() { return this.r(); } // Paper - OBFHELPER - public SoundEffectType r() { - return this.getBlock().getStepSound(this); - } diff --git a/src/main/java/net/minecraft/server/SoundEffectType.java b/src/main/java/net/minecraft/server/SoundEffectType.java -index b774d2d8d903acc1ce4c5bd9240b2e96779e1d53..adf0913a0ecc3eaf330bee303d9cc7fb4bc51dee 100644 +index 957799e034ad8bc7201815b849244b7a809fb666..2301b38ac3b488809d2f624055ad3e23663d3fdb 100644 --- a/src/main/java/net/minecraft/server/SoundEffectType.java +++ b/src/main/java/net/minecraft/server/SoundEffectType.java -@@ -27,10 +27,10 @@ public class SoundEffectType { - public static final SoundEffectType w = new SoundEffectType(1.0F, 1.0F, SoundEffects.BLOCK_LANTERN_BREAK, SoundEffects.BLOCK_LANTERN_STEP, SoundEffects.BLOCK_LANTERN_PLACE, SoundEffects.BLOCK_LANTERN_HIT, SoundEffects.BLOCK_LANTERN_FALL); - public final float x; - public final float y; -- private final SoundEffect z; -+ private final SoundEffect z; public final SoundEffect getBreakSound() { return this.z; } // Paper - OBFHELPER - private final SoundEffect A; - private final SoundEffect B; -- private final SoundEffect C; -+ private final SoundEffect C; public final SoundEffect getHitSound() { return this.C; } // Paper - OBFHELPER - private final SoundEffect D; +@@ -51,10 +51,10 @@ public class SoundEffectType { + public static final SoundEffectType U = new SoundEffectType(1.0F, 1.0F, SoundEffects.BLOCK_GILDED_BLACKSTONE_BREAK, SoundEffects.BLOCK_GILDED_BLACKSTONE_STEP, SoundEffects.BLOCK_GILDED_BLACKSTONE_PLACE, SoundEffects.BLOCK_GILDED_BLACKSTONE_HIT, SoundEffects.BLOCK_GILDED_BLACKSTONE_FALL); + public final float V; + public final float W; +- private final SoundEffect X; ++ private final SoundEffect X; public final SoundEffect getBreakSound() { return this.X; } // Paper - OBFHELPER + private final SoundEffect Y; + private final SoundEffect Z; +- private final SoundEffect aa; ++ private final SoundEffect aa; public final SoundEffect getHitSound() { return this.aa; } // Paper - OBFHELPER + private final SoundEffect ab; public SoundEffectType(float f, float f1, SoundEffect soundeffect, SoundEffect soundeffect1, SoundEffect soundeffect2, SoundEffect soundeffect3, SoundEffect soundeffect4) { -@@ -51,14 +51,17 @@ public class SoundEffectType { - return this.y; +@@ -75,14 +75,17 @@ public class SoundEffectType { + return this.W; } + public final SoundEffect getStepSound() { return this.d(); } // Paper - OBFHELPER public SoundEffect d() { - return this.A; + return this.Y; } + public final SoundEffect getPlaceSound() { return this.e(); } // Paper - OBFHELPER public SoundEffect e() { - return this.B; + return this.Z; } + public final SoundEffect getFallSound() { return this.g(); } // Paper - OBFHELPER public SoundEffect g() { - return this.D; + return this.ab; } diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -index 30b7c9038d3a95b80304e052a5d629b461f76e99..1fc7f55fcaa1f9aaa4c675f9fcd508ffb80e9629 100644 +index 12b8d544566888dc77bc2c8748d78f09c4bb3b76..bda3e17ae7a5de98ef94f37307df302fefa3675f 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -@@ -704,4 +704,11 @@ public class CraftBlock implements Block { +@@ -718,4 +718,11 @@ public class CraftBlock implements Block { AxisAlignedBB aabb = shape.getBoundingBox(); return new BoundingBox(getX() + aabb.minX, getY() + aabb.minY, getZ() + aabb.minZ, getX() + aabb.maxX, getY() + aabb.maxY, getZ() + aabb.maxZ); } diff --git a/Spigot-Server-Patches/0377-Chunk-debug-command.patch b/Spigot-Server-Patches/0365-Chunk-debug-command.patch similarity index 95% rename from Spigot-Server-Patches/0377-Chunk-debug-command.patch rename to Spigot-Server-Patches/0365-Chunk-debug-command.patch index e327853d6..b5c50b513 100644 --- a/Spigot-Server-Patches/0377-Chunk-debug-command.patch +++ b/Spigot-Server-Patches/0365-Chunk-debug-command.patch @@ -185,20 +185,20 @@ index 5acad8e44f024d3ddf5ef4fd320460ac516e0fb8..af810987846efcd2bffbd23c31481b2d * Ported from MinecraftForge - author: LexManos - License: LGPLv2.1 */ diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 8c6550433c20c54cbe390219821ce393c5720da8..e6d08756f76360b29b29f18305e5ec84d09f2d54 100644 +index 6921def2dc8dd7f2b8ba9d46ab697a9f9b62cf4e..9f4c79629c981d496b96cf8a7a4c8e058f102b8b 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -22,7 +22,7 @@ import org.apache.logging.log4j.Logger; +@@ -23,7 +23,7 @@ import org.apache.logging.log4j.Logger; + public class ChunkProviderServer extends IChunkProvider { - private static final int b = (int) Math.pow(17.0D, 2.0D); -- private static final List c = ChunkStatus.a(); -+ private static final List c = ChunkStatus.a(); static final List getPossibleChunkStatuses() { return ChunkProviderServer.c; } // Paper - OBFHELPER +- private static final List b = ChunkStatus.a(); ++ private static final List b = ChunkStatus.a(); static final List getPossibleChunkStatuses() { return ChunkProviderServer.b; } // Paper - OBFHELPER private final ChunkMapDistance chunkMapDistance; - public final ChunkGenerator chunkGenerator; + public final ChunkGenerator chunkGenerator; private final WorldServer world; diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java -index 49178cbcebe7e7af9e9a2485ae11058fd1c6b20f..ece411feee81f96ae0462cf7643ec450cafad7a7 100644 +index 2eacc5de340ca5558d9a0cba9baa26bbebef714d..99801463d958540b5148e55c1e44f90a1078c371 100644 --- a/src/main/java/net/minecraft/server/MCUtil.java +++ b/src/main/java/net/minecraft/server/MCUtil.java @@ -5,7 +5,13 @@ import com.destroystokyo.paper.profile.CraftPlayerProfile; @@ -227,7 +227,7 @@ index 49178cbcebe7e7af9e9a2485ae11058fd1c6b20f..ece411feee81f96ae0462cf7643ec450 import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; import java.util.concurrent.LinkedBlockingQueue; -@@ -533,4 +542,170 @@ public final class MCUtil { +@@ -521,4 +530,170 @@ public final class MCUtil { return null; } @@ -320,7 +320,7 @@ index 49178cbcebe7e7af9e9a2485ae11058fd1c6b20f..ece411feee81f96ae0462cf7643ec450 + return Integer.compare(v1.location.z, v2.location.z); + }); + -+ worldData.addProperty("name", world.getWorldData().getName()); ++ worldData.addProperty("name", world.getWorld().getName()); + worldData.addProperty("view-distance", world.spigotConfig.viewDistance); + worldData.addProperty("keep-spawn-loaded", world.keepSpawnInMemory); + worldData.addProperty("keep-spawn-loaded-range", world.paperConfig.keepLoadedRange); @@ -399,7 +399,7 @@ index 49178cbcebe7e7af9e9a2485ae11058fd1c6b20f..ece411feee81f96ae0462cf7643ec450 + } } diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index 980044b9a81232e7d0eab8e4947db6ca1f845c1c..47e3e618c9e683e6975fb64e1094dc7078574dae 100644 +index 5efd611859648ed3c1bcda70728ea6106bd4bf4c..d806b6acbcfbf141f4c1436bd5a163fbf11bf4e6 100644 --- a/src/main/java/net/minecraft/server/PlayerChunk.java +++ b/src/main/java/net/minecraft/server/PlayerChunk.java @@ -27,7 +27,7 @@ public class PlayerChunk { @@ -412,10 +412,10 @@ index 980044b9a81232e7d0eab8e4947db6ca1f845c1c..47e3e618c9e683e6975fb64e1094dc70 private int dirtyCount; private int r; diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 1d255ce3833a0ea735bedbb33ae8259751346ab2..34f470779fa5d1cf9638431253024481236c073b 100644 +index 936be3fd8954933ac218f62a172df6878d128ec9..684d84e3c5caf1a0c816895c4930d056b2ba8be5 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -58,7 +58,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -59,7 +59,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { public final Long2ObjectLinkedOpenHashMap updatingChunks = new Long2ObjectLinkedOpenHashMap(); public volatile Long2ObjectLinkedOpenHashMap visibleChunks; private final Long2ObjectLinkedOpenHashMap pendingUnload; @@ -424,7 +424,7 @@ index 1d255ce3833a0ea735bedbb33ae8259751346ab2..34f470779fa5d1cf9638431253024481 public final WorldServer world; private final LightEngineThreaded lightEngine; private final IAsyncTaskHandler executor; -@@ -71,7 +71,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -72,7 +72,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { private final Mailbox> mailboxWorldGen; private final Mailbox> mailboxMain; public final WorldLoadListener worldLoadListener; diff --git a/Spigot-Server-Patches/0365-Per-Player-View-Distance-API-placeholders.patch b/Spigot-Server-Patches/0365-Per-Player-View-Distance-API-placeholders.patch deleted file mode 100644 index 28c3c8c34..000000000 --- a/Spigot-Server-Patches/0365-Per-Player-View-Distance-API-placeholders.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zach Brown -Date: Mon, 6 May 2019 01:29:25 -0400 -Subject: [PATCH] Per-Player View Distance API placeholders - -I hope to look at this more in-depth soon. It appears doable. -However this should not block the update. - -diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java -index 6a4ccaeb0fef2cabab87b33bf89b5a68608800e9..5bf99e0028b886a6ba1d2f39f8dc4cd3c9aa0943 100644 ---- a/src/main/java/net/minecraft/server/EntityEnderDragon.java -+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java -@@ -579,9 +579,9 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster { - // CraftBukkit start - Use relative location for far away sounds - // this.world.b(1028, new BlockPosition(this), 0); - // Paper start -- //int viewDistance = ((WorldServer) this.world).spigotConfig.viewDistance * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API -+ int viewDistance = this.world.getWorld().getViewDistance() * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API - for (EntityPlayer player : ((WorldServer)world).getPlayers()) { -- final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch -+ //final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch - // Paper end - double deltaX = this.locX() - player.locX(); - double deltaZ = this.locZ() - player.locZ(); -diff --git a/src/main/java/net/minecraft/server/EntityWither.java b/src/main/java/net/minecraft/server/EntityWither.java -index 2e95069c1907df951680f2a00441a72500c48430..2f466af4d56d6f87c9d98226276b041ba2e89ac5 100644 ---- a/src/main/java/net/minecraft/server/EntityWither.java -+++ b/src/main/java/net/minecraft/server/EntityWither.java -@@ -208,9 +208,9 @@ public class EntityWither extends EntityMonster implements IRangedEntity { - // CraftBukkit start - Use relative location for far away sounds - // this.world.b(1023, new BlockPosition(this), 0); - // Paper start -- //int viewDistance = ((WorldServer) this.world).spigotConfig.viewDistance * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API -+ int viewDistance = this.world.getWorld().getViewDistance() * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API - for (EntityPlayer player : ((WorldServer)world).getPlayers()) { -- final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch -+ //final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch - // Paper end - double deltaX = this.locX() - player.locX(); - double deltaZ = this.locZ() - player.locZ(); -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index a614db834dfe8096ec0a7e6bc6e0348bfb300a1d..71d5ebe8c6ea2d52886c28e0fdc55e5993238709 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1958,6 +1958,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - super.remove(); - } - } -+ -+ @Override -+ public int getViewDistance() { -+ throw new NotImplementedException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO -+ } -+ -+ @Override -+ public void setViewDistance(int viewDistance) { -+ throw new NotImplementedException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO -+ } - // Paper end - - // Spigot start diff --git a/Spigot-Server-Patches/0379-Catch-exceptions-from-dispenser-entity-spawns.patch b/Spigot-Server-Patches/0366-Catch-exceptions-from-dispenser-entity-spawns.patch similarity index 93% rename from Spigot-Server-Patches/0379-Catch-exceptions-from-dispenser-entity-spawns.patch rename to Spigot-Server-Patches/0366-Catch-exceptions-from-dispenser-entity-spawns.patch index 7fccaa308..be995a8f4 100644 --- a/Spigot-Server-Patches/0379-Catch-exceptions-from-dispenser-entity-spawns.patch +++ b/Spigot-Server-Patches/0366-Catch-exceptions-from-dispenser-entity-spawns.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Catch exceptions from dispenser entity spawns diff --git a/src/main/java/net/minecraft/server/IDispenseBehavior.java b/src/main/java/net/minecraft/server/IDispenseBehavior.java -index 5a8c4dc6ba370af2da15949c1b514317a85e743b..b6b7e3c6c973886e35bde0bf10787b62c7f015ca 100644 +index aa6af83512e2baea4e3d942b7f7407ad05ea0f24..5432c24919bb5c32ca1eec4c9861ad127f72a60a 100644 --- a/src/main/java/net/minecraft/server/IDispenseBehavior.java +++ b/src/main/java/net/minecraft/server/IDispenseBehavior.java @@ -163,7 +163,14 @@ public interface IDispenseBehavior { diff --git a/Spigot-Server-Patches/0380-Fix-World-isChunkGenerated-calls.patch b/Spigot-Server-Patches/0367-Fix-World-isChunkGenerated-calls.patch similarity index 88% rename from Spigot-Server-Patches/0380-Fix-World-isChunkGenerated-calls.patch rename to Spigot-Server-Patches/0367-Fix-World-isChunkGenerated-calls.patch index 66b5a976d..63970da83 100644 --- a/Spigot-Server-Patches/0380-Fix-World-isChunkGenerated-calls.patch +++ b/Spigot-Server-Patches/0367-Fix-World-isChunkGenerated-calls.patch @@ -8,10 +8,10 @@ This patch also adds a chunk status cache on region files (note that its only purpose is to cache the status on DISK) diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 7b855ec2914a8a31ce0ade0f7ad085dd04f71478..d8647f272bdb29518b1a7faafa6fbcb53ffe1163 100644 +index 9f4c79629c981d496b96cf8a7a4c8e058f102b8b..726926f19c6725c1d935beec2f0f766d7466835e 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -28,7 +28,7 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -29,7 +29,7 @@ public class ChunkProviderServer extends IChunkProvider { private final WorldServer world; public final Thread serverThread; // Paper - private -> public private final LightEngineThreaded lightEngine; @@ -20,7 +20,7 @@ index 7b855ec2914a8a31ce0ade0f7ad085dd04f71478..d8647f272bdb29518b1a7faafa6fbcb5 public final PlayerChunkMap playerChunkMap; private final WorldPersistentData worldPersistentData; private long lastTickTime; -@@ -294,6 +294,21 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -295,6 +295,21 @@ public class ChunkProviderServer extends IChunkProvider { return ret; } @@ -43,10 +43,10 @@ index 7b855ec2914a8a31ce0ade0f7ad085dd04f71478..d8647f272bdb29518b1a7faafa6fbcb5 @Nullable diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index f54572773c25b6716a68166efa8d3fc8b22b6258..8e4b3e52cbc95e24b1d72aed9ec8c32b94a91561 100644 +index 17b8c4445af2bd2ed907d05ed3c396d4290dc63d..208a8ef3aaa4b33bfe2db2569a3588a332ab5686 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -@@ -403,6 +403,17 @@ public class ChunkRegionLoader { +@@ -407,6 +407,17 @@ public class ChunkRegionLoader { } // Paper end @@ -65,10 +65,10 @@ index f54572773c25b6716a68166efa8d3fc8b22b6258..8e4b3e52cbc95e24b1d72aed9ec8c32b if (nbttagcompound != null) { ChunkStatus chunkstatus = ChunkStatus.a(nbttagcompound.getCompound("Level").getString("Status")); diff --git a/src/main/java/net/minecraft/server/ChunkStatus.java b/src/main/java/net/minecraft/server/ChunkStatus.java -index efdf611e66ffd782291de749d8a48f3bf08f2129..134a4f0b7d254b5dd8ca26a9c5874532826978c4 100644 +index 772affccd3f56c72e547c973e4548b12ad3a86ec..0939e015aad7d3fcc7908afcabee0100c4deee40 100644 --- a/src/main/java/net/minecraft/server/ChunkStatus.java +++ b/src/main/java/net/minecraft/server/ChunkStatus.java -@@ -176,6 +176,7 @@ public class ChunkStatus { +@@ -182,6 +182,7 @@ public class ChunkStatus { return this.s; } @@ -76,7 +76,7 @@ index efdf611e66ffd782291de749d8a48f3bf08f2129..134a4f0b7d254b5dd8ca26a9c5874532 public ChunkStatus e() { return this.u; } -@@ -196,6 +197,17 @@ public class ChunkStatus { +@@ -202,6 +203,17 @@ public class ChunkStatus { return this.y; } @@ -95,7 +95,7 @@ index efdf611e66ffd782291de749d8a48f3bf08f2129..134a4f0b7d254b5dd8ca26a9c5874532 return (ChunkStatus) IRegistry.CHUNK_STATUS.get(MinecraftKey.a(s)); } diff --git a/src/main/java/net/minecraft/server/IChunkLoader.java b/src/main/java/net/minecraft/server/IChunkLoader.java -index f0a052eec2fb72b11dc70bf62a5e57f599bbc190..2f95174fcc467908808ed3f2dc956bdcafdc3558 100644 +index 2fde0b6ca8f38a998ac73b68be61fbfea9088cee..fa03834dacacf7ae6a326c88007256a261153c27 100644 --- a/src/main/java/net/minecraft/server/IChunkLoader.java +++ b/src/main/java/net/minecraft/server/IChunkLoader.java @@ -8,7 +8,7 @@ import javax.annotation.Nullable; @@ -108,10 +108,10 @@ index f0a052eec2fb72b11dc70bf62a5e57f599bbc190..2f95174fcc467908808ed3f2dc956bdc @Nullable private PersistentStructureLegacy c; diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index ed9ada49c7cc1131691bd6e005b2380274ef23e3..52ea4f05a0c7f29f62f31bb032a5ceb905107e60 100644 +index d806b6acbcfbf141f4c1436bd5a163fbf11bf4e6..3b0d13d319fe1d274ab657c7c87e5a2db5c02c4f 100644 --- a/src/main/java/net/minecraft/server/PlayerChunk.java +++ b/src/main/java/net/minecraft/server/PlayerChunk.java -@@ -115,6 +115,19 @@ public class PlayerChunk { +@@ -111,6 +111,19 @@ public class PlayerChunk { Either either = (Either) statusFuture.getNow(null); return either == null ? null : (Chunk) either.left().orElse(null); } @@ -132,24 +132,22 @@ index ed9ada49c7cc1131691bd6e005b2380274ef23e3..52ea4f05a0c7f29f62f31bb032a5ceb9 public CompletableFuture> getStatusFutureUnchecked(ChunkStatus chunkstatus) { diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 4f5b516144829a7ae11f21a56789ac7a1f256250..1d517fd1aea90edf470388fd857a41f2be149327 100644 +index 684d84e3c5caf1a0c816895c4930d056b2ba8be5..6dda11ffc022aa9bc7481506811a710a184f5e78 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -969,12 +969,62 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -938,12 +938,61 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } @Nullable - private NBTTagCompound readChunkData(ChunkCoordIntPair chunkcoordintpair) throws IOException { + public NBTTagCompound readChunkData(ChunkCoordIntPair chunkcoordintpair) throws IOException { // Paper - private -> public NBTTagCompound nbttagcompound = this.read(chunkcoordintpair); - -- return nbttagcompound == null ? null : this.getChunkData(this.world.getWorldProvider().getDimensionManager(), this.l, nbttagcompound, chunkcoordintpair, world); // CraftBukkit + // Paper start - Cache chunk status on disk + if (nbttagcompound == null) { + return null; + } + -+ nbttagcompound = this.getChunkData(this.world.getWorldProvider().getDimensionManager(), this.l, nbttagcompound, chunkcoordintpair, world); // CraftBukkit ++ nbttagcompound = this.getChunkData(this.world.getTypeKey(), this.l, nbttagcompound, chunkcoordintpair, world); // CraftBukkit + if (nbttagcompound == null) { + return null; + } @@ -165,12 +163,12 @@ index 4f5b516144829a7ae11f21a56789ac7a1f256250..1d517fd1aea90edf470388fd857a41f2 + RegionFile regionFile = this.getIOWorker().getRegionFileCache().getRegionFileIfLoaded(chunkPos); + + return regionFile == null ? null : regionFile.getStatusIfCached(chunkPos.x, chunkPos.z); - } - -+ public ChunkStatus getChunkStatusOnDisk(ChunkCoordIntPair chunkPos) throws IOException { -+ RegionFile regionFile = this.getIOWorker().getRegionFileCache().getFile(chunkPos, false); ++ } + -+ if (!regionFile.chunkExists(chunkPos)) { ++ public ChunkStatus getChunkStatusOnDisk(ChunkCoordIntPair chunkPos) throws IOException { ++ RegionFile regionFile = this.getIOWorker().getRegionFileCache().getFile(chunkPos, true); ++ ++ if (regionFile == null || !regionFile.chunkExists(chunkPos)) { + return null; + } + @@ -181,10 +179,11 @@ index 4f5b516144829a7ae11f21a56789ac7a1f256250..1d517fd1aea90edf470388fd857a41f2 + } + + this.readChunkData(chunkPos); -+ + +- return nbttagcompound == null ? null : this.getChunkData(this.world.getTypeKey(), this.l, nbttagcompound, chunkcoordintpair, world); // CraftBukkit + return regionFile.getStatusIfCached(chunkPos.x, chunkPos.z); -+ } -+ + } + + public void updateChunkStatusOnDisk(ChunkCoordIntPair chunkPos, @Nullable NBTTagCompound compound) throws IOException { + RegionFile regionFile = this.getIOWorker().getRegionFileCache().getFile(chunkPos, false); + @@ -201,7 +200,7 @@ index 4f5b516144829a7ae11f21a56789ac7a1f256250..1d517fd1aea90edf470388fd857a41f2 // Spigot start return isOutsideOfRange(chunkcoordintpair, false); diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java -index 6b543f89d4e32fb79bfe9aa7b815e4117dbea602..d37abf2cf304f81405e570588c8accbc44a629f4 100644 +index f781bb12a1c37d8b3088d0f638eae80d5b80aca4..e1730709fff5dfee68621d0aaed70a00bab97948 100644 --- a/src/main/java/net/minecraft/server/RegionFile.java +++ b/src/main/java/net/minecraft/server/RegionFile.java @@ -36,6 +36,30 @@ public class RegionFile implements AutoCloseable { @@ -232,10 +231,10 @@ index 6b543f89d4e32fb79bfe9aa7b815e4117dbea602..d37abf2cf304f81405e570588c8accbc + } + // Paper end + - public RegionFile(File file, File file1) throws IOException { - this(file.toPath(), file1.toPath(), RegionFileCompression.b); + public RegionFile(File file, File file1, boolean flag) throws IOException { + this(file.toPath(), file1.toPath(), RegionFileCompression.b, flag); } -@@ -350,11 +374,13 @@ public class RegionFile implements AutoCloseable { +@@ -359,11 +383,13 @@ public class RegionFile implements AutoCloseable { return this.getOffset(chunkcoordintpair) != 0; } @@ -247,14 +246,14 @@ index 6b543f89d4e32fb79bfe9aa7b815e4117dbea602..d37abf2cf304f81405e570588c8accbc public void close() throws IOException { + this.closed = true; // Paper try { - this.c(); + this.d(); } finally { diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java -index 942b7d323936a872d83c536c1901b4b436aa7e7c..2f8af42e2aadeb1b11db94fdb54ec0ba9e30f095 100644 +index 02bd568af727633a6e834d5328683a9ff67b9dd7..341689ac996164b7b53e095495b92b6e85ab991a 100644 --- a/src/main/java/net/minecraft/server/RegionFileCache.java +++ b/src/main/java/net/minecraft/server/RegionFileCache.java -@@ -18,7 +18,14 @@ public final class RegionFileCache implements AutoCloseable { - this.b = file; +@@ -20,7 +20,14 @@ public final class RegionFileCache implements AutoCloseable { + this.c = flag; } - private RegionFile getFile(ChunkCoordIntPair chunkcoordintpair, boolean existingOnly) throws IOException { // CraftBukkit @@ -269,7 +268,7 @@ index 942b7d323936a872d83c536c1901b4b436aa7e7c..2f8af42e2aadeb1b11db94fdb54ec0ba long i = ChunkCoordIntPair.pair(chunkcoordintpair.getRegionX(), chunkcoordintpair.getRegionZ()); RegionFile regionfile = (RegionFile) this.cache.getAndMoveToFirst(i); -@@ -165,7 +172,8 @@ public final class RegionFileCache implements AutoCloseable { +@@ -167,7 +174,8 @@ public final class RegionFileCache implements AutoCloseable { try { NBTCompressedStreamTools.a(nbttagcompound, (DataOutput) dataoutputstream); @@ -280,7 +279,7 @@ index 942b7d323936a872d83c536c1901b4b436aa7e7c..2f8af42e2aadeb1b11db94fdb54ec0ba throwable = throwable1; throw throwable1; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index b257ef7583f7bc3b6d31f0be89990603640c5ff7..cf059aa091e9c732f99b89fc347074a9c1b879a8 100644 +index 29d88bf1a8c5272822dd26e5e93d102748d9abf2..412dc3865dfee606c37c06daefeacc6ed14ced7b 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -19,6 +19,7 @@ import java.util.Objects; @@ -291,7 +290,7 @@ index b257ef7583f7bc3b6d31f0be89990603640c5ff7..cf059aa091e9c732f99b89fc347074a9 import java.util.function.Predicate; import java.util.stream.Collectors; import net.minecraft.server.ArraySetSorted; -@@ -410,8 +411,22 @@ public class CraftWorld implements World { +@@ -413,8 +414,22 @@ public class CraftWorld implements World { @Override public boolean isChunkGenerated(int x, int z) { @@ -315,7 +314,7 @@ index b257ef7583f7bc3b6d31f0be89990603640c5ff7..cf059aa091e9c732f99b89fc347074a9 } catch (IOException ex) { throw new RuntimeException(ex); } -@@ -522,20 +537,49 @@ public class CraftWorld implements World { +@@ -525,20 +540,49 @@ public class CraftWorld implements World { @Override public boolean loadChunk(int x, int z, boolean generate) { org.spigotmc.AsyncCatcher.catchOp("chunk load"); // Spigot diff --git a/Spigot-Server-Patches/0381-Show-blockstate-location-if-we-failed-to-read-it.patch b/Spigot-Server-Patches/0368-Show-blockstate-location-if-we-failed-to-read-it.patch similarity index 94% rename from Spigot-Server-Patches/0381-Show-blockstate-location-if-we-failed-to-read-it.patch rename to Spigot-Server-Patches/0368-Show-blockstate-location-if-we-failed-to-read-it.patch index 76414879f..bdabcc0cc 100644 --- a/Spigot-Server-Patches/0381-Show-blockstate-location-if-we-failed-to-read-it.patch +++ b/Spigot-Server-Patches/0368-Show-blockstate-location-if-we-failed-to-read-it.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Show blockstate location if we failed to read it diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java -index f6401e2cde9d56547cee7f8d9e4b2a58764ee895..3e22d558ea09a6554e1bc71f8ca10277ec480705 100644 +index feeae1a9eb309ae4101783b191bb2bffe9aeb7d3..6e9eff2c29528b857cf758e9e45606c8a1c1cc8d 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java @@ -19,6 +19,8 @@ public class CraftBlockEntityState extends CraftBlockState diff --git a/Spigot-Server-Patches/0382-Synchronize-DataPaletteBlock-instead-of-ReentrantLoc.patch b/Spigot-Server-Patches/0369-Synchronize-DataPaletteBlock-instead-of-ReentrantLoc.patch similarity index 86% rename from Spigot-Server-Patches/0382-Synchronize-DataPaletteBlock-instead-of-ReentrantLoc.patch rename to Spigot-Server-Patches/0369-Synchronize-DataPaletteBlock-instead-of-ReentrantLoc.patch index a4138a3a7..f0a0d68f9 100644 --- a/Spigot-Server-Patches/0382-Synchronize-DataPaletteBlock-instead-of-ReentrantLoc.patch +++ b/Spigot-Server-Patches/0369-Synchronize-DataPaletteBlock-instead-of-ReentrantLoc.patch @@ -13,10 +13,10 @@ contention situations. And this is extremely a low contention situation. diff --git a/src/main/java/net/minecraft/server/DataPaletteBlock.java b/src/main/java/net/minecraft/server/DataPaletteBlock.java -index d5f5a51872dfabdbb828b6c20d61893aed2efec7..3da575929fcf878ebfe18e3240fac84325159225 100644 +index bcf249aab7d8223f6d9b597fcb20c1aa523ab862..4d397dc5a5127d5e9eb1ba5675239b022a1544c0 100644 --- a/src/main/java/net/minecraft/server/DataPaletteBlock.java +++ b/src/main/java/net/minecraft/server/DataPaletteBlock.java -@@ -24,7 +24,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { +@@ -23,7 +23,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { private int i; private int getBitsPerObject() { return this.i; } // Paper - OBFHELPER private final ReentrantLock j = new ReentrantLock(); @@ -25,7 +25,7 @@ index d5f5a51872dfabdbb828b6c20d61893aed2efec7..3da575929fcf878ebfe18e3240fac843 if (this.j.isLocked() && !this.j.isHeldByCurrentThread()) { String s = (String) Thread.getAllStackTraces().keySet().stream().filter(Objects::nonNull).map((thread) -> { return thread.getName() + ": \n\tat " + (String) Arrays.stream(thread.getStackTrace()).map(Object::toString).collect(Collectors.joining("\n\tat ")); -@@ -36,11 +36,11 @@ public class DataPaletteBlock implements DataPaletteExpandable { +@@ -35,11 +35,11 @@ public class DataPaletteBlock implements DataPaletteExpandable { throw new ReportedException(crashreport); } else { this.j.lock(); @@ -39,7 +39,7 @@ index d5f5a51872dfabdbb828b6c20d61893aed2efec7..3da575929fcf878ebfe18e3240fac843 } public DataPaletteBlock(DataPalette datapalette, RegistryBlockID registryblockid, Function function, Function function1, T t0) { -@@ -76,7 +76,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { +@@ -75,7 +75,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { } @Override @@ -48,7 +48,7 @@ index d5f5a51872dfabdbb828b6c20d61893aed2efec7..3da575929fcf878ebfe18e3240fac843 this.a(); DataBits databits = this.a; DataPalette datapalette = this.h; -@@ -99,18 +99,18 @@ public class DataPaletteBlock implements DataPaletteExpandable { +@@ -98,18 +98,18 @@ public class DataPaletteBlock implements DataPaletteExpandable { } public T setBlock(int i, int j, int k, T t0) { @@ -72,7 +72,7 @@ index d5f5a51872dfabdbb828b6c20d61893aed2efec7..3da575929fcf878ebfe18e3240fac843 int j = this.h.a(t0); int k = this.a.a(i, j); T t1 = this.h.a(k); -@@ -135,7 +135,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { +@@ -134,7 +134,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { } public void writeDataPaletteBlock(PacketDataSerializer packetDataSerializer) { this.b(packetDataSerializer); } // Paper - OBFHELPER @@ -81,16 +81,16 @@ index d5f5a51872dfabdbb828b6c20d61893aed2efec7..3da575929fcf878ebfe18e3240fac843 this.a(); packetdataserializer.writeByte(this.i); this.h.b(packetdataserializer); -@@ -143,7 +143,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { +@@ -142,7 +142,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { this.b(); } - public void a(NBTTagList nbttaglist, long[] along) { + public synchronized void a(NBTTagList nbttaglist, long[] along) { // Paper - synchronize this.a(); - int i = Math.max(4, MathHelper.d(nbttaglist.size())); + int i = Math.max(4, MathHelper.e(nbttaglist.size())); -@@ -176,7 +176,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { +@@ -175,7 +175,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { this.b(); } diff --git a/Spigot-Server-Patches/0378-incremental-chunk-saving.patch b/Spigot-Server-Patches/0370-incremental-chunk-saving.patch similarity index 83% rename from Spigot-Server-Patches/0378-incremental-chunk-saving.patch rename to Spigot-Server-Patches/0370-incremental-chunk-saving.patch index 6afaaf3e9..073ecf723 100644 --- a/Spigot-Server-Patches/0378-incremental-chunk-saving.patch +++ b/Spigot-Server-Patches/0370-incremental-chunk-saving.patch @@ -5,10 +5,10 @@ Subject: [PATCH] incremental chunk saving diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 071e5e7f729d6c3ffb70506e7ef32eebee1e9118..48676152152faf7a7b9524ac37d8b4a8c32c4e2c 100644 +index 6e1756eb90b6237100612527f69c995246d53ed1..5f3c8f74a60f9446623b863f9297402be1cd2f88 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -487,4 +487,19 @@ public class PaperWorldConfig { +@@ -450,4 +450,19 @@ public class PaperWorldConfig { keepLoadedRange = (short) (getInt("keep-spawn-loaded-range", Math.min(spigotConfig.viewDistance, 10)) * 16); log( "Keep Spawn Loaded Range: " + (keepLoadedRange/16)); } @@ -29,10 +29,10 @@ index 071e5e7f729d6c3ffb70506e7ef32eebee1e9118..48676152152faf7a7b9524ac37d8b4a8 + } } diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 962f425bbb7165740e77664dc543f976ef3d9c4a..dd3857bb6a002d8432ecbc6c6b52a39e5d55e6a6 100644 +index 141f2e8975b01fc2a5e7743955894f100c3062a2..8a316f732644886c476921c69838e9cb8b93a5b5 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -42,7 +42,7 @@ public class Chunk implements IChunkAccess { +@@ -43,7 +43,7 @@ public class Chunk implements IChunkAccess { private TickList o; private TickList p; private boolean q; @@ -42,10 +42,10 @@ index 962f425bbb7165740e77664dc543f976ef3d9c4a..dd3857bb6a002d8432ecbc6c6b52a39e private long inhabitedTime; @Nullable diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 8a8fb6acaabc5fc179a23ce3e23ddb54e1ee23a4..7b855ec2914a8a31ce0ade0f7ad085dd04f71478 100644 +index 726926f19c6725c1d935beec2f0f766d7466835e..f2ff1aa915c218bb1fc72467ccbd73ccf135c494 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -525,6 +525,15 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -535,6 +535,15 @@ public class ChunkProviderServer extends IChunkProvider { } // Paper - Timings } @@ -62,18 +62,18 @@ index 8a8fb6acaabc5fc179a23ce3e23ddb54e1ee23a4..7b855ec2914a8a31ce0ade0f7ad085dd public void close() throws IOException { // CraftBukkit start diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 257adcf4d5387fc18d5c48e0fa221f68539ad8f9..7920d24ab089fb8360ef74946cf7dc35cb7625eb 100644 +index d6a3c51826ac82fd46b8f6c98be7bf405ffa3f38..4ffd9c1d7b4fc2f42fa157b2235365cab41e295f 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -168,6 +168,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant processQueue = new java.util.concurrent.ConcurrentLinkedQueue(); public int autosavePeriod; + public boolean serverAutoSave = false; // Paper - public File bukkitDataPackFolder; public CommandDispatcher vanillaCommandDispatcher; private boolean forceTicks; -@@ -1116,14 +1117,28 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant 0) { -+ try { -+ world.saveIncrementally(serverAutoSave); -+ } catch (ExceptionWorldConflict exceptionWorldConflict) { -+ MinecraftServer.LOGGER.warn(exceptionWorldConflict.getMessage()); -+ } ++ world.saveIncrementally(serverAutoSave); + } + } + // Paper end @@ -108,10 +104,10 @@ index 257adcf4d5387fc18d5c48e0fa221f68539ad8f9..7920d24ab089fb8360ef74946cf7dc35 this.methodProfiler.enter("snooper"); if (((DedicatedServer) this).getDedicatedServerProperties().snooperEnabled && !this.snooper.d() && this.ticks > 100) { // Spigot diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index 47e3e618c9e683e6975fb64e1094dc7078574dae..ed9ada49c7cc1131691bd6e005b2380274ef23e3 100644 +index 3b0d13d319fe1d274ab657c7c87e5a2db5c02c4f..3e1c1253ad5e2fa68fd8a0bac100c2e7536ea080 100644 --- a/src/main/java/net/minecraft/server/PlayerChunk.java +++ b/src/main/java/net/minecraft/server/PlayerChunk.java -@@ -41,6 +41,9 @@ public class PlayerChunk { +@@ -40,6 +40,9 @@ public class PlayerChunk { private final PlayerChunkMap chunkMap; // Paper @@ -175,10 +171,10 @@ index 47e3e618c9e683e6975fb64e1094dc7078574dae..ed9ada49c7cc1131691bd6e005b23802 public void a(ProtoChunkExtension protochunkextension) { for (int i = 0; i < this.statusFutures.length(); ++i) { diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 34f470779fa5d1cf9638431253024481236c073b..4f5b516144829a7ae11f21a56789ac7a1f256250 100644 +index 6dda11ffc022aa9bc7481506811a710a184f5e78..39d89d6209123ae2146ae292009cad44c25f490a 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -332,6 +332,64 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -333,6 +333,64 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } @@ -195,7 +191,7 @@ index 34f470779fa5d1cf9638431253024481236c073b..4f5b516144829a7ae11f21a56789ac7a + protected void saveIncrementally() { + int savedThisTick = 0; + // optimized since we search far less chunks to hit ones that need to be saved -+ List reschedule = new ArrayList<>(this.world.paperConfig.maxAutoSaveChunksPerTick); ++ List reschedule = new java.util.ArrayList<>(this.world.paperConfig.maxAutoSaveChunksPerTick); + long currentTick = this.world.getTime(); + long maxSaveTime = currentTick - this.world.paperConfig.autoSavePeriod; + @@ -243,7 +239,7 @@ index 34f470779fa5d1cf9638431253024481236c073b..4f5b516144829a7ae11f21a56789ac7a protected void save(boolean flag) { if (flag) { List list = (List) this.visibleChunks.values().stream().filter(PlayerChunk::hasBeenLoaded).peek(PlayerChunk::m).collect(Collectors.toList()); -@@ -442,6 +500,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -443,6 +501,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { this.world.unloadChunk(chunk); } @@ -251,7 +247,7 @@ index 34f470779fa5d1cf9638431253024481236c073b..4f5b516144829a7ae11f21a56789ac7a this.lightEngine.a(ichunkaccess.getPos()); this.lightEngine.queueUpdate(); -@@ -623,6 +682,8 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -635,6 +694,8 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { playerchunk.a(new ProtoChunkExtension(chunk)); } @@ -261,15 +257,15 @@ index 34f470779fa5d1cf9638431253024481236c073b..4f5b516144829a7ae11f21a56789ac7a return PlayerChunk.getChunkState(playerchunk.getTicketLevel()); }); diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index ca0a23be27ee8174204867d463eb89a10931ff84..a0484d8062ecfb817cfd5b996915dc8f9a4eb2bd 100644 +index e8382aabb36f58c55ba47e6495d47af588b30d03..479271a51ba7e9c433f030918bc926ccd93dc938 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -817,11 +817,44 @@ public class WorldServer extends World { - return this.worldProvider.c(); +@@ -768,11 +768,43 @@ public class WorldServer extends World implements GeneratorAccessSeed { + return !this.server.a(this, blockposition, entityhuman) && this.getWorldBorder().a(blockposition); } + // Paper start - derived from below -+ public void saveIncrementally(boolean doFull) throws ExceptionWorldConflict { ++ public void saveIncrementally(boolean doFull) { + ChunkProviderServer chunkproviderserver = this.getChunkProvider(); + + if (doFull) { @@ -286,35 +282,34 @@ index ca0a23be27ee8174204867d463eb89a10931ff84..a0484d8062ecfb817cfd5b996915dc8f + timings.worldSaveChunks.stopTiming(); // Paper + + ++ // Copied from save() + // CraftBukkit start - moved from MinecraftServer.saveChunks -+ // PAIL - rename -+ if (doFull) { ++ if (doFull) { // Paper + WorldServer worldserver1 = this; -+ WorldData worlddata = worldserver1.getWorldData(); + -+ worldserver1.getWorldBorder().save(worlddata); -+ worlddata.setCustomBossEvents(this.server.getBossBattleCustomData().save()); -+ worldserver1.getDataManager().saveWorldData(worlddata, this.server.getPlayerList().save()); -+ // CraftBukkit end ++ worldDataServer.a(worldserver1.getWorldBorder().t()); ++ worldDataServer.setCustomBossEvents(this.server.getBossBattleCustomData().save()); ++ convertable.a(this.server.f, this.worldDataServer, this.server.getPlayerList().save()); + } ++ // CraftBukkit end + } + } + // Paper end + - public void save(@Nullable IProgressUpdate iprogressupdate, boolean flag, boolean flag1) throws ExceptionWorldConflict { + public void save(@Nullable IProgressUpdate iprogressupdate, boolean flag, boolean flag1) { ChunkProviderServer chunkproviderserver = this.getChunkProvider(); if (!flag1) { - org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld())); // CraftBukkit -+ if (flag) org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld())); // CraftBukkit ++ if (flag) org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld())); // CraftBukkit // Paper try (co.aikar.timings.Timing ignored = timings.worldSave.startTiming()) { // Paper if (iprogressupdate != null) { - iprogressupdate.a(new ChatMessage("menu.savingLevel", new Object[0])); -@@ -848,6 +881,7 @@ public class WorldServer extends World { + iprogressupdate.a(new ChatMessage("menu.savingLevel")); +@@ -798,6 +830,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { // CraftBukkit end } -+ protected void saveData() throws ExceptionWorldConflict { this.m_(); } // Paper - OBFHELPER - protected void m_() throws ExceptionWorldConflict { - this.checkSession(); - this.worldProvider.i(); ++ private void saveData() { this.ag(); } // Paper - OBFHELPER + private void ag() { + if (this.dragonBattle != null) { + this.server.getSaveData().a(this.dragonBattle.a()); diff --git a/Spigot-Server-Patches/0384-Anti-Xray.patch b/Spigot-Server-Patches/0371-Anti-Xray.patch similarity index 91% rename from Spigot-Server-Patches/0384-Anti-Xray.patch rename to Spigot-Server-Patches/0371-Anti-Xray.patch index 47bca2c29..4037bc053 100644 --- a/Spigot-Server-Patches/0384-Anti-Xray.patch +++ b/Spigot-Server-Patches/0371-Anti-Xray.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Anti-Xray diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 48676152152faf7a7b9524ac37d8b4a8c32c4e2c..f7c7c2871726e3a1673a693b9bd93910a28189b2 100644 +index 5f3c8f74a60f9446623b863f9297402be1cd2f88..c2cc7b8ebb1b15cf2c080ef5f78c5215d7c20828 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -1,7 +1,9 @@ @@ -18,7 +18,7 @@ index 48676152152faf7a7b9524ac37d8b4a8c32c4e2c..f7c7c2871726e3a1673a693b9bd93910 import org.bukkit.Bukkit; import org.bukkit.configuration.file.YamlConfiguration; import org.spigotmc.SpigotWorldConfig; -@@ -502,4 +504,31 @@ public class PaperWorldConfig { +@@ -465,4 +467,31 @@ public class PaperWorldConfig { private void maxAutoSaveChunksPerTick() { maxAutoSaveChunksPerTick = getInt("max-auto-save-chunks-per-tick", 24); } @@ -98,7 +98,7 @@ index 0000000000000000000000000000000000000000..df7e4183d8842f5be8ae9d0698f8fa90 +} diff --git a/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java new file mode 100644 -index 0000000000000000000000000000000000000000..4ecd180fa84376319ef78bf9b21bf669b22ff817 +index 0000000000000000000000000000000000000000..c0d7767adb996edf9f645be591e4eee1d1dddf97 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/antixray/ChunkPacketBlockControllerAntiXray.java @@ -0,0 +1,620 @@ @@ -197,7 +197,7 @@ index 0000000000000000000000000000000000000000..4ecd180fa84376319ef78bf9b21bf669 + IBlockData blockData = ChunkSection.GLOBAL_PALETTE.getObject(i); + + if (blockData != null) { -+ solidGlobal[i] = blockData.getBlock().isOccluding(blockData, emptyChunk, zeroPos) ++ solidGlobal[i] = blockData.isOccluding(emptyChunk, zeroPos) + && blockData.getBlock() != Blocks.SPAWNER && blockData.getBlock() != Blocks.BARRIER && blockData.getBlock() != Blocks.SHULKER_BOX; + // shulker box checks TE. + } @@ -847,10 +847,10 @@ index 0000000000000000000000000000000000000000..e61421d87a19bf2f6ce8836b48c445ff +} diff --git a/src/main/java/com/destroystokyo/paper/antixray/DataBitsReader.java b/src/main/java/com/destroystokyo/paper/antixray/DataBitsReader.java new file mode 100644 -index 0000000000000000000000000000000000000000..c5a7b186e96901d55680283500f423025ededbe8 +index 0000000000000000000000000000000000000000..298ea423084dbcc1b61f991bcd82b8ae51bf0977 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/antixray/DataBitsReader.java -@@ -0,0 +1,56 @@ +@@ -0,0 +1,51 @@ +package com.destroystokyo.paper.antixray; + +public final class DataBitsReader { @@ -891,28 +891,23 @@ index 0000000000000000000000000000000000000000..c5a7b186e96901d55680283500f42302 + } + + public int read() { -+ int value = (int) (current >>> bitInLongIndex) & mask; -+ bitInLongIndex += bitsPerObject; -+ -+ if (bitInLongIndex > 63) { -+ bitInLongIndex -= 64; ++ if (bitInLongIndex + bitsPerObject > 64) { ++ bitInLongIndex = 0; + longInDataBitsIndex += 8; + init(); -+ -+ if (bitInLongIndex > 0) { -+ value |= current << bitsPerObject - bitInLongIndex & mask; -+ } + } + ++ int value = (int) (current >>> bitInLongIndex) & mask; ++ bitInLongIndex += bitsPerObject; + return value; + } +} diff --git a/src/main/java/com/destroystokyo/paper/antixray/DataBitsWriter.java b/src/main/java/com/destroystokyo/paper/antixray/DataBitsWriter.java new file mode 100644 -index 0000000000000000000000000000000000000000..2eff19f6aaa31245f80910c6fbb541e32c672a31 +index 0000000000000000000000000000000000000000..333763936897befda5bb6c077944d2667f922799 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/antixray/DataBitsWriter.java -@@ -0,0 +1,84 @@ +@@ -0,0 +1,79 @@ +package com.destroystokyo.paper.antixray; + +public final class DataBitsWriter { @@ -969,39 +964,34 @@ index 0000000000000000000000000000000000000000..2eff19f6aaa31245f80910c6fbb541e3 + } + + public void write(int value) { ++ if (bitInLongIndex + bitsPerObject > 64) { ++ finish(); ++ bitInLongIndex = 0; ++ longInDataBitsIndex += 8; ++ init(); ++ } ++ + current = current & ~(mask << bitInLongIndex) | (value & mask) << bitInLongIndex; + dirty = true; + bitInLongIndex += bitsPerObject; -+ -+ if (bitInLongIndex > 63) { -+ finish(); -+ bitInLongIndex -= 64; -+ longInDataBitsIndex += 8; -+ init(); -+ -+ if (bitInLongIndex > 0) { -+ current = current & ~(mask >>> bitsPerObject - bitInLongIndex) | (value & mask) >>> bitsPerObject - bitInLongIndex; -+ dirty = true; -+ } -+ } + } + + public void skip() { + bitInLongIndex += bitsPerObject; + -+ if (bitInLongIndex > 63) { ++ if (bitInLongIndex > 64) { + finish(); -+ bitInLongIndex -= 64; ++ bitInLongIndex = bitsPerObject; + longInDataBitsIndex += 8; + init(); + } + } +} diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index dd3857bb6a002d8432ecbc6c6b52a39e5d55e6a6..08b3cbabc482d71862d90fcd9acd32d28f44a6e2 100644 +index 8a316f732644886c476921c69838e9cb8b93a5b5..8fa440b313b414a79118089b7481dee9f7ba69a8 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -422,7 +422,7 @@ public class Chunk implements IChunkAccess { +@@ -423,7 +423,7 @@ public class Chunk implements IChunkAccess { return null; } @@ -1011,10 +1001,10 @@ index dd3857bb6a002d8432ecbc6c6b52a39e5d55e6a6..08b3cbabc482d71862d90fcd9acd32d2 } diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index 8e4b3e52cbc95e24b1d72aed9ec8c32b94a91561..d287ea55c550dbebbbc1d5f815296ae7ba6315e9 100644 +index 208a8ef3aaa4b33bfe2db2569a3588a332ab5686..be3c7a8697c540d03a143b9306311a184474857f 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -@@ -57,7 +57,7 @@ public class ChunkRegionLoader { +@@ -58,7 +58,7 @@ public class ChunkRegionLoader { byte b0 = nbttagcompound2.getByte("Y"); if (nbttagcompound2.hasKeyOfType("Palette", 9) && nbttagcompound2.hasKeyOfType("BlockStates", 12)) { @@ -1023,7 +1013,7 @@ index 8e4b3e52cbc95e24b1d72aed9ec8c32b94a91561..d287ea55c550dbebbbc1d5f815296ae7 chunksection.getBlocks().a(nbttagcompound2.getList("Palette", 10), nbttagcompound2.getLongArray("BlockStates")); chunksection.recalcBlockCounts(); -@@ -115,7 +115,7 @@ public class ChunkRegionLoader { +@@ -116,7 +116,7 @@ public class ChunkRegionLoader { loadEntities(nbttagcompound1, chunk); }); } else { @@ -1033,17 +1023,18 @@ index 8e4b3e52cbc95e24b1d72aed9ec8c32b94a91561..d287ea55c550dbebbbc1d5f815296ae7 protochunk.a(biomestorage); object = protochunk; diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java -index e72d1386feb59e4a4c27466da96ffd29222bea18..c180d44bed91c86838d3be8c19be954b4412534e 100644 +index bd2290a4d4ec314b7afdb1f63d711f80803153cd..b168ad8021a5387e05023cd03ec1a69c8a86a233 100644 --- a/src/main/java/net/minecraft/server/ChunkSection.java +++ b/src/main/java/net/minecraft/server/ChunkSection.java -@@ -1,5 +1,6 @@ +@@ -1,6 +1,7 @@ package net.minecraft.server; + import java.util.function.Predicate; +import com.destroystokyo.paper.antixray.ChunkPacketInfo; // Paper - Anti-Xray - Add chunk packet info import javax.annotation.Nullable; public class ChunkSection { -@@ -11,16 +12,22 @@ public class ChunkSection { +@@ -12,16 +13,22 @@ public class ChunkSection { private short e; final DataPaletteBlock blockIds; @@ -1065,12 +1056,12 @@ index e72d1386feb59e4a4c27466da96ffd29222bea18..c180d44bed91c86838d3be8c19be954b this.nonEmptyBlockCount = short0; this.tickingBlockCount = short1; this.e = short2; -- this.blockIds = new DataPaletteBlock<>(ChunkSection.GLOBAL_PALETTE, Block.REGISTRY_ID, GameProfileSerializer::d, GameProfileSerializer::a, Blocks.AIR.getBlockData()); -+ this.blockIds = new DataPaletteBlock<>(ChunkSection.GLOBAL_PALETTE, Block.REGISTRY_ID, GameProfileSerializer::d, GameProfileSerializer::a, Blocks.AIR.getBlockData(), world == null ? null : world.chunkPacketBlockController.getPredefinedBlockData(world, chunk, this, initializeBlocks), initializeBlocks); // Paper - Anti-Xray - Add predefined block data +- this.blockIds = new DataPaletteBlock<>(ChunkSection.GLOBAL_PALETTE, Block.REGISTRY_ID, GameProfileSerializer::c, GameProfileSerializer::a, Blocks.AIR.getBlockData()); ++ this.blockIds = new DataPaletteBlock<>(ChunkSection.GLOBAL_PALETTE, Block.REGISTRY_ID, GameProfileSerializer::c, GameProfileSerializer::a, Blocks.AIR.getBlockData(), world == null ? null : world.chunkPacketBlockController.getPredefinedBlockData(world, chunk, this, initializeBlocks), initializeBlocks); // Paper - Anti-Xray - Add predefined block data } public final IBlockData getType(int i, int j, int k) { // Paper -@@ -132,10 +139,14 @@ public class ChunkSection { +@@ -133,10 +140,14 @@ public class ChunkSection { return this.blockIds; } @@ -1089,18 +1080,18 @@ index e72d1386feb59e4a4c27466da96ffd29222bea18..c180d44bed91c86838d3be8c19be954b public int j() { diff --git a/src/main/java/net/minecraft/server/DataPaletteBlock.java b/src/main/java/net/minecraft/server/DataPaletteBlock.java -index 44310efd63b0a460e9dcdc1c8ad0abec78052061..a5ea0e34ec181ad9f98f9ee2f644c3ec1eb1cd3c 100644 +index 4d397dc5a5127d5e9eb1ba5675239b022a1544c0..900b551f6f76862443b09c1e76ad596eda5655f4 100644 --- a/src/main/java/net/minecraft/server/DataPaletteBlock.java +++ b/src/main/java/net/minecraft/server/DataPaletteBlock.java -@@ -3,6 +3,7 @@ package net.minecraft.server; - import it.unimi.dsi.fastutil.ints.Int2IntMap; +@@ -1,6 +1,7 @@ + package net.minecraft.server; + import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap; - import it.unimi.dsi.fastutil.ints.Int2IntMap.Entry; +import com.destroystokyo.paper.antixray.ChunkPacketInfo; // Paper - Anti-Xray - Add chunk packet info import java.util.Arrays; import java.util.Objects; import java.util.concurrent.locks.ReentrantLock; -@@ -19,6 +20,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { +@@ -18,6 +19,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { private final Function e; private final Function f; private final T g; @@ -1108,7 +1099,7 @@ index 44310efd63b0a460e9dcdc1c8ad0abec78052061..a5ea0e34ec181ad9f98f9ee2f644c3ec protected DataBits a; protected DataBits getDataBits() { return this.a; } // Paper - OBFHELPER private DataPalette h; private DataPalette getDataPalette() { return this.h; } // Paper - OBFHELPER private int i; private int getBitsPerObject() { return this.i; } // Paper - OBFHELPER -@@ -43,14 +45,47 @@ public class DataPaletteBlock implements DataPaletteExpandable { +@@ -42,14 +44,47 @@ public class DataPaletteBlock implements DataPaletteExpandable { //this.j.unlock(); // Paper - disable this } @@ -1158,7 +1149,7 @@ index 44310efd63b0a460e9dcdc1c8ad0abec78052061..a5ea0e34ec181ad9f98f9ee2f644c3ec private static int b(int i, int j, int k) { return j << 8 | k << 4 | i; -@@ -85,6 +120,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { +@@ -84,6 +119,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { int j; @@ -1166,7 +1157,7 @@ index 44310efd63b0a460e9dcdc1c8ad0abec78052061..a5ea0e34ec181ad9f98f9ee2f644c3ec for (j = 0; j < databits.b(); ++j) { T t1 = datapalette.a(databits.a(j)); -@@ -134,24 +170,38 @@ public class DataPaletteBlock implements DataPaletteExpandable { +@@ -133,24 +169,38 @@ public class DataPaletteBlock implements DataPaletteExpandable { return t0 == null ? this.g : t0; } @@ -1195,9 +1186,9 @@ index 44310efd63b0a460e9dcdc1c8ad0abec78052061..a5ea0e34ec181ad9f98f9ee2f644c3ec public synchronized void a(NBTTagList nbttaglist, long[] along) { // Paper - synchronize this.a(); -- int i = Math.max(4, MathHelper.d(nbttaglist.size())); +- int i = Math.max(4, MathHelper.e(nbttaglist.size())); + // Paper - Anti-Xray - TODO: Should this.predefinedObjects.length just be added here (faster) or should the contents be compared to calculate the size (less RAM)? -+ int i = Math.max(4, MathHelper.d(nbttaglist.size() + (this.predefinedObjects == null ? 0 : this.predefinedObjects.length))); // Paper - Anti-Xray - Calculate the size with predefined objects ++ int i = Math.max(4, MathHelper.e(nbttaglist.size() + (this.predefinedObjects == null ? 0 : this.predefinedObjects.length))); // Paper - Anti-Xray - Calculate the size with predefined objects - if (i != this.i) { + if (true || i != this.i) { // Paper - Anti-Xray - Not initialized yet @@ -1210,7 +1201,7 @@ index 44310efd63b0a460e9dcdc1c8ad0abec78052061..a5ea0e34ec181ad9f98f9ee2f644c3ec if (this.h == this.b) { diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -index 23223f3f45210cf23f44f9012f292db80df781a0..9b608d73869bd2907f705562c8378bc2f205767b 100644 +index 900f16efde29ace3f073b1cbc01df8bafc360a9a..8335d003369d94cbad17ec6fce76d6f9d016455a 100644 --- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java +++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java @@ -1,5 +1,6 @@ @@ -1220,14 +1211,13 @@ index 23223f3f45210cf23f44f9012f292db80df781a0..9b608d73869bd2907f705562c8378bc2 import com.google.common.collect.Lists; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; -@@ -20,8 +21,13 @@ public class PacketPlayOutMapChunk implements Packet { - private byte[] f; private byte[] getData() { return this.f; } // Paper - OBFHELPER - private List g; +@@ -22,7 +23,12 @@ public class PacketPlayOutMapChunk implements Packet { private boolean h; -+ private volatile boolean ready; // Paper - Async-Anti-Xray - Ready flag for the network manager + private boolean i; - public PacketPlayOutMapChunk() {} + // Paper start - Async-Anti-Xray - Set the ready flag to true ++ private volatile boolean ready; // Paper - Async-Anti-Xray - Ready flag for the network manager + public PacketPlayOutMapChunk() { + this.ready = true; + } @@ -1235,29 +1225,29 @@ index 23223f3f45210cf23f44f9012f292db80df781a0..9b608d73869bd2907f705562c8378bc2 // Paper start private final java.util.List extraPackets = new java.util.ArrayList<>(); -@@ -33,6 +39,7 @@ public class PacketPlayOutMapChunk implements Packet { +@@ -34,6 +40,7 @@ public class PacketPlayOutMapChunk implements Packet { } // Paper end - public PacketPlayOutMapChunk(Chunk chunk, int i) { + public PacketPlayOutMapChunk(Chunk chunk, int i, boolean flag) { + ChunkPacketInfo chunkPacketInfo = chunk.world.chunkPacketBlockController.getChunkPacketInfo(this, chunk, i); // Paper - Anti-Xray - Add chunk packet info ChunkCoordIntPair chunkcoordintpair = chunk.getPos(); this.a = chunkcoordintpair.x; -@@ -55,7 +62,12 @@ public class PacketPlayOutMapChunk implements Packet { +@@ -57,7 +64,12 @@ public class PacketPlayOutMapChunk implements Packet { } this.f = new byte[this.a(chunk, i)]; -- this.c = this.a(new PacketDataSerializer(this.j()), chunk, i); +- this.c = this.a(new PacketDataSerializer(this.k()), chunk, i); + // Paper start - Anti-Xray - Add chunk packet info + if (chunkPacketInfo != null) { + chunkPacketInfo.setData(this.getData()); + } -+ this.c = this.writeChunk(new PacketDataSerializer(this.j()), chunk, i, chunkPacketInfo); ++ this.c = this.writeChunk(new PacketDataSerializer(this.k()), chunk, i, chunkPacketInfo); + // Paper end this.g = Lists.newArrayList(); iterator = chunk.getTileEntities().entrySet().iterator(); int totalTileEntities = 0; // Paper -@@ -82,8 +94,19 @@ public class PacketPlayOutMapChunk implements Packet { +@@ -84,8 +96,19 @@ public class PacketPlayOutMapChunk implements Packet { this.g.add(nbttagcompound); } } @@ -1277,7 +1267,7 @@ index 23223f3f45210cf23f44f9012f292db80df781a0..9b608d73869bd2907f705562c8378bc2 @Override public void a(PacketDataSerializer packetdataserializer) throws IOException { -@@ -149,8 +172,12 @@ public class PacketPlayOutMapChunk implements Packet { +@@ -153,8 +176,12 @@ public class PacketPlayOutMapChunk implements Packet { return bytebuf; } @@ -1292,7 +1282,7 @@ index 23223f3f45210cf23f44f9012f292db80df781a0..9b608d73869bd2907f705562c8378bc2 int j = 0; ChunkSection[] achunksection = chunk.getSections(); int k = 0; -@@ -160,7 +187,7 @@ public class PacketPlayOutMapChunk implements Packet { +@@ -164,7 +191,7 @@ public class PacketPlayOutMapChunk implements Packet { if (chunksection != Chunk.a && (!this.f() || !chunksection.c()) && (i & 1 << k) != 0) { j |= 1 << k; @@ -1302,23 +1292,23 @@ index 23223f3f45210cf23f44f9012f292db80df781a0..9b608d73869bd2907f705562c8378bc2 } diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 9171785ad54a26e95dea8b30509c1e49a5d9b22d..94b0c54d9d4d77b724087be55ffe6ce464a0bbe7 100644 +index 39d89d6209123ae2146ae292009cad44c25f490a..24f3e8a6866bb416f04aca342514fa5dd3d314c8 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -604,7 +604,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - PlayerChunkMap.LOGGER.error("Couldn't load chunk {}", chunkcoordintpair, exception); +@@ -608,7 +608,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } + this.g(chunkcoordintpair); - return Either.left(new ProtoChunk(chunkcoordintpair, ChunkConverter.a)); + return Either.left(new ProtoChunk(chunkcoordintpair, ChunkConverter.a, this.world)); // Paper - Anti-Xray - Add parameter }, this.executor); } diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java -index ed3f3362b640746649455f8dd2255ac2da03df7c..f11ef84df85c1e7ada9c62247b7882f19ae32089 100644 +index a32490f0eb754b065ee34c41465176db78b1625d..734855c1db3215d90b2743988f64af68aacb388e 100644 --- a/src/main/java/net/minecraft/server/PlayerInteractManager.java +++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java -@@ -272,6 +272,8 @@ public class PlayerInteractManager { +@@ -275,6 +275,8 @@ public class PlayerInteractManager { } } @@ -1328,10 +1318,10 @@ index ed3f3362b640746649455f8dd2255ac2da03df7c..f11ef84df85c1e7ada9c62247b7882f1 public void a(BlockPosition blockposition, PacketPlayInBlockDig.EnumPlayerDigType packetplayinblockdig_enumplayerdigtype, String s) { diff --git a/src/main/java/net/minecraft/server/ProtoChunk.java b/src/main/java/net/minecraft/server/ProtoChunk.java -index 51a5b9cb36c4325df8d1434dcf28d27abefdfede..a78b240621e0407fff67b018224c39fc4f97f4e5 100644 +index 5114ce15ad1be23ca83b3a3fcaba10a34fcb1a6f..a60b414cdf70096e667e776ab4fd36e411f8ff12 100644 --- a/src/main/java/net/minecraft/server/ProtoChunk.java +++ b/src/main/java/net/minecraft/server/ProtoChunk.java -@@ -45,16 +45,24 @@ public class ProtoChunk implements IChunkAccess { +@@ -46,16 +46,24 @@ public class ProtoChunk implements IChunkAccess { private long s; private final Map t; private volatile boolean u; @@ -1359,7 +1349,7 @@ index 51a5b9cb36c4325df8d1434dcf28d27abefdfede..a78b240621e0407fff67b018224c39fc this.f = Maps.newEnumMap(HeightMap.Type.class); this.g = ChunkStatus.EMPTY; this.h = Maps.newHashMap(); -@@ -209,7 +217,7 @@ public class ProtoChunk implements IChunkAccess { +@@ -210,7 +218,7 @@ public class ProtoChunk implements IChunkAccess { public ChunkSection a(int i) { if (this.j[i] == Chunk.a) { @@ -1369,7 +1359,7 @@ index 51a5b9cb36c4325df8d1434dcf28d27abefdfede..a78b240621e0407fff67b018224c39fc return this.j[i]; diff --git a/src/main/java/net/minecraft/server/ProtoChunkExtension.java b/src/main/java/net/minecraft/server/ProtoChunkExtension.java -index b740e82622e282bdf543a84a559af69dd5b8568c..6db6e74886943559e3582c350ffae54857ad8b84 100644 +index ee8df274d43be753887fb77e4203e2ee30ea02b3..9f91c02b444874e690eacb0cfa0c810168c8bb46 100644 --- a/src/main/java/net/minecraft/server/ProtoChunkExtension.java +++ b/src/main/java/net/minecraft/server/ProtoChunkExtension.java @@ -11,7 +11,7 @@ public class ProtoChunkExtension extends ProtoChunk { @@ -1382,7 +1372,7 @@ index b740e82622e282bdf543a84a559af69dd5b8568c..6db6e74886943559e3582c350ffae548 } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 69db339c29c8f06026f05b0b5bb8019099af3fdf..479b87eaae67909768db1ba23854f05d2e61110c 100644 +index 897069231f057bd977c382731d6b3d87ac30b030..25785eed8c714b87635679e44ef06726c9a1b24c 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -2,6 +2,8 @@ package net.minecraft.server; @@ -1394,7 +1384,7 @@ index 69db339c29c8f06026f05b0b5bb8019099af3fdf..479b87eaae67909768db1ba23854f05d import com.destroystokyo.paper.event.server.ServerExceptionEvent; import com.destroystokyo.paper.exception.ServerInternalException; import com.google.common.base.MoreObjects; -@@ -78,6 +80,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -84,6 +86,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot public final com.destroystokyo.paper.PaperWorldConfig paperConfig; // Paper @@ -1402,19 +1392,19 @@ index 69db339c29c8f06026f05b0b5bb8019099af3fdf..479b87eaae67909768db1ba23854f05d public final co.aikar.timings.WorldTimingsHandler timings; // Paper public static BlockPosition lastPhysicsProblem; // Spigot -@@ -116,9 +119,10 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - return ((ChunkProviderServer) this.chunkProvider).getChunkAt(x, z, false); +@@ -101,9 +104,10 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + return (CraftServer) Bukkit.getServer(); } -- protected World(WorldData worlddata, DimensionManager dimensionmanager, BiFunction bifunction, GameProfilerFiller gameprofilerfiller, boolean flag, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env) { -+ protected World(WorldData worlddata, DimensionManager dimensionmanager, java.util.concurrent.Executor executor, BiFunction bifunction, GameProfilerFiller gameprofilerfiller, boolean flag, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env) { // Paper - executor - this.spigotConfig = new org.spigotmc.SpigotWorldConfig( worlddata.getName() ); // Spigot - this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(worlddata.getName(), this.spigotConfig); // Paper +- protected World(WorldDataMutable worlddatamutable, ResourceKey resourcekey, ResourceKey resourcekey1, DimensionManager dimensionmanager, Supplier supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env) { ++ protected World(WorldDataMutable worlddatamutable, ResourceKey resourcekey, ResourceKey resourcekey1, DimensionManager dimensionmanager, Supplier supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env, java.util.concurrent.Executor executor) { + this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((WorldDataServer) worlddatamutable).getName()); // Spigot + this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig((((WorldDataServer)worlddatamutable).getName()), this.spigotConfig); // Paper + this.chunkPacketBlockController = this.paperConfig.antiXray ? new ChunkPacketBlockControllerAntiXray(this.paperConfig, executor) : ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray this.generator = gen; - if (dimensionmanager.world == null) dimensionmanager.world = (WorldServer) this; // Paper this.world = new CraftWorld((WorldServer) this, gen, env); -@@ -343,6 +347,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit +@@ -408,6 +412,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { // CraftBukkit end IBlockData iblockdata1 = chunk.setType(blockposition, iblockdata, (i & 64) != 0, (i & 1024) == 0); // CraftBukkit custom NO_PLACE flag @@ -1423,23 +1413,23 @@ index 69db339c29c8f06026f05b0b5bb8019099af3fdf..479b87eaae67909768db1ba23854f05d if (iblockdata1 == null) { // CraftBukkit start - remove blockstate if failed (or the same) diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index a0484d8062ecfb817cfd5b996915dc8f9a4eb2bd..c019f0287711f8301b47a3c8f3740ff2aecb998b 100644 +index 479271a51ba7e9c433f030918bc926ccd93dc938..7e862f44ad8b8b878a8a86a4d1b48de4b4506c66 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -84,7 +84,7 @@ public class WorldServer extends World { - - // Add env and gen to constructor - public WorldServer(MinecraftServer minecraftserver, Executor executor, WorldNBTStorage worldnbtstorage, WorldData worlddata, DimensionManager dimensionmanager, GameProfilerFiller gameprofilerfiller, WorldLoadListener worldloadlistener, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { -- super(worlddata, dimensionmanager, (world, worldprovider) -> { -+ super(worlddata, dimensionmanager, executor, (world, worldprovider) -> { // Paper - pass executor down - // CraftBukkit start - ChunkGenerator chunkGenerator; +@@ -95,7 +95,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { + // Add env and gen to constructor, WorldData -> WorldDataServer + public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey resourcekey, ResourceKey resourcekey1, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { +- super(iworlddataserver, resourcekey, resourcekey1, dimensionmanager, minecraftserver::getMethodProfiler, false, flag, i, gen, env); ++ super(iworlddataserver, resourcekey, resourcekey1, dimensionmanager, minecraftserver::getMethodProfiler, false, flag, i, gen, env, executor); // Paper pass executor + this.pvpMode = minecraftserver.getPVP(); + convertable = convertable_conversionsession; + uuid = WorldUUID.getUUID(convertable_conversionsession.folder.toFile()); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -index a53bb7295c5d510f2976ff3787d68857548e11cc..47f1b970b9ba39f9050ac34a5ac15593c25f8a70 100644 +index 2bd7d7959ce2845dbc09e198122e3574593dca58..cccb8f7b1c13811db7203282a5caad3da5b69a09 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -@@ -38,7 +38,7 @@ public class CraftChunk implements Chunk { +@@ -40,7 +40,7 @@ public class CraftChunk implements Chunk { private final WorldServer worldServer; private final int x; private final int z; @@ -1448,12 +1438,12 @@ index a53bb7295c5d510f2976ff3787d68857548e11cc..47f1b970b9ba39f9050ac34a5ac15593 private static final byte[] emptyLight = new byte[2048]; public CraftChunk(net.minecraft.server.Chunk chunk) { -@@ -260,7 +260,7 @@ public class CraftChunk implements Chunk { +@@ -262,7 +262,7 @@ public class CraftChunk implements Chunk { NBTTagCompound data = new NBTTagCompound(); cs[i].getBlocks().a(data, "Palette", "BlockStates"); -- DataPaletteBlock blockids = new DataPaletteBlock<>(ChunkSection.GLOBAL_PALETTE, net.minecraft.server.Block.REGISTRY_ID, GameProfileSerializer::d, GameProfileSerializer::a, Blocks.AIR.getBlockData()); // TODO: snapshot whole ChunkSection -+ DataPaletteBlock blockids = new DataPaletteBlock<>(ChunkSection.GLOBAL_PALETTE, net.minecraft.server.Block.REGISTRY_ID, GameProfileSerializer::d, GameProfileSerializer::a, Blocks.AIR.getBlockData(), null, false); // TODO: snapshot whole ChunkSection // Paper - Anti-Xray - Add no predefined block data and don't initialize because it's done in the line below internally +- DataPaletteBlock blockids = new DataPaletteBlock<>(ChunkSection.GLOBAL_PALETTE, net.minecraft.server.Block.REGISTRY_ID, GameProfileSerializer::c, GameProfileSerializer::a, Blocks.AIR.getBlockData()); // TODO: snapshot whole ChunkSection ++ DataPaletteBlock blockids = new DataPaletteBlock<>(ChunkSection.GLOBAL_PALETTE, net.minecraft.server.Block.REGISTRY_ID, GameProfileSerializer::c, GameProfileSerializer::a, Blocks.AIR.getBlockData(), null, false); // TODO: snapshot whole ChunkSection // Paper - Anti-Xray - Add no predefined block data and don't initialize because it's done in the line below internally blockids.a(data.getList("Palette", CraftMagicNumbers.NBT.TAG_COMPOUND), data.getLongArray("BlockStates")); sectionBlockIDs[i] = blockids; diff --git a/Spigot-Server-Patches/0385-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch b/Spigot-Server-Patches/0372-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch similarity index 62% rename from Spigot-Server-Patches/0385-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch rename to Spigot-Server-Patches/0372-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch index 29b06fd92..4699925f4 100644 --- a/Spigot-Server-Patches/0385-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch +++ b/Spigot-Server-Patches/0372-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch @@ -17,10 +17,10 @@ This should fully solve all of the issues around it so that only natural influences natural spawns. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index f7c7c2871726e3a1673a693b9bd93910a28189b2..e8e61ce505cafccb3c8338bc5bbdf941f903bb27 100644 +index c2cc7b8ebb1b15cf2c080ef5f78c5215d7c20828..bccc2cb3e76aa3ffe1c4200f1b7380d136cb2f96 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -505,6 +505,16 @@ public class PaperWorldConfig { +@@ -468,6 +468,16 @@ public class PaperWorldConfig { maxAutoSaveChunksPerTick = getInt("max-auto-save-chunks-per-tick", 24); } @@ -37,21 +37,21 @@ index f7c7c2871726e3a1673a693b9bd93910a28189b2..e8e61ce505cafccb3c8338bc5bbdf941 public boolean antiXray; public EngineMode engineMode; public int maxChunkSectionIndex; -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index c019f0287711f8301b47a3c8f3740ff2aecb998b..702dcc0387f85ebae8f1cfe9a8e79affef24281b 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -960,6 +960,13 @@ public class WorldServer extends World { +diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java +index 6426f67afb3cc3522ff79b1c8515c1f97cd2f0c1..8130e14b5d6c3e8b0a1234668d5c855e82f3a5dc 100644 +--- a/src/main/java/net/minecraft/server/SpawnerCreature.java ++++ b/src/main/java/net/minecraft/server/SpawnerCreature.java +@@ -48,6 +48,13 @@ public final class SpawnerCreature { EnumCreatureType enumcreaturetype = entity.getEntityType().e(); - if (enumcreaturetype != EnumCreatureType.MISC && this.getChunkProvider().b(entity)) { + if (enumcreaturetype != EnumCreatureType.MISC) { + // Paper start - Only count natural spawns -+ if (!this.paperConfig.countAllMobsForSpawning && -+ !(entity.spawnReason == CreatureSpawnEvent.SpawnReason.NATURAL || -+ entity.spawnReason == CreatureSpawnEvent.SpawnReason.CHUNK_GEN)) { ++ if (!entity.world.paperConfig.countAllMobsForSpawning && ++ !(entity.spawnReason == org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL || ++ entity.spawnReason == org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN)) { + continue; + } + // Paper end - object2intmap.mergeInt(enumcreaturetype, 1, Integer::sum); - } - } + BlockPosition blockposition = entity.getChunkCoordinates(); + long j = ChunkCoordIntPair.pair(blockposition.getX() >> 4, blockposition.getZ() >> 4); + diff --git a/Spigot-Server-Patches/0386-Configurable-projectile-relative-velocity.patch b/Spigot-Server-Patches/0373-Configurable-projectile-relative-velocity.patch similarity index 57% rename from Spigot-Server-Patches/0386-Configurable-projectile-relative-velocity.patch rename to Spigot-Server-Patches/0373-Configurable-projectile-relative-velocity.patch index 73ac6c25e..2c39e5436 100644 --- a/Spigot-Server-Patches/0386-Configurable-projectile-relative-velocity.patch +++ b/Spigot-Server-Patches/0373-Configurable-projectile-relative-velocity.patch @@ -25,10 +25,10 @@ P3) Solutions for 1) and especially 2) might not be future-proof, while this server-internal fix makes this change future-proof. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index e8e61ce505cafccb3c8338bc5bbdf941f903bb27..7101ef0912221bdb1c32d2cafbac5d9d53e7037d 100644 +index bccc2cb3e76aa3ffe1c4200f1b7380d136cb2f96..822b738f48578b39f81bb8e38208dc3d26c2a221 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -541,4 +541,9 @@ public class PaperWorldConfig { +@@ -504,4 +504,9 @@ public class PaperWorldConfig { } log("Anti-Xray: " + (antiXray ? "enabled" : "disabled") + " / Engine Mode: " + engineMode.getDescription() + " / Up to " + ((maxChunkSectionIndex + 1) * 16) + " blocks / Update Radius: " + updateRadius); } @@ -38,29 +38,16 @@ index e8e61ce505cafccb3c8338bc5bbdf941f903bb27..7101ef0912221bdb1c32d2cafbac5d9d + disableRelativeProjectileVelocity = getBoolean("game-mechanics.disable-relative-projectile-velocity", false); + } } -diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java -index 634e2bd3049d65bbef4ef12e2264049a6980fd71..9c97edf9c9e9a8cdf029264f6b563090142c686b 100644 ---- a/src/main/java/net/minecraft/server/EntityArrow.java -+++ b/src/main/java/net/minecraft/server/EntityArrow.java -@@ -85,7 +85,7 @@ public abstract class EntityArrow extends Entity implements IProjectile { - float f7 = MathHelper.cos(f1 * 0.017453292F) * MathHelper.cos(f * 0.017453292F); - - this.shoot((double) f5, (double) f6, (double) f7, f3, f4); -- this.setMot(this.getMot().add(entity.getMot().x, entity.onGround ? 0.0D : entity.getMot().y, entity.getMot().z)); -+ if (!entity.world.paperConfig.disableRelativeProjectileVelocity) this.setMot(this.getMot().add(entity.getMot().x, entity.onGround ? 0.0D : entity.getMot().y, entity.getMot().z)); // Paper - allow disabling relative velocity - } - - @Override -diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java -index 6c091b68087d60b0b916871eb0ce06c6a2776bf8..f5c8074dcf1c6275bc13eb8f2b67c04ca547877b 100644 ---- a/src/main/java/net/minecraft/server/EntityProjectile.java -+++ b/src/main/java/net/minecraft/server/EntityProjectile.java -@@ -43,7 +43,7 @@ public abstract class EntityProjectile extends Entity implements IProjectile { +diff --git a/src/main/java/net/minecraft/server/IProjectile.java b/src/main/java/net/minecraft/server/IProjectile.java +index ef7e036943bfbd869bd5d71bcb2ecc6c35c18294..a961f5d5d4f56cc43d883862e50e3430a2138968 100644 +--- a/src/main/java/net/minecraft/server/IProjectile.java ++++ b/src/main/java/net/minecraft/server/IProjectile.java +@@ -114,7 +114,7 @@ public abstract class IProjectile extends Entity { this.shoot((double) f5, (double) f6, (double) f7, f3, f4); Vec3D vec3d = entity.getMot(); -- this.setMot(this.getMot().add(vec3d.x, entity.onGround ? 0.0D : vec3d.y, vec3d.z)); -+ if (!entity.world.paperConfig.disableRelativeProjectileVelocity) this.setMot(this.getMot().add(vec3d.x, entity.onGround ? 0.0D : vec3d.y, vec3d.z)); // Paper - allow disabling relative velocity +- this.setMot(this.getMot().add(vec3d.x, entity.isOnGround() ? 0.0D : vec3d.y, vec3d.z)); ++ if (!entity.world.paperConfig.disableRelativeProjectileVelocity) this.setMot(this.getMot().add(vec3d.x, entity.isOnGround() ? 0.0D : vec3d.y, vec3d.z)); // Paper - allow disabling relative velocity } - @Override + protected void a(MovingObjectPosition movingobjectposition) { diff --git a/Spigot-Server-Patches/0387-Mark-entities-as-being-ticked-when-notifying-navigat.patch b/Spigot-Server-Patches/0374-Mark-entities-as-being-ticked-when-notifying-navigat.patch similarity index 76% rename from Spigot-Server-Patches/0387-Mark-entities-as-being-ticked-when-notifying-navigat.patch rename to Spigot-Server-Patches/0374-Mark-entities-as-being-ticked-when-notifying-navigat.patch index bd1b8d54e..1777b58fa 100644 --- a/Spigot-Server-Patches/0387-Mark-entities-as-being-ticked-when-notifying-navigat.patch +++ b/Spigot-Server-Patches/0374-Mark-entities-as-being-ticked-when-notifying-navigat.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Mark entities as being ticked when notifying navigation diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 36a951cfcd617baf1a840f394e639567bd044308..58018bfcee5396d440b0f022a7aa9ed452e67ec5 100644 +index 7e862f44ad8b8b878a8a86a4d1b48de4b4506c66..4529ccc02f53fadc6ac2df97682b21913487bc22 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1401,6 +1401,7 @@ public class WorldServer extends World { +@@ -1319,6 +1319,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { VoxelShape voxelshape1 = iblockdata1.getCollisionShape(this, blockposition); if (VoxelShapes.c(voxelshape, voxelshape1, OperatorBoolean.NOT_SAME)) { @@ -16,7 +16,7 @@ index 36a951cfcd617baf1a840f394e639567bd044308..58018bfcee5396d440b0f022a7aa9ed4 Iterator iterator = this.navigators.iterator(); while (iterator.hasNext()) { -@@ -1411,6 +1412,7 @@ public class WorldServer extends World { +@@ -1329,6 +1330,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { } } diff --git a/Spigot-Server-Patches/0388-offset-item-frame-ticking.patch b/Spigot-Server-Patches/0375-offset-item-frame-ticking.patch similarity index 89% rename from Spigot-Server-Patches/0388-offset-item-frame-ticking.patch rename to Spigot-Server-Patches/0375-offset-item-frame-ticking.patch index 7e53a08ee..f3cc8ac57 100644 --- a/Spigot-Server-Patches/0388-offset-item-frame-ticking.patch +++ b/Spigot-Server-Patches/0375-offset-item-frame-ticking.patch @@ -5,7 +5,7 @@ Subject: [PATCH] offset item frame ticking diff --git a/src/main/java/net/minecraft/server/EntityHanging.java b/src/main/java/net/minecraft/server/EntityHanging.java -index 21dbc9b2ab7c6edf2691f5c4f9e466ba33ba7580..ef9c4717c31c9fae4d9ac2e357ce22dab8fa3cce 100644 +index 3dc1f234a389b1badf0b189ba27708c787ce37af..06cf11af972f7762de43dc1df18a431a62787111 100644 --- a/src/main/java/net/minecraft/server/EntityHanging.java +++ b/src/main/java/net/minecraft/server/EntityHanging.java @@ -15,7 +15,7 @@ public abstract class EntityHanging extends Entity { diff --git a/Spigot-Server-Patches/0389-Avoid-hopper-searches-if-there-are-no-items.patch b/Spigot-Server-Patches/0376-Avoid-hopper-searches-if-there-are-no-items.patch similarity index 91% rename from Spigot-Server-Patches/0389-Avoid-hopper-searches-if-there-are-no-items.patch rename to Spigot-Server-Patches/0376-Avoid-hopper-searches-if-there-are-no-items.patch index 9e05dd85f..c514cf39d 100644 --- a/Spigot-Server-Patches/0389-Avoid-hopper-searches-if-there-are-no-items.patch +++ b/Spigot-Server-Patches/0376-Avoid-hopper-searches-if-there-are-no-items.patch @@ -14,10 +14,10 @@ And since minecart hoppers are used _very_ rarely near we can avoid alot of sear Combined, this adds up a lot. diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 08b3cbabc482d71862d90fcd9acd32d28f44a6e2..af9a195f6d0f966133577d00d30e8b4ad812aaeb 100644 +index 8fa440b313b414a79118089b7481dee9f7ba69a8..b2713942d8cf5bedd91ac63df18a336743c72da5 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -84,6 +84,10 @@ public class Chunk implements IChunkAccess { +@@ -85,6 +85,10 @@ public class Chunk implements IChunkAccess { return removed; } } @@ -28,7 +28,7 @@ index 08b3cbabc482d71862d90fcd9acd32d28f44a6e2..af9a195f6d0f966133577d00d30e8b4a // Paper end public Chunk(World world, ChunkCoordIntPair chunkcoordintpair, BiomeStorage biomestorage, ChunkConverter chunkconverter, TickList ticklist, TickList ticklist1, long i, @Nullable ChunkSection[] achunksection, @Nullable Consumer consumer) { -@@ -538,6 +542,13 @@ public class Chunk implements IChunkAccess { +@@ -539,6 +543,13 @@ public class Chunk implements IChunkAccess { entity.chunkZ = this.loc.z; this.entities.add(entity); // Paper - per chunk entity list this.entitySlices[k].add(entity); @@ -42,7 +42,7 @@ index 08b3cbabc482d71862d90fcd9acd32d28f44a6e2..af9a195f6d0f966133577d00d30e8b4a entity.entitySlice = this.entitySlices[k]; // Paper this.markDirty(); // Paper } -@@ -570,6 +581,11 @@ public class Chunk implements IChunkAccess { +@@ -571,6 +582,11 @@ public class Chunk implements IChunkAccess { if (!this.entitySlices[i].remove(entity)) { return; } @@ -54,7 +54,7 @@ index 08b3cbabc482d71862d90fcd9acd32d28f44a6e2..af9a195f6d0f966133577d00d30e8b4a entityCounts.decrement(entity.getMinecraftKeyString()); this.markDirty(); // Paper // Paper end -@@ -853,6 +869,14 @@ public class Chunk implements IChunkAccess { +@@ -854,6 +870,14 @@ public class Chunk implements IChunkAccess { for (int k = i; k <= j; ++k) { Iterator iterator = this.entitySlices[k].iterator(); // Spigot @@ -69,7 +69,7 @@ index 08b3cbabc482d71862d90fcd9acd32d28f44a6e2..af9a195f6d0f966133577d00d30e8b4a while (iterator.hasNext()) { T entity = (T) iterator.next(); // CraftBukkit - decompile error if (entity.shouldBeRemoved) continue; // Paper -@@ -872,9 +896,29 @@ public class Chunk implements IChunkAccess { +@@ -873,9 +897,29 @@ public class Chunk implements IChunkAccess { i = MathHelper.clamp(i, 0, this.entitySlices.length - 1); j = MathHelper.clamp(j, 0, this.entitySlices.length - 1); @@ -100,7 +100,7 @@ index 08b3cbabc482d71862d90fcd9acd32d28f44a6e2..af9a195f6d0f966133577d00d30e8b4a T t0 = (T) iterator.next(); // CraftBukkit - decompile error if (t0.shouldBeRemoved) continue; // Paper diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java -index 498f381099b2cf9460104688e12afc5f586e057a..a2d1ef3602a1c63d106d10140e18dfdb1d490805 100644 +index 28f10ab2e427872c04bc97ebc392cf6d58854cf9..57bc56cffff87d9b1774cec455af8d1651fb882c 100644 --- a/src/main/java/net/minecraft/server/IEntitySelector.java +++ b/src/main/java/net/minecraft/server/IEntitySelector.java @@ -11,6 +11,7 @@ public final class IEntitySelector { diff --git a/Spigot-Server-Patches/0390-Asynchronous-chunk-IO-and-loading.patch b/Spigot-Server-Patches/0377-Asynchronous-chunk-IO-and-loading.patch similarity index 91% rename from Spigot-Server-Patches/0390-Asynchronous-chunk-IO-and-loading.patch rename to Spigot-Server-Patches/0377-Asynchronous-chunk-IO-and-loading.patch index 63124c86d..1eedcdea5 100644 --- a/Spigot-Server-Patches/0390-Asynchronous-chunk-IO-and-loading.patch +++ b/Spigot-Server-Patches/0377-Asynchronous-chunk-IO-and-loading.patch @@ -121,10 +121,10 @@ tasks required to be executed by the chunk load task (i.e lighting and some poi tasks). diff --git a/src/main/java/co/aikar/timings/WorldTimingsHandler.java b/src/main/java/co/aikar/timings/WorldTimingsHandler.java -index fa1c920ea6092259149f9e7f9cd7cc1ed27bf338..98acbfa44dd9042b26fdf719d7748f92d201c928 100644 +index 944fd203e9f39d6c6fc9e270940c76c98067273a..a27dc38d1a29ed1d63d2f44b7984c2b65be487d9 100644 --- a/src/main/java/co/aikar/timings/WorldTimingsHandler.java +++ b/src/main/java/co/aikar/timings/WorldTimingsHandler.java -@@ -57,6 +57,17 @@ public class WorldTimingsHandler { +@@ -58,6 +58,17 @@ public class WorldTimingsHandler { public final Timing miscMobSpawning; @@ -140,9 +140,9 @@ index fa1c920ea6092259149f9e7f9cd7cc1ed27bf338..98acbfa44dd9042b26fdf719d7748f92 + public final Timing chunkUnloadDataSave; + public WorldTimingsHandler(World server) { - String name = server.worldData.getName() +" - "; + String name = ((WorldDataServer) server.getWorldData()).getName() + " - "; -@@ -110,6 +121,17 @@ public class WorldTimingsHandler { +@@ -111,6 +122,17 @@ public class WorldTimingsHandler { miscMobSpawning = Timings.ofSafe(name + "Mob spawning - Misc"); @@ -199,7 +199,7 @@ index af810987846efcd2bffbd23c31481b2d31c168dd..331493a172f58e71b464d635efdba461 doChunkInfo(sender, args); break; diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index dbd14399707cdd43f98af40191be8ff3e76edf43..74295466e53db06d0d019a13768f3575ac61d699 100644 +index f9b1b198299166759fe0bd0a36d8d88c626e06a4..bf86444c479f346e7d56f10a7c0ebefd62f08f59 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java @@ -1,5 +1,6 @@ @@ -209,7 +209,7 @@ index dbd14399707cdd43f98af40191be8ff3e76edf43..74295466e53db06d0d019a13768f3575 import com.google.common.base.Strings; import com.google.common.base.Throwables; -@@ -367,4 +368,54 @@ public class PaperConfig { +@@ -347,4 +348,54 @@ public class PaperConfig { maxBookPageSize = getInt("settings.book-size.page-max", maxBookPageSize); maxBookTotalSizeMultiplier = getDouble("settings.book-size.total-multiplier", maxBookTotalSizeMultiplier); } @@ -334,14 +334,13 @@ index 0000000000000000000000000000000000000000..5af0ac3d9e87c06053e65433060f1577 +} diff --git a/src/main/java/com/destroystokyo/paper/io/PaperFileIOThread.java b/src/main/java/com/destroystokyo/paper/io/PaperFileIOThread.java new file mode 100644 -index 0000000000000000000000000000000000000000..a6434b4e28a73ecab4350862c5747b7494761ba0 +index 0000000000000000000000000000000000000000..1917d7be7dfddc93c95b9fd864cf13f9a24c8f96 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/io/PaperFileIOThread.java -@@ -0,0 +1,607 @@ +@@ -0,0 +1,606 @@ +package com.destroystokyo.paper.io; + +import net.minecraft.server.ChunkCoordIntPair; -+import net.minecraft.server.ExceptionWorldConflict; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.NBTTagCompound; +import net.minecraft.server.RegionFile; @@ -882,15 +881,15 @@ index 0000000000000000000000000000000000000000..a6434b4e28a73ecab4350862c5747b74 + } + + // check if another process is writing -+ try { -+ this.world.checkSession(); -+ } catch (final ExceptionWorldConflict ex) { ++ /*try { TODO: Can we restore this? ++ ((WorldServer)this.world).checkSession(); ++ } catch (final Exception ex) { + LOGGER.fatal("Couldn't save chunk; already in use by another instance of Minecraft?", ex); + // we don't need to set the write counter to -1 as we know at this stage there's no point in re-scheduling + // writes since they'll fail anyways. + return; + } -+ ++*/ + for (;;) { + final long writeCounter; + final NBTTagCompound data; @@ -1477,7 +1476,7 @@ index 0000000000000000000000000000000000000000..ee906b594b306906c170180a29a8b619 +} diff --git a/src/main/java/com/destroystokyo/paper/io/chunk/ChunkLoadTask.java b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkLoadTask.java new file mode 100644 -index 0000000000000000000000000000000000000000..044c3da825505f9dc002c02296bf2de51ceef01e +index 0000000000000000000000000000000000000000..6367092663a213793367ccb65733afc119e4883c --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkLoadTask.java @@ -0,0 +1,146 @@ @@ -1575,7 +1574,7 @@ index 0000000000000000000000000000000000000000..044c3da825505f9dc002c02296bf2de5 + // apply fixes + + try { -+ chunkData.chunkData = chunkManager.getChunkData(this.world.getWorldProvider().getDimensionManager(), ++ chunkData.chunkData = chunkManager.getChunkData(this.world.getTypeKey(), + chunkManager.getWorldPersistentDataSupplier(), chunkData.chunkData, chunkPos, this.world); // clone data for safety, file IO thread does not clone + } catch (final Throwable ex) { + PaperFileIOThread.LOGGER.error("Could not apply datafixers for chunk task: " + this.toString(), ex); @@ -1793,7 +1792,7 @@ index 0000000000000000000000000000000000000000..1dfa8abfd869ca97e4cc566d44e509b4 +} diff --git a/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTaskManager.java b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTaskManager.java new file mode 100644 -index 0000000000000000000000000000000000000000..b5c2e1f4a2b5fdcaa6bb01f4b3b6847cd5b73ae8 +index 0000000000000000000000000000000000000000..49a594e5f345096cb3b9913b8ee2760795c5f012 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTaskManager.java @@ -0,0 +1,511 @@ @@ -1974,7 +1973,7 @@ index 0000000000000000000000000000000000000000..b5c2e1f4a2b5fdcaa6bb01f4b3b6847c + + for (int i = 0; i < threads; ++i) { + this.workers[i] = new QueueExecutorThread<>(this.queue, (long)0.10e6); //0.1ms -+ this.workers[i].setName("Async chunk loader thread #" + i + " for world: " + world.getWorldData().getName()); ++ this.workers[i].setName("Async chunk loader thread #" + i + " for world: " + world.getWorld().getName()); + this.workers[i].setPriority(Thread.NORM_PRIORITY - 1); + this.workers[i].setUncaughtExceptionHandler((final Thread thread, final Throwable throwable) -> { + PaperFileIOThread.LOGGER.fatal("Thread '" + thread.getName() + "' threw an uncaught exception!", throwable); @@ -2309,10 +2308,10 @@ index 0000000000000000000000000000000000000000..b5c2e1f4a2b5fdcaa6bb01f4b3b6847c + +} diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index d8647f272bdb29518b1a7faafa6fbcb53ffe1163..981cf581c7504c38120d48c06b6351952fab43c0 100644 +index f2ff1aa915c218bb1fc72467ccbd73ccf135c494..edd901bb53385fa3d189a0057d57f98bf8b7115c 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -309,11 +309,138 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -310,11 +310,138 @@ public class ChunkProviderServer extends IChunkProvider { return playerChunk.getAvailableChunkNow(); } @@ -2451,7 +2450,7 @@ index d8647f272bdb29518b1a7faafa6fbcb53ffe1163..981cf581c7504c38120d48c06b635195 if (Thread.currentThread() != this.serverThread) { return (IChunkAccess) CompletableFuture.supplyAsync(() -> { return this.getChunkAt(i, j, chunkstatus, flag); -@@ -336,11 +463,16 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -337,11 +464,16 @@ public class ChunkProviderServer extends IChunkProvider { } gameprofilerfiller.c("getChunkCacheMiss"); @@ -2469,7 +2468,7 @@ index d8647f272bdb29518b1a7faafa6fbcb53ffe1163..981cf581c7504c38120d48c06b635195 this.world.timings.syncChunkLoad.stopTiming(); // Paper } // Paper ichunkaccess = (IChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> { -@@ -406,6 +538,11 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -407,6 +539,11 @@ public class ChunkProviderServer extends IChunkProvider { } private CompletableFuture> getChunkFutureMainThread(int i, int j, ChunkStatus chunkstatus, boolean flag) { @@ -2481,7 +2480,7 @@ index d8647f272bdb29518b1a7faafa6fbcb53ffe1163..981cf581c7504c38120d48c06b635195 ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i, j); long k = chunkcoordintpair.pair(); int l = 33 + ChunkStatus.a(chunkstatus); -@@ -845,11 +982,12 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -806,11 +943,12 @@ public class ChunkProviderServer extends IChunkProvider { protected boolean executeNext() { // CraftBukkit start - process pending Chunk loadCallback() and unloadCallback() after each run task try { @@ -2496,7 +2495,7 @@ index d8647f272bdb29518b1a7faafa6fbcb53ffe1163..981cf581c7504c38120d48c06b635195 } finally { playerChunkMap.callbackExecutor.run(); diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index d287ea55c550dbebbbc1d5f815296ae7ba6315e9..34cd09a503bfe617bd50808927bae0ccf43e53fc 100644 +index be3c7a8697c540d03a143b9306311a184474857f..4d6e8f987233ca6c5f53d004031c022bb2d43e1e 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java @@ -6,6 +6,7 @@ import it.unimi.dsi.fastutil.longs.LongOpenHashSet; @@ -2507,7 +2506,7 @@ index d287ea55c550dbebbbc1d5f815296ae7ba6315e9..34cd09a503bfe617bd50808927bae0cc import java.util.Arrays; import java.util.BitSet; import java.util.EnumSet; -@@ -22,7 +23,29 @@ public class ChunkRegionLoader { +@@ -23,7 +24,29 @@ public class ChunkRegionLoader { private static final Logger LOGGER = LogManager.getLogger(); @@ -2534,10 +2533,10 @@ index d287ea55c550dbebbbc1d5f815296ae7ba6315e9..34cd09a503bfe617bd50808927bae0cc + public static InProgressChunkHolder loadChunk(WorldServer worldserver, DefinedStructureManager definedstructuremanager, VillagePlace villageplace, ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound, boolean distinguish) { + ArrayDeque tasksToExecuteOnMain = new ArrayDeque<>(); + // Paper end - ChunkGenerator chunkgenerator = worldserver.getChunkProvider().getChunkGenerator(); + ChunkGenerator chunkgenerator = worldserver.getChunkProvider().getChunkGenerator(); WorldChunkManager worldchunkmanager = chunkgenerator.getWorldChunkManager(); NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("Level"); -@@ -49,7 +72,9 @@ public class ChunkRegionLoader { +@@ -50,7 +73,9 @@ public class ChunkRegionLoader { LightEngine lightengine = chunkproviderserver.getLightEngine(); if (flag) { @@ -2548,7 +2547,7 @@ index d287ea55c550dbebbbc1d5f815296ae7ba6315e9..34cd09a503bfe617bd50808927bae0cc } for (int i = 0; i < nbttaglist.size(); ++i) { -@@ -65,16 +90,30 @@ public class ChunkRegionLoader { +@@ -66,16 +91,28 @@ public class ChunkRegionLoader { achunksection[b0] = chunksection; } @@ -2560,29 +2559,27 @@ index d287ea55c550dbebbbc1d5f815296ae7ba6315e9..34cd09a503bfe617bd50808927bae0cc if (flag) { if (nbttagcompound2.hasKeyOfType("BlockLight", 7)) { -- lightengine.a(EnumSkyBlock.BLOCK, SectionPosition.a(chunkcoordintpair, b0), new NibbleArray(nbttagcompound2.getByteArray("BlockLight"))); +- lightengine.a(EnumSkyBlock.BLOCK, SectionPosition.a(chunkcoordintpair, b0), new NibbleArray(nbttagcompound2.getByteArray("BlockLight")), true); + // Paper start - delay this task since we're executing off-main + NibbleArray blockLight = new NibbleArray(nbttagcompound2.getByteArray("BlockLight")); -+ // Note: We move the block light nibble array creation here for perf & in case the compound is modified + tasksToExecuteOnMain.add(() -> { -+ lightengine.a(EnumSkyBlock.BLOCK, SectionPosition.a(chunkcoordintpair, b0), blockLight); ++ lightengine.a(EnumSkyBlock.BLOCK, SectionPosition.a(chunkcoordintpair, b0), blockLight, true); + }); -+ // Paper end ++ // Paper end - delay this task since we're executing off-main } if (flag2 && nbttagcompound2.hasKeyOfType("SkyLight", 7)) { -- lightengine.a(EnumSkyBlock.SKY, SectionPosition.a(chunkcoordintpair, b0), new NibbleArray(nbttagcompound2.getByteArray("SkyLight"))); +- lightengine.a(EnumSkyBlock.SKY, SectionPosition.a(chunkcoordintpair, b0), new NibbleArray(nbttagcompound2.getByteArray("SkyLight")), true); + // Paper start - delay this task since we're executing off-main + NibbleArray skyLight = new NibbleArray(nbttagcompound2.getByteArray("SkyLight")); -+ // Note: We move the block light nibble array creation here for perf & in case the compound is modified + tasksToExecuteOnMain.add(() -> { -+ lightengine.a(EnumSkyBlock.SKY, SectionPosition.a(chunkcoordintpair, b0), skyLight); ++ lightengine.a(EnumSkyBlock.SKY, SectionPosition.a(chunkcoordintpair, b0), skyLight, true); + }); -+ // Paper end ++ // Paper end - delay this task since we're executing off-main } } } -@@ -177,7 +216,7 @@ public class ChunkRegionLoader { +@@ -178,7 +215,7 @@ public class ChunkRegionLoader { } if (chunkstatus_type == ChunkStatus.Type.LEVELCHUNK) { @@ -2591,15 +2588,15 @@ index d287ea55c550dbebbbc1d5f815296ae7ba6315e9..34cd09a503bfe617bd50808927bae0cc } else { ProtoChunk protochunk1 = (ProtoChunk) object; -@@ -216,11 +255,83 @@ public class ChunkRegionLoader { +@@ -217,11 +254,83 @@ public class ChunkRegionLoader { protochunk1.a(worldgenstage_features, BitSet.valueOf(nbttagcompound5.getByteArray(s1))); } - return protochunk1; + return new InProgressChunkHolder(protochunk1, tasksToExecuteOnMain); // Paper - Async chunk loading - } - } - ++ } ++ } ++ + // Paper start - async chunk save for unload + public static final class AsyncSaveData { + public final NibbleArray[] blockLight; // null or size of 17 (for indices -1 through 15) @@ -2617,9 +2614,9 @@ index d287ea55c550dbebbbc1d5f815296ae7ba6315e9..34cd09a503bfe617bd50808927bae0cc + this.blockTickList = blockTickList; + this.fluidTickList = fluidTickList; + this.worldTime = worldTime; -+ } -+ } -+ + } + } + + // must be called sync + public static AsyncSaveData getAsyncSaveData(WorldServer world, IChunkAccess chunk) { + org.spigotmc.AsyncCatcher.catchOp("preparation of chunk data for async save"); @@ -2676,7 +2673,7 @@ index d287ea55c550dbebbbc1d5f815296ae7ba6315e9..34cd09a503bfe617bd50808927bae0cc ChunkCoordIntPair chunkcoordintpair = ichunkaccess.getPos(); NBTTagCompound nbttagcompound = new NBTTagCompound(); NBTTagCompound nbttagcompound1 = new NBTTagCompound(); -@@ -229,7 +340,7 @@ public class ChunkRegionLoader { +@@ -230,7 +339,7 @@ public class ChunkRegionLoader { nbttagcompound.set("Level", nbttagcompound1); nbttagcompound1.setInt("xPos", chunkcoordintpair.x); nbttagcompound1.setInt("zPos", chunkcoordintpair.z); @@ -2685,7 +2682,7 @@ index d287ea55c550dbebbbc1d5f815296ae7ba6315e9..34cd09a503bfe617bd50808927bae0cc nbttagcompound1.setLong("InhabitedTime", ichunkaccess.getInhabitedTime()); nbttagcompound1.setString("Status", ichunkaccess.getChunkStatus().d()); ChunkConverter chunkconverter = ichunkaccess.p(); -@@ -245,14 +356,22 @@ public class ChunkRegionLoader { +@@ -246,14 +355,22 @@ public class ChunkRegionLoader { NBTTagCompound nbttagcompound2; @@ -2712,7 +2709,7 @@ index d287ea55c550dbebbbc1d5f815296ae7ba6315e9..34cd09a503bfe617bd50808927bae0cc if (chunksection != Chunk.a || nibblearray != null || nibblearray1 != null) { nbttagcompound2 = new NBTTagCompound(); nbttagcompound2.setByte("Y", (byte) (i & 255)); -@@ -313,7 +432,7 @@ public class ChunkRegionLoader { +@@ -314,7 +431,7 @@ public class ChunkRegionLoader { Entity entity = (Entity) iterator1.next(); NBTTagCompound nbttagcompound4 = new NBTTagCompound(); // Paper start @@ -2721,7 +2718,7 @@ index d287ea55c550dbebbbc1d5f815296ae7ba6315e9..34cd09a503bfe617bd50808927bae0cc toUpdate.add(entity); continue; } -@@ -353,24 +472,32 @@ public class ChunkRegionLoader { +@@ -357,24 +474,32 @@ public class ChunkRegionLoader { } nbttagcompound1.set("Entities", nbttaglist2); @@ -2731,8 +2728,7 @@ index d287ea55c550dbebbbc1d5f815296ae7ba6315e9..34cd09a503bfe617bd50808927bae0cc if (ticklist instanceof ProtoChunkTickList) { nbttagcompound1.set("ToBeTicked", ((ProtoChunkTickList) ticklist).b()); } else if (ticklist instanceof TickListChunk) { -- nbttagcompound1.set("TileTicks", ((TickListChunk) ticklist).a(worldserver.getTime())); -+ nbttagcompound1.set("TileTicks", ((TickListChunk) ticklist).a(asyncsavedata != null ? asyncsavedata.worldTime : worldserver.getTime())); // Paper - async chunk unloading + nbttagcompound1.set("TileTicks", ((TickListChunk) ticklist).b()); + // Paper start - async chunk save for unload + } else if (asyncsavedata != null) { + nbttagcompound1.set("TileTicks", asyncsavedata.blockTickList); @@ -2748,23 +2744,22 @@ index d287ea55c550dbebbbc1d5f815296ae7ba6315e9..34cd09a503bfe617bd50808927bae0cc if (ticklist1 instanceof ProtoChunkTickList) { nbttagcompound1.set("LiquidsToBeTicked", ((ProtoChunkTickList) ticklist1).b()); } else if (ticklist1 instanceof TickListChunk) { -- nbttagcompound1.set("LiquidTicks", ((TickListChunk) ticklist1).a(worldserver.getTime())); -+ nbttagcompound1.set("LiquidTicks", ((TickListChunk) ticklist1).a(asyncsavedata != null ? asyncsavedata.worldTime : worldserver.getTime())); // Paper - async chunk unloading + nbttagcompound1.set("LiquidTicks", ((TickListChunk) ticklist1).b()); + // Paper start - async chunk save for unload + } else if (asyncsavedata != null) { + nbttagcompound1.set("LiquidTicks", asyncsavedata.fluidTickList); + // Paper end } else { - nbttagcompound1.set("LiquidTicks", worldserver.getFluidTickList().a(chunkcoordintpair)); -+ nbttagcompound1.set("LiquidTicks", worldserver.getFluidTickList().a(chunkcoordintpair)); // Paper - diff on method change (see getAsyncSaveData) ++ nbttagcompound1.set("LiquidTicks", worldserver.getFluidTickList().a(chunkcoordintpair)); // Paper - diff on method change (see getAsyncSaveData) } nbttagcompound1.set("PostProcessing", a(ichunkaccess.l())); diff --git a/src/main/java/net/minecraft/server/ChunkStatus.java b/src/main/java/net/minecraft/server/ChunkStatus.java -index 134a4f0b7d254b5dd8ca26a9c5874532826978c4..40ce30cdc2a07b7a9c2d1f33070e87259f27cd27 100644 +index 0939e015aad7d3fcc7908afcabee0100c4deee40..36c26512297430cf072b549614990b064db94152 100644 --- a/src/main/java/net/minecraft/server/ChunkStatus.java +++ b/src/main/java/net/minecraft/server/ChunkStatus.java -@@ -153,6 +153,7 @@ public class ChunkStatus { +@@ -159,6 +159,7 @@ public class ChunkStatus { return ChunkStatus.q.size(); } @@ -2772,7 +2767,7 @@ index 134a4f0b7d254b5dd8ca26a9c5874532826978c4..40ce30cdc2a07b7a9c2d1f33070e8725 public static int a(ChunkStatus chunkstatus) { return ChunkStatus.r.getInt(chunkstatus.c()); } -@@ -168,6 +169,7 @@ public class ChunkStatus { +@@ -174,6 +175,7 @@ public class ChunkStatus { this.t = chunkstatus == null ? 0 : chunkstatus.c() + 1; } @@ -2780,7 +2775,7 @@ index 134a4f0b7d254b5dd8ca26a9c5874532826978c4..40ce30cdc2a07b7a9c2d1f33070e8725 public int c() { return this.t; } -@@ -189,6 +191,7 @@ public class ChunkStatus { +@@ -195,6 +197,7 @@ public class ChunkStatus { return this.w.doWork(this, worldserver, definedstructuremanager, lightenginethreaded, function, ichunkaccess); } @@ -2788,7 +2783,7 @@ index 134a4f0b7d254b5dd8ca26a9c5874532826978c4..40ce30cdc2a07b7a9c2d1f33070e8725 public int f() { return this.x; } -@@ -216,6 +219,7 @@ public class ChunkStatus { +@@ -222,6 +225,7 @@ public class ChunkStatus { return this.z; } @@ -2797,7 +2792,7 @@ index 134a4f0b7d254b5dd8ca26a9c5874532826978c4..40ce30cdc2a07b7a9c2d1f33070e8725 return this.c() >= chunkstatus.c(); } diff --git a/src/main/java/net/minecraft/server/IAsyncTaskHandler.java b/src/main/java/net/minecraft/server/IAsyncTaskHandler.java -index 7e5ece9d50af7151ad4cc084e3680dae41ac92be..cfe43e882e524b6ab3d9702e81269c97e6b75eba 100644 +index 1ba26ee10f338edbec0f580bb55d083a3d6d2284..63fdae15ccbef0c39718b320dbd096794bcfa3b4 100644 --- a/src/main/java/net/minecraft/server/IAsyncTaskHandler.java +++ b/src/main/java/net/minecraft/server/IAsyncTaskHandler.java @@ -91,7 +91,7 @@ public abstract class IAsyncTaskHandler implements Mailbox { + DedicatedServer dedicatedserver1 = new DedicatedServer(optionset, datapackconfiguration1, thread, iregistrycustom_dimension, convertable_conversionsession, resourcepackrepository, datapackresources, null, dedicatedserversettings, DataConverterRegistry.a(), minecraftsessionservice, gameprofilerepository, usercache, WorldLoadListenerLogger::new); + diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 7920d24ab089fb8360ef74946cf7dc35cb7625eb..9450e27e5ce9295d87b95be2797fc27984ca2b0b 100644 +index 4ffd9c1d7b4fc2f42fa157b2235365cab41e295f..0633944364179ffb9b9fdd0400d82fd5b2ab3892 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -780,6 +780,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant> getStatusFutureUnchecked(ChunkStatus chunkstatus) { -@@ -353,7 +365,7 @@ public class PlayerChunk { +@@ -340,7 +352,7 @@ public class PlayerChunk { ChunkStatus chunkstatus = getChunkStatus(this.oldTicketLevel); ChunkStatus chunkstatus1 = getChunkStatus(this.ticketLevel); boolean flag = this.oldTicketLevel <= PlayerChunkMap.GOLDEN_TICKET; @@ -3047,7 +3032,7 @@ index 52ea4f05a0c7f29f62f31bb032a5ceb905107e60..0f1576effe10795bcb8ed3b519f4dbaf PlayerChunk.State playerchunk_state = getChunkState(this.oldTicketLevel); PlayerChunk.State playerchunk_state1 = getChunkState(this.ticketLevel); // CraftBukkit start -@@ -389,6 +401,12 @@ public class PlayerChunk { +@@ -376,6 +388,12 @@ public class PlayerChunk { } }); @@ -3061,19 +3046,19 @@ index 52ea4f05a0c7f29f62f31bb032a5ceb905107e60..0f1576effe10795bcb8ed3b519f4dbaf completablefuture = (CompletableFuture) this.statusFutures.get(i); if (completablefuture != null) { diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 94b0c54d9d4d77b724087be55ffe6ce464a0bbe7..6552bbf06637b08626cbf0fb352123c3e381cb5a 100644 +index 24f3e8a6866bb416f04aca342514fa5dd3d314c8..a10006efc52f093196e7d67a3281a87d4c5df19b 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -63,7 +63,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -64,7 +64,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { private final LightEngineThreaded lightEngine; private final IAsyncTaskHandler executor; - public final ChunkGenerator chunkGenerator; + public final ChunkGenerator chunkGenerator; - private final Supplier l; + private final Supplier l; public final Supplier getWorldPersistentDataSupplier() { return this.l; } // Paper - OBFHELPER private final VillagePlace m; public final LongSet unloadQueue; private boolean updatingChunksModified; -@@ -73,7 +73,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -74,7 +74,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { public final WorldLoadListener worldLoadListener; public final PlayerChunkMap.a chunkDistanceManager; public final PlayerChunkMap.a getChunkMapDistanceManager() { return this.chunkDistanceManager; } // Paper - OBFHELPER private final AtomicInteger u; @@ -3082,16 +3067,16 @@ index 94b0c54d9d4d77b724087be55ffe6ce464a0bbe7..6552bbf06637b08626cbf0fb352123c3 private final File w; private final PlayerMap playerMap; public final Int2ObjectMap trackedEntities; -@@ -156,7 +156,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - this.lightEngine = new LightEngineThreaded(ilightaccess, this, this.world.getWorldProvider().f(), threadedmailbox1, this.p.a(threadedmailbox1, false)); +@@ -157,7 +157,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + this.lightEngine = new LightEngineThreaded(ilightaccess, this, this.world.getDimensionManager().hasSkyLight(), threadedmailbox1, this.p.a(threadedmailbox1, false)); this.chunkDistanceManager = new PlayerChunkMap.a(executor, iasynctaskhandler); this.l = supplier; -- this.m = new VillagePlace(new File(this.w, "poi"), datafixer); -+ this.m = new VillagePlace(new File(this.w, "poi"), datafixer, this.world); // Paper +- this.m = new VillagePlace(new File(this.w, "poi"), datafixer, flag); ++ this.m = new VillagePlace(new File(this.w, "poi"), datafixer, flag, this.world); // Paper this.setViewDistance(i); } -@@ -203,7 +203,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -204,7 +204,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } @Nullable @@ -3100,7 +3085,7 @@ index 94b0c54d9d4d77b724087be55ffe6ce464a0bbe7..6552bbf06637b08626cbf0fb352123c3 return (PlayerChunk) this.visibleChunks.get(i); } -@@ -325,6 +325,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -326,6 +326,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { public void close() throws IOException { try { this.p.close(); @@ -3108,7 +3093,7 @@ index 94b0c54d9d4d77b724087be55ffe6ce464a0bbe7..6552bbf06637b08626cbf0fb352123c3 this.m.close(); } finally { super.close(); -@@ -416,7 +417,8 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -417,7 +418,8 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { this.b(() -> { return true; }); @@ -3118,7 +3103,7 @@ index 94b0c54d9d4d77b724087be55ffe6ce464a0bbe7..6552bbf06637b08626cbf0fb352123c3 PlayerChunkMap.LOGGER.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", this.w.getName()); } else { this.visibleChunks.values().stream().filter(PlayerChunk::hasBeenLoaded).forEach((playerchunk) -> { -@@ -432,16 +434,20 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -433,16 +435,20 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } @@ -3140,7 +3125,7 @@ index 94b0c54d9d4d77b724087be55ffe6ce464a0bbe7..6552bbf06637b08626cbf0fb352123c3 } gameprofilerfiller.exit(); -@@ -462,12 +468,13 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -463,12 +469,13 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { if (playerchunk != null) { this.pendingUnload.put(j, playerchunk); this.updatingChunksModified = true; @@ -3155,7 +3140,7 @@ index 94b0c54d9d4d77b724087be55ffe6ce464a0bbe7..6552bbf06637b08626cbf0fb352123c3 } } activityAccountant.endActivity(); // Spigot -@@ -481,6 +488,60 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -482,6 +489,60 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } @@ -3216,7 +3201,7 @@ index 94b0c54d9d4d77b724087be55ffe6ce464a0bbe7..6552bbf06637b08626cbf0fb352123c3 private void a(long i, PlayerChunk playerchunk) { CompletableFuture completablefuture = playerchunk.getChunkSave(); Consumer consumer = (ichunkaccess) -> { // CraftBukkit - decompile error -@@ -494,7 +555,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -495,7 +556,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { ((Chunk) ichunkaccess).setLoaded(false); } @@ -3225,7 +3210,7 @@ index 94b0c54d9d4d77b724087be55ffe6ce464a0bbe7..6552bbf06637b08626cbf0fb352123c3 if (this.loadedChunks.remove(i) && ichunkaccess instanceof Chunk) { Chunk chunk = (Chunk) ichunkaccess; -@@ -502,6 +563,13 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -503,6 +564,13 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } this.autoSaveQueue.remove(playerchunk); // Paper @@ -3239,16 +3224,9 @@ index 94b0c54d9d4d77b724087be55ffe6ce464a0bbe7..6552bbf06637b08626cbf0fb352123c3 this.lightEngine.a(ichunkaccess.getPos()); this.lightEngine.queueUpdate(); this.worldLoadListener.a(ichunkaccess.getPos(), (ChunkStatus) null); -@@ -571,27 +639,32 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - } +@@ -573,19 +641,21 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } -+ // Paper start - Async chunk io -+ public NBTTagCompound completeChunkData(NBTTagCompound compound, ChunkCoordIntPair chunkcoordintpair) throws IOException { -+ return compound == null ? null : this.getChunkData(this.world.getWorldProvider().getDimensionManager(), this.getWorldPersistentDataSupplier(), compound, chunkcoordintpair, this.world); -+ } -+ // Paper end -+ private CompletableFuture> f(ChunkCoordIntPair chunkcoordintpair) { - return CompletableFuture.supplyAsync(() -> { + // Paper start - Async chunk io @@ -3259,38 +3237,27 @@ index 94b0c54d9d4d77b724087be55ffe6ce464a0bbe7..6552bbf06637b08626cbf0fb352123c3 - try (Timing ignored2 = this.world.timings.chunkIO.startTimingIfSync()) { // Paper start - timings - nbttagcompound = this.readChunkData(chunkcoordintpair); - } // Paper end -- ++ // Paper start ++ if (ioThrowable != null) { ++ com.destroystokyo.paper.util.SneakyThrow.sneaky(ioThrowable); ++ } ++ chunkHolder.tasks.forEach(Runnable::run); ++ // Paper end + - if (nbttagcompound != null) {try (Timing ignored2 = this.world.timings.chunkLoadLevelTimer.startTimingIfSync()) { // Paper start - timings - boolean flag = nbttagcompound.hasKeyOfType("Level", 10) && nbttagcompound.getCompound("Level").hasKeyOfType("Status", 8); -+ if (ioThrowable != null) { -+ com.destroystokyo.paper.io.IOUtil.rethrow(ioThrowable); -+ } ++ if (chunkHolder.protoChunk != null) {try (Timing ignored2 = this.world.timings.chunkLoadLevelTimer.startTimingIfSync()) { // Paper start - timings // Paper - chunk is created async - if (flag) { - ProtoChunk protochunk = ChunkRegionLoader.loadChunk(this.world, this.definedStructureManager, this.m, chunkcoordintpair, nbttagcompound); -+ this.getVillagePlace().loadInData(chunkcoordintpair, chunkHolder.poiData); -+ chunkHolder.tasks.forEach(Runnable::run); -+ // Paper - async load completes this -+ // Paper end ++ if (true) { ++ ProtoChunk protochunk = chunkHolder.protoChunk; -- protochunk.setLastSaved(this.world.getTime()); -- return Either.left(protochunk); -- } -- -- PlayerChunkMap.LOGGER.error("Chunk file at {} is missing level data, skipping", chunkcoordintpair); -- }} // Paper -+ // Paper start - This is done async -+ if (chunkHolder.protoChunk != null) { -+ chunkHolder.protoChunk.setLastSaved(this.world.getTime()); -+ return Either.left(chunkHolder.protoChunk); -+ } -+ // Paper end - } catch (ReportedException reportedexception) { - Throwable throwable = reportedexception.getCause(); - -@@ -605,7 +678,32 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - } + protochunk.setLastSaved(this.world.getTime()); + this.a(chunkcoordintpair, protochunk.getChunkStatus().getType()); +@@ -609,7 +679,32 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + this.g(chunkcoordintpair); return Either.left(new ProtoChunk(chunkcoordintpair, ChunkConverter.a, this.world)); // Paper - Anti-Xray - Add parameter - }, this.executor); + // Paper start - Async chunk io @@ -3321,8 +3288,8 @@ index 94b0c54d9d4d77b724087be55ffe6ce464a0bbe7..6552bbf06637b08626cbf0fb352123c3 + // Paper end } - private CompletableFuture> b(PlayerChunk playerchunk, ChunkStatus chunkstatus) { -@@ -824,17 +922,12 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + private void g(ChunkCoordIntPair chunkcoordintpair) { +@@ -836,6 +931,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } public boolean saveChunk(IChunkAccess ichunkaccess) { @@ -3330,52 +3297,46 @@ index 94b0c54d9d4d77b724087be55ffe6ce464a0bbe7..6552bbf06637b08626cbf0fb352123c3 this.m.a(ichunkaccess.getPos()); if (!ichunkaccess.isNeedsSaving()) { return false; - } else { -- try { -- this.world.checkSession(); -- } catch (ExceptionWorldConflict exceptionworldconflict) { -- PlayerChunkMap.LOGGER.error("Couldn't save chunk; already in use by another instance of Minecraft?", exceptionworldconflict); -- com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(exceptionworldconflict); // Paper -- return false; -- } -+ // Paper - The save session check is performed on the IO thread - - ichunkaccess.setLastSaved(this.world.getTime()); - ichunkaccess.setNeedsSaving(false); -@@ -845,6 +938,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - NBTTagCompound nbttagcompound; +@@ -848,6 +944,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + ChunkStatus chunkstatus = ichunkaccess.getChunkStatus(); if (chunkstatus.getType() != ChunkStatus.Type.LEVELCHUNK) { + try (co.aikar.timings.Timing ignored1 = this.world.timings.chunkSaveOverwriteCheck.startTiming()) { // Paper - // Paper start - Optimize save by using status cache - ChunkStatus statusOnDisk = this.getChunkStatusOnDisk(chunkcoordintpair); - if (statusOnDisk != null && statusOnDisk.getType() == ChunkStatus.Type.LEVELCHUNK) { -@@ -857,9 +951,15 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + if (this.h(chunkcoordintpair)) { + return false; } +@@ -855,12 +952,20 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + if (chunkstatus == ChunkStatus.EMPTY && ichunkaccess.h().values().stream().noneMatch(StructureStart::e)) { + return false; + } ++ } // Paper } -+ } // Paper this.world.getMethodProfiler().c("chunkSave"); +- NBTTagCompound nbttagcompound = ChunkRegionLoader.saveChunk(this.world, ichunkaccess); ++ NBTTagCompound nbttagcompound; + try (co.aikar.timings.Timing ignored1 = this.world.timings.chunkSaveDataSerialization.startTiming()) { // Paper - nbttagcompound = ChunkRegionLoader.saveChunk(this.world, ichunkaccess); -- this.a(chunkcoordintpair, nbttagcompound); ++ nbttagcompound = ChunkRegionLoader.saveChunk(this.world, ichunkaccess); + } // Paper ++ + +- this.a(chunkcoordintpair, nbttagcompound); + // Paper start - async chunk io + com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE.scheduleSave(this.world, chunkcoordintpair.x, chunkcoordintpair.z, + null, nbttagcompound, com.destroystokyo.paper.io.PrioritizedTaskQueue.NORMAL_PRIORITY); + // Paper end - async chunk io + this.a(chunkcoordintpair, chunkstatus.getType()); return true; } catch (Exception exception) { - PlayerChunkMap.LOGGER.error("Failed to save chunk {},{}", chunkcoordintpair.x, chunkcoordintpair.z, exception); -@@ -867,6 +967,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -869,6 +974,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { return false; } } + } // Paper } - protected void setViewDistance(int i) { -@@ -970,6 +1071,35 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + private boolean h(ChunkCoordIntPair chunkcoordintpair) { +@@ -998,6 +1104,35 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } } @@ -3411,20 +3372,20 @@ index 94b0c54d9d4d77b724087be55ffe6ce464a0bbe7..6552bbf06637b08626cbf0fb352123c3 @Nullable public NBTTagCompound readChunkData(ChunkCoordIntPair chunkcoordintpair) throws IOException { // Paper - private -> public NBTTagCompound nbttagcompound = this.read(chunkcoordintpair); -@@ -992,33 +1122,55 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1019,33 +1154,55 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { // Paper start - chunk status cache "api" public ChunkStatus getChunkStatusOnDiskIfCached(ChunkCoordIntPair chunkPos) { - RegionFile regionFile = this.getIOWorker().getRegionFileCache().getRegionFileIfLoaded(chunkPos); + synchronized (this) { // Paper -+ RegionFile regionFile = this.getRegionFileIfLoaded(chunkPos); ++ RegionFile regionFile = this.regionFileCache.getRegionFileIfLoaded(chunkPos); return regionFile == null ? null : regionFile.getStatusIfCached(chunkPos.x, chunkPos.z); + } // Paper } public ChunkStatus getChunkStatusOnDisk(ChunkCoordIntPair chunkPos) throws IOException { -- RegionFile regionFile = this.getIOWorker().getRegionFileCache().getFile(chunkPos, false); +- RegionFile regionFile = this.getIOWorker().getRegionFileCache().getFile(chunkPos, true); + // Paper start - async chunk save for unload + IChunkAccess unloadingChunk = this.world.asyncChunkTaskManager.getChunkInSaveProgress(chunkPos.x, chunkPos.z); + if (unloadingChunk != null) { @@ -3435,20 +3396,20 @@ index 94b0c54d9d4d77b724087be55ffe6ce464a0bbe7..6552bbf06637b08626cbf0fb352123c3 + NBTTagCompound inProgressWrite = com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE + .getPendingWrite(this.world, chunkPos.x, chunkPos.z, false); -- if (!regionFile.chunkExists(chunkPos)) { +- if (regionFile == null || !regionFile.chunkExists(chunkPos)) { - return null; + if (inProgressWrite != null) { + return ChunkRegionLoader.getStatus(inProgressWrite); } + // Paper end + synchronized (this) { // Paper - async io -+ RegionFile regionFile = this.getFile(chunkPos, false); -+ -+ if (!regionFile.chunkExists(chunkPos)) { -+ return null; -+ } ++ RegionFile regionFile = this.regionFileCache.getFile(chunkPos, true); - ChunkStatus status = regionFile.getStatusIfCached(chunkPos.x, chunkPos.z); ++ if (regionFile == null || !regionFile.chunkExists(chunkPos)) { ++ return null; ++ } ++ + ChunkStatus status = regionFile.getStatusIfCached(chunkPos.x, chunkPos.z); - if (status != null) { @@ -3470,7 +3431,7 @@ index 94b0c54d9d4d77b724087be55ffe6ce464a0bbe7..6552bbf06637b08626cbf0fb352123c3 public void updateChunkStatusOnDisk(ChunkCoordIntPair chunkPos, @Nullable NBTTagCompound compound) throws IOException { - RegionFile regionFile = this.getIOWorker().getRegionFileCache().getFile(chunkPos, false); + synchronized (this) { -+ RegionFile regionFile = this.getFile(chunkPos, false); ++ RegionFile regionFile = this.regionFileCache.getFile(chunkPos, false); - regionFile.setStatus(chunkPos.x, chunkPos.z, ChunkRegionLoader.getStatus(compound)); + regionFile.setStatus(chunkPos.x, chunkPos.z, ChunkRegionLoader.getStatus(compound)); @@ -3478,7 +3439,7 @@ index 94b0c54d9d4d77b724087be55ffe6ce464a0bbe7..6552bbf06637b08626cbf0fb352123c3 } public IChunkAccess getUnloadingChunk(int chunkX, int chunkZ) { -@@ -1027,6 +1179,39 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1054,6 +1211,39 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } // Paper end @@ -3506,7 +3467,7 @@ index 94b0c54d9d4d77b724087be55ffe6ce464a0bbe7..6552bbf06637b08626cbf0fb352123c3 + synchronized (world.getChunkProvider().playerChunkMap) { + net.minecraft.server.RegionFile file; + try { -+ file = world.getChunkProvider().playerChunkMap.getFile(chunkPos, false); ++ file = world.getChunkProvider().playerChunkMap.regionFileCache.getFile(chunkPos, false); + } catch (IOException ex) { + throw new RuntimeException(ex); + } @@ -3518,7 +3479,7 @@ index 94b0c54d9d4d77b724087be55ffe6ce464a0bbe7..6552bbf06637b08626cbf0fb352123c3 boolean isOutsideOfRange(ChunkCoordIntPair chunkcoordintpair) { // Spigot start return isOutsideOfRange(chunkcoordintpair, false); -@@ -1374,6 +1559,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1399,6 +1589,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } @@ -3527,10 +3488,10 @@ index 94b0c54d9d4d77b724087be55ffe6ce464a0bbe7..6552bbf06637b08626cbf0fb352123c3 return this.m; } diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index a5700a955b6d7927228a14128860b49e79e61f03..6a7bdf8c5f38ca4eb578e1104375e5773269330c 100644 +index 62a0db6c08047be4ab28f5c23f4ae12694cf003f..70d3b429bfe08f1d2e5a3ac8368d8221770d5307 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -541,6 +541,13 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -544,6 +544,13 @@ public class PlayerConnection implements PacketListenerPlayIn { minecraftServer.scheduleOnMain(() -> this.disconnect(new ChatMessage("disconnect.spam", new Object[0]))); // Paper return; } @@ -3545,7 +3506,7 @@ index a5700a955b6d7927228a14128860b49e79e61f03..6a7bdf8c5f38ca4eb578e1104375e577 StringReader stringreader = new StringReader(packetplayintabcomplete.c()); diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java -index d37abf2cf304f81405e570588c8accbc44a629f4..df728e2c0a2bf660a91e0bd6342c4b4b1471dcb7 100644 +index e1730709fff5dfee68621d0aaed70a00bab97948..93797395c3a710d228bd790771ac18b4baa3b1e2 100644 --- a/src/main/java/net/minecraft/server/RegionFile.java +++ b/src/main/java/net/minecraft/server/RegionFile.java @@ -36,6 +36,8 @@ public class RegionFile implements AutoCloseable { @@ -3557,7 +3518,7 @@ index d37abf2cf304f81405e570588c8accbc44a629f4..df728e2c0a2bf660a91e0bd6342c4b4b // Paper start - Cache chunk status private final ChunkStatus[] statuses = new ChunkStatus[32 * 32]; -@@ -224,7 +226,7 @@ public class RegionFile implements AutoCloseable { +@@ -229,7 +231,7 @@ public class RegionFile implements AutoCloseable { return (i + 4096 - 1) / 4096; } @@ -3566,7 +3527,7 @@ index d37abf2cf304f81405e570588c8accbc44a629f4..df728e2c0a2bf660a91e0bd6342c4b4b int i = this.getOffset(chunkcoordintpair); if (i == 0) { -@@ -380,6 +382,11 @@ public class RegionFile implements AutoCloseable { +@@ -389,6 +391,11 @@ public class RegionFile implements AutoCloseable { } public void close() throws IOException { @@ -3577,9 +3538,9 @@ index d37abf2cf304f81405e570588c8accbc44a629f4..df728e2c0a2bf660a91e0bd6342c4b4b + // Paper end this.closed = true; // Paper try { - this.c(); -@@ -394,6 +401,10 @@ public class RegionFile implements AutoCloseable { - } + this.d(); +@@ -399,6 +406,10 @@ public class RegionFile implements AutoCloseable { + this.dataFile.close(); } } + } finally { // Paper start - Prevent regionfiles from being closed during use @@ -3590,7 +3551,7 @@ index d37abf2cf304f81405e570588c8accbc44a629f4..df728e2c0a2bf660a91e0bd6342c4b4b } diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java -index 2f8af42e2aadeb1b11db94fdb54ec0ba9e30f095..72118a7dcfabde0f069b8c8b86f41c026a2c99d9 100644 +index 341689ac996164b7b53e095495b92b6e85ab991a..867dc074bc57b27486de6ce742971d5db945b0fc 100644 --- a/src/main/java/net/minecraft/server/RegionFileCache.java +++ b/src/main/java/net/minecraft/server/RegionFileCache.java @@ -9,7 +9,7 @@ import java.io.File; @@ -3602,7 +3563,7 @@ index 2f8af42e2aadeb1b11db94fdb54ec0ba9e30f095..72118a7dcfabde0f069b8c8b86f41c02 public final Long2ObjectLinkedOpenHashMap cache = new Long2ObjectLinkedOpenHashMap(); private final File b; -@@ -20,16 +20,27 @@ public final class RegionFileCache implements AutoCloseable { +@@ -22,16 +22,27 @@ public final class RegionFileCache implements AutoCloseable { // Paper start @@ -3632,8 +3593,8 @@ index 2f8af42e2aadeb1b11db94fdb54ec0ba9e30f095..72118a7dcfabde0f069b8c8b86f41c02 return regionfile; } else { if (this.cache.size() >= com.destroystokyo.paper.PaperConfig.regionFileCacheSize) { // Paper - configurable -@@ -45,6 +56,12 @@ public final class RegionFileCache implements AutoCloseable { - RegionFile regionfile1 = new RegionFile(file, this.b); +@@ -47,6 +58,12 @@ public final class RegionFileCache implements AutoCloseable { + RegionFile regionfile1 = new RegionFile(file, this.b, this.c); this.cache.putAndMoveToFirst(i, regionfile1); + // Paper start @@ -3645,7 +3606,7 @@ index 2f8af42e2aadeb1b11db94fdb54ec0ba9e30f095..72118a7dcfabde0f069b8c8b86f41c02 return regionfile1; } } -@@ -120,11 +137,12 @@ public final class RegionFileCache implements AutoCloseable { +@@ -122,11 +139,12 @@ public final class RegionFileCache implements AutoCloseable { @Nullable public NBTTagCompound read(ChunkCoordIntPair chunkcoordintpair) throws IOException { // CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing @@ -3659,7 +3620,7 @@ index 2f8af42e2aadeb1b11db94fdb54ec0ba9e30f095..72118a7dcfabde0f069b8c8b86f41c02 DataInputStream datainputstream = regionfile.a(chunkcoordintpair); // Paper start if (regionfile.isOversized(chunkcoordintpair.x, chunkcoordintpair.z)) { -@@ -162,10 +180,14 @@ public final class RegionFileCache implements AutoCloseable { +@@ -164,10 +182,14 @@ public final class RegionFileCache implements AutoCloseable { } return nbttagcompound; @@ -3675,7 +3636,7 @@ index 2f8af42e2aadeb1b11db94fdb54ec0ba9e30f095..72118a7dcfabde0f069b8c8b86f41c02 int attempts = 0; Exception laste = null; while (attempts++ < 5) { try { // Paper DataOutputStream dataoutputstream = regionfile.c(chunkcoordintpair); Throwable throwable = null; -@@ -204,9 +226,12 @@ public final class RegionFileCache implements AutoCloseable { +@@ -206,9 +228,12 @@ public final class RegionFileCache implements AutoCloseable { MinecraftServer.LOGGER.error("Failed to save chunk", laste); } // Paper end @@ -3686,10 +3647,10 @@ index 2f8af42e2aadeb1b11db94fdb54ec0ba9e30f095..72118a7dcfabde0f069b8c8b86f41c02 - public void close() throws IOException { + public synchronized void close() throws IOException { // Paper -> synchronized + ExceptionSuppressor exceptionsuppressor = new ExceptionSuppressor<>(); ObjectIterator objectiterator = this.cache.values().iterator(); - while (objectiterator.hasNext()) { -@@ -216,4 +241,12 @@ public final class RegionFileCache implements AutoCloseable { +@@ -235,4 +260,12 @@ public final class RegionFileCache implements AutoCloseable { } } @@ -3703,46 +3664,45 @@ index 2f8af42e2aadeb1b11db94fdb54ec0ba9e30f095..72118a7dcfabde0f069b8c8b86f41c02 + // CraftBukkit end } diff --git a/src/main/java/net/minecraft/server/RegionFileSection.java b/src/main/java/net/minecraft/server/RegionFileSection.java -index db9f0196bda4c987de6cf63eea437b7154d47b57..a6d8ef5eb44f3f851a3a1be4032ca21ab1d7f2b2 100644 +index a39075c68bb04e7183941c5eb80eb7cdde235045..bd0ff1e43a07a3332f9ade49fec2f76275a25c7f 100644 --- a/src/main/java/net/minecraft/server/RegionFileSection.java +++ b/src/main/java/net/minecraft/server/RegionFileSection.java -@@ -20,28 +20,29 @@ import javax.annotation.Nullable; +@@ -21,28 +21,29 @@ import javax.annotation.Nullable; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; --public class RegionFileSection implements AutoCloseable { -+public class RegionFileSection extends RegionFileCache implements AutoCloseable { // Paper - nuke IOWorker +-public class RegionFileSection implements AutoCloseable { ++public class RegionFileSection extends RegionFileCache implements AutoCloseable { // Paper - nuke IOWorker private static final Logger LOGGER = LogManager.getLogger(); - private final IOWorker b; -+// private final IOWorker b; ++ // Paper - nuke IOWorker private final Long2ObjectMap> c = new Long2ObjectOpenHashMap(); - private final LongLinkedOpenHashSet d = new LongLinkedOpenHashSet(); + protected final LongLinkedOpenHashSet d = new LongLinkedOpenHashSet(); // Paper - private -> protected - private final BiFunction, R> e; + private final Function> e; private final Function f; private final DataFixer g; private final DataFixTypes h; - public RegionFileSection(File file, BiFunction, R> bifunction, Function function, DataFixer datafixer, DataFixTypes datafixtypes) { -+ super(file); // Paper - nuke IOWorker - this.e = bifunction; - this.f = function; + public RegionFileSection(File file, Function> function, Function function1, DataFixer datafixer, DataFixTypes datafixtypes, boolean flag) { ++ super(file, flag); // Paper - nuke IOWorker + this.e = function; + this.f = function1; this.g = datafixer; this.h = datafixtypes; -- this.b = new IOWorker(new RegionFileCache(file), file.getName()); -+// this.b = new IOWorker(new RegionFileCache(file), file.getName()); // Paper - nuke IOWorker +- this.b = new IOWorker(file, flag, file.getName()); ++ //this.b = new IOWorker(file, flag, file.getName()); // Paper - nuke IOWorker } protected void a(BooleanSupplier booleansupplier) { -- while (!this.d.isEmpty() && booleansupplier.getAsBoolean()) { -- ChunkCoordIntPair chunkcoordintpair = SectionPosition.a(this.d.firstLong()).u(); -+ while (!this.d.isEmpty() && booleansupplier.getAsBoolean()) { // Paper - conflict here to avoid obfhelpers -+ ChunkCoordIntPair chunkcoordintpair = SectionPosition.a(this.d.firstLong()).u(); // Paper - conflict here to avoid obfhelpers + while (!this.d.isEmpty() && booleansupplier.getAsBoolean()) { +- ChunkCoordIntPair chunkcoordintpair = SectionPosition.a(this.d.firstLong()).r(); ++ ChunkCoordIntPair chunkcoordintpair = SectionPosition.a(this.d.firstLong()).r(); // Paper - conflict here to avoid obfhelpers this.d(chunkcoordintpair); } -@@ -95,13 +96,18 @@ public class RegionFileSection implements AutoC +@@ -96,13 +97,18 @@ public class RegionFileSection implements AutoCloseable { } private void b(ChunkCoordIntPair chunkcoordintpair) { @@ -3763,7 +3723,7 @@ index db9f0196bda4c987de6cf63eea437b7154d47b57..a6d8ef5eb44f3f851a3a1be4032ca21a } catch (IOException ioexception) { RegionFileSection.LOGGER.error("Error reading chunk {} data from disk", chunkcoordintpair, ioexception); return null; -@@ -143,17 +149,31 @@ public class RegionFileSection implements AutoC +@@ -148,17 +154,31 @@ public class RegionFileSection implements AutoCloseable { } private void d(ChunkCoordIntPair chunkcoordintpair) { @@ -3797,19 +3757,19 @@ index db9f0196bda4c987de6cf63eea437b7154d47b57..a6d8ef5eb44f3f851a3a1be4032ca21a private Dynamic a(ChunkCoordIntPair chunkcoordintpair, DynamicOps dynamicops) { Map map = Maps.newHashMap(); -@@ -190,9 +210,9 @@ public class RegionFileSection implements AutoC +@@ -204,9 +224,9 @@ public class RegionFileSection implements AutoCloseable { public void a(ChunkCoordIntPair chunkcoordintpair) { if (!this.d.isEmpty()) { for (int i = 0; i < 16; ++i) { -- long j = SectionPosition.a(chunkcoordintpair, i).v(); -+ long j = SectionPosition.a(chunkcoordintpair, i).v(); // Paper - conflict here to avoid obfhelpers +- long j = SectionPosition.a(chunkcoordintpair, i).s(); ++ long j = SectionPosition.a(chunkcoordintpair, i).s(); // Paper - conflict here to avoid obfhelpers - if (this.d.contains(j)) { + if (this.d.contains(j)) { // Paper - conflict here to avoid obfhelpers this.d(chunkcoordintpair); return; } -@@ -201,7 +221,26 @@ public class RegionFileSection implements AutoC +@@ -215,7 +235,26 @@ public class RegionFileSection implements AutoCloseable { } @@ -3827,7 +3787,7 @@ index db9f0196bda4c987de6cf63eea437b7154d47b57..a6d8ef5eb44f3f851a3a1be4032ca21a + // This is checking if the data exists, then it builds it later in getDataInternal(ChunkCoordIntPair) + if (!this.d.isEmpty()) { + for (int i = 0; i < 16; ++i) { -+ long j = SectionPosition.a(chunkcoordintpair, i).v(); ++ long j = SectionPosition.a(chunkcoordintpair, i).s(); + + if (this.d.contains(j)) { + return this.getDataInternal(chunkcoordintpair); @@ -3851,27 +3811,27 @@ index 75ab9f185b3231113dfa387c956a707b403bb2db..8055f5998213ab1c6c10d03d88d2b14d public static TicketType a(String s, Comparator comparator) { return new TicketType<>(s, comparator, 0L); diff --git a/src/main/java/net/minecraft/server/VillagePlace.java b/src/main/java/net/minecraft/server/VillagePlace.java -index c999f8c9bf8a59e19b3d6d1b7ad8b5fb6e48b928..1a5ec6152c15a6ece227d4bac00c3b02bd9c5c95 100644 +index b8c15047771bd4527b86e514a3b950b2ffc6eef0..303f6b0953ff3c29bd31ec5e02386a92b11d114a 100644 --- a/src/main/java/net/minecraft/server/VillagePlace.java +++ b/src/main/java/net/minecraft/server/VillagePlace.java -@@ -24,8 +24,16 @@ public class VillagePlace extends RegionFileSection { +@@ -25,8 +25,16 @@ public class VillagePlace extends RegionFileSection { private final VillagePlace.a a = new VillagePlace.a(); private final LongSet b = new LongOpenHashSet(); + private final WorldServer world; // Paper + - public VillagePlace(File file, DataFixer datafixer) { -+ // Paper start -+ this(file, datafixer, null); + public VillagePlace(File file, DataFixer datafixer, boolean flag) { ++ // Paper start - add world parameter ++ this(file, datafixer, flag, null); + } -+ public VillagePlace(File file, DataFixer datafixer, WorldServer world) { -+ // Paper end - super(file, VillagePlaceSection::new, VillagePlaceSection::new, datafixer, DataFixTypes.POI_CHUNK); -+ this.world = world; // Paper ++ public VillagePlace(File file, DataFixer datafixer, boolean flag, WorldServer world) { + super(file, VillagePlaceSection::a, VillagePlaceSection::new, datafixer, DataFixTypes.POI_CHUNK, flag); ++ this.world = world; ++ // Paper end - add world parameter } public void a(BlockPosition blockposition, VillagePlaceType villageplacetype) { -@@ -129,7 +137,23 @@ public class VillagePlace extends RegionFileSection { +@@ -134,7 +142,23 @@ public class VillagePlace extends RegionFileSection { @Override public void a(BooleanSupplier booleansupplier) { @@ -3882,7 +3842,7 @@ index c999f8c9bf8a59e19b3d6d1b7ad8b5fb6e48b928..1a5ec6152c15a6ece227d4bac00c3b02 + } else { + //super.a(booleansupplier); // re-implement below + while (!((RegionFileSection)this).d.isEmpty() && booleansupplier.getAsBoolean()) { -+ ChunkCoordIntPair chunkcoordintpair = SectionPosition.a(((RegionFileSection)this).d.firstLong()).u(); ++ ChunkCoordIntPair chunkcoordintpair = SectionPosition.a(((RegionFileSection)this).d.firstLong()).r(); + + NBTTagCompound data; + try (co.aikar.timings.Timing ignored1 = this.world.timings.poiSaveDataSerialization.startTiming()) { @@ -3896,7 +3856,7 @@ index c999f8c9bf8a59e19b3d6d1b7ad8b5fb6e48b928..1a5ec6152c15a6ece227d4bac00c3b02 this.a.a(); } -@@ -229,6 +253,35 @@ public class VillagePlace extends RegionFileSection { +@@ -234,6 +258,35 @@ public class VillagePlace extends RegionFileSection { } } @@ -3933,11 +3893,11 @@ index c999f8c9bf8a59e19b3d6d1b7ad8b5fb6e48b928..1a5ec6152c15a6ece227d4bac00c3b02 HAS_SPACE(VillagePlaceRecord::d), IS_OCCUPIED(VillagePlaceRecord::e), ANY((villageplacerecord) -> { diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 83585f3ba7ef9e72f3702079a82f62c8b17e4077..83e6c872028107a17de1c08a5f6e8a02d62277ea 100644 +index 4529ccc02f53fadc6ac2df97682b21913487bc22..85b73e65a4c1af052e75473bc239d91d5d1fd108 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -82,6 +82,79 @@ public class WorldServer extends World { - return new Throwable(entity + " Added to world at " + new java.util.Date()); +@@ -93,6 +93,79 @@ public class WorldServer extends World implements GeneratorAccessSeed { + return this.chunkProvider.getChunkAt(x, z, false); } + // Paper start - Asynchronous IO @@ -3993,7 +3953,7 @@ index 83585f3ba7ef9e72f3702079a82f62c8b17e4077..83e6c872028107a17de1c08a5f6e8a02 + RegionFile file; + + try { -+ file = WorldServer.this.getChunkProvider().playerChunkMap.getFile(new ChunkCoordIntPair(chunkX, chunkZ), false); ++ file = WorldServer.this.getChunkProvider().playerChunkMap.regionFileCache.getFile(new ChunkCoordIntPair(chunkX, chunkZ), false); + } catch (java.io.IOException ex) { + throw new RuntimeException(ex); + } @@ -4005,7 +3965,7 @@ index 83585f3ba7ef9e72f3702079a82f62c8b17e4077..83e6c872028107a17de1c08a5f6e8a02 + @Override + public T computeForRegionFileIfLoaded(int chunkX, int chunkZ, java.util.function.Function function) { + synchronized (WorldServer.this.getChunkProvider().playerChunkMap) { -+ RegionFile file = WorldServer.this.getChunkProvider().playerChunkMap.getRegionFileIfLoaded(new ChunkCoordIntPair(chunkX, chunkZ)); ++ RegionFile file = WorldServer.this.getChunkProvider().playerChunkMap.regionFileCache.getRegionFileIfLoaded(new ChunkCoordIntPair(chunkX, chunkZ)); + return function.apply(file); + } + } @@ -4013,19 +3973,19 @@ index 83585f3ba7ef9e72f3702079a82f62c8b17e4077..83e6c872028107a17de1c08a5f6e8a02 + public final com.destroystokyo.paper.io.chunk.ChunkTaskManager asyncChunkTaskManager; + // Paper end + - // Add env and gen to constructor - public WorldServer(MinecraftServer minecraftserver, Executor executor, WorldNBTStorage worldnbtstorage, WorldData worlddata, DimensionManager dimensionmanager, GameProfilerFiller gameprofilerfiller, WorldLoadListener worldloadlistener, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { - super(worlddata, dimensionmanager, executor, (world, worldprovider) -> { // Paper - pass executor down -@@ -125,6 +198,8 @@ public class WorldServer extends World { - - this.mobSpawnerTrader = this.worldProvider.getDimensionManager().getType() == DimensionManager.OVERWORLD ? new MobSpawnerTrader(this) : null; // CraftBukkit - getType() + // Add env and gen to constructor, WorldData -> WorldDataServer + public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey resourcekey, ResourceKey resourcekey1, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { + super(iworlddataserver, resourcekey, resourcekey1, dimensionmanager, minecraftserver::getMethodProfiler, false, flag, i, gen, env, executor); // Paper pass executor +@@ -140,6 +213,8 @@ public class WorldServer extends World implements GeneratorAccessSeed { + this.dragonBattle = null; + } this.getServer().addWorld(this.getWorld()); // CraftBukkit + + this.asyncChunkTaskManager = new com.destroystokyo.paper.io.chunk.ChunkTaskManager(this); // Paper } // CraftBukkit start -@@ -1664,7 +1739,10 @@ public class WorldServer extends World { +@@ -1569,7 +1644,10 @@ public class WorldServer extends World implements GeneratorAccessSeed { } MCUtil.getSpiralOutChunks(spawn, radiusInBlocks >> 4).forEach(pair -> { @@ -4038,10 +3998,10 @@ index 83585f3ba7ef9e72f3702079a82f62c8b17e4077..83e6c872028107a17de1c08a5f6e8a02 } public void removeTicketsForSpawn(int radiusInBlocks, BlockPosition spawn) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index cf059aa091e9c732f99b89fc347074a9c1b879a8..5aea49404717061fce4bf24e91f36217db5cee83 100644 +index 412dc3865dfee606c37c06daefeacc6ed14ced7b..310c4446734a7ebfadf0cbd74d1cfcee20ef3668 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -75,6 +75,7 @@ import net.minecraft.server.GroupDataEntity; +@@ -74,6 +74,7 @@ import net.minecraft.server.GroupDataEntity; import net.minecraft.server.IBlockData; import net.minecraft.server.IChunkAccess; import net.minecraft.server.MinecraftKey; @@ -4049,7 +4009,7 @@ index cf059aa091e9c732f99b89fc347074a9c1b879a8..5aea49404717061fce4bf24e91f36217 import net.minecraft.server.MovingObjectPosition; import net.minecraft.server.PacketPlayOutCustomSoundEffect; import net.minecraft.server.PacketPlayOutUpdateTime; -@@ -555,22 +556,23 @@ public class CraftWorld implements World { +@@ -558,22 +559,23 @@ public class CraftWorld implements World { return true; } @@ -4081,9 +4041,9 @@ index cf059aa091e9c732f99b89fc347074a9c1b879a8..5aea49404717061fce4bf24e91f36217 // fall through to load // we do this so we do not re-read the chunk data on disk -@@ -2442,6 +2444,34 @@ public class CraftWorld implements World { - - return new CraftDragonBattle(((WorldProviderTheEnd) worldProvider).o()); // PAIL rename getDragonBattle +@@ -2479,6 +2481,34 @@ public class CraftWorld implements World { + public DragonBattle getEnderDragonBattle() { + return (getHandle().getDragonBattle() == null) ? null : new CraftDragonBattle(getHandle().getDragonBattle()); } + // Paper start + @Override diff --git a/Spigot-Server-Patches/0391-Use-getChunkIfLoadedImmediately-in-places.patch b/Spigot-Server-Patches/0378-Use-getChunkIfLoadedImmediately-in-places.patch similarity index 63% rename from Spigot-Server-Patches/0391-Use-getChunkIfLoadedImmediately-in-places.patch rename to Spigot-Server-Patches/0378-Use-getChunkIfLoadedImmediately-in-places.patch index eab049a61..9ee98edac 100644 --- a/Spigot-Server-Patches/0391-Use-getChunkIfLoadedImmediately-in-places.patch +++ b/Spigot-Server-Patches/0378-Use-getChunkIfLoadedImmediately-in-places.patch @@ -8,10 +8,10 @@ ticket level 33 (yes getChunkIfLoaded will actually perform a chunk load in that case). diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 6a7bdf8c5f38ca4eb578e1104375e5773269330c..ee186ed5a076ede4d89702aeb5a2128d6e7ac8cf 100644 +index 70d3b429bfe08f1d2e5a3ac8368d8221770d5307..092e49ae11ff735cf0179de8e0aaa73f7842e372 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -996,7 +996,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -1015,7 +1015,7 @@ public class PlayerConnection implements PacketListenerPlayIn { speed = player.abilities.walkSpeed * 10f; } // Paper start - Prevent moving into unloaded chunks @@ -21,45 +21,41 @@ index 6a7bdf8c5f38ca4eb578e1104375e5773269330c..ee186ed5a076ede4d89702aeb5a2128d return; } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 479b87eaae67909768db1ba23854f05d2e61110c..8e5c54af26d2c7abf2daae081af97caee7fd9f7a 100644 +index 25785eed8c714b87635679e44ef06726c9a1b24c..2278835e15449c72d1bbbf0a2694c386554242e3 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -116,8 +116,16 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -104,6 +104,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + return (CraftServer) Bukkit.getServer(); } - public Chunk getChunkIfLoaded(int x, int z) { -- return ((ChunkProviderServer) this.chunkProvider).getChunkAt(x, z, false); -+ return ((ChunkProviderServer) this.chunkProvider).getChunkAtIfLoadedImmediately(x, z); // Paper - } + // Paper start + @Override + public boolean isChunkLoaded(int x, int z) { -+ return getChunkIfLoaded(x, z) != null; ++ return ((WorldServer)this).getChunkIfLoaded(x, z) != null; + } -+ -+ + // Paper end - - protected World(WorldData worlddata, DimensionManager dimensionmanager, java.util.concurrent.Executor executor, BiFunction bifunction, GameProfilerFiller gameprofilerfiller, boolean flag, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env) { // Paper - executor - this.spigotConfig = new org.spigotmc.SpigotWorldConfig( worlddata.getName() ); // Spigot -@@ -1110,14 +1118,14 @@ public abstract class World implements GeneratorAccess, AutoCloseable { ++ + protected World(WorldDataMutable worlddatamutable, ResourceKey resourcekey, ResourceKey resourcekey1, DimensionManager dimensionmanager, Supplier supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env, java.util.concurrent.Executor executor) { + this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((WorldDataServer) worlddatamutable).getName()); // Spigot + this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig((((WorldDataServer)worlddatamutable).getName()), this.spigotConfig); // Paper +@@ -1039,14 +1046,14 @@ public abstract class World implements GeneratorAccess, AutoCloseable { } - public boolean n(BlockPosition blockposition) { -- return isOutsideWorld(blockposition) ? false : this.chunkProvider.b(blockposition.getX() >> 4, blockposition.getZ() >> 4); + public boolean p(BlockPosition blockposition) { +- return isOutsideWorld(blockposition) ? false : this.getChunkProvider().b(blockposition.getX() >> 4, blockposition.getZ() >> 4); + return isOutsideWorld(blockposition) ? false : isChunkLoaded(blockposition.getX() >> 4, blockposition.getZ() >> 4); // Paper } - public boolean a(BlockPosition blockposition, Entity entity) { + public boolean a(BlockPosition blockposition, Entity entity, EnumDirection enumdirection) { if (isOutsideWorld(blockposition)) { return false; } else { - IChunkAccess ichunkaccess = this.getChunkAt(blockposition.getX() >> 4, blockposition.getZ() >> 4, ChunkStatus.FULL, false); + IChunkAccess ichunkaccess = this.getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4); // Paper - return ichunkaccess == null ? false : ichunkaccess.getType(blockposition).a((IBlockAccess) this, blockposition, entity); + return ichunkaccess == null ? false : ichunkaccess.getType(blockposition).a((IBlockAccess) this, blockposition, entity, enumdirection); } -@@ -1233,7 +1241,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -1167,7 +1174,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { for (int i1 = i; i1 < j; ++i1) { for (int j1 = k; j1 < l; ++j1) { @@ -68,8 +64,21 @@ index 479b87eaae67909768db1ba23854f05d2e61110c..8e5c54af26d2c7abf2daae081af97cae if (chunk != null) { chunk.a(oclass, axisalignedbb, list, predicate); +diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java +index 85b73e65a4c1af052e75473bc239d91d5d1fd108..df04a1d39a4ad3a5cf30372bd14a65d1ff5459b3 100644 +--- a/src/main/java/net/minecraft/server/WorldServer.java ++++ b/src/main/java/net/minecraft/server/WorldServer.java +@@ -90,7 +90,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { + } + + @Override public Chunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI +- return this.chunkProvider.getChunkAt(x, z, false); ++ return this.chunkProvider.getChunkAtIfLoadedImmediately(x, z); // Paper + } + + // Paper start - Asynchronous IO diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java -index f86404f83ae605159307a3ad2cca6c6c314a01af..92601c581cffac471872226abeb93ef9aa24f079 100644 +index 78f0fb5d97b077673ec542cd70bbc3ffa13f916c..b73af0a5fb2d08c2f3a52c699ef0d8ed34c83f77 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java @@ -143,9 +143,10 @@ public class ActivationRange diff --git a/Spigot-Server-Patches/0392-Reduce-sync-loads.patch b/Spigot-Server-Patches/0379-Reduce-sync-loads.patch similarity index 91% rename from Spigot-Server-Patches/0392-Reduce-sync-loads.patch rename to Spigot-Server-Patches/0379-Reduce-sync-loads.patch index cd2b995d7..3801c8671 100644 --- a/Spigot-Server-Patches/0392-Reduce-sync-loads.patch +++ b/Spigot-Server-Patches/0379-Reduce-sync-loads.patch @@ -109,7 +109,7 @@ index 331493a172f58e71b464d635efdba461082bd27d..182b440ba4802d199b8e44f7779b3401 if (args.length < 2 || args[1].equals("*")) { diff --git a/src/main/java/com/destroystokyo/paper/io/SyncLoadFinder.java b/src/main/java/com/destroystokyo/paper/io/SyncLoadFinder.java new file mode 100644 -index 0000000000000000000000000000000000000000..59aec103295f747793fdc0a52eb45f4121aba921 +index 0000000000000000000000000000000000000000..1a68a8012f83bab9e814159c76b8c3710c7b1112 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/io/SyncLoadFinder.java @@ -0,0 +1,172 @@ @@ -267,7 +267,7 @@ index 0000000000000000000000000000000000000000..59aec103295f747793fdc0a52eb45f41 + final ThrowableWithEquals other = (ThrowableWithEquals)obj; + final StackTraceElement[] otherStackTrace = other.stacktrace; + -+ if (this.stacktrace.length != otherStackTrace.length) { ++ if (this.stacktrace.length != otherStackTrace.length || this.hash != other.hash) { + return false; + } + @@ -286,10 +286,10 @@ index 0000000000000000000000000000000000000000..59aec103295f747793fdc0a52eb45f41 + } +} diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 981cf581c7504c38120d48c06b6351952fab43c0..54cf319e9db1aad793ab7f55249f9857b450eda2 100644 +index edd901bb53385fa3d189a0057d57f98bf8b7115c..707db4febac59a4d09d6420ea2add469cf54c2ec 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -470,6 +470,7 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -471,6 +471,7 @@ public class ChunkProviderServer extends IChunkProvider { this.world.asyncChunkTaskManager.raisePriority(x, z, com.destroystokyo.paper.io.PrioritizedTaskQueue.HIGHEST_PRIORITY); com.destroystokyo.paper.io.chunk.ChunkTaskManager.pushChunkWait(this.world, x, z); // Paper end @@ -298,19 +298,19 @@ index 981cf581c7504c38120d48c06b6351952fab43c0..54cf319e9db1aad793ab7f55249f9857 this.serverThreadQueue.awaitTasks(completablefuture::isDone); com.destroystokyo.paper.io.chunk.ChunkTaskManager.popChunkWait(); // Paper - async chunk debug diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 8e5c54af26d2c7abf2daae081af97caee7fd9f7a..045e449c7e411dec7ef415c76c808cda426db652 100644 +index 2278835e15449c72d1bbbf0a2694c386554242e3..dd3dd03200ad8f0219d6673abfe8fc87341a0fe6 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -1174,7 +1174,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -1107,7 +1107,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { for (int i1 = i; i1 <= j; ++i1) { for (int j1 = k; j1 <= l; ++j1) { -- Chunk chunk = this.getChunkProvider().getChunkAt(i1, j1, false); +- Chunk chunk = ichunkprovider.getChunkAt(i1, j1, false); + Chunk chunk = (Chunk)this.getChunkIfLoadedImmediately(i1, j1); // Paper if (chunk != null) { chunk.a(entity, axisalignedbb, list, predicate); -@@ -1195,7 +1195,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -1128,7 +1128,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { for (int i1 = i; i1 < j; ++i1) { for (int j1 = k; j1 < l; ++j1) { @@ -319,7 +319,7 @@ index 8e5c54af26d2c7abf2daae081af97caee7fd9f7a..045e449c7e411dec7ef415c76c808cda if (chunk != null) { chunk.a(entitytypes, axisalignedbb, list, predicate); -@@ -1218,7 +1218,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -1151,7 +1151,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { for (int i1 = i; i1 < j; ++i1) { for (int j1 = k; j1 < l; ++j1) { @@ -329,10 +329,10 @@ index 8e5c54af26d2c7abf2daae081af97caee7fd9f7a..045e449c7e411dec7ef415c76c808cda if (chunk != null) { chunk.a(oclass, axisalignedbb, list, predicate); diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 83e6c872028107a17de1c08a5f6e8a02d62277ea..da38293cf02d84f3e24a883136ffe5118a510b5a 100644 +index df04a1d39a4ad3a5cf30372bd14a65d1ff5459b3..8c0b1f28c3a914ce467345104e024650b9ebe2fe 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -154,6 +154,12 @@ public class WorldServer extends World { +@@ -165,6 +165,12 @@ public class WorldServer extends World implements GeneratorAccessSeed { }; public final com.destroystokyo.paper.io.chunk.ChunkTaskManager asyncChunkTaskManager; // Paper end @@ -343,5 +343,5 @@ index 83e6c872028107a17de1c08a5f6e8a02d62277ea..da38293cf02d84f3e24a883136ffe511 + } + // Paper end - // Add env and gen to constructor - public WorldServer(MinecraftServer minecraftserver, Executor executor, WorldNBTStorage worldnbtstorage, WorldData worlddata, DimensionManager dimensionmanager, GameProfilerFiller gameprofilerfiller, WorldLoadListener worldloadlistener, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { + // Add env and gen to constructor, WorldData -> WorldDataServer + public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey resourcekey, ResourceKey resourcekey1, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { diff --git a/Spigot-Server-Patches/0393-Implement-alternative-item-despawn-rate.patch b/Spigot-Server-Patches/0380-Implement-alternative-item-despawn-rate.patch similarity index 91% rename from Spigot-Server-Patches/0393-Implement-alternative-item-despawn-rate.patch rename to Spigot-Server-Patches/0380-Implement-alternative-item-despawn-rate.patch index 1479d5039..27424c79a 100644 --- a/Spigot-Server-Patches/0393-Implement-alternative-item-despawn-rate.patch +++ b/Spigot-Server-Patches/0380-Implement-alternative-item-despawn-rate.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Implement alternative item-despawn-rate diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 7101ef0912221bdb1c32d2cafbac5d9d53e7037d..9b43b4172ae5df253479a412ec0d83fed08d70f1 100644 +index 822b738f48578b39f81bb8e38208dc3d26c2a221..ce0db77ccd24c3543c7894db4044bed03ea776d8 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -1,10 +1,15 @@ @@ -24,7 +24,7 @@ index 7101ef0912221bdb1c32d2cafbac5d9d53e7037d..9b43b4172ae5df253479a412ec0d83fe import org.bukkit.configuration.file.YamlConfiguration; import org.spigotmc.SpigotWorldConfig; -@@ -546,4 +551,52 @@ public class PaperWorldConfig { +@@ -509,4 +514,52 @@ public class PaperWorldConfig { private void disableRelativeProjectileVelocity() { disableRelativeProjectileVelocity = getBoolean("game-mechanics.disable-relative-projectile-velocity", false); } @@ -78,7 +78,7 @@ index 7101ef0912221bdb1c32d2cafbac5d9d53e7037d..9b43b4172ae5df253479a412ec0d83fe + } } diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java -index ef2cf6565b5935b1f1a80f12670609017aebb2c8..507627a29f67c380314d2fa8ee56807ced8ee56a 100644 +index 465550656356394074ebf4cc8d6188455daded88..f2626358d16e8f3d60633283322009e5afacd145 100644 --- a/src/main/java/net/minecraft/server/EntityItem.java +++ b/src/main/java/net/minecraft/server/EntityItem.java @@ -6,6 +6,7 @@ import java.util.Objects; @@ -89,7 +89,7 @@ index ef2cf6565b5935b1f1a80f12670609017aebb2c8..507627a29f67c380314d2fa8ee56807c import org.bukkit.event.entity.EntityPickupItemEvent; import org.bukkit.event.player.PlayerPickupItemEvent; // CraftBukkit end -@@ -128,7 +129,7 @@ public class EntityItem extends Entity { +@@ -129,7 +130,7 @@ public class EntityItem extends Entity { } } @@ -98,7 +98,7 @@ index ef2cf6565b5935b1f1a80f12670609017aebb2c8..507627a29f67c380314d2fa8ee56807c // CraftBukkit start - fire ItemDespawnEvent if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) { this.age = 0; -@@ -152,7 +153,7 @@ public class EntityItem extends Entity { +@@ -153,7 +154,7 @@ public class EntityItem extends Entity { this.lastTick = MinecraftServer.currentTick; // CraftBukkit end @@ -107,7 +107,7 @@ index ef2cf6565b5935b1f1a80f12670609017aebb2c8..507627a29f67c380314d2fa8ee56807c // CraftBukkit start - fire ItemDespawnEvent if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) { this.age = 0; -@@ -478,9 +479,16 @@ public class EntityItem extends Entity { +@@ -497,9 +498,16 @@ public class EntityItem extends Entity { public void s() { this.o(); @@ -123,5 +123,5 @@ index ef2cf6565b5935b1f1a80f12670609017aebb2c8..507627a29f67c380314d2fa8ee56807c + // Paper end + @Override - public Packet L() { + public Packet O() { return new PacketPlayOutSpawnEntity(this); diff --git a/Spigot-Server-Patches/0381-Do-less-work-if-we-have-a-custom-Bukkit-generator.patch b/Spigot-Server-Patches/0381-Do-less-work-if-we-have-a-custom-Bukkit-generator.patch new file mode 100644 index 000000000..36ac6d6a2 --- /dev/null +++ b/Spigot-Server-Patches/0381-Do-less-work-if-we-have-a-custom-Bukkit-generator.patch @@ -0,0 +1,40 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Paul Sauve +Date: Sun, 14 Jul 2019 21:05:03 -0500 +Subject: [PATCH] Do less work if we have a custom Bukkit generator + +If the Bukkit generator already has a spawn, use it immediately instead +of spending time generating one that we won't use + +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index 0633944364179ffb9b9fdd0400d82fd5b2ab3892..41c4b2df34faa95afdd2d35b0bac021d77c56884 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -512,11 +512,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant list = worldchunkmanager.b(); +- Random random = new Random(worldserver.getSeed()); +- BlockPosition blockposition = worldchunkmanager.a(0, worldserver.getSeaLevel(), 0, 256, list, random); +- ChunkCoordIntPair chunkcoordintpair = blockposition == null ? new ChunkCoordIntPair(0, 0) : new ChunkCoordIntPair(blockposition); ++ // Paper start - moved down + // CraftBukkit start + if (worldserver.generator != null) { + Random rand = new Random(worldserver.getSeed()); +@@ -532,6 +528,14 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant list = worldchunkmanager.b(); ++ Random random = new Random(worldserver.getSeed()); ++ BlockPosition blockposition = worldchunkmanager.a(0, worldserver.getSeaLevel(), 0, 256, list, random); ++ ChunkCoordIntPair chunkcoordintpair = blockposition == null ? new ChunkCoordIntPair(0, 0) : new ChunkCoordIntPair(blockposition); ++ // Paper end + + if (blockposition == null) { + MinecraftServer.LOGGER.warn("Unable to find spawn biome"); diff --git a/Spigot-Server-Patches/0395-Fix-MC-158900.patch b/Spigot-Server-Patches/0382-Fix-MC-158900.patch similarity index 90% rename from Spigot-Server-Patches/0395-Fix-MC-158900.patch rename to Spigot-Server-Patches/0382-Fix-MC-158900.patch index baaab4d55..dbd58cddb 100644 --- a/Spigot-Server-Patches/0395-Fix-MC-158900.patch +++ b/Spigot-Server-Patches/0382-Fix-MC-158900.patch @@ -7,10 +7,10 @@ The problem was we were checking isExpired() on the entry, but if it was expired at that point, then it would be null. diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 7b2514355d26681ddd69c040ad6a7bc4d6aaaac2..e3127e01a5642225bf24bb061b069765da16cf72 100644 +index dd05e753942d2f50ba0af41d59b4cb962df4cd1b..62b9c1f23fcc9df1ba49823a45b54b4e547813d0 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -502,8 +502,10 @@ public abstract class PlayerList { +@@ -531,8 +531,10 @@ public abstract class PlayerList { Player player = entity.getBukkitEntity(); PlayerLoginEvent event = new PlayerLoginEvent(player, hostname, ((java.net.InetSocketAddress) socketaddress).getAddress(), ((java.net.InetSocketAddress) loginlistener.networkManager.getRawAddress()).getAddress()); diff --git a/Spigot-Server-Patches/0383-Use-ChunkStatus-cache-when-saving-protochunks.patch b/Spigot-Server-Patches/0383-Use-ChunkStatus-cache-when-saving-protochunks.patch deleted file mode 100644 index f94c70b4c..000000000 --- a/Spigot-Server-Patches/0383-Use-ChunkStatus-cache-when-saving-protochunks.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Spottedleaf -Date: Sat, 22 Jun 2019 04:20:47 -0700 -Subject: [PATCH] Use ChunkStatus cache when saving protochunks - -The cache should contain the chunk status when saving. If not it -will load it. - -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 1d517fd1aea90edf470388fd857a41f2be149327..9171785ad54a26e95dea8b30509c1e49a5d9b22d 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -845,8 +845,10 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - NBTTagCompound nbttagcompound; - - if (chunkstatus.getType() != ChunkStatus.Type.LEVELCHUNK) { -- nbttagcompound = this.readChunkData(chunkcoordintpair); -- if (nbttagcompound != null && ChunkRegionLoader.a(nbttagcompound) == ChunkStatus.Type.LEVELCHUNK) { -+ // Paper start - Optimize save by using status cache -+ ChunkStatus statusOnDisk = this.getChunkStatusOnDisk(chunkcoordintpair); -+ if (statusOnDisk != null && statusOnDisk.getType() == ChunkStatus.Type.LEVELCHUNK) { -+ // Paper end - return false; - } - diff --git a/Spigot-Server-Patches/0396-implement-optional-per-player-mob-spawns.patch b/Spigot-Server-Patches/0383-implement-optional-per-player-mob-spawns.patch similarity index 68% rename from Spigot-Server-Patches/0396-implement-optional-per-player-mob-spawns.patch rename to Spigot-Server-Patches/0383-implement-optional-per-player-mob-spawns.patch index cf5dc5764..e0e269a99 100644 --- a/Spigot-Server-Patches/0396-implement-optional-per-player-mob-spawns.patch +++ b/Spigot-Server-Patches/0383-implement-optional-per-player-mob-spawns.patch @@ -5,10 +5,10 @@ Subject: [PATCH] implement optional per player mob spawns diff --git a/src/main/java/co/aikar/timings/WorldTimingsHandler.java b/src/main/java/co/aikar/timings/WorldTimingsHandler.java -index 98acbfa44dd9042b26fdf719d7748f92d201c928..a94ebf7c76f167d3b66f7d243910c13d4bfaaba3 100644 +index a27dc38d1a29ed1d63d2f44b7984c2b65be487d9..96aaaab5b7685c874463505f9d25e8a0a01a6e7c 100644 --- a/src/main/java/co/aikar/timings/WorldTimingsHandler.java +++ b/src/main/java/co/aikar/timings/WorldTimingsHandler.java -@@ -56,6 +56,7 @@ public class WorldTimingsHandler { +@@ -57,6 +57,7 @@ public class WorldTimingsHandler { public final Timing miscMobSpawning; @@ -16,7 +16,7 @@ index 98acbfa44dd9042b26fdf719d7748f92d201c928..a94ebf7c76f167d3b66f7d243910c13d public final Timing poiUnload; public final Timing chunkUnload; -@@ -121,6 +122,7 @@ public class WorldTimingsHandler { +@@ -122,6 +123,7 @@ public class WorldTimingsHandler { miscMobSpawning = Timings.ofSafe(name + "Mob spawning - Misc"); @@ -25,10 +25,10 @@ index 98acbfa44dd9042b26fdf719d7748f92d201c928..a94ebf7c76f167d3b66f7d243910c13d poiUnload = Timings.ofSafe(name + "Chunk unload - POI"); chunkUnload = Timings.ofSafe(name + "Chunk unload - Chunk"); diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 9b43b4172ae5df253479a412ec0d83fed08d70f1..c148a57a9c3d44f2a0a2edfed4f96211745cc3e7 100644 +index ce0db77ccd24c3543c7894db4044bed03ea776d8..edf4fa474d32ac20ff85cecfa9f03464a7ecf6ec 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -599,4 +599,9 @@ public class PaperWorldConfig { +@@ -562,4 +562,9 @@ public class PaperWorldConfig { } } } @@ -545,16 +545,16 @@ index 0000000000000000000000000000000000000000..4f13d3ff8391793a99f067189f854078 + } +} diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 54cf319e9db1aad793ab7f55249f9857b450eda2..633f12098973857eca04acd2839bb4d453860f1e 100644 +index 707db4febac59a4d09d6420ea2add469cf54c2ec..1597b7a882769109f467d81ecbadc45ff6779b7e 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -757,7 +757,22 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -744,7 +744,22 @@ public class ChunkProviderServer extends IChunkProvider { + this.world.getMethodProfiler().enter("naturalSpawnCount"); this.world.timings.countNaturalMobs.startTiming(); // Paper - timings int l = this.chunkMapDistance.b(); - EnumCreatureType[] aenumcreaturetype = EnumCreatureType.values(); -- Object2IntMap object2intmap = this.world.l(); +- SpawnerCreature.d spawnercreature_d = SpawnerCreature.a(l, this.world.z(), this::a); + // Paper start - per player mob spawning -+ int[] worldMobCount; ++ SpawnerCreature.d spawnercreature_d; // moved down + if (this.playerChunkMap.playerMobDistanceMap != null) { + // update distance map + this.world.timings.playerMobDistanceMapUpdate.startTiming(); @@ -564,45 +564,19 @@ index 54cf319e9db1aad793ab7f55249f9857b450eda2..633f12098973857eca04acd2839bb4d4 + for (EntityPlayer player : this.world.players) { + Arrays.fill(player.mobCounts, 0); + } -+ worldMobCount = this.world.countMobs(true); ++ spawnercreature_d = SpawnerCreature.countMobs(l, this.world.z(), this::a, true); + } else { -+ worldMobCount = this.world.countMobs(false); ++ spawnercreature_d = SpawnerCreature.countMobs(l, this.world.z(), this::a, false); + } + // Paper end - this.world.timings.countNaturalMobs.stopTiming(); // Paper - timings - this.world.getMethodProfiler().exit(); -@@ -825,8 +840,23 @@ public class ChunkProviderServer extends IChunkProvider { - if (enumcreaturetype != EnumCreatureType.MISC && (!enumcreaturetype.c() || this.allowAnimals) && (enumcreaturetype.c() || this.allowMonsters) && (!enumcreaturetype.d() || flag2)) { - int k1 = limit * l / ChunkProviderServer.b; // CraftBukkit - use per-world limits -- if (object2intmap.getInt(enumcreaturetype) <= k1) { -- SpawnerCreature.a(enumcreaturetype, this.world, chunk, blockposition); -+ // Paper start - only allow spawns upto the limit per chunk and update count afterwards -+ int currEntityCount = worldMobCount[enumcreaturetype.ordinal()]; -+ int difference = k1 - currEntityCount; -+ -+ if (this.world.paperConfig.perPlayerMobSpawns) { -+ int minDiff = Integer.MAX_VALUE; -+ for (EntityPlayer entityplayer : this.playerChunkMap.playerMobDistanceMap.getPlayersInRange(chunk.getPos())) { -+ minDiff = Math.min(limit - this.playerChunkMap.getMobCountNear(entityplayer, enumcreaturetype), minDiff); -+ } -+ difference = (minDiff == Integer.MAX_VALUE) ? 0 : minDiff; -+ } -+ -+ if (difference > 0) { -+ int spawnCount = SpawnerCreature.spawnMobs(enumcreaturetype, this.world, chunk, blockposition, difference, -+ this.world.paperConfig.perPlayerMobSpawns ? this.playerChunkMap::updatePlayerMobTypeMap : null); -+ worldMobCount[enumcreaturetype.ordinal()] += spawnCount; -+ // Paper end - } - } - } + this.p = spawnercreature_d; diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 57b393c22448910c3ecc34353c3aa8480c58c074..3db173fb5559e62150192a28dbdccdff16787401 100644 +index c43e0b19cfbad4fe74141c2c1e48afdc8960ee1c..6787b467f18bb03a8d45dc254988b5084c74f499 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -81,6 +81,11 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -85,6 +85,11 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public boolean queueHealthUpdatePacket = false; public net.minecraft.server.PacketPlayOutUpdateHealth queuedHealthUpdatePacket; // Paper end @@ -614,7 +588,7 @@ index 57b393c22448910c3ecc34353c3aa8480c58c074..3db173fb5559e62150192a28dbdccdff // CraftBukkit start public String displayName; -@@ -116,6 +121,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -120,6 +125,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { this.displayName = this.getName(); this.canPickUpLoot = true; this.maxHealthCache = this.getMaxHealth(); @@ -622,43 +596,43 @@ index 57b393c22448910c3ecc34353c3aa8480c58c074..3db173fb5559e62150192a28dbdccdff } // Yes, this doesn't match Vanilla, but it's the best we can do for now. -@@ -1791,6 +1797,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -1929,6 +1935,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } -+ public SectionPosition getPlayerMapSection() { return this.K(); } // Paper - OBFHELPER - public SectionPosition K() { - return this.cs; ++ public final SectionPosition getPlayerMapSection() { return this.N(); } // Paper - OBFHELPER + public SectionPosition N() { + return this.cq; } diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java -index 8427ee2ee8b90d5deb686412bb2eefb9a574b75a..0f04bcc8b7cd5bd0536dd3fccab0f4dae6b0130b 100644 +index b9fe08301409bc1f0d61a7566c26e720ff720d80..18a806ebbf092b904983691529ce5edf2da4e6db 100644 --- a/src/main/java/net/minecraft/server/EntityTypes.java +++ b/src/main/java/net/minecraft/server/EntityTypes.java -@@ -254,6 +254,7 @@ public class EntityTypes { - return this.bf; +@@ -265,6 +265,7 @@ public class EntityTypes { + return this.bk; } -+ public EnumCreatureType getEnumCreatureType() { return this.e(); } // Paper - OBFHELPER ++ public final EnumCreatureType getEnumCreatureType() { return this.e(); } // Paper - OBFHELPER public EnumCreatureType e() { - return this.bb; + return this.bf; } diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 6552bbf06637b08626cbf0fb352123c3e381cb5a..c20acd86beb8f28345d1359d0a2b68b7d8e0e410 100644 +index a10006efc52f093196e7d67a3281a87d4c5df19b..ab5413a39147180af2eb33512fc992a5dcbb69bf 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -78,7 +78,8 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - private final PlayerMap playerMap; +@@ -80,7 +80,8 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { public final Int2ObjectMap trackedEntities; - private final Queue z; + private final Long2ByteMap z; + private final Queue A; private final Queue getUnloadQueueTasks() { return this.A; } // Paper - OBFHELPER - private int viewDistance; + int viewDistance; // Paper - private -> package private + public final com.destroystokyo.paper.util.PlayerMobDistanceMap playerMobDistanceMap; // Paper // CraftBukkit start - recursion-safe executor for Chunk loadCallback() and unloadCallback() public final CallbackExecutor callbackExecutor = new CallbackExecutor(); -@@ -158,6 +159,24 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -159,6 +160,24 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { this.l = supplier; - this.m = new VillagePlace(new File(this.w, "poi"), datafixer, this.world); // Paper + this.m = new VillagePlace(new File(this.w, "poi"), datafixer, flag, this.world); // Paper this.setViewDistance(i); + this.playerMobDistanceMap = this.world.paperConfig.perPlayerMobSpawns ? new com.destroystokyo.paper.util.PlayerMobDistanceMap() : null; // Paper + } @@ -682,120 +656,168 @@ index 6552bbf06637b08626cbf0fb352123c3e381cb5a..c20acd86beb8f28345d1359d0a2b68b7 private static double a(ChunkCoordIntPair chunkcoordintpair, Entity entity) { diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java -index fdac5bb3a2d4a73035e1d914979b87fc224b6b20..58bbf2f9d2ec91715051d40e108e16067bb36561 100644 +index 8130e14b5d6c3e8b0a1234668d5c855e82f3a5dc..c5845013a79036704d084cfb903589cb9e8767cd 100644 --- a/src/main/java/net/minecraft/server/SpawnerCreature.java +++ b/src/main/java/net/minecraft/server/SpawnerCreature.java -@@ -3,6 +3,7 @@ package net.minecraft.server; - import java.util.List; - import java.util.Objects; - import java.util.Random; -+import java.util.function.Consumer; // Paper - import javax.annotation.Nullable; - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; -@@ -16,9 +17,14 @@ public final class SpawnerCreature { +@@ -29,6 +29,11 @@ public final class SpawnerCreature { + }); - private static final Logger LOGGER = LogManager.getLogger(); - -+ // Paper start - add maxSpawns parameter and return spawned mobs - public static void a(EnumCreatureType enumcreaturetype, WorldServer worldserver, Chunk chunk, BlockPosition blockposition) { -+ spawnMobs(enumcreaturetype, worldserver, chunk, blockposition, Integer.MAX_VALUE, null); + public static SpawnerCreature.d a(int i, Iterable iterable, SpawnerCreature.b spawnercreature_b) { ++ // Paper start - add countMobs parameter ++ return countMobs(i, iterable, spawnercreature_b, false); + } -+ public static int spawnMobs(EnumCreatureType enumcreaturetype, WorldServer worldserver, Chunk chunk, BlockPosition blockposition, int maxSpawns, Consumer trackEntity) { -+ // Paper end - ChunkGenerator chunkgenerator = worldserver.getChunkProvider().getChunkGenerator(); -- int i = 0; -+ int i = 0; // Paper - force diff on name change - BlockPosition blockposition1 = getRandomPosition(worldserver, chunk); - int j = blockposition1.getX(); - int k = blockposition1.getY(); -@@ -88,7 +94,7 @@ public final class SpawnerCreature { - ); - if (!event.callEvent()) { - if (event.shouldAbortSpawn()) { -- return; -+ return i; // Paper - } - ++i2; - continue; -@@ -107,7 +113,7 @@ public final class SpawnerCreature { - } catch (Exception exception) { - SpawnerCreature.LOGGER.warn("Failed to create mob", exception); - ServerInternalException.reportInternalException(exception); // Paper -- return; -+ return i; // Paper - } - - entityinsentient.setPositionRotation((double) f, (double) k, (double) f1, worldserver.random.nextFloat() * 360.0F, 0.0F); -@@ -115,12 +121,16 @@ public final class SpawnerCreature { - groupdataentity = entityinsentient.prepare(worldserver, worldserver.getDamageScaler(new BlockPosition(entityinsentient)), EnumMobSpawn.NATURAL, groupdataentity, (NBTTagCompound) null); - // CraftBukkit start - if (worldserver.addEntity(entityinsentient, SpawnReason.NATURAL)) { -- ++i; -+ ++i; // Paper - force diff on name change - ++i2; -+ if (trackEntity != null) { -+ trackEntity.accept(entityinsentient); // Paper -+ } - } -+ if (i >= maxSpawns) { return i; } // Paper - // CraftBukkit end - if (i >= entityinsentient.getMaxSpawnGroup()) { -- return; -+ return i; // Paper - } - - if (entityinsentient.c(i2)) { -@@ -146,6 +156,7 @@ public final class SpawnerCreature { ++ public static SpawnerCreature.d countMobs(int i, Iterable iterable, SpawnerCreature.b spawnercreature_b, boolean countMobs) { ++ // Paper end - add countMobs parameter + SpawnerCreatureProbabilities spawnercreatureprobabilities = new SpawnerCreatureProbabilities(); + Object2IntOpenHashMap object2intopenhashmap = new Object2IntOpenHashMap(); + Iterator iterator = iterable.iterator(); +@@ -67,6 +72,11 @@ public final class SpawnerCreature { + } + object2intopenhashmap.addTo(enumcreaturetype, 1); ++ // Paper start ++ if (countMobs) { ++ ((WorldServer)chunk.world).getChunkProvider().playerChunkMap.updatePlayerMobTypeMap(entity); ++ } ++ // Paper end + }); } } -+ return i; // Paper - } +@@ -125,13 +135,33 @@ public final class SpawnerCreature { + continue; + } - @Nullable -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 135d1211525f499198122e500626ce463c263088..80e2a15bebe93939dc7b43b17b8116965438c062 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1031,7 +1031,20 @@ public class WorldServer extends World { - } - - public Object2IntMap l() { -- Object2IntMap object2intmap = new Object2IntOpenHashMap(); -+ // Paper start -+ int[] values = this.countMobs(false); -+ EnumCreatureType[] byId = EnumCreatureType.values(); -+ Object2IntMap ret = new Object2IntOpenHashMap<>(); ++ // Paper start - only allow spawns upto the limit per chunk and update count afterwards ++ int currEntityCount = spawnercreature_d.getEntityCountsByType().getInt(enumcreaturetype); ++ int k1 = limit * spawnercreature_d.getSpawnerChunks() / SpawnerCreature.b; ++ int difference = k1 - currEntityCount; + -+ for (int i = 0, len = values.length; i < len; ++i) { -+ ret.put(byId[i], values[i]); -+ } -+ -+ return ret; -+ } -+ public int[] countMobs(boolean updatePlayerCounts) { -+ int[] ret = new int[EntityPlayer.ENUMCREATURETYPE_TOTAL_ENUMS]; -+ // Paper end - ObjectIterator objectiterator = this.entitiesById.values().iterator(); - - while (objectiterator.hasNext()) { -@@ -1056,11 +1069,16 @@ public class WorldServer extends World { - continue; - } - // Paper end -- object2intmap.mergeInt(enumcreaturetype, 1, Integer::sum); -+ // Paper start - rework mob spawning -+ if (updatePlayerCounts) { -+ this.getChunkProvider().playerChunkMap.updatePlayerMobTypeMap(entity); ++ if (worldserver.paperConfig.perPlayerMobSpawns) { ++ int minDiff = Integer.MAX_VALUE; ++ for (EntityPlayer entityplayer : worldserver.getChunkProvider().playerChunkMap.playerMobDistanceMap.getPlayersInRange(chunk.getPos())) { ++ minDiff = Math.min(limit - worldserver.getChunkProvider().playerChunkMap.getMobCountNear(entityplayer, enumcreaturetype), minDiff); + } -+ ++ret[enumcreaturetype.ordinal()]; -+ // Paper end ++ difference = (minDiff == Integer.MAX_VALUE) ? 0 : minDiff; ++ } ++ // Paper end ++ ++ if (difference > 0) { // Paper + if ((flag || !enumcreaturetype.d()) && (flag1 || enumcreaturetype.d()) && (flag2 || !enumcreaturetype.e()) && spawnercreature_d.a(enumcreaturetype, limit)) { + // CraftBukkit end +- a(enumcreaturetype, worldserver, chunk, (entitytypes, blockposition, ichunkaccess) -> { ++ int spawnCount = spawnMobs(enumcreaturetype, worldserver, chunk, (entitytypes, blockposition, ichunkaccess) -> { + return spawnercreature_d.a(entitytypes, blockposition, ichunkaccess); + }, (entityinsentient, ichunkaccess) -> { + spawnercreature_d.a(entityinsentient, ichunkaccess); ++ }, ++ limit, worldserver.paperConfig.perPlayerMobSpawns ? worldserver.getChunkProvider().playerChunkMap::updatePlayerMobTypeMap : null); ++ spawnercreature_d.getEntityCountsByType().mergeInt(enumcreaturetype, 0, (keyInMap, valueInMap) -> { ++ return Integer.valueOf(spawnCount + valueInMap.intValue()); + }); ++ } // Paper } } -- return object2intmap; -+ return ret; +@@ -140,22 +170,34 @@ public final class SpawnerCreature { } - @Override + public static void a(EnumCreatureType enumcreaturetype, WorldServer worldserver, Chunk chunk, SpawnerCreature.c spawnercreature_c, SpawnerCreature.a spawnercreature_a) { ++ // Paper start - add parameters and int ret type ++ spawnMobs(enumcreaturetype, worldserver, chunk, spawnercreature_c, spawnercreature_a, Integer.MAX_VALUE, null); ++ } ++ public static int spawnMobs(EnumCreatureType enumcreaturetype, WorldServer worldserver, Chunk chunk, SpawnerCreature.c spawnercreature_c, SpawnerCreature.a spawnercreature_a, int maxSpawns, Consumer trackEntity) { ++ // Paper end - add parameters and int ret type + BlockPosition blockposition = getRandomPosition(worldserver, chunk); + + if (blockposition.getY() >= 1) { +- a(enumcreaturetype, worldserver, (IChunkAccess) chunk, blockposition, spawnercreature_c, spawnercreature_a); ++ return spawnMobsInternal(enumcreaturetype, worldserver, (IChunkAccess) chunk, blockposition, spawnercreature_c, spawnercreature_a, maxSpawns, trackEntity); + } ++ return 0; // Paper + } + + public static void a(EnumCreatureType enumcreaturetype, WorldServer worldserver, IChunkAccess ichunkaccess, BlockPosition blockposition, SpawnerCreature.c spawnercreature_c, SpawnerCreature.a spawnercreature_a) { ++ // Paper start - add maxSpawns parameter and return spawned mobs ++ spawnMobsInternal(enumcreaturetype, worldserver, ichunkaccess, blockposition, spawnercreature_c, spawnercreature_a, Integer.MAX_VALUE, null); ++ } ++ public static int spawnMobsInternal(EnumCreatureType enumcreaturetype, WorldServer worldserver, IChunkAccess ichunkaccess, BlockPosition blockposition, SpawnerCreature.c spawnercreature_c, SpawnerCreature.a spawnercreature_a, int maxSpawns, Consumer trackEntity) { ++ // Paper end - add maxSpawns parameter and return spawned mobs + StructureManager structuremanager = worldserver.getStructureManager(); + ChunkGenerator chunkgenerator = worldserver.getChunkProvider().getChunkGenerator(); + int i = blockposition.getY(); + IBlockData iblockdata = worldserver.getTypeIfLoadedAndInBounds(blockposition); // Paper - don't load chunks for mob spawn ++ int j = 0; // Paper - moved up + + if (iblockdata != null && !iblockdata.isOccluding(ichunkaccess, blockposition)) { // Paper - don't load chunks for mob spawn + BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition(); +- int j = 0; ++ // Paper - moved up + int k = 0; + + while (k < 3) { +@@ -195,13 +237,13 @@ public final class SpawnerCreature { + // Paper start + Boolean doSpawning = a(worldserver, enumcreaturetype, structuremanager, chunkgenerator, biomebase_biomemeta, blockposition_mutableblockposition, d2); + if (doSpawning == null) { +- return; ++ return j; // Paper + } + if (doSpawning.booleanValue() && spawnercreature_c.test(biomebase_biomemeta.c, blockposition_mutableblockposition, ichunkaccess)) { // Paper end + EntityInsentient entityinsentient = a(worldserver, biomebase_biomemeta.c); + + if (entityinsentient == null) { +- return; ++ return j; // Paper + } + + entityinsentient.setPositionRotation(d0, (double) i, d1, worldserver.random.nextFloat() * 360.0F, 0.0F); +@@ -209,13 +251,18 @@ public final class SpawnerCreature { + groupdataentity = entityinsentient.prepare(worldserver, worldserver.getDamageScaler(entityinsentient.getChunkCoordinates()), EnumMobSpawn.NATURAL, groupdataentity, (NBTTagCompound) null); + // CraftBukkit start + if (worldserver.addEntity(entityinsentient, SpawnReason.NATURAL)) { +- ++j; ++ ++j; // Paper - force diff on name change - we expect this to be the total amount spawned + ++k1; + spawnercreature_a.run(entityinsentient, ichunkaccess); ++ // Paper start ++ if (trackEntity != null) { ++ trackEntity.accept(entityinsentient); ++ } ++ // Paper end + } + // CraftBukkit end +- if (j >= entityinsentient.getMaxSpawnGroup()) { +- return; ++ if (j >= entityinsentient.getMaxSpawnGroup() || j >= maxSpawns) { // Paper ++ return j; // Paper + } + + if (entityinsentient.c(k1)) { +@@ -237,6 +284,7 @@ public final class SpawnerCreature { + } + + } ++ return j; // Paper + } + + private static boolean a(WorldServer worldserver, IChunkAccess ichunkaccess, BlockPosition.MutableBlockPosition blockposition_mutableblockposition, double d0) { +@@ -476,8 +524,8 @@ public final class SpawnerCreature { + + public static class d { + +- private final int a; +- private final Object2IntOpenHashMap b; ++ private final int a; final int getSpawnerChunks() { return this.a; } // Paper - OBFHELPER ++ private final Object2IntOpenHashMap b; final Object2IntMap getEntityCountsByType() { return this.b; } // Paper - OBFHELPER + private final SpawnerCreatureProbabilities c; + private final Object2IntMap d; + @Nullable +@@ -540,7 +588,7 @@ public final class SpawnerCreature { + + // CraftBukkit start + private boolean a(EnumCreatureType enumcreaturetype, int limit) { +- int i = limit * this.a / SpawnerCreature.b; ++ int i = limit * this.a / SpawnerCreature.b; // Paper - diff on change, needed in the spawn method + // CraftBukkit end + + return this.b.getInt(enumcreaturetype) < i; diff --git a/Spigot-Server-Patches/0397-Prevent-consuming-the-wrong-itemstack.patch b/Spigot-Server-Patches/0384-Prevent-consuming-the-wrong-itemstack.patch similarity index 80% rename from Spigot-Server-Patches/0397-Prevent-consuming-the-wrong-itemstack.patch rename to Spigot-Server-Patches/0384-Prevent-consuming-the-wrong-itemstack.patch index c7c6b44c5..d439b641e 100644 --- a/Spigot-Server-Patches/0397-Prevent-consuming-the-wrong-itemstack.patch +++ b/Spigot-Server-Patches/0384-Prevent-consuming-the-wrong-itemstack.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Prevent consuming the wrong itemstack diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 0a31f2e931bba74ecda40c3792718a530acec3af..576c9c6ae4339951d4ec9fffa69c7f860d82b33f 100644 +index eeca12bd7c6e59b872303fda1378a69d03dcf783..d354e9b504b6872f20a9e433522827589bd4778a 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -2897,10 +2897,13 @@ public abstract class EntityLiving extends Entity { - this.datawatcher.set(EntityLiving.ao, (byte) j); +@@ -3068,10 +3068,13 @@ public abstract class EntityLiving extends Entity { + this.datawatcher.set(EntityLiving.an, (byte) j); } - public void c(EnumHand enumhand) { @@ -22,20 +22,20 @@ index 0a31f2e931bba74ecda40c3792718a530acec3af..576c9c6ae4339951d4ec9fffa69c7f86 - if (!itemstack.isEmpty() && !this.isHandRaised()) { + if (!itemstack.isEmpty() && !this.isHandRaised() || forceUpdate) { // Paper use override flag this.activeItem = itemstack; - this.bl = itemstack.k(); + this.bk = itemstack.k(); if (!this.world.isClientSide) { -@@ -2976,6 +2979,7 @@ public abstract class EntityLiving extends Entity { - this.clearActiveItem(); +@@ -3147,6 +3150,7 @@ public abstract class EntityLiving extends Entity { + this.releaseActiveItem(); } else { if (!this.activeItem.isEmpty() && this.isHandRaised()) { + this.updateActiveItem(this.getRaisedHand(), true); // Paper this.b(this.activeItem, 16); // CraftBukkit start - fire PlayerItemConsumeEvent ItemStack itemstack; -@@ -3006,8 +3010,8 @@ public abstract class EntityLiving extends Entity { +@@ -3177,8 +3181,8 @@ public abstract class EntityLiving extends Entity { this.a(this.getRaisedHand(), itemstack); // CraftBukkit end - this.dH(); + this.clearActiveItem(); - // Paper start - if the replacement is anything but the default, update the client inventory - if (this instanceof EntityPlayer && !com.google.common.base.Objects.equal(defaultReplacement, itemstack)) { + // Paper start diff --git a/Spigot-Server-Patches/0398-only-add-passanger-entities-once-from-spawners.patch b/Spigot-Server-Patches/0385-only-add-passanger-entities-once-from-spawners.patch similarity index 90% rename from Spigot-Server-Patches/0398-only-add-passanger-entities-once-from-spawners.patch rename to Spigot-Server-Patches/0385-only-add-passanger-entities-once-from-spawners.patch index 63a8d16c9..64f30c9f2 100644 --- a/Spigot-Server-Patches/0398-only-add-passanger-entities-once-from-spawners.patch +++ b/Spigot-Server-Patches/0385-only-add-passanger-entities-once-from-spawners.patch @@ -5,7 +5,7 @@ Subject: [PATCH] only add passanger entities once from spawners diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -index 41001b02a654194c4a8e25ad5f7af8fdd91090b2..df494d37be687860878c2709ae7996510118a559 100644 +index 921abae4914c7b3f28d387f7a682d991293c4798..2f1d168bd6daad1bbd41977b18263d1fe67a3da0 100644 --- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java @@ -196,7 +196,7 @@ public abstract class MobSpawnerAbstract { diff --git a/Spigot-Server-Patches/0399-Fix-nether-portal-creation.patch b/Spigot-Server-Patches/0386-Fix-nether-portal-creation.patch similarity index 100% rename from Spigot-Server-Patches/0399-Fix-nether-portal-creation.patch rename to Spigot-Server-Patches/0386-Fix-nether-portal-creation.patch diff --git a/Spigot-Server-Patches/0387-Generator-Settings.patch b/Spigot-Server-Patches/0387-Generator-Settings.patch new file mode 100644 index 000000000..c60e196ea --- /dev/null +++ b/Spigot-Server-Patches/0387-Generator-Settings.patch @@ -0,0 +1,89 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Byteflux +Date: Wed, 2 Mar 2016 02:17:54 -0600 +Subject: [PATCH] Generator Settings + + +diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +index edf4fa474d32ac20ff85cecfa9f03464a7ecf6ec..fde31f324b3578c65a7d064c466b80ee46b65e03 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +@@ -567,4 +567,9 @@ public class PaperWorldConfig { + private void perPlayerMobSpawns() { + perPlayerMobSpawns = getBoolean("per-player-mob-spawns", false); + } ++ ++ public boolean generateFlatBedrock; ++ private void generatorSettings() { ++ generateFlatBedrock = getBoolean("generator-settings.flat-bedrock", false); ++ } + } +diff --git a/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java b/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java +index bbd955160802fdb231cd8090d95f4e49f10d8495..733c6244e08f6b7277006c1ed801f2cfc8fc36e5 100644 +--- a/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java ++++ b/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java +@@ -370,8 +370,8 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator { + BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition(); + int i = ichunkaccess.getPos().d(); + int j = ichunkaccess.getPos().e(); +- int k = this.h.f(); +- int l = this.x - 1 - this.h.e(); ++ int k = this.h.f(); final int floorHeight = k; // Paper ++ int l = this.x - 1 - this.h.e(); final int roofHeight = l; // Paper + boolean flag = true; + boolean flag1 = l + 4 >= 0 && l < this.x; + boolean flag2 = k + 4 >= 0 && k < this.x; +@@ -385,7 +385,7 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator { + + if (flag1) { + for (i1 = 0; i1 < 5; ++i1) { +- if (i1 <= random.nextInt(5)) { ++ if (i1 <= (ichunkaccess.generateFlatBedrock() ? roofHeight : random.nextInt(5))) { // Paper - Configurable flat bedrock roof + ichunkaccess.setType(blockposition_mutableblockposition.d(blockposition.getX(), l - i1, blockposition.getZ()), Blocks.BEDROCK.getBlockData(), false); + } + } +@@ -393,7 +393,7 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator { + + if (flag2) { + for (i1 = 4; i1 >= 0; --i1) { +- if (i1 <= random.nextInt(5)) { ++ if (i1 <= (ichunkaccess.generateFlatBedrock() ? floorHeight : random.nextInt(5))) { // Paper - Configurable flat bedrock floor + ichunkaccess.setType(blockposition_mutableblockposition.d(blockposition.getX(), k + i1, blockposition.getZ()), Blocks.BEDROCK.getBlockData(), false); + } + } +diff --git a/src/main/java/net/minecraft/server/IChunkAccess.java b/src/main/java/net/minecraft/server/IChunkAccess.java +index 3adb35b6abd0df9617e27e10fa3e0d365958ba42..930cd8106412b362650c77a69ea5f945043c92c7 100644 +--- a/src/main/java/net/minecraft/server/IChunkAccess.java ++++ b/src/main/java/net/minecraft/server/IChunkAccess.java +@@ -12,6 +12,18 @@ import org.apache.logging.log4j.LogManager; + + public interface IChunkAccess extends IBlockAccess, IStructureAccess { + ++ // Paper start ++ default boolean generateFlatBedrock() { ++ if (this instanceof ProtoChunk) { ++ return ((ProtoChunk)this).world.paperConfig.generateFlatBedrock; ++ } else if (this instanceof Chunk) { ++ return ((Chunk)this).world.paperConfig.generateFlatBedrock; ++ } else { ++ return false; ++ } ++ } ++ // Paper end ++ + IBlockData getType(final int x, final int y, final int z); // Paper + @Nullable + IBlockData setType(BlockPosition blockposition, IBlockData iblockdata, boolean flag); +diff --git a/src/main/java/net/minecraft/server/ProtoChunk.java b/src/main/java/net/minecraft/server/ProtoChunk.java +index a60b414cdf70096e667e776ab4fd36e411f8ff12..3b03c28ee5de1481e1f8088c0e4d388778155fad 100644 +--- a/src/main/java/net/minecraft/server/ProtoChunk.java ++++ b/src/main/java/net/minecraft/server/ProtoChunk.java +@@ -46,7 +46,7 @@ public class ProtoChunk implements IChunkAccess { + private long s; + private final Map t; + private volatile boolean u; +- private final World world; // Paper - Anti-Xray - Add world ++ final World world; // Paper - Anti-Xray - Add world // Paper - private -> default + + // Paper start - Anti-Xray - Add world + @Deprecated public ProtoChunk(ChunkCoordIntPair chunkcoordintpair, ChunkConverter chunkconverter) { this(chunkcoordintpair, chunkconverter, null); } // Notice for updates: Please make sure this constructor isn't used anywhere diff --git a/Spigot-Server-Patches/0402-Fix-MC-161754.patch b/Spigot-Server-Patches/0388-Fix-MC-161754.patch similarity index 91% rename from Spigot-Server-Patches/0402-Fix-MC-161754.patch rename to Spigot-Server-Patches/0388-Fix-MC-161754.patch index 9ba10c6d7..bab48dada 100644 --- a/Spigot-Server-Patches/0402-Fix-MC-161754.patch +++ b/Spigot-Server-Patches/0388-Fix-MC-161754.patch @@ -9,7 +9,7 @@ We can use an entity valid check since this method is invoked for each inventory iteraction (thanks to CB) and on player tick (vanilla). diff --git a/src/main/java/net/minecraft/server/ContainerHorse.java b/src/main/java/net/minecraft/server/ContainerHorse.java -index c95ce0124d948626732e796c386b7544e34b36c4..18e1ae7f0a4b06ec7d7400e791ac79e5192eb8d8 100644 +index 82109f50778a3ac4bea43ef83b5442105a45664a..ebaf45be997d121e1974dc1f920dccbf11744cb3 100644 --- a/src/main/java/net/minecraft/server/ContainerHorse.java +++ b/src/main/java/net/minecraft/server/ContainerHorse.java @@ -76,7 +76,7 @@ public class ContainerHorse extends Container { diff --git a/Spigot-Server-Patches/0403-Performance-improvement-for-Chunk.getEntities.patch b/Spigot-Server-Patches/0389-Performance-improvement-for-Chunk.getEntities.patch similarity index 90% rename from Spigot-Server-Patches/0403-Performance-improvement-for-Chunk.getEntities.patch rename to Spigot-Server-Patches/0389-Performance-improvement-for-Chunk.getEntities.patch index e58b04f55..d166242db 100644 --- a/Spigot-Server-Patches/0403-Performance-improvement-for-Chunk.getEntities.patch +++ b/Spigot-Server-Patches/0389-Performance-improvement-for-Chunk.getEntities.patch @@ -10,10 +10,10 @@ operation. This patch will reduce the load of plugins which for example implement custom moblimits and depend on Chunk.getEntities(). diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -index 47f1b970b9ba39f9050ac34a5ac15593c25f8a70..39ef95cbbb1d1d049354ae1e8991309e918d0462 100644 +index cccb8f7b1c13811db7203282a5caad3da5b69a09..01bf7320b5cbc38e278ca907aa324ee3e945805e 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -@@ -111,14 +111,14 @@ public class CraftChunk implements Chunk { +@@ -113,14 +113,14 @@ public class CraftChunk implements Chunk { Entity[] entities = new Entity[count]; for (int i = 0; i < 16; i++) { diff --git a/Spigot-Server-Patches/0404-Fix-spawning-of-hanging-entities-that-are-not-ItemFr.patch b/Spigot-Server-Patches/0390-Fix-spawning-of-hanging-entities-that-are-not-ItemFr.patch similarity index 90% rename from Spigot-Server-Patches/0404-Fix-spawning-of-hanging-entities-that-are-not-ItemFr.patch rename to Spigot-Server-Patches/0390-Fix-spawning-of-hanging-entities-that-are-not-ItemFr.patch index f136189c9..1635ff96f 100644 --- a/Spigot-Server-Patches/0404-Fix-spawning-of-hanging-entities-that-are-not-ItemFr.patch +++ b/Spigot-Server-Patches/0390-Fix-spawning-of-hanging-entities-that-are-not-ItemFr.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Fix spawning of hanging entities that are not ItemFrames and diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 5aea49404717061fce4bf24e91f36217db5cee83..c030ff7b34fdd4c4632714a800935a6a5f8082cb 100644 +index 310c4446734a7ebfadf0cbd74d1cfcee20ef3668..080f600008ce1cba12c2bfe07e014e8adb7b7b2b 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -1850,7 +1850,12 @@ public class CraftWorld implements World { +@@ -1870,7 +1870,12 @@ public class CraftWorld implements World { height = 9; } diff --git a/Spigot-Server-Patches/0405-Expose-the-internal-current-tick.patch b/Spigot-Server-Patches/0391-Expose-the-internal-current-tick.patch similarity index 81% rename from Spigot-Server-Patches/0405-Expose-the-internal-current-tick.patch rename to Spigot-Server-Patches/0391-Expose-the-internal-current-tick.patch index cb23c2a1b..7b3a02cf8 100644 --- a/Spigot-Server-Patches/0405-Expose-the-internal-current-tick.patch +++ b/Spigot-Server-Patches/0391-Expose-the-internal-current-tick.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Expose the internal current tick diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 14cc12d772fe8c879a282275e3ee76cd66047c6b..e8d3528d515754affb14c947109ccdf1739d9745 100644 +index 04349821b5ffdc9e7f81de072bfb01b1b6dcf684..f3169a2b9b2c4a06d6502cb96ddca8616cbcbf32 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2203,5 +2203,10 @@ public final class CraftServer implements Server { +@@ -2282,5 +2282,10 @@ public final class CraftServer implements Server { } return new com.destroystokyo.paper.profile.CraftPlayerProfile(uuid, name); } diff --git a/Spigot-Server-Patches/0406-Fix-stuck-in-sneak-when-changing-worlds-MC-10657.patch b/Spigot-Server-Patches/0392-Fix-stuck-in-sneak-when-changing-worlds-MC-10657.patch similarity index 77% rename from Spigot-Server-Patches/0406-Fix-stuck-in-sneak-when-changing-worlds-MC-10657.patch rename to Spigot-Server-Patches/0392-Fix-stuck-in-sneak-when-changing-worlds-MC-10657.patch index 076f9ddec..ed16ef155 100644 --- a/Spigot-Server-Patches/0406-Fix-stuck-in-sneak-when-changing-worlds-MC-10657.patch +++ b/Spigot-Server-Patches/0392-Fix-stuck-in-sneak-when-changing-worlds-MC-10657.patch @@ -5,23 +5,23 @@ Subject: [PATCH] Fix stuck in sneak when changing worlds (MC-10657) diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 3db173fb5559e62150192a28dbdccdff16787401..81f00141776a1767b907d14ef04f60b576110128 100644 +index 6787b467f18bb03a8d45dc254988b5084c74f499..bb60ce14f6c13bc3f123893150129edb955bfff5 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -984,6 +984,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -1016,6 +1016,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting { this.lastHealthSent = -1.0F; this.lastFoodSent = -1; + setSneaking(false); // Paper - fix MC-10657 + // CraftBukkit start - PlayerChangedWorldEvent changeEvent = new PlayerChangedWorldEvent(this.getBukkitEntity(), worldserver.getWorld()); + PlayerChangedWorldEvent changeEvent = new PlayerChangedWorldEvent(this.getBukkitEntity(), worldserver1.getWorld()); this.world.getServer().getPluginManager().callEvent(changeEvent); diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index e3127e01a5642225bf24bb061b069765da16cf72..e479dedc889bdfabda99d9c2b36f6c4b7ce87a99 100644 +index 62b9c1f23fcc9df1ba49823a45b54b4e547813d0..a047375a231e49485a053903713b6ee5cbc9971f 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -718,6 +718,8 @@ public abstract class PlayerList { +@@ -759,6 +759,8 @@ public abstract class PlayerList { entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityEffect(entityplayer.getId(), mobEffect)); } diff --git a/Spigot-Server-Patches/0407-Add-option-to-disable-pillager-patrols.patch b/Spigot-Server-Patches/0393-Add-option-to-disable-pillager-patrols.patch similarity index 80% rename from Spigot-Server-Patches/0407-Add-option-to-disable-pillager-patrols.patch rename to Spigot-Server-Patches/0393-Add-option-to-disable-pillager-patrols.patch index 2e175f197..a159a6c4e 100644 --- a/Spigot-Server-Patches/0407-Add-option-to-disable-pillager-patrols.patch +++ b/Spigot-Server-Patches/0393-Add-option-to-disable-pillager-patrols.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add option to disable pillager patrols diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index f6f5f9dea6284582e9a175c0875273ee1db76076..19f355d00ebe7065ae2d2df8156ea4b6459a6598 100644 +index fde31f324b3578c65a7d064c466b80ee46b65e03..c51a149fd9cd7f2d250f07a4ca0e7ce8c9b91383 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -614,4 +614,9 @@ public class PaperWorldConfig { +@@ -572,4 +572,9 @@ public class PaperWorldConfig { private void generatorSettings() { generateFlatBedrock = getBoolean("generator-settings.flat-bedrock", false); } @@ -19,12 +19,12 @@ index f6f5f9dea6284582e9a175c0875273ee1db76076..19f355d00ebe7065ae2d2df8156ea4b6 + } } diff --git a/src/main/java/net/minecraft/server/MobSpawnerPatrol.java b/src/main/java/net/minecraft/server/MobSpawnerPatrol.java -index 33488b37e4d0dd295e0f48b59c43d30208eb531a..a0f582807605b9cc5bbf31d84907e56fba393e2e 100644 +index e108f14b36b5459503e02146f8c11e5223d6bd61..b1fea06d29a0c98136496d6eff81e6959cb73672 100644 --- a/src/main/java/net/minecraft/server/MobSpawnerPatrol.java +++ b/src/main/java/net/minecraft/server/MobSpawnerPatrol.java -@@ -9,6 +9,7 @@ public class MobSpawnerPatrol { - public MobSpawnerPatrol() {} +@@ -10,6 +10,7 @@ public class MobSpawnerPatrol implements MobSpawner { + @Override public int a(WorldServer worldserver, boolean flag, boolean flag1) { + if (worldserver.paperConfig.disablePillagerPatrols) return 0; // Paper if (!flag) { diff --git a/Spigot-Server-Patches/0394-Do-less-work-if-we-have-a-custom-Bukkit-generator.patch b/Spigot-Server-Patches/0394-Do-less-work-if-we-have-a-custom-Bukkit-generator.patch deleted file mode 100644 index 10d83ed9e..000000000 --- a/Spigot-Server-Patches/0394-Do-less-work-if-we-have-a-custom-Bukkit-generator.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Paul Sauve -Date: Sun, 14 Jul 2019 21:05:03 -0500 -Subject: [PATCH] Do less work if we have a custom Bukkit generator - -If the Bukkit generator already has a spawn, use it immediately instead -of spending time generating one that we won't use - -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index befdabc38edfcdffb588c4cdbe52908afe8a9c04..469f4e718ba123c65b9743877555f14d8d218589 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -814,12 +814,13 @@ public class WorldServer extends World { - } else if (this.worldData.getType() == WorldType.DEBUG_ALL_BLOCK_STATES) { - this.worldData.setSpawn(BlockPosition.ZERO.up()); - } else { -- WorldChunkManager worldchunkmanager = this.getChunkProvider().getChunkGenerator().getWorldChunkManager(); -- List list = worldchunkmanager.a(); -- Random random = new Random(this.getSeed()); -- BlockPosition blockposition = worldchunkmanager.a(0, this.getSeaLevel(), 0, 256, list, random); -- ChunkCoordIntPair chunkcoordintpair = blockposition == null ? new ChunkCoordIntPair(0, 0) : new ChunkCoordIntPair(blockposition); -- -+// Paper start - moved down -+// WorldChunkManager worldchunkmanager = this.getChunkProvider().getChunkGenerator().getWorldChunkManager(); -+// List list = worldchunkmanager.a(); -+// Random random = new Random(this.getSeed()); -+// BlockPosition blockposition = worldchunkmanager.a(0, this.getSeaLevel(), 0, 256, list, random); -+// ChunkCoordIntPair chunkcoordintpair = blockposition == null ? new ChunkCoordIntPair(0, 0) : new ChunkCoordIntPair(blockposition); -+// Paper end - // CraftBukkit start - if (this.generator != null) { - Random rand = new Random(this.getSeed()); -@@ -836,6 +837,13 @@ public class WorldServer extends World { - } - // CraftBukkit end - -+ // Paper start - this is useless if craftbukkit returns early -+ WorldChunkManager worldchunkmanager = this.getChunkProvider().getChunkGenerator().getWorldChunkManager(); -+ List list = worldchunkmanager.a(); -+ Random random = new Random(this.getSeed()); -+ BlockPosition blockposition = worldchunkmanager.a(0, this.getSeaLevel(), 0, 256, list, random); -+ ChunkCoordIntPair chunkcoordintpair = blockposition == null ? new ChunkCoordIntPair(0, 0) : new ChunkCoordIntPair(blockposition); -+ // Paper end - if (blockposition == null) { - WorldServer.LOGGER.warn("Unable to find spawn biome"); - } diff --git a/Spigot-Server-Patches/0408-Fix-AssertionError-when-player-hand-set-to-empty-typ.patch b/Spigot-Server-Patches/0394-Fix-AssertionError-when-player-hand-set-to-empty-typ.patch similarity index 55% rename from Spigot-Server-Patches/0408-Fix-AssertionError-when-player-hand-set-to-empty-typ.patch rename to Spigot-Server-Patches/0394-Fix-AssertionError-when-player-hand-set-to-empty-typ.patch index 79d4feb42..84834967e 100644 --- a/Spigot-Server-Patches/0408-Fix-AssertionError-when-player-hand-set-to-empty-typ.patch +++ b/Spigot-Server-Patches/0394-Fix-AssertionError-when-player-hand-set-to-empty-typ.patch @@ -7,29 +7,29 @@ Fixes an AssertionError when setting the player's item in hand to null or a new Fixes GH-2718 diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 24594aa0e9b8741811acfc9f84f4db7552832bd2..aada8d3b08b437f81f68f8e988412c1071287d54 100644 +index d354e9b504b6872f20a9e433522827589bd4778a..12b27c44d77b72fa4a4d42cfe3db8394a47d9c9b 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -1891,6 +1891,7 @@ public abstract class EntityLiving extends Entity { - return this.getEquipment(EnumItemSlot.OFFHAND); +@@ -2040,6 +2040,7 @@ public abstract class EntityLiving extends Entity { + return predicate.test(this.getItemInMainHand().getItem()) || predicate.test(this.getItemInOffHand().getItem()); } -+ public ItemStack getItemInHand(EnumHand enumhand) { return this.b(enumhand); } // Paper - OBFHELPER ++ public final ItemStack getItemInHand(EnumHand enumhand) { return this.b(enumhand); } // Paper - OBFHELPER public ItemStack b(EnumHand enumhand) { if (enumhand == EnumHand.MAIN_HAND) { return this.getEquipment(EnumItemSlot.MAINHAND); diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 5d9bca7a87f463ede1ff0a478d5d6d524ccb877b..3ef083f7df1604e39405ed59b8630334ee9fcd4a 100644 +index 092e49ae11ff735cf0179de8e0aaa73f7842e372..eb5231571884d1c828935b007d8fba3499bb68d2 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1438,6 +1438,10 @@ public class PlayerConnection implements PacketListenerPlayIn { - if (cancelled) { +@@ -1478,6 +1478,10 @@ public class PlayerConnection implements PacketListenerPlayIn { this.player.getBukkitEntity().updateInventory(); // SPIGOT-2524 - } else { -+ // Paper start -+ itemstack = this.player.getItemInHand(enumhand); -+ if (itemstack.isEmpty()) return; -+ // Paper end - this.player.playerInteractManager.a(this.player, worldserver, itemstack, enumhand); + return; } - // CraftBukkit end ++ // Paper start ++ itemstack = this.player.getItemInHand(enumhand); ++ if (itemstack.isEmpty()) return; ++ // Paper end + EnumInteractionResult enuminteractionresult = this.player.playerInteractManager.a(this.player, worldserver, itemstack, enumhand); + + if (enuminteractionresult.b()) { diff --git a/Spigot-Server-Patches/0409-PlayerLaunchProjectileEvent.patch b/Spigot-Server-Patches/0395-PlayerLaunchProjectileEvent.patch similarity index 82% rename from Spigot-Server-Patches/0409-PlayerLaunchProjectileEvent.patch rename to Spigot-Server-Patches/0395-PlayerLaunchProjectileEvent.patch index d5773b74c..cf650d9db 100644 --- a/Spigot-Server-Patches/0409-PlayerLaunchProjectileEvent.patch +++ b/Spigot-Server-Patches/0395-PlayerLaunchProjectileEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] PlayerLaunchProjectileEvent diff --git a/src/main/java/net/minecraft/server/InteractionResultWrapper.java b/src/main/java/net/minecraft/server/InteractionResultWrapper.java -index 5cab47a2821adf869693132f8ce1193b1543f896..886babdcda0b559fc6a760b48074bec44e0f9da1 100644 +index d59a0b739c0b8787029969a14002042e5c288ae8..8b2fc1c0e608c911b2cdc95ef134f84e3760c05d 100644 --- a/src/main/java/net/minecraft/server/InteractionResultWrapper.java +++ b/src/main/java/net/minecraft/server/InteractionResultWrapper.java @@ -10,6 +10,7 @@ public class InteractionResultWrapper { @@ -17,7 +17,7 @@ index 5cab47a2821adf869693132f8ce1193b1543f896..886babdcda0b559fc6a760b48074bec4 return this.a; } diff --git a/src/main/java/net/minecraft/server/ItemEgg.java b/src/main/java/net/minecraft/server/ItemEgg.java -index 6fccd70a034b5d70729f57e0f2ee56e59e6f9cbc..16f1b734e01ee7cf917d2f9a4a4dc1e98e4f2af9 100644 +index f028cb04d692f848a4682aa2eeac2174eb0f6769..6ddb0237c013e5c40d6c28a300f33443f6f703a5 100644 --- a/src/main/java/net/minecraft/server/ItemEgg.java +++ b/src/main/java/net/minecraft/server/ItemEgg.java @@ -16,21 +16,35 @@ public class ItemEgg extends Item { @@ -49,7 +49,7 @@ index 6fccd70a034b5d70729f57e0f2ee56e59e6f9cbc..16f1b734e01ee7cf917d2f9a4a4dc1e9 + + } - world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_EGG_THROW, SoundCategory.PLAYERS, 0.5F, 0.4F / (ItemEgg.i.nextFloat() * 0.4F + 0.8F)); // CraftBukkit - from above + world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_EGG_THROW, SoundCategory.PLAYERS, 0.5F, 0.4F / (ItemEgg.RANDOM.nextFloat() * 0.4F + 0.8F)); // CraftBukkit - from above + /* // Paper start - moved up entityhuman.b(StatisticList.ITEM_USED.b(this)); @@ -58,10 +58,10 @@ index 6fccd70a034b5d70729f57e0f2ee56e59e6f9cbc..16f1b734e01ee7cf917d2f9a4a4dc1e9 } + */ // Paper end - return InteractionResultWrapper.success(itemstack); + return InteractionResultWrapper.a(itemstack, world.s_()); } diff --git a/src/main/java/net/minecraft/server/ItemEnderPearl.java b/src/main/java/net/minecraft/server/ItemEnderPearl.java -index cab869e8e9b6a505e23c109c4434178a8824ba45..b57e9f7e72b892165129c3857d5d03a088bee3ee 100644 +index aa7356e6a18c0bf72314e92809a4eab320d3695f..0e154ee2976694dacf8d41fcd831f21fbbda13af 100644 --- a/src/main/java/net/minecraft/server/ItemEnderPearl.java +++ b/src/main/java/net/minecraft/server/ItemEnderPearl.java @@ -16,22 +16,37 @@ public class ItemEnderPearl extends Item { @@ -91,7 +91,7 @@ index cab869e8e9b6a505e23c109c4434178a8824ba45..b57e9f7e72b892165129c3857d5d03a0 } } -- world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_ENDER_PEARL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemEnderPearl.i.nextFloat() * 0.4F + 0.8F)); +- world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_ENDER_PEARL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemEnderPearl.RANDOM.nextFloat() * 0.4F + 0.8F)); - entityhuman.getCooldownTracker().setCooldown(this, 20); - // CraftBukkit end - @@ -100,7 +100,7 @@ index cab869e8e9b6a505e23c109c4434178a8824ba45..b57e9f7e72b892165129c3857d5d03a0 - itemstack.subtract(1); - } + // Paper start - moved up -+// world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_ENDER_PEARL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemEnderPearl.i.nextFloat() * 0.4F + 0.8F)); ++// world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_ENDER_PEARL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemEnderPearl.RANDOM.nextFloat() * 0.4F + 0.8F)); +// entityhuman.getCooldownTracker().setCooldown(this, 20); +// // CraftBukkit end +// @@ -108,20 +108,20 @@ index cab869e8e9b6a505e23c109c4434178a8824ba45..b57e9f7e72b892165129c3857d5d03a0 +// if (!entityhuman.abilities.canInstantlyBuild) { +// itemstack.subtract(1); +// } -+ // Paper end ++ // Paper end - moved up - return InteractionResultWrapper.success(itemstack); + return InteractionResultWrapper.a(itemstack, world.s_()); } diff --git a/src/main/java/net/minecraft/server/ItemExpBottle.java b/src/main/java/net/minecraft/server/ItemExpBottle.java -index 071688b3ab45a527a642c3d16c8d8b1f3682e63c..1d575af5269762f6f2616884a7733470cca06be5 100644 +index 07e12714d064a2ccc7a3a50fbb88517f9a3b8b78..10abf20e907f1ea25797ff33d181de7eaed9a9da 100644 --- a/src/main/java/net/minecraft/server/ItemExpBottle.java +++ b/src/main/java/net/minecraft/server/ItemExpBottle.java @@ -15,19 +15,38 @@ public class ItemExpBottle extends Item { public InteractionResultWrapper a(World world, EntityHuman entityhuman, EnumHand enumhand) { ItemStack itemstack = entityhuman.b(enumhand); -- world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_EXPERIENCE_BOTTLE_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemExpBottle.i.nextFloat() * 0.4F + 0.8F)); -+// world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_EXPERIENCE_BOTTLE_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemExpBottle.i.nextFloat() * 0.4F + 0.8F)); // Paper - moved down +- world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_EXPERIENCE_BOTTLE_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemExpBottle.RANDOM.nextFloat() * 0.4F + 0.8F)); ++ //world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_EXPERIENCE_BOTTLE_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemExpBottle.RANDOM.nextFloat() * 0.4F + 0.8F)); // Paper - moved down if (!world.isClientSide) { EntityThrownExpBottle entitythrownexpbottle = new EntityThrownExpBottle(world, entityhuman); @@ -155,28 +155,29 @@ index 071688b3ab45a527a642c3d16c8d8b1f3682e63c..1d575af5269762f6f2616884a7733470 } + */ // Paper end - return InteractionResultWrapper.success(itemstack); + return InteractionResultWrapper.a(itemstack, world.s_()); } diff --git a/src/main/java/net/minecraft/server/ItemLingeringPotion.java b/src/main/java/net/minecraft/server/ItemLingeringPotion.java -index c19b678cfb2bc3c27858488031e119d482905f8b..7672e31fc0c915c49c8752ba864c2706f1292e86 100644 +index 685d958994bc35ad5eceba629e6743b41e2cc04b..58f7191a6980265e8fab17cf39769bbbca0ee105 100644 --- a/src/main/java/net/minecraft/server/ItemLingeringPotion.java +++ b/src/main/java/net/minecraft/server/ItemLingeringPotion.java -@@ -8,7 +8,11 @@ public class ItemLingeringPotion extends ItemPotionThrowable { +@@ -8,7 +8,12 @@ public class ItemLingeringPotion extends ItemPotionThrowable { @Override public InteractionResultWrapper a(World world, EntityHuman entityhuman, EnumHand enumhand) { -- world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_LINGERING_POTION_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemLingeringPotion.i.nextFloat() * 0.4F + 0.8F)); +- world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_LINGERING_POTION_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemLingeringPotion.RANDOM.nextFloat() * 0.4F + 0.8F)); - return super.a(world, entityhuman, enumhand); + // Paper start + InteractionResultWrapper wrapper = super.a(world, entityhuman, enumhand); -+ if (wrapper.getResult() != EnumInteractionResult.FAIL) -+ world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_LINGERING_POTION_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemLingeringPotion.i.nextFloat() * 0.4F + 0.8F)); ++ if (wrapper.getResult() != EnumInteractionResult.FAIL) { ++ world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_LINGERING_POTION_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemLingeringPotion.RANDOM.nextFloat() * 0.4F + 0.8F)); ++ } + return wrapper; + // Paper end } } diff --git a/src/main/java/net/minecraft/server/ItemPotionThrowable.java b/src/main/java/net/minecraft/server/ItemPotionThrowable.java -index 5d1f118c5139540a809dbaeee0982fbc7e9c3996..d1beab1ab72dffd3ee671982991d414b9244973d 100644 +index dee3d4042b0cd1ace86fe1d80d894d0cc48cf941..9c84de77df7e32915a633b92c842cfb69e30e0d0 100644 --- a/src/main/java/net/minecraft/server/ItemPotionThrowable.java +++ b/src/main/java/net/minecraft/server/ItemPotionThrowable.java @@ -15,13 +15,31 @@ public class ItemPotionThrowable extends ItemPotion { @@ -210,13 +211,13 @@ index 5d1f118c5139540a809dbaeee0982fbc7e9c3996..d1beab1ab72dffd3ee671982991d414b } + */ // Paper end - return InteractionResultWrapper.success(itemstack); + return InteractionResultWrapper.a(itemstack, world.s_()); } diff --git a/src/main/java/net/minecraft/server/ItemSnowball.java b/src/main/java/net/minecraft/server/ItemSnowball.java -index 56ec5089596de4209780a823a2a3f37676ec515b..e6044e654b78ab8ef9d73ef7bd6ad82a079745a8 100644 +index 19ac8cc57d6400e7574dd475dd21f2f48a954324..4242b5c4ed1e7d546fee7e2b3892b7b25e1259ff 100644 --- a/src/main/java/net/minecraft/server/ItemSnowball.java +++ b/src/main/java/net/minecraft/server/ItemSnowball.java -@@ -17,19 +17,27 @@ public class ItemSnowball extends Item { +@@ -17,14 +17,20 @@ public class ItemSnowball extends Item { entitysnowball.setItem(itemstack); entitysnowball.a(entityhuman, entityhuman.pitch, entityhuman.yaw, 0.0F, 1.5F, 1.0F); @@ -226,44 +227,35 @@ index 56ec5089596de4209780a823a2a3f37676ec515b..e6044e654b78ab8ef9d73ef7bd6ad82a + com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent event = new com.destroystokyo.paper.event.player.PlayerLaunchProjectileEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack), (org.bukkit.entity.Projectile) entitysnowball.getBukkitEntity()); + if (event.callEvent() && world.addEntity(entitysnowball)) { + if (event.shouldConsume() && !entityhuman.abilities.canInstantlyBuild) { ++ // Paper end itemstack.subtract(1); -+ } else if (entityhuman instanceof EntityPlayer) { -+ ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); ++ } else if (entityhuman instanceof EntityPlayer) { // Paper ++ ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); // Paper } -- world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemSnowball.i.nextFloat() * 0.4F + 0.8F)); + world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemSnowball.RANDOM.nextFloat() * 0.4F + 0.8F)); - } else if (entityhuman instanceof EntityPlayer) { - ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); -+ world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (Entity.SHARED_RANDOM.nextFloat() * 0.4F + 0.8F)); -+ entityhuman.b(StatisticList.ITEM_USED.b(this)); -+ } else { -+ if (entityhuman instanceof EntityPlayer) { -+ ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); -+ } -+ return new InteractionResultWrapper(EnumInteractionResult.FAIL, itemstack); ++ } else { // Paper ++ if (entityhuman instanceof EntityPlayer) ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); // Paper ++ return new InteractionResultWrapper(EnumInteractionResult.FAIL, itemstack); // Paper } } // CraftBukkit end - -- entityhuman.b(StatisticList.ITEM_USED.b(this)); -+// entityhuman.b(StatisticList.ITEM_USED.b(this)); // Paper - moved up - // CraftBukkit start - moved up - /* - if (!entityhuman.abilities.canInstantlyBuild) { diff --git a/src/main/java/net/minecraft/server/ItemSplashPotion.java b/src/main/java/net/minecraft/server/ItemSplashPotion.java -index 18bd846ceecf638fa1184a6cceb5c909ec49372c..e71e933fffb04aa4a00d02cfbc284da8ad3ee925 100644 +index 3574cf875c6284687c10637159ec96a823ade2dc..c919a402e80a5c6b17fdbd99e110be1abefda747 100644 --- a/src/main/java/net/minecraft/server/ItemSplashPotion.java +++ b/src/main/java/net/minecraft/server/ItemSplashPotion.java -@@ -8,7 +8,11 @@ public class ItemSplashPotion extends ItemPotionThrowable { +@@ -8,7 +8,12 @@ public class ItemSplashPotion extends ItemPotionThrowable { @Override public InteractionResultWrapper a(World world, EntityHuman entityhuman, EnumHand enumhand) { -- world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_SPLASH_POTION_THROW, SoundCategory.PLAYERS, 0.5F, 0.4F / (ItemSplashPotion.i.nextFloat() * 0.4F + 0.8F)); -- return super.a(world, entityhuman, enumhand); + // Paper start + InteractionResultWrapper wrapper = super.a(world, entityhuman, enumhand); -+ if (wrapper.getResult() != EnumInteractionResult.FAIL) -+ world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_SPLASH_POTION_THROW, SoundCategory.PLAYERS, 0.5F, 0.4F / (ItemSplashPotion.i.nextFloat() * 0.4F + 0.8F)); ++ if (wrapper.getResult() != EnumInteractionResult.FAIL) { + world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_SPLASH_POTION_THROW, SoundCategory.PLAYERS, 0.5F, 0.4F / (ItemSplashPotion.RANDOM.nextFloat() * 0.4F + 0.8F)); +- return super.a(world, entityhuman, enumhand); ++ } + return wrapper; + // Paper end } diff --git a/Spigot-Server-Patches/0410-Add-CraftMagicNumbers.isSupportedApiVersion.patch b/Spigot-Server-Patches/0396-Add-CraftMagicNumbers.isSupportedApiVersion.patch similarity index 84% rename from Spigot-Server-Patches/0410-Add-CraftMagicNumbers.isSupportedApiVersion.patch rename to Spigot-Server-Patches/0396-Add-CraftMagicNumbers.isSupportedApiVersion.patch index e84521520..ab71bf1a6 100644 --- a/Spigot-Server-Patches/0410-Add-CraftMagicNumbers.isSupportedApiVersion.patch +++ b/Spigot-Server-Patches/0396-Add-CraftMagicNumbers.isSupportedApiVersion.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add CraftMagicNumbers.isSupportedApiVersion() diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 79ddf03c7f3afc868cb73ee4c000fc879ede90d8..6363074c38312387b62e6cf5df2592aefb078f29 100644 +index b87b2eacc9a89c79d18c4c2168aca9f5ca953c81..ac9105c23cbe36dfbebfff63e074065b8f472c0e 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -314,6 +314,11 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -325,6 +325,11 @@ public final class CraftMagicNumbers implements UnsafeValues { public com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() { return new com.destroystokyo.paper.PaperVersionFetcher(); } diff --git a/Spigot-Server-Patches/0397-Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch b/Spigot-Server-Patches/0397-Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch new file mode 100644 index 000000000..74c074937 --- /dev/null +++ b/Spigot-Server-Patches/0397-Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch @@ -0,0 +1,20 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Callahan +Date: Mon, 13 Jan 2020 23:47:28 -0600 +Subject: [PATCH] Prevent sync chunk loads when villagers try to find beds + + +diff --git a/src/main/java/net/minecraft/server/BehaviorSleep.java b/src/main/java/net/minecraft/server/BehaviorSleep.java +index 77bbe246b225aab41fa193cf63286739118c05f4..615a06497588e07fa2b71194a5836ef6360bf0ca 100644 +--- a/src/main/java/net/minecraft/server/BehaviorSleep.java ++++ b/src/main/java/net/minecraft/server/BehaviorSleep.java +@@ -34,7 +34,8 @@ public class BehaviorSleep extends Behavior { + } + } + +- IBlockData iblockdata = worldserver.getType(globalpos.getBlockPosition()); ++ IBlockData iblockdata = worldserver.getTypeIfLoaded(globalpos.getBlockPosition()); // Paper ++ if (iblockdata == null) { return false; } // Paper + + return globalpos.getBlockPosition().a((IPosition) entityliving.getPositionVector(), 2.0D) && iblockdata.getBlock().a((Tag) TagsBlock.BEDS) && !(Boolean) iblockdata.get(BlockBed.OCCUPIED); + } diff --git a/Spigot-Server-Patches/0413-MC-145656-Fix-Follow-Range-Initial-Target.patch b/Spigot-Server-Patches/0398-MC-145656-Fix-Follow-Range-Initial-Target.patch similarity index 86% rename from Spigot-Server-Patches/0413-MC-145656-Fix-Follow-Range-Initial-Target.patch rename to Spigot-Server-Patches/0398-MC-145656-Fix-Follow-Range-Initial-Target.patch index 3494a9680..524934062 100644 --- a/Spigot-Server-Patches/0413-MC-145656-Fix-Follow-Range-Initial-Target.patch +++ b/Spigot-Server-Patches/0398-MC-145656-Fix-Follow-Range-Initial-Target.patch @@ -5,10 +5,10 @@ Subject: [PATCH] MC-145656 Fix Follow Range Initial Target diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 19f355d00ebe7065ae2d2df8156ea4b6459a6598..a26848df994ffb0dc02d6a6051971439613dd0ba 100644 +index c51a149fd9cd7f2d250f07a4ca0e7ce8c9b91383..f0a28d787e06ceae71034f757637b4c90b6f3c04 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -619,4 +619,9 @@ public class PaperWorldConfig { +@@ -577,4 +577,9 @@ public class PaperWorldConfig { private void pillagerSettings() { disablePillagerPatrols = getBoolean("game-mechanics.disable-pillager-patrols", disablePillagerPatrols); } @@ -19,7 +19,7 @@ index 19f355d00ebe7065ae2d2df8156ea4b6459a6598..a26848df994ffb0dc02d6a6051971439 + } } diff --git a/src/main/java/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java b/src/main/java/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java -index cd17bf2be53a92bcbe9c54794981753153bbef07..b85e67a85d16934c2158621b58701df403a42ff3 100644 +index 25a67f91e487d80d3996cc8b2544fece55059590..c0721c7fe479c8f753b8f48197a70dcd1ecfef5f 100644 --- a/src/main/java/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java +++ b/src/main/java/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java @@ -25,6 +25,7 @@ public class PathfinderGoalNearestAttackableTarget exten @@ -31,7 +31,7 @@ index cd17bf2be53a92bcbe9c54794981753153bbef07..b85e67a85d16934c2158621b58701df4 @Override diff --git a/src/main/java/net/minecraft/server/PathfinderTargetCondition.java b/src/main/java/net/minecraft/server/PathfinderTargetCondition.java -index c76a43837b443d09c0648d520b045765530d9af9..e35ec2db078cc888333cfdd44e1cd3fda71246da 100644 +index 42859f323ad5a300e0026e86371f5753ab3feab5..af09e1926fb6f3b780a5063b2e2e00da4cdc8ce6 100644 --- a/src/main/java/net/minecraft/server/PathfinderTargetCondition.java +++ b/src/main/java/net/minecraft/server/PathfinderTargetCondition.java @@ -80,7 +80,7 @@ public class PathfinderTargetCondition { @@ -57,7 +57,7 @@ index c76a43837b443d09c0648d520b045765530d9af9..e35ec2db078cc888333cfdd44e1cd3fd + } + + private double getFollowRange(EntityLiving entityliving) { -+ AttributeInstance attributeinstance = entityliving.getAttributeInstance(GenericAttributes.FOLLOW_RANGE); ++ AttributeModifiable attributeinstance = entityliving.getAttributeInstance(GenericAttributes.FOLLOW_RANGE); + return attributeinstance == null ? 16.0D : attributeinstance.getValue(); + } + // Paper end diff --git a/Spigot-Server-Patches/0414-Optimize-Hoppers.patch b/Spigot-Server-Patches/0399-Optimize-Hoppers.patch similarity index 91% rename from Spigot-Server-Patches/0414-Optimize-Hoppers.patch rename to Spigot-Server-Patches/0399-Optimize-Hoppers.patch index ad789cfbc..94cfe277e 100644 --- a/Spigot-Server-Patches/0414-Optimize-Hoppers.patch +++ b/Spigot-Server-Patches/0399-Optimize-Hoppers.patch @@ -13,10 +13,10 @@ Subject: [PATCH] Optimize Hoppers * Remove Streams from Item Suck In and restore restore 1.12 AABB checks which is simpler and no voxel allocations (was doing TWO Item Suck ins) diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index a26848df994ffb0dc02d6a6051971439613dd0ba..cab503bd5c34d12b38a2f5deed6d3feb9287b370 100644 +index f0a28d787e06ceae71034f757637b4c90b6f3c04..9bd64034587217743157a81c04fc20751474e21d 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -624,4 +624,13 @@ public class PaperWorldConfig { +@@ -582,4 +582,13 @@ public class PaperWorldConfig { private void entitiesTargetWithFollowRange() { entitiesTargetWithFollowRange = getBoolean("entities-target-with-follow-range", entitiesTargetWithFollowRange); } @@ -31,7 +31,7 @@ index a26848df994ffb0dc02d6a6051971439613dd0ba..cab503bd5c34d12b38a2f5deed6d3feb + } } diff --git a/src/main/java/net/minecraft/server/IHopper.java b/src/main/java/net/minecraft/server/IHopper.java -index e1aa272e526950e6405221e566cf4299c869a6b2..4da26365ec59ed33e10b55789e535a1c0e7b92a1 100644 +index d891be4115f35c7b9685faa34ce90380e989fb18..54552d181912133577cd2c16c0d54e47d90f59d3 100644 --- a/src/main/java/net/minecraft/server/IHopper.java +++ b/src/main/java/net/minecraft/server/IHopper.java @@ -12,12 +12,13 @@ public interface IHopper extends IInventory { @@ -43,20 +43,20 @@ index e1aa272e526950e6405221e566cf4299c869a6b2..4da26365ec59ed33e10b55789e535a1c World getWorld(); + default BlockPosition getBlockPosition() { return new BlockPosition(getX(), getY(), getZ()); } // Paper +- double x(); ++ double x(); default double getX() { return this.x(); } // Paper - OBFHELPER + - double z(); -+ double z();default double getX() { return z(); } // Paper - OBFHELPER ++ double z(); default double getY() { return this.z(); } // Paper - OBFHELPER - double A(); -+ double A();default double getY() { return A(); } // Paper - OBFHELPER - -- double B(); -+ double B();default double getZ() { return B(); } // Paper - OBFHELPER ++ double A(); default double getZ() { return this.A(); } // Paper - OBFHELPER } diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java -index d953cdef14a9b62833a35a4fe94a22b5e9b19c2d..d6e43313bf0c678cf78fe77de2f8f4b6f819e3f4 100644 +index a075a41d954836864a5186b383e967a9ac262df8..64150130fa0081786190eada4cd2d1312a51572d 100644 --- a/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java -@@ -482,11 +482,12 @@ public final class ItemStack { +@@ -486,11 +486,12 @@ public final class ItemStack { return this.getItem().a(this, entityhuman, entityliving, enumhand); } @@ -65,27 +65,27 @@ index d953cdef14a9b62833a35a4fe94a22b5e9b19c2d..d6e43313bf0c678cf78fe77de2f8f4b6 + public ItemStack cloneItemStack() { return cloneItemStack(false); } // Paper + public ItemStack cloneItemStack(boolean origItem) { // Paper + if (!origItem && this.isEmpty()) { // Paper - return ItemStack.a; + return ItemStack.b; } else { - ItemStack itemstack = new ItemStack(this.getItem(), this.count); + ItemStack itemstack = new ItemStack(origItem ? this.item : this.getItem(), this.count); // Paper - itemstack.d(this.C()); + itemstack.d(this.D()); if (this.tag != null) { diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 9450e27e5ce9295d87b95be2797fc27984ca2b0b..8c08a542a97edd76c07ef7d64834bdbd70345876 100644 +index 41c4b2df34faa95afdd2d35b0bac021d77c56884..67ab908879146c83bf591ae9956d0c038fb5c5d9 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1222,6 +1222,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant 0; // Paper + TileEntityHopper.skipHopperEvents = worldserver.paperConfig.disableHopperMoveEvents || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper - if (true || worldserver.worldProvider.getDimensionManager() == DimensionManager.OVERWORLD || this.getAllowNether()) { // CraftBukkit - this.methodProfiler.a(() -> { - return worldserver.getWorldData().getName() + " " + IRegistry.DIMENSION_TYPE.getKey(worldserver.worldProvider.getDimensionManager()); + + this.methodProfiler.a(() -> { + return worldserver + " " + worldserver.getDimensionKey().a(); diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index 958279249fdadfe5c2808d2a046636f06c3bd500..a8e64dfdab1e73894144a65c10c15d22f9198d3d 100644 +index 2b06c95b4fac97513e706ef073fdd7418e1f092c..67fda8bd5a0ad6fea2df0066c61e006c8a49980c 100644 --- a/src/main/java/net/minecraft/server/TileEntity.java +++ b/src/main/java/net/minecraft/server/TileEntity.java @@ -62,6 +62,7 @@ public abstract class TileEntity implements KeyedObject { // Paper @@ -105,7 +105,7 @@ index 958279249fdadfe5c2808d2a046636f06c3bd500..a8e64dfdab1e73894144a65c10c15d22 this.world.b(this.position, this); if (!this.c.isAir()) { diff --git a/src/main/java/net/minecraft/server/TileEntityHopper.java b/src/main/java/net/minecraft/server/TileEntityHopper.java -index 907d088c8691eec5d72836ccda420a7a0703ad22..c755faed4f63884cb6a66bf951104a27dbaf887f 100644 +index a0a3adac3e2bc939b1809c5587929f674f4318a5..20df9bd21d0e4d2579d05d79672da2eb26478044 100644 --- a/src/main/java/net/minecraft/server/TileEntityHopper.java +++ b/src/main/java/net/minecraft/server/TileEntityHopper.java @@ -168,6 +168,160 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi @@ -266,8 +266,8 @@ index 907d088c8691eec5d72836ccda420a7a0703ad22..c755faed4f63884cb6a66bf951104a27 + } + // Paper end + - private boolean j() { - IInventory iinventory = this.k(); + private boolean k() { + IInventory iinventory = this.l(); @@ -179,6 +333,7 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi if (this.b(iinventory, enumdirection)) { @@ -369,8 +369,12 @@ index 907d088c8691eec5d72836ccda420a7a0703ad22..c755faed4f63884cb6a66bf951104a27 } else { Iterator iterator = c(ihopper).iterator(); -@@ -268,7 +467,8 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi - private static boolean a(IHopper ihopper, IInventory iinventory, int i, EnumDirection enumdirection) { +@@ -265,10 +464,11 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi + } + } + +- private static boolean a(IHopper ihopper, IInventory iinventory, int i, EnumDirection enumdirection) { ++ private static boolean a(IHopper ihopper, IInventory iinventory, int i, EnumDirection enumdirection) {// Paper - method unused as logic is inlined above ItemStack itemstack = iinventory.getItem(i); - if (!itemstack.isEmpty() && b(iinventory, itemstack, i, enumdirection)) { @@ -412,15 +416,15 @@ index 907d088c8691eec5d72836ccda420a7a0703ad22..c755faed4f63884cb6a66bf951104a27 + IGNORE_TILE_UPDATES = true; // Paper iinventory1.setItem(i, itemstack); + IGNORE_TILE_UPDATES = false; // Paper - itemstack = ItemStack.a; + itemstack = ItemStack.b; flag = true; } else if (a(itemstack1, itemstack)) { @@ -419,18 +622,24 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi } public static List c(IHopper ihopper) { -- return (List) ihopper.P_().d().stream().flatMap((axisalignedbb) -> { -- return ihopper.getWorld().a(EntityItem.class, axisalignedbb.d(ihopper.z() - 0.5D, ihopper.A() - 0.5D, ihopper.B() - 0.5D), IEntitySelector.a).stream(); +- return (List) ihopper.ac_().d().stream().flatMap((axisalignedbb) -> { +- return ihopper.getWorld().a(EntityItem.class, axisalignedbb.d(ihopper.x() - 0.5D, ihopper.z() - 0.5D, ihopper.A() - 0.5D), IEntitySelector.a).stream(); - }).collect(Collectors.toList()); + // Paper start - Optimize item suck in. remove streams, restore 1.12 checks. Seriously checking the bowl?! + World world = ihopper.getWorld(); @@ -455,10 +459,10 @@ index 907d088c8691eec5d72836ccda420a7a0703ad22..c755faed4f63884cb6a66bf951104a27 if (!list.isEmpty()) { diff --git a/src/main/java/net/minecraft/server/TileEntityLootable.java b/src/main/java/net/minecraft/server/TileEntityLootable.java -index d4cbce3243fe1f4973c9c0ae0dbdab10e3390897..3b394c2726e0fbe595641a022e59c8967d525f82 100644 +index 5ebba482a65cfe6079484a99f016f968c59df8ee..d017904561d093bf8f0061f646a75aa53975be88 100644 --- a/src/main/java/net/minecraft/server/TileEntityLootable.java +++ b/src/main/java/net/minecraft/server/TileEntityLootable.java -@@ -72,12 +72,19 @@ public abstract class TileEntityLootable extends TileEntityContainer { +@@ -77,12 +77,19 @@ public abstract class TileEntityLootable extends TileEntityContainer { @Override public boolean isEmpty() { this.d((EntityHuman) null); @@ -481,10 +485,10 @@ index d4cbce3243fe1f4973c9c0ae0dbdab10e3390897..3b394c2726e0fbe595641a022e59c896 } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 045e449c7e411dec7ef415c76c808cda426db652..2beb1374b105381d4467de4989c207339cb5dca1 100644 +index dd3dd03200ad8f0219d6673abfe8fc87341a0fe6..4317c901419d13ed6f5737543399d4e340e30bc4 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -1206,8 +1206,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -1139,8 +1139,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable { return list; } diff --git a/Spigot-Server-Patches/0400-Generator-Settings.patch b/Spigot-Server-Patches/0400-Generator-Settings.patch deleted file mode 100644 index 2cbf2fe4f..000000000 --- a/Spigot-Server-Patches/0400-Generator-Settings.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Byteflux -Date: Wed, 2 Mar 2016 02:17:54 -0600 -Subject: [PATCH] Generator Settings - - -diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index c148a57a9c3d44f2a0a2edfed4f96211745cc3e7..62fe175dc4f00cc9cab6cbd828b57e25740b3793 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -604,4 +604,9 @@ public class PaperWorldConfig { - private void perPlayerMobSpawns() { - perPlayerMobSpawns = getBoolean("per-player-mob-spawns", false); - } -+ -+ public boolean generateFlatBedrock; -+ private void generatorSettings() { -+ generateFlatBedrock = getBoolean("generator-settings.flat-bedrock", false); -+ } - } -diff --git a/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java b/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java -index af81a841428a656bc4c4a23c9dcafb25e4c96ee2..2268fbdd8716233ce8f5a8a68d17a8a460a6685f 100644 ---- a/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java -+++ b/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java -@@ -211,8 +211,8 @@ public abstract class ChunkGeneratorAbstract - int i = ichunkaccess.getPos().d(); - int j = ichunkaccess.getPos().e(); - T t0 = this.getSettings(); -- int k = t0.u(); -- int l = t0.t(); -+ int k = t0.u(); final int floorHeight = k; // Paper -+ int l = t0.t(); final int roofHeight = l; // Paper - Iterator iterator = BlockPosition.b(i, 0, j, i + 15, 0, j + 15).iterator(); - - while (iterator.hasNext()) { -@@ -221,7 +221,7 @@ public abstract class ChunkGeneratorAbstract - - if (l > 0) { - for (i1 = l; i1 >= l - 4; --i1) { -- if (i1 >= l - random.nextInt(5)) { -+ if (i1 >= (getWorld().paperConfig.generateFlatBedrock ? roofHeight : l - random.nextInt(5))) { // Paper - Configurable flat bedrock roof - ichunkaccess.setType(blockposition_mutableblockposition.d(blockposition.getX(), i1, blockposition.getZ()), Blocks.BEDROCK.getBlockData(), false); - } - } -@@ -229,7 +229,7 @@ public abstract class ChunkGeneratorAbstract - - if (k < 256) { - for (i1 = k + 4; i1 >= k; --i1) { -- if (i1 <= k + random.nextInt(5)) { -+ if (i1 <= (getWorld().paperConfig.generateFlatBedrock ? floorHeight : k + random.nextInt(5))) { // Paper - Configurable flat bedrock floor - ichunkaccess.setType(blockposition_mutableblockposition.d(blockposition.getX(), i1, blockposition.getZ()), Blocks.BEDROCK.getBlockData(), false); - } - } diff --git a/Spigot-Server-Patches/0415-PlayerDeathEvent-shouldDropExperience.patch b/Spigot-Server-Patches/0400-PlayerDeathEvent-shouldDropExperience.patch similarity index 81% rename from Spigot-Server-Patches/0415-PlayerDeathEvent-shouldDropExperience.patch rename to Spigot-Server-Patches/0400-PlayerDeathEvent-shouldDropExperience.patch index ed6a98ac2..dc9904aa1 100644 --- a/Spigot-Server-Patches/0415-PlayerDeathEvent-shouldDropExperience.patch +++ b/Spigot-Server-Patches/0400-PlayerDeathEvent-shouldDropExperience.patch @@ -5,12 +5,12 @@ Subject: [PATCH] PlayerDeathEvent#shouldDropExperience diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 86bbbbaefca9ace5327d8bc2456939eb9ae8966a..8434f10d4c674fbbed40dba86e54f7cad93df642 100644 +index bb60ce14f6c13bc3f123893150129edb955bfff5..2e902d7015dabad22d4ff6dfd79ed92255718651 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -645,7 +645,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - - this.releaseShoulderEntities(); +@@ -688,7 +688,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + this.eW(); + } // SPIGOT-5478 must be called manually now - this.dropExperience(); + if (event.shouldDropExperience()) this.dropExperience(); // Paper - tie to event diff --git a/Spigot-Server-Patches/0416-Prevent-bees-loading-chunks-checking-hive-position.patch b/Spigot-Server-Patches/0401-Prevent-bees-loading-chunks-checking-hive-position.patch similarity index 82% rename from Spigot-Server-Patches/0416-Prevent-bees-loading-chunks-checking-hive-position.patch rename to Spigot-Server-Patches/0401-Prevent-bees-loading-chunks-checking-hive-position.patch index 5aa65f1fe..8ff6e1663 100644 --- a/Spigot-Server-Patches/0416-Prevent-bees-loading-chunks-checking-hive-position.patch +++ b/Spigot-Server-Patches/0401-Prevent-bees-loading-chunks-checking-hive-position.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Prevent bees loading chunks checking hive position diff --git a/src/main/java/net/minecraft/server/EntityBee.java b/src/main/java/net/minecraft/server/EntityBee.java -index b39599654e3e0a1120a37d254c80749ba70b3c15..73e016257847e5654e37ec6dbf8c689c36593216 100644 +index 5cc0a9284ef635aa6cb6f4803c0776cdbbf515a8..dcfd2ea5024be6d4a001fa7437092a7831b36fa7 100644 --- a/src/main/java/net/minecraft/server/EntityBee.java +++ b/src/main/java/net/minecraft/server/EntityBee.java -@@ -386,6 +386,7 @@ public class EntityBee extends EntityAnimal implements EntityBird { +@@ -368,6 +368,7 @@ public class EntityBee extends EntityAnimal implements IEntityAngerable, EntityB if (!this.hasHivePos()) { return false; } else { diff --git a/Spigot-Server-Patches/0417-Don-t-load-Chunks-from-Hoppers-and-other-things.patch b/Spigot-Server-Patches/0402-Don-t-load-Chunks-from-Hoppers-and-other-things.patch similarity index 82% rename from Spigot-Server-Patches/0417-Don-t-load-Chunks-from-Hoppers-and-other-things.patch rename to Spigot-Server-Patches/0402-Don-t-load-Chunks-from-Hoppers-and-other-things.patch index ed2db84aa..83a4f9a58 100644 --- a/Spigot-Server-Patches/0417-Don-t-load-Chunks-from-Hoppers-and-other-things.patch +++ b/Spigot-Server-Patches/0402-Don-t-load-Chunks-from-Hoppers-and-other-things.patch @@ -13,21 +13,20 @@ This of course is undesirable, so just return the loaded side as "primary" and treat it as a single chest if the other sides are unloaded diff --git a/src/main/java/net/minecraft/server/DoubleBlockFinder.java b/src/main/java/net/minecraft/server/DoubleBlockFinder.java -index 3cb6e60895637405f163c1fac731926ee2cf0d2c..7a16a3e0e209b254db0ec15212d51fab71c17f60 100644 +index ac46a68f7b0f13b9d936ae872306a229ec4f1a61..89b2b11bf00b656bb23be855b25697e6ac93a0a2 100644 --- a/src/main/java/net/minecraft/server/DoubleBlockFinder.java +++ b/src/main/java/net/minecraft/server/DoubleBlockFinder.java -@@ -21,8 +21,12 @@ public class DoubleBlockFinder { +@@ -21,7 +21,12 @@ public class DoubleBlockFinder { return new DoubleBlockFinder.Result.Single<>(s0); } else { BlockPosition blockposition1 = blockposition.shift((EnumDirection) function1.apply(iblockdata)); - IBlockData iblockdata1 = generatoraccess.getType(blockposition1); -- -+ // Paper start - don't load chunks if the other side of the chest is in unloaded chunk ++ // Paper start + IBlockData iblockdata1 = generatoraccess.getTypeIfLoaded(blockposition1); + if (iblockdata1 == null) { + return new DoubleBlockFinder.Result.Single<>(s0); + } + // Paper end - if (iblockdata1.getBlock() == iblockdata.getBlock()) { - DoubleBlockFinder.BlockType doubleblockfinder_blocktype1 = (DoubleBlockFinder.BlockType) function.apply(iblockdata1); + if (iblockdata1.a(iblockdata.getBlock())) { + DoubleBlockFinder.BlockType doubleblockfinder_blocktype1 = (DoubleBlockFinder.BlockType) function.apply(iblockdata1); diff --git a/Spigot-Server-Patches/0418-Guard-against-serializing-mismatching-chunk-coordina.patch b/Spigot-Server-Patches/0403-Guard-against-serializing-mismatching-chunk-coordina.patch similarity index 85% rename from Spigot-Server-Patches/0418-Guard-against-serializing-mismatching-chunk-coordina.patch rename to Spigot-Server-Patches/0403-Guard-against-serializing-mismatching-chunk-coordina.patch index c654bb838..bcb184288 100644 --- a/Spigot-Server-Patches/0418-Guard-against-serializing-mismatching-chunk-coordina.patch +++ b/Spigot-Server-Patches/0403-Guard-against-serializing-mismatching-chunk-coordina.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Guard against serializing mismatching chunk coordinate Should help if something dumb happens diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index 34cd09a503bfe617bd50808927bae0ccf43e53fc..fa893b14bcef9bab6891dea2c4375b09d74ac038 100644 +index 4d6e8f987233ca6c5f53d004031c022bb2d43e1e..5b196201c0e35895a04e2a542ef7c753d0c469e1 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -@@ -23,6 +23,13 @@ public class ChunkRegionLoader { +@@ -24,6 +24,13 @@ public class ChunkRegionLoader { private static final Logger LOGGER = LogManager.getLogger(); @@ -23,9 +23,9 @@ index 34cd09a503bfe617bd50808927bae0ccf43e53fc..fa893b14bcef9bab6891dea2c4375b09 // Paper start public static final class InProgressChunkHolder { -@@ -48,8 +55,8 @@ public class ChunkRegionLoader { +@@ -49,8 +56,8 @@ public class ChunkRegionLoader { // Paper end - ChunkGenerator chunkgenerator = worldserver.getChunkProvider().getChunkGenerator(); + ChunkGenerator chunkgenerator = worldserver.getChunkProvider().getChunkGenerator(); WorldChunkManager worldchunkmanager = chunkgenerator.getWorldChunkManager(); - NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("Level"); - ChunkCoordIntPair chunkcoordintpair1 = new ChunkCoordIntPair(nbttagcompound1.getInt("xPos"), nbttagcompound1.getInt("zPos")); @@ -35,11 +35,11 @@ index 34cd09a503bfe617bd50808927bae0ccf43e53fc..fa893b14bcef9bab6891dea2c4375b09 if (!Objects.equals(chunkcoordintpair, chunkcoordintpair1)) { ChunkRegionLoader.LOGGER.error("Chunk file at {} is in the wrong location; relocating. (Expected {}, got {})", chunkcoordintpair, chunkcoordintpair, chunkcoordintpair1); diff --git a/src/main/java/net/minecraft/server/IChunkLoader.java b/src/main/java/net/minecraft/server/IChunkLoader.java -index 134c76065bf382912e6c28d15449db3f9827f848..25c8b131fec6d9076120bd8ef516b14956a668ec 100644 +index c0d2df8ef3b4d0224ede2b7a4ef4e3f930590209..582a5695bac7d078e3022b8ee70c512c0680d992 100644 --- a/src/main/java/net/minecraft/server/IChunkLoader.java +++ b/src/main/java/net/minecraft/server/IChunkLoader.java -@@ -106,6 +106,13 @@ public class IChunkLoader extends RegionFileCache implements AutoCloseable { - // +@@ -106,6 +106,13 @@ public class IChunkLoader implements AutoCloseable { + public void a(ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) throws IOException { write(chunkcoordintpair, nbttagcompound); } // Paper OBFHELPER public void write(ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) throws IOException { // Paper - OBFHELPER - (Switched around for safety) + // Paper start @@ -49,6 +49,6 @@ index 134c76065bf382912e6c28d15449db3f9827f848..25c8b131fec6d9076120bd8ef516b149 + + " but compound says coordinate is " + ChunkRegionLoader.getChunkCoordinate(nbttagcompound).toString() + (world == null ? " for an unknown world" : (" for world: " + world))); + } + // Paper end - super.write(chunkcoordintpair, nbttagcompound); + this.regionFileCache.write(chunkcoordintpair, nbttagcompound); if (this.c != null) { synchronized (this.persistentDataLock) { // Paper - Async chunk loading diff --git a/Spigot-Server-Patches/0419-Optimise-IEntityAccess-getPlayerByUUID.patch b/Spigot-Server-Patches/0404-Optimise-IEntityAccess-getPlayerByUUID.patch similarity index 57% rename from Spigot-Server-Patches/0419-Optimise-IEntityAccess-getPlayerByUUID.patch rename to Spigot-Server-Patches/0404-Optimise-IEntityAccess-getPlayerByUUID.patch index 3bd05ac08..2f5f38bf7 100644 --- a/Spigot-Server-Patches/0419-Optimise-IEntityAccess-getPlayerByUUID.patch +++ b/Spigot-Server-Patches/0404-Optimise-IEntityAccess-getPlayerByUUID.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Optimise IEntityAccess#getPlayerByUUID Use the world entity map instead of iterating over all players diff --git a/src/main/java/net/minecraft/server/IEntityAccess.java b/src/main/java/net/minecraft/server/IEntityAccess.java -index d5c284cdd10d33f5f1b7f456d6a384a44eafb139..4157e50e4d99c029759bffcb48a8d645487554c8 100644 +index 48e8b005bd9589135eff03a110ecce8776ab208a..74d4c28246e7db850e6d993e07a84b2a6ca24ce2 100644 --- a/src/main/java/net/minecraft/server/IEntityAccess.java +++ b/src/main/java/net/minecraft/server/IEntityAccess.java -@@ -219,6 +219,12 @@ public interface IEntityAccess { +@@ -235,6 +235,12 @@ public interface IEntityAccess { @Nullable default EntityHuman b(UUID uuid) { @@ -23,12 +23,12 @@ index d5c284cdd10d33f5f1b7f456d6a384a44eafb139..4157e50e4d99c029759bffcb48a8d645 EntityHuman entityhuman = (EntityHuman) this.getPlayers().get(i); diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index fe84d8b33733391cf58215d92f8f31d6ac107f0a..1f28e24f4f056c1f72293a3004c6dbdb8f8d1f9e 100644 +index 8c0b1f28c3a914ce467345104e024650b9ebe2fe..8458ac3cf864774520afcb9ddc7cd60fc8f9d4e6 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -82,6 +82,15 @@ public class WorldServer extends World { - return new Throwable(entity + " Added to world at " + new java.util.Date()); +@@ -172,6 +172,15 @@ public class WorldServer extends World implements GeneratorAccessSeed { } + // Paper end + // Paper start - optimise getPlayerByUUID + @Nullable @@ -39,6 +39,6 @@ index fe84d8b33733391cf58215d92f8f31d6ac107f0a..1f28e24f4f056c1f72293a3004c6dbdb + } + // Paper end + - // Paper start - Asynchronous IO - public final com.destroystokyo.paper.io.PaperFileIOThread.ChunkDataController poiDataController = new com.destroystokyo.paper.io.PaperFileIOThread.ChunkDataController() { - @Override + // Add env and gen to constructor, WorldData -> WorldDataServer + public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey resourcekey, ResourceKey resourcekey1, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { + super(iworlddataserver, resourcekey, resourcekey1, dimensionmanager, minecraftserver::getMethodProfiler, false, flag, i, gen, env, executor); // Paper pass executor diff --git a/Spigot-Server-Patches/0420-Fix-items-not-falling-correctly.patch b/Spigot-Server-Patches/0405-Fix-items-not-falling-correctly.patch similarity index 89% rename from Spigot-Server-Patches/0420-Fix-items-not-falling-correctly.patch rename to Spigot-Server-Patches/0405-Fix-items-not-falling-correctly.patch index ac6d68d29..e8f474c06 100644 --- a/Spigot-Server-Patches/0420-Fix-items-not-falling-correctly.patch +++ b/Spigot-Server-Patches/0405-Fix-items-not-falling-correctly.patch @@ -15,10 +15,10 @@ This patch resolves the conflict by offsetting checking an item's move method from Spigot's entity activation range check. diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java -index 507627a29f67c380314d2fa8ee56807ced8ee56a..2926fbb95705f4389ca599c3bf0421267b83d401 100644 +index f2626358d16e8f3d60633283322009e5afacd145..a7860cb4ded3e9f949e6e1a7a2afacd738da756e 100644 --- a/src/main/java/net/minecraft/server/EntityItem.java +++ b/src/main/java/net/minecraft/server/EntityItem.java -@@ -86,7 +86,7 @@ public class EntityItem extends Entity { +@@ -88,7 +88,7 @@ public class EntityItem extends Entity { } } diff --git a/Spigot-Server-Patches/0421-Lag-compensate-eating.patch b/Spigot-Server-Patches/0406-Lag-compensate-eating.patch similarity index 65% rename from Spigot-Server-Patches/0421-Lag-compensate-eating.patch rename to Spigot-Server-Patches/0406-Lag-compensate-eating.patch index 606469d9d..0efa064d2 100644 --- a/Spigot-Server-Patches/0421-Lag-compensate-eating.patch +++ b/Spigot-Server-Patches/0406-Lag-compensate-eating.patch @@ -7,76 +7,76 @@ When the server is lagging, players will wait longer when eating. Change to also use a time check instead if it passes. diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 4f9255c0bc2ff46f34072846d2b0dc2e97f05db4..0ec0ddb7d0e3f25820fe064d75916407cb579eae 100644 +index 12b27c44d77b72fa4a4d42cfe3db8394a47d9c9b..b213a13c18ad483472808f4fe9743f74821a25cd 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -113,7 +113,7 @@ public abstract class EntityLiving extends Entity { +@@ -119,7 +119,7 @@ public abstract class EntityLiving extends Entity { private int jumpTicks; private float bD; public ItemStack activeItem; // Paper - public -- protected int bl; -+ protected int bl; protected final int getEatTimeTicks() { return this.bl; } protected final void setEatTimeTicks(int value) { this.bl = value; } // Paper - OBFHELPER - protected int bm; +- protected int bk; ++ protected int bk; protected final int getEatTimeTicks() { return this.bk; } protected final void setEatTimeTicks(int value) { this.bk = value; } // Paper - OBFHELPER + protected int bl; private BlockPosition bE; - private DamageSource bF; -@@ -2848,6 +2848,10 @@ public abstract class EntityLiving extends Entity { - return ((Byte) this.datawatcher.get(EntityLiving.ao) & 2) > 0 ? EnumHand.OFF_HAND : EnumHand.MAIN_HAND; + private Optional bF; +@@ -3018,6 +3018,11 @@ public abstract class EntityLiving extends Entity { + return ((Byte) this.datawatcher.get(EntityLiving.an) & 2) > 0 ? EnumHand.OFF_HAND : EnumHand.MAIN_HAND; } + // Paper start - lag compensate eating + protected long eatStartTime; + protected int totalEatTimeTicks; + // Paper end - private void o() { ++ + private void u() { if (this.isHandRaised()) { if (ItemStack.d(this.b(this.getRaisedHand()), this.activeItem)) { -@@ -2856,7 +2860,14 @@ public abstract class EntityLiving extends Entity { +@@ -3027,7 +3032,13 @@ public abstract class EntityLiving extends Entity { this.b(this.activeItem, 5); } -- if (--this.bl == 0 && !this.world.isClientSide && !this.activeItem.m()) { -+ +- if (--this.bk == 0 && !this.world.isClientSide && !this.activeItem.m()) { + // Paper start - lag compensate eating + // we add 1 to the expected time to avoid lag compensating when we should not + boolean shouldLagCompensate + = this.activeItem.getItem().isFood() && this.eatStartTime != -1 && (System.nanoTime() - this.eatStartTime) > ((1 + this.totalEatTimeTicks) * 50 * (1000 * 1000)); -+ if ((--this.bl == 0 || shouldLagCompensate) && !this.world.isClientSide && !this.activeItem.m()) { ++ if ((--this.bk == 0 || shouldLagCompensate) && !this.world.isClientSide && !this.activeItem.m()) { + this.setEatTimeTicks(0); + // Paper end - this.q(); + this.s(); } } else { -@@ -2906,7 +2917,10 @@ public abstract class EntityLiving extends Entity { +@@ -3077,7 +3088,10 @@ public abstract class EntityLiving extends Entity { if (!itemstack.isEmpty() && !this.isHandRaised() || forceUpdate) { // Paper use override flag this.activeItem = itemstack; -- this.bl = itemstack.k(); +- this.bk = itemstack.k(); + // Paper start - lag compensate eating -+ this.bl = this.totalEatTimeTicks = itemstack.k(); ++ this.bk = this.totalEatTimeTicks = itemstack.k(); + this.eatStartTime = System.nanoTime(); + // Paper end if (!this.world.isClientSide) { this.c(1, true); this.c(2, enumhand == EnumHand.OFF_HAND); -@@ -2930,7 +2944,10 @@ public abstract class EntityLiving extends Entity { +@@ -3101,7 +3115,10 @@ public abstract class EntityLiving extends Entity { } } else if (!this.isHandRaised() && !this.activeItem.isEmpty()) { - this.activeItem = ItemStack.a; -- this.bl = 0; + this.activeItem = ItemStack.b; +- this.bk = 0; + // Paper start - lag compensate eating -+ this.bl = this.totalEatTimeTicks = 0; ++ this.bk = this.totalEatTimeTicks = 0; + this.eatStartTime = -1L; + // Paper end } } -@@ -3052,7 +3069,10 @@ public abstract class EntityLiving extends Entity { +@@ -3223,7 +3240,10 @@ public abstract class EntityLiving extends Entity { } - this.activeItem = ItemStack.a; -- this.bl = 0; + this.activeItem = ItemStack.b; +- this.bk = 0; + // Paper start - lag compensate eating -+ this.bl = this.totalEatTimeTicks = 0; ++ this.bk = this.totalEatTimeTicks = 0; + this.eatStartTime = -1L; + // Paper end } diff --git a/Spigot-Server-Patches/0422-Optimize-call-to-getFluid-for-explosions.patch b/Spigot-Server-Patches/0407-Optimize-call-to-getFluid-for-explosions.patch similarity index 72% rename from Spigot-Server-Patches/0422-Optimize-call-to-getFluid-for-explosions.patch rename to Spigot-Server-Patches/0407-Optimize-call-to-getFluid-for-explosions.patch index 1657736d4..46956819e 100644 --- a/Spigot-Server-Patches/0422-Optimize-call-to-getFluid-for-explosions.patch +++ b/Spigot-Server-Patches/0407-Optimize-call-to-getFluid-for-explosions.patch @@ -5,15 +5,15 @@ Subject: [PATCH] Optimize call to getFluid for explosions diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java -index d99d2defe9916e191ba7a2bfbd94bd72a2f5872a..a353f3d5fa5a5f54335f73584589de3f5cb20d3e 100644 +index 1b738260fb06446713ceab159eb7fa3df70fb611..22a19e761fdec68cc9405988b977021a8b6398eb 100644 --- a/src/main/java/net/minecraft/server/Explosion.java +++ b/src/main/java/net/minecraft/server/Explosion.java -@@ -117,7 +117,7 @@ public class Explosion { +@@ -124,7 +124,7 @@ public class Explosion { for (float f1 = 0.3F; f > 0.0F; f -= 0.22500001F) { BlockPosition blockposition = new BlockPosition(d4, d5, d6); IBlockData iblockdata = this.world.getType(blockposition); - Fluid fluid = this.world.getFluid(blockposition); + Fluid fluid = iblockdata.getFluid(); // Paper + Optional optional = this.k.a(this, this.world, blockposition, iblockdata, fluid); - if (!iblockdata.isAir() || !fluid.isEmpty()) { - float f2 = Math.max(iblockdata.getBlock().getDurability(), fluid.k()); + if (optional.isPresent()) { diff --git a/Spigot-Server-Patches/0423-Fix-last-firework-in-stack-not-having-effects-when-d.patch b/Spigot-Server-Patches/0408-Fix-last-firework-in-stack-not-having-effects-when-d.patch similarity index 56% rename from Spigot-Server-Patches/0423-Fix-last-firework-in-stack-not-having-effects-when-d.patch rename to Spigot-Server-Patches/0408-Fix-last-firework-in-stack-not-having-effects-when-d.patch index a1c44ea4f..9c065ec6c 100644 --- a/Spigot-Server-Patches/0423-Fix-last-firework-in-stack-not-having-effects-when-d.patch +++ b/Spigot-Server-Patches/0408-Fix-last-firework-in-stack-not-having-effects-when-d.patch @@ -9,15 +9,15 @@ dispensed. The resulting item would have size == 0 and therefore be convertered to air, hence why the effects disappeared. diff --git a/src/main/java/net/minecraft/server/IDispenseBehavior.java b/src/main/java/net/minecraft/server/IDispenseBehavior.java -index b6b7e3c6c973886e35bde0bf10787b62c7f015ca..3af686c7f1e483afd4dbf5e2b27c484e2ef321d0 100644 +index 5432c24919bb5c32ca1eec4c9861ad127f72a60a..660f44975a003ea68ddad59899618485fdaf5487 100644 --- a/src/main/java/net/minecraft/server/IDispenseBehavior.java +++ b/src/main/java/net/minecraft/server/IDispenseBehavior.java -@@ -265,7 +265,7 @@ public interface IDispenseBehavior { +@@ -352,7 +352,7 @@ public interface IDispenseBehavior { } itemstack1 = CraftItemStack.asNMSCopy(event.getItem()); -- EntityFireworks entityfireworks = new EntityFireworks(isourceblock.getWorld(), itemstack, d3, d4, d5, true); -+ EntityFireworks entityfireworks = new EntityFireworks(isourceblock.getWorld(), itemstack1, d3, d4, d5, true); // Paper - GH-2871 - fix last firework in stack having no effects when dispensed +- EntityFireworks entityfireworks = new EntityFireworks(isourceblock.getWorld(), itemstack, isourceblock.getX(), isourceblock.getY(), isourceblock.getX(), true); ++ EntityFireworks entityfireworks = new EntityFireworks(isourceblock.getWorld(), itemstack1, isourceblock.getX(), isourceblock.getY(), isourceblock.getX(), true); // Paper - GH-2871 - fix last firework in stack having no effects when dispensed - entityfireworks.shoot(d0, d1, d2, 0.5F, 1.0F); - isourceblock.getWorld().addEntity(entityfireworks); + IDispenseBehavior.a(isourceblock, entityfireworks, enumdirection); + entityfireworks.shoot((double) enumdirection.getAdjacentX(), (double) enumdirection.getAdjacentY(), (double) enumdirection.getAdjacentZ(), 0.5F, 1.0F); diff --git a/Spigot-Server-Patches/0424-Entity-Activation-Range-2.0.patch b/Spigot-Server-Patches/0409-Entity-Activation-Range-2.0.patch similarity index 87% rename from Spigot-Server-Patches/0424-Entity-Activation-Range-2.0.patch rename to Spigot-Server-Patches/0409-Entity-Activation-Range-2.0.patch index beee0f4a8..17abf62b1 100644 --- a/Spigot-Server-Patches/0424-Entity-Activation-Range-2.0.patch +++ b/Spigot-Server-Patches/0409-Entity-Activation-Range-2.0.patch @@ -13,20 +13,8 @@ Adds water Mobs to activation range config and nerfs fish Adds flying monsters to control ghast and phantoms Adds villagers as separate config -diff --git a/src/main/java/net/minecraft/server/BehaviorController.java b/src/main/java/net/minecraft/server/BehaviorController.java -index a1883eba63e0da420a3cf57b8da6ebdb2afbad80..7c6e687707cdf32638eee41e549818a494cd45ab 100644 ---- a/src/main/java/net/minecraft/server/BehaviorController.java -+++ b/src/main/java/net/minecraft/server/BehaviorController.java -@@ -161,6 +161,7 @@ public class BehaviorController implements MinecraftSeri - }); - } - -+ public boolean hasActivity(Activity activity) { return c(activity); } // Paper - OBFHELPER - public boolean c(Activity activity) { - return this.g.contains(activity); - } diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index fbec89c6d827463ea28036617acaa573c8e11d02..a1245c1f551cbce84b0f3dd3a7349e8585631a82 100644 +index 5a897b844d676309230fee83c0250a8a2600a581..067765981afda04959313fc5371e6da9d7564f1a 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -192,6 +192,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -37,7 +25,7 @@ index fbec89c6d827463ea28036617acaa573c8e11d02..a1245c1f551cbce84b0f3dd3a7349e85 public boolean spawnedViaMobSpawner; // Paper - Yes this name is similar to above, upstream took the better one protected int numCollisions = 0; // Paper public void inactiveTick() { } -@@ -553,6 +554,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -575,6 +576,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke this.recalcPosition(); } else { if (enummovetype == EnumMoveType.PISTON) { @@ -45,8 +33,8 @@ index fbec89c6d827463ea28036617acaa573c8e11d02..a1245c1f551cbce84b0f3dd3a7349e85 vec3d = this.a(vec3d); if (vec3d.equals(Vec3D.a)) { return; -@@ -565,6 +567,13 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - this.y = Vec3D.a; +@@ -587,6 +589,13 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke + this.x = Vec3D.a; this.setMot(Vec3D.a); } + // Paper start - ignore movement changes while inactive. @@ -58,17 +46,17 @@ index fbec89c6d827463ea28036617acaa573c8e11d02..a1245c1f551cbce84b0f3dd3a7349e85 + // Paper end vec3d = this.a(vec3d, enummovetype); - Vec3D vec3d1 = this.e(vec3d); -@@ -2769,6 +2778,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - return this.am; + Vec3D vec3d1 = this.f(vec3d); +@@ -2700,6 +2709,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke + return this.al; } -+ public boolean isPushedByWater() { return this.bM(); } // Paper - OBFHELPER - the below is not an obfhelper, don't use it! - public boolean bM() { ++ public boolean isPushedByWater() { return this.bU(); } // Paper - OBFHELPER - the below is not an obfhelper, don't use it! + public boolean bU() { // Paper start return this.pushedByWater(); diff --git a/src/main/java/net/minecraft/server/EntityCreature.java b/src/main/java/net/minecraft/server/EntityCreature.java -index b40c8d2f83a80bcb8925632a1e7d6bb4cc0caebf..4eda130750ff4903c3dc7d2afae09b8b77ff62b9 100644 +index c94197a50269622e8995685119bac984c45e6833..11d384729326af693a9a679195acbd594227466a 100644 --- a/src/main/java/net/minecraft/server/EntityCreature.java +++ b/src/main/java/net/minecraft/server/EntityCreature.java @@ -7,6 +7,7 @@ import org.bukkit.event.entity.EntityUnleashEvent; @@ -80,19 +68,19 @@ index b40c8d2f83a80bcb8925632a1e7d6bb4cc0caebf..4eda130750ff4903c3dc7d2afae09b8b protected EntityCreature(EntityTypes entitytypes, World world) { super(entitytypes, world); diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index 6d53254f8381f3a957673930c7fdf42d4b9d2f36..5aca7a9131787415fb2edba1ebec9601e8a56d3a 100644 +index 5e9a05dfe822c42b83da84a154fe881d57ac1689..605bbf0174e60f795e445193a0284739ea452946 100644 --- a/src/main/java/net/minecraft/server/EntityInsentient.java +++ b/src/main/java/net/minecraft/server/EntityInsentient.java -@@ -46,7 +46,7 @@ public abstract class EntityInsentient extends EntityLiving { +@@ -47,7 +47,7 @@ public abstract class EntityInsentient extends EntityLiving { public MinecraftKey lootTableKey; public long lootTableSeed; @Nullable - private Entity leashHolder; -+ public Entity leashHolder; // Paper - private int bF; ++ public Entity leashHolder; // Paper - private -> public + private int bE; @Nullable - private NBTTagCompound bG; -@@ -114,6 +114,17 @@ public abstract class EntityInsentient extends EntityLiving { + private NBTTagCompound bF; +@@ -128,6 +128,17 @@ public abstract class EntityInsentient extends EntityLiving { return this.lookController; } @@ -111,35 +99,35 @@ index 6d53254f8381f3a957673930c7fdf42d4b9d2f36..5aca7a9131787415fb2edba1ebec9601 if (this.isPassenger() && this.getVehicle() instanceof EntityInsentient) { EntityInsentient entityinsentient = (EntityInsentient) this.getVehicle(); diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 252b3c59294a75618622950286969f5e656da85a..38f666bb115d7d29da8eac1f4848ba23ef29ba43 100644 +index b213a13c18ad483472808f4fe9743f74821a25cd..66bca610fbb8afc6f5b4430318c66d29af55fc19 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -91,7 +91,7 @@ public abstract class EntityLiving extends Entity { - protected float aV; - protected int aW; protected int getKillCount() { return this.aW; } // Paper - OBFHELPER +@@ -97,7 +97,7 @@ public abstract class EntityLiving extends Entity { + protected float aU; + protected int aV; protected int getKillCount() { return this.aV; } // Paper - OBFHELPER public float lastDamage; - protected boolean jumping; -+ public boolean jumping; // Paper ++ public boolean jumping; // Paper protected -> public + public float aY; public float aZ; public float ba; - public float bb; diff --git a/src/main/java/net/minecraft/server/EntityLlama.java b/src/main/java/net/minecraft/server/EntityLlama.java -index 6d4d41c88c206ad63f3733b5c8b3f23eb40dde52..193dbfc5f684bfe46f69cb2ab2c52dbb44707792 100644 +index 7ce3421696fbfc5a445f879dfd55a3055502a933..4fe769c761949c40bbb923cde5dfe1709843921f 100644 --- a/src/main/java/net/minecraft/server/EntityLlama.java +++ b/src/main/java/net/minecraft/server/EntityLlama.java -@@ -382,6 +382,7 @@ public class EntityLlama extends EntityHorseChestedAbstract implements IRangedEn - return this.bK != null; - } - -+ public boolean inCaravan() { return this.fd(); } // Paper - OBFHELPER - public boolean fd() { +@@ -404,6 +404,7 @@ public class EntityLlama extends EntityHorseChestedAbstract implements IRangedEn return this.bJ != null; } + ++ public final boolean inCaravan() { return this.fD(); } // Paper - OBFHELPER + public boolean fD() { + return this.bI != null; + } diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java -index 6e0020ae0b4d2f2597843129b83fff0d194de337..b3462576469f67dca618c54bb35fd53454afcd1f 100644 +index a23c8d54a30a1ed1a3ed4d158da08229f59ca4c5..8d3811ead268635c4b728f5c9b8dd6c9b8ec6124 100644 --- a/src/main/java/net/minecraft/server/EntityVillager.java +++ b/src/main/java/net/minecraft/server/EntityVillager.java -@@ -135,17 +135,30 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation +@@ -144,18 +144,29 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation @Override public void inactiveTick() { // SPIGOT-3874, SPIGOT-3894, SPIGOT-3846, SPIGOT-5286 :( @@ -148,14 +136,14 @@ index 6e0020ae0b4d2f2597843129b83fff0d194de337..b3462576469f67dca618c54bb35fd534 + // Paper start + if (this.getUnhappy() > 0) { + this.setUnhappy(this.getUnhappy() - 1); -+ } + } + if (this.doAITick()) { + if (world.spigotConfig.tickInactiveVillagers) { + this.mobTick(); + } else { + this.mobTick(true); + } - } ++ } + doReputationTick(); + // Paper end + @@ -163,62 +151,61 @@ index 6e0020ae0b4d2f2597843129b83fff0d194de337..b3462576469f67dca618c54bb35fd534 } // Spigot End -- @Override + @Override - protected void mobTick() { -+ @Override // Paper start - tick trades while inactive + protected void mobTick() { mobTick(false); } + protected void mobTick(boolean inactive) { -+ // Paper end - this.world.getMethodProfiler().enter("brain"); + this.world.getMethodProfiler().enter("villagerBrain"); - this.getBehaviorController().a((WorldServer) this.world, this); // CraftBukkit - decompile error +- this.world.getMethodProfiler().exit(); + if (!inactive) this.getBehaviorController().a((WorldServer) this.world, this); // CraftBukkit - decompile error // Paper - this.world.getMethodProfiler().exit(); - if (!this.et() && this.bB > 0) { - --this.bB; -@@ -165,7 +178,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation - this.bD = null; + if (this.bM) { + this.bM = false; + } +@@ -178,7 +189,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation + this.bC = null; } - if (!this.isNoAI() && this.random.nextInt(100) == 0) { + if (!inactive && !this.isNoAI() && this.random.nextInt(100) == 0) { // Paper - Raid raid = ((WorldServer) this.world).c_(new BlockPosition(this)); + Raid raid = ((WorldServer) this.world).c_(this.getChunkCoordinates()); if (raid != null && raid.v() && !raid.a()) { -@@ -176,6 +189,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation - if (this.getVillagerData().getProfession() == VillagerProfession.NONE && this.et()) { - this.ey(); +@@ -189,6 +200,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation + if (this.getVillagerData().getProfession() == VillagerProfession.NONE && this.eO()) { + this.eT(); } + if (inactive) return; // Paper super.mobTick(); } -@@ -819,6 +833,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation +@@ -820,6 +832,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation } } -+ private void doReputationTick() { fa(); } // Paper - OBFHELPER - private void fa() { ++ private void doReputationTick() { fv(); } // Paper - OBFHELPER + private void fv() { long i = this.world.getTime(); diff --git a/src/main/java/net/minecraft/server/EntityVillagerAbstract.java b/src/main/java/net/minecraft/server/EntityVillagerAbstract.java -index 9b75c67c72bc2837cf12bf7ef8172031831deb6e..463528532026e9757431a90cc2540af0f7903faf 100644 +index b2ea467f26f78d3239062c6c3b9741b87489713e..81823b5d5ef17479583fda0121c95091175fdf1e 100644 --- a/src/main/java/net/minecraft/server/EntityVillagerAbstract.java +++ b/src/main/java/net/minecraft/server/EntityVillagerAbstract.java -@@ -43,10 +43,12 @@ public abstract class EntityVillagerAbstract extends EntityAgeable implements NP +@@ -45,10 +45,12 @@ public abstract class EntityVillagerAbstract extends EntityAgeable implements NP return super.prepare(generatoraccess, difficultydamagescaler, enummobspawn, (GroupDataEntity) groupdataentity, nbttagcompound); } -+ public final int getUnhappy() { return eq(); } // Paper - OBFHELPER - public int eq() { - return (Integer) this.datawatcher.get(EntityVillagerAbstract.bx); ++ public final int getUnhappy() { return eL(); } // Paper - OBFHELPER + public int eL() { + return (Integer) this.datawatcher.get(EntityVillagerAbstract.bw); } + public final void setUnhappy(int i) { s(i); } // Paper - OBFHELPER public void s(int i) { - this.datawatcher.set(EntityVillagerAbstract.bx, i); + this.datawatcher.set(EntityVillagerAbstract.bw, i); } diff --git a/src/main/java/net/minecraft/server/PathfinderGoal.java b/src/main/java/net/minecraft/server/PathfinderGoal.java -index f22f12eeb0b10d038fcd74cc4b19e888b134c3c7..bdb90a346639db37d3c72359c28b72d021d1b389 100644 +index d9454448119a3c1590b7f9ef141dccf10d4742cc..384300894d19ff70556c23b130c01b2e49aa3f20 100644 --- a/src/main/java/net/minecraft/server/PathfinderGoal.java +++ b/src/main/java/net/minecraft/server/PathfinderGoal.java @@ -20,7 +20,10 @@ public abstract class PathfinderGoal { @@ -234,7 +221,7 @@ index f22f12eeb0b10d038fcd74cc4b19e888b134c3c7..bdb90a346639db37d3c72359c28b72d0 public void e() {} diff --git a/src/main/java/net/minecraft/server/PathfinderGoalGotoTarget.java b/src/main/java/net/minecraft/server/PathfinderGoalGotoTarget.java -index 41fb166ce0ab29148ebd40e147fef98d1a2e9609..e93129f0b281e242383e36c99d19f6b0577a0b6b 100644 +index b0e17a5764ae4668ef45c4b5e8fe7280b3f5bfdf..3e26c32d0c886c6bd70aa4823d8738cdde7a6b24 100644 --- a/src/main/java/net/minecraft/server/PathfinderGoalGotoTarget.java +++ b/src/main/java/net/minecraft/server/PathfinderGoalGotoTarget.java @@ -4,12 +4,12 @@ import java.util.EnumSet; @@ -267,7 +254,7 @@ index 41fb166ce0ab29148ebd40e147fef98d1a2e9609..e93129f0b281e242383e36c99d19f6b0 public PathfinderGoalGotoTarget(EntityCreature entitycreature, double d0, int i, int j) { this.e = BlockPosition.ZERO; @@ -100,6 +107,7 @@ public abstract class PathfinderGoalGotoTarget extends PathfinderGoal { - blockposition_mutableblockposition.g(blockposition).e(i1, k - 1, j1); + blockposition_mutableblockposition.a((BaseBlockPosition) blockposition, i1, k - 1, j1); if (this.a.a((BlockPosition) blockposition_mutableblockposition) && this.a(this.a.world, blockposition_mutableblockposition)) { this.e = blockposition_mutableblockposition; + setTarget(blockposition_mutableblockposition.immutableCopy()); // Paper @@ -275,24 +262,24 @@ index 41fb166ce0ab29148ebd40e147fef98d1a2e9609..e93129f0b281e242383e36c99d19f6b0 } } diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java -index 44bb18c5945b69f09b3a6e6272f2c3a5477780c7..935136771e776fe498f608a159a41393340adc4e 100644 +index 482ce2cd8123252110508e8e03aa65afdd533e0a..b18e53220d8dbd50723c4201231091cbe4f4119a 100644 --- a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java +++ b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java -@@ -24,10 +24,11 @@ public class PathfinderGoalSelector { +@@ -25,10 +25,11 @@ public class PathfinderGoalSelector { } }; private final Map c = new EnumMap(PathfinderGoal.Type.class); - private final Set d = Sets.newLinkedHashSet(); -+ private final Set d = Sets.newLinkedHashSet();private Set getTasks() { return d; }// Paper - OBFHELPER - private final GameProfilerFiller e; ++ private final Set d = Sets.newLinkedHashSet(); private Set getTasks() { return d; }// Paper - OBFHELPER + private final Supplier e; private final EnumSet f = EnumSet.noneOf(PathfinderGoal.Type.class); - private int g = 3; + private int g = 3;private int getTickRate() { return g; } // Paper - OBFHELPER + private int curRate;private int getCurRate() { return curRate; } private void incRate() { this.curRate++; } // Paper TODO - public PathfinderGoalSelector(GameProfilerFiller gameprofilerfiller) { - this.e = gameprofilerfiller; -@@ -37,6 +38,25 @@ public class PathfinderGoalSelector { + public PathfinderGoalSelector(Supplier supplier) { + this.e = supplier; +@@ -38,6 +39,25 @@ public class PathfinderGoalSelector { this.d.add(new PathfinderGoalWrapped(i, pathfindergoal)); } @@ -319,7 +306,7 @@ index 44bb18c5945b69f09b3a6e6272f2c3a5477780c7..935136771e776fe498f608a159a41393 this.d.stream().filter((pathfindergoalwrapped) -> { return pathfindergoalwrapped.j() == pathfindergoal; diff --git a/src/main/java/net/minecraft/server/PathfinderGoalWrapped.java b/src/main/java/net/minecraft/server/PathfinderGoalWrapped.java -index 5a8c60ad909394413427851db8068ba79c058b63..29657fed75184aee0c89e56f5e642a5d68eda444 100644 +index 50487dbf0ac162d7608b67b4fb50fa7f8bfba69d..04b28555b1bb68536e40bb652613678775337b31 100644 --- a/src/main/java/net/minecraft/server/PathfinderGoalWrapped.java +++ b/src/main/java/net/minecraft/server/PathfinderGoalWrapped.java @@ -64,6 +64,7 @@ public class PathfinderGoalWrapped extends PathfinderGoal { @@ -331,12 +318,12 @@ index 5a8c60ad909394413427851db8068ba79c058b63..29657fed75184aee0c89e56f5e642a5d return this.c; } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 6b6612de65081895825858f52d0f1c6f23c8edb6..3742be65afebcf4c61a9efbd1c207f968e5f7473 100644 +index 4317c901419d13ed6f5737543399d4e340e30bc4..97840c0a673402f258e172873fd6756bc23f298b 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -76,6 +76,12 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - public long ticksPerMonsterSpawns; +@@ -82,6 +82,12 @@ public abstract class World implements GeneratorAccess, AutoCloseable { public long ticksPerWaterSpawns; + public long ticksPerWaterAmbientSpawns; public long ticksPerAmbientSpawns; + // Paper start + public int wakeupInactiveRemainingAnimals; @@ -348,7 +335,7 @@ index 6b6612de65081895825858f52d0f1c6f23c8edb6..3742be65afebcf4c61a9efbd1c207f96 public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java -index 92601c581cffac471872226abeb93ef9aa24f079..d873b8cf3aec01b791565c33b252889f99f181f9 100644 +index b73af0a5fb2d08c2f3a52c699ef0d8ed34c83f77..5dcc1ba547db7cc53a08426a7ad119ae88690136 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java @@ -2,24 +2,34 @@ package org.spigotmc; @@ -593,8 +580,8 @@ index 92601c581cffac471872226abeb93ef9aa24f079..d873b8cf3aec01b791565c33b252889f } if ( !( entity instanceof EntityArrow ) ) { -- if ( !entity.onGround || !entity.passengers.isEmpty() || entity.isPassenger() ) -+ if ( (!entity.onGround && !(entity instanceof EntityFlying)) || !entity.passengers.isEmpty() || entity.isPassenger() ) // Paper +- if ( !entity.isOnGround() || !entity.passengers.isEmpty() || entity.isPassenger() ) ++ if ( (!entity.isOnGround() && !(entity instanceof EntityFlying)) || !entity.passengers.isEmpty() || entity.isPassenger() ) { - return true; + return 10; // Paper @@ -637,14 +624,14 @@ index 92601c581cffac471872226abeb93ef9aa24f079..d873b8cf3aec01b791565c33b252889f + + if (config.villagersActiveForPanic) { + for (Activity activity : VILLAGER_PANIC_IMMUNITIES) { -+ if (behaviorController.hasActivity(activity)) { ++ if (behaviorController.c(activity)) { + return 20*5; + } + } + } + + if (config.villagersWorkImmunityAfter > 0 && inactiveFor >= config.villagersWorkImmunityAfter) { -+ if (behaviorController.hasActivity(Activity.WORK)) { ++ if (behaviorController.c(Activity.WORK)) { + return config.villagersWorkImmunityFor; + } + } @@ -735,7 +722,7 @@ index 92601c581cffac471872226abeb93ef9aa24f079..d873b8cf3aec01b791565c33b252889f isActive = false; } diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index 37ef07338e0e7ebb778b4446c8e7a630f597c7be..69454bc3c51c0d7c6f1b6d1fbcba93322205bab6 100644 +index f0ad5fa235adfd165b8e56be7352568a3b3ae54a..9859e0c964e4d1e7dc7689cb97f40643a8e5cdd7 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java +++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -180,13 +180,59 @@ public class SpigotWorldConfig diff --git a/Spigot-Server-Patches/0425-Add-effect-to-block-break-naturally.patch b/Spigot-Server-Patches/0410-Add-effect-to-block-break-naturally.patch similarity index 78% rename from Spigot-Server-Patches/0425-Add-effect-to-block-break-naturally.patch rename to Spigot-Server-Patches/0410-Add-effect-to-block-break-naturally.patch index f43e886f8..712d4676d 100644 --- a/Spigot-Server-Patches/0425-Add-effect-to-block-break-naturally.patch +++ b/Spigot-Server-Patches/0410-Add-effect-to-block-break-naturally.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add effect to block break naturally diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -index 16349e8e796c5e7e4e43fb355d4d641df7f41dc9..382b50d37aced746266b618f3f277846728565bd 100644 +index bda3e17ae7a5de98ef94f37307df302fefa3675f..9b0e868f006a34b47ef9a48c7ea844be8122c291 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -@@ -606,6 +606,13 @@ public class CraftBlock implements Block { +@@ -620,6 +620,13 @@ public class CraftBlock implements Block { @Override public boolean breakNaturally(ItemStack item) { @@ -22,9 +22,9 @@ index 16349e8e796c5e7e4e43fb355d4d641df7f41dc9..382b50d37aced746266b618f3f277846 // Order matters here, need to drop before setting to air so skulls can get their data net.minecraft.server.IBlockData iblockdata = this.getNMS(); net.minecraft.server.Block block = iblockdata.getBlock(); -@@ -615,6 +622,7 @@ public class CraftBlock implements Block { +@@ -629,6 +636,7 @@ public class CraftBlock implements Block { // Modelled off EntityHuman#hasBlock - if (block != Blocks.AIR && (item == null || iblockdata.getMaterial().isAlwaysDestroyable() || nmsItem.canDestroySpecialBlock(iblockdata))) { + if (block != Blocks.AIR && (item == null || !iblockdata.isAlwaysDestroyable() || nmsItem.canDestroySpecialBlock(iblockdata))) { net.minecraft.server.Block.dropItems(iblockdata, world.getMinecraftWorld(), position, world.getTileEntity(position), null, nmsItem); + if (triggerEffect) world.triggerEffect(org.bukkit.Effect.STEP_SOUND.getId(), position, net.minecraft.server.Block.getCombinedId(block.getBlockData())); // Paper result = true; diff --git a/Spigot-Server-Patches/0411-Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch b/Spigot-Server-Patches/0411-Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch deleted file mode 100644 index 7535c03fa..000000000 --- a/Spigot-Server-Patches/0411-Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch +++ /dev/null @@ -1,20 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Callahan -Date: Mon, 13 Jan 2020 23:47:28 -0600 -Subject: [PATCH] Prevent sync chunk loads when villagers try to find beds - - -diff --git a/src/main/java/net/minecraft/server/BehaviorSleep.java b/src/main/java/net/minecraft/server/BehaviorSleep.java -index fa575dde1924d840b966791aab8553108a877be4..dfe0f66500ab2ea733fd5ef84d7d80f32e2dfaab 100644 ---- a/src/main/java/net/minecraft/server/BehaviorSleep.java -+++ b/src/main/java/net/minecraft/server/BehaviorSleep.java -@@ -31,7 +31,8 @@ public class BehaviorSleep extends Behavior { - if (optional.isPresent() && worldserver.getTime() - ((MinecraftSerializableLong) optional.get()).a() < 100L) { - return false; - } else { -- IBlockData iblockdata = worldserver.getType(globalpos.getBlockPosition()); -+ IBlockData iblockdata = worldserver.getTypeIfLoaded(globalpos.getBlockPosition()); // Paper -+ if(iblockdata == null) return false; // Paper - - return globalpos.getBlockPosition().a((IPosition) entityliving.getPositionVector(), 2.0D) && iblockdata.getBlock().a(TagsBlock.BEDS) && !(Boolean) iblockdata.get(BlockBed.OCCUPIED); - } diff --git a/Spigot-Server-Patches/0426-Tracking-Range-Improvements.patch b/Spigot-Server-Patches/0411-Tracking-Range-Improvements.patch similarity index 95% rename from Spigot-Server-Patches/0426-Tracking-Range-Improvements.patch rename to Spigot-Server-Patches/0411-Tracking-Range-Improvements.patch index 01f06e48b..d6a3c237e 100644 --- a/Spigot-Server-Patches/0426-Tracking-Range-Improvements.patch +++ b/Spigot-Server-Patches/0411-Tracking-Range-Improvements.patch @@ -8,10 +8,10 @@ Sets tracking range of watermobs to animals instead of misc and simplifies code Also ignores Enderdragon, defaulting it to Mojang's setting diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index c20acd86beb8f28345d1359d0a2b68b7d8e0e410..4ba661c5a89bebe29c8802387bc93c10094b7606 100644 +index ab5413a39147180af2eb33512fc992a5dcbb69bf..b530316b582390c4c464bb1f3df48597c8bf7569 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -1702,6 +1702,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1736,6 +1736,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); int j = entity.getEntityType().getChunkRange() * 16; diff --git a/Spigot-Server-Patches/0428-Fix-items-vanishing-through-end-portal.patch b/Spigot-Server-Patches/0412-Fix-items-vanishing-through-end-portal.patch similarity index 63% rename from Spigot-Server-Patches/0428-Fix-items-vanishing-through-end-portal.patch rename to Spigot-Server-Patches/0412-Fix-items-vanishing-through-end-portal.patch index 467cd1e04..c186d986f 100644 --- a/Spigot-Server-Patches/0428-Fix-items-vanishing-through-end-portal.patch +++ b/Spigot-Server-Patches/0412-Fix-items-vanishing-through-end-portal.patch @@ -13,18 +13,16 @@ Quickly loading the exact world spawn chunk before searching the heightmap resolves the issue without having to load all spawn chunks. diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index a1245c1f551cbce84b0f3dd3a7349e8585631a82..83e0af493c0f4037ff3e625ee93b9422863f335f 100644 +index 067765981afda04959313fc5371e6da9d7564f1a..39a7b8743a0612f818cda3796b5f6ae1137a7eee 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -2613,6 +2613,11 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -2537,6 +2537,9 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke if (blockposition == null) { // CraftBukkit - if (dimensionmanager1.getType() == DimensionManager.THE_END && dimensionmanager == DimensionManager.OVERWORLD) { // CraftBukkit + if (this.world.getTypeKey() == DimensionManager.THE_END && worldserver.getTypeKey() == DimensionManager.OVERWORLD) { // CraftBukkit + // Paper start - Ensure spawn chunk is always loaded before calculating Y coordinate -+ if (!worldserver1.isLoaded(worldserver1.getSpawn())) { -+ worldserver1.getChunkAtWorldCoords(worldserver1.getSpawn()); -+ } ++ this.world.getChunkAtWorldCoords(this.world.getSpawn()); + // Paper end // CraftBukkit start - EntityPortalEvent event = CraftEventFactory.callEntityPortalEvent(this, worldserver1, worldserver1.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver1.getSpawn()), 0); + EntityPortalEvent event = CraftEventFactory.callEntityPortalEvent(this, worldserver, worldserver.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver.getSpawn()), 0); if (event == null) { diff --git a/Spigot-Server-Patches/0430-Bees-get-gravity-in-void.-Fixes-MC-167279.patch b/Spigot-Server-Patches/0413-Bees-get-gravity-in-void.-Fixes-MC-167279.patch similarity index 84% rename from Spigot-Server-Patches/0430-Bees-get-gravity-in-void.-Fixes-MC-167279.patch rename to Spigot-Server-Patches/0413-Bees-get-gravity-in-void.-Fixes-MC-167279.patch index f20d61188..80436106a 100644 --- a/Spigot-Server-Patches/0430-Bees-get-gravity-in-void.-Fixes-MC-167279.patch +++ b/Spigot-Server-Patches/0413-Bees-get-gravity-in-void.-Fixes-MC-167279.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Bees get gravity in void. Fixes MC-167279 diff --git a/src/main/java/net/minecraft/server/ControllerMove.java b/src/main/java/net/minecraft/server/ControllerMove.java -index 7e3671dae6194a9caad68054fb61c9e441b2d538..a5c4cbb67f030760e64e75e618285bd98083c5b5 100644 +index f2d2d04fe16bc091a971c8c90db56e6cd2799555..ac6f9d9e5252b819f91703ad6aeaae3d580eeca0 100644 --- a/src/main/java/net/minecraft/server/ControllerMove.java +++ b/src/main/java/net/minecraft/server/ControllerMove.java @@ -2,7 +2,7 @@ package net.minecraft.server; @@ -18,7 +18,7 @@ index 7e3671dae6194a9caad68054fb61c9e441b2d538..a5c4cbb67f030760e64e75e618285bd9 protected double c; protected double d; diff --git a/src/main/java/net/minecraft/server/ControllerMoveFlying.java b/src/main/java/net/minecraft/server/ControllerMoveFlying.java -index 2b6ac2eeb0fdf35e75c35144941d7fb82cb8adc1..0496c0c5dbbcf89461c947881129673fa4f33e42 100644 +index d3507b3852f02bf35bda35a13db66d5375325000..bafcb780f520db562e4a834400b789f60b563597 100644 --- a/src/main/java/net/minecraft/server/ControllerMoveFlying.java +++ b/src/main/java/net/minecraft/server/ControllerMoveFlying.java @@ -12,7 +12,7 @@ public class ControllerMoveFlying extends ControllerMove { @@ -31,10 +31,10 @@ index 2b6ac2eeb0fdf35e75c35144941d7fb82cb8adc1..0496c0c5dbbcf89461c947881129673f this.h = ControllerMove.Operation.WAIT; this.a.setNoGravity(true); diff --git a/src/main/java/net/minecraft/server/EntityBee.java b/src/main/java/net/minecraft/server/EntityBee.java -index 73e016257847e5654e37ec6dbf8c689c36593216..c7d79efdf6ee3b1ac910ff48bfd4b0ef084b4d43 100644 +index dcfd2ea5024be6d4a001fa7437092a7831b36fa7..b9e01e4d9e64fdec4c4f04f1808eb8832bd00c8e 100644 --- a/src/main/java/net/minecraft/server/EntityBee.java +++ b/src/main/java/net/minecraft/server/EntityBee.java -@@ -36,7 +36,17 @@ public class EntityBee extends EntityAnimal implements EntityBird { +@@ -37,7 +37,17 @@ public class EntityBee extends EntityAnimal implements IEntityAngerable, EntityB public EntityBee(EntityTypes entitytypes, World world) { super(entitytypes, world); @@ -51,5 +51,5 @@ index 73e016257847e5654e37ec6dbf8c689c36593216..c7d79efdf6ee3b1ac910ff48bfd4b0ef + }; + // Paper end this.lookController = new EntityBee.j(this); + this.a(PathType.DANGER_FIRE, -1.0F); this.a(PathType.WATER, -1.0F); - this.a(PathType.COCOA, -1.0F); diff --git a/Spigot-Server-Patches/0431-Optimise-getChunkAt-calls-for-loaded-chunks.patch b/Spigot-Server-Patches/0414-Optimise-getChunkAt-calls-for-loaded-chunks.patch similarity index 89% rename from Spigot-Server-Patches/0431-Optimise-getChunkAt-calls-for-loaded-chunks.patch rename to Spigot-Server-Patches/0414-Optimise-getChunkAt-calls-for-loaded-chunks.patch index 9ac993e60..0fe3d50ad 100644 --- a/Spigot-Server-Patches/0431-Optimise-getChunkAt-calls-for-loaded-chunks.patch +++ b/Spigot-Server-Patches/0414-Optimise-getChunkAt-calls-for-loaded-chunks.patch @@ -7,10 +7,10 @@ bypass the need to get a player chunk, then get the either, then unwrap it... diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 633f12098973857eca04acd2839bb4d453860f1e..e467cd8123dafc46a8c894f1ffa9440de0d45340 100644 +index 1597b7a882769109f467d81ecbadc45ff6779b7e..67d6facd37462beef49dac311019b1977150d73f 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -446,6 +446,12 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -447,6 +447,12 @@ public class ChunkProviderServer extends IChunkProvider { return this.getChunkAt(i, j, chunkstatus, flag); }, this.serverThreadQueue).join(); } else { @@ -23,7 +23,7 @@ index 633f12098973857eca04acd2839bb4d453860f1e..e467cd8123dafc46a8c894f1ffa9440d GameProfilerFiller gameprofilerfiller = this.world.getMethodProfiler(); gameprofilerfiller.c("getChunk"); -@@ -496,39 +502,7 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -497,39 +503,7 @@ public class ChunkProviderServer extends IChunkProvider { if (Thread.currentThread() != this.serverThread) { return null; } else { @@ -65,10 +65,10 @@ index 633f12098973857eca04acd2839bb4d453860f1e..e467cd8123dafc46a8c894f1ffa9440d } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index d7ac4c86d170a8d7d816f86ac691c3b5129a20ba..adacff593ee20804b5ddb2df55b66bc6c162dc70 100644 +index 97840c0a673402f258e172873fd6756bc23f298b..73e0bf2d0851d2e10cd5b45a4bb90eba104bdc3d 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -266,6 +266,14 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -321,6 +321,14 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @Override public Chunk getChunkAt(int i, int j) { diff --git a/Spigot-Server-Patches/0433-Allow-overriding-the-java-version-check.patch b/Spigot-Server-Patches/0415-Allow-overriding-the-java-version-check.patch similarity index 90% rename from Spigot-Server-Patches/0433-Allow-overriding-the-java-version-check.patch rename to Spigot-Server-Patches/0415-Allow-overriding-the-java-version-check.patch index 0f8fe0874..d326950c3 100644 --- a/Spigot-Server-Patches/0433-Allow-overriding-the-java-version-check.patch +++ b/Spigot-Server-Patches/0415-Allow-overriding-the-java-version-check.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Allow overriding the java version check -DPaper.IgnoreJavaVersion=true diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index bf0a020189425d6507fa75f68f8e754723c58818..093dbeae2784d51dae74f66e3e1ce5bf6a370428 100644 +index 05b647fbb360910b2961c9276c2928fe71dad90c..5ec16547a20271074d034f7fbcb43e86cb1597e6 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -175,7 +175,7 @@ public class Main { diff --git a/Spigot-Server-Patches/0434-Add-ThrownEggHatchEvent.patch b/Spigot-Server-Patches/0416-Add-ThrownEggHatchEvent.patch similarity index 89% rename from Spigot-Server-Patches/0434-Add-ThrownEggHatchEvent.patch rename to Spigot-Server-Patches/0416-Add-ThrownEggHatchEvent.patch index 42e3a2e27..5edd2e992 100644 --- a/Spigot-Server-Patches/0434-Add-ThrownEggHatchEvent.patch +++ b/Spigot-Server-Patches/0416-Add-ThrownEggHatchEvent.patch @@ -7,10 +7,10 @@ Adds a new event similar to PlayerEggThrowEvent, but without the Player requirem (dispensers can throw eggs to hatch them, too). diff --git a/src/main/java/net/minecraft/server/EntityEgg.java b/src/main/java/net/minecraft/server/EntityEgg.java -index 970f9109d9bdea5556dc2ac7752860378623ecfa..bdd82d052a2b04744435e5695b4578c7872d8d52 100644 +index 0d5e91a4204c394efcc510d34011f32f2e313ab1..edce89169b3ca2894852087b83a6bf035ba43c3f 100644 --- a/src/main/java/net/minecraft/server/EntityEgg.java +++ b/src/main/java/net/minecraft/server/EntityEgg.java -@@ -52,6 +52,16 @@ public class EntityEgg extends EntityProjectileThrowable { +@@ -55,6 +55,16 @@ public class EntityEgg extends EntityProjectileThrowable { hatchingType = event.getHatchingType(); } diff --git a/Spigot-Server-Patches/0435-Optimise-random-block-ticking.patch b/Spigot-Server-Patches/0417-Optimise-random-block-ticking.patch similarity index 67% rename from Spigot-Server-Patches/0435-Optimise-random-block-ticking.patch rename to Spigot-Server-Patches/0417-Optimise-random-block-ticking.patch index ab44ee122..2bd78d134 100644 --- a/Spigot-Server-Patches/0435-Optimise-random-block-ticking.patch +++ b/Spigot-Server-Patches/0417-Optimise-random-block-ticking.patch @@ -70,39 +70,11 @@ index 0000000000000000000000000000000000000000..3edc8e52e06a62ce9f8cc734fd7458b3 + return fastRandomBounded(this.next(32) & 0xFFFFFFFFL, bound); + } +} -diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java -index e29ec958b3519d92cda215a50e97e6852d71c684..e40375b67a4a321048c87002a07fde5c5d2395db 100644 ---- a/src/main/java/net/minecraft/server/Block.java -+++ b/src/main/java/net/minecraft/server/Block.java -@@ -109,8 +109,8 @@ public class Block implements IMaterial { - return iblockdata.d(iblockaccess, blockposition, EnumDirection.UP) && this.n < 14; - } - -- @Deprecated -- public boolean d(IBlockData iblockdata) { -+ public final boolean isAir(IBlockData iblockdata) { return this.d(iblockdata); } // Paper - OBFHELPER -+ @Deprecated public boolean d(IBlockData iblockdata) { // Paper - OBFHELPER - return false; - } - -diff --git a/src/main/java/net/minecraft/server/BlockFluids.java b/src/main/java/net/minecraft/server/BlockFluids.java -index 6d351f0979ecfa8e500edf8dd03b4a455fd5d180..a44f65f40d2080b63069602a454266ee6fe6cff7 100644 ---- a/src/main/java/net/minecraft/server/BlockFluids.java -+++ b/src/main/java/net/minecraft/server/BlockFluids.java -@@ -27,7 +27,7 @@ public class BlockFluids extends Block implements IFluidSource { - - @Override - public void b(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) { -- worldserver.getFluid(blockposition).b(worldserver, blockposition, random); -+ iblockdata.getFluid().b(worldserver, blockposition, random); // Paper - avoid getType call - } - - @Override diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java -index 8a3435a0accd68982fab497f25557edb5fdf56b4..9fc34246a845168d158a6b2793d8e344f2d2b008 100644 +index b50d86b39d2296e1dfb9aaaeb8f8f6f62a4e7430..2d3e73ef92c7b88d49f8eb27233cb823b425ea4a 100644 --- a/src/main/java/net/minecraft/server/BlockPosition.java +++ b/src/main/java/net/minecraft/server/BlockPosition.java -@@ -458,6 +458,7 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali +@@ -402,6 +402,7 @@ public class BlockPosition extends BaseBlockPosition { return this.d(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2)); } @@ -111,25 +83,25 @@ index 8a3435a0accd68982fab497f25557edb5fdf56b4..9fc34246a845168d158a6b2793d8e344 return this.d(baseblockposition.getX(), baseblockposition.getY(), baseblockposition.getZ()); } diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index af9a195f6d0f966133577d00d30e8b4ad812aaeb..cfdf6ea55dedeaf6b96566b72ca0015350c13e92 100644 +index b2713942d8cf5bedd91ac63df18a336743c72da5..a76b1d2fd81aaedb37190bcb8510020d5df2513e 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -592,8 +592,8 @@ public class Chunk implements IChunkAccess { +@@ -593,8 +593,8 @@ public class Chunk implements IChunkAccess { this.entities.remove(entity); // Paper } - @Override -- public int a(HeightMap.Type heightmap_type, int i, int j) { -+ public int getHighestBlockY(HeightMap.Type heightmap_type, int i, int j) { return this.a(heightmap_type, i, j) + 1; } // Paper - sort of an obfhelper, but without -1 -+ @Override public int a(HeightMap.Type heightmap_type, int i, int j) { // Paper +- public int getHighestBlock(HeightMap.Type heightmap_type, int i, int j) { ++ public final int getHighestBlockY(HeightMap.Type heightmap_type, int i, int j) { return this.getHighestBlock(heightmap_type, i, j) + 1; } // Paper - sort of an obfhelper, but without -1 ++ @Override public int getHighestBlock(HeightMap.Type heightmap_type, int i, int j) { // Paper return ((HeightMap) this.heightMap.get(heightmap_type)).a(i & 15, j & 15) - 1; } diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java -index c180d44bed91c86838d3be8c19be954b4412534e..4eb7c1a9b5afced4be79a263e6a918f39c4b51be 100644 +index b168ad8021a5387e05023cd03ec1a69c8a86a233..cf444fa1cc96e881a1f9ed0c78d45935fe1c90ab 100644 --- a/src/main/java/net/minecraft/server/ChunkSection.java +++ b/src/main/java/net/minecraft/server/ChunkSection.java -@@ -6,12 +6,14 @@ import javax.annotation.Nullable; +@@ -7,12 +7,14 @@ import javax.annotation.Nullable; public class ChunkSection { public static final DataPalette GLOBAL_PALETTE = new DataPaletteGlobal<>(Block.REGISTRY_ID, Blocks.AIR.getBlockData()); @@ -146,9 +118,9 @@ index c180d44bed91c86838d3be8c19be954b4412534e..4eb7c1a9b5afced4be79a263e6a918f3 // Paper start - Anti-Xray - Add parameters @Deprecated public ChunkSection(int i) { this(i, null, null, true); } // Notice for updates: Please make sure this constructor isn't used anywhere public ChunkSection(int i, IChunkAccess chunk, World world, boolean initializeBlocks) { -@@ -66,6 +68,9 @@ public class ChunkSection { +@@ -67,6 +69,9 @@ public class ChunkSection { --this.nonEmptyBlockCount; - if (iblockdata1.q()) { + if (iblockdata1.isTicking()) { --this.tickingBlockCount; + // Paper start + this.tickingList.remove(i, j, k); @@ -156,9 +128,9 @@ index c180d44bed91c86838d3be8c19be954b4412534e..4eb7c1a9b5afced4be79a263e6a918f3 } } -@@ -77,6 +82,9 @@ public class ChunkSection { +@@ -78,6 +83,9 @@ public class ChunkSection { ++this.nonEmptyBlockCount; - if (iblockdata.q()) { + if (iblockdata.isTicking()) { ++this.tickingBlockCount; + // Paper start + this.tickingList.add(i, j, k, iblockdata); @@ -166,7 +138,7 @@ index c180d44bed91c86838d3be8c19be954b4412534e..4eb7c1a9b5afced4be79a263e6a918f3 } } -@@ -112,23 +120,29 @@ public class ChunkSection { +@@ -113,23 +121,29 @@ public class ChunkSection { } public void recalcBlockCounts() { @@ -182,10 +154,10 @@ index c180d44bed91c86838d3be8c19be954b4412534e..4eb7c1a9b5afced4be79a263e6a918f3 if (!iblockdata.isAir()) { - this.nonEmptyBlockCount = (short) (this.nonEmptyBlockCount + i); -+ this.nonEmptyBlockCount = (short) (this.nonEmptyBlockCount + 1); // Paper - if (iblockdata.q()) { ++ this.nonEmptyBlockCount = (short) (this.nonEmptyBlockCount + 1); + if (iblockdata.isTicking()) { - this.tickingBlockCount = (short) (this.tickingBlockCount + i); -+ this.tickingBlockCount = (short) (this.tickingBlockCount + 1); // Paper ++ this.tickingBlockCount = (short) (this.tickingBlockCount + 1); + // Paper start + this.tickingList.add(location, iblockdata); + // Paper end @@ -194,53 +166,39 @@ index c180d44bed91c86838d3be8c19be954b4412534e..4eb7c1a9b5afced4be79a263e6a918f3 if (!fluid.isEmpty()) { - this.nonEmptyBlockCount = (short) (this.nonEmptyBlockCount + i); -+ this.nonEmptyBlockCount = (short) (this.nonEmptyBlockCount + 1); // Paper - if (fluid.h()) { ++ this.nonEmptyBlockCount = (short) (this.nonEmptyBlockCount + 1); + if (fluid.f()) { - this.e = (short) (this.e + i); -+ this.e = (short) (this.e + 1); // Paper ++ this.e = (short) (this.e + 1); } } diff --git a/src/main/java/net/minecraft/server/DataBits.java b/src/main/java/net/minecraft/server/DataBits.java -index f9680b6830c77f31e1eb8b6845dd6d58d04f624a..a61cffa3f494be5fea785a573b0faf05b149a30d 100644 +index 48cca2b9a1dbb071615625842123c0c47e281b29..235c9ec37c00ce8838b3e7c02284e402f9d30e38 100644 --- a/src/main/java/net/minecraft/server/DataBits.java +++ b/src/main/java/net/minecraft/server/DataBits.java -@@ -127,4 +127,46 @@ public class DataBits { - +@@ -111,4 +111,32 @@ public class DataBits { } + } + + // Paper start + public final void forEach(DataBitConsumer consumer) { -+ // Note: copied from above -+ int i = this.a.length; ++ int i = 0; ++ long[] along = this.b; ++ int j = along.length; + -+ if (i != 0) { -+ int j = 0; -+ long k = this.a[0]; -+ long l = i > 1 ? this.a[1] : 0L; ++ for (int k = 0; k < j; ++k) { ++ long l = along[k]; + -+ for (int i1 = 0; i1 < this.d; ++i1) { -+ int j1 = i1 * this.b; -+ int k1 = j1 >> 6; -+ int l1 = (i1 + 1) * this.b - 1 >> 6; -+ int i2 = j1 ^ k1 << 6; -+ -+ if (k1 != j) { -+ k = l; -+ l = k1 + 1 < i ? this.a[k1 + 1] : 0L; -+ j = k1; -+ } -+ -+ if (k1 == l1) { -+ consumer.accept(i1, (int) (k >>> i2 & this.c)); -+ } else { -+ int j2 = 64 - i2; -+ -+ consumer.accept(i1, (int) ((k >>> i2 | l << j2) & this.c)); ++ for (int i1 = 0; i1 < this.f; ++i1) { ++ consumer.accept(i, (int) (l & this.d)); ++ l >>= this.c; ++ ++i; ++ if (i >= this.e) { ++ return; + } + } -+ + } + } + @@ -253,10 +211,10 @@ index f9680b6830c77f31e1eb8b6845dd6d58d04f624a..a61cffa3f494be5fea785a573b0faf05 + // Paper end } diff --git a/src/main/java/net/minecraft/server/DataPaletteBlock.java b/src/main/java/net/minecraft/server/DataPaletteBlock.java -index a5ea0e34ec181ad9f98f9ee2f644c3ec1eb1cd3c..81362de5430f9cd045ee7cbefa4a28e4c6bc0457 100644 +index 900b551f6f76862443b09c1e76ad596eda5655f4..1cb45f97b644347d16b66b46113b1e4455004fd3 100644 --- a/src/main/java/net/minecraft/server/DataPaletteBlock.java +++ b/src/main/java/net/minecraft/server/DataPaletteBlock.java -@@ -278,6 +278,14 @@ public class DataPaletteBlock implements DataPaletteExpandable { +@@ -277,6 +277,14 @@ public class DataPaletteBlock implements DataPaletteExpandable { }); } @@ -272,77 +230,24 @@ index a5ea0e34ec181ad9f98f9ee2f644c3ec1eb1cd3c..81362de5430f9cd045ee7cbefa4a28e4 public interface a { diff --git a/src/main/java/net/minecraft/server/EntityTurtle.java b/src/main/java/net/minecraft/server/EntityTurtle.java -index dd02cb3485021c3afd23c2985a71e93c6b0ab07d..b24a5100b452f69f771b724ca96d34613c7fa170 100644 +index 00827c335e9413e986d7f07d0adbcef0d106a553..c66a8011dde4932e03ea91194ea92a7263e48428 100644 --- a/src/main/java/net/minecraft/server/EntityTurtle.java +++ b/src/main/java/net/minecraft/server/EntityTurtle.java @@ -29,7 +29,7 @@ public class EntityTurtle extends EntityAnimal { - public final void setHome(BlockPosition pos) { g(pos); } // Paper - OBFHELPER - public void g(BlockPosition blockposition) { -- this.datawatcher.set(EntityTurtle.bx, blockposition); -+ this.datawatcher.set(EntityTurtle.bx, blockposition.immutableCopy()); // Paper - make sure home position can't change + public final void setHome(BlockPosition pos) { setHomePos(pos); } // Paper - OBFHELPER + public void setHomePos(BlockPosition blockposition) { +- this.datawatcher.set(EntityTurtle.bw, blockposition); ++ this.datawatcher.set(EntityTurtle.bw, blockposition.immutableCopy()); // Paper - called with mutablepos... } - - public final BlockPosition getHome() { return this.es(); } // Paper - OBFHELPER -diff --git a/src/main/java/net/minecraft/server/IBlockData.java b/src/main/java/net/minecraft/server/IBlockData.java -index 321eae23c575528788b1b575f17593580d6ba737..b19bbbbc81376177751396a2de9452ce1f84c06b 100644 ---- a/src/main/java/net/minecraft/server/IBlockData.java -+++ b/src/main/java/net/minecraft/server/IBlockData.java -@@ -22,11 +22,15 @@ public class IBlockData extends BlockDataAbstract implements - private IBlockData.a c; - private final int d; - private final boolean e; -+ private final boolean isAir; // Paper -+ private final boolean isTicking; // Paper - - public IBlockData(Block block, ImmutableMap, Comparable> immutablemap) { - super(block, immutablemap); - this.d = block.a(this); - this.e = block.o(this); -+ this.isAir = this.getBlock().isAir(this); // Paper -+ this.isTicking = this.getBlock().isTicking(this); // Paper - } - - public void c() { -@@ -82,8 +86,8 @@ public class IBlockData extends BlockDataAbstract implements - return this.d; - } - -- public boolean isAir() { -- return this.getBlock().d(this); -+ public final boolean isAir() { // Paper - compile fail if the impl changes -+ return this.isAir; // Paper - improve inlining of isAir - } - - public MaterialMapColor c(IBlockAccess iblockaccess, BlockPosition blockposition) { -@@ -268,12 +272,19 @@ public class IBlockData extends BlockDataAbstract implements - return this.getBlock().a(tag); - } - -+ private Fluid fluidData; // Paper - cache result - public Fluid getFluid() { -- return this.getBlock().a_(this); -+ // Paper start -+ // This can't be done during the constructor, order issues -+ if (this.fluidData != null) { -+ return this.fluidData; -+ } -+ return this.fluidData = this.getBlock().a_(this); -+ // Paper end - } - - public boolean q() { -- return this.getBlock().isTicking(this); -+ return this.isTicking; // Paper - } - - public final SoundEffectType getStepSound() { return this.r(); } // Paper - OBFHELPER + // TODO Paper: Obf helpers here can prolly be removed? check that no newer patches use them + public final BlockPosition getHome() { return this.getHomePos(); } // Paper - OBFHELPER diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index adacff593ee20804b5ddb2df55b66bc6c162dc70..a52d8a27cee6721c32444d9d2bd81135b7d4b859 100644 +index 73e0bf2d0851d2e10cd5b45a4bb90eba104bdc3d..93df6a29035bb3cc96409b145a2e1433d38bbe99 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -1564,10 +1564,19 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - public abstract TagRegistry t(); +@@ -1466,10 +1466,18 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + public abstract TagRegistry p(); public BlockPosition a(int i, int j, int k, int l) { + // Paper start - allow use of mutable pos @@ -350,11 +255,10 @@ index adacff593ee20804b5ddb2df55b66bc6c162dc70..a52d8a27cee6721c32444d9d2bd81135 + this.getRandomBlockPosition(i, j, k, l, ret); + return ret.immutableCopy(); + } -+ + public final BlockPosition.MutableBlockPosition getRandomBlockPosition(int i, int j, int k, int l, BlockPosition.MutableBlockPosition out) { + // Paper end - this.i = this.i * 3 + 1013904223; - int i1 = this.i >> 2; + this.n = this.n * 3 + 1013904223; + int i1 = this.n >> 2; - return new BlockPosition(i + (i1 & 15), j + (i1 >> 16 & l), k + (i1 >> 8 & 15)); + out.setValues(i + (i1 & 15), j + (i1 >> 16 & l), k + (i1 >> 8 & 15)); // Paper - change to setValues call @@ -363,10 +267,10 @@ index adacff593ee20804b5ddb2df55b66bc6c162dc70..a52d8a27cee6721c32444d9d2bd81135 public boolean isSavingDisabled() { diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index f32e313a6287c8f5d487d4ad7148cac176773228..7fded15f14a3f5c04a676e9e25413718b9922c13 100644 +index 8458ac3cf864774520afcb9ddc7cd60fc8f9d4e6..d52a75ac37db59e4df23131aecc3e7fc6bedf3a9 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -531,7 +531,12 @@ public class WorldServer extends World { +@@ -557,7 +557,12 @@ public class WorldServer extends World implements GeneratorAccessSeed { }); } @@ -380,21 +284,20 @@ index f32e313a6287c8f5d487d4ad7148cac176773228..7fded15f14a3f5c04a676e9e25413718 ChunkCoordIntPair chunkcoordintpair = chunk.getPos(); boolean flag = this.isRaining(); int j = chunkcoordintpair.d(); -@@ -539,10 +544,10 @@ public class WorldServer extends World { +@@ -565,10 +570,10 @@ public class WorldServer extends World implements GeneratorAccessSeed { GameProfilerFiller gameprofilerfiller = this.getMethodProfiler(); gameprofilerfiller.enter("thunder"); - BlockPosition blockposition; + final BlockPosition.MutableBlockPosition blockposition = this.chunkTickMutablePosition; // Paper - use mutable to reduce allocation rate, final to force compile fail on change -- if (!this.paperConfig.disableThunder && flag && this.U() && this.random.nextInt(100000) == 0) { // Paper - Disable thunder + if (!this.paperConfig.disableThunder && flag && this.T() && this.random.nextInt(100000) == 0) { // Paper - Disable thunder - blockposition = this.a(this.a(j, 0, k, 15)); -+ if (!this.paperConfig.disableThunder && flag && this.U() && this.randomTickRandom.nextInt(100000) == 0) { // Paper - Disable thunder // Paper - optimise random ticking -+ blockposition.setValues(this.a(this.getRandomBlockPosition(j, 0, k, 15, blockposition))); // Paper ++ blockposition.setValues(this.a(this.a(j, 0, k, 15))); // Paper if (this.isRainingAt(blockposition)) { DifficultyDamageScaler difficultydamagescaler = this.getDamageScaler(blockposition); boolean flag1 = this.getGameRules().getBoolean(GameRules.DO_MOB_SPAWNING) && this.random.nextDouble() < (double) difficultydamagescaler.b() * paperConfig.skeleHorseSpawnChance; // Paper -@@ -561,61 +566,79 @@ public class WorldServer extends World { +@@ -591,59 +596,77 @@ public class WorldServer extends World implements GeneratorAccessSeed { } gameprofilerfiller.exitEnter("iceandsnow"); @@ -469,10 +372,8 @@ index f32e313a6287c8f5d487d4ad7148cac176773228..7fded15f14a3f5c04a676e9e25413718 + continue; + } -- if (iblockdata.q()) { -- iblockdata.getBlock().randomTick = true; // Paper - fix MC-113809 +- if (iblockdata.isTicking()) { - iblockdata.b(this, blockposition2, this.random); -- iblockdata.getBlock().randomTick = false; // Paper - fix MC-113809 - } + long raw = section.tickingList.getRaw(index); + int location = com.destroystokyo.paper.util.maplist.IBlockDataList.getLocationFromRaw(raw); @@ -484,12 +385,10 @@ index f32e313a6287c8f5d487d4ad7148cac176773228..7fded15f14a3f5c04a676e9e25413718 + BlockPosition blockposition2 = blockposition.setValues(j + randomX, randomY, k + randomZ); + IBlockData iblockdata = com.destroystokyo.paper.util.maplist.IBlockDataList.getBlockDataFromRaw(raw); -- if (fluid.h()) { +- if (fluid.f()) { - fluid.b(this, blockposition2, this.random); - } -+ iblockdata.getBlock().randomTick = true; // Paper - fix MC-113809 + iblockdata.b(this, blockposition2, this.randomTickRandom); -+ iblockdata.getBlock().randomTick = false; // Paper - fix MC-113809 - gameprofilerfiller.exit(); - } diff --git a/Spigot-Server-Patches/0436-Entity-Jump-API.patch b/Spigot-Server-Patches/0418-Entity-Jump-API.patch similarity index 76% rename from Spigot-Server-Patches/0436-Entity-Jump-API.patch rename to Spigot-Server-Patches/0418-Entity-Jump-API.patch index 929f72735..3e5df2270 100644 --- a/Spigot-Server-Patches/0436-Entity-Jump-API.patch +++ b/Spigot-Server-Patches/0418-Entity-Jump-API.patch @@ -5,13 +5,13 @@ Subject: [PATCH] Entity Jump API diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 38f666bb115d7d29da8eac1f4848ba23ef29ba43..253e35826f6f51145c278b083d195599affca2a7 100644 +index 66bca610fbb8afc6f5b4430318c66d29af55fc19..e0a4866048276c44079e0b9034c1acea1f0498fa 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -2608,8 +2608,10 @@ public abstract class EntityLiving extends Entity { - } else if (this.aH()) { - this.c(TagsFluid.LAVA); - } else if ((this.onGround || this.N > 0.0D && this.N <= 0.4D) && this.jumpTicks == 0) { +@@ -2754,8 +2754,10 @@ public abstract class EntityLiving extends Entity { + } else if (this.aN() && (!this.onGround || d7 > d8)) { + this.c((Tag) TagsFluid.LAVA); + } else if ((this.onGround || flag && d7 <= d8) && this.jumpTicks == 0) { + if (new com.destroystokyo.paper.event.entity.EntityJumpEvent(getBukkitLivingEntity()).callEvent()) { // Paper this.jump(); this.jumpTicks = 10; @@ -20,13 +20,13 @@ index 38f666bb115d7d29da8eac1f4848ba23ef29ba43..253e35826f6f51145c278b083d195599 } else { this.jumpTicks = 0; diff --git a/src/main/java/net/minecraft/server/EntityPanda.java b/src/main/java/net/minecraft/server/EntityPanda.java -index cd41c80f19105633305be933ac20fc5548b1c5f7..f50ed19080257b9199bf1b8b846877a2ba1cafbb 100644 +index 50fe69143a6b91f957414ff556a0e60d220ab04f..42df0d74ee24ef9ac15ee19cfd298c5721df0d7d 100644 --- a/src/main/java/net/minecraft/server/EntityPanda.java +++ b/src/main/java/net/minecraft/server/EntityPanda.java -@@ -438,7 +438,9 @@ public class EntityPanda extends EntityAnimal { +@@ -435,7 +435,9 @@ public class EntityPanda extends EntityAnimal { EntityPanda entitypanda = (EntityPanda) iterator.next(); - if (!entitypanda.isBaby() && entitypanda.onGround && !entitypanda.isInWater() && entitypanda.eL()) { + if (!entitypanda.isBaby() && entitypanda.onGround && !entitypanda.isInWater() && entitypanda.fi()) { + if (new com.destroystokyo.paper.event.entity.EntityJumpEvent(getBukkitLivingEntity()).callEvent()) { // Paper entitypanda.jump(); + } else { this.setJumping(false); } // Paper - setJumping(false) stops a potential loop @@ -34,10 +34,10 @@ index cd41c80f19105633305be933ac20fc5548b1c5f7..f50ed19080257b9199bf1b8b846877a2 } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 7d101d9630848b68b15acc5efdc16ae51dc1f132..245bd116d143af120127a9d25dcb7a0c43ad47a0 100644 +index 39b8ab223bc708e5ee3dc967e489fdc76d944416..b3ec32b20751fbea2f6df14fc5e9f84682493bfd 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -723,5 +723,20 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -736,5 +736,20 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { public boolean isHandRaised() { return getHandle().isHandRaised(); } diff --git a/Spigot-Server-Patches/0437-Add-option-to-nerf-pigmen-from-nether-portals.patch b/Spigot-Server-Patches/0419-Add-option-to-nerf-pigmen-from-nether-portals.patch similarity index 77% rename from Spigot-Server-Patches/0437-Add-option-to-nerf-pigmen-from-nether-portals.patch rename to Spigot-Server-Patches/0419-Add-option-to-nerf-pigmen-from-nether-portals.patch index 9803eec32..8f719cd09 100644 --- a/Spigot-Server-Patches/0437-Add-option-to-nerf-pigmen-from-nether-portals.patch +++ b/Spigot-Server-Patches/0419-Add-option-to-nerf-pigmen-from-nether-portals.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add option to nerf pigmen from nether portals diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 2ab810f71beaa608af2194165696817a2cde4b92..578d81337394e5279c99937890c3ce35bf58404c 100644 +index 9bd64034587217743157a81c04fc20751474e21d..796c5a0b110009b479f5c9eef17e2605b564ce09 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -639,4 +639,9 @@ public class PaperWorldConfig { +@@ -591,4 +591,9 @@ public class PaperWorldConfig { disableHopperMoveEvents = getBoolean("hopper.disable-move-event", disableHopperMoveEvents); log("Hopper Move Item Events: " + (disableHopperMoveEvents ? "disabled" : "enabled")); } @@ -19,20 +19,20 @@ index 2ab810f71beaa608af2194165696817a2cde4b92..578d81337394e5279c99937890c3ce35 + } } diff --git a/src/main/java/net/minecraft/server/BlockPortal.java b/src/main/java/net/minecraft/server/BlockPortal.java -index 2dc3ab4cfa3fb9335d271e91c89f0b22f21eeb39..09c7c131833ded951e49a7a1a2eb2e1f6f8cb989 100644 +index e5b8d45ed9f62c28b0429859593d881546ccead2..77f8d5e6662fa75e622f07b3e6efae04c38735fe 100644 --- a/src/main/java/net/minecraft/server/BlockPortal.java +++ b/src/main/java/net/minecraft/server/BlockPortal.java -@@ -45,6 +45,8 @@ public class BlockPortal extends Block { - Entity entity = EntityTypes.ZOMBIE_PIGMAN.spawnCreature(worldserver, (NBTTagCompound) null, (IChatBaseComponent) null, (EntityHuman) null, blockposition.up(), EnumMobSpawn.STRUCTURE, false, false, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NETHER_PORTAL); +@@ -46,6 +46,8 @@ public class BlockPortal extends Block { if (entity != null) { + entity.portalCooldown = entity.getDefaultPortalCooldown(); + entity.fromNetherPortal = true; // Paper + if (worldserver.paperConfig.nerfNetherPortalPigmen) ((EntityInsentient) entity).aware = false; // Paper - entity.portalCooldown = entity.ba(); } } + } diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 83e0af493c0f4037ff3e625ee93b9422863f335f..7bdd3f19b2bc51c4f995d42fcd47e0e315310bff 100644 +index 39a7b8743a0612f818cda3796b5f6ae1137a7eee..c49d157b8ca25f9811bf64396c207b1c1d6e085d 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -194,6 +194,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -43,7 +43,7 @@ index 83e0af493c0f4037ff3e625ee93b9422863f335f..7bdd3f19b2bc51c4f995d42fcd47e0e3 protected int numCollisions = 0; // Paper public void inactiveTick() { } // Spigot end -@@ -1646,6 +1647,9 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -1606,6 +1607,9 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke if (spawnedViaMobSpawner) { nbttagcompound.setBoolean("Paper.FromMobSpawner", true); } @@ -53,7 +53,7 @@ index 83e0af493c0f4037ff3e625ee93b9422863f335f..7bdd3f19b2bc51c4f995d42fcd47e0e3 // Paper end return nbttagcompound; } catch (Throwable throwable) { -@@ -1768,6 +1772,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -1730,6 +1734,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke } spawnedViaMobSpawner = nbttagcompound.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status diff --git a/Spigot-Server-Patches/0438-Make-the-GUI-graph-fancier.patch b/Spigot-Server-Patches/0420-Make-the-GUI-graph-fancier.patch similarity index 95% rename from Spigot-Server-Patches/0438-Make-the-GUI-graph-fancier.patch rename to Spigot-Server-Patches/0420-Make-the-GUI-graph-fancier.patch index b84071ea4..7b332f58c 100644 --- a/Spigot-Server-Patches/0438-Make-the-GUI-graph-fancier.patch +++ b/Spigot-Server-Patches/0420-Make-the-GUI-graph-fancier.patch @@ -385,10 +385,10 @@ index 0000000000000000000000000000000000000000..c3e54da4ab6440811aab2f9dd1e21880 + } +} diff --git a/src/main/java/net/minecraft/server/GuiStatsComponent.java b/src/main/java/net/minecraft/server/GuiStatsComponent.java -index c21db8e6b798cd5106801d666f14d1d73d5e84ed..7b6e9352578aecf37c5827ba2b2596d07851bf9a 100644 +index d4d5bc19e167a5271f8eb8d010f8a52b23b942df..859e31c63f94bdc7729c6d475990750b76e24b9c 100644 --- a/src/main/java/net/minecraft/server/GuiStatsComponent.java +++ b/src/main/java/net/minecraft/server/GuiStatsComponent.java -@@ -12,7 +12,7 @@ import javax.swing.Timer; +@@ -11,7 +11,7 @@ import javax.swing.Timer; public class GuiStatsComponent extends JComponent { @@ -398,23 +398,23 @@ index c21db8e6b798cd5106801d666f14d1d73d5e84ed..7b6e9352578aecf37c5827ba2b2596d0 }); private final int[] b = new int[256]; diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index e9c3d1507317e38272305e157e889a033c5d2803..dcc5781d99d760e1d1fe6194db8fd49b23091404 100644 +index 67ab908879146c83bf591ae9956d0c038fb5c5d9..99b6a4d277816699a5abd9ec889535c064758e97 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -105,7 +105,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant set) { diff --git a/Spigot-Server-Patches/0442-Validate-tripwire-hook-placement-before-update.patch b/Spigot-Server-Patches/0423-Validate-tripwire-hook-placement-before-update.patch similarity index 90% rename from Spigot-Server-Patches/0442-Validate-tripwire-hook-placement-before-update.patch rename to Spigot-Server-Patches/0423-Validate-tripwire-hook-placement-before-update.patch index eb09d8429..6ea67bd8e 100644 --- a/Spigot-Server-Patches/0442-Validate-tripwire-hook-placement-before-update.patch +++ b/Spigot-Server-Patches/0423-Validate-tripwire-hook-placement-before-update.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Validate tripwire hook placement before update diff --git a/src/main/java/net/minecraft/server/BlockTripwireHook.java b/src/main/java/net/minecraft/server/BlockTripwireHook.java -index 1b9d889af6bdefed0d6a3ebc832c39effb8af0b9..a5e6e94fe0d7702594a842bcfec2fcaae9f19d7f 100644 +index 26d801c231c6e9e31d0bdfea59e6027c77f488e4..dd30810569325096d35a367c4348e09f1463b2a9 100644 --- a/src/main/java/net/minecraft/server/BlockTripwireHook.java +++ b/src/main/java/net/minecraft/server/BlockTripwireHook.java @@ -149,6 +149,7 @@ public class BlockTripwireHook extends Block { diff --git a/Spigot-Server-Patches/0443-Add-option-to-allow-iron-golems-to-spawn-in-air.patch b/Spigot-Server-Patches/0424-Add-option-to-allow-iron-golems-to-spawn-in-air.patch similarity index 82% rename from Spigot-Server-Patches/0443-Add-option-to-allow-iron-golems-to-spawn-in-air.patch rename to Spigot-Server-Patches/0424-Add-option-to-allow-iron-golems-to-spawn-in-air.patch index dfcc131bd..ca49b9a59 100644 --- a/Spigot-Server-Patches/0443-Add-option-to-allow-iron-golems-to-spawn-in-air.patch +++ b/Spigot-Server-Patches/0424-Add-option-to-allow-iron-golems-to-spawn-in-air.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add option to allow iron golems to spawn in air diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 47c6d66b78ed312ef85dd90178c7d6059bc94661..b773b750ae4cd41708e3fde4c88b5cf1af7098cb 100644 +index 796c5a0b110009b479f5c9eef17e2605b564ce09..1b2256144f7f968667570e5a9838a77173d515c5 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -413,6 +413,11 @@ public class PaperWorldConfig { +@@ -380,6 +380,11 @@ public class PaperWorldConfig { scanForLegacyEnderDragon = getBoolean("game-mechanics.scan-for-legacy-ender-dragon", true); } @@ -21,10 +21,10 @@ index 47c6d66b78ed312ef85dd90178c7d6059bc94661..b773b750ae4cd41708e3fde4c88b5cf1 private void bedSearchRadius() { bedSearchRadius = getInt("bed-search-radius", 1); diff --git a/src/main/java/net/minecraft/server/EntityIronGolem.java b/src/main/java/net/minecraft/server/EntityIronGolem.java -index 2f764776b2fd7b9fd7c2489f1ab914dc6d2f121a..7f6a56776000643ecc42b0b917f6673b7b038d79 100644 +index 86de45327653c09dcb6764754b10b8ad1b3450fd..e38a675be7e6a4cbb1f2f7606bf84ac570bb5985 100644 --- a/src/main/java/net/minecraft/server/EntityIronGolem.java +++ b/src/main/java/net/minecraft/server/EntityIronGolem.java -@@ -221,7 +221,7 @@ public class EntityIronGolem extends EntityGolem { +@@ -251,7 +251,7 @@ public class EntityIronGolem extends EntityGolem implements IEntityAngerable { BlockPosition blockposition1 = blockposition.down(); IBlockData iblockdata = iworldreader.getType(blockposition1); diff --git a/Spigot-Server-Patches/0444-Configurable-chance-of-villager-zombie-infection.patch b/Spigot-Server-Patches/0425-Configurable-chance-of-villager-zombie-infection.patch similarity index 84% rename from Spigot-Server-Patches/0444-Configurable-chance-of-villager-zombie-infection.patch rename to Spigot-Server-Patches/0425-Configurable-chance-of-villager-zombie-infection.patch index cb86dbf05..29c8b55f1 100644 --- a/Spigot-Server-Patches/0444-Configurable-chance-of-villager-zombie-infection.patch +++ b/Spigot-Server-Patches/0425-Configurable-chance-of-villager-zombie-infection.patch @@ -8,10 +8,10 @@ This allows you to solve an issue in vanilla behavior where: * On normal difficulty they will have a 50% of getting infected or dying. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 7d39028c930cbd66c867649d5148be2fb96bc579..0ff4475625e93d6f7a41345149e7c1fed0220bbb 100644 +index 1b2256144f7f968667570e5a9838a77173d515c5..f888fc1c5ef4212f81ed936da6485abadc336407 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -649,4 +649,9 @@ public class PaperWorldConfig { +@@ -601,4 +601,9 @@ public class PaperWorldConfig { private void nerfNetherPortalPigmen() { nerfNetherPortalPigmen = getBoolean("game-mechanics.nerf-pigmen-from-nether-portals", nerfNetherPortalPigmen); } @@ -22,23 +22,22 @@ index 7d39028c930cbd66c867649d5148be2fb96bc579..0ff4475625e93d6f7a41345149e7c1fe + } } diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java -index 8635d4f40ca153819e0fda014d7ea3795f86b940..07ebc1d81610bc506e51c7bbffefdcf676a2bb85 100644 +index 05d19850538b7d853b270d952739d5d1b151690c..b66059836cc86cbef6c302c44d3f758067a4824d 100644 --- a/src/main/java/net/minecraft/server/EntityZombie.java +++ b/src/main/java/net/minecraft/server/EntityZombie.java -@@ -455,10 +455,14 @@ public class EntityZombie extends EntityMonster { +@@ -390,10 +390,14 @@ public class EntityZombie extends EntityMonster { @Override - public void b(EntityLiving entityliving) { - super.b(entityliving); + public void a_(EntityLiving entityliving) { + super.a_(entityliving); - if ((this.world.getDifficulty() == EnumDifficulty.NORMAL || this.world.getDifficulty() == EnumDifficulty.HARD) && entityliving instanceof EntityVillager) { - if (this.world.getDifficulty() != EnumDifficulty.HARD && this.random.nextBoolean()) { + // Paper start + if (world.paperConfig.zombieVillagerInfectionChance != 0.0 && (world.paperConfig.zombieVillagerInfectionChance != -1.0 || this.world.getDifficulty() == EnumDifficulty.NORMAL || this.world.getDifficulty() == EnumDifficulty.HARD) && entityliving instanceof EntityVillager) { + if (world.paperConfig.zombieVillagerInfectionChance == -1.0 && this.world.getDifficulty() != EnumDifficulty.HARD && this.random.nextBoolean()) { -+ return; -+ } -+ if (world.paperConfig.zombieVillagerInfectionChance != -1.0 && (this.random.nextDouble() * 100.0) > world.paperConfig.zombieVillagerInfectionChance) { return; -- } + } ++ if (world.paperConfig.zombieVillagerInfectionChance != -1.0 && (this.random.nextDouble() * 100.0) > world.paperConfig.zombieVillagerInfectionChance) { ++ return; + } // Paper end EntityVillager entityvillager = (EntityVillager) entityliving; diff --git a/Spigot-Server-Patches/0445-Optimise-Chunk-getFluid.patch b/Spigot-Server-Patches/0426-Optimise-Chunk-getFluid.patch similarity index 87% rename from Spigot-Server-Patches/0445-Optimise-Chunk-getFluid.patch rename to Spigot-Server-Patches/0426-Optimise-Chunk-getFluid.patch index d0174a7e1..ed9f3cdb2 100644 --- a/Spigot-Server-Patches/0445-Optimise-Chunk-getFluid.patch +++ b/Spigot-Server-Patches/0426-Optimise-Chunk-getFluid.patch @@ -8,10 +8,10 @@ faster on its own, however removing the try catch makes it easier to inline due to code size diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index cfdf6ea55dedeaf6b96566b72ca0015350c13e92..74d110874d0a9c1603d6b2d77753179ba49811ea 100644 +index a76b1d2fd81aaedb37190bcb8510020d5df2513e..cb24f27bc443880b18ffc36236f6ec7174c9d493 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -385,17 +385,20 @@ public class Chunk implements IChunkAccess { +@@ -386,17 +386,20 @@ public class Chunk implements IChunkAccess { } public Fluid a(int i, int j, int k) { @@ -39,7 +39,7 @@ index cfdf6ea55dedeaf6b96566b72ca0015350c13e92..74d110874d0a9c1603d6b2d77753179b CrashReport crashreport = CrashReport.a(throwable, "Getting fluid state"); CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Block being got"); -@@ -404,6 +407,7 @@ public class Chunk implements IChunkAccess { +@@ -405,6 +408,7 @@ public class Chunk implements IChunkAccess { }); throw new ReportedException(crashreport); } @@ -48,10 +48,10 @@ index cfdf6ea55dedeaf6b96566b72ca0015350c13e92..74d110874d0a9c1603d6b2d77753179b // CraftBukkit start diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java -index 4eb7c1a9b5afced4be79a263e6a918f39c4b51be..f6df85c6bf27bfa7a16967259a6016c9473201a5 100644 +index cf444fa1cc96e881a1f9ed0c78d45935fe1c90ab..860dc98ab4f84c470b27726314943936d23fcb79 100644 --- a/src/main/java/net/minecraft/server/ChunkSection.java +++ b/src/main/java/net/minecraft/server/ChunkSection.java -@@ -37,7 +37,7 @@ public class ChunkSection { +@@ -38,7 +38,7 @@ public class ChunkSection { } public Fluid b(int i, int j, int k) { diff --git a/Spigot-Server-Patches/0427-Fix-comparator-behavior-for-EntityPhanton-goal.patch b/Spigot-Server-Patches/0427-Fix-comparator-behavior-for-EntityPhanton-goal.patch deleted file mode 100644 index 3e04bb18f..000000000 --- a/Spigot-Server-Patches/0427-Fix-comparator-behavior-for-EntityPhanton-goal.patch +++ /dev/null @@ -1,19 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Shane Freeder -Date: Wed, 22 Jan 2020 21:00:21 +0000 -Subject: [PATCH] Fix comparator behavior for EntityPhanton goal - - -diff --git a/src/main/java/net/minecraft/server/EntityPhantom.java b/src/main/java/net/minecraft/server/EntityPhantom.java -index 82323bf4acc140d279c399cc64fa393a0db90136..90eeddb1af59126ea7ca19c2cc909da72578fb6c 100644 ---- a/src/main/java/net/minecraft/server/EntityPhantom.java -+++ b/src/main/java/net/minecraft/server/EntityPhantom.java -@@ -224,7 +224,7 @@ public class EntityPhantom extends EntityFlying implements IMonster { - - if (!list.isEmpty()) { - list.sort((entityhuman, entityhuman1) -> { -- return entityhuman.locY() > entityhuman1.locY() ? -1 : 1; -+ return Double.compare(entityhuman1.locY(), entityhuman.locY()); // Paper - }); - Iterator iterator = list.iterator(); - diff --git a/Spigot-Server-Patches/0446-Optimise-TickListServer-by-rewriting-it.patch b/Spigot-Server-Patches/0427-Optimise-TickListServer-by-rewriting-it.patch similarity index 91% rename from Spigot-Server-Patches/0446-Optimise-TickListServer-by-rewriting-it.patch rename to Spigot-Server-Patches/0427-Optimise-TickListServer-by-rewriting-it.patch index 24d53ad14..b06dbbb88 100644 --- a/Spigot-Server-Patches/0446-Optimise-TickListServer-by-rewriting-it.patch +++ b/Spigot-Server-Patches/0427-Optimise-TickListServer-by-rewriting-it.patch @@ -42,10 +42,10 @@ sets the excessive tick delay to the specified ticks (defaults to 60 * 20 ticks, aka 60 seconds) diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 74295466e53db06d0d019a13768f3575ac61d699..f1b41e16c8ce8323a896339c5d822f8ff7d8f7e6 100644 +index bf86444c479f346e7d56f10a7c0ebefd62f08f59..8508b3e10e60a4ce36d471b1d3f7ffc836a6ddf7 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -369,6 +369,13 @@ public class PaperConfig { +@@ -349,6 +349,13 @@ public class PaperConfig { maxBookTotalSizeMultiplier = getDouble("settings.book-size.total-multiplier", maxBookTotalSizeMultiplier); } @@ -61,10 +61,10 @@ index 74295466e53db06d0d019a13768f3575ac61d699..f1b41e16c8ce8323a896339c5d822f8f ConfigurationSection section; diff --git a/src/main/java/com/destroystokyo/paper/server/ticklist/PaperTickList.java b/src/main/java/com/destroystokyo/paper/server/ticklist/PaperTickList.java new file mode 100644 -index 0000000000000000000000000000000000000000..ce653f6b4be3ab6c6d35cb3e9222e7f8c8759e25 +index 0000000000000000000000000000000000000000..0692fe33bb7c4a7bb666920b10f5dd3a0e7a7689 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/server/ticklist/PaperTickList.java -@@ -0,0 +1,622 @@ +@@ -0,0 +1,617 @@ +package com.destroystokyo.paper.server.ticklist; + +import net.minecraft.server.MCUtil; @@ -113,7 +113,7 @@ index 0000000000000000000000000000000000000000..ce653f6b4be3ab6c6d35cb3e9222e7f8 + private final WorldServer world; + private final Predicate excludeFromScheduling; + private final Function getMinecraftKeyFrom; -+ private final Function getObjectFronMinecraftKey; ++ //private final Function getObjectFronMinecraftKey; + private final Consumer> tickFunction; + + private final co.aikar.timings.Timing timingCleanup; // Paper @@ -156,12 +156,11 @@ index 0000000000000000000000000000000000000000..ce653f6b4be3ab6c6d35cb3e9222e7f8 + } + + public PaperTickList(final WorldServer world, final Predicate excludeFromScheduling, final Function getMinecraftKeyFrom, -+ final Function getObjectFronMinecraftKey, final Consumer> tickFunction, final String timingsType) { -+ super(world, excludeFromScheduling, getMinecraftKeyFrom, getObjectFronMinecraftKey, tickFunction, timingsType); ++ final Consumer> tickFunction, final String timingsType) { ++ super(world, excludeFromScheduling, getMinecraftKeyFrom, tickFunction, timingsType); + this.world = world; + this.excludeFromScheduling = excludeFromScheduling; + this.getMinecraftKeyFrom = getMinecraftKeyFrom; -+ this.getObjectFronMinecraftKey = getObjectFronMinecraftKey; + this.tickFunction = tickFunction; + this.timingCleanup = co.aikar.timings.WorldTimingsHandler.getTickList(world, timingsType + " - Cleanup"); // Paper + this.timingTicking = co.aikar.timings.WorldTimingsHandler.getTickList(world, timingsType + " - Ticking"); // Paper @@ -521,10 +520,6 @@ index 0000000000000000000000000000000000000000..ce653f6b4be3ab6c6d35cb3e9222e7f8 + this.addToSchedule(entry); + } + -+ @Override -+ public void scheduleAll(final Stream> stream) { -+ this.scheduleAll(stream.iterator()); -+ } + public void scheduleAll(final Iterator> iterator) { + while (iterator.hasNext()) { + this.schedule(iterator.next()); @@ -883,10 +878,10 @@ index 0000000000000000000000000000000000000000..118988c39e58f28e8a2851792b9c014f + } +} diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java -index 3fcfe416d26808fa1c9bfdc5b413b149764c544a..3bf17ccdaef21322b787db538d569e0bc614ef22 100644 +index 2d3e73ef92c7b88d49f8eb27233cb823b425ea4a..163a6c83a2e494e28981974ef9accd3255e562c2 100644 --- a/src/main/java/net/minecraft/server/BlockPosition.java +++ b/src/main/java/net/minecraft/server/BlockPosition.java -@@ -126,6 +126,7 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali +@@ -104,6 +104,7 @@ public class BlockPosition extends BaseBlockPosition { return i == 0 && j == 0 && k == 0 ? this : new BlockPosition(this.getX() + i, this.getY() + j, this.getZ() + k); } @@ -895,10 +890,10 @@ index 3fcfe416d26808fa1c9bfdc5b413b149764c544a..3bf17ccdaef21322b787db538d569e0b return this.b(baseblockposition.getX(), baseblockposition.getY(), baseblockposition.getZ()); } diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 6688b1340e2cc8fb13a7e80c9b7c37b8822dcecd..d53b34ba552771bf271131ce0a56ebb992ccc84c 100644 +index 67d6facd37462beef49dac311019b1977150d73f..ba9f75bd8f6fe1990d485548f4481bd1762d93af 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -200,6 +200,13 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -202,6 +202,13 @@ public class ChunkProviderServer extends IChunkProvider { } // Paper end @@ -909,9 +904,9 @@ index 6688b1340e2cc8fb13a7e80c9b7c37b8822dcecd..d53b34ba552771bf271131ce0a56ebb9 + } + // Paper end - rewrite ticklistserver + - - public ChunkProviderServer(WorldServer worldserver, File file, DataFixer datafixer, DefinedStructureManager definedstructuremanager, Executor executor, ChunkGenerator chunkgenerator, int i, WorldLoadListener worldloadlistener, Supplier supplier) { + public ChunkProviderServer(WorldServer worldserver, Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, DefinedStructureManager definedstructuremanager, Executor executor, ChunkGenerator chunkgenerator, int i, boolean flag, WorldLoadListener worldloadlistener, Supplier supplier) { this.world = worldserver; + this.serverThreadQueue = new ChunkProviderServer.a(worldserver); diff --git a/src/main/java/net/minecraft/server/NextTickListEntry.java b/src/main/java/net/minecraft/server/NextTickListEntry.java index 33cfeabdee03195a294f303f28044a313cb1c4ed..2287e47d1b891135a5f2579ec324c70589141192 100644 --- a/src/main/java/net/minecraft/server/NextTickListEntry.java @@ -984,10 +979,10 @@ index 33cfeabdee03195a294f303f28044a313cb1c4ed..2287e47d1b891135a5f2579ec324c705 public String toString() { return this.e + ": " + this.a + ", " + this.b + ", " + this.c + ", " + this.f; diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index 0f1576effe10795bcb8ed3b519f4dbafdf9ea6ed..afc92dd031cdaf725b85c0b301d5a5a21da54720 100644 +index b6868b6b23a09e8e0dfe7a5e378dca22b8d80bad..9cb2ff09da0b8832e58eed4d70741853a25c9011 100644 --- a/src/main/java/net/minecraft/server/PlayerChunk.java +++ b/src/main/java/net/minecraft/server/PlayerChunk.java -@@ -473,7 +473,9 @@ public class PlayerChunk { +@@ -460,7 +460,9 @@ public class PlayerChunk { PlayerChunk.this.isTickingReady = true; @@ -999,7 +994,7 @@ index 0f1576effe10795bcb8ed3b519f4dbafdf9ea6ed..afc92dd031cdaf725b85c0b301d5a5a2 } }); diff --git a/src/main/java/net/minecraft/server/StructureBoundingBox.java b/src/main/java/net/minecraft/server/StructureBoundingBox.java -index dbb565e74d211ef35d5d40b3d024e2f07cef9031..185658e230688a9939c89dae9167217cbee03571 100644 +index 7873db26b336c97f909e5391e58ee53feaf59b9a..447eb2ba84789edf9bac2e2ffb2dec7cb4596cbf 100644 --- a/src/main/java/net/minecraft/server/StructureBoundingBox.java +++ b/src/main/java/net/minecraft/server/StructureBoundingBox.java @@ -4,12 +4,12 @@ import com.google.common.base.MoreObjects; @@ -1021,7 +1016,7 @@ index dbb565e74d211ef35d5d40b3d024e2f07cef9031..185658e230688a9939c89dae9167217c public StructureBoundingBox() {} -@@ -84,6 +84,7 @@ public class StructureBoundingBox { +@@ -88,6 +88,7 @@ public class StructureBoundingBox { this.e = 512; } @@ -1029,8 +1024,8 @@ index dbb565e74d211ef35d5d40b3d024e2f07cef9031..185658e230688a9939c89dae9167217c public boolean b(StructureBoundingBox structureboundingbox) { return this.d >= structureboundingbox.a && this.a <= structureboundingbox.d && this.f >= structureboundingbox.c && this.c <= structureboundingbox.f && this.e >= structureboundingbox.b && this.b <= structureboundingbox.e; } -@@ -114,6 +115,7 @@ public class StructureBoundingBox { - return new StructureBoundingBox(this.a + i, this.b + j, this.c + k, this.d + i, this.e + j, this.f + k); +@@ -122,6 +123,7 @@ public class StructureBoundingBox { + this.a(baseblockposition.getX(), baseblockposition.getY(), baseblockposition.getZ()); } + public final boolean hasPoint(BaseBlockPosition baseblockposition) { return this.b(baseblockposition); } // Paper - OBFHELPER @@ -1038,10 +1033,10 @@ index dbb565e74d211ef35d5d40b3d024e2f07cef9031..185658e230688a9939c89dae9167217c return baseblockposition.getX() >= this.a && baseblockposition.getX() <= this.d && baseblockposition.getZ() >= this.c && baseblockposition.getZ() <= this.f && baseblockposition.getY() >= this.b && baseblockposition.getY() <= this.e; } diff --git a/src/main/java/net/minecraft/server/TickListServer.java b/src/main/java/net/minecraft/server/TickListServer.java -index f533860bbed19ff2915c90186c259b466f41ce90..3f1aa5ced697490b5481ba992cf5af5dc98b8166 100644 +index 3b8f56c0f0507ebdd9ac20be70688b4c0cfe4cf8..149d2b4f929c11b8baf17163bbd6ff8220a95e86 100644 --- a/src/main/java/net/minecraft/server/TickListServer.java +++ b/src/main/java/net/minecraft/server/TickListServer.java -@@ -42,6 +42,11 @@ public class TickListServer implements TickList { +@@ -39,6 +39,11 @@ public class TickListServer implements TickList { // Paper end public void b() { @@ -1053,7 +1048,7 @@ index f533860bbed19ff2915c90186c259b466f41ce90..3f1aa5ced697490b5481ba992cf5af5d int i = this.nextTickList.size(); if (false) { // CraftBukkit -@@ -109,15 +114,30 @@ public class TickListServer implements TickList { +@@ -106,10 +111,20 @@ public class TickListServer implements TickList { @Override public boolean b(BlockPosition blockposition, T t0) { @@ -1062,17 +1057,7 @@ index f533860bbed19ff2915c90186c259b466f41ce90..3f1aa5ced697490b5481ba992cf5af5d + } + public boolean isPendingTickThisTick(BlockPosition blockposition, T t0) { + // Paper end - return this.g.contains(new NextTickListEntry<>(blockposition, t0)); - } - - @Override - public void a(Stream> stream) { -+ // Paper start - allow overriding -+ this.scheduleAll(stream); -+ } -+ public void scheduleAll(Stream> stream) { -+ // Paper end - stream.forEach(this::a); + return this.f.contains(new NextTickListEntry<>(blockposition, t0)); } public List> a(ChunkCoordIntPair chunkcoordintpair, boolean flag, boolean flag1) { @@ -1084,7 +1069,7 @@ index f533860bbed19ff2915c90186c259b466f41ce90..3f1aa5ced697490b5481ba992cf5af5d int i = (chunkcoordintpair.x << 4) - 2; int j = i + 16 + 2; int k = (chunkcoordintpair.z << 4) - 2; -@@ -127,6 +147,11 @@ public class TickListServer implements TickList { +@@ -119,6 +134,11 @@ public class TickListServer implements TickList { } public List> a(StructureBoundingBox structureboundingbox, boolean flag, boolean flag1) { @@ -1096,7 +1081,7 @@ index f533860bbed19ff2915c90186c259b466f41ce90..3f1aa5ced697490b5481ba992cf5af5d List> list = this.a((List) null, this.nextTickList, structureboundingbox, flag); if (flag && list != null) { -@@ -166,6 +191,11 @@ public class TickListServer implements TickList { +@@ -158,6 +178,11 @@ public class TickListServer implements TickList { } public void a(StructureBoundingBox structureboundingbox, BlockPosition blockposition) { @@ -1108,7 +1093,7 @@ index f533860bbed19ff2915c90186c259b466f41ce90..3f1aa5ced697490b5481ba992cf5af5d List> list = this.a(structureboundingbox, false, false); Iterator iterator = list.iterator(); -@@ -183,11 +213,17 @@ public class TickListServer implements TickList { +@@ -175,11 +200,17 @@ public class TickListServer implements TickList { } public NBTTagList a(ChunkCoordIntPair chunkcoordintpair) { @@ -1119,14 +1104,14 @@ index f533860bbed19ff2915c90186c259b466f41ce90..3f1aa5ced697490b5481ba992cf5af5d + // Paper end List> list = this.a(chunkcoordintpair, false, true); - return a(this.b, list, this.f.getTime()); + return a(this.b, list, this.e.getTime()); } + public static NBTTagList serialize(Function function, Iterable> iterable, long i) { return TickListServer.a(function, iterable, i); } // Paper - OBFHELPER - public static NBTTagList a(Function function, Iterable> iterable, long i) { + private static NBTTagList a(Function function, Iterable> iterable, long i) { NBTTagList nbttaglist = new NBTTagList(); Iterator iterator = iterable.iterator(); -@@ -210,11 +246,21 @@ public class TickListServer implements TickList { +@@ -202,11 +233,21 @@ public class TickListServer implements TickList { @Override public boolean a(BlockPosition blockposition, T t0) { @@ -1146,9 +1131,9 @@ index f533860bbed19ff2915c90186c259b466f41ce90..3f1aa5ced697490b5481ba992cf5af5d + public void schedule(BlockPosition blockposition, T t0, int i, TickListPriority ticklistpriority) { + // Paper end if (!this.a.test(t0)) { - this.a(new NextTickListEntry<>(blockposition, t0, (long) i + this.f.getTime(), ticklistpriority)); + this.a(new NextTickListEntry<>(blockposition, t0, (long) i + this.e.getTime(), ticklistpriority)); } -@@ -230,6 +276,11 @@ public class TickListServer implements TickList { +@@ -222,6 +263,11 @@ public class TickListServer implements TickList { } public int a() { @@ -1161,10 +1146,10 @@ index f533860bbed19ff2915c90186c259b466f41ce90..3f1aa5ced697490b5481ba992cf5af5d } } diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 7fded15f14a3f5c04a676e9e25413718b9922c13..642b5b485df28149f255ae9b5e43083821b20a0a 100644 +index d52a75ac37db59e4df23131aecc3e7fc6bedf3a9..7426c800002560bc5534aa3f683068fb2dcb7898 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -170,6 +170,15 @@ public class WorldServer extends World { +@@ -181,6 +181,15 @@ public class WorldServer extends World implements GeneratorAccessSeed { } // Paper end @@ -1177,35 +1162,34 @@ index 7fded15f14a3f5c04a676e9e25413718b9922c13..642b5b485df28149f255ae9b5e430838 + } + // Paper end - rewrite ticklistserver + - // Add env and gen to constructor - public WorldServer(MinecraftServer minecraftserver, Executor executor, WorldNBTStorage worldnbtstorage, WorldData worlddata, DimensionManager dimensionmanager, GameProfilerFiller gameprofilerfiller, WorldLoadListener worldloadlistener, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { - super(worlddata, dimensionmanager, executor, (world, worldprovider) -> { // Paper - pass executor down -@@ -190,12 +199,22 @@ public class WorldServer extends World { - this.pvpMode = minecraftserver.getPVP(); - worlddata.world = this; + // Add env and gen to constructor, WorldData -> WorldDataServer + public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey resourcekey, ResourceKey resourcekey1, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { + super(iworlddataserver, resourcekey, resourcekey1, dimensionmanager, minecraftserver::getMethodProfiler, false, flag, i, gen, env, executor); // Paper pass executor +@@ -188,12 +197,21 @@ public class WorldServer extends World implements GeneratorAccessSeed { + convertable = convertable_conversionsession; + uuid = WorldUUID.getUUID(convertable_conversionsession.folder.toFile()); // CraftBukkit end - this.nextTickListBlock = new TickListServer<>(this, (block) -> { - return block == null || block.getBlockData().isAir(); -- }, IRegistry.BLOCK::getKey, IRegistry.BLOCK::get, this::b, "Blocks"); // Paper - Timings +- }, IRegistry.BLOCK::getKey, this::b, "Blocks"); // Paper - Timings - this.nextTickListFluid = new TickListServer<>(this, (fluidtype) -> { - return fluidtype == null || fluidtype == FluidTypes.EMPTY; -- }, IRegistry.FLUID::getKey, IRegistry.FLUID::get, this::a, "Fluids"); // Paper - Timings +- }, IRegistry.FLUID::getKey, this::a, "Fluids"); // Paper - Timings + if (com.destroystokyo.paper.PaperConfig.useOptimizedTickList) { -+ this.nextTickListBlock = new com.destroystokyo.paper.server.ticklist.PaperTickList<>(this, (block) -> { // Paper - optimise TickListServer ++ this.nextTickListBlock = new com.destroystokyo.paper.server.ticklist.PaperTickList<>(this, (block) -> { + return block == null || block.getBlockData().isAir(); -+ }, IRegistry.BLOCK::getKey, IRegistry.BLOCK::get, this::b, "Blocks"); // Paper - Timings -+ this.nextTickListFluid = new com.destroystokyo.paper.server.ticklist.PaperTickList<>(this, (fluidtype) -> { // Paper - optimise TickListServer ++ }, IRegistry.BLOCK::getKey, this::b, "Blocks"); // Paper - Timings ++ this.nextTickListFluid = new com.destroystokyo.paper.server.ticklist.PaperTickList<>(this, (fluidtype) -> { + return fluidtype == null || fluidtype == FluidTypes.EMPTY; -+ }, IRegistry.FLUID::getKey, IRegistry.FLUID::get, this::a, "Fluids"); // Paper - Timings ++ }, IRegistry.FLUID::getKey, this::a, "Fluids"); // Paper - Timings + } else { -+ this.nextTickListBlock = new TickListServer<>(this, (block) -> { // Paper - optimise TickListServer ++ this.nextTickListBlock = new TickListServer<>(this, (block) -> { + return block == null || block.getBlockData().isAir(); -+ }, IRegistry.BLOCK::getKey, IRegistry.BLOCK::get, this::b, "Blocks"); // Paper - Timings -+ this.nextTickListFluid = new TickListServer<>(this, (fluidtype) -> { // Paper - optimise TickListServer ++ }, IRegistry.BLOCK::getKey, this::b, "Blocks"); // Paper - Timings ++ this.nextTickListFluid = new TickListServer<>(this, (fluidtype) -> { + return fluidtype == null || fluidtype == FluidTypes.EMPTY; -+ }, IRegistry.FLUID::getKey, IRegistry.FLUID::get, this::a, "Fluids"); // Paper - Timings ++ }, IRegistry.FLUID::getKey, this::a, "Fluids"); // Paper - Timings + } -+ this.navigators = Sets.newHashSet(); - this.I = new ObjectLinkedOpenHashSet(); - this.dataManager = worldnbtstorage; + this.L = new ObjectLinkedOpenHashSet(); + this.Q = flag1; diff --git a/Spigot-Server-Patches/0447-Pillager-patrol-spawn-settings-and-per-player-option.patch b/Spigot-Server-Patches/0428-Pillager-patrol-spawn-settings-and-per-player-option.patch similarity index 92% rename from Spigot-Server-Patches/0447-Pillager-patrol-spawn-settings-and-per-player-option.patch rename to Spigot-Server-Patches/0428-Pillager-patrol-spawn-settings-and-per-player-option.patch index 3ceb2620f..06a51a33e 100644 --- a/Spigot-Server-Patches/0447-Pillager-patrol-spawn-settings-and-per-player-option.patch +++ b/Spigot-Server-Patches/0428-Pillager-patrol-spawn-settings-and-per-player-option.patch @@ -10,10 +10,10 @@ When not per player it will use the Vanilla mechanic of one delay per world and the world age for the start day. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 0ff4475625e93d6f7a41345149e7c1fed0220bbb..598f27bc1b95132ded224dd5c7a0e2639ab2bd12 100644 +index f888fc1c5ef4212f81ed936da6485abadc336407..b987399ca3786a30f87c98658e8bf04d4aa2e2da 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -627,10 +627,21 @@ public class PaperWorldConfig { +@@ -579,10 +579,21 @@ public class PaperWorldConfig { } public boolean disablePillagerPatrols = false; @@ -36,10 +36,10 @@ index 0ff4475625e93d6f7a41345149e7c1fed0220bbb..598f27bc1b95132ded224dd5c7a0e263 private void entitiesTargetWithFollowRange() { entitiesTargetWithFollowRange = getBoolean("entities-target-with-follow-range", entitiesTargetWithFollowRange); diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 8434f10d4c674fbbed40dba86e54f7cad93df642..52544730a2cce4db4f912ad1109945ac4e53a9b6 100644 +index 2e902d7015dabad22d4ff6dfd79ed92255718651..7792ce6e94d25021666ef21da790f337d411234e 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -77,6 +77,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -81,6 +81,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public boolean viewingCredits; private int containerUpdateDelay; // Paper public long loginTime; // Paper @@ -48,12 +48,12 @@ index 8434f10d4c674fbbed40dba86e54f7cad93df642..52544730a2cce4db4f912ad1109945ac public boolean queueHealthUpdatePacket = false; public net.minecraft.server.PacketPlayOutUpdateHealth queuedHealthUpdatePacket; diff --git a/src/main/java/net/minecraft/server/MobSpawnerPatrol.java b/src/main/java/net/minecraft/server/MobSpawnerPatrol.java -index a0f582807605b9cc5bbf31d84907e56fba393e2e..edca6d3abdc31701068cad4af493759f353d4407 100644 +index b1fea06d29a0c98136496d6eff81e6959cb73672..78029e10e6670936fb7dbedc7f34c5f8045fc291 100644 --- a/src/main/java/net/minecraft/server/MobSpawnerPatrol.java +++ b/src/main/java/net/minecraft/server/MobSpawnerPatrol.java -@@ -4,12 +4,14 @@ import java.util.Random; +@@ -4,13 +4,15 @@ import java.util.Random; - public class MobSpawnerPatrol { + public class MobSpawnerPatrol implements MobSpawner { + private int getSpawnDelay() { return a; } // Paper - OBFHELPER + private void setSpawnDelay(int spawnDelay) { this.a = spawnDelay; } // Paper - OBFHELPER @@ -61,13 +61,14 @@ index a0f582807605b9cc5bbf31d84907e56fba393e2e..edca6d3abdc31701068cad4af493759f public MobSpawnerPatrol() {} + @Override public int a(WorldServer worldserver, boolean flag, boolean flag1) { - if (worldserver.paperConfig.disablePillagerPatrols) return 0; // Paper + if (worldserver.paperConfig.disablePillagerPatrols || worldserver.paperConfig.patrolSpawnChance == 0) return 0; // Paper if (!flag) { return 0; } else if (!worldserver.getGameRules().getBoolean(GameRules.DO_PATROL_SPAWNING)) { -@@ -17,23 +19,51 @@ public class MobSpawnerPatrol { +@@ -18,23 +20,51 @@ public class MobSpawnerPatrol implements MobSpawner { } else { Random random = worldserver.random; diff --git a/Spigot-Server-Patches/0448-Ensure-Entity-is-never-double-registered.patch b/Spigot-Server-Patches/0429-Ensure-Entity-is-never-double-registered.patch similarity index 79% rename from Spigot-Server-Patches/0448-Ensure-Entity-is-never-double-registered.patch rename to Spigot-Server-Patches/0429-Ensure-Entity-is-never-double-registered.patch index 4a2110a09..f7bf961b2 100644 --- a/Spigot-Server-Patches/0448-Ensure-Entity-is-never-double-registered.patch +++ b/Spigot-Server-Patches/0429-Ensure-Entity-is-never-double-registered.patch @@ -11,7 +11,7 @@ Vs behavior of non ticking of just overwriting state. We will now simply log a warning when this happens instead of crashing the server. diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 7bdd3f19b2bc51c4f995d42fcd47e0e315310bff..7434f859f7f9acff0f881ff594c8dffdfa249c76 100644 +index c49d157b8ca25f9811bf64396c207b1c1d6e085d..e895bf811ce5d441541725ade48e3f07ca86fc2b 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -59,6 +59,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -23,18 +23,18 @@ index 7bdd3f19b2bc51c4f995d42fcd47e0e315310bff..7434f859f7f9acff0f881ff594c8dffd private boolean locked = false; @Override diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index be61f898cc96afeffe6ff2eb0ae3c4ce8da10b80..e635839673b767c630d0d3a2a7c370b05bba7164 100644 +index 7426c800002560bc5534aa3f683068fb2dcb7898..ceeefe7ac6b0dcdb96a8939e0d1ba543161aba57 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -532,6 +532,7 @@ public class WorldServer extends World { +@@ -531,6 +531,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { + Entity entity2; - try (co.aikar.timings.Timing ignored = this.timings.newEntities.startTiming()) { // Paper - timings - while ((entity = (Entity) this.entitiesToAdd.poll()) != null) { -+ if (!entity.isQueuedForRegister) continue; // Paper - ignore cancelled registers - this.registerEntity(entity); + while ((entity2 = (Entity) this.entitiesToAdd.poll()) != null) { ++ if (!entity2.isQueuedForRegister) continue; // Paper - ignore cancelled registers + this.registerEntity(entity2); } - } // Paper - timings -@@ -1338,6 +1339,19 @@ public class WorldServer extends World { + +@@ -1227,6 +1228,19 @@ public class WorldServer extends World implements GeneratorAccessSeed { public void unregisterEntity(Entity entity) { org.spigotmc.AsyncCatcher.catchOp("entity unregister"); // Spigot @@ -54,7 +54,7 @@ index be61f898cc96afeffe6ff2eb0ae3c4ce8da10b80..e635839673b767c630d0d3a2a7c370b0 // Spigot start if ( entity instanceof EntityHuman ) { -@@ -1404,9 +1418,21 @@ public class WorldServer extends World { +@@ -1293,9 +1307,21 @@ public class WorldServer extends World implements GeneratorAccessSeed { private void registerEntity(Entity entity) { org.spigotmc.AsyncCatcher.catchOp("entity register"); // Spigot @@ -76,4 +76,4 @@ index be61f898cc96afeffe6ff2eb0ae3c4ce8da10b80..e635839673b767c630d0d3a2a7c370b0 + entity.isQueuedForRegister = false; // Paper this.entitiesById.put(entity.getId(), entity); if (entity instanceof EntityEnderDragon) { - EntityComplexPart[] aentitycomplexpart = ((EntityEnderDragon) entity).eo(); + EntityComplexPart[] aentitycomplexpart = ((EntityEnderDragon) entity).eK(); diff --git a/Spigot-Server-Patches/0449-Fix-unregistering-entities-from-unloading-chunks.patch b/Spigot-Server-Patches/0430-Fix-unregistering-entities-from-unloading-chunks.patch similarity index 88% rename from Spigot-Server-Patches/0449-Fix-unregistering-entities-from-unloading-chunks.patch rename to Spigot-Server-Patches/0430-Fix-unregistering-entities-from-unloading-chunks.patch index 462026c5d..80607819b 100644 --- a/Spigot-Server-Patches/0449-Fix-unregistering-entities-from-unloading-chunks.patch +++ b/Spigot-Server-Patches/0430-Fix-unregistering-entities-from-unloading-chunks.patch @@ -15,10 +15,10 @@ Combine that with a buggy detail of the previous implementation of the Dupe UUID patch, then this was the likely source of the "Ghost entities" diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index e635839673b767c630d0d3a2a7c370b05bba7164..255650fc6adcd81df2ee063209d2098745e45e39 100644 +index ceeefe7ac6b0dcdb96a8939e0d1ba543161aba57..f21011761ddf3082bc9bb59f1ec6d97e5d98c705 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1497,9 +1497,9 @@ public class WorldServer extends World { +@@ -1386,9 +1386,9 @@ public class WorldServer extends World implements GeneratorAccessSeed { } private void removeEntityFromChunk(Entity entity) { diff --git a/Spigot-Server-Patches/0450-Remote-Connections-shouldn-t-hold-up-shutdown.patch b/Spigot-Server-Patches/0431-Remote-Connections-shouldn-t-hold-up-shutdown.patch similarity index 86% rename from Spigot-Server-Patches/0450-Remote-Connections-shouldn-t-hold-up-shutdown.patch rename to Spigot-Server-Patches/0431-Remote-Connections-shouldn-t-hold-up-shutdown.patch index e74f8cac9..ee69aaee7 100644 --- a/Spigot-Server-Patches/0450-Remote-Connections-shouldn-t-hold-up-shutdown.patch +++ b/Spigot-Server-Patches/0431-Remote-Connections-shouldn-t-hold-up-shutdown.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Remote Connections shouldn't hold up shutdown Bugs in the connection logic appears to leave stale connections even, preventing shutdown diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index 349a0ea213f7f45e927d439985e121e8fa66c041..1ef7890da599d13e784861035e7891efcc4cd504 100644 +index e923835634f7440e5b88a9d5c62a70fcec8b688a..87753a94792af94454f76a2beb1ab9f1027f514f 100644 --- a/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java -@@ -415,11 +415,11 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer +@@ -361,11 +361,11 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer } if (this.remoteControlListener != null) { diff --git a/Spigot-Server-Patches/0432-Be-more-tolerant-of-invalid-attributes.patch b/Spigot-Server-Patches/0432-Be-more-tolerant-of-invalid-attributes.patch deleted file mode 100644 index 9f40d486f..000000000 --- a/Spigot-Server-Patches/0432-Be-more-tolerant-of-invalid-attributes.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zach Brown -Date: Thu, 6 Feb 2020 19:20:27 -0600 -Subject: [PATCH] Be more tolerant of invalid attributes - -Prior to this commit, the player would be disconnected if they ever encountered an attribute with a name that did -not match Bukkit's expected vanilla scheme. It appears that datapacks can set whatever attribute name they want, -ignoring vanilla's typical scheme. - -In a more perfect world the API would expose some way to interact with these attributes, however Bukkit is not -particularly flexible in this area. Perhaps this is an area for future expansion at a later time. - -diff --git a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java -index 77e584b129ab21959b7c33ac45e5841935e86ac8..007d28b16ce16295c7d398c09557b8c0777657c6 100644 ---- a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java -+++ b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java -@@ -47,6 +47,12 @@ public class CraftAttributeMap implements Attributable { - public static Attribute fromMinecraft(String nms) { - String[] split = nms.split("\\.", 2); - -+ // Paper start - Datapacks can set their own attributes that may not match our expectations, ignore them -+ if (split.length != 2) { -+ return null; -+ } -+ // Paper end -+ - String generic = split[0]; - String descriptor = CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, split[1]); // movementSpeed -> MOVEMENT_SPEED - String fin = generic + "_" + descriptor; diff --git a/Spigot-Server-Patches/0451-Do-not-allow-bees-to-load-chunks-for-beehives.patch b/Spigot-Server-Patches/0432-Do-not-allow-bees-to-load-chunks-for-beehives.patch similarity index 73% rename from Spigot-Server-Patches/0451-Do-not-allow-bees-to-load-chunks-for-beehives.patch rename to Spigot-Server-Patches/0432-Do-not-allow-bees-to-load-chunks-for-beehives.patch index f639d95a4..f39f9165e 100644 --- a/Spigot-Server-Patches/0451-Do-not-allow-bees-to-load-chunks-for-beehives.patch +++ b/Spigot-Server-Patches/0432-Do-not-allow-bees-to-load-chunks-for-beehives.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Do not allow bees to load chunks for beehives diff --git a/src/main/java/net/minecraft/server/EntityBee.java b/src/main/java/net/minecraft/server/EntityBee.java -index c7d79efdf6ee3b1ac910ff48bfd4b0ef084b4d43..dd1d246aeb5bd7c7d284175f936936ececb0f932 100644 +index b9e01e4d9e64fdec4c4f04f1808eb8832bd00c8e..e6868e2b65e3c2bde7696272b242a47e7394e27f 100644 --- a/src/main/java/net/minecraft/server/EntityBee.java +++ b/src/main/java/net/minecraft/server/EntityBee.java -@@ -315,6 +315,7 @@ public class EntityBee extends EntityAnimal implements EntityBird { +@@ -284,6 +284,7 @@ public class EntityBee extends EntityAnimal implements IEntityAngerable, EntityB if (this.hivePos == null) { return false; } else { @@ -16,7 +16,7 @@ index c7d79efdf6ee3b1ac910ff48bfd4b0ef084b4d43..dd1d246aeb5bd7c7d284175f936936ec TileEntity tileentity = this.world.getTileEntity(this.hivePos); return tileentity instanceof TileEntityBeehive && ((TileEntityBeehive) tileentity).d(); -@@ -334,6 +335,7 @@ public class EntityBee extends EntityAnimal implements EntityBird { +@@ -316,6 +317,7 @@ public class EntityBee extends EntityAnimal implements IEntityAngerable, EntityB } private boolean i(BlockPosition blockposition) { @@ -24,15 +24,15 @@ index c7d79efdf6ee3b1ac910ff48bfd4b0ef084b4d43..dd1d246aeb5bd7c7d284175f936936ec TileEntity tileentity = this.world.getTileEntity(blockposition); return tileentity instanceof TileEntityBeehive ? !((TileEntityBeehive) tileentity).isFull() : false; -@@ -593,6 +595,7 @@ public class EntityBee extends EntityAnimal implements EntityBird { +@@ -558,6 +560,7 @@ public class EntityBee extends EntityAnimal implements IEntityAngerable, EntityB @Override public boolean g() { - if (EntityBee.this.hasHivePos() && EntityBee.this.eI() && EntityBee.this.hivePos.a((IPosition) EntityBee.this.getPositionVector(), 2.0D)) { + if (EntityBee.this.hasHivePos() && EntityBee.this.fe() && EntityBee.this.hivePos.a((IPosition) EntityBee.this.getPositionVector(), 2.0D)) { + if (!EntityBee.this.world.isLoadedAndInBounds(EntityBee.this.hivePos)) return false; // Paper TileEntity tileentity = EntityBee.this.world.getTileEntity(EntityBee.this.hivePos); if (tileentity instanceof TileEntityBeehive) { -@@ -616,6 +619,7 @@ public class EntityBee extends EntityAnimal implements EntityBird { +@@ -581,6 +584,7 @@ public class EntityBee extends EntityAnimal implements IEntityAngerable, EntityB @Override public void c() { diff --git a/Spigot-Server-Patches/0452-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch b/Spigot-Server-Patches/0433-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch similarity index 81% rename from Spigot-Server-Patches/0452-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch rename to Spigot-Server-Patches/0433-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch index e75822ae2..c14b62075 100644 --- a/Spigot-Server-Patches/0452-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch +++ b/Spigot-Server-Patches/0433-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch @@ -7,10 +7,10 @@ Suspected case would be around the technique used in .stopRiding Stack will identify any causer of this and warn instead of crashing. diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 4ba661c5a89bebe29c8802387bc93c10094b7606..6a2cf0c6f649e7a74b58fc292f57a08c0663b0a4 100644 +index b530316b582390c4c464bb1f3df48597c8bf7569..6ac39fc6cafdcbf7883e868ecb58a2ebfad41601 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -1411,6 +1411,14 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1443,6 +1443,14 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { protected void addEntity(Entity entity) { org.spigotmc.AsyncCatcher.catchOp("entity track"); // Spigot @@ -23,13 +23,13 @@ index 4ba661c5a89bebe29c8802387bc93c10094b7606..6a2cf0c6f649e7a74b58fc292f57a08c + } + // Paper end if (!(entity instanceof EntityComplexPart)) { - if (!(entity instanceof EntityLightning)) { - EntityTypes entitytypes = entity.getEntityType(); + EntityTypes entitytypes = entity.getEntityType(); + int i = entitytypes.getChunkRange() * 16; diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 255650fc6adcd81df2ee063209d2098745e45e39..c1e3c5ad7bbadedf01f7bd9162602398b81005a2 100644 +index f21011761ddf3082bc9bb59f1ec6d97e5d98c705..d28985adf70b7a06688ac3113477a681f4b19693 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1463,7 +1463,7 @@ public class WorldServer extends World { +@@ -1352,7 +1352,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { } } @@ -38,7 +38,7 @@ index 255650fc6adcd81df2ee063209d2098745e45e39..c1e3c5ad7bbadedf01f7bd9162602398 // CraftBukkit start - SPIGOT-5278 if (entity instanceof EntityDrowned) { this.navigators.add(((EntityDrowned) entity).navigationWater); -@@ -1474,6 +1474,7 @@ public class WorldServer extends World { +@@ -1363,6 +1363,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { this.navigators.add(((EntityInsentient) entity).getNavigation()); } entity.valid = true; // CraftBukkit diff --git a/Spigot-Server-Patches/0434-Optimize-Collision-to-not-load-chunks.patch b/Spigot-Server-Patches/0434-Optimize-Collision-to-not-load-chunks.patch new file mode 100644 index 000000000..38b00fc9b --- /dev/null +++ b/Spigot-Server-Patches/0434-Optimize-Collision-to-not-load-chunks.patch @@ -0,0 +1,135 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Thu, 2 Apr 2020 02:37:57 -0400 +Subject: [PATCH] Optimize Collision to not load chunks + +The collision code takes an AABB and generates a cuboid of checks rather +than a cylinder, so at high velocity this can generate a lot of chunk checks. + +Treat an unloaded chunk as a collision for entities, and also for players if +the "prevent moving into unloaded chunks" setting is enabled. + +If that serting is not enabled, collisions will be ignored for players, since +movement will load only the chunk the player enters anyways and avoids loading +massive amounts of surrounding chunks due to large AABB lookups. + +diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +index e895bf811ce5d441541725ade48e3f07ca86fc2b..152f613159ef88977de867c0deec94bfa4353f7a 100644 +--- a/src/main/java/net/minecraft/server/Entity.java ++++ b/src/main/java/net/minecraft/server/Entity.java +@@ -80,6 +80,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke + private CraftEntity bukkitEntity; + + PlayerChunkMap.EntityTracker tracker; // Paper ++ boolean collisionLoadChunks = false; // Paper + Throwable addedToWorldStack; // Paper - entity debug + public CraftEntity getBukkitEntity() { + if (bukkitEntity == null) { +diff --git a/src/main/java/net/minecraft/server/ICollisionAccess.java b/src/main/java/net/minecraft/server/ICollisionAccess.java +index b27260270de80de371a5a71fa0516aa43c44c83e..1cc40b1f0af9e617b2a71bcc442543e10b2dc61a 100644 +--- a/src/main/java/net/minecraft/server/ICollisionAccess.java ++++ b/src/main/java/net/minecraft/server/ICollisionAccess.java +@@ -46,7 +46,9 @@ public interface ICollisionAccess extends IBlockAccess { + } + + default boolean b(@Nullable Entity entity, AxisAlignedBB axisalignedbb, Predicate predicate) { ++ try { if (entity != null) entity.collisionLoadChunks = true; // Paper + return this.d(entity, axisalignedbb, predicate).allMatch(VoxelShape::isEmpty); ++ } finally { if (entity != null) entity.collisionLoadChunks = false; } // Paper + } + + Stream c(@Nullable Entity entity, AxisAlignedBB axisalignedbb, Predicate predicate); +diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java +index a047375a231e49485a053903713b6ee5cbc9971f..31f33e8de4b976b6a895568dd55dae35645e9a80 100644 +--- a/src/main/java/net/minecraft/server/PlayerList.java ++++ b/src/main/java/net/minecraft/server/PlayerList.java +@@ -722,6 +722,7 @@ public abstract class PlayerList { + entityplayer1.forceSetPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); + // CraftBukkit end + ++ worldserver.getChunkProvider().addTicket(TicketType.POST_TELEPORT, new ChunkCoordIntPair(location.getBlockX() >> 4, location.getBlockZ() >> 4), 1, entityplayer.getId()); // Paper + while (avoidSuffocation && !worldserver1.getCubes(entityplayer1) && entityplayer1.locY() < 256.0D) { + entityplayer1.setPosition(entityplayer1.locX(), entityplayer1.locY() + 1.0D, entityplayer1.locZ()); + } +diff --git a/src/main/java/net/minecraft/server/VoxelShapeSpliterator.java b/src/main/java/net/minecraft/server/VoxelShapeSpliterator.java +index 4967d1ebd109c462a322e4829d01ff519d1b5366..ed0f3ddbcb7d6ce8a59ae3829f4cb11ae75046cb 100644 +--- a/src/main/java/net/minecraft/server/VoxelShapeSpliterator.java ++++ b/src/main/java/net/minecraft/server/VoxelShapeSpliterator.java +@@ -9,13 +9,13 @@ import javax.annotation.Nullable; + public class VoxelShapeSpliterator extends AbstractSpliterator { + + @Nullable +- private final Entity a; ++ private final Entity a; final Entity getEntity() { return this.a; } // Paper - OBFHELPER + private final AxisAlignedBB b; + private final VoxelShapeCollision c; + private final CursorPosition d; +- private final BlockPosition.MutableBlockPosition e; ++ private final BlockPosition.MutableBlockPosition e; final BlockPosition.MutableBlockPosition getMutablePos() { return this.e; } // Paper - OBFHELPER + private final VoxelShape f; +- private final ICollisionAccess g; ++ private final ICollisionAccess g; final ICollisionAccess getCollisionAccess() { return this.g; } // Paper - OBFHELPER + private boolean h; + private final BiPredicate i; + +@@ -52,23 +52,37 @@ public class VoxelShapeSpliterator extends AbstractSpliterator { + boolean a(Consumer consumer) { + while (true) { + if (this.d.a()) { +- int i = this.d.b(); +- int j = this.d.c(); +- int k = this.d.d(); ++ int i = this.d.b(); final int x = i; ++ int j = this.d.c(); final int y = j; ++ int k = this.d.d(); final int z = k; + int l = this.d.e(); + + if (l == 3) { + continue; + } + +- IBlockAccess iblockaccess = this.a(i, k); +- +- if (iblockaccess == null) { ++ // Paper start - ensure we don't load chunks ++ Entity entity = this.getEntity(); ++ BlockPosition.MutableBlockPosition blockposition_mutableblockposition = this.getMutablePos(); ++ boolean far = entity != null && MCUtil.distanceSq(entity.locX(), y, entity.locZ(), x, y, z) > 14; ++ blockposition_mutableblockposition.setValues(x, y, z); ++ ++ boolean isRegionLimited = this.getCollisionAccess() instanceof RegionLimitedWorldAccess; ++ IBlockData iblockdata = isRegionLimited ? Blocks.VOID_AIR.getBlockData() : ((!far && entity instanceof EntityPlayer) || (entity != null && entity.collisionLoadChunks) ++ ? this.getCollisionAccess().getType(blockposition_mutableblockposition) ++ : this.getCollisionAccess().getTypeIfLoaded(blockposition_mutableblockposition) ++ ); ++ ++ if (iblockdata == null) { ++ if (!(entity instanceof EntityPlayer) || entity.world.paperConfig.preventMovingIntoUnloadedChunks) { ++ VoxelShape voxelshape3 = VoxelShapes.of(far ? entity.getBoundingBox() : new AxisAlignedBB(new BlockPosition(x, y, z))); ++ consumer.accept(voxelshape3); ++ return true; ++ } + continue; + } +- +- this.e.d(i, j, k); +- IBlockData iblockdata = iblockaccess.getType(this.e); ++ // Paper - moved up ++ // Paper end + + if (!this.i.test(iblockdata, this.e) || l == 1 && !iblockdata.d() || l == 2 && !iblockdata.a(Blocks.MOVING_PISTON)) { + continue; +diff --git a/src/main/java/net/minecraft/server/VoxelShapes.java b/src/main/java/net/minecraft/server/VoxelShapes.java +index b6e2a3d8d0cf510f497c6f974356fafaf2adc13b..4acde367542247627574fdeb586fb8c9087eef1a 100644 +--- a/src/main/java/net/minecraft/server/VoxelShapes.java ++++ b/src/main/java/net/minecraft/server/VoxelShapes.java +@@ -239,7 +239,8 @@ public final class VoxelShapes { + + if (k2 < 3) { + blockposition_mutableblockposition.a(enumaxiscycle1, i2, j2, l1); +- IBlockData iblockdata = iworldreader.getType(blockposition_mutableblockposition); ++ IBlockData iblockdata = iworldreader.getTypeIfLoaded(blockposition_mutableblockposition); // Paper ++ if (iblockdata == null) return 0.0D; // Paper + + if ((k2 != 1 || iblockdata.d()) && (k2 != 2 || iblockdata.a(Blocks.MOVING_PISTON))) { + d0 = iblockdata.b((IBlockAccess) iworldreader, blockposition_mutableblockposition, voxelshapecollision).a(enumdirection_enumaxis2, axisalignedbb.d((double) (-blockposition_mutableblockposition.getX()), (double) (-blockposition_mutableblockposition.getY()), (double) (-blockposition_mutableblockposition.getZ())), d0); diff --git a/Spigot-Server-Patches/0454-Don-t-tick-dead-players.patch b/Spigot-Server-Patches/0435-Don-t-tick-dead-players.patch similarity index 60% rename from Spigot-Server-Patches/0454-Don-t-tick-dead-players.patch rename to Spigot-Server-Patches/0435-Don-t-tick-dead-players.patch index 999a01d97..0c8149a78 100644 --- a/Spigot-Server-Patches/0454-Don-t-tick-dead-players.patch +++ b/Spigot-Server-Patches/0435-Don-t-tick-dead-players.patch @@ -7,15 +7,15 @@ Causes sync chunk loads and who knows what all else. This is safe because Spectators are skipped in unloaded chunks too in vanilla. diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 52544730a2cce4db4f912ad1109945ac4e53a9b6..f4215d38acef8018f09dff5f379c14336647687d 100644 +index 7792ce6e94d25021666ef21da790f337d411234e..c6f326787328ff6b2f974d653dc9e7932c3c0205 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -429,7 +429,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -469,7 +469,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public void playerTick() { try { -- if (!this.isSpectator() || this.world.isLoaded(new BlockPosition(this))) { -+ if (valid && (!this.isSpectator() || this.world.isLoaded(new BlockPosition(this)))) { // Paper - don't tick dead players that are not in the world currently (pending respawn) +- if (!this.isSpectator() || this.world.isLoaded(this.getChunkCoordinates())) { ++ if (valid && !this.isSpectator() || this.world.isLoaded(this.getChunkCoordinates())) { // Paper - don't tick dead players that are not in the world currently (pending respawn) super.tick(); } diff --git a/Spigot-Server-Patches/0455-Dead-Player-s-shouldn-t-be-able-to-move.patch b/Spigot-Server-Patches/0436-Dead-Player-s-shouldn-t-be-able-to-move.patch similarity index 84% rename from Spigot-Server-Patches/0455-Dead-Player-s-shouldn-t-be-able-to-move.patch rename to Spigot-Server-Patches/0436-Dead-Player-s-shouldn-t-be-able-to-move.patch index 558141ad3..eb02670fd 100644 --- a/Spigot-Server-Patches/0455-Dead-Player-s-shouldn-t-be-able-to-move.patch +++ b/Spigot-Server-Patches/0436-Dead-Player-s-shouldn-t-be-able-to-move.patch @@ -7,10 +7,10 @@ This fixes a lot of game state issues where packets were delayed for processing due to 1.15's new queue but processed while dead. diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index 61c9e030a105ee78a7e59fbf36cf7a77f87a0e88..c4d433430503e844121f1917c6caf05823af0a34 100644 +index 7916421fe1dd8eadfd1c9bd15c4bbbb7331faca6..22acfe1350eb122b7eaa7209f519e4f4f1469b6c 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -978,7 +978,7 @@ public abstract class EntityHuman extends EntityLiving { +@@ -952,7 +952,7 @@ public abstract class EntityHuman extends EntityLiving { @Override protected boolean isFrozen() { diff --git a/Spigot-Server-Patches/0456-Optimize-PlayerChunkMap-memory-use-for-visibleChunks.patch b/Spigot-Server-Patches/0437-Optimize-PlayerChunkMap-memory-use-for-visibleChunks.patch similarity index 89% rename from Spigot-Server-Patches/0456-Optimize-PlayerChunkMap-memory-use-for-visibleChunks.patch rename to Spigot-Server-Patches/0437-Optimize-PlayerChunkMap-memory-use-for-visibleChunks.patch index 7383da9f4..a23ddfcac 100644 --- a/Spigot-Server-Patches/0456-Optimize-PlayerChunkMap-memory-use-for-visibleChunks.patch +++ b/Spigot-Server-Patches/0437-Optimize-PlayerChunkMap-memory-use-for-visibleChunks.patch @@ -57,23 +57,23 @@ index 0000000000000000000000000000000000000000..f6ff4d8132a95895680f5bc81f8f873e + } +} diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 9e3471be219b5e061486c8a3e4b638a45e6f28f5..9d5275c628b3963befdfa60841ef3c3331c8338c 100644 +index ba9f75bd8f6fe1990d485548f4481bd1762d93af..e14e8bcf235339c1537a1e0a7702a364ee784c93 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -766,7 +766,7 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -756,7 +756,7 @@ public class ChunkProviderServer extends IChunkProvider { entityPlayer.playerNaturallySpawnedEvent.callEvent(); }; // Paper end -- this.playerChunkMap.f().forEach((playerchunk) -> { +- this.playerChunkMap.f().forEach((playerchunk) -> { // Paper - no... just no... + this.playerChunkMap.forEachVisibleChunk((playerchunk) -> { // Paper - safe iterator incase chunk loads, also no wrapping - Optional optional = ((Either) playerchunk.b().getNow(PlayerChunk.UNLOADED_CHUNK)).left(); + Optional optional = ((Either) playerchunk.a().getNow(PlayerChunk.UNLOADED_CHUNK)).left(); if (optional.isPresent()) { diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java -index ea087800eb838371d5da70538091e1148816296e..ce0bf608b71cf492fc31e89a360ecd83fa5c23a6 100644 +index 9615c4d324e42f7f91a7e60b6151c16d20e9c739..a68e4fc411ae84f12b1ca7443fa66f6325712af8 100644 --- a/src/main/java/net/minecraft/server/MCUtil.java +++ b/src/main/java/net/minecraft/server/MCUtil.java -@@ -610,7 +610,7 @@ public final class MCUtil { +@@ -598,7 +598,7 @@ public final class MCUtil { WorldServer world = ((org.bukkit.craftbukkit.CraftWorld)bukkitWorld).getHandle(); PlayerChunkMap chunkMap = world.getChunkProvider().playerChunkMap; @@ -83,10 +83,10 @@ index ea087800eb838371d5da70538091e1148816296e..ce0bf608b71cf492fc31e89a360ecd83 List allChunks = new ArrayList<>(visibleChunks.values()); List players = world.players; diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 6a2cf0c6f649e7a74b58fc292f57a08c0663b0a4..ea6b310e8e4741c8bb301e5bc586faca8bea5e06 100644 +index 6ac39fc6cafdcbf7883e868ecb58a2ebfad41601..bb4d54ebee573964cf3026888da108584b12972f 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -55,8 +55,33 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -56,8 +56,33 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { private static final Logger LOGGER = LogManager.getLogger(); public static final int GOLDEN_TICKET = 33 + ChunkStatus.b(); @@ -124,14 +124,14 @@ index 6a2cf0c6f649e7a74b58fc292f57a08c0663b0a4..ea6b310e8e4741c8bb301e5bc586faca public final WorldServer world; @@ -130,7 +155,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - public PlayerChunkMap(WorldServer worldserver, File file, DataFixer datafixer, DefinedStructureManager definedstructuremanager, Executor executor, IAsyncTaskHandler iasynctaskhandler, ILightAccess ilightaccess, ChunkGenerator chunkgenerator, WorldLoadListener worldloadlistener, Supplier supplier, int i) { - super(new File(worldserver.getWorldProvider().getDimensionManager().a(file), "region"), datafixer); + public PlayerChunkMap(WorldServer worldserver, Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, DefinedStructureManager definedstructuremanager, Executor executor, IAsyncTaskHandler iasynctaskhandler, ILightAccess ilightaccess, ChunkGenerator chunkgenerator, WorldLoadListener worldloadlistener, Supplier supplier, int i, boolean flag) { + super(new File(convertable_conversionsession.a(worldserver.getDimensionKey()), "region"), datafixer, flag); - this.visibleChunks = this.updatingChunks.clone(); + //this.visibleChunks = this.updatingChunks.clone(); // Paper - no more cloning this.pendingUnload = new Long2ObjectLinkedOpenHashMap(); this.loadedChunks = new LongOpenHashSet(); this.unloadQueue = new LongOpenHashSet(); -@@ -221,9 +246,52 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -222,9 +247,52 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { return (PlayerChunk) this.updatingChunks.get(i); } @@ -185,7 +185,7 @@ index 6a2cf0c6f649e7a74b58fc292f57a08c0663b0a4..ea6b310e8e4741c8bb301e5bc586faca } protected IntSupplier c(long i) { -@@ -411,8 +479,9 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -412,8 +480,9 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { // Paper end protected void save(boolean flag) { @@ -196,7 +196,7 @@ index 6a2cf0c6f649e7a74b58fc292f57a08c0663b0a4..ea6b310e8e4741c8bb301e5bc586faca MutableBoolean mutableboolean = new MutableBoolean(); do { -@@ -440,7 +509,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -441,7 +510,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { // this.i(); // Paper - nuke IOWorker PlayerChunkMap.LOGGER.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", this.w.getName()); } else { @@ -205,7 +205,7 @@ index 6a2cf0c6f649e7a74b58fc292f57a08c0663b0a4..ea6b310e8e4741c8bb301e5bc586faca IChunkAccess ichunkaccess = (IChunkAccess) playerchunk.getChunkSave().getNow(null); // CraftBukkit - decompile error if (ichunkaccess instanceof ProtoChunkExtension || ichunkaccess instanceof Chunk) { -@@ -611,7 +680,20 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -612,7 +681,20 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { if (!this.updatingChunksModified) { return false; } else { @@ -227,7 +227,7 @@ index 6a2cf0c6f649e7a74b58fc292f57a08c0663b0a4..ea6b310e8e4741c8bb301e5bc586faca this.updatingChunksModified = false; return true; } -@@ -1048,12 +1130,12 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1081,12 +1163,12 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } protected Iterable f() { @@ -243,10 +243,10 @@ index 6a2cf0c6f649e7a74b58fc292f57a08c0663b0a4..ea6b310e8e4741c8bb301e5bc586faca while (objectbidirectionaliterator.hasNext()) { Entry entry = (Entry) objectbidirectionaliterator.next(); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index c030ff7b34fdd4c4632714a800935a6a5f8082cb..1929aacbe83c401c7254484aa8df62ed1554e3ba 100644 +index 080f600008ce1cba12c2bfe07e014e8adb7b7b2b..3ec021746ffaea89f09126538fcaa0555872ac17 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -74,6 +74,7 @@ import net.minecraft.server.GameRules; +@@ -73,6 +73,7 @@ import net.minecraft.server.GameRules; import net.minecraft.server.GroupDataEntity; import net.minecraft.server.IBlockData; import net.minecraft.server.IChunkAccess; @@ -254,7 +254,7 @@ index c030ff7b34fdd4c4632714a800935a6a5f8082cb..1929aacbe83c401c7254484aa8df62ed import net.minecraft.server.MinecraftKey; import net.minecraft.server.MinecraftServer; import net.minecraft.server.MovingObjectPosition; -@@ -291,6 +292,7 @@ public class CraftWorld implements World { +@@ -294,6 +295,7 @@ public class CraftWorld implements World { return ret; } public int getTileEntityCount() { @@ -262,7 +262,7 @@ index c030ff7b34fdd4c4632714a800935a6a5f8082cb..1929aacbe83c401c7254484aa8df62ed // We don't use the full world tile entity list, so we must iterate chunks Long2ObjectLinkedOpenHashMap chunks = world.getChunkProvider().playerChunkMap.visibleChunks; int size = 0; -@@ -302,11 +304,13 @@ public class CraftWorld implements World { +@@ -305,11 +307,13 @@ public class CraftWorld implements World { size += chunk.tileEntities.size(); } return size; @@ -276,7 +276,7 @@ index c030ff7b34fdd4c4632714a800935a6a5f8082cb..1929aacbe83c401c7254484aa8df62ed int ret = 0; for (PlayerChunk chunkHolder : world.getChunkProvider().playerChunkMap.visibleChunks.values()) { -@@ -315,7 +319,7 @@ public class CraftWorld implements World { +@@ -318,7 +322,7 @@ public class CraftWorld implements World { } } @@ -285,7 +285,7 @@ index c030ff7b34fdd4c4632714a800935a6a5f8082cb..1929aacbe83c401c7254484aa8df62ed } public int getPlayerCount() { return world.players.size(); -@@ -435,6 +439,14 @@ public class CraftWorld implements World { +@@ -438,6 +442,14 @@ public class CraftWorld implements World { @Override public Chunk[] getLoadedChunks() { diff --git a/Spigot-Server-Patches/0457-Increase-Light-Queue-Size.patch b/Spigot-Server-Patches/0438-Increase-Light-Queue-Size.patch similarity index 83% rename from Spigot-Server-Patches/0457-Increase-Light-Queue-Size.patch rename to Spigot-Server-Patches/0438-Increase-Light-Queue-Size.patch index 7ad92c02d..2890f58e7 100644 --- a/Spigot-Server-Patches/0457-Increase-Light-Queue-Size.patch +++ b/Spigot-Server-Patches/0438-Increase-Light-Queue-Size.patch @@ -14,10 +14,10 @@ light engine on shutdown... The queue size only puts a cap on max loss, doesn't solve that problem. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 598f27bc1b95132ded224dd5c7a0e2639ab2bd12..ea5f306ef57fe5958a554f4bdf866a36d2b185e0 100644 +index b987399ca3786a30f87c98658e8bf04d4aa2e2da..08949526752e4d66e4c0df11f76f6500846e1fe4 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -665,4 +665,9 @@ public class PaperWorldConfig { +@@ -617,4 +617,9 @@ public class PaperWorldConfig { private void zombieVillagerInfectionChance() { zombieVillagerInfectionChance = getDouble("zombie-villager-infection-chance", zombieVillagerInfectionChance); } @@ -28,15 +28,15 @@ index 598f27bc1b95132ded224dd5c7a0e2639ab2bd12..ea5f306ef57fe5958a554f4bdf866a36 + } } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 234c6f1854d4a491f6233fbd4677719a0503d3a1..508aa4866e47f3865a8c51f7c8e3b842be216923 100644 +index 99b6a4d277816699a5abd9ec889535c064758e97..0d91765cb6386c9483a6b5494e37bd7806638928 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -637,7 +637,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant -Date: Fri, 21 Feb 2020 18:44:28 +0000 -Subject: [PATCH] Backport fix for MC-167561 - - -diff --git a/src/main/java/net/minecraft/server/EntityWolf.java b/src/main/java/net/minecraft/server/EntityWolf.java -index db15d5e0a23c414742ac73785d29aeadd432d3d7..eec1e26b6eba07c31d251ecf69dc36199688110e 100644 ---- a/src/main/java/net/minecraft/server/EntityWolf.java -+++ b/src/main/java/net/minecraft/server/EntityWolf.java -@@ -296,7 +296,14 @@ public class EntityWolf extends EntityTameableAnimal { - boolean flag = super.a(entityhuman, enumhand); - - if (!flag || this.isBaby()) { -- this.goalSit.setSitting(!this.isSitting()); -+ //this.goalSit.setSitting(!this.isSitting()); // Paper start - copied from below -+ if (this.i((EntityLiving) entityhuman) && !this.i(itemstack)) { -+ this.goalSit.setSitting(!this.isSitting()); -+ this.jumping = false; -+ this.navigation.o(); -+ this.setGoalTarget((EntityLiving) null, TargetReason.FORGOT_TARGET, true); // CraftBukkit - reason -+ } -+ // Paper end - copied from below - } - - return flag; -@@ -313,12 +320,14 @@ public class EntityWolf extends EntityTameableAnimal { - return true; - } - -+ /* Paper start - Move into above - if (this.i((EntityLiving) entityhuman) && !this.i(itemstack)) { - this.goalSit.setSitting(!this.isSitting()); - this.jumping = false; - this.navigation.o(); - this.setGoalTarget((EntityLiving) null, TargetReason.FORGOT_TARGET, true); // CraftBukkit - reason - } -+ */ // Paper end - } else if (item == Items.BONE && !this.isAngry()) { - if (!entityhuman.abilities.canInstantlyBuild) { - itemstack.subtract(1); diff --git a/Spigot-Server-Patches/0458-Mid-Tick-Chunk-Tasks-Speed-up-processing-of-chunk-lo.patch b/Spigot-Server-Patches/0439-Mid-Tick-Chunk-Tasks-Speed-up-processing-of-chunk-lo.patch similarity index 79% rename from Spigot-Server-Patches/0458-Mid-Tick-Chunk-Tasks-Speed-up-processing-of-chunk-lo.patch rename to Spigot-Server-Patches/0439-Mid-Tick-Chunk-Tasks-Speed-up-processing-of-chunk-lo.patch index 8f9ba37c0..c05dc01ab 100644 --- a/Spigot-Server-Patches/0458-Mid-Tick-Chunk-Tasks-Speed-up-processing-of-chunk-lo.patch +++ b/Spigot-Server-Patches/0439-Mid-Tick-Chunk-Tasks-Speed-up-processing-of-chunk-lo.patch @@ -42,10 +42,10 @@ index a58ef60d9976b3afc50e94364cf474bd2e5fdfd6..dd07223978c9aa648673d96ba7b3db11 public static final Timing commandFunctionsTimer = Timings.ofSafe("Command Functions"); public static final Timing connectionTimer = Timings.ofSafe("Connection Handler"); diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index f1b41e16c8ce8323a896339c5d822f8ff7d8f7e6..f8f225e18fa38cad917f52a379233e0a7a869b07 100644 +index 8508b3e10e60a4ce36d471b1d3f7ffc836a6ddf7..aad1420dc63c16b558ad1ca34accf8a7a9af6363 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -425,4 +425,9 @@ public class PaperConfig { +@@ -405,4 +405,9 @@ public class PaperConfig { log("Async Chunks: Enabled - Chunks will be loaded much faster, without lag."); } } @@ -56,10 +56,10 @@ index f1b41e16c8ce8323a896339c5d822f8ff7d8f7e6..f8f225e18fa38cad917f52a379233e0a + } } diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 9d5275c628b3963befdfa60841ef3c3331c8338c..b6146330a55665a0365ff7474f1843766e0c0ce1 100644 +index e14e8bcf235339c1537a1e0a7702a364ee784c93..d1f832db33f21f8ba910d2c0c163af78718d298f 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -699,6 +699,7 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -694,6 +694,7 @@ public class ChunkProviderServer extends IChunkProvider { this.world.getMethodProfiler().enter("purge"); this.world.timings.doChunkMap.startTiming(); // Spigot this.chunkMapDistance.purgeTickets(); @@ -67,7 +67,7 @@ index 9d5275c628b3963befdfa60841ef3c3331c8338c..b6146330a55665a0365ff7474f184376 this.tickDistanceManager(); this.world.timings.doChunkMap.stopTiming(); // Spigot this.world.getMethodProfiler().exitEnter("chunks"); -@@ -708,6 +709,7 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -703,6 +704,7 @@ public class ChunkProviderServer extends IChunkProvider { this.world.timings.doChunkUnload.startTiming(); // Spigot this.world.getMethodProfiler().exitEnter("unload"); this.playerChunkMap.unloadChunks(booleansupplier); @@ -75,24 +75,24 @@ index 9d5275c628b3963befdfa60841ef3c3331c8338c..b6146330a55665a0365ff7474f184376 this.world.timings.doChunkUnload.stopTiming(); // Spigot this.world.getMethodProfiler().exit(); this.clearCache(); -@@ -766,7 +768,7 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -756,7 +758,7 @@ public class ChunkProviderServer extends IChunkProvider { entityPlayer.playerNaturallySpawnedEvent.callEvent(); }; // Paper end - this.playerChunkMap.forEachVisibleChunk((playerchunk) -> { // Paper - safe iterator incase chunk loads, also no wrapping + final int[] chunksTicked = {0}; this.playerChunkMap.forEachVisibleChunk((playerchunk) -> { // Paper - safe iterator incase chunk loads, also no wrapping - Optional optional = ((Either) playerchunk.b().getNow(PlayerChunk.UNLOADED_CHUNK)).left(); + Optional optional = ((Either) playerchunk.a().getNow(PlayerChunk.UNLOADED_CHUNK)).left(); if (optional.isPresent()) { -@@ -849,6 +851,7 @@ public class ChunkProviderServer extends IChunkProvider { - this.world.timings.chunkTicks.startTiming(); // Spigot // Paper - this.world.a(chunk, k); - this.world.timings.chunkTicks.stopTiming(); // Spigot // Paper -+ if (chunksTicked[0]++ % 10 == 0) this.world.getMinecraftServer().midTickLoadChunks(); // Paper +@@ -780,6 +782,7 @@ public class ChunkProviderServer extends IChunkProvider { + this.world.timings.chunkTicks.startTiming(); // Spigot // Paper + this.world.a(chunk, k); + this.world.timings.chunkTicks.stopTiming(); // Spigot // Paper ++ if (chunksTicked[0]++ % 10 == 0) this.world.getMinecraftServer().midTickLoadChunks(); // Paper + } } } - }); -@@ -990,6 +993,41 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -936,6 +939,41 @@ public class ChunkProviderServer extends IChunkProvider { super.executeTask(runnable); } @@ -135,10 +135,10 @@ index 9d5275c628b3963befdfa60841ef3c3331c8338c..b6146330a55665a0365ff7474f184376 protected boolean executeNext() { // CraftBukkit start - process pending Chunk loadCallback() and unloadCallback() after each run task diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 508aa4866e47f3865a8c51f7c8e3b842be216923..11349565e71d97384d3dcab9cdf6ea168c6d2f4f 100644 +index 0d91765cb6386c9483a6b5494e37bd7806638928..5b6f3d811ff55d0c6d55bddc7707ef878baff782 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -910,6 +910,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant { @@ -187,7 +187,7 @@ index 508aa4866e47f3865a8c51f7c8e3b842be216923..11349565e71d97384d3dcab9cdf6ea16 return !this.canOversleep(); }); isOversleep = false;MinecraftTimings.serverOversleep.stopTiming(); -@@ -1178,13 +1197,16 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant(this); // Paper -@@ -162,6 +162,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -168,6 +168,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } // CraftBukkit end -+ public void moveToSpawn(WorldServer worldserver) { a(worldserver); } // Paper - OBFHELPER - private void a(WorldServer worldserver) { ++ public final void moveToSpawn(WorldServer worldserver) { b(worldserver); } // Paper - OBFHELPER + private void b(WorldServer worldserver) { BlockPosition blockposition = worldserver.getSpawn(); -@@ -302,7 +303,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - position = new Vec3D(world.getSpawn()); +@@ -343,7 +344,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + position = Vec3D.a(((WorldServer) world).getSpawn()); } this.world = world; - this.setPosition(position.getX(), position.getY(), position.getZ()); + this.setPositionRaw(position.getX(), position.getY(), position.getZ()); // Paper - don't register to chunks yet } - this.dimension = ((WorldServer) this.world).getWorldProvider().getDimensionManager(); this.playerInteractManager.a((WorldServer) world); + } diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 157738f452493aabdefb228cd527ba85400baad5..611dea90200fe346915d66317e21d94154381e97 100644 +index 31f33e8de4b976b6a895568dd55dae35645e9a80..502f4b93e04c78f4681459abfb160c6fc2279c72 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -108,6 +108,7 @@ public abstract class PlayerList { - NBTTagCompound bukkit = nbttagcompound.getCompound("bukkit"); - s = bukkit.hasKeyOfType("lastKnownName", 8) ? bukkit.getString("lastKnownName") : s; +@@ -134,6 +134,8 @@ public abstract class PlayerList { + worldserver1 = worldserver; } -+ if (nbttagcompound == null) entityplayer.moveToSpawn(worldserver); // Paper - only move to spawn on first login, otherwise, stay where you are.... - // CraftBukkit end - entityplayer.spawnIn(worldserver); ++ if (nbttagcompound == null) entityplayer.moveToSpawn(worldserver1); // Paper - only move to spawn on first login, otherwise, stay where you are.... ++ + entityplayer.spawnIn(worldserver1); + entityplayer.playerInteractManager.a((WorldServer) entityplayer.world); + String s1 = "local"; diff --git a/Spigot-Server-Patches/0460-Add-tick-times-API-and-mspt-command.patch b/Spigot-Server-Patches/0441-Add-tick-times-API-and-mspt-command.patch similarity index 86% rename from Spigot-Server-Patches/0460-Add-tick-times-API-and-mspt-command.patch rename to Spigot-Server-Patches/0441-Add-tick-times-API-and-mspt-command.patch index 1d28a9ba7..73ee96c42 100644 --- a/Spigot-Server-Patches/0460-Add-tick-times-API-and-mspt-command.patch +++ b/Spigot-Server-Patches/0441-Add-tick-times-API-and-mspt-command.patch @@ -75,10 +75,10 @@ index 0000000000000000000000000000000000000000..d0211d4f39f9d6af1d751ac66342b42c + } +} diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index f8f225e18fa38cad917f52a379233e0a7a869b07..3ee7e5671dd2519cec72b81211f1f39176a228ba 100644 +index aad1420dc63c16b558ad1ca34accf8a7a9af6363..ac01d492872fde6df2b7113005457c714b91fe44 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -70,6 +70,7 @@ public class PaperConfig { +@@ -69,6 +69,7 @@ public class PaperConfig { commands = new HashMap(); commands.put("paper", new PaperCommand("paper")); @@ -87,23 +87,23 @@ index f8f225e18fa38cad917f52a379233e0a7a869b07..3ee7e5671dd2519cec72b81211f1f391 version = getInt("config-version", 20); set("config-version", 20); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 11349565e71d97384d3dcab9cdf6ea168c6d2f4f..a0e33d42a158defc8b4a72de5d01b9395dca42eb 100644 +index 5b6f3d811ff55d0c6d55bddc7707ef878baff782..04eb2af28f9843ef7641f5464d2a043c696de864 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -106,6 +106,11 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant c = new EnumMap(PathfinderGoal.Type.class); - private final Set d = Sets.newLinkedHashSet();private Set getTasks() { return d; }// Paper - OBFHELPER - private final GameProfilerFiller e; + private final Set d = Sets.newLinkedHashSet(); private Set getTasks() { return d; }// Paper - OBFHELPER + private final Supplier e; - private final EnumSet f = EnumSet.noneOf(PathfinderGoal.Type.class); + private final EnumSet f = EnumSet.noneOf(PathfinderGoal.Type.class); // Paper unused, but dummy to prevent plugins from crashing as hard. Theyll need to support paper in a special case if this is super important, but really doesn't seem like it would be. + private final OptimizedSmallEnumSet goalTypes = new OptimizedSmallEnumSet<>(PathfinderGoal.Type.class); // Paper - remove streams from pathfindergoalselector private int g = 3;private int getTickRate() { return g; } // Paper - OBFHELPER private int curRate;private int getCurRate() { return curRate; } private void incRate() { this.curRate++; } // Paper TODO -@@ -58,33 +61,36 @@ public class PathfinderGoalSelector { +@@ -59,35 +62,38 @@ public class PathfinderGoalSelector { // Paper end public void a(PathfinderGoal pathfindergoal) { @@ -104,8 +104,10 @@ index 935136771e776fe498f608a159a41393340adc4e..84d2abbcb90eb09a19fa0922cfc053c7 + private static final PathfinderGoal.Type[] PATHFINDER_GOAL_TYPES = PathfinderGoal.Type.values(); // Paper - remove streams from pathfindergoalselector + public void doTick() { - this.e.enter("goalCleanup"); -- this.c().filter((pathfindergoalwrapped) -> { + GameProfilerFiller gameprofilerfiller = (GameProfilerFiller) this.e.get(); + + gameprofilerfiller.enter("goalCleanup"); +- this.d().filter((pathfindergoalwrapped) -> { - boolean flag; - - if (pathfindergoalwrapped.g()) { @@ -136,10 +138,10 @@ index 935136771e776fe498f608a159a41393340adc4e..84d2abbcb90eb09a19fa0922cfc053c7 this.c.forEach((pathfindergoal_type, pathfindergoalwrapped) -> { if (!pathfindergoalwrapped.g()) { this.c.remove(pathfindergoal_type); -@@ -93,30 +99,58 @@ public class PathfinderGoalSelector { +@@ -96,30 +102,58 @@ public class PathfinderGoalSelector { }); - this.e.exit(); - this.e.enter("goalUpdate"); + gameprofilerfiller.exit(); + gameprofilerfiller.enter("goalUpdate"); - this.d.stream().filter((pathfindergoalwrapped) -> { - return !pathfindergoalwrapped.g(); - }).filter((pathfindergoalwrapped) -> { @@ -203,9 +205,9 @@ index 935136771e776fe498f608a159a41393340adc4e..84d2abbcb90eb09a19fa0922cfc053c7 + wrappedGoal.c(); + } + // Paper end - remove streams from pathfindergoalselector - this.e.exit(); - this.e.enter("goalTick"); -- this.c().forEach(PathfinderGoalWrapped::e); + gameprofilerfiller.exit(); + gameprofilerfiller.enter("goalTick"); +- this.d().forEach(PathfinderGoalWrapped::e); + // Paper start - remove streams from pathfindergoalselector + for (Iterator iterator = this.d.iterator(); iterator.hasNext();) { + PathfinderGoalWrapped wrappedGoal = iterator.next(); @@ -214,10 +216,10 @@ index 935136771e776fe498f608a159a41393340adc4e..84d2abbcb90eb09a19fa0922cfc053c7 + } + } + // Paper end - remove streams from pathfindergoalselector - this.e.exit(); + gameprofilerfiller.exit(); } -@@ -125,11 +159,11 @@ public class PathfinderGoalSelector { +@@ -128,11 +162,11 @@ public class PathfinderGoalSelector { } public void a(PathfinderGoal.Type pathfindergoal_type) { @@ -232,7 +234,7 @@ index 935136771e776fe498f608a159a41393340adc4e..84d2abbcb90eb09a19fa0922cfc053c7 public void a(PathfinderGoal.Type pathfindergoal_type, boolean flag) { diff --git a/src/main/java/net/minecraft/server/PathfinderGoalWrapped.java b/src/main/java/net/minecraft/server/PathfinderGoalWrapped.java -index 29657fed75184aee0c89e56f5e642a5d68eda444..1b800c558f0988ffc0270b86d1a59ea3bb245116 100644 +index 04b28555b1bb68536e40bb652613678775337b31..96f4401044cacf88e8e00b5b18821c105e634fba 100644 --- a/src/main/java/net/minecraft/server/PathfinderGoalWrapped.java +++ b/src/main/java/net/minecraft/server/PathfinderGoalWrapped.java @@ -59,9 +59,10 @@ public class PathfinderGoalWrapped extends PathfinderGoal { diff --git a/Spigot-Server-Patches/0464-Delay-unsafe-actions-until-after-entity-ticking-is-d.patch b/Spigot-Server-Patches/0445-Delay-unsafe-actions-until-after-entity-ticking-is-d.patch similarity index 78% rename from Spigot-Server-Patches/0464-Delay-unsafe-actions-until-after-entity-ticking-is-d.patch rename to Spigot-Server-Patches/0445-Delay-unsafe-actions-until-after-entity-ticking-is-d.patch index 0bd387f30..6a83f1139 100644 --- a/Spigot-Server-Patches/0464-Delay-unsafe-actions-until-after-entity-ticking-is-d.patch +++ b/Spigot-Server-Patches/0445-Delay-unsafe-actions-until-after-entity-ticking-is-d.patch @@ -6,12 +6,12 @@ Subject: [PATCH] Delay unsafe actions until after entity ticking is done This will help prevent many cases of unregistering entities during entity ticking diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 69e6614049e490dc70baf745761c62b173cf693e..aaf85a1497de98522e3a01d4f81a267c4b0cc087 100644 +index 894c3230cf61403beec29a60a9e69a3719c5870c..e99e47b0844bb33560c7c6fcf7712656e9d8cdb4 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -60,6 +60,16 @@ public class WorldServer extends World { - private final Queue entitiesToAdd = Queues.newArrayDeque(); +@@ -61,6 +61,16 @@ public class WorldServer extends World implements GeneratorAccessSeed { public final List players = Lists.newArrayList(); // Paper - private -> public + public final ChunkProviderServer chunkProvider; // Paper - public boolean tickingEntities; + // Paper start + List afterEntityTickingTasks = Lists.newArrayList(); @@ -24,9 +24,9 @@ index 69e6614049e490dc70baf745761c62b173cf693e..aaf85a1497de98522e3a01d4f81a267c + } + // Paper end private final MinecraftServer server; - private final WorldNBTStorage dataManager; + public final WorldDataServer worldDataServer; // CraftBukkit - type public boolean savingDisabled; -@@ -531,6 +541,16 @@ public class WorldServer extends World { +@@ -529,6 +539,16 @@ public class WorldServer extends World implements GeneratorAccessSeed { timings.entityTick.stopTiming(); // Spigot this.tickingEntities = false; @@ -42,4 +42,4 @@ index 69e6614049e490dc70baf745761c62b173cf693e..aaf85a1497de98522e3a01d4f81a267c + // Paper end this.getMinecraftServer().midTickLoadChunks(); // Paper - try (co.aikar.timings.Timing ignored = this.timings.newEntities.startTiming()) { // Paper - timings + Entity entity2; diff --git a/Spigot-Server-Patches/0465-Async-command-map-building.patch b/Spigot-Server-Patches/0446-Async-command-map-building.patch similarity index 90% rename from Spigot-Server-Patches/0465-Async-command-map-building.patch rename to Spigot-Server-Patches/0446-Async-command-map-building.patch index 2d3efaa3a..953f41863 100644 --- a/Spigot-Server-Patches/0465-Async-command-map-building.patch +++ b/Spigot-Server-Patches/0446-Async-command-map-building.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Async command map building diff --git a/src/main/java/net/minecraft/server/CommandDispatcher.java b/src/main/java/net/minecraft/server/CommandDispatcher.java -index 37b1a7947c2d5ce954d83f599453db86ca1eb131..2414b0a552e5d6fb449bca163add7a9bac39e943 100644 +index e6030512dbbfac3c2ab29e20562ad666f7608295..1229aaf19de60f1e3ce161b5c3b7ef659d14c018 100644 --- a/src/main/java/net/minecraft/server/CommandDispatcher.java +++ b/src/main/java/net/minecraft/server/CommandDispatcher.java -@@ -241,6 +241,14 @@ public class CommandDispatcher { +@@ -242,6 +242,14 @@ public class CommandDispatcher { if ( org.spigotmc.SpigotConfig.tabComplete < 0 ) return; // Spigot // CraftBukkit start // Register Vanilla commands into builtRoot as before @@ -23,7 +23,7 @@ index 37b1a7947c2d5ce954d83f599453db86ca1eb131..2414b0a552e5d6fb449bca163add7a9b Map, CommandNode> map = Maps.newIdentityHashMap(); // Use identity to prevent aliasing issues RootCommandNode vanillaRoot = new RootCommandNode(); -@@ -258,7 +266,14 @@ public class CommandDispatcher { +@@ -259,7 +267,14 @@ public class CommandDispatcher { for (CommandNode node : rootcommandnode.getChildren()) { bukkit.add(node.getName()); } diff --git a/Spigot-Server-Patches/0466-Improved-Watchdog-Support.patch b/Spigot-Server-Patches/0447-Improved-Watchdog-Support.patch similarity index 86% rename from Spigot-Server-Patches/0466-Improved-Watchdog-Support.patch rename to Spigot-Server-Patches/0447-Improved-Watchdog-Support.patch index 20a2c9e38..0c1ba4bd4 100644 --- a/Spigot-Server-Patches/0466-Improved-Watchdog-Support.patch +++ b/Spigot-Server-Patches/0447-Improved-Watchdog-Support.patch @@ -55,7 +55,7 @@ index e257d6b36e0e78dac5b8320017d92776171e1bb0..24641501aeae0f2c2c5ce877775c7b97 } }, 1000 * 60 * 5, 1000 * 60 * 30); diff --git a/src/main/java/net/minecraft/server/CrashReport.java b/src/main/java/net/minecraft/server/CrashReport.java -index 3de19c998b749ccf74958c2412a8c9506457383e..c7dc8787cc3456c5540d6a00a6ff051533edc25a 100644 +index 95e6a6de7ccfc4445d0ac19c5f874c0d533b1712..cc6e6f245ee5e73bd570cf42381bf55ee0b364d3 100644 --- a/src/main/java/net/minecraft/server/CrashReport.java +++ b/src/main/java/net/minecraft/server/CrashReport.java @@ -257,6 +257,7 @@ public class CrashReport { @@ -67,19 +67,19 @@ index 3de19c998b749ccf74958c2412a8c9506457383e..c7dc8787cc3456c5540d6a00a6ff0515 throwable = throwable.getCause(); } diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index 1ef7890da599d13e784861035e7891efcc4cd504..32cd645abb236b355f4f4f0f810e56342ee6cc06 100644 +index 87753a94792af94454f76a2beb1ab9f1027f514f..4c561181a977fd0244325880bb6a8cd6a54dcacc 100644 --- a/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java -@@ -299,7 +299,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - long l = SystemUtils.getMonotonicNanos() - i; - String s2 = String.format(Locale.ROOT, "%.3fs", (double) l / 1.0E9D); +@@ -242,7 +242,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer + long j = SystemUtils.getMonotonicNanos() - i; + String s = String.format(Locale.ROOT, "%.3fs", (double) j / 1.0E9D); -- DedicatedServer.LOGGER.info("Done ({})! For help, type \"help\"", s2); -+ //DedicatedServer.LOGGER.info("Done ({})! For help, type \"help\"", s2); // Paper moved to after init +- DedicatedServer.LOGGER.info("Done ({})! For help, type \"help\"", s); ++ //DedicatedServer.LOGGER.info("Done ({})! For help, type \"help\"", s); // Paper moved to after init if (dedicatedserverproperties.announcePlayerAchievements != null) { ((GameRules.GameRuleBoolean) this.getGameRules().get(GameRules.ANNOUNCE_ADVANCEMENTS)).a(dedicatedserverproperties.announcePlayerAchievements, (MinecraftServer) this); } -@@ -422,6 +422,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer +@@ -368,6 +368,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer //this.remoteStatusListener.b(); // Paper - don't wait for remote connections } @@ -87,17 +87,17 @@ index 1ef7890da599d13e784861035e7891efcc4cd504..32cd645abb236b355f4f4f0f810e5634 System.exit(0); // CraftBukkit } -@@ -750,7 +751,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer +@@ -696,7 +697,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer @Override public void stop() { super.stop(); -- SystemUtils.f(); -+ //SystemUtils.f(); // Paper - moved into super +- SystemUtils.h(); ++ //SystemUtils.h(); // Paper - moved into super } @Override diff --git a/src/main/java/net/minecraft/server/IAsyncTaskHandler.java b/src/main/java/net/minecraft/server/IAsyncTaskHandler.java -index cfe43e882e524b6ab3d9702e81269c97e6b75eba..2632c7c3ec77918be7979f2aa49209e566cafc77 100644 +index 63fdae15ccbef0c39718b320dbd096794bcfa3b4..6beefff203ed6e448898eb5b2e95800def868381 100644 --- a/src/main/java/net/minecraft/server/IAsyncTaskHandler.java +++ b/src/main/java/net/minecraft/server/IAsyncTaskHandler.java @@ -135,6 +135,7 @@ public abstract class IAsyncTaskHandler implements Mailbox resourcePackRepository; - @Nullable - private ResourcePackSourceFolder resourcePackFolder; -+ public volatile Thread shutdownThread; // Paper - public CommandDispatcher commandDispatcher; - private final CraftingManager craftingManager; - private final TagRegistry tagRegistry; -@@ -176,7 +177,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant S a(Function function) { + AtomicReference atomicreference = new AtomicReference(); + Thread thread = new Thread(() -> { +@@ -737,6 +739,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant { CompletableFuture completablefuture; diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 80f1c41062de9251343c3d9be4e076315cdbf88d..4d4912a38ad0bf38a42ac8fed0ad4c1eecaf63a5 100644 +index 502f4b93e04c78f4681459abfb160c6fc2279c72..bbe41a108b424abd3b3acfdfee4d368467a2c52e 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -400,7 +400,7 @@ public abstract class PlayerList { +@@ -429,7 +429,7 @@ public abstract class PlayerList { cserver.getPluginManager().callEvent(playerQuitEvent); entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage()); @@ -285,22 +296,22 @@ index 80f1c41062de9251343c3d9be4e076315cdbf88d..4d4912a38ad0bf38a42ac8fed0ad4c1e // Paper start - Remove from collideRule team if needed diff --git a/src/main/java/net/minecraft/server/SystemUtils.java b/src/main/java/net/minecraft/server/SystemUtils.java -index 20d803ad68ea65fd725d6eb3317b998c1692a7b3..aa399e7f6518ff70f2214161319170b1fc911751 100644 +index 5579044782f155f587de1e2ea5115bde6053f722..e8075ad6b5395c7dce12741fe85dafd13f72cf41 100644 --- a/src/main/java/net/minecraft/server/SystemUtils.java +++ b/src/main/java/net/minecraft/server/SystemUtils.java -@@ -112,6 +112,7 @@ public class SystemUtils { - return SystemUtils.c; +@@ -119,6 +119,7 @@ public class SystemUtils { + return SystemUtils.f; } -+ public static void shutdownServerThreadPool() { f(); } // Paper - OBFHELPER - public static void f() { - SystemUtils.c.shutdown(); - ++ public static void shutdownServerThreadPool() { h(); } // Paper - OBFHELPER + public static void h() { + a(SystemUtils.e); + a(SystemUtils.f); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index a52d8a27cee6721c32444d9d2bd81135b7d4b859..bdd0908adb7d3cd5370b43be196c975e6c48a70f 100644 +index 93df6a29035bb3cc96409b145a2e1433d38bbe99..418ba04a837ee2b17cc679edd35ba09830c01f28 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -793,6 +793,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -846,6 +846,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { gameprofilerfiller.exit(); } catch (Throwable throwable) { @@ -308,7 +319,7 @@ index a52d8a27cee6721c32444d9d2bd81135b7d4b859..bdd0908adb7d3cd5370b43be196c975e // Paper start - Prevent tile entity and entity crashes String msg = "TileEntity threw exception at " + tileentity.world.getWorld().getName() + ":" + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ(); System.err.println(msg); -@@ -868,6 +869,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -921,6 +922,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { try { consumer.accept(entity); } catch (Throwable throwable) { @@ -317,10 +328,10 @@ index a52d8a27cee6721c32444d9d2bd81135b7d4b859..bdd0908adb7d3cd5370b43be196c975e String msg = "Entity threw exception at " + entity.world.getWorld().getName() + ":" + entity.locX() + "," + entity.locY() + "," + entity.locZ(); System.err.println(msg); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index b627180729a24a83ca383f83aee53133ea1b398e..f49193d9d7cd9655fdedf64bebdcf4e1a9b77f2c 100644 +index f7e1f50c672705802b1ee9e2413211882ad21b97..7981f23d043142615a6a0043ba748b22532ded22 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1706,7 +1706,7 @@ public final class CraftServer implements Server { +@@ -1785,7 +1785,7 @@ public final class CraftServer implements Server { @Override public boolean isPrimaryThread() { @@ -330,7 +341,7 @@ index b627180729a24a83ca383f83aee53133ea1b398e..f49193d9d7cd9655fdedf64bebdcf4e1 @Override diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index d3463abe89f6e730373cef5e3ac8c0911d0b0963..e913d249d850210c9efba1bb46ce2ce4df013a62 100644 +index 5ec16547a20271074d034f7fbcb43e86cb1597e6..3e4454a14fdf6305b262c15cf67203854debef28 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -150,6 +150,37 @@ public class Main { @@ -371,7 +382,7 @@ index d3463abe89f6e730373cef5e3ac8c0911d0b0963..e913d249d850210c9efba1bb46ce2ce4 try { options = parser.parse(args); } catch (joptsimple.OptionException ex) { -@@ -245,8 +276,61 @@ public class Main { +@@ -245,8 +276,63 @@ public class Main { } catch (Throwable t) { t.printStackTrace(); } @@ -411,9 +422,11 @@ index d3463abe89f6e730373cef5e3ac8c0911d0b0963..e913d249d850210c9efba1bb46ce2ce4 + tryPreloadClass("org.slf4j.helpers.BasicMarker"); + tryPreloadClass("org.slf4j.helpers.Util"); + tryPreloadClass("com.destroystokyo.paper.event.player.PlayerConnectionCloseEvent"); ++ tryPreloadClass("com.destroystokyo.paper.event.entity.EntityRemoveFromWorldEvent"); + // Minecraft, seen during saving + tryPreloadClass("net.minecraft.server.LightEngineLayerEventListener$Void"); + tryPreloadClass("net.minecraft.server.LightEngineLayerEventListener"); ++ tryPreloadClass("net.minecraft.server.ExceptionSuppressor"); + // Paper end + } + } diff --git a/Spigot-Server-Patches/0467-Optimize-Pathfinding.patch b/Spigot-Server-Patches/0448-Optimize-Pathfinding.patch similarity index 91% rename from Spigot-Server-Patches/0467-Optimize-Pathfinding.patch rename to Spigot-Server-Patches/0448-Optimize-Pathfinding.patch index b06ced591..6329d78de 100644 --- a/Spigot-Server-Patches/0467-Optimize-Pathfinding.patch +++ b/Spigot-Server-Patches/0448-Optimize-Pathfinding.patch @@ -7,7 +7,7 @@ Prevents pathfinding from spamming failures for things such as arrow attacks. diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java -index f06764973feaa29ccbb4731b65372c544dcf3032..dc32107ec320fa54487f24c9d68ff8e5a6dea1bb 100644 +index cca6242e38fc286eea810eb8f2e4d1ab5429b9df..e6dc5b9ce1b2f844d84a7cdf9bce030bc8eb568d 100644 --- a/src/main/java/net/minecraft/server/NavigationAbstract.java +++ b/src/main/java/net/minecraft/server/NavigationAbstract.java @@ -11,7 +11,7 @@ public abstract class NavigationAbstract { @@ -17,9 +17,9 @@ index f06764973feaa29ccbb4731b65372c544dcf3032..dc32107ec320fa54487f24c9d68ff8e5 - protected PathEntity c; + protected PathEntity c; protected final PathEntity getCurrentPath() { return this.c; } // Paper - OBFHELPER protected double d; - private final AttributeInstance p; protected int e; -@@ -158,10 +158,30 @@ public abstract class NavigationAbstract { + protected int f; +@@ -162,10 +162,30 @@ public abstract class NavigationAbstract { return this.a(this.a(d0, d1, d2, 1), d3); } diff --git a/Spigot-Server-Patches/0469-Reduce-Either-Optional-allocation.patch b/Spigot-Server-Patches/0449-Reduce-Either-Optional-allocation.patch similarity index 100% rename from Spigot-Server-Patches/0469-Reduce-Either-Optional-allocation.patch rename to Spigot-Server-Patches/0449-Reduce-Either-Optional-allocation.patch diff --git a/Spigot-Server-Patches/0470-Remove-streams-from-PairedQueue.patch b/Spigot-Server-Patches/0450-Remove-streams-from-PairedQueue.patch similarity index 100% rename from Spigot-Server-Patches/0470-Remove-streams-from-PairedQueue.patch rename to Spigot-Server-Patches/0450-Remove-streams-from-PairedQueue.patch diff --git a/Spigot-Server-Patches/0472-Reduce-memory-footprint-of-NBTTagCompound.patch b/Spigot-Server-Patches/0451-Reduce-memory-footprint-of-NBTTagCompound.patch similarity index 89% rename from Spigot-Server-Patches/0472-Reduce-memory-footprint-of-NBTTagCompound.patch rename to Spigot-Server-Patches/0451-Reduce-memory-footprint-of-NBTTagCompound.patch index 8f36b43e4..1ef08f95c 100644 --- a/Spigot-Server-Patches/0472-Reduce-memory-footprint-of-NBTTagCompound.patch +++ b/Spigot-Server-Patches/0451-Reduce-memory-footprint-of-NBTTagCompound.patch @@ -8,10 +8,10 @@ is important because we clone chunk data after reading it for safety. So, reduce the impact of the clone on GC. diff --git a/src/main/java/net/minecraft/server/NBTTagCompound.java b/src/main/java/net/minecraft/server/NBTTagCompound.java -index 98deaba12ceb25f59d1b56420fb544a64b417ddd..02a2ed1baa3f82d302432b7bc627f3179751f886 100644 +index 9c445902e6adc05773497bc4444203ca364e4f5c..f608b35502890650adfc1df35e0794471f57ecbc 100644 --- a/src/main/java/net/minecraft/server/NBTTagCompound.java +++ b/src/main/java/net/minecraft/server/NBTTagCompound.java -@@ -31,7 +31,7 @@ public class NBTTagCompound implements NBTBase { +@@ -41,7 +41,7 @@ public class NBTTagCompound implements NBTBase { if (i > 512) { throw new RuntimeException("Tried to read NBT tag with too high complexity, depth > 512"); } else { @@ -20,7 +20,7 @@ index 98deaba12ceb25f59d1b56420fb544a64b417ddd..02a2ed1baa3f82d302432b7bc627f317 byte b0; -@@ -67,7 +67,7 @@ public class NBTTagCompound implements NBTBase { +@@ -77,7 +77,7 @@ public class NBTTagCompound implements NBTBase { } public NBTTagCompound() { @@ -29,7 +29,7 @@ index 98deaba12ceb25f59d1b56420fb544a64b417ddd..02a2ed1baa3f82d302432b7bc627f317 } @Override -@@ -402,9 +402,17 @@ public class NBTTagCompound implements NBTBase { +@@ -409,9 +409,17 @@ public class NBTTagCompound implements NBTBase { @Override public NBTTagCompound clone() { diff --git a/Spigot-Server-Patches/0473-Prevent-opening-inventories-when-frozen.patch b/Spigot-Server-Patches/0452-Prevent-opening-inventories-when-frozen.patch similarity index 80% rename from Spigot-Server-Patches/0473-Prevent-opening-inventories-when-frozen.patch rename to Spigot-Server-Patches/0452-Prevent-opening-inventories-when-frozen.patch index a245aa5c4..5f5192528 100644 --- a/Spigot-Server-Patches/0473-Prevent-opening-inventories-when-frozen.patch +++ b/Spigot-Server-Patches/0452-Prevent-opening-inventories-when-frozen.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Prevent opening inventories when frozen diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 4e4c0acc6c103c85b7ba2a390a54d3513939d547..49fe2d1a0376e5aa8a5ec00d010e6c834633e7b7 100644 +index 03e1b76a8b6850a26ed8a7b1992e09756166f5b8..27926559a665a5af14f11b8b4331cdb5f120eb41 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -380,7 +380,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -420,7 +420,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { containerUpdateDelay = world.paperConfig.containerUpdateTickRate; } // Paper end @@ -17,7 +17,7 @@ index 4e4c0acc6c103c85b7ba2a390a54d3513939d547..49fe2d1a0376e5aa8a5ec00d010e6c83 this.closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.CANT_USE); // Paper this.activeContainer = this.defaultContainer; } -@@ -1170,7 +1170,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -1276,7 +1276,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } else { // CraftBukkit start this.activeContainer = container; @@ -26,7 +26,7 @@ index 4e4c0acc6c103c85b7ba2a390a54d3513939d547..49fe2d1a0376e5aa8a5ec00d010e6c83 // CraftBukkit end container.addSlotListener(this); return OptionalInt.of(this.containerCounter); -@@ -1933,7 +1933,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -2071,7 +2071,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } @Override @@ -36,24 +36,24 @@ index 4e4c0acc6c103c85b7ba2a390a54d3513939d547..49fe2d1a0376e5aa8a5ec00d010e6c83 } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -index a6d75c0e07a25fdb59dde2e3eb2a0213c7112515..a5e9fc90ffae794b9b14468337ce7b091fd0dc35 100644 +index 00d67c9911c52ddcdf48fda7998bcd2a8a35f0eb..75aa141e86e301254b25ede3da67513aae76fa5c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -@@ -350,7 +350,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { +@@ -319,7 +319,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { String title = container.getBukkitView().getTitle(); -- player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, windowType, new ChatComponentText(title))); -+ if (!player.isFrozen()) player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, windowType, new ChatComponentText(title))); // Paper +- player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, windowType, CraftChatMessage.fromString(title)[0])); ++ if (!player.isFrozen()) player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, windowType, CraftChatMessage.fromString(title)[0])); // Paper getHandle().activeContainer = container; getHandle().activeContainer.addSlotListener(player); } -@@ -420,7 +420,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { +@@ -389,7 +389,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { // Now open the window Containers windowType = CraftContainer.getNotchInventoryType(inventory.getTopInventory()); String title = inventory.getTitle(); -- player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, windowType, new ChatComponentText(title))); -+ if (!player.isFrozen()) player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, windowType, new ChatComponentText(title))); // Paper +- player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, windowType, CraftChatMessage.fromString(title)[0])); ++ if (!player.isFrozen()) player.playerConnection.sendPacket(new PacketPlayOutOpenWindow(container.windowId, windowType, CraftChatMessage.fromString(title)[0])); // Paper player.activeContainer = container; player.activeContainer.addSlotListener(player); } diff --git a/Spigot-Server-Patches/0474-Optimise-ArraySetSorted-removeIf.patch b/Spigot-Server-Patches/0453-Optimise-ArraySetSorted-removeIf.patch similarity index 100% rename from Spigot-Server-Patches/0474-Optimise-ArraySetSorted-removeIf.patch rename to Spigot-Server-Patches/0453-Optimise-ArraySetSorted-removeIf.patch diff --git a/Spigot-Server-Patches/0453-Optimize-Collision-to-not-load-chunks.patch b/Spigot-Server-Patches/0453-Optimize-Collision-to-not-load-chunks.patch deleted file mode 100644 index f7bc6e470..000000000 --- a/Spigot-Server-Patches/0453-Optimize-Collision-to-not-load-chunks.patch +++ /dev/null @@ -1,111 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Thu, 2 Apr 2020 02:37:57 -0400 -Subject: [PATCH] Optimize Collision to not load chunks - -The collision code takes an AABB and generates a cuboid of checks rather -than a cylinder, so at high velocity this can generate a lot of chunk checks. - -Treat an unloaded chunk as a collision for entities, and also for players if -the "prevent moving into unloaded chunks" setting is enabled. - -If that serting is not enabled, collisions will be ignored for players, since -movement will load only the chunk the player enters anyways and avoids loading -massive amounts of surrounding chunks due to large AABB lookups. - -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 7434f859f7f9acff0f881ff594c8dffdfa249c76..7fb34a86dc35cb4bf51e1ce5220e56642096fece 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -80,6 +80,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - private CraftEntity bukkitEntity; - - PlayerChunkMap.EntityTracker tracker; // Paper -+ boolean collisionLoadChunks = false; // Paper - Throwable addedToWorldStack; // Paper - entity debug - public CraftEntity getBukkitEntity() { - if (bukkitEntity == null) { -diff --git a/src/main/java/net/minecraft/server/ICollisionAccess.java b/src/main/java/net/minecraft/server/ICollisionAccess.java -index f851ed11df14fd9aa8017f44d82fb6cfc3bde345..3eefbf4d5f10b53f930759a0afa5661253b92c60 100644 ---- a/src/main/java/net/minecraft/server/ICollisionAccess.java -+++ b/src/main/java/net/minecraft/server/ICollisionAccess.java -@@ -43,7 +43,9 @@ public interface ICollisionAccess extends IBlockAccess { - } - - default boolean a(@Nullable Entity entity, AxisAlignedBB axisalignedbb, Set set) { -+ try { if (entity != null) entity.collisionLoadChunks = true; // Paper - return this.c(entity, axisalignedbb, set).allMatch(VoxelShape::isEmpty); -+ } finally { if (entity != null) entity.collisionLoadChunks = false; } // Paper - } - - default Stream b(@Nullable Entity entity, AxisAlignedBB axisalignedbb, Set set) { -@@ -83,19 +85,33 @@ public interface ICollisionAccess extends IBlockAccess { - } - - while (cursorposition.a()) { -- int k1 = cursorposition.b(); -- int l1 = cursorposition.c(); -- int i2 = cursorposition.d(); -+ int k1 = cursorposition.b();int x = k1; // Paper -+ int l1 = cursorposition.c();int y = l1; // Paper -+ int i2 = cursorposition.d();int z = i2; // Paper - int j2 = cursorposition.e(); - - if (j2 != 3) { -- int k2 = k1 >> 4; -- int l2 = i2 >> 4; -- IBlockAccess iblockaccess = ICollisionAccess.this.c(k2, l2); -- -- if (iblockaccess != null) { -- blockposition_mutableblockposition.d(k1, l1, i2); -- IBlockData iblockdata = iblockaccess.getType(blockposition_mutableblockposition); -+ // Paper start - ensure we don't load chunks -+ //int k2 = k1 >> 4; -+ //int l2 = i2 >> 4; -+ boolean far = entity != null && MCUtil.distanceSq(entity.locX(), y, entity.locZ(), x, y, z) > 14; -+ blockposition_mutableblockposition.setValues(x, y, z); -+ -+ boolean isRegionLimited = ICollisionAccess.this instanceof RegionLimitedWorldAccess; -+ IBlockData iblockdata = isRegionLimited ? Blocks.VOID_AIR.getBlockData() : ((!far && entity instanceof EntityPlayer) || (entity != null && entity.collisionLoadChunks) -+ ? ICollisionAccess.this.getType(blockposition_mutableblockposition) -+ : ICollisionAccess.this.getTypeIfLoaded(blockposition_mutableblockposition) -+ ); -+ if (iblockdata == null) { -+ if (!(entity instanceof EntityPlayer) || entity.world.paperConfig.preventMovingIntoUnloadedChunks) { -+ VoxelShape voxelshape3 = VoxelShapes.of(far ? entity.getBoundingBox() : new AxisAlignedBB(new BlockPosition(x, y, z))); -+ consumer.accept(voxelshape3); -+ return true; -+ } -+ } else { -+ //blockposition_mutableblockposition.d(k1, l1, i2); // moved up -+ //IBlockData iblockdata = iblockaccess.getType(blockposition_mutableblockposition); // moved up -+ // Paper end - - if ((j2 != 1 || iblockdata.f()) && (j2 != 2 || iblockdata.getBlock() == Blocks.MOVING_PISTON)) { - VoxelShape voxelshape2 = iblockdata.b((IBlockAccess) ICollisionAccess.this, blockposition_mutableblockposition, voxelshapecollision); -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 0ba103a5c60d8f5b8f332fe63364c597925a6450..157738f452493aabdefb228cd527ba85400baad5 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -677,6 +677,7 @@ public abstract class PlayerList { - entityplayer1.forceSetPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); - // CraftBukkit end - -+ worldserver.getChunkProvider().addTicket(TicketType.POST_TELEPORT, new ChunkCoordIntPair(location.getBlockX() >> 4, location.getBlockZ() >> 4), 1, entityplayer.getId()); // Paper - while (avoidSuffocation && !worldserver.getCubes(entityplayer1) && entityplayer1.locY() < 256.0D) { - entityplayer1.setPosition(entityplayer1.locX(), entityplayer1.locY() + 1.0D, entityplayer1.locZ()); - } -diff --git a/src/main/java/net/minecraft/server/VoxelShapes.java b/src/main/java/net/minecraft/server/VoxelShapes.java -index 335142ec0dfad822cfe40877e99dec0f307e1a58..e641d4b8d8b4ac5d539e6d9c0eaf345601e0b499 100644 ---- a/src/main/java/net/minecraft/server/VoxelShapes.java -+++ b/src/main/java/net/minecraft/server/VoxelShapes.java -@@ -239,7 +239,8 @@ public final class VoxelShapes { - - if (k2 < 3) { - blockposition_mutableblockposition.a(enumaxiscycle1, i2, j2, l1); -- IBlockData iblockdata = iworldreader.getType(blockposition_mutableblockposition); -+ IBlockData iblockdata = iworldreader.getTypeIfLoaded(blockposition_mutableblockposition); // Paper -+ if (iblockdata == null) return 0.0D; // Paper - - if ((k2 != 1 || iblockdata.f()) && (k2 != 2 || iblockdata.getBlock() == Blocks.MOVING_PISTON)) { - d0 = iblockdata.b((IBlockAccess) iworldreader, blockposition_mutableblockposition, voxelshapecollision).a(enumdirection_enumaxis2, axisalignedbb.d((double) (-blockposition_mutableblockposition.getX()), (double) (-blockposition_mutableblockposition.getY()), (double) (-blockposition_mutableblockposition.getZ())), d0); diff --git a/Spigot-Server-Patches/0475-Don-t-run-entity-collision-code-if-not-needed.patch b/Spigot-Server-Patches/0454-Don-t-run-entity-collision-code-if-not-needed.patch similarity index 89% rename from Spigot-Server-Patches/0475-Don-t-run-entity-collision-code-if-not-needed.patch rename to Spigot-Server-Patches/0454-Don-t-run-entity-collision-code-if-not-needed.patch index fa10e6fb2..ba59d2269 100644 --- a/Spigot-Server-Patches/0475-Don-t-run-entity-collision-code-if-not-needed.patch +++ b/Spigot-Server-Patches/0454-Don-t-run-entity-collision-code-if-not-needed.patch @@ -7,10 +7,10 @@ Will not run if max entity craming is disabled and the max collisions per entity is less than or equal to 0 diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 253e35826f6f51145c278b083d195599affca2a7..2c81344a65bf230a6ba09deb2a3bb45881144a39 100644 +index e0a4866048276c44079e0b9034c1acea1f0498fa..40ac2b8153dbbb10b732123f95b9c0a3a807e54e 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -2666,10 +2666,16 @@ public abstract class EntityLiving extends Entity { +@@ -2820,10 +2820,16 @@ public abstract class EntityLiving extends Entity { protected void doTick() {} protected void collideNearby() { diff --git a/Spigot-Server-Patches/0476-Optimise-entity-hard-collision-checking.patch b/Spigot-Server-Patches/0455-Optimise-entity-hard-collision-checking.patch similarity index 74% rename from Spigot-Server-Patches/0476-Optimise-entity-hard-collision-checking.patch rename to Spigot-Server-Patches/0455-Optimise-entity-hard-collision-checking.patch index b80a505ed..bfa5a5ff8 100644 --- a/Spigot-Server-Patches/0476-Optimise-entity-hard-collision-checking.patch +++ b/Spigot-Server-Patches/0455-Optimise-entity-hard-collision-checking.patch @@ -11,10 +11,10 @@ Less crammed entities are likely to show significantly less benefit. Effectively, this patch optimises crammed entity situations. diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 74d110874d0a9c1603d6b2d77753179ba49811ea..cf86ce24e12068d6ff7ae43cb1fd6fe665c24932 100644 +index cb24f27bc443880b18ffc36236f6ec7174c9d493..b65ae2d6919a67498d0646c5522735086fec00c1 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -90,6 +90,54 @@ public class Chunk implements IChunkAccess { +@@ -91,6 +91,54 @@ public class Chunk implements IChunkAccess { private final int[] inventoryEntityCounts = new int[16]; // Paper end @@ -27,7 +27,7 @@ index 74d110874d0a9c1603d6b2d77753179ba49811ea..cf86ce24e12068d6ff7ae43cb1fd6fe6 + } + } + -+ public final void getHardCollidingEntities(@Nullable Entity entity, AxisAlignedBB axisalignedbb, List into) { ++ public final void getHardCollidingEntities(@Nullable Entity entity, AxisAlignedBB axisalignedbb, List into, Predicate predicate) { + // copied from getEntities + int min = MathHelper.floor((axisalignedbb.minY - 2.0D) / 16.0D); + int max = MathHelper.floor((axisalignedbb.maxY + 2.0D) / 16.0D); @@ -43,7 +43,7 @@ index 74d110874d0a9c1603d6b2d77753179ba49811ea..cf86ce24e12068d6ff7ae43cb1fd6fe6 + Entity entity1 = entities[i]; + if (entity1.shouldBeRemoved) continue; // Paper + -+ if (entity1 != entity && entity1.getBoundingBox().intersects(axisalignedbb)) { ++ if (entity1 != entity && entity1.getBoundingBox().intersects(axisalignedbb) && (predicate == null || predicate.test(entity1))) { + into.add(entity1); + + if (!(entity1 instanceof EntityEnderDragon)) { @@ -56,7 +56,7 @@ index 74d110874d0a9c1603d6b2d77753179ba49811ea..cf86ce24e12068d6ff7ae43cb1fd6fe6 + for (int i1 = 0; i1 < l; ++i1) { + EntityComplexPart entitycomplexpart = aentitycomplexpart[i1]; + -+ if (entitycomplexpart != entity && entitycomplexpart.getBoundingBox().intersects(axisalignedbb)) { ++ if (entitycomplexpart != entity && entitycomplexpart.getBoundingBox().intersects(axisalignedbb) && (predicate == null || predicate.test(entitycomplexpart))) { + into.add(entitycomplexpart); + } + } @@ -69,7 +69,7 @@ index 74d110874d0a9c1603d6b2d77753179ba49811ea..cf86ce24e12068d6ff7ae43cb1fd6fe6 public Chunk(World world, ChunkCoordIntPair chunkcoordintpair, BiomeStorage biomestorage, ChunkConverter chunkconverter, TickList ticklist, TickList ticklist1, long i, @Nullable ChunkSection[] achunksection, @Nullable Consumer consumer) { this.sections = new ChunkSection[16]; this.e = Maps.newHashMap(); -@@ -545,7 +593,7 @@ public class Chunk implements IChunkAccess { +@@ -546,7 +594,7 @@ public class Chunk implements IChunkAccess { entity.chunkY = k; entity.chunkZ = this.loc.z; this.entities.add(entity); // Paper - per chunk entity list @@ -78,7 +78,7 @@ index 74d110874d0a9c1603d6b2d77753179ba49811ea..cf86ce24e12068d6ff7ae43cb1fd6fe6 // Paper start if (entity instanceof EntityItem) { itemCounts[k]++; -@@ -582,7 +630,7 @@ public class Chunk implements IChunkAccess { +@@ -583,7 +631,7 @@ public class Chunk implements IChunkAccess { entity.entitySlice = null; entity.inChunk = false; } @@ -88,7 +88,7 @@ index 74d110874d0a9c1603d6b2d77753179ba49811ea..cf86ce24e12068d6ff7ae43cb1fd6fe6 } if (entity instanceof EntityItem) { diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 7fb34a86dc35cb4bf51e1ce5220e56642096fece..f20f798f0f7bb765ffdab8672f4bf77a60fa52d2 100644 +index 152f613159ef88977de867c0deec94bfa4353f7a..a0249d7a60c1381ebd7131d735a73fa2e9250543 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -211,6 +211,40 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -106,9 +106,9 @@ index 7fb34a86dc35cb4bf51e1ce5220e56642096fece..f20f798f0f7bb765ffdab8672f4bf77a + Boolean hardCollides = cachedOverrides.get(this.getClass()); + if (hardCollides == null) { + try { -+ Object getHardCollisionBoxMethod = Entity.class.getMethod("au"); ++ Object getHardCollisionBoxMethod = Entity.class.getMethod("ay"); + Object getHardCollisionBoxEntityMethod = Entity.class.getMethod("j", Entity.class); -+ if (!this.getClass().getMethod("au").equals(getHardCollisionBoxMethod)) { ++ if (!this.getClass().getMethod("ay").equals(getHardCollisionBoxMethod)) { + hardCollides = Boolean.TRUE; + } else if (!this.getClass().getMethod("j", Entity.class).equals(getHardCollisionBoxEntityMethod)) { + hardCollides = Boolean.TRUE; @@ -133,61 +133,73 @@ index 7fb34a86dc35cb4bf51e1ce5220e56642096fece..f20f798f0f7bb765ffdab8672f4bf77a this.id = Entity.entityCount.incrementAndGet(); this.passengers = Lists.newArrayList(); diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java -index 5bf99e0028b886a6ba1d2f39f8dc4cd3c9aa0943..aecdaacfc7da560759bc513680d76f55820d5046 100644 +index 96f898acdeae1917a4aaf99ec4a48bccf3904488..73e9859e675902d9fc5942547966b52426a496a2 100644 --- a/src/main/java/net/minecraft/server/EntityEnderDragon.java +++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java -@@ -847,6 +847,7 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster { +@@ -844,6 +844,7 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster { @Override public void checkDespawn() {} -+ public final EntityComplexPart[] getComplexParts() { return this.eo(); } // Paper - OBFHELPER - public EntityComplexPart[] eo() { ++ public final EntityComplexPart[] getComplexParts() { return this.eK(); } // Paper - OBFHELPER + public EntityComplexPart[] eK() { return this.children; } diff --git a/src/main/java/net/minecraft/server/IEntityAccess.java b/src/main/java/net/minecraft/server/IEntityAccess.java -index 4157e50e4d99c029759bffcb48a8d645487554c8..5135308fb6137a34ed6fd061f0a210de6de4e81c 100644 +index 74d4c28246e7db850e6d993e07a84b2a6ca24ce2..267a6baae89c181eed545e6758fac7115eb3882f 100644 --- a/src/main/java/net/minecraft/server/IEntityAccess.java +++ b/src/main/java/net/minecraft/server/IEntityAccess.java -@@ -42,17 +42,26 @@ public interface IEntityAccess { - return this.b(oclass, axisalignedbb, IEntitySelector.f); +@@ -53,24 +53,36 @@ public interface IEntityAccess { + return this.b(oclass, axisalignedbb, IEntitySelector.g); } + // Paper start - optimise hard collision + /** + * Not guaranteed to only return hard colliding entites + */ -+ default List getHardCollidingEntities(@Nullable Entity entity, AxisAlignedBB axisalignedbb) { -+ return this.getEntities(entity, axisalignedbb); ++ default List getHardCollidingEntities(@Nullable Entity entity, AxisAlignedBB axisalignedbb, Predicate predicate) { ++ return this.getEntities(entity, axisalignedbb, predicate); + } + // Paper end - optimise hard collision + - default Stream b(@Nullable Entity entity, AxisAlignedBB axisalignedbb, Set set) { + default Stream c(@Nullable Entity entity, AxisAlignedBB axisalignedbb, Predicate predicate) { if (axisalignedbb.a() < 1.0E-7D) { return Stream.empty(); } else { AxisAlignedBB axisalignedbb1 = axisalignedbb.g(1.0E-7D); -- Stream stream = this.getEntities(entity, axisalignedbb1).stream().filter((entity1) -> { // Paper - decompile fix -+ Stream stream = ((entity != null && entity.hardCollides()) ? this.getEntities(entity, axisalignedbb) : this.getHardCollidingEntities(entity, axisalignedbb1)).stream().filter((entity1) -> { // Paper - decompile fix // Paper - optimise hard collision - return !set.contains(entity1); - }).filter((entity1) -> { - return entity == null || !entity.isSameVehicle(entity1); - }).flatMap((entity1) -> { -- return Stream.of(entity1.au(), entity == null ? null : entity.j(entity1)); -+ return Stream.of(entity1.au(), entity == null ? null : entity.j(entity1)); // Paper - optimise hard collision - diff on change, these are the methods that only hard colliding entities override - }).filter(Objects::nonNull); - return stream.filter(axisalignedbb1::c).map(VoxelShapes::a); +- return this.getEntities(entity, axisalignedbb1, predicate.and((entity1) -> { ++ // Paper start ++ Predicate effectivePredicate = predicate.and((entity1) -> { + return entity == null || !entity.isSameVehicle(entity1); +- })).stream().flatMap((entity1) -> { ++ }); ++ ++ return ((entity != null && entity.hardCollides()) ? this.getEntities(entity, axisalignedbb, effectivePredicate) : this.getHardCollidingEntities(entity, axisalignedbb1, effectivePredicate)).stream().flatMap((entity1) -> { + if (entity != null) { +- AxisAlignedBB axisalignedbb2 = entity.j(entity1); ++ AxisAlignedBB axisalignedbb2 = entity.j(entity1); // Paper - diff on change, hard collision box method + + if (axisalignedbb2 != null && axisalignedbb2.c(axisalignedbb1)) { + return Stream.of(entity1.ay(), axisalignedbb2); + } + } + +- return Stream.of(entity1.ay()); ++ return Stream.of(entity1.ay()); // Paper - diff on change, hard collision box method + }).filter(Objects::nonNull).map(VoxelShapes::a); + } + } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index bdd0908adb7d3cd5370b43be196c975e6c48a70f..1c7955d3ae7ddd1c2d924cec20a91202cf090f40 100644 +index 418ba04a837ee2b17cc679edd35ba09830c01f28..365539e53efdb7e729b580f52fb23659cbde4f0a 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -1179,6 +1179,32 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -1111,6 +1111,32 @@ public abstract class World implements GeneratorAccess, AutoCloseable { return this.getChunkAt(i, j, ChunkStatus.FULL, false); } + // Paper start - optimise hard collision handling + @Override -+ public List getHardCollidingEntities(@Nullable Entity entity, AxisAlignedBB axisalignedbb) { ++ public List getHardCollidingEntities(@Nullable Entity entity, AxisAlignedBB axisalignedbb, Predicate predicate) { + // copied from below + List list = Lists.newArrayList(); + int i = MathHelper.floor((axisalignedbb.minX - 2.0D) / 16.0D); @@ -195,14 +207,14 @@ index bdd0908adb7d3cd5370b43be196c975e6c48a70f..1c7955d3ae7ddd1c2d924cec20a91202 + int k = MathHelper.floor((axisalignedbb.minZ - 2.0D) / 16.0D); + int l = MathHelper.floor((axisalignedbb.maxZ + 2.0D) / 16.0D); + -+ ChunkProviderServer chunkProvider = ((ChunkProviderServer)this.chunkProvider); ++ ChunkProviderServer chunkProvider = ((WorldServer)this).getChunkProvider(); + + for (int i1 = i; i1 <= j; ++i1) { + for (int j1 = k; j1 <= l; ++j1) { + Chunk chunk = chunkProvider.getChunkAtIfLoadedMainThread(i1, j1); + + if (chunk != null) { -+ chunk.getHardCollidingEntities(entity, axisalignedbb, list); ++ chunk.getHardCollidingEntities(entity, axisalignedbb, list, predicate); + } + } + } diff --git a/Spigot-Server-Patches/0477-Optimize-ChunkProviderServer-s-chunk-level-checking-.patch b/Spigot-Server-Patches/0456-Optimize-ChunkProviderServer-s-chunk-level-checking-.patch similarity index 74% rename from Spigot-Server-Patches/0477-Optimize-ChunkProviderServer-s-chunk-level-checking-.patch rename to Spigot-Server-Patches/0456-Optimize-ChunkProviderServer-s-chunk-level-checking-.patch index 9bd9a6f1e..368e1ea8c 100644 --- a/Spigot-Server-Patches/0477-Optimize-ChunkProviderServer-s-chunk-level-checking-.patch +++ b/Spigot-Server-Patches/0456-Optimize-ChunkProviderServer-s-chunk-level-checking-.patch @@ -9,16 +9,16 @@ so inline where possible, and avoid the abstraction of the Either class. diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index b6146330a55665a0365ff7474f1843766e0c0ce1..695d12e1942018be6a9e8c999ba6071b9f778568 100644 +index d1f832db33f21f8ba910d2c0c163af78718d298f..91755cd7313d87bae85584dff140acbc6467428f 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -617,27 +617,37 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -618,21 +618,29 @@ public class ChunkProviderServer extends IChunkProvider { public final boolean isInEntityTickingChunk(Entity entity) { return this.a(entity); } // Paper - OBFHELPER @Override public boolean a(Entity entity) { - long i = ChunkCoordIntPair.pair(MathHelper.floor(entity.locX()) >> 4, MathHelper.floor(entity.locZ()) >> 4); - -- return this.a(i, PlayerChunk::b); +- return this.a(i, (Function>>) PlayerChunk::b); // CraftBukkit - decompile error + // Paper start - optimize is ticking ready type functions + // entity ticking + PlayerChunk playerChunk = this.getChunk(MCUtil.getCoordinateKey(entity)); @@ -28,7 +28,7 @@ index b6146330a55665a0365ff7474f1843766e0c0ce1..695d12e1942018be6a9e8c999ba6071b public final boolean isEntityTickingChunk(ChunkCoordIntPair chunkcoordintpair) { return this.a(chunkcoordintpair); } // Paper - OBFHELPER @Override public boolean a(ChunkCoordIntPair chunkcoordintpair) { -- return this.a(chunkcoordintpair.pair(), PlayerChunk::b); +- return this.a(chunkcoordintpair.pair(), (Function>>) PlayerChunk::b); // CraftBukkit - decompile error + // Paper start - optimize is ticking ready type functions + // is entity ticking ready + PlayerChunk playerChunk = this.getChunk(MCUtil.getCoordinateKey(chunkcoordintpair)); @@ -40,7 +40,7 @@ index b6146330a55665a0365ff7474f1843766e0c0ce1..695d12e1942018be6a9e8c999ba6071b public boolean a(BlockPosition blockposition) { - long i = ChunkCoordIntPair.pair(blockposition.getX() >> 4, blockposition.getZ() >> 4); - -- return this.a(i, PlayerChunk::a); +- return this.a(i, (Function>>) PlayerChunk::a); // CraftBukkit - decompile error + // Paper start - optimize is ticking ready type functions + // is ticking ready + PlayerChunk playerChunk = this.getChunk(MCUtil.getCoordinateKey(blockposition)); @@ -48,15 +48,4 @@ index b6146330a55665a0365ff7474f1843766e0c0ce1..695d12e1942018be6a9e8c999ba6071b + // Paper end - optimize is ticking ready type functions } - public boolean b(Entity entity) { -- long i = ChunkCoordIntPair.pair(MathHelper.floor(entity.locX()) >> 4, MathHelper.floor(entity.locZ()) >> 4); -- -- return this.a(i, PlayerChunk::c); -+ // Paper start - optimize is ticking ready type functions -+ // is full chunk ready -+ PlayerChunk playerChunk = this.getChunk(MCUtil.getCoordinateKey(entity)); -+ return playerChunk != null && playerChunk.isFullChunkReady(); -+ // Paper end - optimize is ticking ready type functions - } - private boolean a(long i, Function>> function) { diff --git a/Spigot-Server-Patches/0478-Restrict-vanilla-teleport-command-to-valid-locations.patch b/Spigot-Server-Patches/0457-Restrict-vanilla-teleport-command-to-valid-locations.patch similarity index 77% rename from Spigot-Server-Patches/0478-Restrict-vanilla-teleport-command-to-valid-locations.patch rename to Spigot-Server-Patches/0457-Restrict-vanilla-teleport-command-to-valid-locations.patch index 9cfca0614..12eb7b480 100644 --- a/Spigot-Server-Patches/0478-Restrict-vanilla-teleport-command-to-valid-locations.patch +++ b/Spigot-Server-Patches/0457-Restrict-vanilla-teleport-command-to-valid-locations.patch @@ -6,19 +6,19 @@ Subject: [PATCH] Restrict vanilla teleport command to valid locations Fixes GH-3165, GH-3575 diff --git a/src/main/java/net/minecraft/server/CommandTeleport.java b/src/main/java/net/minecraft/server/CommandTeleport.java -index 3060b4f68b13abe05d31b85bb49690a0b476939f..cc00cd0b44b23c76c627b5d51362a22273f7bac4 100644 +index 75c2c7f191f0a9704017ff08766cc920fa8a7270..203373c3bb97d331ff6c6b9e21ae4cbc8b173fe6 100644 --- a/src/main/java/net/minecraft/server/CommandTeleport.java +++ b/src/main/java/net/minecraft/server/CommandTeleport.java -@@ -116,6 +116,12 @@ public class CommandTeleport { - } +@@ -119,6 +119,12 @@ public class CommandTeleport { - private static void a(CommandListenerWrapper commandlistenerwrapper, Entity entity, WorldServer worldserver, double d0, double d1, double d2, Set set, float f, float f1, @Nullable CommandTeleport.a commandteleport_a) { + private static void a(CommandListenerWrapper commandlistenerwrapper, Entity entity, WorldServer worldserver, double d0, double d1, double d2, Set set, float f, float f1, @Nullable CommandTeleport.a commandteleport_a) throws CommandSyntaxException { + BlockPosition blockposition = new BlockPosition(d0, d1, d2); + // Paper start - Don't allow teleport command to invalid locations + if (d0 <= -30000000 || d2 <= -30000000 || d0 > 30000000 || d2 > 30000000 || d1 > 30000000 || d1 <= -30000000) { // Copy/pasta from BaseBlockPosition#isValidLocation + org.bukkit.Bukkit.getLogger().warning("Refused to teleport " + entity.getName() + " to " + d0 + ", " + d1 + ", " + d2); + return; + } + // Paper end - if (entity instanceof EntityPlayer) { - ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(new BlockPosition(d0, d1, d2)); + if (!World.k(blockposition)) { + throw CommandTeleport.a.create(); diff --git a/Spigot-Server-Patches/0479-Implement-Player-Client-Options-API.patch b/Spigot-Server-Patches/0458-Implement-Player-Client-Options-API.patch similarity index 81% rename from Spigot-Server-Patches/0479-Implement-Player-Client-Options-API.patch rename to Spigot-Server-Patches/0458-Implement-Player-Client-Options-API.patch index 212608344..14d03e7a9 100644 --- a/Spigot-Server-Patches/0479-Implement-Player-Client-Options-API.patch +++ b/Spigot-Server-Patches/0458-Implement-Player-Client-Options-API.patch @@ -85,20 +85,20 @@ index 0000000000000000000000000000000000000000..b6f4400df3d8ec7e06a996de54f8cabb + } +} diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index c4d433430503e844121f1917c6caf05823af0a34..7df24be46e4471ae0ddad5cded5eef4937fd37a3 100644 +index 22acfe1350eb122b7eaa7209f519e4f4f1469b6c..2cada09ced1660526e9c112c2c8d92bbf9d6ea98 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -35,7 +35,7 @@ public abstract class EntityHuman extends EntityLiving { - private static final Map b = ImmutableMap.builder().put(EntityPose.STANDING, EntityHuman.bp).put(EntityPose.SLEEPING, EntityHuman.ap).put(EntityPose.FALL_FLYING, EntitySize.b(0.6F, 0.6F)).put(EntityPose.SWIMMING, EntitySize.b(0.6F, 0.6F)).put(EntityPose.SPIN_ATTACK, EntitySize.b(0.6F, 0.6F)).put(EntityPose.CROUCHING, EntitySize.b(0.6F, 1.5F)).put(EntityPose.DYING, EntitySize.c(0.2F, 0.2F)).build(); +@@ -36,7 +36,7 @@ public abstract class EntityHuman extends EntityLiving { + private static final Map b = ImmutableMap.builder().put(EntityPose.STANDING, EntityHuman.bo).put(EntityPose.SLEEPING, EntityHuman.ao).put(EntityPose.FALL_FLYING, EntitySize.b(0.6F, 0.6F)).put(EntityPose.SWIMMING, EntitySize.b(0.6F, 0.6F)).put(EntityPose.SPIN_ATTACK, EntitySize.b(0.6F, 0.6F)).put(EntityPose.CROUCHING, EntitySize.b(0.6F, 1.5F)).put(EntityPose.DYING, EntitySize.c(0.2F, 0.2F)).build(); private static final DataWatcherObject c = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.c); private static final DataWatcherObject d = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.b); -- protected static final DataWatcherObject bq = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.a); -+ protected static final DataWatcherObject bq = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.a); public static DataWatcherObject getSkinPartsWatcher() { return bq; } // Paper - OBFHELPER - protected static final DataWatcherObject br = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.a); +- protected static final DataWatcherObject bp = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.a); ++ protected static final DataWatcherObject bp = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.a); public static DataWatcherObject getSkinPartsWatcher() { return bp; } // Paper - OBFHELPER + protected static final DataWatcherObject bq = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.a); + protected static final DataWatcherObject br = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.p); protected static final DataWatcherObject bs = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.p); - protected static final DataWatcherObject bt = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.p); diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 49fe2d1a0376e5aa8a5ec00d010e6c834633e7b7..64e00275edf38739fe6e2d79dbcb93243e765678 100644 +index 27926559a665a5af14f11b8b4331cdb5f120eb41..83a3c8d8d15f5792f5618ab301e3c9ed1c1162cd 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -2,6 +2,7 @@ package net.minecraft.server; @@ -108,35 +108,39 @@ index 49fe2d1a0376e5aa8a5ec00d010e6c834633e7b7..64e00275edf38739fe6e2d79dbcb9324 +import com.destroystokyo.paper.event.player.PlayerClientOptionsChangeEvent; // Paper import com.mojang.authlib.GameProfile; import com.mojang.datafixers.util.Either; - import io.netty.util.concurrent.Future; + import com.mojang.serialization.DataResult; @@ -59,7 +60,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public int lastSentExp = -99999999; public int invulnerableTicks = 60; - private EnumChatVisibility ch; -- private boolean ci = true; -+ private boolean ci = true; public boolean hasChatColorsEnabled() { return this.ci; } // Paper - OBFHELPER - private long cj = SystemUtils.getMonotonicMillis(); + private EnumChatVisibility cf; +- private boolean cg = true; ++ private boolean cg = true; public boolean hasChatColorsEnabled() { return this.cg; } // Paper - OBFHELPER + private long ch = SystemUtils.getMonotonicMillis(); private Entity spectatedEntity; public boolean worldChangeInvuln; -@@ -1573,6 +1574,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - } +@@ -1680,6 +1681,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + public String locale = null; // CraftBukkit - lowercase // Paper - default to null public void a(PacketPlayInSettings packetplayinsettings) { + new PlayerClientOptionsChangeEvent(getBukkitEntity(), packetplayinsettings.getLocale(), packetplayinsettings.viewDistance, com.destroystokyo.paper.ClientOption.ChatVisibility.valueOf(packetplayinsettings.getChatVisibility().name()), packetplayinsettings.hasChatColorsEnabled(), new com.destroystokyo.paper.PaperSkinParts(packetplayinsettings.getSkinParts()), packetplayinsettings.getMainHand() == EnumMainHand.LEFT ? MainHand.LEFT : MainHand.RIGHT).callEvent(); // Paper - settings event // CraftBukkit start if (getMainHand() != packetplayinsettings.getMainHand()) { PlayerChangedMainHandEvent event = new PlayerChangedMainHandEvent(getBukkitEntity(), getMainHand() == EnumMainHand.LEFT ? MainHand.LEFT : MainHand.RIGHT); diff --git a/src/main/java/net/minecraft/server/PacketPlayInSettings.java b/src/main/java/net/minecraft/server/PacketPlayInSettings.java -index 8faebf9efed7c3529b151fddf8246e8c77a8b693..4da637138190c9b749d986ac32dddc051931d58f 100644 +index dbc3552d50c4129e1844c8a379ab5ba396645f52..be97a0b01b3272e01ece90172f283e3feca10d14 100644 --- a/src/main/java/net/minecraft/server/PacketPlayInSettings.java +++ b/src/main/java/net/minecraft/server/PacketPlayInSettings.java -@@ -37,18 +37,22 @@ public class PacketPlayInSettings implements Packet { - packetlistenerplayin.a(this); - } +@@ -4,7 +4,7 @@ import java.io.IOException; -+ public String getLocale() { return b(); } // Paper - OBFHELPER - public String b() { - return this.a; + public class PacketPlayInSettings implements Packet { + +- public String locale; ++ public String locale; public String getLocale() { return this.locale; } // Paper - OBFHELPER + public int viewDistance; + private EnumChatVisibility c; + private boolean d; +@@ -37,14 +37,17 @@ public class PacketPlayInSettings implements Packet { + packetlistenerplayin.a(this); } + public EnumChatVisibility getChatVisibility() { return d(); } // Paper - OBFHELPER @@ -154,7 +158,7 @@ index 8faebf9efed7c3529b151fddf8246e8c77a8b693..4da637138190c9b749d986ac32dddc05 return this.e; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 71d5ebe8c6ea2d52886c28e0fdc55e5993238709..bd4d5184b607db09c8ff2687ceaf47fb94368a28 100644 +index 93bf15984f541b4daf05e4c27f105f9787cb0347..e3ae90aa7c2c067741540995fbb1c694b663f624 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1,5 +1,8 @@ @@ -166,15 +170,7 @@ index 71d5ebe8c6ea2d52886c28e0fdc55e5993238709..bd4d5184b607db09c8ff2687ceaf47fb import com.destroystokyo.paper.Title; import com.destroystokyo.paper.profile.CraftPlayerProfile; import com.destroystokyo.paper.profile.PlayerProfile; -@@ -36,6 +39,7 @@ import net.minecraft.server.BlockPosition; - import net.minecraft.server.ChatComponentText; - import net.minecraft.server.Container; - import net.minecraft.server.Entity; -+import net.minecraft.server.EntityHuman; - import net.minecraft.server.EntityLiving; - import net.minecraft.server.EntityPlayer; - import net.minecraft.server.EnumColor; -@@ -1968,6 +1972,24 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2035,6 +2038,24 @@ public class CraftPlayer extends CraftHumanEntity implements Player { public void setViewDistance(int viewDistance) { throw new NotImplementedException("Per-Player View Distance APIs need further understanding to properly implement (There are per world view distances though!)"); // TODO } diff --git a/Spigot-Server-Patches/0480-Fix-Chunk-Post-Processing-deadlock-risk.patch b/Spigot-Server-Patches/0459-Fix-Chunk-Post-Processing-deadlock-risk.patch similarity index 80% rename from Spigot-Server-Patches/0480-Fix-Chunk-Post-Processing-deadlock-risk.patch rename to Spigot-Server-Patches/0459-Fix-Chunk-Post-Processing-deadlock-risk.patch index 3cc4ccdb7..5174e5379 100644 --- a/Spigot-Server-Patches/0480-Fix-Chunk-Post-Processing-deadlock-risk.patch +++ b/Spigot-Server-Patches/0459-Fix-Chunk-Post-Processing-deadlock-risk.patch @@ -25,10 +25,10 @@ This successfully fixed a reoccurring and highly reproduceable crash for heightmaps. diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 695d12e1942018be6a9e8c999ba6071b9f778568..665d83042dab467cddf315fade883fd55ffc8bfd 100644 +index 91755cd7313d87bae85584dff140acbc6467428f..0080a0cbe58d1a81c434ef97659428c8bf1ec290 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -1050,6 +1050,7 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -994,6 +994,7 @@ public class ChunkProviderServer extends IChunkProvider { return super.executeNext() || execChunkTask; // Paper } } finally { @@ -37,10 +37,10 @@ index 695d12e1942018be6a9e8c999ba6071b9f778568..665d83042dab467cddf315fade883fd5 } // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 6bdaaf8daef15cd7c11943254e412e0e2d2898fb..48f858388029e77f710365e73905f8570f1103f5 100644 +index 09f94bd242318155dbb46e12224ad3e47eed40cf..4ab719930f5b35c0ae221e9345f1e2eda7d9d719 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -131,6 +131,8 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -133,6 +133,8 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { }; // CraftBukkit end @@ -49,12 +49,12 @@ index 6bdaaf8daef15cd7c11943254e412e0e2d2898fb..48f858388029e77f710365e73905f857 // Paper start - distance maps private final com.destroystokyo.paper.util.misc.PooledLinkedHashSets pooledLinkedPlayerHashSets = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets<>(); -@@ -987,7 +989,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -996,7 +998,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { return Either.left(chunk); }); }, (runnable) -> { -- this.mailboxMain.a(ChunkTaskQueueSorter.a(playerchunk, runnable)); // CraftBukkit - decompile error -+ this.mailboxMain.a(ChunkTaskQueueSorter.a(playerchunk, () -> PlayerChunkMap.this.chunkLoadConversionCallbackExecutor.execute(runnable))); // CraftBukkit - decompile error // Paper - delay running Chunk post processing until outside of the sorter to prevent a deadlock scenario when post processing causes another chunk request. +- this.mailboxMain.a(ChunkTaskQueueSorter.a(playerchunk, runnable)); ++ this.mailboxMain.a(ChunkTaskQueueSorter.a(playerchunk, () -> PlayerChunkMap.this.chunkLoadConversionCallbackExecutor.execute(runnable))); // Paper - delay running Chunk post processing until outside of the sorter to prevent a deadlock scenario when post processing causes another chunk request. }); completablefuture1.thenAcceptAsync((either) -> { diff --git a/Spigot-Server-Patches/0481-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch b/Spigot-Server-Patches/0460-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch similarity index 79% rename from Spigot-Server-Patches/0481-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch rename to Spigot-Server-Patches/0460-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch index fae600572..fd6daa957 100644 --- a/Spigot-Server-Patches/0481-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch +++ b/Spigot-Server-Patches/0460-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch @@ -7,11 +7,11 @@ Subject: [PATCH] Don't crash if player is attempted to be removed from I suspect it deals with teleporting as it uses players current x/y/z diff --git a/src/main/java/net/minecraft/server/ChunkMapDistance.java b/src/main/java/net/minecraft/server/ChunkMapDistance.java -index 83da76fdc495225b563cecbdb71422aec2b534f3..10e385eb556faff954df28ed0b3ddaceac2b8baa 100644 +index d5b50a6a6816421c0443ae36213932b16ed5c797..32d3887e2542c4ebba4a7498167fbe4b497a71ce 100644 --- a/src/main/java/net/minecraft/server/ChunkMapDistance.java +++ b/src/main/java/net/minecraft/server/ChunkMapDistance.java @@ -238,8 +238,8 @@ public abstract class ChunkMapDistance { - long i = sectionposition.u().pair(); + long i = sectionposition.r().pair(); ObjectSet objectset = (ObjectSet) this.c.get(i); - objectset.remove(entityplayer); @@ -19,5 +19,5 @@ index 83da76fdc495225b563cecbdb71422aec2b534f3..10e385eb556faff954df28ed0b3ddace + if (objectset != null) objectset.remove(entityplayer); // Paper - some state corruption happens here, don't crash, clean up gracefully. + if (objectset == null || objectset.isEmpty()) { // Paper this.c.remove(i); - this.f.b(i, Integer.MAX_VALUE, false); - this.g.b(i, Integer.MAX_VALUE, false); + this.f.update(i, Integer.MAX_VALUE, false); + this.g.update(i, Integer.MAX_VALUE, false); diff --git a/Spigot-Server-Patches/0482-Broadcast-join-message-to-console.patch b/Spigot-Server-Patches/0461-Broadcast-join-message-to-console.patch similarity index 83% rename from Spigot-Server-Patches/0482-Broadcast-join-message-to-console.patch rename to Spigot-Server-Patches/0461-Broadcast-join-message-to-console.patch index 046df5747..038e379f2 100644 --- a/Spigot-Server-Patches/0482-Broadcast-join-message-to-console.patch +++ b/Spigot-Server-Patches/0461-Broadcast-join-message-to-console.patch @@ -5,15 +5,15 @@ Subject: [PATCH] Broadcast join message to console diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 5428f306340acb92b93fe133b827173b646e5d4c..ba97c48c937051adc0baa1e9acbc911575ea58d0 100644 +index bbe41a108b424abd3b3acfdfee4d368467a2c52e..45fce4f08eb6f3f67306d45be407b85b3fda604b 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -188,9 +188,9 @@ public abstract class PlayerList { +@@ -211,9 +211,9 @@ public abstract class PlayerList { joinMessage = playerJoinEvent.getJoinMessage(); if (joinMessage != null && joinMessage.length() > 0) { - for (IChatBaseComponent line : org.bukkit.craftbukkit.util.CraftChatMessage.fromString(joinMessage)) { -- server.getPlayerList().sendAll(new PacketPlayOutChat(line)); +- server.getPlayerList().sendAll(new PacketPlayOutChat(line, ChatMessageType.SYSTEM, SystemUtils.b)); - } + // Paper start - Removed sendAll for loop and broadcasted to console also + server.getPlayerList().sendMessage(CraftChatMessage.fromString(joinMessage)); diff --git a/Spigot-Server-Patches/0483-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch b/Spigot-Server-Patches/0462-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch similarity index 82% rename from Spigot-Server-Patches/0483-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch rename to Spigot-Server-Patches/0462-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch index 835b1f83a..5bd5b46a1 100644 --- a/Spigot-Server-Patches/0483-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch +++ b/Spigot-Server-Patches/0462-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch @@ -28,10 +28,10 @@ receives a deterministic result, and should no longer require 1 tick delays anymore. diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 64e00275edf38739fe6e2d79dbcb93243e765678..a87aa07b17205b52e85f7d082fa4d5169771cbb4 100644 +index 83a3c8d8d15f5792f5618ab301e3c9ed1c1162cd..b90d5fdd58ede1cf57e36b6f65ce259cf55615ba 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -100,6 +100,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -104,6 +104,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public double maxHealthCache; public boolean joining = true; public boolean sentListPacket = false; @@ -40,35 +40,35 @@ index 64e00275edf38739fe6e2d79dbcb93243e765678..a87aa07b17205b52e85f7d082fa4d516 // CraftBukkit end public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 48f858388029e77f710365e73905f8570f1103f5..2caa53a7e143aae32918ecbefc1bdadcab8d61ed 100644 +index 4ab719930f5b35c0ae221e9345f1e2eda7d9d719..8de86684dda275585826617b41d6792f233b814c 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -1503,6 +1503,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1535,6 +1535,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { .printStackTrace(); return; } + if (entity instanceof EntityPlayer && ((EntityPlayer) entity).supressTrackerForLogin) return; // Delay adding to tracker until after list packets // Paper end if (!(entity instanceof EntityComplexPart)) { - if (!(entity instanceof EntityLightning)) { + EntityTypes entitytypes = entity.getEntityType(); diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index ba97c48c937051adc0baa1e9acbc911575ea58d0..1c7aac029ae01afa127ca386278a4ff8520e3674 100644 +index 45fce4f08eb6f3f67306d45be407b85b3fda604b..881265d9f3f5432c0f79142abc8d6ca2f5609243 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -177,6 +177,12 @@ public abstract class PlayerList { +@@ -200,6 +200,12 @@ public abstract class PlayerList { this.j.put(entityplayer.getUniqueID(), entityplayer); // this.sendAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, new EntityPlayer[]{entityplayer})); // CraftBukkit - replaced with loop below + // Paper start - correctly register player BEFORE PlayerJoinEvent, so the entity is valid and doesn't require tick delay hacks + entityplayer.supressTrackerForLogin = true; -+ worldserver.addPlayerJoin(entityplayer); ++ worldserver1.addPlayerJoin(entityplayer); + this.server.getBossBattleCustomData().a(entityplayer); // see commented out section below worldserver.addPlayerJoin(entityplayer); -+ mountSavedVehicle(entityplayer, worldserver, nbttagcompound); ++ mountSavedVehicle(entityplayer, worldserver1, nbttagcompound); + // Paper end // CraftBukkit start PlayerJoinEvent playerJoinEvent = new PlayerJoinEvent(cserver.getPlayer(entityplayer), joinMessage); cserver.getPluginManager().callEvent(playerJoinEvent); -@@ -211,6 +217,8 @@ public abstract class PlayerList { +@@ -234,6 +240,8 @@ public abstract class PlayerList { entityplayer.playerConnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, new EntityPlayer[] { entityplayer1})); } entityplayer.sentListPacket = true; @@ -77,26 +77,26 @@ index ba97c48c937051adc0baa1e9acbc911575ea58d0..1c7aac029ae01afa127ca386278a4ff8 // CraftBukkit end entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityMetadata(entityplayer.getId(), entityplayer.datawatcher, true)); // CraftBukkit - BungeeCord#2321, send complete data to self on spawn -@@ -236,6 +244,11 @@ public abstract class PlayerList { +@@ -259,6 +267,11 @@ public abstract class PlayerList { playerconnection.sendPacket(new PacketPlayOutEntityEffect(entityplayer.getId(), mobeffect)); } + // Paper start - move vehicle into method so it can be called above - short circuit around that code -+ onPlayerJoinFinish(entityplayer, worldserver, s1); ++ onPlayerJoinFinish(entityplayer, worldserver1, s1); + } -+ private void mountSavedVehicle(EntityPlayer entityplayer, WorldServer worldserver, NBTTagCompound nbttagcompound) { ++ private void mountSavedVehicle(EntityPlayer entityplayer, WorldServer worldserver1, NBTTagCompound nbttagcompound) { + // Paper end if (nbttagcompound != null && nbttagcompound.hasKeyOfType("RootVehicle", 10)) { NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("RootVehicle"); // CraftBukkit start -@@ -277,6 +290,10 @@ public abstract class PlayerList { +@@ -307,6 +320,10 @@ public abstract class PlayerList { } } + // Paper start + } -+ public void onPlayerJoinFinish(EntityPlayer entityplayer, WorldServer worldserver, String s1) { ++ public void onPlayerJoinFinish(EntityPlayer entityplayer, WorldServer worldserver1, String s1) { + // Paper end entityplayer.syncInventory(); // Paper start - Add to collideRule team if needed - final Scoreboard scoreboard = this.getServer().getWorldServer(DimensionManager.OVERWORLD).getScoreboard(); + final Scoreboard scoreboard = this.getServer().getWorldServer(World.OVERWORLD).getScoreboard(); diff --git a/Spigot-Server-Patches/0484-Load-Chunks-for-Login-Asynchronously.patch b/Spigot-Server-Patches/0463-Load-Chunks-for-Login-Asynchronously.patch similarity index 76% rename from Spigot-Server-Patches/0484-Load-Chunks-for-Login-Asynchronously.patch rename to Spigot-Server-Patches/0463-Load-Chunks-for-Login-Asynchronously.patch index 2d0d6beed..658675ac1 100644 --- a/Spigot-Server-Patches/0484-Load-Chunks-for-Login-Asynchronously.patch +++ b/Spigot-Server-Patches/0463-Load-Chunks-for-Login-Asynchronously.patch @@ -4,32 +4,45 @@ Date: Sun, 19 Apr 2020 04:28:29 -0400 Subject: [PATCH] Load Chunks for Login Asynchronously +diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java +index 0080a0cbe58d1a81c434ef97659428c8bf1ec290..eebd4c50a7324250d3ebe7060739a71af4243f72 100644 +--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java +@@ -604,7 +604,7 @@ public class ChunkProviderServer extends IChunkProvider { + return this.serverThreadQueue.executeNext(); + } + +- private boolean tickDistanceManager() { ++ public boolean tickDistanceManager() { // Paper - private -> public + boolean flag = this.chunkMapDistance.a(this.playerChunkMap); + boolean flag1 = this.playerChunkMap.b(); + diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index f20f798f0f7bb765ffdab8672f4bf77a60fa52d2..9eab570e48817e18d10ddde95b3f80f7e4ea4766 100644 +index a0249d7a60c1381ebd7131d735a73fa2e9250543..561610ee1a99c781ccabd600812a0d10cd4ba785 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -1384,7 +1384,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -1326,7 +1326,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke this.pitch = MathHelper.a(f1, -90.0F, 90.0F) % 360.0F; this.lastYaw = this.yaw; this.lastPitch = this.pitch; -- world.getChunkAt((int) Math.floor(this.locX) >> 4, (int) Math.floor(this.locZ) >> 4); // CraftBukkit -+ if (valid) world.getChunkAt((int) Math.floor(this.locX) >> 4, (int) Math.floor(this.locZ) >> 4); // CraftBukkit // Paper +- world.getChunkAt((int) Math.floor(this.locX()) >> 4, (int) Math.floor(this.locZ()) >> 4); // CraftBukkit ++ if (valid) world.getChunkAt((int) Math.floor(this.locX()) >> 4, (int) Math.floor(this.locZ()) >> 4); // CraftBukkit // Paper } - public void setPositionRotation(BlockPosition blockposition, float f, float f1) { + public void c(Vec3D vec3d) { diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index a87aa07b17205b52e85f7d082fa4d5169771cbb4..79c2187b7383336e7574709e6d4ad805e557976f 100644 +index b90d5fdd58ede1cf57e36b6f65ce259cf55615ba..658f5d8515db84a55d9cea092163feac596ea956 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -43,6 +43,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + private static final Logger LOGGER = LogManager.getLogger(); - public String locale = null; // CraftBukkit - lowercase // Paper - default to null public PlayerConnection playerConnection; + public NetworkManager networkManager; // Paper public final MinecraftServer server; public final PlayerInteractManager playerInteractManager; public final Deque removeQueue = new ArrayDeque<>(); // Paper -@@ -101,6 +102,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -105,6 +106,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public boolean joining = true; public boolean sentListPacket = false; public boolean supressTrackerForLogin = false; // Paper @@ -38,14 +51,14 @@ index a87aa07b17205b52e85f7d082fa4d5169771cbb4..79c2187b7383336e7574709e6d4ad805 // CraftBukkit end public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java -index f1222fcb2bd52b8781d0f92c94e1472fa7b1e493..28f48f22522ef8c3c66381abcf017f0859b45290 100644 +index 50163f7291474062bde81631c9220e8a9f5bb718..ebab6961b752ca0b1c1b28f85abb33c7b4d70e3c 100644 --- a/src/main/java/net/minecraft/server/LoginListener.java +++ b/src/main/java/net/minecraft/server/LoginListener.java @@ -66,7 +66,7 @@ public class LoginListener implements PacketLoginInListener { } // Paper end } else if (this.g == LoginListener.EnumProtocolState.DELAY_ACCEPT) { -- EntityPlayer entityplayer = this.server.getPlayerList().a(this.i.getId()); +- EntityPlayer entityplayer = this.server.getPlayerList().getPlayer(this.i.getId()); + EntityPlayer entityplayer = this.server.getPlayerList().getActivePlayer(this.i.getId()); // Paper if (entityplayer == null) { @@ -54,13 +67,13 @@ index f1222fcb2bd52b8781d0f92c94e1472fa7b1e493..28f48f22522ef8c3c66381abcf017f08 } this.networkManager.sendPacket(new PacketLoginOutSuccess(this.i)); -- EntityPlayer entityplayer = this.server.getPlayerList().a(this.i.getId()); +- EntityPlayer entityplayer = this.server.getPlayerList().getPlayer(this.i.getId()); + EntityPlayer entityplayer = this.server.getPlayerList().getActivePlayer(this.i.getId()); // Paper if (entityplayer != null) { this.g = LoginListener.EnumProtocolState.DELAY_ACCEPT; diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 4be93d12dbe12511628fd97af52d5cf78da17eaa..6dd4303c1c211ac4b0bb542ea96cc150581bf8c1 100644 +index 6faa8764d19f3e58808de9dc84145f765c8958a8..22ded747e9e8683faa17924149f9b279752e47ea 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -69,6 +69,7 @@ public class PlayerConnection implements PacketListenerPlayIn { @@ -97,18 +110,10 @@ index 4be93d12dbe12511628fd97af52d5cf78da17eaa..6dd4303c1c211ac4b0bb542ea96cc150 this.minecraftServer.getMethodProfiler().enter("keepAlive"); // Paper Start - give clients a longer time to respond to pings as per pre 1.12.2 timings diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index d9fff5836e6f4b8a14fea1db66c5a89b43b2b952..628327e1e39299bbe64dff042d0187a9f79203a8 100644 +index 881265d9f3f5432c0f79142abc8d6ca2f5609243..3d110c998f6b28e55055637bbfeff6f2ebdb2747 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -16,6 +16,7 @@ import java.util.Map; - import java.util.Optional; - import java.util.Set; - import java.util.UUID; -+import java.util.concurrent.CompletableFuture; - import javax.annotation.Nullable; - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; -@@ -52,11 +53,12 @@ public abstract class PlayerList { +@@ -54,11 +54,12 @@ public abstract class PlayerList { private static final SimpleDateFormat g = new SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss z"); private final MinecraftServer server; public final List players = new java.util.concurrent.CopyOnWriteArrayList(); // CraftBukkit - ArrayList -> CopyOnWriteArrayList: Iterator safety @@ -122,7 +127,7 @@ index d9fff5836e6f4b8a14fea1db66c5a89b43b2b952..628327e1e39299bbe64dff042d0187a9 // CraftBukkit start // private final Map o; // private final Map p; -@@ -94,6 +96,11 @@ public abstract class PlayerList { +@@ -97,6 +98,11 @@ public abstract class PlayerList { } public void a(NetworkManager networkmanager, EntityPlayer entityplayer) { @@ -134,33 +139,33 @@ index d9fff5836e6f4b8a14fea1db66c5a89b43b2b952..628327e1e39299bbe64dff042d0187a9 entityplayer.loginTime = System.currentTimeMillis(); // Paper GameProfile gameprofile = entityplayer.getProfile(); UserCache usercache = this.server.getUserCache(); -@@ -107,7 +114,7 @@ public abstract class PlayerList { +@@ -110,7 +116,7 @@ public abstract class PlayerList { if (nbttagcompound != null && nbttagcompound.hasKey("bukkit")) { NBTTagCompound bukkit = nbttagcompound.getCompound("bukkit"); s = bukkit.hasKeyOfType("lastKnownName", 8) ? bukkit.getString("lastKnownName") : s; - } + }String lastKnownName = s; // Paper - if (nbttagcompound == null) entityplayer.moveToSpawn(worldserver); // Paper - only move to spawn on first login, otherwise, stay where you are.... // CraftBukkit end -@@ -160,6 +167,52 @@ public abstract class PlayerList { + if (nbttagcompound != null) { +@@ -183,6 +189,51 @@ public abstract class PlayerList { entityplayer.B().a(entityplayer); - this.sendScoreboard(worldserver.getScoreboard(), entityplayer); + this.sendScoreboard(worldserver1.getScoreboard(), entityplayer); this.server.invalidatePingSample(); + // Paper start - async load spawn in chunk -+ WorldServer finalWorldserver = worldserver; ++ WorldServer finalWorldserver = worldserver1; + int chunkX = loc.getBlockX() >> 4; + int chunkZ = loc.getBlockZ() >> 4; + final ChunkCoordIntPair pos = new ChunkCoordIntPair(chunkX, chunkZ); -+ PlayerChunkMap playerChunkMap = finalWorldserver.getChunkProvider().playerChunkMap; ++ PlayerChunkMap playerChunkMap = worldserver1.getChunkProvider().playerChunkMap; + playerChunkMap.chunkDistanceManager.addTicketAtLevel(TicketType.LOGIN, pos, 31, pos.pair()); -+ worldserver.getChunkProvider().tickDistanceManager(); -+ worldserver.getChunkProvider().getChunkAtAsynchronously(chunkX, chunkZ, true, true).thenApply(chunk -> { ++ worldserver1.getChunkProvider().tickDistanceManager(); ++ worldserver1.getChunkProvider().getChunkAtAsynchronously(chunkX, chunkZ, true, true).thenApply(chunk -> { + PlayerChunk updatingChunk = playerChunkMap.getUpdatingChunk(pos.pair()); + if (updatingChunk != null) { + return updatingChunk.getEntityTickingFuture(); + } else { -+ return CompletableFuture.completedFuture(chunk); ++ return java.util.concurrent.CompletableFuture.completedFuture(chunk); + } + }).thenAccept(chunk -> { + playerconnection.playerJoinReady = () -> { @@ -168,7 +173,6 @@ index d9fff5836e6f4b8a14fea1db66c5a89b43b2b952..628327e1e39299bbe64dff042d0187a9 + entityplayer, finalWorldserver, networkmanager, playerconnection, + nbttagcompound, networkmanager.getSocketAddress().toString(), lastKnownName + ); -+ //playerChunkMap.chunkDistanceManager.removeTicketAtLevel(TicketType.LOGIN, pos, 31, pos.pair()); + }; + }); + } @@ -186,7 +190,7 @@ index d9fff5836e6f4b8a14fea1db66c5a89b43b2b952..628327e1e39299bbe64dff042d0187a9 + }); + } + -+ private void postChunkLoadJoin(EntityPlayer entityplayer, WorldServer worldserver, NetworkManager networkmanager, PlayerConnection playerconnection, NBTTagCompound nbttagcompound, String s1, String s) { ++ private void postChunkLoadJoin(EntityPlayer entityplayer, WorldServer worldserver1, NetworkManager networkmanager, PlayerConnection playerconnection, NBTTagCompound nbttagcompound, String s1, String s) { + pendingPlayers.remove(entityplayer.getUniqueID(), entityplayer); + if (!networkmanager.isConnected()) { + return; @@ -196,23 +200,7 @@ index d9fff5836e6f4b8a14fea1db66c5a89b43b2b952..628327e1e39299bbe64dff042d0187a9 ChatMessage chatmessage; if (entityplayer.getProfile().getName().equalsIgnoreCase(s)) { -@@ -218,7 +271,6 @@ public abstract class PlayerList { - } - entityplayer.sentListPacket = true; - entityplayer.supressTrackerForLogin = false; // Paper -- ((WorldServer)entityplayer.world).getChunkProvider().playerChunkMap.addEntity(entityplayer); // Paper - track entity now - // CraftBukkit end - - entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityMetadata(entityplayer.getId(), entityplayer.datawatcher, true)); // CraftBukkit - BungeeCord#2321, send complete data to self on spawn -@@ -245,6 +297,7 @@ public abstract class PlayerList { - } - - // Paper start - move vehicle into method so it can be called above - short circuit around that code -+ ((WorldServer)entityplayer.world).getChunkProvider().playerChunkMap.addEntity(entityplayer); // track entity now - onPlayerJoinFinish(entityplayer, worldserver, s1); - } - private void mountSavedVehicle(EntityPlayer entityplayer, WorldServer worldserver, NBTTagCompound nbttagcompound) { -@@ -390,6 +443,7 @@ public abstract class PlayerList { +@@ -419,6 +470,7 @@ public abstract class PlayerList { protected void savePlayerFile(EntityPlayer entityplayer) { if (!entityplayer.getBukkitEntity().isPersistent()) return; // CraftBukkit @@ -220,7 +208,7 @@ index d9fff5836e6f4b8a14fea1db66c5a89b43b2b952..628327e1e39299bbe64dff042d0187a9 this.playerFileData.save(entityplayer); ServerStatisticManager serverstatisticmanager = (ServerStatisticManager) entityplayer.getStatisticManager(); // CraftBukkit -@@ -414,7 +468,7 @@ public abstract class PlayerList { +@@ -443,7 +495,7 @@ public abstract class PlayerList { entityplayer.closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.DISCONNECT); // Paper PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(cserver.getPlayer(entityplayer), "\u00A7e" + entityplayer.getName() + " left the game"); @@ -229,7 +217,7 @@ index d9fff5836e6f4b8a14fea1db66c5a89b43b2b952..628327e1e39299bbe64dff042d0187a9 entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage()); if (server.isMainThread()) entityplayer.playerTick(); // SPIGOT-924 // Paper - don't tick during emergency shutdowns (Watchdog) -@@ -466,6 +520,13 @@ public abstract class PlayerList { +@@ -496,6 +548,13 @@ public abstract class PlayerList { // this.p.remove(uuid); // CraftBukkit end } @@ -242,8 +230,8 @@ index d9fff5836e6f4b8a14fea1db66c5a89b43b2b952..628327e1e39299bbe64dff042d0187a9 + // Paper end // CraftBukkit start - // this.sendAll(new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, new EntityPlayer[]{entityplayer})); -@@ -483,7 +544,7 @@ public abstract class PlayerList { + // this.sendAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, new EntityPlayer[]{entityplayer})); +@@ -513,7 +572,7 @@ public abstract class PlayerList { cserver.getScoreboardManager().removePlayer(entityplayer.getBukkitEntity()); // CraftBukkit end @@ -252,7 +240,7 @@ index d9fff5836e6f4b8a14fea1db66c5a89b43b2b952..628327e1e39299bbe64dff042d0187a9 } // CraftBukkit start - Whole method, SocketAddress to LoginListener, added hostname to signature, return EntityPlayer -@@ -502,6 +563,13 @@ public abstract class PlayerList { +@@ -532,6 +591,13 @@ public abstract class PlayerList { list.add(entityplayer); } } diff --git a/Spigot-Server-Patches/0485-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch b/Spigot-Server-Patches/0464-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch similarity index 65% rename from Spigot-Server-Patches/0485-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch rename to Spigot-Server-Patches/0464-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch index 3e1193387..44d9b275b 100644 --- a/Spigot-Server-Patches/0485-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch +++ b/Spigot-Server-Patches/0464-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch @@ -7,21 +7,21 @@ The code following this has better support for null worlds to move them back to the world spawn. diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 9eab570e48817e18d10ddde95b3f80f7e4ea4766..0a7e4449407104fe6c0ff7d00bd1f32eb074e10a 100644 +index 561610ee1a99c781ccabd600812a0d10cd4ba785..f31f4fdecc824b27afefc79d1791a293227cbc9c 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -1792,9 +1792,11 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -1754,9 +1754,11 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke bworld = server.getWorld(worldName); } - if (bworld == null) { -- bworld = ((org.bukkit.craftbukkit.CraftServer) server).getServer().getWorldServer(DimensionManager.OVERWORLD).getWorld(); +- bworld = ((org.bukkit.craftbukkit.CraftServer) server).getServer().getWorldServer(World.OVERWORLD).getWorld(); - } + // Paper start - Move player to spawn point if spawn in unloaded world -+ // if (bworld == null) { -+ // bworld = ((org.bukkit.craftbukkit.CraftServer) server).getServer().getWorldServer(DimensionManager.OVERWORLD).getWorld(); -+ // } -+ // Paper end ++// if (bworld == null) { ++// bworld = ((org.bukkit.craftbukkit.CraftServer) server).getServer().getWorldServer(World.OVERWORLD).getWorld(); ++// } ++ // Paper end - Move player to spawn point if spawn in unloaded world spawnIn(bworld == null ? null : ((CraftWorld) bworld).getHandle()); } diff --git a/Spigot-Server-Patches/0487-Add-PlayerAttackEntityCooldownResetEvent.patch b/Spigot-Server-Patches/0465-Add-PlayerAttackEntityCooldownResetEvent.patch similarity index 81% rename from Spigot-Server-Patches/0487-Add-PlayerAttackEntityCooldownResetEvent.patch rename to Spigot-Server-Patches/0465-Add-PlayerAttackEntityCooldownResetEvent.patch index f5ba23a12..6559567b4 100644 --- a/Spigot-Server-Patches/0487-Add-PlayerAttackEntityCooldownResetEvent.patch +++ b/Spigot-Server-Patches/0465-Add-PlayerAttackEntityCooldownResetEvent.patch @@ -5,14 +5,14 @@ Subject: [PATCH] Add PlayerAttackEntityCooldownResetEvent diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 2c81344a65bf230a6ba09deb2a3bb45881144a39..3fc2360a103a5399f2878eccb0c13eb6e41e824d 100644 +index 40ac2b8153dbbb10b732123f95b9c0a3a807e54e..7a2140e4b901027997b2884275b35b43fe2175bc 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -1690,7 +1690,17 @@ public abstract class EntityLiving extends Entity { +@@ -1825,7 +1825,16 @@ public abstract class EntityLiving extends Entity { EntityDamageEvent event = CraftEventFactory.handleLivingEntityDamageEvent(this, damagesource, originalDamage, hardHatModifier, blockingModifier, armorModifier, resistanceModifier, magicModifier, absorptionModifier, hardHat, blocking, armor, resistance, magic, absorption); if (damagesource.getEntity() instanceof EntityHuman) { -- ((EntityHuman) damagesource.getEntity()).ey(); // Moved from EntityHuman in order to make the cooldown reset get called after the damage event is fired +- ((EntityHuman) damagesource.getEntity()).resetAttackCooldown(); // Moved from EntityHuman in order to make the cooldown reset get called after the damage event is fired + // Paper start - PlayerAttackEntityCooldownResetEvent + if (damagesource.getEntity() instanceof EntityPlayer) { + EntityPlayer player = (EntityPlayer) damagesource.getEntity(); @@ -23,7 +23,6 @@ index 2c81344a65bf230a6ba09deb2a3bb45881144a39..3fc2360a103a5399f2878eccb0c13eb6 + ((EntityHuman) damagesource.getEntity()).resetCooldown(); + } + // Paper end -+ } if (event.isCancelled()) { return false; diff --git a/Spigot-Server-Patches/0488-Allow-multiple-callbacks-to-schedule-for-Callback-Ex.patch b/Spigot-Server-Patches/0466-Allow-multiple-callbacks-to-schedule-for-Callback-Ex.patch similarity index 93% rename from Spigot-Server-Patches/0488-Allow-multiple-callbacks-to-schedule-for-Callback-Ex.patch rename to Spigot-Server-Patches/0466-Allow-multiple-callbacks-to-schedule-for-Callback-Ex.patch index b2f5e2274..fa113669a 100644 --- a/Spigot-Server-Patches/0488-Allow-multiple-callbacks-to-schedule-for-Callback-Ex.patch +++ b/Spigot-Server-Patches/0466-Allow-multiple-callbacks-to-schedule-for-Callback-Ex.patch @@ -14,10 +14,10 @@ Use an ArrayDeque to store this Queue We make sure to also implement a pattern that is recursion safe too. diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 2caa53a7e143aae32918ecbefc1bdadcab8d61ed..3f1a5e48676d1b4b01fbbc25fc9c9cf556cbf0eb 100644 +index 8de86684dda275585826617b41d6792f233b814c..850602a32d371bd030665732b762b4bcbd49e25e 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -110,24 +110,32 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -112,24 +112,32 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { public final CallbackExecutor callbackExecutor = new CallbackExecutor(); public static final class CallbackExecutor implements java.util.concurrent.Executor, Runnable { diff --git a/Spigot-Server-Patches/0467-Don-t-fire-BlockFade-on-worldgen-threads.patch b/Spigot-Server-Patches/0467-Don-t-fire-BlockFade-on-worldgen-threads.patch new file mode 100644 index 000000000..31efcfdd5 --- /dev/null +++ b/Spigot-Server-Patches/0467-Don-t-fire-BlockFade-on-worldgen-threads.patch @@ -0,0 +1,28 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Thu, 23 Apr 2020 01:36:39 -0400 +Subject: [PATCH] Don't fire BlockFade on worldgen threads + +Caused a deadlock + +diff --git a/src/main/java/net/minecraft/server/BlockFire.java b/src/main/java/net/minecraft/server/BlockFire.java +index a11a775a929c5f868f1b84c56d7e1715a91db236..a8875a9a5fa6b285b41f3de1bc81c44f35ea5cce 100644 +--- a/src/main/java/net/minecraft/server/BlockFire.java ++++ b/src/main/java/net/minecraft/server/BlockFire.java +@@ -35,6 +35,7 @@ public class BlockFire extends BlockFireAbstract { + @Override + public IBlockData updateState(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) { + // CraftBukkit start ++ if (!(generatoraccess instanceof WorldServer)) return this.canPlace(iblockdata, generatoraccess, blockposition) ? (IBlockData) this.a(generatoraccess, blockposition, (Integer) iblockdata.get(BlockFire.AGE)) : Blocks.AIR.getBlockData(); // Paper - don't fire events in world generation + if (!this.canPlace(iblockdata, generatoraccess, blockposition)) { + // Suppress during worldgen + if (!(generatoraccess instanceof World)) { +@@ -50,7 +51,7 @@ public class BlockFire extends BlockFireAbstract { + return blockState.getHandle(); + } + } +- return this.a(generatoraccess, blockposition, (Integer) iblockdata.get(BlockFire.AGE)); ++ return this.a(generatoraccess, blockposition, (Integer) iblockdata.get(BlockFire.AGE)); // Paper - diff on change, see "don't fire events in world generation" + // CraftBukkit end + } + diff --git a/Spigot-Server-Patches/0490-Add-phantom-creative-and-insomniac-controls.patch b/Spigot-Server-Patches/0468-Add-phantom-creative-and-insomniac-controls.patch similarity index 74% rename from Spigot-Server-Patches/0490-Add-phantom-creative-and-insomniac-controls.patch rename to Spigot-Server-Patches/0468-Add-phantom-creative-and-insomniac-controls.patch index 723b5b1a2..1b5e3e7a3 100644 --- a/Spigot-Server-Patches/0490-Add-phantom-creative-and-insomniac-controls.patch +++ b/Spigot-Server-Patches/0468-Add-phantom-creative-and-insomniac-controls.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add phantom creative and insomniac controls diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index ea5f306ef57fe5958a554f4bdf866a36d2b185e0..9db76eae1649fe2ce0856ff4bdcb15569bf58d93 100644 +index 08949526752e4d66e4c0df11f76f6500846e1fe4..13b89276feb76fcecaeefc166a1bc161d5931d9d 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -670,4 +670,11 @@ public class PaperWorldConfig { +@@ -622,4 +622,11 @@ public class PaperWorldConfig { private void lightQueueSize() { lightQueueSize = getInt("light-queue-size", lightQueueSize); } @@ -21,10 +21,10 @@ index ea5f306ef57fe5958a554f4bdf866a36d2b185e0..9db76eae1649fe2ce0856ff4bdcb1556 + } } diff --git a/src/main/java/net/minecraft/server/EntityPhantom.java b/src/main/java/net/minecraft/server/EntityPhantom.java -index 90eeddb1af59126ea7ca19c2cc909da72578fb6c..96b4912c4832bee0337d35cb23e574cd02f64c3b 100644 +index 47d82722e15c5b91a86af1a09807ccc37a1b37be..3cb78924daa48c3a0a3e5c9c64ef6e726d79a798 100644 --- a/src/main/java/net/minecraft/server/EntityPhantom.java +++ b/src/main/java/net/minecraft/server/EntityPhantom.java -@@ -232,6 +232,7 @@ public class EntityPhantom extends EntityFlying implements IMonster { +@@ -225,6 +225,7 @@ public class EntityPhantom extends EntityFlying implements IMonster { EntityHuman entityhuman = (EntityHuman) iterator.next(); if (EntityPhantom.this.a((EntityLiving) entityhuman, PathfinderTargetCondition.a)) { @@ -33,27 +33,27 @@ index 90eeddb1af59126ea7ca19c2cc909da72578fb6c..96b4912c4832bee0337d35cb23e574cd return true; } diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java -index a2d1ef3602a1c63d106d10140e18dfdb1d490805..1398c47a2f8b183b65f1553c735c3b183a8bfc9c 100644 +index 57bc56cffff87d9b1774cec455af8d1651fb882c..a52dd0c021e264a57a62bde27ea9d2a6a97e2335 100644 --- a/src/main/java/net/minecraft/server/IEntitySelector.java +++ b/src/main/java/net/minecraft/server/IEntitySelector.java -@@ -23,6 +23,7 @@ public final class IEntitySelector { - public static final Predicate f = (entity) -> { +@@ -26,6 +26,7 @@ public final class IEntitySelector { + public static final Predicate g = (entity) -> { return !entity.isSpectator(); }; + public static Predicate isInsomniac = (player) -> MathHelper.clamp(((EntityPlayer) player).getStatisticManager().getStatisticValue(StatisticList.CUSTOM.get(StatisticList.TIME_SINCE_REST)), 1, Integer.MAX_VALUE) >= 72000; // Paper - public static Predicate a(double d0, double d1, double d2, double d3) { - double d4 = d3 * d3; + // Paper start + public static final Predicate affectsSpawning = (entity) -> { diff --git a/src/main/java/net/minecraft/server/MobSpawnerPhantom.java b/src/main/java/net/minecraft/server/MobSpawnerPhantom.java -index f488c22ed64a9fa1ce7746942b2a9ff4bc296703..0db431cd6add225304af48a73e1aa732b4c3ae58 100644 +index 39c5350373f6a5ad30f41e8886573d6b315924c6..bf4fa17101cb8710d8b8ba8ad43f98b6fe154ae1 100644 --- a/src/main/java/net/minecraft/server/MobSpawnerPhantom.java +++ b/src/main/java/net/minecraft/server/MobSpawnerPhantom.java -@@ -31,7 +31,7 @@ public class MobSpawnerPhantom { +@@ -32,7 +32,7 @@ public class MobSpawnerPhantom implements MobSpawner { while (iterator.hasNext()) { EntityHuman entityhuman = (EntityHuman) iterator.next(); - if (!entityhuman.isSpectator()) { + if (!entityhuman.isSpectator() && (!worldserver.paperConfig.phantomIgnoreCreative || !entityhuman.isCreative())) { // Paper - BlockPosition blockposition = new BlockPosition(entityhuman); + BlockPosition blockposition = entityhuman.getChunkCoordinates(); - if (!worldserver.worldProvider.f() || blockposition.getY() >= worldserver.getSeaLevel() && worldserver.f(blockposition)) { + if (!worldserver.getDimensionManager().hasSkyLight() || blockposition.getY() >= worldserver.getSeaLevel() && worldserver.f(blockposition)) { diff --git a/Spigot-Server-Patches/0491-Fix-numerous-item-duplication-issues-and-teleport-is.patch b/Spigot-Server-Patches/0469-Fix-numerous-item-duplication-issues-and-teleport-is.patch similarity index 84% rename from Spigot-Server-Patches/0491-Fix-numerous-item-duplication-issues-and-teleport-is.patch rename to Spigot-Server-Patches/0469-Fix-numerous-item-duplication-issues-and-teleport-is.patch index fd2e4bff8..83264e8f0 100644 --- a/Spigot-Server-Patches/0491-Fix-numerous-item-duplication-issues-and-teleport-is.patch +++ b/Spigot-Server-Patches/0469-Fix-numerous-item-duplication-issues-and-teleport-is.patch @@ -16,10 +16,10 @@ So even if something NEW comes up, it would be impossible to drop the same item twice because the source was destroyed. diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 0a7e4449407104fe6c0ff7d00bd1f32eb074e10a..32daf027a3575d73aeabf9db14a2e0c74e4cc7e6 100644 +index f31f4fdecc824b27afefc79d1791a293227cbc9c..449a687399f38d3ef79685ff80531cf1212f054a 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java -@@ -1968,11 +1968,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -1910,11 +1910,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke } else { // CraftBukkit start - Capture drops for death event if (this instanceof EntityLiving && !((EntityLiving) this).forceDrops) { @@ -34,20 +34,20 @@ index 0a7e4449407104fe6c0ff7d00bd1f32eb074e10a..32daf027a3575d73aeabf9db14a2e0c7 entityitem.defaultPickupDelay(); // CraftBukkit start -@@ -2635,6 +2636,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -2565,6 +2566,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @Nullable - public Entity teleportTo(DimensionManager dimensionmanager, BlockPosition location) { + public Entity teleportTo(WorldServer worldserver, BlockPosition location) { // CraftBukkit end + // Paper start - fix bad state entities causing dupes + if (!isAlive() || !valid) { -+ LOGGER.warn("Illegal Entity Teleport " + this + " to " + dimensionmanager + ":" + location, new Throwable()); ++ LOGGER.warn("Illegal Entity Teleport " + this + " to " + worldserver + ":" + location, new Throwable()); + return null; + } + // Paper end - if (!this.world.isClientSide && !this.dead) { + if (this.world instanceof WorldServer && !this.dead) { this.world.getMethodProfiler().enter("changeDimension"); - MinecraftServer minecraftserver = this.getMinecraftServer(); -@@ -2743,7 +2750,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke + // CraftBukkit start +@@ -2668,7 +2675,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke entity.bukkitEntity = this.getBukkitEntity(); if (this instanceof EntityInsentient) { @@ -56,7 +56,7 @@ index 0a7e4449407104fe6c0ff7d00bd1f32eb074e10a..32daf027a3575d73aeabf9db14a2e0c7 } // CraftBukkit end } -@@ -2760,7 +2767,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -2689,7 +2696,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke } public boolean canPortal() { @@ -66,7 +66,7 @@ index 0a7e4449407104fe6c0ff7d00bd1f32eb074e10a..32daf027a3575d73aeabf9db14a2e0c7 public float a(Explosion explosion, IBlockAccess iblockaccess, BlockPosition blockposition, IBlockData iblockdata, Fluid fluid, float f) { diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java -index 8ad131e4fc20efc61b938a5f6ab64379da23bf0d..d35a0b2d94e4f52c257375c35f55b5a41c9f2c12 100644 +index 51e9f4a6e09474a7489d2872a800308ee3f02e46..250bccee4a27801b41c50d59e93396c696ab6974 100644 --- a/src/main/java/net/minecraft/server/EntityArmorStand.java +++ b/src/main/java/net/minecraft/server/EntityArmorStand.java @@ -557,7 +557,7 @@ public class EntityArmorStand extends EntityLiving { @@ -75,7 +75,7 @@ index 8ad131e4fc20efc61b938a5f6ab64379da23bf0d..d35a0b2d94e4f52c257375c35f55b5a4 if (!itemstack.isEmpty()) { - drops.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(itemstack)); // CraftBukkit - add to drops + drops.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack)); // CraftBukkit - add to drops // Paper - mirror so we can destroy it later - though this call site was safe - this.handItems.set(i, ItemStack.a); + this.handItems.set(i, ItemStack.b); } } @@ -565,7 +565,7 @@ public class EntityArmorStand extends EntityLiving { @@ -84,14 +84,14 @@ index 8ad131e4fc20efc61b938a5f6ab64379da23bf0d..d35a0b2d94e4f52c257375c35f55b5a4 if (!itemstack.isEmpty()) { - drops.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(itemstack)); // CraftBukkit - add to drops + drops.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack)); // CraftBukkit - add to drops // Paper - mirror so we can destroy it later - though this call site was safe - this.armorItems.set(i, ItemStack.a); + this.armorItems.set(i, ItemStack.b); } } diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 08471184b04690653761a17d79941cd4ae8b1f81..ce8d7877adcc4635ebf2f5743c8b02aa95691102 100644 +index 36afa821dc5f04d77b6f44fe7282444ec6a7b842..6c5036b23a41769167fd53b8cc5454e5e747598e 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -777,7 +777,8 @@ public class CraftEventFactory { +@@ -803,7 +803,8 @@ public class CraftEventFactory { for (org.bukkit.inventory.ItemStack stack : event.getDrops()) { if (stack == null || stack.getType() == Material.AIR || stack.getAmount() == 0) continue; diff --git a/Spigot-Server-Patches/0492-Implement-Brigadier-Mojang-API.patch b/Spigot-Server-Patches/0470-Implement-Brigadier-Mojang-API.patch similarity index 76% rename from Spigot-Server-Patches/0492-Implement-Brigadier-Mojang-API.patch rename to Spigot-Server-Patches/0470-Implement-Brigadier-Mojang-API.patch index b4c15ac4f..249dbea43 100644 --- a/Spigot-Server-Patches/0492-Implement-Brigadier-Mojang-API.patch +++ b/Spigot-Server-Patches/0470-Implement-Brigadier-Mojang-API.patch @@ -10,10 +10,10 @@ Adds CommandRegisteredEvent - Allows manipulating the CommandNode to add more children/metadata for the client diff --git a/src/main/java/net/minecraft/server/CommandDispatcher.java b/src/main/java/net/minecraft/server/CommandDispatcher.java -index 2414b0a552e5d6fb449bca163add7a9bac39e943..2d512aa4f9ab74dfadff748ba6dd72631eda9fe5 100644 +index 1229aaf19de60f1e3ce161b5c3b7ef659d14c018..e59151d01b4710b750366a395e1e5d18caa4726f 100644 --- a/src/main/java/net/minecraft/server/CommandDispatcher.java +++ b/src/main/java/net/minecraft/server/CommandDispatcher.java -@@ -267,6 +267,7 @@ public class CommandDispatcher { +@@ -268,6 +268,7 @@ public class CommandDispatcher { bukkit.add(node.getName()); } // Paper start - Async command map building @@ -21,7 +21,7 @@ index 2414b0a552e5d6fb449bca163add7a9bac39e943..2d512aa4f9ab74dfadff748ba6dd7263 MinecraftServer.getServer().execute(() -> { runSync(entityplayer, bukkit, rootcommandnode); }); -@@ -274,6 +275,7 @@ public class CommandDispatcher { +@@ -275,6 +276,7 @@ public class CommandDispatcher { private void runSync(EntityPlayer entityplayer, Collection bukkit, RootCommandNode rootcommandnode) { // Paper end - Async command map building @@ -30,19 +30,19 @@ index 2414b0a552e5d6fb449bca163add7a9bac39e943..2d512aa4f9ab74dfadff748ba6dd7263 event.getPlayer().getServer().getPluginManager().callEvent(event); diff --git a/src/main/java/net/minecraft/server/CommandListenerWrapper.java b/src/main/java/net/minecraft/server/CommandListenerWrapper.java -index 0b23a0548d52a30c064d624e39a896a9791aab3b..c988c929f1063b417d10d84b0c13127738f63e20 100644 +index 4b6f45501106f49f118a93e5027734cdb7ff2727..fa0f247e51c20ea0e3cbaccbc8dbb2a153d6121f 100644 --- a/src/main/java/net/minecraft/server/CommandListenerWrapper.java +++ b/src/main/java/net/minecraft/server/CommandListenerWrapper.java -@@ -15,7 +15,7 @@ import java.util.function.BinaryOperator; +@@ -16,7 +16,7 @@ import java.util.function.BinaryOperator; import java.util.stream.Stream; import javax.annotation.Nullable; -public class CommandListenerWrapper implements ICompletionProvider { +public class CommandListenerWrapper implements ICompletionProvider, com.destroystokyo.paper.brigadier.BukkitBrigadierCommandSource { // Paper - public static final SimpleCommandExceptionType a = new SimpleCommandExceptionType(new ChatMessage("permissions.requires.player", new Object[0])); - public static final SimpleCommandExceptionType b = new SimpleCommandExceptionType(new ChatMessage("permissions.requires.entity", new Object[0])); -@@ -120,6 +120,25 @@ public class CommandListenerWrapper implements ICompletionProvider { + public static final SimpleCommandExceptionType a = new SimpleCommandExceptionType(new ChatMessage("permissions.requires.player")); + public static final SimpleCommandExceptionType b = new SimpleCommandExceptionType(new ChatMessage("permissions.requires.entity")); +@@ -121,6 +121,25 @@ public class CommandListenerWrapper implements ICompletionProvider { return this.g; } @@ -69,37 +69,37 @@ index 0b23a0548d52a30c064d624e39a896a9791aab3b..c988c929f1063b417d10d84b0c131277 public boolean hasPermission(int i) { // CraftBukkit start diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 08e087d952edfecd73ad698684b71c09dabbac9e..c3a86d3007c2fdc5d45f628226507b4a1c968ad6 100644 +index 22ded747e9e8683faa17924149f9b279752e47ea..daa066cbec8097b86f8b3c564e8134607e57b3cd 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -581,8 +581,12 @@ public class PlayerConnection implements PacketListenerPlayIn { - ParseResults parseresults = this.minecraftServer.getCommandDispatcher().a().parse(stringreader, this.player.getCommandListener()); +@@ -584,8 +584,12 @@ public class PlayerConnection implements PacketListenerPlayIn { + ParseResults parseresults = this.minecraftServer.getCommandDispatcher().a().parse(stringreader, this.player.getCommandListener()); - this.minecraftServer.getCommandDispatcher().a().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> { -- if (((Suggestions) suggestions).isEmpty()) return; // CraftBukkit - don't send through empty suggestions - prevents [] from showing for plugins with nothing more to offer -- this.networkManager.sendPacket(new PacketPlayOutTabComplete(packetplayintabcomplete.b(), (Suggestions) suggestions)); // CraftBukkit - decompile error -+ // Paper start -+ com.destroystokyo.paper.event.brigadier.AsyncPlayerSendSuggestionsEvent suggestEvent = new com.destroystokyo.paper.event.brigadier.AsyncPlayerSendSuggestionsEvent(this.getPlayer(), suggestions, buffer); -+ suggestEvent.setCancelled(suggestions.isEmpty()); -+ if (!suggestEvent.callEvent()) return; -+ this.networkManager.sendPacket(new PacketPlayOutTabComplete(packetplayintabcomplete.b(), (Suggestions) suggestEvent.getSuggestions())); // CraftBukkit - decompile error // Paper -+ // Paper end - }); - }); // Paper - This needs to be on main + this.minecraftServer.getCommandDispatcher().a().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> { +- if (suggestions.isEmpty()) return; // CraftBukkit - don't send through empty suggestions - prevents [] from showing for plugins with nothing more to offer +- this.networkManager.sendPacket(new PacketPlayOutTabComplete(packetplayintabcomplete.b(), suggestions)); ++ // Paper start ++ com.destroystokyo.paper.event.brigadier.AsyncPlayerSendSuggestionsEvent suggestEvent = new com.destroystokyo.paper.event.brigadier.AsyncPlayerSendSuggestionsEvent(this.getPlayer(), suggestions, buffer); ++ suggestEvent.setCancelled(suggestions.isEmpty()); ++ if (!suggestEvent.callEvent()) return; ++ this.networkManager.sendPacket(new PacketPlayOutTabComplete(packetplayintabcomplete.b(), (com.mojang.brigadier.suggestion.Suggestions) suggestEvent.getSuggestions())); // CraftBukkit - decompile error // Paper ++ // Paper end + }); + }); } -@@ -592,7 +596,11 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -594,7 +598,11 @@ public class PlayerConnection implements PacketListenerPlayIn { builder = builder.createOffset(builder.getInput().lastIndexOf(' ') + 1); completions.forEach(builder::suggest); - player.playerConnection.sendPacket(new PacketPlayOutTabComplete(packetplayintabcomplete.b(), builder.buildFuture().join())); -+ Suggestions suggestions = builder.buildFuture().join(); ++ com.mojang.brigadier.suggestion.Suggestions suggestions = builder.buildFuture().join(); + com.destroystokyo.paper.event.brigadier.AsyncPlayerSendSuggestionsEvent suggestEvent = new com.destroystokyo.paper.event.brigadier.AsyncPlayerSendSuggestionsEvent(this.getPlayer(), suggestions, buffer); + suggestEvent.setCancelled(suggestions.isEmpty()); + if (!suggestEvent.callEvent()) return; + this.networkManager.sendPacket(new PacketPlayOutTabComplete(packetplayintabcomplete.b(), suggestEvent.getSuggestions())); } // Paper end - async tab completion - + } diff --git a/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java b/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java index 5f33c9e52ac51486d4b22a6dcbfac7f46e0412bb..e16ecdea7d27424053b3f21378af054b2f808eca 100644 --- a/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java diff --git a/Spigot-Server-Patches/0471-Remove-streams-from-MinecraftKey.patch b/Spigot-Server-Patches/0471-Remove-streams-from-MinecraftKey.patch deleted file mode 100644 index 853063b15..000000000 --- a/Spigot-Server-Patches/0471-Remove-streams-from-MinecraftKey.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Spottedleaf -Date: Mon, 6 Apr 2020 18:06:24 -0700 -Subject: [PATCH] Remove streams from MinecraftKey - -They produce a lot of garbage. - -diff --git a/src/main/java/net/minecraft/server/MinecraftKey.java b/src/main/java/net/minecraft/server/MinecraftKey.java -index 2b271d3e509a5450c9136dced3ad4dc4d65af45a..b1beebf0ed5737c04875bf9138624fb2bd5dff27 100644 ---- a/src/main/java/net/minecraft/server/MinecraftKey.java -+++ b/src/main/java/net/minecraft/server/MinecraftKey.java -@@ -125,15 +125,29 @@ public class MinecraftKey implements Comparable { - } - - private static boolean c(String s) { -- return s.chars().allMatch((i) -> { -- return i == 95 || i == 45 || i >= 97 && i <= 122 || i >= 48 && i <= 57 || i == 47 || i == 46; -- }); -+ // Paper start - remove streams -+ for (int index = 0, len = s.length(); index < len; ++index) { -+ int i = (int)s.charAt(index); -+ boolean condition = i == 95 || i == 45 || i >= 97 && i <= 122 || i >= 48 && i <= 57 || i == 47 || i == 46; // this is copied from the replaced code. -+ if (!condition) { -+ return false; -+ } -+ } -+ return true; -+ // Paper end - remove streams - } - - private static boolean d(String s) { -- return s.chars().allMatch((i) -> { -- return i == 95 || i == 45 || i >= 97 && i <= 122 || i >= 48 && i <= 57 || i == 46; -- }); -+ // Paper start - remove streams -+ for (int index = 0, len = s.length(); index < len; ++index) { -+ int i = (int)s.charAt(index); -+ boolean condition = i == 95 || i == 45 || i >= 97 && i <= 122 || i >= 48 && i <= 57 || i == 46; // this is copied from the replaced code. -+ if (!condition) { -+ return false; -+ } -+ } -+ return true; -+ // Paper end - remove streams - } - - public static class a implements JsonDeserializer, JsonSerializer { diff --git a/Spigot-Server-Patches/0471-Villager-Restocks-API.patch b/Spigot-Server-Patches/0471-Villager-Restocks-API.patch new file mode 100644 index 000000000..6353e61e2 --- /dev/null +++ b/Spigot-Server-Patches/0471-Villager-Restocks-API.patch @@ -0,0 +1,42 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: zbk +Date: Sun, 26 Apr 2020 23:49:01 -0400 +Subject: [PATCH] Villager Restocks API + + +diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java +index 8d3811ead268635c4b728f5c9b8dd6c9b8ec6124..9f28c7e4bd70abc280a8cf3cbf5ccc84246aff12 100644 +--- a/src/main/java/net/minecraft/server/EntityVillager.java ++++ b/src/main/java/net/minecraft/server/EntityVillager.java +@@ -44,7 +44,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation + private long bH; + private int bI; + private long bJ; +- private int bK; ++ private int bK; public int getRestocksToday(){ return this.bK; } public void setRestocksToday(int restocksToday){ this.bK = restocksToday; } // Paper OBFHELPER + private long bL; + private boolean bM; + private static final ImmutableList> bN = ImmutableList.of(MemoryModuleType.HOME, MemoryModuleType.JOB_SITE, MemoryModuleType.POTENTIAL_JOB_SITE, MemoryModuleType.MEETING_POINT, MemoryModuleType.MOBS, MemoryModuleType.VISIBLE_MOBS, MemoryModuleType.VISIBLE_VILLAGER_BABIES, MemoryModuleType.NEAREST_PLAYERS, MemoryModuleType.NEAREST_VISIBLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_TARGETABLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_WANTED_ITEM, MemoryModuleType.WALK_TARGET, new MemoryModuleType[]{MemoryModuleType.LOOK_TARGET, MemoryModuleType.INTERACTION_TARGET, MemoryModuleType.BREED_TARGET, MemoryModuleType.PATH, MemoryModuleType.INTERACTABLE_DOORS, MemoryModuleType.OPENED_DOORS, MemoryModuleType.NEAREST_BED, MemoryModuleType.HURT_BY, MemoryModuleType.HURT_BY_ENTITY, MemoryModuleType.NEAREST_HOSTILE, MemoryModuleType.SECONDARY_JOB_SITE, MemoryModuleType.HIDING_PLACE, MemoryModuleType.HEARD_BELL_TIME, MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE, MemoryModuleType.LAST_SLEPT, MemoryModuleType.LAST_WOKEN, MemoryModuleType.LAST_WORKED_AT_POI, MemoryModuleType.GOLEM_LAST_SEEN_TIME}); +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java +index fe726e7884c9f091d73c8f5d2cb58a87a16649f8..a8384081c03884c86578dca677914d77441c1863 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java +@@ -82,6 +82,18 @@ public class CraftVillager extends CraftAbstractVillager implements Villager { + getHandle().setExperience(experience); + } + ++ // Paper start ++ @Override ++ public int getRestocksToday() { ++ return getHandle().getRestocksToday(); ++ } ++ ++ @Override ++ public void setRestocksToday(int restocksToday) { ++ getHandle().setRestocksToday(restocksToday); ++ } ++ // Paper end ++ + @Override + public boolean sleep(Location location) { + Preconditions.checkArgument(location != null, "Location cannot be null"); diff --git a/Spigot-Server-Patches/0494-Validate-PickItem-Packet-and-kick-for-invalid.patch b/Spigot-Server-Patches/0472-Validate-PickItem-Packet-and-kick-for-invalid.patch similarity index 91% rename from Spigot-Server-Patches/0494-Validate-PickItem-Packet-and-kick-for-invalid.patch rename to Spigot-Server-Patches/0472-Validate-PickItem-Packet-and-kick-for-invalid.patch index e8c029c3a..744a212e9 100644 --- a/Spigot-Server-Patches/0494-Validate-PickItem-Packet-and-kick-for-invalid.patch +++ b/Spigot-Server-Patches/0472-Validate-PickItem-Packet-and-kick-for-invalid.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Validate PickItem Packet and kick for invalid diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index c3a86d3007c2fdc5d45f628226507b4a1c968ad6..a716f25478ba9731b7bb07f5d80c3655c8190e8b 100644 +index daa066cbec8097b86f8b3c564e8134607e57b3cd..0ece15a8457debc7d8343c894b060e81be845488 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -696,7 +696,14 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -697,7 +697,14 @@ public class PlayerConnection implements PacketListenerPlayIn { @Override public void a(PacketPlayInPickItem packetplayinpickitem) { PlayerConnectionUtils.ensureMainThread(packetplayinpickitem, this, this.player.getWorldServer()); diff --git a/Spigot-Server-Patches/0495-Expose-game-version.patch b/Spigot-Server-Patches/0473-Expose-game-version.patch similarity index 82% rename from Spigot-Server-Patches/0495-Expose-game-version.patch rename to Spigot-Server-Patches/0473-Expose-game-version.patch index 8d6ba360d..adbc9ffe6 100644 --- a/Spigot-Server-Patches/0495-Expose-game-version.patch +++ b/Spigot-Server-Patches/0473-Expose-game-version.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Expose game version diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index f49193d9d7cd9655fdedf64bebdcf4e1a9b77f2c..1647c09756ed303a3f3e879e877b5b3de639f843 100644 +index 7981f23d043142615a6a0043ba748b22532ded22..ed08106c56974bebed1a32a1c865e1169308c787 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -489,6 +489,13 @@ public final class CraftServer implements Server { +@@ -518,6 +518,13 @@ public final class CraftServer implements Server { return bukkitVersion; } diff --git a/Spigot-Server-Patches/0496-Sync-position-on-teleportation.patch b/Spigot-Server-Patches/0474-Sync-position-on-teleportation.patch similarity index 86% rename from Spigot-Server-Patches/0496-Sync-position-on-teleportation.patch rename to Spigot-Server-Patches/0474-Sync-position-on-teleportation.patch index 06ad495a7..83099f36b 100644 --- a/Spigot-Server-Patches/0496-Sync-position-on-teleportation.patch +++ b/Spigot-Server-Patches/0474-Sync-position-on-teleportation.patch @@ -13,10 +13,10 @@ it is triggering a massive movement velocity. This will ensure that the servers position is synchronized anytime player is teleported. diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index a716f25478ba9731b7bb07f5d80c3655c8190e8b..1f9d231fb93e30286205f7a0a4c898a0e153bd95 100644 +index 0ece15a8457debc7d8343c894b060e81be845488..7fd991fd3994a18625c193aeb15ed521d3b6a447 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -498,6 +498,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -501,6 +501,7 @@ public class PlayerConnection implements PacketListenerPlayIn { this.o = this.teleportPos.x; this.p = this.teleportPos.y; this.q = this.teleportPos.z; @@ -24,7 +24,7 @@ index a716f25478ba9731b7bb07f5d80c3655c8190e8b..1f9d231fb93e30286205f7a0a4c898a0 if (this.player.H()) { this.player.I(); } -@@ -1277,6 +1278,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -1300,6 +1301,7 @@ public class PlayerConnection implements PacketListenerPlayIn { this.A = this.e; this.player.setLocation(d0, d1, d2, f, f1); diff --git a/Spigot-Server-Patches/0497-Optimize-Voxel-Shape-Merging.patch b/Spigot-Server-Patches/0475-Optimize-Voxel-Shape-Merging.patch similarity index 98% rename from Spigot-Server-Patches/0497-Optimize-Voxel-Shape-Merging.patch rename to Spigot-Server-Patches/0475-Optimize-Voxel-Shape-Merging.patch index dfe8d29d4..94143e356 100644 --- a/Spigot-Server-Patches/0497-Optimize-Voxel-Shape-Merging.patch +++ b/Spigot-Server-Patches/0475-Optimize-Voxel-Shape-Merging.patch @@ -75,7 +75,7 @@ index 71d2ae2a9c5a05351241b5a313e66ca15b0624ef..232b0023773008c19f19ad4658eb40fc this.b = new IntArrayList(i1); this.c = new IntArrayList(i1); diff --git a/src/main/java/net/minecraft/server/VoxelShapes.java b/src/main/java/net/minecraft/server/VoxelShapes.java -index e641d4b8d8b4ac5d539e6d9c0eaf345601e0b499..4b3e632a8944828189bc8a5dada32913c1929286 100644 +index 4acde367542247627574fdeb586fb8c9087eef1a..aeee4f11828e54ff9e873e452e19299822b1ec86 100644 --- a/src/main/java/net/minecraft/server/VoxelShapes.java +++ b/src/main/java/net/minecraft/server/VoxelShapes.java @@ -319,9 +319,21 @@ public final class VoxelShapes { diff --git a/Spigot-Server-Patches/0498-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch b/Spigot-Server-Patches/0476-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch similarity index 91% rename from Spigot-Server-Patches/0498-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch rename to Spigot-Server-Patches/0476-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch index 50dcdc2c0..417fed798 100644 --- a/Spigot-Server-Patches/0498-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch +++ b/Spigot-Server-Patches/0476-Set-cap-on-JDK-per-thread-native-byte-buffer-cache.patch @@ -17,10 +17,10 @@ keeping long lived large direct buffers in cache. Set system properly at server startup if not set already to help protect from this. diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index e913d249d850210c9efba1bb46ce2ce4df013a62..2ea6f5b7da35cbb342e72a00ea70fef667f05d49 100644 +index 3e4454a14fdf6305b262c15cf67203854debef28..a8cd55d3c288f2f1c0f7f9392f2f08f12f69f969 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java -@@ -21,6 +21,7 @@ public class Main { +@@ -20,6 +20,7 @@ public class Main { public static void main(String[] args) { // Todo: Installation script diff --git a/Spigot-Server-Patches/0499-Implement-Mob-Goal-API.patch b/Spigot-Server-Patches/0477-Implement-Mob-Goal-API.patch similarity index 94% rename from Spigot-Server-Patches/0499-Implement-Mob-Goal-API.patch rename to Spigot-Server-Patches/0477-Implement-Mob-Goal-API.patch index 2316a882b..3e34ad498 100644 --- a/Spigot-Server-Patches/0499-Implement-Mob-Goal-API.patch +++ b/Spigot-Server-Patches/0477-Implement-Mob-Goal-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Implement Mob Goal API diff --git a/pom.xml b/pom.xml -index 64bd667e8b11263e483364efc3414396819a255c..e4c63bb76cb598545f9d215a8859724d6e7f8b81 100644 +index 6cde6f7dcbb3ff2fda0189a06573640777548d27..ef8ee637a8a0e5e703922b2991c58f4f116b23fb 100644 --- a/pom.xml +++ b/pom.xml @@ -133,6 +133,13 @@ @@ -24,10 +24,10 @@ index 64bd667e8b11263e483364efc3414396819a255c..e4c63bb76cb598545f9d215a8859724d diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java new file mode 100644 -index 0000000000000000000000000000000000000000..cf720c384b639f154b3a1ea8d45836a0b28aa763 +index 0000000000000000000000000000000000000000..7b12014db0abd9c4b89f58ceaaa7d9dd032b027a --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java -@@ -0,0 +1,349 @@ +@@ -0,0 +1,353 @@ +package com.destroystokyo.paper.entity.ai; + +import com.google.common.collect.BiMap; @@ -251,6 +251,10 @@ index 0000000000000000000000000000000000000000..cf720c384b639f154b3a1ea8d45836a0 + bukkitMap.put(EntityZombie.class, Zombie.class); + bukkitMap.put(EntityZombieHusk.class, Husk.class); + bukkitMap.put(EntityZombieVillager.class, ZombieVillager.class); ++ bukkitMap.put(EntityHoglin.class, Hoglin.class); ++ bukkitMap.put(EntityPiglin.class, Piglin.class); ++ bukkitMap.put(EntityStrider.class, Strider.class); ++ bukkitMap.put(EntityZoglin.class, Zoglin.class); + } + + public static String getUsableName(Class clazz) { @@ -751,7 +755,7 @@ index 9df0006c1a283f77c4d01d9fce9062fc1c9bbb1f..b3329c6fcd6758a781a51f5ba8f5052a + } } diff --git a/src/main/java/net/minecraft/server/PathfinderGoal.java b/src/main/java/net/minecraft/server/PathfinderGoal.java -index 93009d83f07bdaf7bc424ffb99cbfe716ca0d66d..003868a9d6a298f37cebec49046533c7325ab846 100644 +index a85d81186ae92dec72f2cc3a1dcd8c4b7e7ede62..8f26cb20b8c63f2809838c97528cef62ec39bcdb 100644 --- a/src/main/java/net/minecraft/server/PathfinderGoal.java +++ b/src/main/java/net/minecraft/server/PathfinderGoal.java @@ -8,11 +8,17 @@ public abstract class PathfinderGoal { @@ -812,20 +816,20 @@ index 93009d83f07bdaf7bc424ffb99cbfe716ca0d66d..003868a9d6a298f37cebec49046533c7 private Type() {} } diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java -index 84d2abbcb90eb09a19fa0922cfc053c74f8c56e4..a68fc11ec668576d1453459666caeacf5fbc49b8 100644 +index 22f4fec58fbaab24673dd418700c51671248c510..d3f0327a2a7cdedf3fe8d10df981a9f1cb378d26 100644 --- a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java +++ b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java -@@ -26,7 +26,7 @@ public class PathfinderGoalSelector { +@@ -27,7 +27,7 @@ public class PathfinderGoalSelector { } }; private final Map c = new EnumMap(PathfinderGoal.Type.class); -- private final Set d = Sets.newLinkedHashSet();private Set getTasks() { return d; }// Paper - OBFHELPER -+ private final Set d = Sets.newLinkedHashSet();public Set getTasks() { return d; }// Paper - OBFHELPER - private final GameProfilerFiller e; +- private final Set d = Sets.newLinkedHashSet(); private Set getTasks() { return d; }// Paper - OBFHELPER ++ private final Set d = Sets.newLinkedHashSet(); public final Set getTasks() { return d; }// Paper - OBFHELPER // Paper - private -> public + private final Supplier e; private final EnumSet f = EnumSet.noneOf(PathfinderGoal.Type.class); // Paper unused, but dummy to prevent plugins from crashing as hard. Theyll need to support paper in a special case if this is super important, but really doesn't seem like it would be. private final OptimizedSmallEnumSet goalTypes = new OptimizedSmallEnumSet<>(PathfinderGoal.Type.class); // Paper - remove streams from pathfindergoalselector -@@ -37,7 +37,7 @@ public class PathfinderGoalSelector { - this.e = gameprofilerfiller; +@@ -38,7 +38,7 @@ public class PathfinderGoalSelector { + this.e = supplier; } - public void a(int i, PathfinderGoal pathfindergoal) { @@ -833,7 +837,7 @@ index 84d2abbcb90eb09a19fa0922cfc053c74f8c56e4..a68fc11ec668576d1453459666caeacf this.d.add(new PathfinderGoalWrapped(i, pathfindergoal)); } -@@ -60,7 +60,7 @@ public class PathfinderGoalSelector { +@@ -61,7 +61,7 @@ public class PathfinderGoalSelector { } // Paper end @@ -842,16 +846,16 @@ index 84d2abbcb90eb09a19fa0922cfc053c74f8c56e4..a68fc11ec668576d1453459666caeacf // Paper start - remove streams from pathfindergoalselector for (Iterator iterator = this.d.iterator(); iterator.hasNext();) { PathfinderGoalWrapped goalWrapped = iterator.next(); -@@ -154,6 +154,7 @@ public class PathfinderGoalSelector { - this.e.exit(); +@@ -157,6 +157,7 @@ public class PathfinderGoalSelector { + gameprofilerfiller.exit(); } -+ public Stream getExecutingGoals() {return c();} // Paper - OBFHELPER - public Stream c() { ++ public final Stream getExecutingGoals() { return d(); } // Paper - OBFHELPER + public Stream d() { return this.d.stream().filter(PathfinderGoalWrapped::g); } diff --git a/src/main/java/net/minecraft/server/PathfinderGoalWrapped.java b/src/main/java/net/minecraft/server/PathfinderGoalWrapped.java -index 1b800c558f0988ffc0270b86d1a59ea3bb245116..dee4e2beacb1bbb179f220ed186e873bef718340 100644 +index 96f4401044cacf88e8e00b5b18821c105e634fba..112d8bab65bf41263a477c5faa717687fe8a2bc9 100644 --- a/src/main/java/net/minecraft/server/PathfinderGoalWrapped.java +++ b/src/main/java/net/minecraft/server/PathfinderGoalWrapped.java @@ -5,8 +5,8 @@ import javax.annotation.Nullable; @@ -866,10 +870,10 @@ index 1b800c558f0988ffc0270b86d1a59ea3bb245116..dee4e2beacb1bbb179f220ed186e873b public PathfinderGoalWrapped(int i, PathfinderGoal pathfindergoal) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 1647c09756ed303a3f3e879e877b5b3de639f843..b89f99a66fe2ab9ad4c956c38c9e4b1d79716c9c 100644 +index ed08106c56974bebed1a32a1c865e1169308c787..b62e068d5af2b9a43796c721e5cc291976d933a1 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -2230,5 +2230,11 @@ public final class CraftServer implements Server { +@@ -2309,5 +2309,11 @@ public final class CraftServer implements Server { public boolean isStopping() { return net.minecraft.server.MinecraftServer.getServer().hasStopped(); } @@ -883,16 +887,12 @@ index 1647c09756ed303a3f3e879e877b5b3de639f843..b89f99a66fe2ab9ad4c956c38c9e4b1d } diff --git a/src/test/java/com/destroystokyo/paper/entity/ai/VanillaMobGoalTest.java b/src/test/java/com/destroystokyo/paper/entity/ai/VanillaMobGoalTest.java new file mode 100644 -index 0000000000000000000000000000000000000000..bca3fa43562d21fc16f0c987b8f3a4abe56278a3 +index 0000000000000000000000000000000000000000..232c382b586b0812c9f7161565c0d382177adf7d --- /dev/null +++ b/src/test/java/com/destroystokyo/paper/entity/ai/VanillaMobGoalTest.java -@@ -0,0 +1,96 @@ +@@ -0,0 +1,103 @@ +package com.destroystokyo.paper.entity.ai; + -+import com.destroystokyo.paper.entity.ai.GoalKey; -+import com.destroystokyo.paper.entity.ai.MobGoalHelper; -+import com.destroystokyo.paper.entity.ai.VanillaGoal; -+ +import net.minecraft.server.EntityInsentient; +import net.minecraft.server.PathfinderGoal; + @@ -914,11 +914,17 @@ index 0000000000000000000000000000000000000000..bca3fa43562d21fc16f0c987b8f3a4ab + + @Test + public void testKeys() { ++ List> deprecated = new ArrayList<>(); + List> keys = new ArrayList<>(); + for (Field field : VanillaGoal.class.getFields()) { + if (field.getType().equals(GoalKey.class)) { + try { -+ keys.add((GoalKey) field.get(null)); ++ GoalKey goalKey = (GoalKey) field.get(null); ++ if (field.getAnnotation(Deprecated.class) != null) { ++ deprecated.add(goalKey); ++ } else { ++ keys.add(goalKey); ++ } + } catch (IllegalAccessException e) { + System.out.println("Skipping " + field.getName() + ": " + e.getMessage()); + } @@ -957,6 +963,11 @@ index 0000000000000000000000000000000000000000..bca3fa43562d21fc16f0c987b8f3a4ab + shouldFail = true; + } + ++ if (deprecated.size() != 0) { ++ System.out.println("Deprecated (might want to remove them at some point): "); ++ deprecated.forEach(System.out::println); ++ } ++ + if (shouldFail) Assert.fail("See above"); + } + @@ -971,12 +982,12 @@ index 0000000000000000000000000000000000000000..bca3fa43562d21fc16f0c987b8f3a4ab + classes = scanResult.getSubclasses("net.minecraft.server.EntityInsentient").loadClasses(); + } + -+ boolean shouldFail =false; ++ boolean shouldFail = false; + for (Class nmsClass : classes) { + Class bukkitClass = MobGoalHelper.toBukkitClass((Class) nmsClass); -+ if(bukkitClass == null) { ++ if (bukkitClass == null) { + shouldFail = true; -+ System.out.println("Missing bukkitMap.put(" + nmsClass.getSimpleName() + ".class, "+nmsClass.getSimpleName().replace("Entity","")+".class);"); ++ System.out.println("Missing bukkitMap.put(" + nmsClass.getSimpleName() + ".class, " + nmsClass.getSimpleName().replace("Entity", "") + ".class);"); + } + } + diff --git a/Spigot-Server-Patches/0500-Use-distance-map-to-optimise-entity-tracker.patch b/Spigot-Server-Patches/0478-Use-distance-map-to-optimise-entity-tracker.patch similarity index 84% rename from Spigot-Server-Patches/0500-Use-distance-map-to-optimise-entity-tracker.patch rename to Spigot-Server-Patches/0478-Use-distance-map-to-optimise-entity-tracker.patch index 790612e3d..86f8a2897 100644 --- a/Spigot-Server-Patches/0500-Use-distance-map-to-optimise-entity-tracker.patch +++ b/Spigot-Server-Patches/0478-Use-distance-map-to-optimise-entity-tracker.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Use distance map to optimise entity tracker Use the distance map to find candidate players for tracking. diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 32daf027a3575d73aeabf9db14a2e0c74e4cc7e6..b176dc26d15065aebc91c75e8a96745f589c0b87 100644 +index 449a687399f38d3ef79685ff80531cf1212f054a..3bbacebc3397f2c1d695f64bf3f4eb2b89b112b6 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -245,6 +245,21 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -32,22 +32,34 @@ index 32daf027a3575d73aeabf9db14a2e0c74e4cc7e6..b176dc26d15065aebc91c75e8a96745f this.id = Entity.entityCount.incrementAndGet(); this.passengers = Lists.newArrayList(); diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -index 3a88c9a67062eb73ad8257ea786efca7e7e99f65..6d3b34ead9cc95dcc1152dffa8c6c4a8c7f1d58b 100644 +index 9b89c0c8a3f1dada4e9b2aaeed0b92e56229b7ca..0c46297e6ff229538d77b2f481e4ab13ea14c48e 100644 --- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java +++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -@@ -70,6 +70,7 @@ public class EntityTrackerEntry { - this.r = entity.onGround; +@@ -72,6 +72,7 @@ public class EntityTrackerEntry { + this.r = entity.isOnGround(); } + public final void tick() { this.a(); } // Paper - OBFHELPER public void a() { List list = this.tracker.getPassengers(); +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index d9ed9df3021dab1f5ee0a51215a002253ac1e34c..b32d41fac5f855e302469209f368c3674b849fe3 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -1526,6 +1526,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant pooledLinkedPlayerHashSets = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets<>(); @@ -60,6 +72,10 @@ index 3f1a5e48676d1b4b01fbbc25fc9c9cf556cbf0eb..f09bb1329cf993034661fb8cfbf87571 + static final org.spigotmc.TrackingRange.TrackingRangeType[] TRACKING_RANGE_TYPES = org.spigotmc.TrackingRange.TrackingRangeType.values(); + final com.destroystokyo.paper.util.misc.PlayerAreaMap[] playerEntityTrackerTrackMaps; + final int[] entityTrackerTrackRanges; ++ ++ private int convertSpigotRangeToVanilla(final int vanilla) { ++ return MinecraftServer.getServer().applyTrackingRangeScale(vanilla); ++ } + // Paper end - use distance map to optimise tracker void addPlayerToDistanceMaps(EntityPlayer player) { @@ -98,10 +114,10 @@ index 3f1a5e48676d1b4b01fbbc25fc9c9cf556cbf0eb..f09bb1329cf993034661fb8cfbf87571 + } + // Paper end - use distance map to optimise entity tracker } + // Paper end - -@@ -195,6 +225,44 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - this.m = new VillagePlace(new File(this.w, "poi"), datafixer, this.world); // Paper +@@ -196,6 +230,45 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + this.m = new VillagePlace(new File(this.w, "poi"), datafixer, flag, this.world); // Paper this.setViewDistance(i); this.playerMobDistanceMap = this.world.paperConfig.perPlayerMobSpawns ? new com.destroystokyo.paper.util.PlayerMobDistanceMap() : null; // Paper + // Paper start - use distance map to optimise entity tracker @@ -135,6 +151,7 @@ index 3f1a5e48676d1b4b01fbbc25fc9c9cf556cbf0eb..f09bb1329cf993034661fb8cfbf87571 + default: + throw new IllegalStateException("Missing case for enum " + trackingRangeType); + } ++ configuredSpigotValue = convertSpigotRangeToVanilla(configuredSpigotValue); + + int trackRange = (configuredSpigotValue >>> 4) + ((configuredSpigotValue & 15) != 0 ? 1 : 0); + this.entityTrackerTrackRanges[ordinal] = trackRange; @@ -145,7 +162,7 @@ index 3f1a5e48676d1b4b01fbbc25fc9c9cf556cbf0eb..f09bb1329cf993034661fb8cfbf87571 } public void updatePlayerMobTypeMap(Entity entity) { -@@ -1400,17 +1468,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1432,17 +1505,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } public void movePlayer(EntityPlayer entityplayer) { @@ -164,16 +181,16 @@ index 3f1a5e48676d1b4b01fbbc25fc9c9cf556cbf0eb..f09bb1329cf993034661fb8cfbf87571 int i = MathHelper.floor(entityplayer.locX()) >> 4; int j = MathHelper.floor(entityplayer.locZ()) >> 4; -@@ -1527,7 +1585,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1558,7 +1621,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - entity.tracker = playerchunkmap_entitytracker; // Paper - Fast access to tracker - this.trackedEntities.put(entity.getId(), playerchunkmap_entitytracker); -- playerchunkmap_entitytracker.track(this.world.getPlayers()); -+ playerchunkmap_entitytracker.updatePlayers(entity.getPlayersInTrackRange()); // Paper - don't search all players - if (entity instanceof EntityPlayer) { - EntityPlayer entityplayer = (EntityPlayer) entity; + entity.tracker = playerchunkmap_entitytracker; // Paper - Fast access to tracker + this.trackedEntities.put(entity.getId(), playerchunkmap_entitytracker); +- playerchunkmap_entitytracker.track(this.world.getPlayers()); ++ playerchunkmap_entitytracker.updatePlayers(entity.getPlayersInTrackRange()); // Paper - don't search all players + if (entity instanceof EntityPlayer) { + EntityPlayer entityplayer = (EntityPlayer) entity; -@@ -1571,7 +1629,37 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1601,7 +1664,37 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { entity.tracker = null; // Paper - We're no longer tracked } @@ -211,7 +228,7 @@ index 3f1a5e48676d1b4b01fbbc25fc9c9cf556cbf0eb..f09bb1329cf993034661fb8cfbf87571 List list = Lists.newArrayList(); List list1 = this.world.getPlayers(); -@@ -1639,23 +1727,31 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1669,23 +1762,31 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { PacketDebug.a(this.world, chunk.getPos()); List list = Lists.newArrayList(); List list1 = Lists.newArrayList(); @@ -255,7 +272,7 @@ index 3f1a5e48676d1b4b01fbbc25fc9c9cf556cbf0eb..f09bb1329cf993034661fb8cfbf87571 Iterator iterator; Entity entity1; -@@ -1693,7 +1789,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1723,7 +1824,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { public class EntityTracker { @@ -264,7 +281,7 @@ index 3f1a5e48676d1b4b01fbbc25fc9c9cf556cbf0eb..f09bb1329cf993034661fb8cfbf87571 private final Entity tracker; private final int trackingDistance; private SectionPosition e; -@@ -1710,6 +1806,42 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1740,6 +1841,42 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { this.e = SectionPosition.a(entity); } @@ -307,7 +324,7 @@ index 3f1a5e48676d1b4b01fbbc25fc9c9cf556cbf0eb..f09bb1329cf993034661fb8cfbf87571 public boolean equals(Object object) { return object instanceof PlayerChunkMap.EntityTracker ? ((PlayerChunkMap.EntityTracker) object).tracker.getId() == this.tracker.getId() : false; } -@@ -1806,7 +1938,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1840,7 +1977,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { int j = entity.getEntityType().getChunkRange() * 16; j = org.spigotmc.TrackingRange.getEntityTrackingRange(entity, j); // Paper @@ -317,10 +334,15 @@ index 3f1a5e48676d1b4b01fbbc25fc9c9cf556cbf0eb..f09bb1329cf993034661fb8cfbf87571 } } diff --git a/src/main/java/org/spigotmc/TrackingRange.java b/src/main/java/org/spigotmc/TrackingRange.java -index 03990231a8b6bc6925f054e9033825316abfafcc..2ba1c1b9160e8d24cb338fa9b6b844423119dc73 100644 +index 03990231a8b6bc6925f054e9033825316abfafcc..627e9a90b3045602bc540a5f3f031aaf3716c942 100644 --- a/src/main/java/org/spigotmc/TrackingRange.java +++ b/src/main/java/org/spigotmc/TrackingRange.java -@@ -50,4 +50,43 @@ public class TrackingRange +@@ -46,8 +46,49 @@ public class TrackingRange + return config.miscTrackingRange; + } else + { +- if (entity instanceof EntityEnderDragon) return ((WorldServer)(entity.getWorld())).getChunkProvider().playerChunkMap.getLoadViewDistance(); // Paper - enderdragon is exempt ++ if (entity instanceof EntityEnderDragon) return defaultRange; // Paper - enderdragon is exempt return config.otherTrackingRange; } } @@ -337,8 +359,10 @@ index 03990231a8b6bc6925f054e9033825316abfafcc..2ba1c1b9160e8d24cb338fa9b6b84442 + switch (entity.activationType) { + case RAIDER: + case MONSTER: ++ case FLYING_MONSTER: + return TrackingRangeType.MONSTER; + case WATER: ++ case VILLAGER: + case ANIMAL: + return TrackingRangeType.ANIMAL; + case MISC: diff --git a/Spigot-Server-Patches/0501-Optimize-isOutsideRange-to-use-distance-maps.patch b/Spigot-Server-Patches/0479-Optimize-isOutsideRange-to-use-distance-maps.patch similarity index 83% rename from Spigot-Server-Patches/0501-Optimize-isOutsideRange-to-use-distance-maps.patch rename to Spigot-Server-Patches/0479-Optimize-isOutsideRange-to-use-distance-maps.patch index 76f0eb6a9..f3f2c0e86 100644 --- a/Spigot-Server-Patches/0501-Optimize-isOutsideRange-to-use-distance-maps.patch +++ b/Spigot-Server-Patches/0479-Optimize-isOutsideRange-to-use-distance-maps.patch @@ -6,15 +6,15 @@ Subject: [PATCH] Optimize isOutsideRange to use distance maps Use a distance map to find the players in range quickly diff --git a/src/main/java/net/minecraft/server/ChunkMapDistance.java b/src/main/java/net/minecraft/server/ChunkMapDistance.java -index 10e385eb556faff954df28ed0b3ddaceac2b8baa..ae27942991eeaec77f72b58ab32260a35f86b4a4 100644 +index 32d3887e2542c4ebba4a7498167fbe4b497a71ce..7e57a53ec614a2f7d2672edff9d7c0e0dca42377 100644 --- a/src/main/java/net/minecraft/server/ChunkMapDistance.java +++ b/src/main/java/net/minecraft/server/ChunkMapDistance.java @@ -31,7 +31,7 @@ public abstract class ChunkMapDistance { private final Long2ObjectMap> c = new Long2ObjectOpenHashMap(); public final Long2ObjectOpenHashMap>> tickets = new Long2ObjectOpenHashMap(); - private final ChunkMapDistance.a e = new ChunkMapDistance.a(); + private final ChunkMapDistance.a ticketLevelTracker = new ChunkMapDistance.a(); - private final ChunkMapDistance.b f = new ChunkMapDistance.b(8); -+ public static final int MOB_SPAWN_RANGE = 8; //private final ChunkMapDistance.b f = new ChunkMapDistance.b(8); // Paper - no longer used ++ public static final int MOB_SPAWN_RANGE = 8; // private final ChunkMapDistance.b f = new ChunkMapDistance.b(8); // Paper - no longer used private final ChunkMapDistance.c g = new ChunkMapDistance.c(33); // Paper start use a queue, but still keep unique requirement public final java.util.Queue pendingChunkUpdates = new java.util.ArrayDeque() { @@ -34,24 +34,24 @@ index 10e385eb556faff954df28ed0b3ddaceac2b8baa..ae27942991eeaec77f72b58ab32260a3 - this.f.a(); + //this.f.a(); // Paper - no longer used this.g.a(); - int i = Integer.MAX_VALUE - this.e.a(Integer.MAX_VALUE); + int i = Integer.MAX_VALUE - this.ticketLevelTracker.a(Integer.MAX_VALUE); boolean flag = i != 0; @@ -230,7 +232,7 @@ public abstract class ChunkMapDistance { ((ObjectSet) this.c.computeIfAbsent(i, (j) -> { return new ObjectOpenHashSet(); })).add(entityplayer); -- this.f.b(i, 0, true); -+ //this.f.b(i, 0, true); // Paper - no longer used - this.g.b(i, 0, true); +- this.f.update(i, 0, true); ++ //this.f.update(i, 0, true); // Paper - no longer used + this.g.update(i, 0, true); } @@ -241,7 +243,7 @@ public abstract class ChunkMapDistance { if (objectset != null) objectset.remove(entityplayer); // Paper - some state corruption happens here, don't crash, clean up gracefully. if (objectset == null || objectset.isEmpty()) { // Paper this.c.remove(i); -- this.f.b(i, Integer.MAX_VALUE, false); -+ //this.f.b(i, Integer.MAX_VALUE, false); // Paper - no longer used - this.g.b(i, Integer.MAX_VALUE, false); +- this.f.update(i, Integer.MAX_VALUE, false); ++ //this.f.update(i, Integer.MAX_VALUE, false); // Paper - no longer used + this.g.update(i, Integer.MAX_VALUE, false); } @@ -265,13 +267,17 @@ public abstract class ChunkMapDistance { @@ -77,10 +77,10 @@ index 10e385eb556faff954df28ed0b3ddaceac2b8baa..ae27942991eeaec77f72b58ab32260a3 public String c() { diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 665d83042dab467cddf315fade883fd55ffc8bfd..3089d673a029c493cac756124eb0baa21a8bab7f 100644 +index eebd4c50a7324250d3ebe7060739a71af4243f72..a6363b73522f9d27534b6e80f4b3789e84316c49 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -735,6 +735,36 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -728,6 +728,36 @@ public class ChunkProviderServer extends IChunkProvider { boolean flag1 = this.world.getGameRules().getBoolean(GameRules.DO_MOB_SPAWNING) && !world.getPlayers().isEmpty(); // CraftBukkit if (!flag) { @@ -116,55 +116,54 @@ index 665d83042dab467cddf315fade883fd55ffc8bfd..3089d673a029c493cac756124eb0baa2 + // Paper end - optimize isOutisdeRange this.world.getMethodProfiler().enter("pollingChunks"); int k = this.world.getGameRules().getInt(GameRules.RANDOM_TICK_SPEED); - BlockPosition blockposition = this.world.getSpawn(); -@@ -769,15 +799,7 @@ public class ChunkProviderServer extends IChunkProvider { - - this.world.timings.countNaturalMobs.stopTiming(); // Paper - timings + boolean flag2 = world.ticksPerAnimalSpawns != 0L && worlddata.getTime() % world.ticksPerAnimalSpawns == 0L; // CraftBukkit +@@ -757,15 +787,7 @@ public class ChunkProviderServer extends IChunkProvider { this.world.getMethodProfiler().exit(); + //List list = Lists.newArrayList(this.playerChunkMap.f()); // Paper + //Collections.shuffle(list); // Paper - //Paper start - call player naturally spawn event - int chunkRange = world.spigotConfig.mobSpawnRange; - chunkRange = (chunkRange > world.spigotConfig.viewDistance) ? (byte) world.spigotConfig.viewDistance : chunkRange; - chunkRange = Math.min(chunkRange, 8); -- for (EntityPlayer entityPlayer : this.world.players) { +- for (EntityPlayer entityPlayer : this.world.getPlayers()) { - entityPlayer.playerNaturallySpawnedEvent = new com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent(entityPlayer.getBukkitEntity(), (byte) chunkRange); - entityPlayer.playerNaturallySpawnedEvent.callEvent(); - }; - // Paper end -+ // Paper - replaced by above ++ // Paper - moved up final int[] chunksTicked = {0}; this.playerChunkMap.forEachVisibleChunk((playerchunk) -> { // Paper - safe iterator incase chunk loads, also no wrapping - Optional optional = ((Either) playerchunk.b().getNow(PlayerChunk.UNLOADED_CHUNK)).left(); + Optional optional = ((Either) playerchunk.a().getNow(PlayerChunk.UNLOADED_CHUNK)).left(); -@@ -791,10 +813,10 @@ public class ChunkProviderServer extends IChunkProvider { - this.world.getMethodProfiler().exit(); - ChunkCoordIntPair chunkcoordintpair = playerchunk.i(); +@@ -781,9 +803,9 @@ public class ChunkProviderServer extends IChunkProvider { + Chunk chunk = (Chunk) optional1.get(); + ChunkCoordIntPair chunkcoordintpair = playerchunk.i(); + +- if (!this.playerChunkMap.isOutsideOfRange(chunkcoordintpair)) { ++ if (!this.playerChunkMap.isOutsideOfRange(playerchunk, chunkcoordintpair, false)) { // Paper - optimise isOutsideOfRange + chunk.setInhabitedTime(chunk.getInhabitedTime() + j); +- if (flag1 && (this.allowMonsters || this.allowAnimals) && this.world.getWorldBorder().isInBounds(chunk.getPos()) && !this.playerChunkMap.isOutsideOfRange(chunkcoordintpair, true)) { // Spigot ++ if (flag1 && (this.allowMonsters || this.allowAnimals) && this.world.getWorldBorder().isInBounds(chunk.getPos()) && !this.playerChunkMap.isOutsideOfRange(playerchunk, chunkcoordintpair, true)) { // Spigot // Paper - optimise isOutsideOfRange + SpawnerCreature.a(this.world, chunk, spawnercreature_d, this.allowAnimals, this.allowMonsters, flag2); + } -- if (!this.playerChunkMap.isOutsideOfRange(chunkcoordintpair)) { -+ if (!this.playerChunkMap.isOutsideOfRange(playerchunk, chunkcoordintpair, false)) { // Paper - optimise isOutsideOfRange - // Paper end - chunk.setInhabitedTime(chunk.getInhabitedTime() + j); -- if (flag1 && (this.allowMonsters || this.allowAnimals) && this.world.getWorldBorder().isInBounds(chunk.getPos()) && !this.playerChunkMap.isOutsideOfRange(chunkcoordintpair, true)) { // Spigot -+ if (flag1 && (this.allowMonsters || this.allowAnimals) && this.world.getWorldBorder().isInBounds(chunk.getPos()) && !this.playerChunkMap.isOutsideOfRange(playerchunk, chunkcoordintpair, true)) { // Spigot // Paper - optimise isOutsideOfRange - this.world.getMethodProfiler().enter("spawner"); - this.world.timings.mobSpawn.startTiming(); // Spigot - EnumCreatureType[] aenumcreaturetype1 = aenumcreaturetype; diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 79c2187b7383336e7574709e6d4ad805e557976f..0560eca744cb2032bb6a3faf5aeafa95a7a6815e 100644 +index 658f5d8515db84a55d9cea092163feac596ea956..2b7e7a7aaa56b9c51fa0c8065ff25828d92c09ee 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -109,6 +109,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -113,6 +113,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet cachedSingleHashSet; // Paper + double lastEntitySpawnRadiusSquared; // Paper - optimise isOutsideRange, this field is in blocks + public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) { - super((World) worldserver, gameprofile); - playerinteractmanager.player = this; + super(worldserver, worldserver.getSpawn(), gameprofile); + this.spawnDimension = World.OVERWORLD; diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index afc92dd031cdaf725b85c0b301d5a5a21da54720..6980d19f36c18cdbed6679dbdf04afd694e078b6 100644 +index 9cb2ff09da0b8832e58eed4d70741853a25c9011..7f660d3c528f5fb4150e4ee8b29913436f125b06 100644 --- a/src/main/java/net/minecraft/server/PlayerChunk.java +++ b/src/main/java/net/minecraft/server/PlayerChunk.java -@@ -44,6 +44,18 @@ public class PlayerChunk { +@@ -43,6 +43,18 @@ public class PlayerChunk { long lastAutoSaveTime; // Paper - incremental autosave long inactiveTimeStart; // Paper - incremental autosave @@ -183,7 +182,7 @@ index afc92dd031cdaf725b85c0b301d5a5a21da54720..6980d19f36c18cdbed6679dbdf04afd6 public PlayerChunk(ChunkCoordIntPair chunkcoordintpair, int i, LightEngine lightengine, PlayerChunk.c playerchunk_c, PlayerChunk.d playerchunk_d) { this.statusFutures = new AtomicReferenceArray(PlayerChunk.CHUNK_STATUSES.size()); this.fullChunkFuture = PlayerChunk.UNLOADED_CHUNK_FUTURE; -@@ -60,6 +72,7 @@ public class PlayerChunk { +@@ -59,6 +71,7 @@ public class PlayerChunk { this.n = this.oldTicketLevel; this.a(i); this.chunkMap = (PlayerChunkMap)playerchunk_d; // Paper @@ -192,12 +191,12 @@ index afc92dd031cdaf725b85c0b301d5a5a21da54720..6980d19f36c18cdbed6679dbdf04afd6 // Paper start diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index f09bb1329cf993034661fb8cfbf87571fe5f1ebe..74b868d7cec0260a10ca7718f48308f4ec54d56b 100644 +index a7be3f6d2a11c1e1b310f0fcdbe2e485a2113c59..026562c72d7e95345d9369c6d6331cf6cedb8f17 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -153,6 +153,17 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - final com.destroystokyo.paper.util.misc.PlayerAreaMap[] playerEntityTrackerTrackMaps; - final int[] entityTrackerTrackRanges; +@@ -159,6 +159,17 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + return MinecraftServer.getServer().applyTrackingRangeScale(vanilla); + } // Paper end - use distance map to optimise tracker + // Paper start - optimise PlayerChunkMap#isOutsideRange + // A note about the naming used here: @@ -213,7 +212,7 @@ index f09bb1329cf993034661fb8cfbf87571fe5f1ebe..74b868d7cec0260a10ca7718f48308f4 void addPlayerToDistanceMaps(EntityPlayer player) { int chunkX = MCUtil.getChunkCoordinate(player.locX()); -@@ -166,6 +177,9 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -172,6 +183,9 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { trackMap.add(player, chunkX, chunkZ, Math.min(trackRange, this.getEffectiveViewDistance())); } // Paper end - use distance map to optimise entity tracker @@ -223,7 +222,7 @@ index f09bb1329cf993034661fb8cfbf87571fe5f1ebe..74b868d7cec0260a10ca7718f48308f4 } void removePlayerFromDistanceMaps(EntityPlayer player) { -@@ -174,6 +188,10 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -180,6 +194,10 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { this.playerEntityTrackerTrackMaps[i].remove(player); } // Paper end - use distance map to optimise tracker @@ -234,7 +233,7 @@ index f09bb1329cf993034661fb8cfbf87571fe5f1ebe..74b868d7cec0260a10ca7718f48308f4 } void updateMaps(EntityPlayer player) { -@@ -188,6 +206,9 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -194,6 +212,9 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { trackMap.update(player, chunkX, chunkZ, Math.min(trackRange, this.getEffectiveViewDistance())); } // Paper end - use distance map to optimise entity tracker @@ -242,18 +241,18 @@ index f09bb1329cf993034661fb8cfbf87571fe5f1ebe..74b868d7cec0260a10ca7718f48308f4 + this.playerChunkTickRangeMap.update(player, chunkX, chunkZ, ChunkMapDistance.MOB_SPAWN_RANGE); + // Paper end - optimise PlayerChunkMap#isOutsideRange } + // Paper end - -@@ -220,7 +241,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -225,7 +246,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { this.mailboxWorldGen = this.p.a(threadedmailbox, false); this.mailboxMain = this.p.a(mailbox, false); - this.lightEngine = new LightEngineThreaded(ilightaccess, this, this.world.getWorldProvider().f(), threadedmailbox1, this.p.a(threadedmailbox1, false)); + this.lightEngine = new LightEngineThreaded(ilightaccess, this, this.world.getDimensionManager().hasSkyLight(), threadedmailbox1, this.p.a(threadedmailbox1, false)); - this.chunkDistanceManager = new PlayerChunkMap.a(executor, iasynctaskhandler); + this.chunkDistanceManager = new PlayerChunkMap.a(executor, iasynctaskhandler); this.chunkDistanceManager.chunkMap = this; // Paper this.l = supplier; - this.m = new VillagePlace(new File(this.w, "poi"), datafixer, this.world); // Paper + this.m = new VillagePlace(new File(this.w, "poi"), datafixer, flag, this.world); // Paper this.setViewDistance(i); -@@ -263,6 +284,38 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -269,6 +290,38 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { this.playerEntityTrackerTrackMaps[ordinal] = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets); } // Paper end - use distance map to optimise entity tracker @@ -292,7 +291,7 @@ index f09bb1329cf993034661fb8cfbf87571fe5f1ebe..74b868d7cec0260a10ca7718f48308f4 } public void updatePlayerMobTypeMap(Entity entity) { -@@ -282,6 +335,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -288,6 +341,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { return entityPlayer.mobCounts[enumCreatureType.ordinal()]; } @@ -300,7 +299,7 @@ index f09bb1329cf993034661fb8cfbf87571fe5f1ebe..74b868d7cec0260a10ca7718f48308f4 private static double a(ChunkCoordIntPair chunkcoordintpair, Entity entity) { double d0 = (double) (chunkcoordintpair.x * 16 + 8); double d1 = (double) (chunkcoordintpair.z * 16 + 8); -@@ -460,6 +514,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -466,6 +520,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } else { if (playerchunk != null) { playerchunk.a(j); @@ -308,7 +307,7 @@ index f09bb1329cf993034661fb8cfbf87571fe5f1ebe..74b868d7cec0260a10ca7718f48308f4 } if (playerchunk != null) { -@@ -1397,30 +1452,53 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1434,30 +1489,53 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { return isOutsideOfRange(chunkcoordintpair, false); } diff --git a/Spigot-Server-Patches/0502-Stop-copy-on-write-operations-for-updating-light-dat.patch b/Spigot-Server-Patches/0480-Stop-copy-on-write-operations-for-updating-light-dat.patch similarity index 98% rename from Spigot-Server-Patches/0502-Stop-copy-on-write-operations-for-updating-light-dat.patch rename to Spigot-Server-Patches/0480-Stop-copy-on-write-operations-for-updating-light-dat.patch index ede6c2717..5b1fb6844 100644 --- a/Spigot-Server-Patches/0502-Stop-copy-on-write-operations-for-updating-light-dat.patch +++ b/Spigot-Server-Patches/0480-Stop-copy-on-write-operations-for-updating-light-dat.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Stop copy-on-write operations for updating light data Causes huge memory allocations + gc issues diff --git a/src/main/java/net/minecraft/server/LightEngineStorage.java b/src/main/java/net/minecraft/server/LightEngineStorage.java -index a3f919816eb2a742ed09b553995e6508684e5ea5..88277d23c36696fdd5363e41a130c9a443fac2c0 100644 +index 916d38cebcbe912153d54a21acbf60bc26db7401..6c7c4e75670a7e08ba10c0231a2510bf985dab6b 100644 --- a/src/main/java/net/minecraft/server/LightEngineStorage.java +++ b/src/main/java/net/minecraft/server/LightEngineStorage.java @@ -19,8 +19,8 @@ public abstract class LightEngineStorage> e @@ -20,7 +20,7 @@ index a3f919816eb2a742ed09b553995e6508684e5ea5..88277d23c36696fdd5363e41a130c9a4 protected final LongSet g = new LongOpenHashSet(); protected final LongSet h = new LongOpenHashSet(); protected final Long2ObjectMap i = Long2ObjectMaps.synchronize(new Long2ObjectOpenHashMap()); -@@ -33,8 +33,8 @@ public abstract class LightEngineStorage> e +@@ -34,8 +34,8 @@ public abstract class LightEngineStorage> e this.l = enumskyblock; this.m = ilightaccess; this.f = m0; @@ -31,7 +31,7 @@ index a3f919816eb2a742ed09b553995e6508684e5ea5..88277d23c36696fdd5363e41a130c9a4 } protected boolean g(long i) { -@@ -43,7 +43,15 @@ public abstract class LightEngineStorage> e +@@ -44,7 +44,15 @@ public abstract class LightEngineStorage> e @Nullable protected NibbleArray a(long i, boolean flag) { @@ -48,7 +48,7 @@ index a3f919816eb2a742ed09b553995e6508684e5ea5..88277d23c36696fdd5363e41a130c9a4 } @Nullable -@@ -340,10 +348,12 @@ public abstract class LightEngineStorage> e +@@ -357,10 +365,12 @@ public abstract class LightEngineStorage> e protected void e() { if (!this.g.isEmpty()) { diff --git a/Spigot-Server-Patches/0503-No-Tick-view-distance-implementation.patch b/Spigot-Server-Patches/0481-No-Tick-view-distance-implementation.patch similarity index 85% rename from Spigot-Server-Patches/0503-No-Tick-view-distance-implementation.patch rename to Spigot-Server-Patches/0481-No-Tick-view-distance-implementation.patch index 5c11fc107..61869bc2a 100644 --- a/Spigot-Server-Patches/0503-No-Tick-view-distance-implementation.patch +++ b/Spigot-Server-Patches/0481-No-Tick-view-distance-implementation.patch @@ -9,7 +9,7 @@ Per-Player is absent due to difficulty of maintaining the diff required to make it happen. diff --git a/src/main/java/co/aikar/timings/TimingsExport.java b/src/main/java/co/aikar/timings/TimingsExport.java -index d4ebcf8f66197299256bd6b65710a1488c90ea41..a3b41ce5fc70948d4804659a472cb622bb9bbc07 100644 +index c9164dfdb27ddf3709129c8aec54903a1df121ff..e33e889c291d37a821a4fbd40d9aac7bb079de0d 100644 --- a/src/main/java/co/aikar/timings/TimingsExport.java +++ b/src/main/java/co/aikar/timings/TimingsExport.java @@ -153,7 +153,8 @@ public class TimingsExport extends Thread { @@ -23,10 +23,10 @@ index d4ebcf8f66197299256bd6b65710a1488c90ea41..a3b41ce5fc70948d4804659a472cb622 })); diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 9db76eae1649fe2ce0856ff4bdcb15569bf58d93..c3f7717869c86d9ac6395615bceda324aea16b27 100644 +index 13b89276feb76fcecaeefc166a1bc161d5931d9d..5af7e5c815752f2fd2b13c02a905796971401813 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -677,4 +677,9 @@ public class PaperWorldConfig { +@@ -629,4 +629,9 @@ public class PaperWorldConfig { phantomIgnoreCreative = getBoolean("phantoms-do-not-spawn-on-creative-players", phantomIgnoreCreative); phantomOnlyAttackInsomniacs = getBoolean("phantoms-only-attack-insomniacs", phantomOnlyAttackInsomniacs); } @@ -37,10 +37,10 @@ index 9db76eae1649fe2ce0856ff4bdcb15569bf58d93..c3f7717869c86d9ac6395615bceda324 + } } diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index cf86ce24e12068d6ff7ae43cb1fd6fe665c24932..c80a55ee53eac128c94d74b78c5641854e974750 100644 +index b65ae2d6919a67498d0646c5522735086fec00c1..7f508b9ef616071b1adeef7c00da7f4565ef4ddd 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -245,7 +245,51 @@ public class Chunk implements IChunkAccess { +@@ -246,7 +246,51 @@ public class Chunk implements IChunkAccess { } protected void onNeighbourChange(final long bitsetBefore, final long bitsetAfter) { @@ -93,7 +93,7 @@ index cf86ce24e12068d6ff7ae43cb1fd6fe665c24932..c80a55ee53eac128c94d74b78c564185 public final boolean isAnyNeighborsLoaded() { diff --git a/src/main/java/net/minecraft/server/ChunkMapDistance.java b/src/main/java/net/minecraft/server/ChunkMapDistance.java -index ae27942991eeaec77f72b58ab32260a35f86b4a4..7702fbefa598bce7e6a2d287f7ec36b78a62bff8 100644 +index 7e57a53ec614a2f7d2672edff9d7c0e0dca42377..c072f61e8c88eac8335acd660d8ff0e2f9db819e 100644 --- a/src/main/java/net/minecraft/server/ChunkMapDistance.java +++ b/src/main/java/net/minecraft/server/ChunkMapDistance.java @@ -262,7 +262,7 @@ public abstract class ChunkMapDistance { @@ -113,25 +113,39 @@ index ae27942991eeaec77f72b58ab32260a35f86b4a4..7702fbefa598bce7e6a2d287f7ec36b7 + Ticket ticket = new Ticket<>(TicketType.PLAYER, 33, new ChunkCoordIntPair(i)); // Paper - no-tick view distance if (flag1) { - ChunkMapDistance.this.j.a(ChunkTaskQueueSorter.a(() -> { // CraftBukkit - decompile error + ChunkMapDistance.this.j.a(ChunkTaskQueueSorter.a(() -> { diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 0560eca744cb2032bb6a3faf5aeafa95a7a6815e..07a6fc3d88e7d44bfab7f3d6a0eef7dc132ab422 100644 +index 2b7e7a7aaa56b9c51fa0c8065ff25828d92c09ee..5f9ab1b81c1440d9b3003fbbf7d00b135a6b811e 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -111,6 +111,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -115,6 +115,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting { double lastEntitySpawnRadiusSquared; // Paper - optimise isOutsideRange, this field is in blocks + boolean needsChunkCenterUpdate; // Paper - no-tick view distance + public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) { - super((World) worldserver, gameprofile); - playerinteractmanager.player = this; + super(worldserver, worldserver.getSpawn(), gameprofile); + this.spawnDimension = World.OVERWORLD; +diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java +index a68e4fc411ae84f12b1ca7443fa66f6325712af8..d24b5fa7e77bb18626459f6c3ab4aa20a7512712 100644 +--- a/src/main/java/net/minecraft/server/MCUtil.java ++++ b/src/main/java/net/minecraft/server/MCUtil.java +@@ -620,7 +620,8 @@ public final class MCUtil { + }); + + worldData.addProperty("name", world.getWorld().getName()); +- worldData.addProperty("view-distance", world.spigotConfig.viewDistance); ++ worldData.addProperty("view-distance", world.getChunkProvider().playerChunkMap.getEffectiveViewDistance()); ++ worldData.addProperty("no-view-distance", world.getChunkProvider().playerChunkMap.getRawNoTickViewDistance()); + worldData.addProperty("keep-spawn-loaded", world.keepSpawnInMemory); + worldData.addProperty("keep-spawn-loaded-range", world.paperConfig.keepLoadedRange); + worldData.addProperty("visible-chunk-count", visibleChunks.size()); diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index 6980d19f36c18cdbed6679dbdf04afd694e078b6..03fb688fe4bdc19b4bc36b1f1d5b40c61e7bef9b 100644 +index 7f660d3c528f5fb4150e4ee8b29913436f125b06..40347212ad1bcf857d5b8ddb0ee6a698e2568201 100644 --- a/src/main/java/net/minecraft/server/PlayerChunk.java +++ b/src/main/java/net/minecraft/server/PlayerChunk.java -@@ -56,6 +56,18 @@ public class PlayerChunk { +@@ -55,6 +55,18 @@ public class PlayerChunk { } // Paper end - optimise isOutsideOfRange @@ -150,7 +164,7 @@ index 6980d19f36c18cdbed6679dbdf04afd694e078b6..03fb688fe4bdc19b4bc36b1f1d5b40c6 public PlayerChunk(ChunkCoordIntPair chunkcoordintpair, int i, LightEngine lightengine, PlayerChunk.c playerchunk_c, PlayerChunk.d playerchunk_d) { this.statusFutures = new AtomicReferenceArray(PlayerChunk.CHUNK_STATUSES.size()); this.fullChunkFuture = PlayerChunk.UNLOADED_CHUNK_FUTURE; -@@ -211,7 +223,7 @@ public class PlayerChunk { +@@ -210,7 +222,7 @@ public class PlayerChunk { } public void a(int i, int j, int k) { @@ -159,7 +173,7 @@ index 6980d19f36c18cdbed6679dbdf04afd694e078b6..03fb688fe4bdc19b4bc36b1f1d5b40c6 if (chunk != null) { this.r |= 1 << (j >> 4); -@@ -231,7 +243,7 @@ public class PlayerChunk { +@@ -230,7 +242,7 @@ public class PlayerChunk { } public void a(EnumSkyBlock enumskyblock, int i) { @@ -168,7 +182,7 @@ index 6980d19f36c18cdbed6679dbdf04afd694e078b6..03fb688fe4bdc19b4bc36b1f1d5b40c6 if (chunk != null) { chunk.setNeedsSaving(true); -@@ -316,9 +328,48 @@ public class PlayerChunk { +@@ -303,9 +315,48 @@ public class PlayerChunk { } private void a(Packet packet, boolean flag) { @@ -221,10 +235,10 @@ index 6980d19f36c18cdbed6679dbdf04afd694e078b6..03fb688fe4bdc19b4bc36b1f1d5b40c6 public CompletableFuture> a(ChunkStatus chunkstatus, PlayerChunkMap playerchunkmap) { diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 74b868d7cec0260a10ca7718f48308f4ec54d56b..f832e7cdfc6741a932787f02754f145202ff7887 100644 +index 026562c72d7e95345d9369c6d6331cf6cedb8f17..fe343f70ce8024c86363637fda8e5c09cc6e60a9 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -94,7 +94,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -95,7 +95,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { private boolean updatingChunksModified; private final ChunkTaskQueueSorter p; private final Mailbox> mailboxWorldGen; @@ -233,7 +247,7 @@ index 74b868d7cec0260a10ca7718f48308f4ec54d56b..f832e7cdfc6741a932787f02754f1452 public final WorldLoadListener worldLoadListener; public final PlayerChunkMap.a chunkDistanceManager; public final PlayerChunkMap.a getChunkMapDistanceManager() { return this.chunkDistanceManager; } // Paper - OBFHELPER private final AtomicInteger u; -@@ -164,6 +164,22 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -170,6 +170,22 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerMobSpawnMap; // this map is absent from updateMaps since it's controlled at the start of the chunkproviderserver tick public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerChunkTickRangeMap; // Paper end - optimise PlayerChunkMap#isOutsideRange @@ -256,7 +270,7 @@ index 74b868d7cec0260a10ca7718f48308f4ec54d56b..f832e7cdfc6741a932787f02754f1452 void addPlayerToDistanceMaps(EntityPlayer player) { int chunkX = MCUtil.getChunkCoordinate(player.locX()); -@@ -180,6 +196,19 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -186,6 +202,19 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { // Paper start - optimise PlayerChunkMap#isOutsideRange this.playerChunkTickRangeMap.add(player, chunkX, chunkZ, ChunkMapDistance.MOB_SPAWN_RANGE); // Paper end - optimise PlayerChunkMap#isOutsideRange @@ -276,7 +290,7 @@ index 74b868d7cec0260a10ca7718f48308f4ec54d56b..f832e7cdfc6741a932787f02754f1452 } void removePlayerFromDistanceMaps(EntityPlayer player) { -@@ -192,6 +221,11 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -198,6 +227,11 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { this.playerMobSpawnMap.remove(player); this.playerChunkTickRangeMap.remove(player); // Paper end - optimise PlayerChunkMap#isOutsideRange @@ -288,7 +302,7 @@ index 74b868d7cec0260a10ca7718f48308f4ec54d56b..f832e7cdfc6741a932787f02754f1452 } void updateMaps(EntityPlayer player) { -@@ -209,6 +243,19 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -215,6 +249,19 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { // Paper start - optimise PlayerChunkMap#isOutsideRange this.playerChunkTickRangeMap.update(player, chunkX, chunkZ, ChunkMapDistance.MOB_SPAWN_RANGE); // Paper end - optimise PlayerChunkMap#isOutsideRange @@ -306,9 +320,9 @@ index 74b868d7cec0260a10ca7718f48308f4ec54d56b..f832e7cdfc6741a932787f02754f1452 + player.needsChunkCenterUpdate = false; + // Paper end - no-tick view distance } + // Paper end - -@@ -316,6 +363,45 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -322,6 +369,45 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } }); // Paper end - optimise PlayerChunkMap#isOutsideRange @@ -354,7 +368,7 @@ index 74b868d7cec0260a10ca7718f48308f4ec54d56b..f832e7cdfc6741a932787f02754f1452 } public void updatePlayerMobTypeMap(Entity entity) { -@@ -1126,15 +1212,11 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1140,15 +1226,11 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { completablefuture1.thenAcceptAsync((either) -> { either.mapLeft((chunk) -> { this.u.getAndIncrement(); @@ -367,18 +381,18 @@ index 74b868d7cec0260a10ca7718f48308f4ec54d56b..f832e7cdfc6741a932787f02754f1452 return Either.left(chunk); }); }, (runnable) -> { -- this.mailboxMain.a(ChunkTaskQueueSorter.a(playerchunk, runnable)); // CraftBukkit - decompile error -+ this.mailboxMain.a(ChunkTaskQueueSorter.a(playerchunk, runnable)); // CraftBukkit - decompile error // Paper - diff on change, this is the scheduling method copied in Chunk used to schedule chunk broadcasts (on change it needs to be copied again) +- this.mailboxMain.a(ChunkTaskQueueSorter.a(playerchunk, runnable)); ++ this.mailboxMain.a(ChunkTaskQueueSorter.a(playerchunk, runnable)); // Paper - diff on change, this is the scheduling method copied in Chunk used to schedule chunk broadcasts (on change it needs to be copied again) }); return completablefuture1; } -@@ -1205,32 +1287,38 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - } // Paper +@@ -1243,32 +1325,38 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + } } - protected void setViewDistance(int i) { - int j = MathHelper.clamp(i + 1, 3, 33); -+ public final void setViewDistance(int i) { // Paper - public ++ public void setViewDistance(int i) { // Paper - public + int j = MathHelper.clamp(i + 1, 3, 33); // Paper - diff on change, these make the lower view distance limit 2 and the upper 32 if (j != this.viewDistance) { @@ -426,7 +440,7 @@ index 74b868d7cec0260a10ca7718f48308f4ec54d56b..f832e7cdfc6741a932787f02754f1452 protected void sendChunk(EntityPlayer entityplayer, ChunkCoordIntPair chunkcoordintpair, Packet[] apacket, boolean flag, boolean flag1) { if (entityplayer.world == this.world) { -@@ -1238,7 +1326,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1276,7 +1364,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { PlayerChunk playerchunk = this.getVisibleChunk(chunkcoordintpair.pair()); if (playerchunk != null) { @@ -435,7 +449,7 @@ index 74b868d7cec0260a10ca7718f48308f4ec54d56b..f832e7cdfc6741a932787f02754f1452 if (chunk != null) { this.a(entityplayer, apacket, chunk); -@@ -1500,6 +1588,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1537,6 +1625,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } // Paper end - optimise isOutsideOfRange @@ -443,7 +457,7 @@ index 74b868d7cec0260a10ca7718f48308f4ec54d56b..f832e7cdfc6741a932787f02754f1452 private boolean b(EntityPlayer entityplayer) { return entityplayer.isSpectator() && !this.world.getGameRules().getBoolean(GameRules.SPECTATORS_GENERATE_CHUNKS); } -@@ -1527,13 +1616,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1564,13 +1653,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { this.removePlayerFromDistanceMaps(entityplayer); // Paper - distance maps } @@ -458,7 +472,7 @@ index 74b868d7cec0260a10ca7718f48308f4ec54d56b..f832e7cdfc6741a932787f02754f1452 } -@@ -1541,7 +1624,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1578,7 +1661,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { SectionPosition sectionposition = SectionPosition.a((Entity) entityplayer); entityplayer.a(sectionposition); @@ -467,7 +481,7 @@ index 74b868d7cec0260a10ca7718f48308f4ec54d56b..f832e7cdfc6741a932787f02754f1452 return sectionposition; } -@@ -1586,6 +1669,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1623,6 +1706,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { int k1; int l1; @@ -475,7 +489,7 @@ index 74b868d7cec0260a10ca7718f48308f4ec54d56b..f832e7cdfc6741a932787f02754f1452 if (Math.abs(i1 - i) <= this.viewDistance * 2 && Math.abs(j1 - j) <= this.viewDistance * 2) { k1 = Math.min(i, i1) - this.viewDistance; l1 = Math.min(j, j1) - this.viewDistance; -@@ -1623,7 +1707,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1660,7 +1744,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { this.sendChunk(entityplayer, chunkcoordintpair1, new Packet[2], false, true); } } @@ -484,7 +498,7 @@ index 74b868d7cec0260a10ca7718f48308f4ec54d56b..f832e7cdfc6741a932787f02754f1452 this.updateMaps(entityplayer); // Paper - distance maps -@@ -1631,11 +1715,46 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1668,11 +1752,46 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @Override public Stream a(ChunkCoordIntPair chunkcoordintpair, boolean flag) { @@ -501,7 +515,7 @@ index 74b868d7cec0260a10ca7718f48308f4ec54d56b..f832e7cdfc6741a932787f02754f1452 + return Stream.empty(); + } + // all current cases are inlined so we wont hit this code, it's just in case plugins or future updates use it -+ List players = new ArrayList<>(); ++ List players = new java.util.ArrayList<>(); + Object[] backingSet = inRange.getBackingSet(); + + if (flag) { // flag -> border only @@ -535,15 +549,15 @@ index 74b868d7cec0260a10ca7718f48308f4ec54d56b..f832e7cdfc6741a932787f02754f1452 } protected void addEntity(Entity entity) { -@@ -1795,6 +1914,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1830,6 +1949,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } + final void sendChunk(EntityPlayer entityplayer, Packet[] apacket, Chunk chunk) { this.a(entityplayer, apacket, chunk); } // Paper - OBFHELPER private void a(EntityPlayer entityplayer, Packet[] apacket, Chunk chunk) { if (apacket[0] == null) { - apacket[0] = new PacketPlayOutMapChunk(chunk, 65535); -@@ -1980,7 +2100,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + apacket[0] = new PacketPlayOutMapChunk(chunk, 65535, true); +@@ -2015,7 +2135,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(this.tracker.chunkX, this.tracker.chunkZ); PlayerChunk playerchunk = PlayerChunkMap.this.getVisibleChunk(chunkcoordintpair.pair()); @@ -553,28 +567,28 @@ index 74b868d7cec0260a10ca7718f48308f4ec54d56b..f832e7cdfc6741a932787f02754f1452 } } diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index d7a9ec78db5994259bd6de289a8b4996349b2559..6daca5c0ffd1d84f9a25cd106e8992a055dfb912 100644 +index 3d110c998f6b28e55055637bbfeff6f2ebdb2747..59f00891ee2d1641678d4903a365cb94247bf08f 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -152,7 +152,7 @@ public abstract class PlayerList { - // CraftBukkit - getType() +@@ -175,7 +175,7 @@ public abstract class PlayerList { + boolean flag1 = gamerules.getBoolean(GameRules.REDUCED_DEBUG_INFO); + // Spigot - view distance - networkmanager.queueImmunity = true; // Paper -- playerconnection.sendPacket(new PacketPlayOutLogin(entityplayer.getId(), entityplayer.playerInteractManager.getGameMode(), WorldData.c(worlddata.getSeed()), worlddata.isHardcore(), worldserver.worldProvider.getDimensionManager().getType(), this.getMaxPlayers(), worlddata.getType(), worldserver.spigotConfig.viewDistance, flag1, !flag)); -+ playerconnection.sendPacket(new PacketPlayOutLogin(entityplayer.getId(), entityplayer.playerInteractManager.getGameMode(), WorldData.c(worlddata.getSeed()), worlddata.isHardcore(), worldserver.worldProvider.getDimensionManager().getType(), this.getMaxPlayers(), worlddata.getType(), worldserver.getChunkProvider().playerChunkMap.getLoadViewDistance(), flag1, !flag)); // Paper - no-tick view distance +- playerconnection.sendPacket(new PacketPlayOutLogin(entityplayer.getId(), entityplayer.playerInteractManager.getGameMode(), entityplayer.playerInteractManager.c(), BiomeManager.a(worldserver1.getSeed()), worlddata.isHardcore(), this.server.E(), this.s, worldserver1.getTypeKey(), worldserver1.getDimensionKey(), this.getMaxPlayers(), worldserver1.spigotConfig.viewDistance, flag1, !flag, worldserver1.isDebugWorld(), worldserver1.isFlatWorld())); ++ playerconnection.sendPacket(new PacketPlayOutLogin(entityplayer.getId(), entityplayer.playerInteractManager.getGameMode(), entityplayer.playerInteractManager.c(), BiomeManager.a(worldserver1.getSeed()), worlddata.isHardcore(), this.server.E(), this.s, worldserver1.getTypeKey(), worldserver1.getDimensionKey(), this.getMaxPlayers(), worldserver1.getChunkProvider().playerChunkMap.getLoadViewDistance(), flag1, !flag, worldserver1.isDebugWorld(), worldserver1.isFlatWorld())); // Paper - no-tick view distance entityplayer.getBukkitEntity().sendSupportedChannels(); // CraftBukkit playerconnection.sendPacket(new PacketPlayOutCustomPayload(PacketPlayOutCustomPayload.a, (new PacketDataSerializer(Unpooled.buffer())).a(this.getServer().getServerModName()))); playerconnection.sendPacket(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked())); -@@ -776,7 +776,7 @@ public abstract class PlayerList { - WorldData worlddata = worldserver.getWorldData(); - - entityplayer1.playerConnection.sendPacket(new PacketPlayOutRespawn(worldserver.worldProvider.getDimensionManager().getType(), WorldData.c(worldserver.getWorldData().getSeed()), worldserver.getWorldData().getType(), entityplayer1.playerInteractManager.getGameMode())); -- entityplayer1.playerConnection.sendPacket(new PacketPlayOutViewDistance(worldserver.spigotConfig.viewDistance)); // Spigot -+ entityplayer1.playerConnection.sendPacket(new PacketPlayOutViewDistance(worldserver.getChunkProvider().playerChunkMap.getLoadViewDistance())); // Paper - no-tick view distance - entityplayer1.spawnIn(worldserver); +@@ -814,7 +814,7 @@ public abstract class PlayerList { + // CraftBukkit start + WorldData worlddata = worldserver1.getWorldData(); + entityplayer1.playerConnection.sendPacket(new PacketPlayOutRespawn(worldserver1.getTypeKey(), worldserver1.getDimensionKey(), BiomeManager.a(worldserver1.getSeed()), entityplayer1.playerInteractManager.getGameMode(), entityplayer1.playerInteractManager.c(), worldserver1.isDebugWorld(), worldserver1.isFlatWorld(), flag)); +- entityplayer1.playerConnection.sendPacket(new PacketPlayOutViewDistance(worldserver1.spigotConfig.viewDistance)); // Spigot ++ entityplayer1.playerConnection.sendPacket(new PacketPlayOutViewDistance(worldserver1.getChunkProvider().playerChunkMap.getLoadViewDistance())); // Spigot // Paper - no-tick view distance + entityplayer1.spawnIn(worldserver1); entityplayer1.dead = false; - entityplayer1.playerConnection.teleport(new Location(worldserver.getWorld(), entityplayer1.locX(), entityplayer1.locY(), entityplayer1.locZ(), entityplayer1.yaw, entityplayer1.pitch)); -@@ -1262,7 +1262,7 @@ public abstract class PlayerList { + entityplayer1.playerConnection.teleport(new Location(worldserver1.getWorld(), entityplayer1.locX(), entityplayer1.locY(), entityplayer1.locZ(), entityplayer1.yaw, entityplayer1.pitch)); +@@ -1281,7 +1281,7 @@ public abstract class PlayerList { public void a(int i) { this.viewDistance = i; @@ -584,10 +598,10 @@ index d7a9ec78db5994259bd6de289a8b4996349b2559..6daca5c0ffd1d84f9a25cd106e8992a0 while (iterator.hasNext()) { diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 1c7955d3ae7ddd1c2d924cec20a91202cf090f40..7bd3f789b6055d73f3a6c0628652cca241147887 100644 +index 365539e53efdb7e729b580f52fb23659cbde4f0a..ba50189b10b54f5b35448c898f8c3495ddf8e112 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -444,8 +444,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -508,8 +508,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable { this.b(blockposition, iblockdata1, iblockdata2); } @@ -603,10 +617,10 @@ index 1c7955d3ae7ddd1c2d924cec20a91202cf090f40..7bd3f789b6055d73f3a6c0628652cca2 if (!this.isClientSide && (i & 1) != 0) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 1929aacbe83c401c7254484aa8df62ed1554e3ba..36207acffac3620879afd11bb47e06341a3dabb9 100644 +index 3ec021746ffaea89f09126538fcaa0555872ac17..11559f9e4b3f5fda6bfe4f70f963ce4f7967f051 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -2493,10 +2493,39 @@ public class CraftWorld implements World { +@@ -2530,10 +2530,39 @@ public class CraftWorld implements World { // Spigot start @Override public int getViewDistance() { @@ -648,7 +662,7 @@ index 1929aacbe83c401c7254484aa8df62ed1554e3ba..36207acffac3620879afd11bb47e0634 private final Spigot spigot = new Spigot() { diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java -index d873b8cf3aec01b791565c33b252889f99f181f9..f735217e7a99bf8286ea60158f9fe137e84ad75c 100644 +index 5dcc1ba547db7cc53a08426a7ad119ae88690136..f78e44e05f7a97a7da190aa4b5aa6fb8340728ea 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java @@ -201,7 +201,7 @@ public class ActivationRange diff --git a/Spigot-Server-Patches/0504-Add-villager-reputation-API.patch b/Spigot-Server-Patches/0482-Add-villager-reputation-API.patch similarity index 93% rename from Spigot-Server-Patches/0504-Add-villager-reputation-API.patch rename to Spigot-Server-Patches/0482-Add-villager-reputation-API.patch index ab2742c64..1709aec59 100644 --- a/Spigot-Server-Patches/0504-Add-villager-reputation-API.patch +++ b/Spigot-Server-Patches/0482-Add-villager-reputation-API.patch @@ -20,19 +20,19 @@ index 0000000000000000000000000000000000000000..0f10c333d88f2e1c56a6c7f22d421084 + } +} diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java -index eeb76bc0298711ac3ea24440a172e812925f875e..7da267d287eb338d32a8cace82bacc4ce2c47182 100644 +index 9f28c7e4bd70abc280a8cf3cbf5ccc84246aff12..bf019043a9338aca8d91da809f1d5520531386e7 100644 --- a/src/main/java/net/minecraft/server/EntityVillager.java +++ b/src/main/java/net/minecraft/server/EntityVillager.java -@@ -960,6 +960,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation - this.bL = 0; +@@ -959,6 +959,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation + this.bK = 0; } -+ public Reputation getReputation() { return this.eN(); } // Paper - OBFHELPER - public Reputation eN() { - return this.bG; ++ public Reputation getReputation() { return this.fj(); } // Paper - OBFHELPER + public Reputation fj() { + return this.bF; } diff --git a/src/main/java/net/minecraft/server/Reputation.java b/src/main/java/net/minecraft/server/Reputation.java -index 0b6f91ac1206089654a6745bccb038fba8c13d98..4ae31599664ee8478ca1acf68f7253eb02eb45ed 100644 +index 3c6d6be4485cad4f2e9a395425b5837590853eee..28c9f9ed2d532a1eb14b74c2e9723a2cf1b3c6fa 100644 --- a/src/main/java/net/minecraft/server/Reputation.java +++ b/src/main/java/net/minecraft/server/Reputation.java @@ -25,7 +25,7 @@ import java.util.stream.Stream; @@ -44,7 +44,7 @@ index 0b6f91ac1206089654a6745bccb038fba8c13d98..4ae31599664ee8478ca1acf68f7253eb public Reputation() {} -@@ -138,11 +138,11 @@ public class Reputation { +@@ -140,11 +140,11 @@ public class Reputation { return k > reputationtype.h ? Math.max(reputationtype.h, i) : k; } @@ -58,7 +58,7 @@ index 0b6f91ac1206089654a6745bccb038fba8c13d98..4ae31599664ee8478ca1acf68f7253eb this.a = new Object2IntOpenHashMap(); } -@@ -196,6 +196,27 @@ public class Reputation { +@@ -198,6 +198,27 @@ public class Reputation { public void b(ReputationType reputationtype) { this.a.removeInt(reputationtype); } diff --git a/Spigot-Server-Patches/0505-Fix-Light-Command.patch b/Spigot-Server-Patches/0483-Fix-Light-Command.patch similarity index 90% rename from Spigot-Server-Patches/0505-Fix-Light-Command.patch rename to Spigot-Server-Patches/0483-Fix-Light-Command.patch index a6cb9a1c7..e4180ffed 100644 --- a/Spigot-Server-Patches/0505-Fix-Light-Command.patch +++ b/Spigot-Server-Patches/0483-Fix-Light-Command.patch @@ -7,7 +7,7 @@ This lets you run /paper fixlight (max 5) to automatically fix all light data in the chunks. diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java -index 182b440ba4802d199b8e44f7779b3401ace495d5..10b72083322b7f8e3e14525b3e834f5374ec369d 100644 +index 182b440ba4802d199b8e44f7779b3401ace495d5..cc3fc5200f75f80a60b4cbc260e3a0bc4bb3a869 100644 --- a/src/main/java/com/destroystokyo/paper/PaperCommand.java +++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java @@ -20,6 +20,7 @@ import org.bukkit.command.Command; @@ -45,7 +45,7 @@ index 182b440ba4802d199b8e44f7779b3401ace495d5..10b72083322b7f8e3e14525b3e834f53 case "ver": case "version": Command ver = org.bukkit.Bukkit.getServer().getCommandMap().getCommand("version"); -@@ -160,6 +164,75 @@ public class PaperCommand extends Command { +@@ -160,6 +164,77 @@ public class PaperCommand extends Command { return true; } @@ -94,10 +94,12 @@ index 182b440ba4802d199b8e44f7779b3401ace495d5..10b72083322b7f8e3e14525b3e834f53 + } + lightengine.a(world.paperConfig.lightQueueSize + 16 * 256); // ensure full chunk can fit into queue + sender.sendMessage("Updating Light " + coord); ++ int cx = chunk.getPos().x << 4; ++ int cz = chunk.getPos().z << 4; + for (int y = 0; y < world.getHeight(); y++) { + for (int x = 0; x < 16; x++) { + for (int z = 0; z < 16; z++) { -+ BlockPosition pos = new BlockPosition(chunk.getPos().getBlockX() + x, y, chunk.getPos().getBlockZ() + z); ++ BlockPosition pos = new BlockPosition(cx + x, y, cz + z); + lightengine.a(pos); + } + } @@ -107,7 +109,7 @@ index 182b440ba4802d199b8e44f7779b3401ace495d5..10b72083322b7f8e3e14525b3e834f53 + if (visibleChunk != null) { + world.getChunkProvider().playerChunkMap.addLightTask(visibleChunk, () -> { + MinecraftServer.getServer().processQueue.add(() -> { -+ visibleChunk.sendPacketToTrackedPlayers(new PacketPlayOutLightUpdate(chunk.getPos(), lightengine), false); ++ visibleChunk.sendPacketToTrackedPlayers(new PacketPlayOutLightUpdate(chunk.getPos(), lightengine, true), false); + updateLight(sender, world, lightengine, queue); + }); + }); @@ -122,10 +124,10 @@ index 182b440ba4802d199b8e44f7779b3401ace495d5..10b72083322b7f8e3e14525b3e834f53 if (!SyncLoadFinder.ENABLED) { sender.sendMessage(ChatColor.RED + "This command requires the server startup flag '-Dpaper.debug-sync-loads=true' to be set."); diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index 03fb688fe4bdc19b4bc36b1f1d5b40c61e7bef9b..aeca6b2b9d5d73aeb6dc639b5cad2f2533a2de44 100644 +index 40347212ad1bcf857d5b8ddb0ee6a698e2568201..e5751adde516544722b95016f64b2a46c16e77ce 100644 --- a/src/main/java/net/minecraft/server/PlayerChunk.java +++ b/src/main/java/net/minecraft/server/PlayerChunk.java -@@ -327,6 +327,7 @@ public class PlayerChunk { +@@ -314,6 +314,7 @@ public class PlayerChunk { } @@ -134,10 +136,10 @@ index 03fb688fe4bdc19b4bc36b1f1d5b40c61e7bef9b..aeca6b2b9d5d73aeb6dc639b5cad2f25 // Paper start - per player view distance // there can be potential desync with player's last mapped section and the view distance map, so use the diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index f832e7cdfc6741a932787f02754f145202ff7887..f361939b9ae451bdccf7922e9cca09344c6152b5 100644 +index fe343f70ce8024c86363637fda8e5c09cc6e60a9..750749f8533e95b33a6f555900c23bb11b3fda40 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -95,6 +95,12 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -96,6 +96,12 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { private final ChunkTaskQueueSorter p; private final Mailbox> mailboxWorldGen; final Mailbox> mailboxMain; // Paper - private -> package private @@ -150,7 +152,7 @@ index f832e7cdfc6741a932787f02754f145202ff7887..f361939b9ae451bdccf7922e9cca0934 public final WorldLoadListener worldLoadListener; public final PlayerChunkMap.a chunkDistanceManager; public final PlayerChunkMap.a getChunkMapDistanceManager() { return this.chunkDistanceManager; } // Paper - OBFHELPER private final AtomicInteger u; -@@ -282,11 +288,12 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -287,11 +293,12 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { Mailbox mailbox = Mailbox.a("main", iasynctaskhandler::a); this.worldLoadListener = worldloadlistener; @@ -161,6 +163,6 @@ index f832e7cdfc6741a932787f02754f145202ff7887..f361939b9ae451bdccf7922e9cca0934 this.mailboxWorldGen = this.p.a(threadedmailbox, false); this.mailboxMain = this.p.a(mailbox, false); + this.mailboxLight = this.p.a(lightthreaded, false);// Paper - this.lightEngine = new LightEngineThreaded(ilightaccess, this, this.world.getWorldProvider().f(), threadedmailbox1, this.p.a(threadedmailbox1, false)); + this.lightEngine = new LightEngineThreaded(ilightaccess, this, this.world.getDimensionManager().hasSkyLight(), threadedmailbox1, this.p.a(threadedmailbox1, false)); this.chunkDistanceManager = new PlayerChunkMap.a(executor, iasynctaskhandler); this.chunkDistanceManager.chunkMap = this; // Paper this.l = supplier; diff --git a/Spigot-Server-Patches/0507-Fix-PotionEffect-ignores-icon-flag.patch b/Spigot-Server-Patches/0484-Fix-PotionEffect-ignores-icon-flag.patch similarity index 87% rename from Spigot-Server-Patches/0507-Fix-PotionEffect-ignores-icon-flag.patch rename to Spigot-Server-Patches/0484-Fix-PotionEffect-ignores-icon-flag.patch index 9c6ba39af..43fcc1a79 100644 --- a/Spigot-Server-Patches/0507-Fix-PotionEffect-ignores-icon-flag.patch +++ b/Spigot-Server-Patches/0484-Fix-PotionEffect-ignores-icon-flag.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix PotionEffect ignores icon flag diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 245bd116d143af120127a9d25dcb7a0c43ad47a0..a461ac36144361b712e015b722e68bdb0b43dfb2 100644 +index b3ec32b20751fbea2f6df14fc5e9f84682493bfd..3777aba5f32f58f4620d4fe496af4e641ff8c858 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -384,7 +384,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -387,7 +387,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { @Override public boolean addPotionEffect(PotionEffect effect, boolean force) { diff --git a/Spigot-Server-Patches/0508-Optimize-brigadier-child-sorting-performance.patch b/Spigot-Server-Patches/0485-Optimize-brigadier-child-sorting-performance.patch similarity index 87% rename from Spigot-Server-Patches/0508-Optimize-brigadier-child-sorting-performance.patch rename to Spigot-Server-Patches/0485-Optimize-brigadier-child-sorting-performance.patch index 2c05eb7a0..a9d88ce86 100644 --- a/Spigot-Server-Patches/0508-Optimize-brigadier-child-sorting-performance.patch +++ b/Spigot-Server-Patches/0485-Optimize-brigadier-child-sorting-performance.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Optimize brigadier child sorting performance diff --git a/src/main/java/com/mojang/brigadier/tree/CommandNode.java b/src/main/java/com/mojang/brigadier/tree/CommandNode.java -index 98592a3e63591b54f895e5fa6d8761ca7c4d9de4..bd2802d362cbf40ea0603162b66f4bcefe7944df 100644 +index 5b305320937eafdabbdc3d41475eb8d1c4b3b324..5e3fc338b0fe69a74465567e69721bc28c64dd17 100644 --- a/src/main/java/com/mojang/brigadier/tree/CommandNode.java +++ b/src/main/java/com/mojang/brigadier/tree/CommandNode.java -@@ -26,7 +26,7 @@ import java.util.stream.Collectors; +@@ -27,7 +27,7 @@ import java.util.stream.Collectors; import net.minecraft.server.CommandListenerWrapper; // CraftBukkit public abstract class CommandNode implements Comparable> { @@ -17,7 +17,7 @@ index 98592a3e63591b54f895e5fa6d8761ca7c4d9de4..bd2802d362cbf40ea0603162b66f4bce private Map> literals = Maps.newLinkedHashMap(); private Map> arguments = Maps.newLinkedHashMap(); private final Predicate requirement; -@@ -106,8 +106,7 @@ public abstract class CommandNode implements Comparable> { +@@ -107,8 +107,7 @@ public abstract class CommandNode implements Comparable> { arguments.put(node.getName(), (ArgumentCommandNode) node); } } diff --git a/Spigot-Server-Patches/0486-Allow-sleeping-players-to-float.patch b/Spigot-Server-Patches/0486-Allow-sleeping-players-to-float.patch deleted file mode 100644 index 0727ae686..000000000 --- a/Spigot-Server-Patches/0486-Allow-sleeping-players-to-float.patch +++ /dev/null @@ -1,23 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Mariell Hoversholm -Date: Sun, 19 Apr 2020 12:25:20 +0200 -Subject: [PATCH] Allow sleeping players to float - -This change lets players who are in their bed have a position which is above -ground for a longer period of time. This is because of the server not setting -their position to the ground/exit location when entering the bed, resulting in -the server believing they're still in the air. - -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 6dd4303c1c211ac4b0bb542ea96cc150581bf8c1..08e087d952edfecd73ad698684b71c09dabbac9e 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -160,7 +160,7 @@ public class PlayerConnection implements PacketListenerPlayIn { - this.player.setLocation(this.l, this.m, this.n, this.player.yaw, this.player.pitch); - ++this.e; - this.processedMovePackets = this.receivedMovePackets; -- if (this.B) { -+ if (this.B && !this.player.isSleeping()) { // Paper - #3176 Allow sleeping players to float - if (++this.C > 80) { - PlayerConnection.LOGGER.warn("{} was kicked for floating too long!", this.player.getDisplayName().getString()); - this.disconnect(com.destroystokyo.paper.PaperConfig.flyingKickPlayerMessage); // Paper - use configurable kick message diff --git a/Spigot-Server-Patches/0510-Don-t-toString-block-unless-actually-showing-the-mes.patch b/Spigot-Server-Patches/0486-Don-t-toString-block-unless-actually-showing-the-mes.patch similarity index 92% rename from Spigot-Server-Patches/0510-Don-t-toString-block-unless-actually-showing-the-mes.patch rename to Spigot-Server-Patches/0486-Don-t-toString-block-unless-actually-showing-the-mes.patch index f81d312f6..11c031b70 100644 --- a/Spigot-Server-Patches/0510-Don-t-toString-block-unless-actually-showing-the-mes.patch +++ b/Spigot-Server-Patches/0486-Don-t-toString-block-unless-actually-showing-the-mes.patch @@ -7,7 +7,7 @@ This is causing MASSIVE performance issues with hoppers and block states in general. diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java -index 3e22d558ea09a6554e1bc71f8ca10277ec480705..3da34ebcb96040ef4b399e348d1cff2f000aefa2 100644 +index 6e9eff2c29528b857cf758e9e45606c8a1c1cc8d..dc0e6e49e9eb5004e53d24304bce095bcef8f4c2 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java @@ -26,7 +26,7 @@ public class CraftBlockEntityState extends CraftBlockState diff --git a/Spigot-Server-Patches/0514-Potential-bed-API.patch b/Spigot-Server-Patches/0487-Potential-bed-API.patch similarity index 57% rename from Spigot-Server-Patches/0514-Potential-bed-API.patch rename to Spigot-Server-Patches/0487-Potential-bed-API.patch index 2dd156300..75be78853 100644 --- a/Spigot-Server-Patches/0514-Potential-bed-API.patch +++ b/Spigot-Server-Patches/0487-Potential-bed-API.patch @@ -8,24 +8,29 @@ Adds a new method to fetch the location of a player's bed without generating any getPotentialBedLocation - Gets the last known location of a player's bed. This does not preform any check if the bed is still valid and does not load any chunks. diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -index a5e9fc90ffae794b9b14468337ce7b091fd0dc35..a2815073bc04dd831fa22da47162031d360683dd 100644 +index 75aa141e86e301254b25ede3da67513aae76fa5c..fef2035fe5564645d786d042dceedb10ca8b59ce 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -@@ -143,6 +143,17 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { - return null; +@@ -127,6 +127,22 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { + return getHandle().sleepTicks; } + // Paper start - Potential bed api + @Override + public Location getPotentialBedLocation() { -+ BlockPosition bed = getHandle().getBed(); ++ EntityPlayer handle = (EntityPlayer) getHandle(); ++ BlockPosition bed = handle.getSpawn(); + if (bed == null) { + return null; + } -+ return new Location(getServer().getWorld(getHandle().spawnWorld), bed.getX(), bed.getY(), bed.getZ()); ++ ++ net.minecraft.server.WorldServer worldServer = handle.server.getWorldServer(handle.getSpawnDimension()); ++ if (worldServer == null) { ++ return null; ++ } ++ return new Location(worldServer.getWorld(), bed.getX(), bed.getY(), bed.getZ()); + } + // Paper end -+ @Override - public void setBedSpawnLocation(Location location) { - setBedSpawnLocation(location, false); + public boolean sleep(Location location, boolean force) { + Preconditions.checkArgument(location != null, "Location cannot be null"); diff --git a/Spigot-Server-Patches/0515-Wait-for-Async-Tasks-during-shutdown.patch b/Spigot-Server-Patches/0488-Wait-for-Async-Tasks-during-shutdown.patch similarity index 87% rename from Spigot-Server-Patches/0515-Wait-for-Async-Tasks-during-shutdown.patch rename to Spigot-Server-Patches/0488-Wait-for-Async-Tasks-during-shutdown.patch index b7b12e779..5c20dd505 100644 --- a/Spigot-Server-Patches/0515-Wait-for-Async-Tasks-during-shutdown.patch +++ b/Spigot-Server-Patches/0488-Wait-for-Async-Tasks-during-shutdown.patch @@ -10,10 +10,10 @@ Adds a 5 second grace period for any async tasks to finish and warns if any are still running after that delay just as reload does. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 2c9ae5c46a39639fd9f842df23993a47b31c8585..4ab6579032043f570c20befa7fef8931babd2355 100644 +index b32d41fac5f855e302469209f368c3674b849fe3..7c1c929819c450f853c91618b2853fcb424caa22 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -747,6 +747,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant -Date: Thu, 23 Apr 2020 01:36:39 -0400 -Subject: [PATCH] Don't fire BlockFade on worldgen threads - -Caused a deadlock - -diff --git a/src/main/java/net/minecraft/server/BlockFire.java b/src/main/java/net/minecraft/server/BlockFire.java -index b41de95a6390910ba8bb21bfa12ab61c85900218..9e501514f30de00d68736d9593582a5e7c8b3cff 100644 ---- a/src/main/java/net/minecraft/server/BlockFire.java -+++ b/src/main/java/net/minecraft/server/BlockFire.java -@@ -44,6 +44,7 @@ public class BlockFire extends Block { - @Override - public IBlockData updateState(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) { - // CraftBukkit start -+ if (!(generatoraccess instanceof WorldServer)) return this.canPlace(iblockdata, generatoraccess, blockposition) ? (IBlockData) this.a((IBlockAccess) generatoraccess, blockposition).set(BlockFire.AGE, iblockdata.get(BlockFire.AGE)) : Blocks.AIR.getBlockData(); // Paper - don't fire events in world generation - if (!iblockdata.canPlace(generatoraccess, blockposition)) { - CraftBlockState blockState = CraftBlockState.getBlockState(generatoraccess, blockposition); - blockState.setData(Blocks.AIR.getBlockData()); diff --git a/Spigot-Server-Patches/0517-Ensure-EntityRaider-respects-game-and-entity-rules-f.patch b/Spigot-Server-Patches/0489-Ensure-EntityRaider-respects-game-and-entity-rules-f.patch similarity index 77% rename from Spigot-Server-Patches/0517-Ensure-EntityRaider-respects-game-and-entity-rules-f.patch rename to Spigot-Server-Patches/0489-Ensure-EntityRaider-respects-game-and-entity-rules-f.patch index a5a5728cf..7bdfe0e2d 100644 --- a/Spigot-Server-Patches/0517-Ensure-EntityRaider-respects-game-and-entity-rules-f.patch +++ b/Spigot-Server-Patches/0489-Ensure-EntityRaider-respects-game-and-entity-rules-f.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Ensure EntityRaider respects game and entity rules for diff --git a/src/main/java/net/minecraft/server/EntityRaider.java b/src/main/java/net/minecraft/server/EntityRaider.java -index c0b7b5f072b0b3777b2042b0b80f3bb22e617b11..ee1fcb11afbc3efa42ce0170b72da3fd4460b95b 100644 +index a1f89a5c0a8b7bd13ce12fd8e27fc352e877d26f..751873c20ef74daa1e1f7278e8364a22be18504c 100644 --- a/src/main/java/net/minecraft/server/EntityRaider.java +++ b/src/main/java/net/minecraft/server/EntityRaider.java -@@ -486,7 +486,7 @@ public abstract class EntityRaider extends EntityMonsterPatrolling { +@@ -487,7 +487,7 @@ public abstract class EntityRaider extends EntityMonsterPatrolling { public class b extends PathfinderGoal { @@ -18,12 +18,11 @@ index c0b7b5f072b0b3777b2042b0b80f3bb22e617b11..ee1fcb11afbc3efa42ce0170b72da3fd public b(T entityraider) { // CraftBukkit - decompile error this.b = entityraider; -@@ -495,6 +495,8 @@ public abstract class EntityRaider extends EntityMonsterPatrolling { +@@ -496,6 +496,7 @@ public abstract class EntityRaider extends EntityMonsterPatrolling { @Override public boolean a() { + if (!getRaider().world.getGameRules().getBoolean(GameRules.MOB_GRIEFING) || !getRaider().canPickupLoot()) return false; // Paper - respect game and entity rules for picking up items -+ - Raid raid = this.b.eE(); + Raid raid = this.b.fb(); - if (this.b.eF() && !this.b.eE().a() && this.b.es() && !ItemStack.matches(this.b.getEquipment(EnumItemSlot.HEAD), Raid.s())) { + if (this.b.fc() && !this.b.fb().a() && this.b.eO() && !ItemStack.matches(this.b.getEquipment(EnumItemSlot.HEAD), Raid.s())) { diff --git a/Spigot-Server-Patches/0519-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch b/Spigot-Server-Patches/0490-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch similarity index 69% rename from Spigot-Server-Patches/0519-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch rename to Spigot-Server-Patches/0490-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch index 6952b8854..dcbc1c67e 100644 --- a/Spigot-Server-Patches/0519-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch +++ b/Spigot-Server-Patches/0490-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch @@ -13,10 +13,10 @@ A config is provided if you rather let players use these exploits, and let them destroy the worlds End Portals and get on top of the nether easy. diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 3ee7e5671dd2519cec72b81211f1f39176a228ba..cf9b9de8688e3f655631451409096d7ec0471910 100644 +index ac01d492872fde6df2b7113005457c714b91fe44..44f431bee68275d48aad75367aaec40a7ca59bea 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -431,4 +431,10 @@ public class PaperConfig { +@@ -411,4 +411,10 @@ public class PaperConfig { private static void midTickChunkTasks() { midTickChunkTasks = getInt("settings.chunk-tasks-per-tick", midTickChunkTasks); } @@ -28,12 +28,12 @@ index 3ee7e5671dd2519cec72b81211f1f39176a228ba..cf9b9de8688e3f655631451409096d7e + } diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java -index e40375b67a4a321048c87002a07fde5c5d2395db..d2207a2c95690de586ab2d181b64955a6d2ea70d 100644 +index 4f9c6b25f152b348a00dadf4b8f58ec3adc3476e..81725611d5b8c10c05d561984f92dc67349900ec 100644 --- a/src/main/java/net/minecraft/server/Block.java +++ b/src/main/java/net/minecraft/server/Block.java -@@ -32,6 +32,14 @@ public class Block implements IMaterial { - protected final SoundEffectType stepSound; - protected final Material material; +@@ -25,6 +25,14 @@ public class Block extends BlockBase implements IMaterial { + protected final BlockStateList blockStateList; + private IBlockData blockData; // Paper start + public final boolean isDestroyable() { + return com.destroystokyo.paper.PaperConfig.allowBlockPermanentBreakingExploits || @@ -46,7 +46,11 @@ index e40375b67a4a321048c87002a07fde5c5d2395db..d2207a2c95690de586ab2d181b64955a public co.aikar.timings.Timing timing; public co.aikar.timings.Timing getTiming() { if (timing == null) { -@@ -276,7 +284,7 @@ public class Block implements IMaterial { +diff --git a/src/main/java/net/minecraft/server/BlockBase.java b/src/main/java/net/minecraft/server/BlockBase.java +index aa4bfc9fe8e917c1c19838b0a7b045a11fc9300b..ff770a3b0e5c4fcccc498ecca51dad9863b0fe0e 100644 +--- a/src/main/java/net/minecraft/server/BlockBase.java ++++ b/src/main/java/net/minecraft/server/BlockBase.java +@@ -138,7 +138,7 @@ public abstract class BlockBase { @Deprecated public boolean a(IBlockData iblockdata, BlockActionContext blockactioncontext) { @@ -55,20 +59,33 @@ index e40375b67a4a321048c87002a07fde5c5d2395db..d2207a2c95690de586ab2d181b64955a } @Deprecated -@@ -596,7 +604,7 @@ public class Block implements IMaterial { +@@ -342,7 +342,11 @@ public abstract class BlockBase { + public Block getBlock() { + return (Block) this.c; + } +- ++ // Paper start ++ public final boolean isDestroyable() { ++ return getBlock().isDestroyable(); ++ } ++ // Paper end + public Material getMaterial() { + return this.g; + } +@@ -432,7 +436,7 @@ public abstract class BlockBase { + } - @Deprecated - public EnumPistonReaction getPushReaction(IBlockData iblockdata) { -- return this.material.getPushReaction(); -+ return !blockData.isDestroyable() ? EnumPistonReaction.BLOCK : this.material.getPushReaction(); // Paper - } + public EnumPistonReaction getPushReaction() { +- return this.getBlock().getPushReaction(this.p()); ++ return !isDestroyable() ? EnumPistonReaction.BLOCK : this.getBlock().getPushReaction(this.p()); // Paper + } - public void fallOn(World world, BlockPosition blockposition, Entity entity, float f) { + public boolean i(IBlockAccess iblockaccess, BlockPosition blockposition) { diff --git a/src/main/java/net/minecraft/server/BlockPiston.java b/src/main/java/net/minecraft/server/BlockPiston.java -index b29525c40dc8e3ae747b8ddf5a3bd79b7cc0b792..39cd8ab5925ceb9494e0ac910c73338c24ecda2c 100644 +index c068a4115e3b82f4886d822d2472e8b522946674..6b1253fe7e8d4bb71d4d19c063d3e84c167c4d7b 100644 --- a/src/main/java/net/minecraft/server/BlockPiston.java +++ b/src/main/java/net/minecraft/server/BlockPiston.java -@@ -175,6 +175,12 @@ public class BlockPiston extends BlockDirectional { +@@ -165,6 +165,12 @@ public class BlockPiston extends BlockDirectional { @Override public boolean a(IBlockData iblockdata, World world, BlockPosition blockposition, int i, int j) { EnumDirection enumdirection = (EnumDirection) iblockdata.get(BlockPiston.FACING); @@ -81,16 +98,16 @@ index b29525c40dc8e3ae747b8ddf5a3bd79b7cc0b792..39cd8ab5925ceb9494e0ac910c73338c if (!world.isClientSide) { boolean flag = this.a(world, blockposition, enumdirection); -@@ -204,7 +210,7 @@ public class BlockPiston extends BlockDirectional { - } +@@ -196,7 +202,7 @@ public class BlockPiston extends BlockDirectional { + IBlockData iblockdata1 = (IBlockData) ((IBlockData) Blocks.MOVING_PISTON.getBlockData().set(BlockPistonMoving.a, enumdirection)).set(BlockPistonMoving.b, this.sticky ? BlockPropertyPistonType.STICKY : BlockPropertyPistonType.DEFAULT); - world.setTypeAndData(blockposition, (IBlockData) ((IBlockData) Blocks.MOVING_PISTON.getBlockData().set(BlockPistonMoving.a, enumdirection)).set(BlockPistonMoving.b, this.sticky ? BlockPropertyPistonType.STICKY : BlockPropertyPistonType.DEFAULT), 3); + world.setTypeAndData(blockposition, iblockdata1, 20); - world.setTileEntity(blockposition, BlockPistonMoving.a((IBlockData) this.getBlockData().set(BlockPiston.FACING, EnumDirection.fromType1(j & 7)), enumdirection, false, true)); -+ world.setTileEntity(blockposition, BlockPistonMoving.a((IBlockData) this.getBlockData().set(BlockPiston.FACING, EnumDirection.fromType1(j & 7)), enumdirection, false, true)); // Paper - diff on change, j is facing direction ++ world.setTileEntity(blockposition, BlockPistonMoving.a((IBlockData) this.getBlockData().set(BlockPiston.FACING, EnumDirection.fromType1(j & 7)), enumdirection, false, true)); // Paper - diff on change, j is facing direction - copy this above + world.update(blockposition, iblockdata1.getBlock()); + iblockdata1.a(world, blockposition, 2); if (this.sticky) { - BlockPosition blockposition1 = blockposition.b(enumdirection.getAdjacentX() * 2, enumdirection.getAdjacentY() * 2, enumdirection.getAdjacentZ() * 2); - IBlockData iblockdata1 = world.getType(blockposition1); -@@ -232,7 +238,14 @@ public class BlockPiston extends BlockDirectional { +@@ -225,7 +231,14 @@ public class BlockPiston extends BlockDirectional { } } } else { @@ -107,18 +124,18 @@ index b29525c40dc8e3ae747b8ddf5a3bd79b7cc0b792..39cd8ab5925ceb9494e0ac910c73338c world.playSound((EntityHuman) null, blockposition, SoundEffects.BLOCK_PISTON_CONTRACT, SoundCategory.BLOCKS, 0.5F, world.random.nextFloat() * 0.15F + 0.6F); diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java -index a353f3d5fa5a5f54335f73584589de3f5cb20d3e..2552f860ff7a25f74e9a0600e58cefe064fac484 100644 +index 22a19e761fdec68cc9405988b977021a8b6398eb..e408ec8c645e9ceb278a13a5b0de8ecf57f3929e 100644 --- a/src/main/java/net/minecraft/server/Explosion.java +++ b/src/main/java/net/minecraft/server/Explosion.java -@@ -117,6 +117,7 @@ public class Explosion { +@@ -124,6 +124,7 @@ public class Explosion { for (float f1 = 0.3F; f > 0.0F; f -= 0.22500001F) { BlockPosition blockposition = new BlockPosition(d4, d5, d6); IBlockData iblockdata = this.world.getType(blockposition); + if (!iblockdata.isDestroyable()) continue; // Paper Fluid fluid = iblockdata.getFluid(); // Paper + Optional optional = this.k.a(this, this.world, blockposition, iblockdata, fluid); - if (!iblockdata.isAir() || !fluid.isEmpty()) { -@@ -282,7 +283,7 @@ public class Explosion { +@@ -277,7 +278,7 @@ public class Explosion { IBlockData iblockdata = this.world.getType(blockposition); Block block = iblockdata.getBlock(); @@ -127,28 +144,12 @@ index a353f3d5fa5a5f54335f73584589de3f5cb20d3e..2552f860ff7a25f74e9a0600e58cefe0 BlockPosition blockposition1 = blockposition.immutableCopy(); this.world.getMethodProfiler().enter("explosion_blocks"); -diff --git a/src/main/java/net/minecraft/server/IBlockData.java b/src/main/java/net/minecraft/server/IBlockData.java -index b19bbbbc81376177751396a2de9452ce1f84c06b..296b41bf36ee1ace5bd9db2b810bf926b5f5278f 100644 ---- a/src/main/java/net/minecraft/server/IBlockData.java -+++ b/src/main/java/net/minecraft/server/IBlockData.java -@@ -52,6 +52,11 @@ public class IBlockData extends BlockDataAbstract implements - return (CraftBlockData) cachedCraftBlockData.clone(); - } - // Paper end -+ // Paper start -+ public final boolean isDestroyable() { -+ return getBlock().isDestroyable(); -+ } -+ // Paper end - - public Material getMaterial() { - return this.getBlock().k(this); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 7bd3f789b6055d73f3a6c0628652cca241147887..032b7acee8c8af70c0283f5551ce2875607f6c98 100644 +index ba50189b10b54f5b35448c898f8c3495ddf8e112..b598c48692ff340a081995384aeecf9a2266d10f 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -342,6 +342,10 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - public boolean setTypeAndData(BlockPosition blockposition, IBlockData iblockdata, int i) { +@@ -406,6 +406,10 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + public boolean a(BlockPosition blockposition, IBlockData iblockdata, int i, int j) { // CraftBukkit start - tree generation if (this.captureTreeGeneration) { + // Paper start diff --git a/Spigot-Server-Patches/0520-Optimize-NibbleArray-to-use-pooled-buffers.patch b/Spigot-Server-Patches/0491-Optimize-NibbleArray-to-use-pooled-buffers.patch similarity index 90% rename from Spigot-Server-Patches/0520-Optimize-NibbleArray-to-use-pooled-buffers.patch rename to Spigot-Server-Patches/0491-Optimize-NibbleArray-to-use-pooled-buffers.patch index bbd03eef7..a45915f39 100644 --- a/Spigot-Server-Patches/0520-Optimize-NibbleArray-to-use-pooled-buffers.patch +++ b/Spigot-Server-Patches/0491-Optimize-NibbleArray-to-use-pooled-buffers.patch @@ -9,10 +9,10 @@ an object pool for these. Uses lots of advanced new capabilities of the Paper codebase :) diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index e625842e524f18e469f7695b27d52d4d04892266..d752e793f13a9caf5d255293f7ce9d562fd50064 100644 +index 5b196201c0e35895a04e2a542ef7c753d0c469e1..4b7c4643f04448aaccc66f26a9dea2323bea420d 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -@@ -387,11 +387,11 @@ public class ChunkRegionLoader { +@@ -386,11 +386,11 @@ public class ChunkRegionLoader { } if (nibblearray != null && !nibblearray.c()) { @@ -27,10 +27,10 @@ index e625842e524f18e469f7695b27d52d4d04892266..d752e793f13a9caf5d255293f7ce9d56 nbttaglist.add(nbttagcompound2); diff --git a/src/main/java/net/minecraft/server/LightEngineStorage.java b/src/main/java/net/minecraft/server/LightEngineStorage.java -index 88277d23c36696fdd5363e41a130c9a443fac2c0..b0b7544592981bcff22c8acee7230a211918ef28 100644 +index 6c7c4e75670a7e08ba10c0231a2510bf985dab6b..b8b06c790adfa0246b1a6fb5eab1f63bf5ef8b0b 100644 --- a/src/main/java/net/minecraft/server/LightEngineStorage.java +++ b/src/main/java/net/minecraft/server/LightEngineStorage.java -@@ -148,7 +148,7 @@ public abstract class LightEngineStorage> e +@@ -149,7 +149,7 @@ public abstract class LightEngineStorage> e protected NibbleArray j(long i) { NibbleArray nibblearray = (NibbleArray) this.i.get(i); @@ -39,12 +39,15 @@ index 88277d23c36696fdd5363e41a130c9a443fac2c0..b0b7544592981bcff22c8acee7230a21 } protected void a(LightEngineLayer lightenginelayer, long i) { -@@ -317,9 +317,9 @@ public abstract class LightEngineStorage> e +@@ -331,12 +331,12 @@ public abstract class LightEngineStorage> e - protected void a(long i, @Nullable NibbleArray nibblearray) { + protected void a(long i, @Nullable NibbleArray nibblearray, boolean flag) { if (nibblearray != null) { - this.i.put(i, nibblearray); + NibbleArray remove = this.i.put(i, nibblearray); if (remove != null && remove.cleaner != null) remove.cleaner.run(); // Paper - clean up when removed + if (!flag) { + this.n.add(i); + } } else { - this.i.remove(i); + NibbleArray remove = this.i.remove(i); if (remove != null && remove.cleaner != null) remove.cleaner.run(); // Paper - clean up when removed @@ -244,12 +247,21 @@ index 67c960292db9d99ac85b5d0dda50ae48ef942c1b..5e3efa1fa6c089df35971ce5c83da384 for (int i = 0; i < 16; ++i) { System.arraycopy(this.a, 0, abyte, i * 128, 128); diff --git a/src/main/java/net/minecraft/server/PacketPlayOutLightUpdate.java b/src/main/java/net/minecraft/server/PacketPlayOutLightUpdate.java -index cd1ad45469aa163b9bc41774ae80adfa617fd97b..27068f73a2b1fd97dc675ceb3f0eb07ac9e59437 100644 +index 6b70df646c6a690ab9437ead96c5ff097e4e12d2..a22f0cccecc85b4e4fe4603bcfa213f15c23db69 100644 --- a/src/main/java/net/minecraft/server/PacketPlayOutLightUpdate.java +++ b/src/main/java/net/minecraft/server/PacketPlayOutLightUpdate.java -@@ -16,13 +16,42 @@ public class PacketPlayOutLightUpdate implements Packet { - private List g; +@@ -1,6 +1,8 @@ + package net.minecraft.server; + + import com.google.common.collect.Lists; ++import io.netty.channel.ChannelFuture; // Paper ++ + import java.io.IOException; + import java.util.Iterator; + import java.util.List; +@@ -17,14 +19,43 @@ public class PacketPlayOutLightUpdate implements Packet { private List h; + private boolean i; + // Paper start + java.lang.Runnable cleaner1; @@ -262,7 +274,7 @@ index cd1ad45469aa163b9bc41774ae80adfa617fd97b..27068f73a2b1fd97dc675ceb3f0eb07a + } + + @Override -+ public void onPacketDispatchFinish(EntityPlayer player, io.netty.channel.ChannelFuture future) { ++ public void onPacketDispatchFinish(EntityPlayer player, ChannelFuture future) { + if (remainingSends.decrementAndGet() <= 0) { + // incase of any race conditions, schedule this delayed + MCUtil.scheduleTask(5, () -> { @@ -282,9 +294,10 @@ index cd1ad45469aa163b9bc41774ae80adfa617fd97b..27068f73a2b1fd97dc675ceb3f0eb07a + // Paper end public PacketPlayOutLightUpdate() {} - public PacketPlayOutLightUpdate(ChunkCoordIntPair chunkcoordintpair, LightEngine lightengine) { + public PacketPlayOutLightUpdate(ChunkCoordIntPair chunkcoordintpair, LightEngine lightengine, boolean flag) { this.a = chunkcoordintpair.x; this.b = chunkcoordintpair.z; + this.i = flag; - this.g = Lists.newArrayList(); - this.h = Lists.newArrayList(); + this.g = Lists.newArrayList();cleaner1 = MCUtil.registerListCleaner(this, this.g, NibbleArray::releaseBytes); // Paper @@ -292,7 +305,7 @@ index cd1ad45469aa163b9bc41774ae80adfa617fd97b..27068f73a2b1fd97dc675ceb3f0eb07a for (int i = 0; i < 18; ++i) { NibbleArray nibblearray = lightengine.a(EnumSkyBlock.SKY).a(SectionPosition.a(chunkcoordintpair, -1 + i)); -@@ -33,7 +62,7 @@ public class PacketPlayOutLightUpdate implements Packet { +@@ -35,7 +66,7 @@ public class PacketPlayOutLightUpdate implements Packet { this.e |= 1 << i; } else { this.c |= 1 << i; @@ -301,7 +314,7 @@ index cd1ad45469aa163b9bc41774ae80adfa617fd97b..27068f73a2b1fd97dc675ceb3f0eb07a } } -@@ -42,7 +71,7 @@ public class PacketPlayOutLightUpdate implements Packet { +@@ -44,7 +75,7 @@ public class PacketPlayOutLightUpdate implements Packet { this.f |= 1 << i; } else { this.d |= 1 << i; @@ -310,8 +323,8 @@ index cd1ad45469aa163b9bc41774ae80adfa617fd97b..27068f73a2b1fd97dc675ceb3f0eb07a } } } -@@ -54,8 +83,8 @@ public class PacketPlayOutLightUpdate implements Packet { - this.b = chunkcoordintpair.z; +@@ -57,8 +88,8 @@ public class PacketPlayOutLightUpdate implements Packet { + this.i = flag; this.c = i; this.d = j; - this.g = Lists.newArrayList(); @@ -321,7 +334,7 @@ index cd1ad45469aa163b9bc41774ae80adfa617fd97b..27068f73a2b1fd97dc675ceb3f0eb07a for (int k = 0; k < 18; ++k) { NibbleArray nibblearray; -@@ -63,7 +92,7 @@ public class PacketPlayOutLightUpdate implements Packet { +@@ -66,7 +97,7 @@ public class PacketPlayOutLightUpdate implements Packet { if ((this.c & 1 << k) != 0) { nibblearray = lightengine.a(EnumSkyBlock.SKY).a(SectionPosition.a(chunkcoordintpair, -1 + k)); if (nibblearray != null && !nibblearray.c()) { @@ -330,7 +343,7 @@ index cd1ad45469aa163b9bc41774ae80adfa617fd97b..27068f73a2b1fd97dc675ceb3f0eb07a } else { this.c &= ~(1 << k); if (nibblearray != null) { -@@ -75,7 +104,7 @@ public class PacketPlayOutLightUpdate implements Packet { +@@ -78,7 +109,7 @@ public class PacketPlayOutLightUpdate implements Packet { if ((this.d & 1 << k) != 0) { nibblearray = lightengine.a(EnumSkyBlock.BLOCK).a(SectionPosition.a(chunkcoordintpair, -1 + k)); if (nibblearray != null && !nibblearray.c()) { @@ -340,10 +353,10 @@ index cd1ad45469aa163b9bc41774ae80adfa617fd97b..27068f73a2b1fd97dc675ceb3f0eb07a this.d &= ~(1 << k); if (nibblearray != null) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -index 39ef95cbbb1d1d049354ae1e8991309e918d0462..ec3f560556c3056bdfc11cc6a7eb76420f13abad 100644 +index 01bf7320b5cbc38e278ca907aa324ee3e945805e..06e42b7db5385f9a357183552259e7b4491d9fd0 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -@@ -271,14 +271,14 @@ public class CraftChunk implements Chunk { +@@ -273,14 +273,14 @@ public class CraftChunk implements Chunk { sectionSkyLights[i] = emptyLight; } else { sectionSkyLights[i] = new byte[2048]; diff --git a/Spigot-Server-Patches/0521-Reduce-MutableInt-allocations-from-light-engine.patch b/Spigot-Server-Patches/0492-Reduce-MutableInt-allocations-from-light-engine.patch similarity index 100% rename from Spigot-Server-Patches/0521-Reduce-MutableInt-allocations-from-light-engine.patch rename to Spigot-Server-Patches/0492-Reduce-MutableInt-allocations-from-light-engine.patch diff --git a/Spigot-Server-Patches/0522-Reduce-allocation-of-Vec3D-by-entity-tracker.patch b/Spigot-Server-Patches/0493-Reduce-allocation-of-Vec3D-by-entity-tracker.patch similarity index 90% rename from Spigot-Server-Patches/0522-Reduce-allocation-of-Vec3D-by-entity-tracker.patch rename to Spigot-Server-Patches/0493-Reduce-allocation-of-Vec3D-by-entity-tracker.patch index 45ed81a06..25023a520 100644 --- a/Spigot-Server-Patches/0522-Reduce-allocation-of-Vec3D-by-entity-tracker.patch +++ b/Spigot-Server-Patches/0493-Reduce-allocation-of-Vec3D-by-entity-tracker.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Reduce allocation of Vec3D by entity tracker diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -index 6d3b34ead9cc95dcc1152dffa8c6c4a8c7f1d58b..5cc89c0cf9e9e632212a9653391437cbe9b15031 100644 +index 0c46297e6ff229538d77b2f481e4ab13ea14c48e..f75c09d44a19f84588f21a55ea8f0dd8ccb539b9 100644 --- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java +++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -@@ -125,8 +125,12 @@ public class EntityTrackerEntry { +@@ -127,8 +127,12 @@ public class EntityTrackerEntry { ++this.o; i = MathHelper.d(this.tracker.yaw * 256.0F / 360.0F); j = MathHelper.d(this.tracker.pitch * 256.0F / 360.0F); @@ -23,7 +23,7 @@ index 6d3b34ead9cc95dcc1152dffa8c6c4a8c7f1d58b..5cc89c0cf9e9e632212a9653391437cb Packet packet1 = null; boolean flag2 = flag1 || this.tickCounter % 60 == 0; boolean flag3 = Math.abs(i - this.yRot) >= 1 || Math.abs(j - this.xRot) >= 1; -@@ -143,9 +147,11 @@ public class EntityTrackerEntry { +@@ -145,9 +149,11 @@ public class EntityTrackerEntry { // CraftBukkit end if (this.tickCounter > 0 || this.tracker instanceof EntityArrow) { @@ -37,12 +37,12 @@ index 6d3b34ead9cc95dcc1152dffa8c6c4a8c7f1d58b..5cc89c0cf9e9e632212a9653391437cb + // Paper end - remove allocation of Vec3D here boolean flag4 = k < -32768L || k > 32767L || l < -32768L || l > 32767L || i1 < -32768L || i1 > 32767L; - if (!flag4 && this.o <= 400 && !this.q && this.r == this.tracker.onGround) { + if (!flag4 && this.o <= 400 && !this.q && this.r == this.tracker.isOnGround()) { diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index f361939b9ae451bdccf7922e9cca09344c6152b5..68dd9220bb360c75057919fed0598b415b947e4d 100644 +index 750749f8533e95b33a6f555900c23bb11b3fda40..2938a7d46a471aca89b3dc3d8cad0659aea7c69f 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -2096,9 +2096,14 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -2131,9 +2131,14 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { public void updatePlayer(EntityPlayer entityplayer) { org.spigotmc.AsyncCatcher.catchOp("player tracker update"); // Spigot if (entityplayer != this.tracker) { diff --git a/Spigot-Server-Patches/0493-Villager-Restocks-API.patch b/Spigot-Server-Patches/0493-Villager-Restocks-API.patch deleted file mode 100644 index f47011ebd..000000000 --- a/Spigot-Server-Patches/0493-Villager-Restocks-API.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: zbk -Date: Sun, 26 Apr 2020 23:49:01 -0400 -Subject: [PATCH] Villager Restocks API - - -diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java -index b3462576469f67dca618c54bb35fd53454afcd1f..eeb76bc0298711ac3ea24440a172e812925f875e 100644 ---- a/src/main/java/net/minecraft/server/EntityVillager.java -+++ b/src/main/java/net/minecraft/server/EntityVillager.java -@@ -992,4 +992,13 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation - - return optional.isPresent() && optional1.isPresent() ? i - ((MinecraftSerializableLong) optional.get()).a() < 24000L && i - ((MinecraftSerializableLong) optional1.get()).a() < 36000L : false; - } -+ -+ // Paper start -+ public int getRestocksToday(){ -+ return this.bL; -+ } -+ public void setRestocksToday(int restocksToday){ -+ this.bL = restocksToday; -+ } -+ // Paper end - } -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java -index fe726e7884c9f091d73c8f5d2cb58a87a16649f8..a8384081c03884c86578dca677914d77441c1863 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java -@@ -82,6 +82,18 @@ public class CraftVillager extends CraftAbstractVillager implements Villager { - getHandle().setExperience(experience); - } - -+ // Paper start -+ @Override -+ public int getRestocksToday() { -+ return getHandle().getRestocksToday(); -+ } -+ -+ @Override -+ public void setRestocksToday(int restocksToday) { -+ getHandle().setRestocksToday(restocksToday); -+ } -+ // Paper end -+ - @Override - public boolean sleep(Location location) { - Preconditions.checkArgument(location != null, "Location cannot be null"); diff --git a/Spigot-Server-Patches/0523-Ensure-safe-gateway-teleport.patch b/Spigot-Server-Patches/0494-Ensure-safe-gateway-teleport.patch similarity index 64% rename from Spigot-Server-Patches/0523-Ensure-safe-gateway-teleport.patch rename to Spigot-Server-Patches/0494-Ensure-safe-gateway-teleport.patch index 3e35b9bdc..af8fb316e 100644 --- a/Spigot-Server-Patches/0523-Ensure-safe-gateway-teleport.patch +++ b/Spigot-Server-Patches/0494-Ensure-safe-gateway-teleport.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Ensure safe gateway teleport diff --git a/src/main/java/net/minecraft/server/TileEntityEndGateway.java b/src/main/java/net/minecraft/server/TileEntityEndGateway.java -index c71f76004ed934e9e921efc4cb637f2e77af92d2..87aef515c65c8bd815667b1a77f453fee76b192d 100644 +index ea61a473d8e47428ed5cd4541a5855f0e2c50815..ce239d2b2fe942915aa093b86343c3740d10e273 100644 --- a/src/main/java/net/minecraft/server/TileEntityEndGateway.java +++ b/src/main/java/net/minecraft/server/TileEntityEndGateway.java @@ -62,10 +62,14 @@ public class TileEntityEndGateway extends TileEntityEnderPortal implements ITick @@ -14,16 +14,15 @@ index c71f76004ed934e9e921efc4cb637f2e77af92d2..87aef515c65c8bd815667b1a77f453fe List list = this.world.a(Entity.class, new AxisAlignedBB(this.getPosition())); - - if (!list.isEmpty()) { -- this.a(((Entity) list.get(0)).getRootVehicle()); -- } -+ // Paper start -+ for (Entity entity : list) { -+ if (!entity.isPassenger() && !entity.isVehicle() && entity.canPortal()) { -+ this.a(entity); -+ break; -+ } +- this.a((Entity) list.get(this.world.random.nextInt(list.size()))); ++ // Paper start ++ for (Entity entity : list) { ++ if (entity.canPortal()) { ++ this.a(entity); ++ break; + } -+ // Paper end + } ++ // Paper end if (this.age % 2400L == 0L) { this.h(); diff --git a/Spigot-Server-Patches/0525-Add-option-for-console-having-all-permissions.patch b/Spigot-Server-Patches/0495-Add-option-for-console-having-all-permissions.patch similarity index 90% rename from Spigot-Server-Patches/0525-Add-option-for-console-having-all-permissions.patch rename to Spigot-Server-Patches/0495-Add-option-for-console-having-all-permissions.patch index f04d491a8..42c9b660a 100644 --- a/Spigot-Server-Patches/0525-Add-option-for-console-having-all-permissions.patch +++ b/Spigot-Server-Patches/0495-Add-option-for-console-having-all-permissions.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add option for console having all permissions diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index cf9b9de8688e3f655631451409096d7ec0471910..f0284e81db3ab7c45018de2b446f2d8296df15c3 100644 +index 44f431bee68275d48aad75367aaec40a7ca59bea..06adb1fa670e7d755560abae67d46447d63370f0 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -437,4 +437,9 @@ public class PaperConfig { +@@ -417,4 +417,9 @@ public class PaperConfig { allowBlockPermanentBreakingExploits = getBoolean("allow-perm-block-break-exploits", allowBlockPermanentBreakingExploits); } @@ -40,10 +40,10 @@ index bfd21a07280a79d279388c785c78fb8fe731102a..e67da10f9bfbb8125d8fbf34695997ec + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/command/CraftRemoteConsoleCommandSender.java b/src/main/java/org/bukkit/craftbukkit/command/CraftRemoteConsoleCommandSender.java -index 228e88a6e2b93ef2c4a5774cc8663b64467fb9eb..4024408815205c12eac9fdb246497ba713295f4b 100644 +index 655bdbc37d0b95622206569229d4f4ea9496c69d..5562a7199f9b73d6af539360d4912d1dbde5d6cf 100644 --- a/src/main/java/org/bukkit/craftbukkit/command/CraftRemoteConsoleCommandSender.java +++ b/src/main/java/org/bukkit/craftbukkit/command/CraftRemoteConsoleCommandSender.java -@@ -38,4 +38,16 @@ public class CraftRemoteConsoleCommandSender extends ServerCommandSender impleme +@@ -39,4 +39,16 @@ public class CraftRemoteConsoleCommandSender extends ServerCommandSender impleme public void setOp(boolean value) { throw new UnsupportedOperationException("Cannot change operator status of remote controller."); } diff --git a/Spigot-Server-Patches/0526-Workaround-for-Client-Lag-Spikes-MC-162253.patch b/Spigot-Server-Patches/0496-Workaround-for-Client-Lag-Spikes-MC-162253.patch similarity index 82% rename from Spigot-Server-Patches/0526-Workaround-for-Client-Lag-Spikes-MC-162253.patch rename to Spigot-Server-Patches/0496-Workaround-for-Client-Lag-Spikes-MC-162253.patch index 794ef4675..6e53596b7 100644 --- a/Spigot-Server-Patches/0526-Workaround-for-Client-Lag-Spikes-MC-162253.patch +++ b/Spigot-Server-Patches/0496-Workaround-for-Client-Lag-Spikes-MC-162253.patch @@ -12,10 +12,10 @@ to the client, so that it doesn't attempt to calculate them. This mitigates the frametime impact to a minimum (but it's still there). diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index c80a55ee53eac128c94d74b78c5641854e974750..d7beb47d9e07707e5875c50932dfe4698cb6ad72 100644 +index 7f508b9ef616071b1adeef7c00da7f4565ef4ddd..84dc89d961bde16f96dba5cf7f2ce4b85564215a 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -277,7 +277,7 @@ public class Chunk implements IChunkAccess { +@@ -278,7 +278,7 @@ public class Chunk implements IChunkAccess { // broadcast Object[] backingSet = inRange.getBackingSet(); @@ -25,10 +25,10 @@ index c80a55ee53eac128c94d74b78c5641854e974750..d7beb47d9e07707e5875c50932dfe469 Object temp = backingSet[index]; if (!(temp instanceof EntityPlayer)) { diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java -index f6df85c6bf27bfa7a16967259a6016c9473201a5..4dcb111c704a495c214827f4ef554fb8e65ca2da 100644 +index 860dc98ab4f84c470b27726314943936d23fcb79..8d45588ecfa33b8c7335df3db58ed6865b8c956c 100644 --- a/src/main/java/net/minecraft/server/ChunkSection.java +++ b/src/main/java/net/minecraft/server/ChunkSection.java -@@ -99,6 +99,7 @@ public class ChunkSection { +@@ -100,6 +100,7 @@ public class ChunkSection { return this.nonEmptyBlockCount == 0; } @@ -37,19 +37,10 @@ index f6df85c6bf27bfa7a16967259a6016c9473201a5..4dcb111c704a495c214827f4ef554fb8 return chunksection == Chunk.a || chunksection.c(); } diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 68dd9220bb360c75057919fed0598b415b947e4d..0aa14bfca6e1845eb6e9f5bd4e0e36335fa7f532 100644 +index 2938a7d46a471aca89b3dc3d8cad0659aea7c69f..6dd64ce8794b8c2b5704556532159135e85a4b6c 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -402,7 +402,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - player.needsChunkCenterUpdate = false; - player.playerConnection.sendPacket(new PacketPlayOutViewCentre(currPosX, currPosZ)); - } -- PlayerChunkMap.this.sendChunk(player, new ChunkCoordIntPair(rangeX, rangeZ), new Packet[2], false, true); // unloaded, loaded -+ PlayerChunkMap.this.sendChunk(player, new ChunkCoordIntPair(rangeX, rangeZ), new Packet[10], false, true); // unloaded, loaded - }, - (EntityPlayer player, int rangeX, int rangeZ, int currPosX, int currPosZ, int prevPosX, int prevPosZ, - com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet newState) -> { -@@ -1921,12 +1921,112 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1956,12 +1956,112 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } @@ -102,8 +93,8 @@ index 68dd9220bb360c75057919fed0598b415b947e4d..0aa14bfca6e1845eb6e9f5bd4e0e3633 + apacket = new Packet[10]; + } + // Paper end - apacket[0] = new PacketPlayOutMapChunk(chunk, 65535); - apacket[1] = new PacketPlayOutLightUpdate(chunk.getPos(), this.lightEngine); + apacket[0] = new PacketPlayOutMapChunk(chunk, 65535, true); + apacket[1] = new PacketPlayOutLightUpdate(chunk.getPos(), this.lightEngine, true); + + // Paper start - Fix MC-162253 + final int lightMask = getLightMask(chunk); @@ -127,7 +118,7 @@ index 68dd9220bb360c75057919fed0598b415b947e4d..0aa14bfca6e1845eb6e9f5bd4e0e3633 + continue; + } + -+ apacket[i] = new PacketPlayOutLightUpdate(new ChunkCoordIntPair(chunk.getPos().x + x, chunk.getPos().z + z), lightEngine, updateLightMask, 0); ++ apacket[i] = new PacketPlayOutLightUpdate(new ChunkCoordIntPair(chunk.getPos().x + x, chunk.getPos().z + z), lightEngine, updateLightMask, 0, true); + } + } + } diff --git a/Spigot-Server-Patches/0527-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch b/Spigot-Server-Patches/0497-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch similarity index 89% rename from Spigot-Server-Patches/0527-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch rename to Spigot-Server-Patches/0497-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch index 55fde4549..abf2be115 100644 --- a/Spigot-Server-Patches/0527-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch +++ b/Spigot-Server-Patches/0497-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch @@ -23,7 +23,7 @@ Chunks in front of the player have higher priority, to help with fast traveling players keep up with their movement. diff --git a/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTaskManager.java b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTaskManager.java -index b5c2e1f4a2b5fdcaa6bb01f4b3b6847cd5b73ae8..6209b33d8497ec56bbde507e523db0649c66f590 100644 +index 49a594e5f345096cb3b9913b8ee2760795c5f012..bcb7ce2692c5bc1a6214c3a384949666107864fb 100644 --- a/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTaskManager.java +++ b/src/main/java/com/destroystokyo/paper/io/chunk/ChunkTaskManager.java @@ -4,7 +4,10 @@ import com.destroystokyo.paper.io.PaperFileIOThread; @@ -78,19 +78,19 @@ index b5c2e1f4a2b5fdcaa6bb01f4b3b6847cd5b73ae8..6209b33d8497ec56bbde507e523db064 } diff --git a/src/main/java/net/minecraft/server/ChunkCoordIntPair.java b/src/main/java/net/minecraft/server/ChunkCoordIntPair.java -index f617636a22167b06ac8073aa25efd8c7099155f0..0f40793f004639822b9d40521cd21ec50391ba3b 100644 +index 35b8a85d1280ba3be757b14b14388954ac1617d4..f47a6e0027de6886991aad5bcb98a04157aeb846 100644 --- a/src/main/java/net/minecraft/server/ChunkCoordIntPair.java +++ b/src/main/java/net/minecraft/server/ChunkCoordIntPair.java -@@ -110,6 +110,7 @@ public class ChunkCoordIntPair { +@@ -108,6 +108,7 @@ public class ChunkCoordIntPair { return "[" + this.x + ", " + this.z + "]"; } + public final BlockPosition asPosition() { return l(); } // Paper - OBFHELPER public BlockPosition l() { - return new BlockPosition(this.x << 4, 0, this.z << 4); + return new BlockPosition(this.d(), 0, this.e()); } diff --git a/src/main/java/net/minecraft/server/ChunkMapDistance.java b/src/main/java/net/minecraft/server/ChunkMapDistance.java -index 7702fbefa598bce7e6a2d287f7ec36b78a62bff8..35a4999b2c34ae62cba042885db25dd1837cb127 100644 +index c072f61e8c88eac8335acd660d8ff0e2f9db819e..4c4108705e9d25912e57a7b3c28b4f1abad58377 100644 --- a/src/main/java/net/minecraft/server/ChunkMapDistance.java +++ b/src/main/java/net/minecraft/server/ChunkMapDistance.java @@ -23,6 +23,7 @@ import java.util.concurrent.Executor; @@ -113,8 +113,8 @@ index 7702fbefa598bce7e6a2d287f7ec36b78a62bff8..35a4999b2c34ae62cba042885db25dd1 @@ -84,6 +85,7 @@ public abstract class ChunkMapDistance { } - private static int a(ArraySetSorted> arraysetsorted) { -+ AsyncCatcher.catchOp("ChunkMapDistance::getHighestTicketLevel"); // Paper + private static int getLowestTicketLevel(ArraySetSorted> arraysetsorted) { ++ AsyncCatcher.catchOp("ChunkMapDistance::getLowestTicketLevel"); // Paper return !arraysetsorted.isEmpty() ? ((Ticket) arraysetsorted.b()).b() : PlayerChunkMap.GOLDEN_TICKET + 1; } @@ -122,9 +122,9 @@ index 7702fbefa598bce7e6a2d287f7ec36b78a62bff8..35a4999b2c34ae62cba042885db25dd1 public boolean a(PlayerChunkMap playerchunkmap) { //this.f.a(); // Paper - no longer used -+ AsyncCatcher.catchOp("DistanceManagerTick"); ++ AsyncCatcher.catchOp("DistanceManagerTick"); // Paper this.g.a(); - int i = Integer.MAX_VALUE - this.e.a(Integer.MAX_VALUE); + int i = Integer.MAX_VALUE - this.ticketLevelTracker.a(Integer.MAX_VALUE); boolean flag = i != 0; @@ -107,11 +110,13 @@ public abstract class ChunkMapDistance { @@ -149,7 +149,7 @@ index 7702fbefa598bce7e6a2d287f7ec36b78a62bff8..35a4999b2c34ae62cba042885db25dd1 private boolean addTicket(long i, Ticket ticket) { // CraftBukkit - void -> boolean + AsyncCatcher.catchOp("ChunkMapDistance::addTicket"); // Paper ArraySetSorted> arraysetsorted = this.e(i); - int j = a(arraysetsorted); + int j = getLowestTicketLevel(arraysetsorted); Ticket ticket1 = (Ticket) arraysetsorted.a(ticket); // CraftBukkit - decompile error @@ -162,7 +169,9 @@ public abstract class ChunkMapDistance { } @@ -157,22 +157,21 @@ index 7702fbefa598bce7e6a2d287f7ec36b78a62bff8..35a4999b2c34ae62cba042885db25dd1 private boolean removeTicket(long i, Ticket ticket) { // CraftBukkit - void -> boolean + AsyncCatcher.catchOp("ChunkMapDistance::removeTicket"); // Paper ArraySetSorted> arraysetsorted = this.e(i); -+ int oldLevel = a(arraysetsorted); // Paper ++ int oldLevel = getLowestTicketLevel(arraysetsorted); // Paper boolean removed = false; // CraftBukkit if (arraysetsorted.remove(ticket)) { -@@ -172,8 +181,8 @@ public abstract class ChunkMapDistance { - if (arraysetsorted.isEmpty()) { +@@ -173,7 +182,8 @@ public abstract class ChunkMapDistance { this.tickets.remove(i); } -- -- this.e.b(i, a(arraysetsorted), false); -+ int newLevel = a(arraysetsorted); // Paper -+ if (newLevel > oldLevel) this.e.b(i, newLevel, false); // Paper + +- this.ticketLevelTracker.update(i, getLowestTicketLevel(arraysetsorted), false); ++ int newLevel = getLowestTicketLevel(arraysetsorted); // Paper ++ if (newLevel > oldLevel) this.ticketLevelTracker.update(i, newLevel, false); // Paper return removed; // CraftBukkit } -@@ -182,6 +191,135 @@ public abstract class ChunkMapDistance { +@@ -182,6 +192,135 @@ public abstract class ChunkMapDistance { this.addTicketAtLevel(tickettype, chunkcoordintpair, i, t0); } @@ -308,7 +307,7 @@ index 7702fbefa598bce7e6a2d287f7ec36b78a62bff8..35a4999b2c34ae62cba042885db25dd1 public boolean addTicketAtLevel(TicketType ticketType, ChunkCoordIntPair chunkcoordintpair, int level, T identifier) { return this.addTicket(chunkcoordintpair.pair(), new Ticket<>(ticketType, level, identifier)); // CraftBukkit end -@@ -381,27 +519,51 @@ public abstract class ChunkMapDistance { +@@ -381,27 +520,50 @@ public abstract class ChunkMapDistance { private void a(long i, int j, boolean flag, boolean flag1) { if (flag != flag1) { @@ -317,6 +316,7 @@ index 7702fbefa598bce7e6a2d287f7ec36b78a62bff8..35a4999b2c34ae62cba042885db25dd1 + Ticket ticket = new Ticket<>(TicketType.PLAYER, 33, coords); // Paper - no-tick view distance if (flag1) { +- ChunkMapDistance.this.j.a(ChunkTaskQueueSorter.a(() -> { + scheduleChunkLoad(i, MinecraftServer.currentTick, j, (priority) -> { // Paper - smarter ticket delay based on frustum and distance + // Paper start - recheck its still valid if not cancel + if (!isChunkInRange(i)) { @@ -337,16 +337,16 @@ index 7702fbefa598bce7e6a2d287f7ec36b78a62bff8..35a4999b2c34ae62cba042885db25dd1 + return; + } + // Paper end - ChunkMapDistance.this.j.a(ChunkTaskQueueSorter.a(() -> { // CraftBukkit - decompile error ++ ChunkMapDistance.this.j.a(ChunkTaskQueueSorter.a(() -> { // CraftBukkit - decompile error ChunkMapDistance.this.m.execute(() -> { - if (this.c(this.c(i))) { + if (isChunkInRange(i)) { if (!hasPlayerTicket(coords, 33)) { // Paper - high priority might of already added it ChunkMapDistance.this.addTicket(i, ticket); ChunkMapDistance.this.l.add(i); - } else { -+ } -+ } else { // Paper - ChunkMapDistance.this.k.a(ChunkTaskQueueSorter.a(() -> { // CraftBukkit - decompile error +- ChunkMapDistance.this.k.a(ChunkTaskQueueSorter.a(() -> { ++ }} else { // Paper ++ ChunkMapDistance.this.k.a(ChunkTaskQueueSorter.a(() -> { // CraftBukkit - decompile error }, i, false)); } @@ -357,7 +357,7 @@ index 7702fbefa598bce7e6a2d287f7ec36b78a62bff8..35a4999b2c34ae62cba042885db25dd1 })); + }); // Paper } else { - ChunkMapDistance.this.k.a(ChunkTaskQueueSorter.a(() -> { // CraftBukkit - decompile error + ChunkMapDistance.this.k.a(ChunkTaskQueueSorter.a(() -> { ChunkMapDistance.this.m.execute(() -> { ChunkMapDistance.this.removeTicket(i, ticket); + ChunkMapDistance.this.clearPriorityTickets(coords); // Paper @@ -484,10 +484,10 @@ index 7702fbefa598bce7e6a2d287f7ec36b78a62bff8..35a4999b2c34ae62cba042885db25dd1 protected int c(long i) { return this.a.get(i); diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 3089d673a029c493cac756124eb0baa21a8bab7f..8efe036be0c74a5ceb6a18e019c4a08a49a28693 100644 +index a6363b73522f9d27534b6e80f4b3789e84316c49..604e7004b659daed2844ba1a76bf09288ec549e5 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -442,6 +442,26 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -443,6 +443,26 @@ public class ChunkProviderServer extends IChunkProvider { public void removeTicketAtLevel(TicketType ticketType, ChunkCoordIntPair chunkPos, int ticketLevel, T identifier) { this.chunkMapDistance.removeTicketAtLevel(ticketType, chunkPos, ticketLevel, identifier); } @@ -514,7 +514,7 @@ index 3089d673a029c493cac756124eb0baa21a8bab7f..8efe036be0c74a5ceb6a18e019c4a08a // Paper end @Nullable -@@ -480,6 +500,8 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -481,6 +501,8 @@ public class ChunkProviderServer extends IChunkProvider { if (!completablefuture.isDone()) { // Paper // Paper start - async chunk io/loading @@ -523,7 +523,7 @@ index 3089d673a029c493cac756124eb0baa21a8bab7f..8efe036be0c74a5ceb6a18e019c4a08a this.world.asyncChunkTaskManager.raisePriority(x, z, com.destroystokyo.paper.io.PrioritizedTaskQueue.HIGHEST_PRIORITY); com.destroystokyo.paper.io.chunk.ChunkTaskManager.pushChunkWait(this.world, x, z); // Paper end -@@ -488,6 +510,8 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -489,6 +511,8 @@ public class ChunkProviderServer extends IChunkProvider { this.serverThreadQueue.awaitTasks(completablefuture::isDone); com.destroystokyo.paper.io.chunk.ChunkTaskManager.popChunkWait(); // Paper - async chunk debug this.world.timings.syncChunkLoad.stopTiming(); // Paper @@ -532,7 +532,7 @@ index 3089d673a029c493cac756124eb0baa21a8bab7f..8efe036be0c74a5ceb6a18e019c4a08a } // Paper ichunkaccess = (IChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> { return ichunkaccess1; -@@ -540,10 +564,12 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -541,10 +565,12 @@ public class ChunkProviderServer extends IChunkProvider { if (flag && !currentlyUnloading) { // CraftBukkit end this.chunkMapDistance.a(TicketType.UNKNOWN, chunkcoordintpair, l, chunkcoordintpair); @@ -545,7 +545,7 @@ index 3089d673a029c493cac756124eb0baa21a8bab7f..8efe036be0c74a5ceb6a18e019c4a08a this.tickDistanceManager(); playerchunk = this.getChunk(k); gameprofilerfiller.exit(); -@@ -552,8 +578,13 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -553,8 +579,13 @@ public class ChunkProviderServer extends IChunkProvider { } } } @@ -561,18 +561,16 @@ index 3089d673a029c493cac756124eb0baa21a8bab7f..8efe036be0c74a5ceb6a18e019c4a08a } private boolean a(@Nullable PlayerChunk playerchunk, int i) { -@@ -603,7 +634,8 @@ public class ChunkProviderServer extends IChunkProvider { - return this.serverThreadQueue.executeNext(); +@@ -605,6 +636,7 @@ public class ChunkProviderServer extends IChunkProvider { } -- private boolean tickDistanceManager() { -+ public boolean tickDistanceManager() { // Paper - public + public boolean tickDistanceManager() { // Paper - private -> public + if (chunkMapDistance.delayDistanceManagerTick) return false; // Paper boolean flag = this.chunkMapDistance.a(this.playerChunkMap); boolean flag1 = this.playerChunkMap.b(); diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 07a6fc3d88e7d44bfab7f3d6a0eef7dc132ab422..39072ebdc9e4be2bb762d81a8bd542dbdb8f6371 100644 +index 5f9ab1b81c1440d9b3003fbbf7d00b135a6b811e..eeed8edfdfde47b5eec7a2f6c9871fcfa1930b63 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -55,6 +55,12 @@ public class EntityPlayer extends EntityHuman implements ICrafting { @@ -588,7 +586,7 @@ index 07a6fc3d88e7d44bfab7f3d6a0eef7dc132ab422..39072ebdc9e4be2bb762d81a8bd542db private float lastHealthSent = -1.0E8F; private int lastFoodSent = -99999999; private boolean lastSentSaturationZero = true; -@@ -132,6 +138,21 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -136,6 +142,21 @@ public class EntityPlayer extends EntityHuman implements ICrafting { this.maxHealthCache = this.getMaxHealth(); this.cachedSingleMobDistanceMap = new com.destroystokyo.paper.util.PooledHashSets.PooledObjectLinkedOpenHashSet<>(this); // Paper } @@ -610,8 +608,8 @@ index 07a6fc3d88e7d44bfab7f3d6a0eef7dc132ab422..39072ebdc9e4be2bb762d81a8bd542db // Yes, this doesn't match Vanilla, but it's the best we can do for now. // If this is an issue, PRs are welcome -@@ -441,6 +462,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - if (valid && (!this.isSpectator() || this.world.isLoaded(new BlockPosition(this)))) { // Paper - don't tick dead players that are not in the world currently (pending respawn) +@@ -481,6 +502,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + if (valid && !this.isSpectator() || this.world.isLoaded(this.getChunkCoordinates())) { // Paper - don't tick dead players that are not in the world currently (pending respawn) super.tick(); } + if (valid && isAlive() && playerConnection != null) ((WorldServer)world).getChunkProvider().playerChunkMap.checkHighPriorityChunks(this); // Paper @@ -619,10 +617,10 @@ index 07a6fc3d88e7d44bfab7f3d6a0eef7dc132ab422..39072ebdc9e4be2bb762d81a8bd542db for (int i = 0; i < this.inventory.getSize(); ++i) { ItemStack itemstack = this.inventory.getItem(i); diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java -index ce0bf608b71cf492fc31e89a360ecd83fa5c23a6..87d58002116f361d8255d79fc0dbd1200f442168 100644 +index d24b5fa7e77bb18626459f6c3ab4aa20a7512712..e9cedbc8b62180134e774b119fb156c54f5767de 100644 --- a/src/main/java/net/minecraft/server/MCUtil.java +++ b/src/main/java/net/minecraft/server/MCUtil.java -@@ -666,6 +666,7 @@ public final class MCUtil { +@@ -655,6 +655,7 @@ public final class MCUtil { chunkData.addProperty("x", playerChunk.location.x); chunkData.addProperty("z", playerChunk.location.z); chunkData.addProperty("ticket-level", playerChunk.getTicketLevel()); @@ -631,7 +629,7 @@ index ce0bf608b71cf492fc31e89a360ecd83fa5c23a6..87d58002116f361d8255d79fc0dbd120 chunkData.addProperty("queued-for-unload", chunkMap.unloadQueue.contains(playerChunk.location.pair())); chunkData.addProperty("status", status == null ? "unloaded" : status.toString()); diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index aeca6b2b9d5d73aeb6dc639b5cad2f2533a2de44..52da9c78c0cc2b21533a1477a25a3dda492700e4 100644 +index e5751adde516544722b95016f64b2a46c16e77ce..04dea2c9fd9337631a6289c7242338e166d6bc1e 100644 --- a/src/main/java/net/minecraft/server/PlayerChunk.java +++ b/src/main/java/net/minecraft/server/PlayerChunk.java @@ -26,8 +26,8 @@ public class PlayerChunk { @@ -645,7 +643,7 @@ index aeca6b2b9d5d73aeb6dc639b5cad2f2533a2de44..52da9c78c0cc2b21533a1477a25a3dda private final short[] dirtyBlocks; private int dirtyCount; private int r; -@@ -40,6 +40,7 @@ public class PlayerChunk { +@@ -39,6 +39,7 @@ public class PlayerChunk { private boolean hasBeenLoaded; private final PlayerChunkMap chunkMap; // Paper @@ -653,7 +651,7 @@ index aeca6b2b9d5d73aeb6dc639b5cad2f2533a2de44..52da9c78c0cc2b21533a1477a25a3dda long lastAutoSaveTime; // Paper - incremental autosave long inactiveTimeStart; // Paper - incremental autosave -@@ -67,6 +68,120 @@ public class PlayerChunk { +@@ -66,6 +67,120 @@ public class PlayerChunk { return null; } // Paper end - no-tick view distance @@ -774,7 +772,7 @@ index aeca6b2b9d5d73aeb6dc639b5cad2f2533a2de44..52da9c78c0cc2b21533a1477a25a3dda public PlayerChunk(ChunkCoordIntPair chunkcoordintpair, int i, LightEngine lightengine, PlayerChunk.c playerchunk_c, PlayerChunk.d playerchunk_d) { this.statusFutures = new AtomicReferenceArray(PlayerChunk.CHUNK_STATUSES.size()); -@@ -165,6 +280,18 @@ public class PlayerChunk { +@@ -164,6 +279,18 @@ public class PlayerChunk { } return null; } @@ -793,7 +791,7 @@ index aeca6b2b9d5d73aeb6dc639b5cad2f2533a2de44..52da9c78c0cc2b21533a1477a25a3dda // Paper end public CompletableFuture> getStatusFutureUnchecked(ChunkStatus chunkstatus) { -@@ -418,6 +545,7 @@ public class PlayerChunk { +@@ -405,6 +532,7 @@ public class PlayerChunk { return this.n; } @@ -801,7 +799,7 @@ index aeca6b2b9d5d73aeb6dc639b5cad2f2533a2de44..52da9c78c0cc2b21533a1477a25a3dda private void d(int i) { this.n = i; } -@@ -436,7 +564,7 @@ public class PlayerChunk { +@@ -423,7 +551,7 @@ public class PlayerChunk { // CraftBukkit start // ChunkUnloadEvent: Called before the chunk is unloaded: isChunkLoaded is still true and chunk can still be modified by plugins. if (playerchunk_state.isAtLeast(PlayerChunk.State.BORDER) && !playerchunk_state1.isAtLeast(PlayerChunk.State.BORDER)) { @@ -810,7 +808,7 @@ index aeca6b2b9d5d73aeb6dc639b5cad2f2533a2de44..52da9c78c0cc2b21533a1477a25a3dda Chunk chunk = (Chunk)either.left().orElse(null); if (chunk != null) { playerchunkmap.callbackExecutor.execute(() -> { -@@ -501,12 +629,13 @@ public class PlayerChunk { +@@ -488,12 +616,13 @@ public class PlayerChunk { if (!flag2 && flag3) { // Paper start - cache ticking ready status int expectCreateCount = ++this.fullChunkCreateCount; @@ -825,7 +823,7 @@ index aeca6b2b9d5d73aeb6dc639b5cad2f2533a2de44..52da9c78c0cc2b21533a1477a25a3dda } -@@ -531,7 +660,7 @@ public class PlayerChunk { +@@ -518,7 +647,7 @@ public class PlayerChunk { if (!flag4 && flag5) { // Paper start - cache ticking ready status @@ -834,7 +832,7 @@ index aeca6b2b9d5d73aeb6dc639b5cad2f2533a2de44..52da9c78c0cc2b21533a1477a25a3dda if (either.left().isPresent()) { // note: Here is a very good place to add callbacks to logic waiting on this. Chunk tickingChunk = either.left().get(); -@@ -562,7 +691,7 @@ public class PlayerChunk { +@@ -549,7 +678,7 @@ public class PlayerChunk { } // Paper start - cache ticking ready status @@ -843,12 +841,11 @@ index aeca6b2b9d5d73aeb6dc639b5cad2f2533a2de44..52da9c78c0cc2b21533a1477a25a3dda if (either.left().isPresent()) { // note: Here is a very good place to add callbacks to logic waiting on this. Chunk entityTickingChunk = either.left().get(); -@@ -581,13 +710,29 @@ public class PlayerChunk { - this.entityTickingFuture.complete(PlayerChunk.UNLOADED_CHUNK); this.isEntityTickingReady = false; // Paper - cache chunk ticking stage +@@ -569,12 +698,29 @@ public class PlayerChunk { this.entityTickingFuture = PlayerChunk.UNLOADED_CHUNK_FUTURE; } -- -- this.w.a(this.location, this::k, this.ticketLevel, this::d); + +- this.v.a(this.location, this::k, this.ticketLevel, this::d); + // Paper start - raise IO/load priority if priority changes, use our preferred priority + priorityBoost = chunkMap.chunkDistanceManager.getChunkPriority(location); + int priority = getDemandedPriority(); @@ -862,7 +859,7 @@ index aeca6b2b9d5d73aeb6dc639b5cad2f2533a2de44..52da9c78c0cc2b21533a1477a25a3dda + chunkMap.world.asyncChunkTaskManager.raisePriority(location.x, location.z, ioPriority); + } + if (getCurrentPriority() != priority) { -+ this.w.a(this.location, this::getCurrentPriority, priority, this::setPriority); // use preferred priority ++ this.v.a(this.location, this::getCurrentPriority, priority, this::setPriority); // use preferred priority + int neighborsPriority = getNeighborsPriority(); + this.neighbors.forEach((neighbor, neighborDesired) -> neighbor.setNeighborPriority(this, neighborsPriority)); + } @@ -876,7 +873,7 @@ index aeca6b2b9d5d73aeb6dc639b5cad2f2533a2de44..52da9c78c0cc2b21533a1477a25a3dda Chunk chunk = (Chunk)either.left().orElse(null); if (chunk != null) { playerchunkmap.callbackExecutor.execute(() -> { -@@ -669,6 +814,7 @@ public class PlayerChunk { +@@ -656,6 +802,7 @@ public class PlayerChunk { public interface c { @@ -885,10 +882,10 @@ index aeca6b2b9d5d73aeb6dc639b5cad2f2533a2de44..52da9c78c0cc2b21533a1477a25a3dda } diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 0aa14bfca6e1845eb6e9f5bd4e0e36335fa7f532..3139d55bb801b6c433de7274be4a1d0c0fd1eef7 100644 +index 6dd64ce8794b8c2b5704556532159135e85a4b6c..ae42793b5a2f5bb06f068d0365378776901a4351 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -50,6 +50,7 @@ import org.apache.commons.lang3.mutable.MutableBoolean; +@@ -51,6 +51,7 @@ import org.apache.commons.lang3.mutable.MutableBoolean; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.bukkit.entity.Player; // CraftBukkit @@ -896,7 +893,15 @@ index 0aa14bfca6e1845eb6e9f5bd4e0e36335fa7f532..3139d55bb801b6c433de7274be4a1d0c public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { -@@ -123,6 +124,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -88,6 +89,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + public final WorldServer world; + private final LightEngineThreaded lightEngine; + private final IAsyncTaskHandler executor; ++ final java.util.concurrent.Executor mainInvokingExecutor; // Paper + public final ChunkGenerator chunkGenerator; + private final Supplier l; public final Supplier getWorldPersistentDataSupplier() { return this.l; } // Paper - OBFHELPER + private final VillagePlace m; +@@ -125,6 +127,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @Override public void execute(Runnable runnable) { @@ -904,7 +909,7 @@ index 0aa14bfca6e1845eb6e9f5bd4e0e36335fa7f532..3139d55bb801b6c433de7274be4a1d0c if (queued == null) { queued = new java.util.ArrayDeque<>(); } -@@ -131,6 +133,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -133,6 +136,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @Override public void run() { @@ -912,7 +917,23 @@ index 0aa14bfca6e1845eb6e9f5bd4e0e36335fa7f532..3139d55bb801b6c433de7274be4a1d0c if (queued == null) { return; } -@@ -375,6 +378,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -287,6 +291,15 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + this.world = worldserver; + this.chunkGenerator = chunkgenerator; + this.executor = iasynctaskhandler; ++ // Paper start ++ this.mainInvokingExecutor = (run) -> { ++ if (MCUtil.isMainThread()) { ++ run.run(); ++ } else { ++ iasynctaskhandler.execute(run); ++ } ++ }; ++ // Paper end + ThreadedMailbox threadedmailbox = ThreadedMailbox.a(executor, "worldgen"); + + iasynctaskhandler.getClass(); +@@ -381,6 +394,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { this.playerViewDistanceTickMap = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets, (EntityPlayer player, int rangeX, int rangeZ, int currPosX, int currPosZ, int prevPosX, int prevPosZ, com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet newState) -> { @@ -920,7 +941,7 @@ index 0aa14bfca6e1845eb6e9f5bd4e0e36335fa7f532..3139d55bb801b6c433de7274be4a1d0c if (newState.size() != 1) { return; } -@@ -393,7 +397,11 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -399,7 +413,11 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } ChunkCoordIntPair chunkPos = new ChunkCoordIntPair(rangeX, rangeZ); PlayerChunkMap.this.world.getChunkProvider().removeTicketAtLevel(TicketType.PLAYER, chunkPos, 31, chunkPos); // entity ticking level, TODO check on update @@ -933,7 +954,7 @@ index 0aa14bfca6e1845eb6e9f5bd4e0e36335fa7f532..3139d55bb801b6c433de7274be4a1d0c this.playerViewDistanceNoTickMap = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets); this.playerViewDistanceBroadcastMap = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets, (EntityPlayer player, int rangeX, int rangeZ, int currPosX, int currPosZ, int prevPosX, int prevPosZ, -@@ -410,6 +418,116 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -416,6 +434,116 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { }); // Paper end - no-tick view distance } @@ -1050,7 +1071,7 @@ index 0aa14bfca6e1845eb6e9f5bd4e0e36335fa7f532..3139d55bb801b6c433de7274be4a1d0c public void updatePlayerMobTypeMap(Entity entity) { if (!this.world.paperConfig.perPlayerMobSpawns) { -@@ -539,6 +657,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -545,6 +673,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { List>> list = Lists.newArrayList(); int j = chunkcoordintpair.x; int k = chunkcoordintpair.z; @@ -1058,7 +1079,7 @@ index 0aa14bfca6e1845eb6e9f5bd4e0e36335fa7f532..3139d55bb801b6c433de7274be4a1d0c for (int l = -i; l <= i; ++l) { for (int i1 = -i; i1 <= i; ++i1) { -@@ -557,6 +676,14 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -563,6 +692,14 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { ChunkStatus chunkstatus = (ChunkStatus) intfunction.apply(j1); CompletableFuture> completablefuture = playerchunk.a(chunkstatus, this); @@ -1073,7 +1094,7 @@ index 0aa14bfca6e1845eb6e9f5bd4e0e36335fa7f532..3139d55bb801b6c433de7274be4a1d0c list.add(completablefuture); } -@@ -1022,14 +1149,22 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1028,14 +1165,22 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { }; CompletableFuture chunkSaveFuture = this.world.asyncChunkTaskManager.getChunkSaveFuture(chunkcoordintpair.x, chunkcoordintpair.z); @@ -1101,20 +1122,20 @@ index 0aa14bfca6e1845eb6e9f5bd4e0e36335fa7f532..3139d55bb801b6c433de7274be4a1d0c return ret; // Paper end } -@@ -1158,7 +1293,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1172,7 +1317,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { long i = playerchunk.i().pair(); playerchunk.getClass(); -- mailbox.a(ChunkTaskQueueSorter.a(runnable, i, playerchunk::getTicketLevel)); // CraftBukkit - decompile error -+ mailbox.a(ChunkTaskQueueSorter.a(runnable, i, () -> 1)); // CraftBukkit - decompile error // Paper - final loads are always urgent! +- mailbox.a(ChunkTaskQueueSorter.a(runnable, i, playerchunk::getTicketLevel)); ++ mailbox.a(ChunkTaskQueueSorter.a(runnable, i, () -> 1)); // Paper - final loads are always urgent! }); } diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index d52fbda79fe1c52d3ddb53c0f1c1f521d7620702..f9cb87a3be35575ecf3362b10dc7fe5ebadb56ec 100644 +index 7fd991fd3994a18625c193aeb15ed521d3b6a447..6bb2b3520362d056d4d75c65764e4c8dbc1417f9 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1279,6 +1279,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -1302,6 +1302,7 @@ public class PlayerConnection implements PacketListenerPlayIn { this.A = this.e; this.player.setLocation(d0, d1, d2, f, f1); this.syncPosition(); // Paper @@ -1123,46 +1144,38 @@ index d52fbda79fe1c52d3ddb53c0f1c1f521d7620702..f9cb87a3be35575ecf3362b10dc7fe5e } diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 6daca5c0ffd1d84f9a25cd106e8992a055dfb912..f133e7baf958b031819c2c72ccd21c52ba9a683d 100644 +index 59f00891ee2d1641678d4903a365cb94247bf08f..e55e11d5c97d656db8fed42c1581375077129906 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -174,8 +174,8 @@ public abstract class PlayerList { +@@ -196,8 +196,8 @@ public abstract class PlayerList { final ChunkCoordIntPair pos = new ChunkCoordIntPair(chunkX, chunkZ); - PlayerChunkMap playerChunkMap = finalWorldserver.getChunkProvider().playerChunkMap; + PlayerChunkMap playerChunkMap = worldserver1.getChunkProvider().playerChunkMap; playerChunkMap.chunkDistanceManager.addTicketAtLevel(TicketType.LOGIN, pos, 31, pos.pair()); -- worldserver.getChunkProvider().tickDistanceManager(); -- worldserver.getChunkProvider().getChunkAtAsynchronously(chunkX, chunkZ, true, true).thenApply(chunk -> { -+ worldserver.getChunkProvider().markAreaHighPriority(pos, 28, 3); -+ worldserver.getChunkProvider().getChunkAtAsynchronously(chunkX, chunkZ, true, false).thenApply(chunk -> { +- worldserver1.getChunkProvider().tickDistanceManager(); +- worldserver1.getChunkProvider().getChunkAtAsynchronously(chunkX, chunkZ, true, true).thenApply(chunk -> { ++ worldserver1.getChunkProvider().markAreaHighPriority(pos, 28, 3); ++ worldserver1.getChunkProvider().getChunkAtAsynchronously(chunkX, chunkZ, true, false).thenApply(chunk -> { PlayerChunk updatingChunk = playerChunkMap.getUpdatingChunk(pos.pair()); if (updatingChunk != null) { return updatingChunk.getEntityTickingFuture(); -@@ -188,7 +188,6 @@ public abstract class PlayerList { - entityplayer, finalWorldserver, networkmanager, playerconnection, - nbttagcompound, networkmanager.getSocketAddress().toString(), lastKnownName - ); -- //playerChunkMap.chunkDistanceManager.removeTicketAtLevel(TicketType.LOGIN, pos, 31, pos.pair()); - }; - }); - } -@@ -585,6 +584,7 @@ public abstract class PlayerList { +@@ -613,6 +613,7 @@ public abstract class PlayerList { SocketAddress socketaddress = loginlistener.networkManager.getSocketAddress(); - EntityPlayer entity = new EntityPlayer(this.server, this.server.getWorldServer(DimensionManager.OVERWORLD), gameprofile, new PlayerInteractManager(this.server.getWorldServer(DimensionManager.OVERWORLD))); + EntityPlayer entity = new EntityPlayer(this.server, this.server.getWorldServer(World.OVERWORLD), gameprofile, new PlayerInteractManager(this.server.getWorldServer(World.OVERWORLD))); + entity.isRealPlayer = true; // Paper Player player = entity.getBukkitEntity(); PlayerLoginEvent event = new PlayerLoginEvent(player, hostname, ((java.net.InetSocketAddress) socketaddress).getAddress(), ((java.net.InetSocketAddress) loginlistener.networkManager.getRawAddress()).getAddress()); -@@ -764,6 +764,7 @@ public abstract class PlayerList { +@@ -808,6 +809,7 @@ public abstract class PlayerList { // CraftBukkit end worldserver.getChunkProvider().addTicket(TicketType.POST_TELEPORT, new ChunkCoordIntPair(location.getBlockX() >> 4, location.getBlockZ() >> 4), 1, entityplayer.getId()); // Paper + entityplayer1.forceCheckHighPriority(); // Player - while (avoidSuffocation && !worldserver.getCubes(entityplayer1) && entityplayer1.locY() < 256.0D) { + while (avoidSuffocation && !worldserver1.getCubes(entityplayer1) && entityplayer1.locY() < 256.0D) { entityplayer1.setPosition(entityplayer1.locX(), entityplayer1.locY() + 1.0D, entityplayer1.locZ()); } diff --git a/src/main/java/net/minecraft/server/Ticket.java b/src/main/java/net/minecraft/server/Ticket.java -index 7a8397815a5b7f79f3e3a0348aeedf63fe879f8f..0d6e0f2ddaa85c04e626980591e9a78ac27fb42d 100644 +index 7a8397815a5b7f79f3e3a0348aeedf63fe879f8f..b5030d6f5d917ba33fb3c40903384fa7a56bc5f1 100644 --- a/src/main/java/net/minecraft/server/Ticket.java +++ b/src/main/java/net/minecraft/server/Ticket.java @@ -8,6 +8,7 @@ public final class Ticket implements Comparable> { @@ -1173,6 +1186,14 @@ index 7a8397815a5b7f79f3e3a0348aeedf63fe879f8f..0d6e0f2ddaa85c04e626980591e9a78a protected Ticket(TicketType tickettype, int i, T t0) { this.a = tickettype; +@@ -56,6 +57,7 @@ public final class Ticket implements Comparable> { + return this.b; + } + ++ public final void setCurrentTick(long i) { this.a(i); } // Paper - OBFHELPER + protected void a(long i) { + this.d = i; + } diff --git a/src/main/java/net/minecraft/server/TicketType.java b/src/main/java/net/minecraft/server/TicketType.java index d7b9d9fd3a3b607278a3d72b0b306b0be2aa30ad..6fd852db6bcfbfbf84ec2acf6d23b08a6051165c 100644 --- a/src/main/java/net/minecraft/server/TicketType.java @@ -1187,10 +1208,10 @@ index d7b9d9fd3a3b607278a3d72b0b306b0be2aa30ad..6fd852db6bcfbfbf84ec2acf6d23b08a public static TicketType a(String s, Comparator comparator) { return new TicketType<>(s, comparator, 0L); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 36207acffac3620879afd11bb47e06341a3dabb9..5992fdda8a5c66f77dbfca86d6261b98cce2b1e9 100644 +index 11559f9e4b3f5fda6bfe4f70f963ce4f7967f051..bf2f602bb07aa4c7c0a22ad9be9e77d7fd017191 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -2483,6 +2483,10 @@ public class CraftWorld implements World { +@@ -2520,6 +2520,10 @@ public class CraftWorld implements World { return future; } @@ -1202,10 +1223,10 @@ index 36207acffac3620879afd11bb47e06341a3dabb9..5992fdda8a5c66f77dbfca86d6261b98 net.minecraft.server.Chunk chunk = (net.minecraft.server.Chunk) either.left().orElse(null); return CompletableFuture.completedFuture(chunk == null ? null : chunk.getBukkitChunk()); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index bd4d5184b607db09c8ff2687ceaf47fb94368a28..141003ca718cc6ba113de8e4855b18252b293ef6 100644 +index e3ae90aa7c2c067741540995fbb1c694b663f624..8f2b84a84a8249ae2b48d195eb8c1ffb4464fe0e 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -738,6 +738,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -744,6 +744,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player { throw new UnsupportedOperationException("Cannot set rotation of players. Consider teleporting instead."); } diff --git a/Spigot-Server-Patches/0528-Fix-Non-Full-Status-Chunk-NBT-Memory-Leak.patch b/Spigot-Server-Patches/0498-Fix-Non-Full-Status-Chunk-NBT-Memory-Leak.patch similarity index 94% rename from Spigot-Server-Patches/0528-Fix-Non-Full-Status-Chunk-NBT-Memory-Leak.patch rename to Spigot-Server-Patches/0498-Fix-Non-Full-Status-Chunk-NBT-Memory-Leak.patch index 29b5e63ec..0888e5d79 100644 --- a/Spigot-Server-Patches/0528-Fix-Non-Full-Status-Chunk-NBT-Memory-Leak.patch +++ b/Spigot-Server-Patches/0498-Fix-Non-Full-Status-Chunk-NBT-Memory-Leak.patch @@ -16,10 +16,10 @@ We further improve it by making a copy of the nbt tag with only the memory it needs, so that we dont have to hold a copy to the entire compound. diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index d752e793f13a9caf5d255293f7ce9d562fd50064..1685237dfd7d6f352c5bab5f65817462de5e6d12 100644 +index 4b7c4643f04448aaccc66f26a9dea2323bea420d..ac58fcb7985ebe0cfdab6e1400deb37c233ff637 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -@@ -157,9 +157,9 @@ public class ChunkRegionLoader { +@@ -156,9 +156,9 @@ public class ChunkRegionLoader { object2 = protochunkticklist1; } @@ -32,7 +32,7 @@ index d752e793f13a9caf5d255293f7ce9d562fd50064..1685237dfd7d6f352c5bab5f65817462 } else { ProtoChunk protochunk = new ProtoChunk(chunkcoordintpair, chunkconverter, achunksection, protochunkticklist, protochunkticklist1, worldserver); // Paper - Anti-Xray - Add parameter -@@ -265,6 +265,37 @@ public class ChunkRegionLoader { +@@ -264,6 +264,37 @@ public class ChunkRegionLoader { return new InProgressChunkHolder(protochunk1, tasksToExecuteOnMain); // Paper - Async chunk loading } } diff --git a/Spigot-Server-Patches/0499-Optimize-sending-packets-to-nearby-locations-sounds-.patch b/Spigot-Server-Patches/0499-Optimize-sending-packets-to-nearby-locations-sounds-.patch new file mode 100644 index 000000000..79e13aff5 --- /dev/null +++ b/Spigot-Server-Patches/0499-Optimize-sending-packets-to-nearby-locations-sounds-.patch @@ -0,0 +1,63 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Sat, 23 May 2020 17:03:41 -0400 +Subject: [PATCH] Optimize sending packets to nearby locations (sounds/effects) + +Instead of using the entire world or player list, use the distance +maps to only iterate players who are even seeing the chunk the packet +is originating from. + +This will drastically cut down on packet sending cost for worlds with +lots of players in them. + +diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java +index e55e11d5c97d656db8fed42c1581375077129906..f17399a73e0de49d2e7325747a2637f447df78f2 100644 +--- a/src/main/java/net/minecraft/server/PlayerList.java ++++ b/src/main/java/net/minecraft/server/PlayerList.java +@@ -1059,16 +1059,40 @@ public abstract class PlayerList { + } + + public void sendPacketNearby(@Nullable EntityHuman entityhuman, double d0, double d1, double d2, double d3, ResourceKey resourcekey, Packet packet) { +- for (int i = 0; i < this.players.size(); ++i) { +- EntityPlayer entityplayer = (EntityPlayer) this.players.get(i); ++ WorldServer world = null; ++ if (entityhuman != null && entityhuman.world instanceof WorldServer) { ++ world = (WorldServer) entityhuman.world; ++ } + +- // CraftBukkit start - Test if player receiving packet can see the source of the packet +- if (entityhuman != null && entityhuman instanceof EntityPlayer && !entityplayer.getBukkitEntity().canSee(((EntityPlayer) entityhuman).getBukkitEntity())) { +- continue; ++ // Paper start ++ if (world == null) { ++ world = server.getWorldServer(resourcekey); ++ } ++ PlayerChunkMap chunkMap = world != null ? world.getChunkProvider().playerChunkMap : null; ++ Object[] backingSet; ++ if (chunkMap == null) { ++ // Really shouldn't happen... ++ backingSet = world != null ? world.players.toArray() : players.toArray(); ++ } else { ++ com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet nearbyPlayers = chunkMap.playerViewDistanceBroadcastMap.getObjectsInRange(MCUtil.fastFloor(d0) >> 4, MCUtil.fastFloor(d2) >> 4); ++ if (nearbyPlayers == null) { ++ return; + } ++ backingSet = nearbyPlayers.getBackingSet(); ++ } ++ ++ for (Object object : backingSet) { ++ if (!(object instanceof EntityPlayer)) continue; ++ EntityPlayer entityplayer = (EntityPlayer) object; ++ // Paper end ++ ++ // CraftBukkit start - Test if player receiving packet can see the source of the packet ++ //if (entityhuman != null && entityhuman instanceof EntityPlayer && !entityplayer.getBukkitEntity().canSee(((EntityPlayer) entityhuman).getBukkitEntity())) { // Paper ++ //continue; // Paper ++ //} // Paper + // CraftBukkit end + +- if (entityplayer != entityhuman && entityplayer.world.getDimensionKey() == resourcekey) { ++ if (entityplayer != entityhuman && entityplayer.world.getDimensionKey() == resourcekey && (!(entityhuman instanceof EntityPlayer) || entityplayer.getBukkitEntity().canSee(((EntityPlayer) entityhuman).getBukkitEntity()))) { // Paper + double d4 = d0 - entityplayer.locX(); + double d5 = d1 - entityplayer.locY(); + double d6 = d2 - entityplayer.locZ(); diff --git a/Spigot-Server-Patches/0531-Improve-Chunk-Status-Transition-Speed.patch b/Spigot-Server-Patches/0500-Improve-Chunk-Status-Transition-Speed.patch similarity index 72% rename from Spigot-Server-Patches/0531-Improve-Chunk-Status-Transition-Speed.patch rename to Spigot-Server-Patches/0500-Improve-Chunk-Status-Transition-Speed.patch index 85c0553f6..0de038ba5 100644 --- a/Spigot-Server-Patches/0531-Improve-Chunk-Status-Transition-Speed.patch +++ b/Spigot-Server-Patches/0500-Improve-Chunk-Status-Transition-Speed.patch @@ -36,10 +36,10 @@ scenario / path: Previously would have hopped to SERVER around 12+ times there extra. diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index 52da9c78c0cc2b21533a1477a25a3dda492700e4..69899c100dd86c6c4795013364472336327ce036 100644 +index 04dea2c9fd9337631a6289c7242338e166d6bc1e..446c401b3139f8c6c0e70d883340f0140d94b752 100644 --- a/src/main/java/net/minecraft/server/PlayerChunk.java +++ b/src/main/java/net/minecraft/server/PlayerChunk.java -@@ -56,6 +56,13 @@ public class PlayerChunk { +@@ -55,6 +55,13 @@ public class PlayerChunk { this.playersInChunkTickRange = this.chunkMap.playerChunkTickRangeMap.getObjectsInRange(key); } // Paper end - optimise isOutsideOfRange @@ -54,34 +54,10 @@ index 52da9c78c0cc2b21533a1477a25a3dda492700e4..69899c100dd86c6c4795013364472336 // Paper start - no-tick view distance public final Chunk getSendingChunk() { diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 3139d55bb801b6c433de7274be4a1d0c0fd1eef7..98adcb6390105a183d66975ed9659906b609ce08 100644 +index ae42793b5a2f5bb06f068d0365378776901a4351..0e684a040b1a6cee056e8716c2a69620fc440af3 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -88,6 +88,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - public final WorldServer world; - private final LightEngineThreaded lightEngine; - private final IAsyncTaskHandler executor; -+ final java.util.concurrent.Executor mainInvokingExecutor; // Paper - public final ChunkGenerator chunkGenerator; - private final Supplier l; public final Supplier getWorldPersistentDataSupplier() { return this.l; } // Paper - OBFHELPER - private final VillagePlace m; -@@ -285,6 +286,15 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - this.world = worldserver; - this.chunkGenerator = chunkgenerator; - this.executor = iasynctaskhandler; -+ // Paper start - optimize chunk status progression without jumping through thread pool -+ this.mainInvokingExecutor = (run) -> { -+ if (MCUtil.isMainThread()) { -+ run.run(); -+ } else { -+ iasynctaskhandler.execute(run); -+ } -+ }; -+ // Paper end - ThreadedMailbox threadedmailbox = ThreadedMailbox.a(executor, "worldgen"); - - iasynctaskhandler.getClass(); -@@ -724,7 +734,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -740,7 +740,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { return either.mapLeft((list) -> { return (Chunk) list.get(list.size() / 2); }); @@ -90,7 +66,7 @@ index 3139d55bb801b6c433de7274be4a1d0c0fd1eef7..98adcb6390105a183d66975ed9659906 } @Nullable -@@ -1074,7 +1084,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1090,7 +1090,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { IChunkAccess ichunkaccess = (IChunkAccess) optional.get(); if (ichunkaccess.getChunkStatus().b(chunkstatus)) { @@ -99,7 +75,7 @@ index 3139d55bb801b6c433de7274be4a1d0c0fd1eef7..98adcb6390105a183d66975ed9659906 if (chunkstatus == ChunkStatus.LIGHT) { completablefuture1 = this.b(playerchunk, chunkstatus); -@@ -1090,7 +1100,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1106,7 +1106,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { return this.b(playerchunk, chunkstatus); } } @@ -108,7 +84,7 @@ index 3139d55bb801b6c433de7274be4a1d0c0fd1eef7..98adcb6390105a183d66975ed9659906 } } -@@ -1201,6 +1211,12 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1225,6 +1225,12 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { return CompletableFuture.completedFuture(Either.right(playerchunk_failure)); }); }, (runnable) -> { @@ -118,6 +94,6 @@ index 3139d55bb801b6c433de7274be4a1d0c0fd1eef7..98adcb6390105a183d66975ed9659906 + return; + } + // Paper end - this.mailboxWorldGen.a(ChunkTaskQueueSorter.a(playerchunk, runnable)); // CraftBukkit - decompile error + this.mailboxWorldGen.a(ChunkTaskQueueSorter.a(playerchunk, runnable)); }); } diff --git a/Spigot-Server-Patches/0532-Fix-villager-trading-demand-MC-163962.patch b/Spigot-Server-Patches/0501-Fix-villager-trading-demand-MC-163962.patch similarity index 89% rename from Spigot-Server-Patches/0532-Fix-villager-trading-demand-MC-163962.patch rename to Spigot-Server-Patches/0501-Fix-villager-trading-demand-MC-163962.patch index daa484429..96152b810 100644 --- a/Spigot-Server-Patches/0532-Fix-villager-trading-demand-MC-163962.patch +++ b/Spigot-Server-Patches/0501-Fix-villager-trading-demand-MC-163962.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Fix villager trading demand - MC-163962 Prevent demand from going negative and tending to negative infinity diff --git a/src/main/java/net/minecraft/server/MerchantRecipe.java b/src/main/java/net/minecraft/server/MerchantRecipe.java -index f1f49c2ebff93ce3537bd4a58916d4c624a3fe82..7c4dc1143696320c8b8dc21ea4ae0600d5686d62 100644 +index 2865fa7018c3631fbcaaaaa2892219d9cab713d3..e42382a5c385c27b6322b03e87870eb20b21cb22 100644 --- a/src/main/java/net/minecraft/server/MerchantRecipe.java +++ b/src/main/java/net/minecraft/server/MerchantRecipe.java @@ -104,7 +104,7 @@ public class MerchantRecipe { diff --git a/Spigot-Server-Patches/0533-Maps-shouldn-t-load-chunks.patch b/Spigot-Server-Patches/0502-Maps-shouldn-t-load-chunks.patch similarity index 95% rename from Spigot-Server-Patches/0533-Maps-shouldn-t-load-chunks.patch rename to Spigot-Server-Patches/0502-Maps-shouldn-t-load-chunks.patch index 9b5bf7797..6dd34a1a7 100644 --- a/Spigot-Server-Patches/0533-Maps-shouldn-t-load-chunks.patch +++ b/Spigot-Server-Patches/0502-Maps-shouldn-t-load-chunks.patch @@ -15,7 +15,7 @@ Previously maps would load all chunks in a certain radius depending on five ticks that movement occur in anyways. diff --git a/src/main/java/net/minecraft/server/ItemWorldMap.java b/src/main/java/net/minecraft/server/ItemWorldMap.java -index 189e6d753d43b145a5480b10db11bba54fe8fbf3..134468da1a8fad6fdd48f64bf9ea885794e86bdf 100644 +index a65266040dc14d7c679b8eb46188023aa35f83ed..90be8c6091dc590a020721f45c7ff7b137cc806d 100644 --- a/src/main/java/net/minecraft/server/ItemWorldMap.java +++ b/src/main/java/net/minecraft/server/ItemWorldMap.java @@ -96,9 +96,9 @@ public class ItemWorldMap extends ItemWorldMapBase { diff --git a/Spigot-Server-Patches/0534-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch b/Spigot-Server-Patches/0503-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch similarity index 82% rename from Spigot-Server-Patches/0534-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch rename to Spigot-Server-Patches/0503-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch index 0a2d3d9c4..4411c0c4c 100644 --- a/Spigot-Server-Patches/0534-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch +++ b/Spigot-Server-Patches/0503-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Use seed based lookup for Treasure Maps - Fixes lag from diff --git a/src/main/java/net/minecraft/server/ItemWorldMap.java b/src/main/java/net/minecraft/server/ItemWorldMap.java -index 134468da1a8fad6fdd48f64bf9ea885794e86bdf..b09de92ee56f491f7b4c526105f8d306b365a275 100644 +index 90be8c6091dc590a020721f45c7ff7b137cc806d..faa556d4358bc9890ae80c18ee10c38a8d46548e 100644 --- a/src/main/java/net/minecraft/server/ItemWorldMap.java +++ b/src/main/java/net/minecraft/server/ItemWorldMap.java @@ -229,7 +229,7 @@ public class ItemWorldMap extends ItemWorldMapBase { @@ -19,16 +19,15 @@ index 134468da1a8fad6fdd48f64bf9ea885794e86bdf..b09de92ee56f491f7b4c526105f8d306 } diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 2c9acffe5a62af43ff4f4ccdb6962929d645e226..49da7352dcee6c352904cabe8b5db0152c427029 100644 +index e99e47b0844bb33560c7c6fcf7712656e9d8cdb4..472a0c624f09b7c6c07bbe8feadadf3ac7dd05a3 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -283,8 +283,9 @@ public class WorldServer extends World { +@@ -302,8 +302,8 @@ public class WorldServer extends World implements GeneratorAccessSeed { + this.worldDataServer.setThundering(flag1); } - // CraftBukkit end - @Override - public BiomeBase a(int i, int j, int k) { -+ + public BiomeBase getBiomeBySeed(int i, int j, int k) { return a(i, j, k); } // Paper - OBFHELPER + @Override public BiomeBase a(int i, int j, int k) { return this.getChunkProvider().getChunkGenerator().getWorldChunkManager().getBiome(i, j, k); diff --git a/Spigot-Server-Patches/0535-Optimize-Bit-Operations-by-inlining.patch b/Spigot-Server-Patches/0504-Optimize-Bit-Operations-by-inlining.patch similarity index 69% rename from Spigot-Server-Patches/0535-Optimize-Bit-Operations-by-inlining.patch rename to Spigot-Server-Patches/0504-Optimize-Bit-Operations-by-inlining.patch index 7f9251571..eac454310 100644 --- a/Spigot-Server-Patches/0535-Optimize-Bit-Operations-by-inlining.patch +++ b/Spigot-Server-Patches/0504-Optimize-Bit-Operations-by-inlining.patch @@ -7,11 +7,11 @@ Inline bit operations and reduce instruction count to make these hot operations faster diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java -index 3bf17ccdaef21322b787db538d569e0bc614ef22..4c64798fbc50f4d8b08502ba865c5fde5c968e62 100644 +index 163a6c83a2e494e28981974ef9accd3255e562c2..551ca4471fa3e80fd812938bfce53ca1854dc94d 100644 --- a/src/main/java/net/minecraft/server/BlockPosition.java +++ b/src/main/java/net/minecraft/server/BlockPosition.java -@@ -75,38 +75,34 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali - return dynamicops.createIntList(IntStream.of(new int[]{this.getX(), this.getY(), this.getZ()})); +@@ -53,28 +53,29 @@ public class BlockPosition extends BaseBlockPosition { + this(baseblockposition.getX(), baseblockposition.getY(), baseblockposition.getZ()); } + public static long getAdjacent(int baseX, int baseY, int baseZ, EnumDirection enumdirection) { return asLong(baseX + enumdirection.getAdjacentX(), baseY + enumdirection.getAdjacentY(), baseZ + enumdirection.getAdjacentZ()); } // Paper @@ -25,17 +25,17 @@ index 3bf17ccdaef21322b787db538d569e0bc614ef22..4c64798fbc50f4d8b08502ba865c5fde } public static int b(long i) { -- return (int) (i << 64 - BlockPosition.k - BlockPosition.c >> 64 - BlockPosition.c); +- return (int) (i << 64 - BlockPosition.m - BlockPosition.f >> 64 - BlockPosition.f); + return (int) (i >> 38); // Paper - simplify/inline } public static int c(long i) { -- return (int) (i << 64 - BlockPosition.f >> 64 - BlockPosition.f); -+ return (int) ((i << 52) >> 52); // Paper - simplify/inline +- return (int) (i << 64 - BlockPosition.h >> 64 - BlockPosition.h); ++ return (int) ((i << 26) >> 38); // Paper - simplify/inline } public static int d(long i) { -- return (int) (i << 64 - BlockPosition.j - BlockPosition.d >> 64 - BlockPosition.d); +- return (int) (i << 64 - BlockPosition.l - BlockPosition.g >> 64 - BlockPosition.g); + return (int) ((i << 26) >> 38); // Paper - simplify/inline } @@ -44,20 +44,23 @@ index 3bf17ccdaef21322b787db538d569e0bc614ef22..4c64798fbc50f4d8b08502ba865c5fde + return new BlockPosition((int) (i >> 38), (int) ((i << 52) >> 52), (int) ((i << 26) >> 38)); // Paper - simplify/inline } + public long asLong() { +@@ -83,12 +84,7 @@ public class BlockPosition extends BaseBlockPosition { + public static long asLong(int x, int y, int z) { return a(x, y, z); } // Paper - OBFHELPER public static long a(int i, int j, int k) { - long l = 0L; - -- l |= ((long) i & BlockPosition.g) << BlockPosition.k; -- l |= ((long) j & BlockPosition.h) << 0; -- l |= ((long) k & BlockPosition.i) << BlockPosition.j; +- l |= ((long) i & BlockPosition.i) << BlockPosition.m; +- l |= ((long) j & BlockPosition.j) << 0; +- l |= ((long) k & BlockPosition.k) << BlockPosition.l; - return l; + return (((long) i & (long) 67108863) << 38) | (((long) j & (long) 4095)) | (((long) k & (long) 67108863) << 12); // Paper - inline constants and simplify } public static long f(long i) { diff --git a/src/main/java/net/minecraft/server/SectionPosition.java b/src/main/java/net/minecraft/server/SectionPosition.java -index ca3f63f5e5e4e926de562b4bfbbf72ad8a6b943f..22bc96f97d22e0748110982e4b1ff85002f924b5 100644 +index 6a8597c585e74ebea2e8bac2f9965f8760e19b67..7806f3c351cba3f0388da11888f900c48004dadf 100644 --- a/src/main/java/net/minecraft/server/SectionPosition.java +++ b/src/main/java/net/minecraft/server/SectionPosition.java @@ -16,7 +16,7 @@ public class SectionPosition extends BaseBlockPosition { @@ -104,75 +107,35 @@ index ca3f63f5e5e4e926de562b4bfbbf72ad8a6b943f..22bc96f97d22e0748110982e4b1ff850 - int k = b(blockposition.getZ()); - - return (short) (i << 8 | k << 4 | j); -+ return (short) ((blockposition.x & 15) << 8 | (blockposition.z & 15) << 4 | blockposition.y & 15); // Paper - simplify/inline ++ return (short) ((blockposition.getX() & 15) << 8 | (blockposition.getZ() & 15) << 4 | blockposition.getY() & 15); // Paper - simplify/inline } public static int c(int i) { -@@ -60,7 +64,7 @@ public class SectionPosition extends BaseBlockPosition { - } - - public static int b(long i) { -- return (int) (i << 0 >> 42); -+ return (int) (i >> 42); // Paper - } - - public static int c(long i) { -@@ -71,44 +75,46 @@ public class SectionPosition extends BaseBlockPosition { - return (int) (i << 22 >> 42); - } - -- public int a() { -- return this.getX(); -+ public final int a() { // Paper -+ return x; // Paper - } - -- public int b() { -- return this.getY(); -+ public final int b() { // Paper -+ return y; // Paper - } - -- public int c() { -- return this.getZ(); -+ public final int c() { // Paper -+ return z; // Paper +@@ -83,16 +87,16 @@ public class SectionPosition extends BaseBlockPosition { + return this.getZ(); } - public int d() { - return this.a() << 4; + public final int d() { // Paper -+ return x << 4; // Paper ++ return this.getX() << 4; // Paper } - public int e() { - return this.b() << 4; + public final int e() { // Paper -+ return y << 4; // Paper ++ return this.getY() << 4; // Paper } - public int f() { - return this.c() << 4; + public final int f() { // Paper -+ return z << 4; // Paper ++ return this.getZ() << 4; // Paper } -- public int g() { -- return (this.a() << 4) + 15; -+ public final int g() { // Paper -+ return (x << 4) + 15; // Paper - } - -- public int h() { -- return (this.b() << 4) + 15; -+ public final int h() { // Paper -+ return (y << 4) + 15; // Paper - } - -- public int r() { -- return (this.c() << 4) + 15; -+ public final int r() { // Paper -+ return (z << 4) + 15; // Paper + public int g() { +@@ -107,8 +111,10 @@ public class SectionPosition extends BaseBlockPosition { + return (this.c() << 4) + 15; } + public static long blockToSection(long i) { return e(i); } // Paper - OBFHELPER @@ -183,16 +146,7 @@ index ca3f63f5e5e4e926de562b4bfbbf72ad8a6b943f..22bc96f97d22e0748110982e4b1ff850 } public static long f(long i) { -@@ -116,7 +122,7 @@ public class SectionPosition extends BaseBlockPosition { - } - - public BlockPosition s() { -- return new BlockPosition(c(this.a()), c(this.b()), c(this.c())); -+ return new BlockPosition(x << 4, y << 4, z << 4); // Paper - } - - public BlockPosition t() { -@@ -129,36 +135,30 @@ public class SectionPosition extends BaseBlockPosition { +@@ -129,17 +135,18 @@ public class SectionPosition extends BaseBlockPosition { return new ChunkCoordIntPair(this.a(), this.c()); } @@ -212,14 +166,13 @@ index ca3f63f5e5e4e926de562b4bfbbf72ad8a6b943f..22bc96f97d22e0748110982e4b1ff850 + return (((long) i & 4194303L) << 42) | (((long) j & 1048575L)) | (((long) k & 4194303L) << 20); // Paper - Simplify to reduce instruction count } - public long v() { + public long s() { - return b(this.a(), this.b(), this.c()); -+ return (((long) x & 4194303L) << 42) | (((long) y & 1048575L)) | (((long) z & 4194303L) << 20); // Paper - Simplify to reduce instruction count ++ return (((long) getX() & 4194303L) << 42) | (((long) getY() & 1048575L)) | (((long) getZ() & 4194303L) << 20); // Paper - Simplify to reduce instruction count } - public Stream w() { -- return BlockPosition.a(this.d(), this.e(), this.f(), this.g(), this.h(), this.r()); -+ return BlockPosition.a(x << 4, y << 4, z << 4, (x << 4) + 15, (y << 4) + 15, (z << 4) + 15); // Paper - simplify/inline + public Stream t() { +@@ -147,18 +154,11 @@ public class SectionPosition extends BaseBlockPosition { } public static Stream a(SectionPosition sectionposition, int i) { @@ -228,7 +181,7 @@ index ca3f63f5e5e4e926de562b4bfbbf72ad8a6b943f..22bc96f97d22e0748110982e4b1ff850 - int l = sectionposition.c(); - - return a(j - i, k - i, l - i, j + i, k + i, l + i); -+ return a(sectionposition.x - i, sectionposition.y - i, sectionposition.z - i, sectionposition.x + i, sectionposition.y + i, sectionposition.z + i); // Paper - simplify/inline ++ return a(sectionposition.getX() - i, sectionposition.getY() - i, sectionposition.getZ() - i, sectionposition.getX() + i, sectionposition.getY() + i, sectionposition.getZ() + i); // Paper - simplify/inline } public static Stream b(ChunkCoordIntPair chunkcoordintpair, int i) { diff --git a/Spigot-Server-Patches/0536-Optimize-Light-Engine.patch b/Spigot-Server-Patches/0505-Optimize-Light-Engine.patch similarity index 88% rename from Spigot-Server-Patches/0536-Optimize-Light-Engine.patch rename to Spigot-Server-Patches/0505-Optimize-Light-Engine.patch index 56f8be81f..0073d98c4 100644 --- a/Spigot-Server-Patches/0536-Optimize-Light-Engine.patch +++ b/Spigot-Server-Patches/0505-Optimize-Light-Engine.patch @@ -24,24 +24,11 @@ Massive update to light to improve performance and chunk loading/generation. 7) Buffer non urgent tasks even if queueUpdate is called multiple times to improve efficiency. 8) Fix NPE risk that crashes server in getting nibble data -diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java -index d2207a2c95690de586ab2d181b64955a6d2ea70d..66244a9d0e253b3709df4ae2adcd21e44ebbfc90 100644 ---- a/src/main/java/net/minecraft/server/Block.java -+++ b/src/main/java/net/minecraft/server/Block.java -@@ -310,7 +310,7 @@ public class Block implements IMaterial { - return false; - } - -- @Deprecated -+ public final boolean canOcclude(IBlockData blockData) { return n(blockData); } @Deprecated // Paper - OBFHELPER - public final boolean n(IBlockData iblockdata) { - return this.j; - } diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 8efe036be0c74a5ceb6a18e019c4a08a49a28693..7d50b94cb37ea921451af1baa47c8900e99b37e1 100644 +index 604e7004b659daed2844ba1a76bf09288ec549e5..ef980f9859d1d7d0d5e13d0d70e998055f92135e 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -1100,7 +1100,7 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -1044,7 +1044,7 @@ public class ChunkProviderServer extends IChunkProvider { if (ChunkProviderServer.this.tickDistanceManager()) { return true; } else { @@ -50,46 +37,6 @@ index 8efe036be0c74a5ceb6a18e019c4a08a49a28693..7d50b94cb37ea921451af1baa47c8900 return super.executeNext() || execChunkTask; // Paper } } finally { -diff --git a/src/main/java/net/minecraft/server/IBlockData.java b/src/main/java/net/minecraft/server/IBlockData.java -index 296b41bf36ee1ace5bd9db2b810bf926b5f5278f..b39554faf235b6f81c86542673dfb4508d4c3e5a 100644 ---- a/src/main/java/net/minecraft/server/IBlockData.java -+++ b/src/main/java/net/minecraft/server/IBlockData.java -@@ -24,6 +24,7 @@ public class IBlockData extends BlockDataAbstract implements - private final boolean e; - private final boolean isAir; // Paper - private final boolean isTicking; // Paper -+ private final boolean canOcclude; // Paper - - public IBlockData(Block block, ImmutableMap, Comparable> immutablemap) { - super(block, immutablemap); -@@ -31,6 +32,7 @@ public class IBlockData extends BlockDataAbstract implements - this.e = block.o(this); - this.isAir = this.getBlock().isAir(this); // Paper - this.isTicking = this.getBlock().isTicking(this); // Paper -+ this.canOcclude = this.getBlock().canOcclude(this); // Paper - } - - public void c() { -@@ -83,7 +85,7 @@ public class IBlockData extends BlockDataAbstract implements - return this.c == null || this.c.h; - } - -- public boolean g() { -+ public final boolean g() { // Paper - return this.e; - } - -@@ -151,8 +153,8 @@ public class IBlockData extends BlockDataAbstract implements - return this.c != null ? this.c.c : this.getBlock().k(this, iblockaccess, blockposition); - } - -- public boolean o() { -- return this.c != null ? this.c.b : this.getBlock().n(this); -+ public final boolean o() { // Paper -+ return canOcclude; // Paper - } - - public VoxelShape getShape(IBlockAccess iblockaccess, BlockPosition blockposition) { diff --git a/src/main/java/net/minecraft/server/LightEngineBlock.java b/src/main/java/net/minecraft/server/LightEngineBlock.java index 07fadc21ee12138b52cc77c50da536fec5b032f5..a61d0a27e9525505eedaec8cde44216e807eb9a8 100644 --- a/src/main/java/net/minecraft/server/LightEngineBlock.java @@ -264,10 +211,10 @@ index 2eb37fb5796d423a70fa7321899a19b6625bbecc..13d067f48647dea63ef1bf3a2a3e0868 if (l1 == i) { l1 = Long.MAX_VALUE; diff --git a/src/main/java/net/minecraft/server/LightEngineLayer.java b/src/main/java/net/minecraft/server/LightEngineLayer.java -index f72ff8495bcf704c15040676b95c51fecb72b73a..faa432779ec70c2c6b5fe7fe3523f171e26d3a5f 100644 +index 3e9731bcdd4c6370c11ffc93f9fafcaf60fe932b..b5d5dd1075fd6aabbfbbd60f219b76593fc54a76 100644 --- a/src/main/java/net/minecraft/server/LightEngineLayer.java +++ b/src/main/java/net/minecraft/server/LightEngineLayer.java -@@ -11,9 +11,9 @@ public abstract class LightEngineLayer, S e +@@ -11,10 +11,37 @@ public abstract class LightEngineLayer, S e protected final EnumSkyBlock b; protected final S c; private boolean f; @@ -277,9 +224,37 @@ index f72ff8495bcf704c15040676b95c51fecb72b73a..faa432779ec70c2c6b5fe7fe3523f171 - private final IBlockAccess[] h = new IBlockAccess[2]; + private final IChunkAccess[] h = new IChunkAccess[2]; // Paper ++ // Paper start - see fully commented out method below (look for Bedrock) ++ // optimized method with less branching for when scenarios arent needed. ++ // avoid using mutable version if can ++ protected final IBlockData getBlockOptimized(int x, int y, int z, MutableInt mutableint) { ++ IChunkAccess iblockaccess = this.a(x >> 4, z >> 4); ++ ++ if (iblockaccess == null) { ++ mutableint.setValue(16); ++ return Blocks.BEDROCK.getBlockData(); ++ } else { ++ this.pos.setValues(x, y, z); ++ IBlockData iblockdata = iblockaccess.getType(x, y, z); ++ mutableint.setValue(iblockdata.b(this.a.getWorld(), this.pos)); ++ return iblockdata.l() && iblockdata.e() ? iblockdata : Blocks.AIR.getBlockData(); ++ } ++ } ++ protected final IBlockData getBlockOptimized(int x, int y, int z) { ++ IChunkAccess iblockaccess = this.a(x >> 4, z >> 4); ++ ++ if (iblockaccess == null) { ++ return Blocks.BEDROCK.getBlockData(); ++ } else { ++ IBlockData iblockdata = iblockaccess.getType(x, y, z); ++ return iblockdata.l() && iblockdata.e() ? iblockdata : Blocks.AIR.getBlockData(); ++ } ++ } ++ // Paper end public LightEngineLayer(ILightAccess ilightaccess, EnumSkyBlock enumskyblock, S s0) { super(16, 256, 8192); -@@ -33,7 +33,7 @@ public abstract class LightEngineLayer, S e + this.a = ilightaccess; +@@ -33,7 +60,7 @@ public abstract class LightEngineLayer, S e } @Nullable @@ -288,7 +263,7 @@ index f72ff8495bcf704c15040676b95c51fecb72b73a..faa432779ec70c2c6b5fe7fe3523f171 long k = ChunkCoordIntPair.pair(i, j); for (int l = 0; l < 2; ++l) { -@@ -42,7 +42,7 @@ public abstract class LightEngineLayer, S e +@@ -42,7 +69,7 @@ public abstract class LightEngineLayer, S e } } @@ -297,7 +272,7 @@ index f72ff8495bcf704c15040676b95c51fecb72b73a..faa432779ec70c2c6b5fe7fe3523f171 for (int i1 = 1; i1 > 0; --i1) { this.g[i1] = this.g[i1 - 1]; -@@ -59,37 +59,64 @@ public abstract class LightEngineLayer, S e +@@ -59,37 +86,39 @@ public abstract class LightEngineLayer, S e Arrays.fill(this.h, (Object) null); } @@ -308,7 +283,31 @@ index f72ff8495bcf704c15040676b95c51fecb72b73a..faa432779ec70c2c6b5fe7fe3523f171 - } - - return Blocks.AIR.getBlockData(); -+ // Paper start - unused, optimized versions below, comment out to detect changes +- } else { +- int j = SectionPosition.a(BlockPosition.b(i)); +- int k = SectionPosition.a(BlockPosition.d(i)); +- IBlockAccess iblockaccess = this.a(j, k); +- +- if (iblockaccess == null) { +- if (mutableint != null) { +- mutableint.setValue(16); +- } +- +- return Blocks.BEDROCK.getBlockData(); +- } else { +- this.d.g(i); +- IBlockData iblockdata = iblockaccess.getType(this.d); +- boolean flag = iblockdata.l() && iblockdata.e(); +- +- if (mutableint != null) { +- mutableint.setValue(iblockdata.b(this.a.getWorld(), (BlockPosition) this.d)); +- } +- +- return flag ? iblockdata : Blocks.AIR.getBlockData(); +- } +- } +- } ++ // Paper start - comment out, see getBlockOptimized +// protected IBlockData a(long i, @Nullable MutableInt mutableint) { +// if (i == Long.MAX_VALUE) { +// if (mutableint != null) { @@ -330,7 +329,7 @@ index f72ff8495bcf704c15040676b95c51fecb72b73a..faa432779ec70c2c6b5fe7fe3523f171 +// } else { +// this.d.g(i); +// IBlockData iblockdata = iblockaccess.getType(this.d); -+// boolean flag = iblockdata.o() && iblockdata.g(); ++// boolean flag = iblockdata.l() && iblockdata.e(); +// +// if (mutableint != null) { +// mutableint.setValue(iblockdata.b(this.a.getWorld(), (BlockPosition) this.d)); @@ -340,56 +339,11 @@ index f72ff8495bcf704c15040676b95c51fecb72b73a..faa432779ec70c2c6b5fe7fe3523f171 +// } +// } +// } -+ // optimized method with less branching for when scenarios arent needed. -+ // avoid using mutable version if can -+ protected final IBlockData getBlockOptimized(int x, int y, int z, MutableInt mutableint) { -+ IChunkAccess iblockaccess = this.a(x >> 4, z >> 4); -+ -+ if (iblockaccess == null) { -+ mutableint.setValue(16); -+ return Blocks.BEDROCK.getBlockData(); - } else { -- int j = SectionPosition.a(BlockPosition.b(i)); -- int k = SectionPosition.a(BlockPosition.d(i)); -- IBlockAccess iblockaccess = this.a(j, k); -- -- if (iblockaccess == null) { -- if (mutableint != null) { -- mutableint.setValue(16); -- } -- -- return Blocks.BEDROCK.getBlockData(); -- } else { -- this.d.g(i); -- IBlockData iblockdata = iblockaccess.getType(this.d); -- boolean flag = iblockdata.o() && iblockdata.g(); -- -- if (mutableint != null) { -- mutableint.setValue(iblockdata.b(this.a.getWorld(), (BlockPosition) this.d)); -- } -+ this.pos.setValues(x, y, z); -+ IBlockData iblockdata = iblockaccess.getType(x, y, z); -+ mutableint.setValue(iblockdata.b(this.a.getWorld(), this.pos)); -+ return iblockdata.o() && iblockdata.g() ? iblockdata : Blocks.AIR.getBlockData(); -+ } -+ } -+ protected final IBlockData getBlockOptimized(int x, int y, int z) { -+ IChunkAccess iblockaccess = this.a(x >> 4, z >> 4); - -- return flag ? iblockdata : Blocks.AIR.getBlockData(); -- } -+ if (iblockaccess == null) { -+ return Blocks.BEDROCK.getBlockData(); -+ } else { -+ IBlockData iblockdata = iblockaccess.getType(x, y, z); -+ return iblockdata.o() && iblockdata.g() ? iblockdata : Blocks.AIR.getBlockData(); - } - } + // Paper end protected VoxelShape a(IBlockData iblockdata, long i, EnumDirection enumdirection) { - return iblockdata.o() ? iblockdata.a(this.a.getWorld(), this.d.g(i), enumdirection) : VoxelShapes.a(); -@@ -124,8 +151,9 @@ public abstract class LightEngineLayer, S e + return iblockdata.l() ? iblockdata.a(this.a.getWorld(), this.d.g(i), enumdirection) : VoxelShapes.a(); +@@ -124,8 +153,9 @@ public abstract class LightEngineLayer, S e return i == Long.MAX_VALUE ? 0 : 15 - this.c.i(i); } @@ -568,10 +522,10 @@ index f0b57784006752e031800a12a1a3c1a5945c636b..32b52ca2462fa206b1184025cb3837d6 if (i2 != j) { int l2; diff --git a/src/main/java/net/minecraft/server/LightEngineStorage.java b/src/main/java/net/minecraft/server/LightEngineStorage.java -index b0b7544592981bcff22c8acee7230a211918ef28..f2575fb69714397bb8e1f9d402689c7816d73b6c 100644 +index b8b06c790adfa0246b1a6fb5eab1f63bf5ef8b0b..b98e60772bad7e06845b50fdc11e98c0ea775d3d 100644 --- a/src/main/java/net/minecraft/server/LightEngineStorage.java +++ b/src/main/java/net/minecraft/server/LightEngineStorage.java -@@ -20,42 +20,42 @@ public abstract class LightEngineStorage> e +@@ -20,9 +20,9 @@ public abstract class LightEngineStorage> e protected final LongSet c = new LongOpenHashSet(); protected final LongSet d = new LongOpenHashSet(); protected volatile M e_visible; protected final Object visibleUpdateLock = new Object(); // Paper - diff on change, should be "visible" - force compile fail on usage change @@ -583,6 +537,7 @@ index b0b7544592981bcff22c8acee7230a211918ef28..f2575fb69714397bb8e1f9d402689c78 protected final Long2ObjectMap i = Long2ObjectMaps.synchronize(new Long2ObjectOpenHashMap()); private final LongSet n = new LongOpenHashSet(); private final LongSet o = new LongOpenHashSet(); +@@ -30,33 +30,33 @@ public abstract class LightEngineStorage> e protected volatile boolean j; protected LightEngineStorage(EnumSkyBlock enumskyblock, ILightAccess ilightaccess, M m0) { @@ -623,7 +578,7 @@ index b0b7544592981bcff22c8acee7230a211918ef28..f2575fb69714397bb8e1f9d402689c78 return m0.c(i); } -@@ -69,27 +69,57 @@ public abstract class LightEngineStorage> e +@@ -70,27 +70,57 @@ public abstract class LightEngineStorage> e protected abstract int d(long i); protected int i(long i) { @@ -692,16 +647,16 @@ index b0b7544592981bcff22c8acee7230a211918ef28..f2575fb69714397bb8e1f9d402689c78 } } } -@@ -121,17 +151,23 @@ public abstract class LightEngineStorage> e +@@ -122,17 +152,23 @@ public abstract class LightEngineStorage> e } if (k >= 2 && j != 2) { -- if (this.o.contains(i)) { -- this.o.remove(i); +- if (this.p.contains(i)) { +- this.p.remove(i); - } else { -+ if (!this.o.remove(i)) { // Paper - remove useless contains - credit to JellySquid -+ //this.o.remove(i); // Paper -+ //} else { // Pape ++ if (!this.p.remove(i)) { // Paper - remove useless contains - credit to JellySquid ++ //this.p.remove(i); // Paper ++ //} else { // Paper this.f.a(i, this.j(i)); this.g.add(i); this.k(i); @@ -723,7 +678,7 @@ index b0b7544592981bcff22c8acee7230a211918ef28..f2575fb69714397bb8e1f9d402689c78 } } } -@@ -157,9 +193,9 @@ public abstract class LightEngineStorage> e +@@ -158,9 +194,9 @@ public abstract class LightEngineStorage> e return SectionPosition.e(j) == i; }); } else { @@ -736,7 +691,7 @@ index b0b7544592981bcff22c8acee7230a211918ef28..f2575fb69714397bb8e1f9d402689c78 for (int i1 = 0; i1 < 16; ++i1) { for (int j1 = 0; j1 < 16; ++j1) { -@@ -186,7 +222,7 @@ public abstract class LightEngineStorage> e +@@ -187,7 +223,7 @@ public abstract class LightEngineStorage> e NibbleArray nibblearray; while (longiterator.hasNext()) { @@ -745,8 +700,8 @@ index b0b7544592981bcff22c8acee7230a211918ef28..f2575fb69714397bb8e1f9d402689c78 this.a(lightenginelayer, i); NibbleArray nibblearray1 = (NibbleArray) this.i.remove(i); -@@ -204,48 +240,56 @@ public abstract class LightEngineStorage> e - longiterator = this.o.iterator(); +@@ -205,7 +241,7 @@ public abstract class LightEngineStorage> e + longiterator = this.p.iterator(); while (longiterator.hasNext()) { - i = (Long) longiterator.next(); @@ -754,16 +709,11 @@ index b0b7544592981bcff22c8acee7230a211918ef28..f2575fb69714397bb8e1f9d402689c78 this.l(i); } - this.o.clear(); - this.j = false; -- ObjectIterator objectiterator = this.i.long2ObjectEntrySet().iterator(); -+ ObjectIterator> objectiterator = Long2ObjectMaps.fastIterator(this.i); // Paper - +@@ -216,12 +252,13 @@ public abstract class LightEngineStorage> e Entry entry; long j; + NibbleArray test = null; // Paper -+ LongSet propagating = new LongOpenHashSet(); // Paper - credit JellySquid for idea to move this up while (objectiterator.hasNext()) { entry = (Entry) objectiterator.next(); j = entry.getLongKey(); @@ -775,66 +725,48 @@ index b0b7544592981bcff22c8acee7230a211918ef28..f2575fb69714397bb8e1f9d402689c78 this.a(lightenginelayer, j); this.f.a(j, nibblearray); this.g.add(j); - } -+ if (!flag1) propagating.add(j); // Paper -+ objectiterator.remove(); // Paper - } - } - - this.f.c(); -- if (!flag1) { -- longiterator = this.i.keySet().iterator(); -+ if (!flag1) {// Paper - diff on change, change propagating add a few lines up -+ longiterator = propagating.iterator(); // Paper +@@ -234,14 +271,14 @@ public abstract class LightEngineStorage> e + longiterator = this.i.keySet().iterator(); while (longiterator.hasNext()) { - i = (Long) longiterator.next(); -- if (this.g(i)) { -- int k = SectionPosition.c(SectionPosition.b(i)); -- int l = SectionPosition.c(SectionPosition.c(i)); -- int i1 = SectionPosition.c(SectionPosition.d(i)); -+ // Paper start -+ i = longiterator.nextLong(); -+ if (true) { // don't check hasLight, this iterator is filtered already -+ int secX = (int) (i >> 42); -+ int secY = (int) (i << 44 >> 44); -+ int secZ = (int) (i << 22 >> 42); -+ int k = secX << 4; // baseX -+ int l = secY << 4; // baseY -+ int i1 = secZ << 4; // baseZ -+ // Paper end - EnumDirection[] aenumdirection = LightEngineStorage.k; - int j1 = aenumdirection.length; ++ i = longiterator.nextLong(); // Paper + this.b(lightenginelayer, i); + } + } else { + longiterator = this.n.iterator(); - for (int k1 = 0; k1 < j1; ++k1) { - EnumDirection enumdirection = aenumdirection[k1]; -- long l1 = SectionPosition.a(i, enumdirection); -- -- if (!this.i.containsKey(l1) && this.g(l1)) { -+ long l1 = SectionPosition.getAdjacentFromSectionPos(secX, secY, secZ, enumdirection); // Paper - avoid extra unpacking -+ if (!propagating.contains(l1) && this.g(l1)) { // Paper - use propagating - for (int i2 = 0; i2 < 16; ++i2) { - for (int j2 = 0; j2 < 16; ++j2) { - long k2; -@@ -287,6 +331,8 @@ public abstract class LightEngineStorage> e + while (longiterator.hasNext()) { +- i = (Long) longiterator.next(); ++ i = longiterator.nextLong(); // Paper + this.b(lightenginelayer, i); } } +@@ -262,15 +299,20 @@ public abstract class LightEngineStorage> e -+ // Paper start - moved above - Credit JellySquid for idea -+ /* - objectiterator = this.i.long2ObjectEntrySet().iterator(); - - while (objectiterator.hasNext()) { -@@ -295,7 +341,8 @@ public abstract class LightEngineStorage> e - if (this.g(j)) { - objectiterator.remove(); - } -- } -+ }*/ + private void b(LightEngineLayer lightenginelayer, long i) { + if (this.g(i)) { +- int j = SectionPosition.c(SectionPosition.b(i)); +- int k = SectionPosition.c(SectionPosition.c(i)); +- int l = SectionPosition.c(SectionPosition.d(i)); ++ // Paper start ++ int secX = (int) (i >> 42); ++ int secY = (int) (i << 44 >> 44); ++ int secZ = (int) (i << 22 >> 42); ++ int j = secX << 4; // baseX ++ int k = secY << 4; // baseY ++ int l = secZ << 4; // baseZ + // Paper end + EnumDirection[] aenumdirection = LightEngineStorage.k; + int i1 = aenumdirection.length; - } - } + for (int j1 = 0; j1 < i1; ++j1) { + EnumDirection enumdirection = aenumdirection[j1]; +- long k1 = SectionPosition.a(i, enumdirection); ++ long k1 = SectionPosition.getAdjacentFromSectionPos(secX, secY, secZ, enumdirection); // Paper - avoid extra unpacking + + if (!this.i.containsKey(k1) && this.g(k1)) { + for (int l1 = 0; l1 < 16; ++l1) { diff --git a/src/main/java/net/minecraft/server/LightEngineStorageArray.java b/src/main/java/net/minecraft/server/LightEngineStorageArray.java index 37c44a89f28c44915fcae5a7e2c4797b1c123723..549c2551c2b59730bf53a80f8706d388d96ad932 100644 --- a/src/main/java/net/minecraft/server/LightEngineStorageArray.java @@ -1095,7 +1027,7 @@ index 097f58e9ac3f4096d3b9dad75b6ebe76021fa92c..f744f62c93370d096c113f92ee81a823 lightenginelayer.a(Long.MAX_VALUE, l3, 15, false); } diff --git a/src/main/java/net/minecraft/server/LightEngineThreaded.java b/src/main/java/net/minecraft/server/LightEngineThreaded.java -index 8776799de033f02b0f87e9ea7e4a4ce912e94dd4..9ef39f1f51f9960865f6418115b08e8d7de86509 100644 +index a9dc8466278f9ec2becbcb643e6e1c973df72b82..968a1f71a44122ef0c4236d4251497f0b813d3b9 100644 --- a/src/main/java/net/minecraft/server/LightEngineThreaded.java +++ b/src/main/java/net/minecraft/server/LightEngineThreaded.java @@ -14,8 +14,98 @@ import org.apache.logging.log4j.Logger; @@ -1211,7 +1143,7 @@ index 8776799de033f02b0f87e9ea7e4a4ce912e94dd4..9ef39f1f51f9960865f6418115b08e8d @@ -111,8 +201,11 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable { private void a(int i, int j, IntSupplier intsupplier, LightEngineThreaded.Update lightenginethreaded_update, Runnable runnable) { - this.e.a(ChunkTaskQueueSorter.a(() -> { // Paper - decompile error + this.e.a(ChunkTaskQueueSorter.a(() -> { - this.c.add(Pair.of(lightenginethreaded_update, runnable)); - if (this.c.size() >= this.f) { + // Paper start @@ -1337,22 +1269,22 @@ index 8cedfdd820cc02a76607b53e0b054fc74654f907..a9795394c9b17f9f0ce4c4f9c8f51a48 private static final int nibbleBucketSizeMultiplier = Integer.getInteger("Paper.nibbleBucketSize", 3072); private static final int maxPoolSize = Integer.getInteger("Paper.maxNibblePoolSize", (int) Math.min(6, Math.max(1, Runtime.getRuntime().maxMemory() / 1024 / 1024 / 1024)) * (nibbleBucketSizeMultiplier * 8)); diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index 69899c100dd86c6c4795013364472336327ce036..2edb4904d3071aa9de6517c375410b814a45cfbe 100644 +index 446c401b3139f8c6c0e70d883340f0140d94b752..a3bce8f13bf278af2d6870891daa9bf692b4e267 100644 --- a/src/main/java/net/minecraft/server/PlayerChunk.java +++ b/src/main/java/net/minecraft/server/PlayerChunk.java -@@ -728,6 +728,7 @@ public class PlayerChunk { +@@ -716,6 +716,7 @@ public class PlayerChunk { ioPriority = com.destroystokyo.paper.io.PrioritizedTaskQueue.HIGH_PRIORITY; } chunkMap.world.asyncChunkTaskManager.raisePriority(location.x, location.z, ioPriority); + chunkMap.world.getChunkProvider().getLightEngine().changePriority(location.pair(), getCurrentPriority(), priority); } if (getCurrentPriority() != priority) { - this.w.a(this.location, this::getCurrentPriority, priority, this::setPriority); // use preferred priority + this.v.a(this.location, this::getCurrentPriority, priority, this::setPriority); // use preferred priority diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 98adcb6390105a183d66975ed9659906b609ce08..201221df63d4ec8e704fee9126240891f2b1c37d 100644 +index 0e684a040b1a6cee056e8716c2a69620fc440af3..8c5639fa55404474df8656d3f6ad2db1bc71e3da 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -647,6 +647,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -653,6 +653,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { // Paper end } @@ -1361,10 +1293,10 @@ index 98adcb6390105a183d66975ed9659906b609ce08..201221df63d4ec8e704fee9126240891 return () -> { PlayerChunk playerchunk = this.getVisibleChunk(i); diff --git a/src/main/java/net/minecraft/server/ThreadedMailbox.java b/src/main/java/net/minecraft/server/ThreadedMailbox.java -index 8082569022384a3ba03fb4a6f1ae12b443598dcb..3db8073f5182fe4dd4c710b202afc323dfb9b2d2 100644 +index 35f4d2d9591e625ab0bbeab7b606761e74965eec..698d82dd736529a8cbfad5c6bed70ab97f0064bb 100644 --- a/src/main/java/net/minecraft/server/ThreadedMailbox.java +++ b/src/main/java/net/minecraft/server/ThreadedMailbox.java -@@ -93,7 +93,8 @@ public class ThreadedMailbox implements Mailbox, AutoCloseable, Runnable { +@@ -109,7 +109,8 @@ public class ThreadedMailbox implements Mailbox, AutoCloseable, Runnable { } @@ -1375,10 +1307,10 @@ index 8082569022384a3ba03fb4a6f1ae12b443598dcb..3db8073f5182fe4dd4c710b202afc323 this.a.a(t0); this.f(); diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 49da7352dcee6c352904cabe8b5db0152c427029..46e261b6513b52f5562387b661de4a409ea515a3 100644 +index 472a0c624f09b7c6c07bbe8feadadf3ac7dd05a3..3a740f5669876271a3f13c64e28eb6f2cb033b4c 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -685,6 +685,7 @@ public class WorldServer extends World { +@@ -708,6 +708,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { } gameprofilerfiller.exit(); timings.chunkTicksBlocks.stopTiming(); // Paper diff --git a/Spigot-Server-Patches/0537-Delay-Chunk-Unloads-based-on-Player-Movement.patch b/Spigot-Server-Patches/0506-Delay-Chunk-Unloads-based-on-Player-Movement.patch similarity index 90% rename from Spigot-Server-Patches/0537-Delay-Chunk-Unloads-based-on-Player-Movement.patch rename to Spigot-Server-Patches/0506-Delay-Chunk-Unloads-based-on-Player-Movement.patch index 36bc22fde..32ee41904 100644 --- a/Spigot-Server-Patches/0537-Delay-Chunk-Unloads-based-on-Player-Movement.patch +++ b/Spigot-Server-Patches/0506-Delay-Chunk-Unloads-based-on-Player-Movement.patch @@ -17,10 +17,10 @@ This allows servers with smaller worlds who do less long distance exploring to s wasting cpu cycles on saving/unloading/reloading chunks repeatedly. diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index c3f7717869c86d9ac6395615bceda324aea16b27..ecacb72b922927f06883b75e7d2cc1f904eb9f03 100644 +index 5af7e5c815752f2fd2b13c02a905796971401813..6e6534ab25dbebbad5d2ee848edb88ebcae86d03 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -682,4 +682,13 @@ public class PaperWorldConfig { +@@ -634,4 +634,13 @@ public class PaperWorldConfig { private void viewDistance() { this.noTickViewDistance = this.getInt("viewdistances.no-tick-view-distance", -1); } @@ -35,7 +35,7 @@ index c3f7717869c86d9ac6395615bceda324aea16b27..ecacb72b922927f06883b75e7d2cc1f9 + } } diff --git a/src/main/java/net/minecraft/server/ChunkMapDistance.java b/src/main/java/net/minecraft/server/ChunkMapDistance.java -index ff9e164574f1f3d043740ac727faf567122e5b64..cc02ed6b58a219d8f06e4ccc2a51f46c33af98d1 100644 +index 4c4108705e9d25912e57a7b3c28b4f1abad58377..893c0085bca0a8d77a85dba1cc29f2dec96c56ec 100644 --- a/src/main/java/net/minecraft/server/ChunkMapDistance.java +++ b/src/main/java/net/minecraft/server/ChunkMapDistance.java @@ -176,6 +176,27 @@ public abstract class ChunkMapDistance { @@ -67,7 +67,7 @@ index ff9e164574f1f3d043740ac727faf567122e5b64..cc02ed6b58a219d8f06e4ccc2a51f46c if (arraysetsorted.isEmpty()) { diff --git a/src/main/java/net/minecraft/server/Ticket.java b/src/main/java/net/minecraft/server/Ticket.java -index 0d6e0f2ddaa85c04e626980591e9a78ac27fb42d..c79aa4a80a8a2288f7a50466abd677f388360ba1 100644 +index b5030d6f5d917ba33fb3c40903384fa7a56bc5f1..e41cb8613efc86499dfe3be36c9130ab6dc9b89e 100644 --- a/src/main/java/net/minecraft/server/Ticket.java +++ b/src/main/java/net/minecraft/server/Ticket.java @@ -9,11 +9,13 @@ public final class Ticket implements Comparable> { @@ -84,13 +84,7 @@ index 0d6e0f2ddaa85c04e626980591e9a78ac27fb42d..c79aa4a80a8a2288f7a50466abd677f3 } public int compareTo(Ticket ticket) { -@@ -57,12 +59,13 @@ public final class Ticket implements Comparable> { - return this.b; - } - -+ protected void setCurrentTick(long i) { a(i); } // Paper - OBFHELPER - protected void a(long i) { - this.d = i; +@@ -63,7 +65,7 @@ public final class Ticket implements Comparable> { } protected boolean b(long i) { diff --git a/Spigot-Server-Patches/0506-Fix-CraftServer.unloadWorld-Leak.patch b/Spigot-Server-Patches/0506-Fix-CraftServer.unloadWorld-Leak.patch deleted file mode 100644 index fb1455d4f..000000000 --- a/Spigot-Server-Patches/0506-Fix-CraftServer.unloadWorld-Leak.patch +++ /dev/null @@ -1,124 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Fri, 8 May 2020 20:30:58 -0400 -Subject: [PATCH] Fix CraftServer.unloadWorld Leak - -The dimension manager was still registered which leaked the entire World - -diff --git a/src/main/java/net/minecraft/server/DimensionManager.java b/src/main/java/net/minecraft/server/DimensionManager.java -index 393bc4dc700bbf8653db0662c7957f676b0a647a..410ab224fbb05bfbf4aa847d69b150bfe75d32f6 100644 ---- a/src/main/java/net/minecraft/server/DimensionManager.java -+++ b/src/main/java/net/minecraft/server/DimensionManager.java -@@ -20,6 +20,15 @@ public class DimensionManager implements MinecraftSerializable { - private final boolean hasSkyLight; - private final GenLayerZoomer genLayerZoomer; - -+ // Paper start -+ public static void unregister(String s, DimensionManager dimensionmanager) { -+ if (dimensionmanager == OVERWORLD || dimensionmanager == NETHER || dimensionmanager == THE_END) { return; } // do not unregister the default worlds -+ MCUtil.MAIN_EXECUTOR.execute(() -> { -+ RegistryMaterials registry = (RegistryMaterials) IRegistry.DIMENSION_TYPE; -+ registry.deleteValue(new MinecraftKey(s), dimensionmanager); -+ }); -+ } -+ // Paper end - public static DimensionManager register(String s, DimensionManager dimensionmanager) { - return (DimensionManager) IRegistry.a(IRegistry.DIMENSION_TYPE, dimensionmanager.id, s, dimensionmanager); - } -diff --git a/src/main/java/net/minecraft/server/RegistryID.java b/src/main/java/net/minecraft/server/RegistryID.java -index e8a48b9a4c999281869dfb85577c2b44d6e30eb7..5335e7acc85f0fe9699e5ed59e5aaae5f381347d 100644 ---- a/src/main/java/net/minecraft/server/RegistryID.java -+++ b/src/main/java/net/minecraft/server/RegistryID.java -@@ -9,12 +9,26 @@ import javax.annotation.Nullable; - public class RegistryID implements Registry { - - private static final Object a = null; -- private K[] b; -+ private K[] b; // Paper - diff below - private int[] c; -- private K[] d; -+ private K[] d; // Paper - diff below - private int e; - private int f; - private java.util.BitSet usedIds; // Paper -+ // Paper start -+ public void removeValue(K value) { -+ removeValue(value, this.b); -+ removeValue(value, this.d); -+ rehash(this.b.length); -+ } -+ public void removeValue(K value, K[] arr) { -+ for (int i = 0; i < arr.length; i++) { -+ K k = arr[i]; -+ if (k == value) { -+ arr[i] = null; -+ } -+ } -+ } - - public RegistryID(int i) { - i = (int) ((float) i / 0.8F); -@@ -58,6 +72,7 @@ public class RegistryID implements Registry { - return this.e; - } - -+ private void rehash(int i) { d(i); } // Paper - OBFHELPER - private void d(int i) { - K[] ak = this.b; - int[] aint = this.c; -diff --git a/src/main/java/net/minecraft/server/RegistryMaterials.java b/src/main/java/net/minecraft/server/RegistryMaterials.java -index 8477febca23b575da21023b4d7c18bb679cf3b30..dcdd8d38dee89ae7ac404a431e51a61c50b6d45c 100644 ---- a/src/main/java/net/minecraft/server/RegistryMaterials.java -+++ b/src/main/java/net/minecraft/server/RegistryMaterials.java -@@ -22,18 +22,23 @@ public class RegistryMaterials extends IRegistryWritable { - private int V; - - public RegistryMaterials() {} -+ public T deleteValue(MinecraftKey minecraftkey, T value) { -+ this.b.removeValue(value); // Diff 1 -+ this.d = null; // Diff 2 -+ return this.c.remove(minecraftkey); // Diff 3 -+ } - - @Override - public V a(int i, MinecraftKey minecraftkey, V v0) { -- this.b.a(v0, i); -+ this.b.a(v0, i); // Paper - diff above 1 - Validate.notNull(minecraftkey); - Validate.notNull(v0); -- this.d = null; -+ this.d = null; // Diff 2 - if (this.c.containsKey(minecraftkey)) { - RegistryMaterials.LOGGER.debug("Adding duplicate key '{}' to registry", minecraftkey); - } - -- this.c.put(minecraftkey, v0); -+ this.c.put(minecraftkey, v0); // Paper - diff3 - if (this.V <= i) { - this.V = i + 1; - } -diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index b89f99a66fe2ab9ad4c956c38c9e4b1d79716c9c..c2b7cb36052455eef2100a1924dc76a5921fa858 100644 ---- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java -+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -60,6 +60,7 @@ import net.minecraft.server.EntityPlayer; - import net.minecraft.server.EnumDifficulty; - import net.minecraft.server.EnumGamemode; - import net.minecraft.server.IRecipe; -+import net.minecraft.server.IRegistry; - import net.minecraft.server.Item; - import net.minecraft.server.ItemWorldMap; - import net.minecraft.server.Items; -@@ -1099,7 +1100,11 @@ public final class CraftServer implements Server { - } - - worlds.remove(world.getName().toLowerCase(java.util.Locale.ENGLISH)); -- console.worldServer.remove(handle.getWorldProvider().getDimensionManager()); -+ // Paper start -+ DimensionManager dimensionManager = handle.getWorldProvider().getDimensionManager(); -+ DimensionManager.unregister(world.getName().toLowerCase(java.util.Locale.ENGLISH), dimensionManager); -+ console.worldServer.remove(dimensionManager); -+ // Paper end - return true; - } - diff --git a/Spigot-Server-Patches/0538-Add-Plugin-Tickets-to-API-Chunk-Methods.patch b/Spigot-Server-Patches/0507-Add-Plugin-Tickets-to-API-Chunk-Methods.patch similarity index 88% rename from Spigot-Server-Patches/0538-Add-Plugin-Tickets-to-API-Chunk-Methods.patch rename to Spigot-Server-Patches/0507-Add-Plugin-Tickets-to-API-Chunk-Methods.patch index 4ba303fea..07c1b2e67 100644 --- a/Spigot-Server-Patches/0538-Add-Plugin-Tickets-to-API-Chunk-Methods.patch +++ b/Spigot-Server-Patches/0507-Add-Plugin-Tickets-to-API-Chunk-Methods.patch @@ -22,10 +22,10 @@ wants it to collect even faster, they can restore that setting back to 1 instead Not adding it to .getType() though to keep behavior consistent with vanilla for performance reasons. diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 894917c8891a951edb251f019529d0f7bec7037d..568aefdf698facfc36edacc9332e83196c0d80bc 100644 +index 72cd690a192a0eb468d77aa1779f2a5eec60fdc2..56bf840e3d514153ed249093761ddcc04b282403 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -318,7 +318,7 @@ public final class CraftServer implements Server { +@@ -346,7 +346,7 @@ public final class CraftServer implements Server { ambientSpawn = configuration.getInt("spawn-limits.ambient"); console.autosavePeriod = configuration.getInt("ticks-per.autosave"); warningState = WarningState.value(configuration.getString("settings.deprecated-verbose")); @@ -34,8 +34,8 @@ index 894917c8891a951edb251f019529d0f7bec7037d..568aefdf698facfc36edacc9332e8319 minimumAPI = configuration.getString("settings.minimum-api"); loadIcon(); } -@@ -796,7 +796,7 @@ public final class CraftServer implements Server { - waterAnimalSpawn = configuration.getInt("spawn-limits.water-animals"); +@@ -829,7 +829,7 @@ public final class CraftServer implements Server { + waterAmbientSpawn = configuration.getInt("spawn-limits.water-ambient"); ambientSpawn = configuration.getInt("spawn-limits.ambient"); warningState = WarningState.value(configuration.getString("settings.deprecated-verbose")); - TicketType.PLUGIN.loadPeriod = configuration.getInt("chunk-gc.period-in-ticks"); @@ -44,10 +44,10 @@ index 894917c8891a951edb251f019529d0f7bec7037d..568aefdf698facfc36edacc9332e8319 printSaveWarning = false; console.autosavePeriod = configuration.getInt("ticks-per.autosave"); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 5992fdda8a5c66f77dbfca86d6261b98cce2b1e9..73ffc3c24d38c11982cb44bf0c08e761b9667cda 100644 +index bf2f602bb07aa4c7c0a22ad9be9e77d7fd017191..724c0816d89b0261edf65e1b8459988bd0d5d4d8 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -399,9 +399,22 @@ public class CraftWorld implements World { +@@ -402,9 +402,22 @@ public class CraftWorld implements World { @Override public Chunk getChunkAt(int x, int z) { @@ -71,7 +71,7 @@ index 5992fdda8a5c66f77dbfca86d6261b98cce2b1e9..73ffc3c24d38c11982cb44bf0c08e761 @Override public Chunk getChunkAt(Block block) { Preconditions.checkArgument(block != null, "null block"); -@@ -475,7 +488,7 @@ public class CraftWorld implements World { +@@ -478,7 +491,7 @@ public class CraftWorld implements World { public boolean unloadChunkRequest(int x, int z) { org.spigotmc.AsyncCatcher.catchOp("chunk unload"); // Spigot if (isChunkLoaded(x, z)) { @@ -80,7 +80,7 @@ index 5992fdda8a5c66f77dbfca86d6261b98cce2b1e9..73ffc3c24d38c11982cb44bf0c08e761 } return true; -@@ -552,10 +565,12 @@ public class CraftWorld implements World { +@@ -555,10 +568,12 @@ public class CraftWorld implements World { org.spigotmc.AsyncCatcher.catchOp("chunk load"); // Spigot // Paper start - Optimize this method ChunkCoordIntPair chunkPos = new ChunkCoordIntPair(x, z); @@ -94,7 +94,7 @@ index 5992fdda8a5c66f77dbfca86d6261b98cce2b1e9..73ffc3c24d38c11982cb44bf0c08e761 if (immediate == null) { immediate = world.getChunkProvider().playerChunkMap.getUnloadingChunk(x, z); } -@@ -563,7 +578,7 @@ public class CraftWorld implements World { +@@ -566,7 +581,7 @@ public class CraftWorld implements World { if (!(immediate instanceof ProtoChunkExtension) && !(immediate instanceof net.minecraft.server.Chunk)) { return false; // not full status } @@ -103,7 +103,7 @@ index 5992fdda8a5c66f77dbfca86d6261b98cce2b1e9..73ffc3c24d38c11982cb44bf0c08e761 world.getChunkAt(x, z); // make sure we're at ticket level 32 or lower return true; } -@@ -590,7 +605,7 @@ public class CraftWorld implements World { +@@ -593,7 +608,7 @@ public class CraftWorld implements World { // we do this so we do not re-read the chunk data on disk } @@ -112,7 +112,7 @@ index 5992fdda8a5c66f77dbfca86d6261b98cce2b1e9..73ffc3c24d38c11982cb44bf0c08e761 world.getChunkProvider().getChunkAt(x, z, ChunkStatus.FULL, true); return true; // Paper end -@@ -2489,6 +2504,7 @@ public class CraftWorld implements World { +@@ -2526,6 +2541,7 @@ public class CraftWorld implements World { } return this.world.getChunkProvider().getChunkAtAsynchronously(x, z, gen, urgent).thenComposeAsync((either) -> { net.minecraft.server.Chunk chunk = (net.minecraft.server.Chunk) either.left().orElse(null); diff --git a/Spigot-Server-Patches/0539-Fix-missing-chunks-due-to-integer-overflow.patch b/Spigot-Server-Patches/0508-Fix-missing-chunks-due-to-integer-overflow.patch similarity index 90% rename from Spigot-Server-Patches/0539-Fix-missing-chunks-due-to-integer-overflow.patch rename to Spigot-Server-Patches/0508-Fix-missing-chunks-due-to-integer-overflow.patch index 3bea36db8..7554af844 100644 --- a/Spigot-Server-Patches/0539-Fix-missing-chunks-due-to-integer-overflow.patch +++ b/Spigot-Server-Patches/0508-Fix-missing-chunks-due-to-integer-overflow.patch @@ -13,10 +13,10 @@ The fix for the issue is quite simple, casting chunk coordinates to longs allows the distance calculation to avoid overflow and work as intended. diff --git a/src/main/java/net/minecraft/server/WorldChunkManagerTheEnd.java b/src/main/java/net/minecraft/server/WorldChunkManagerTheEnd.java -index 985f54067073909f413a0c9bb574017bf6d177f3..1ba0f43702b6c576fa9251bef574b7d52406f2f1 100644 +index 3abf1a61dfdb89c6df9338bc4947a64be5c91e2f..631a028dd262476f257c382f488320fee42584cd 100644 --- a/src/main/java/net/minecraft/server/WorldChunkManagerTheEnd.java +++ b/src/main/java/net/minecraft/server/WorldChunkManagerTheEnd.java -@@ -36,7 +36,9 @@ public class WorldChunkManagerTheEnd extends WorldChunkManager { +@@ -50,7 +50,9 @@ public class WorldChunkManagerTheEnd extends WorldChunkManager { int l = j / 2; int i1 = i % 2; int j1 = j % 2; diff --git a/Spigot-Server-Patches/0540-Fix-CraftScheduler-runTaskTimerAsynchronously-Plugin.patch b/Spigot-Server-Patches/0509-Fix-CraftScheduler-runTaskTimerAsynchronously-Plugin.patch similarity index 91% rename from Spigot-Server-Patches/0540-Fix-CraftScheduler-runTaskTimerAsynchronously-Plugin.patch rename to Spigot-Server-Patches/0509-Fix-CraftScheduler-runTaskTimerAsynchronously-Plugin.patch index ca4d8858c..d34a476cf 100644 --- a/Spigot-Server-Patches/0540-Fix-CraftScheduler-runTaskTimerAsynchronously-Plugin.patch +++ b/Spigot-Server-Patches/0509-Fix-CraftScheduler-runTaskTimerAsynchronously-Plugin.patch @@ -7,7 +7,7 @@ Subject: [PATCH] Fix CraftScheduler#runTaskTimerAsynchronously(Plugin, diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java -index 99ea0aabadfac2a68ec67a7d49831025820de2c3..c5d9170a35f38ecdec85607de714b72ffebc88c6 100644 +index 7532bbd82559763cfaf5433a07914b5fb906122c..1bc65ae63673b1de3aa6e0c49bf95dadd7d7b355 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java @@ -184,7 +184,7 @@ public class CraftScheduler implements BukkitScheduler { diff --git a/Spigot-Server-Patches/0509-MC-183249-Don-t-generate-Carving-Masks-BitSet-unless.patch b/Spigot-Server-Patches/0509-MC-183249-Don-t-generate-Carving-Masks-BitSet-unless.patch deleted file mode 100644 index 613fea34f..000000000 --- a/Spigot-Server-Patches/0509-MC-183249-Don-t-generate-Carving-Masks-BitSet-unless.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sat, 9 May 2020 12:11:47 -0400 -Subject: [PATCH] MC-183249: Don't generate Carving Masks BitSet unless needed - -This was using SIGNIFICANT amounts of memory allocating many -long[]'s for BitSets for every ProtoChunk in the cache that had -been unloaded and reloaded. - -This will result in a nice memory reduction. - -diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index fa893b14bcef9bab6891dea2c4375b09d74ac038..e625842e524f18e469f7695b27d52d4d04892266 100644 ---- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java -+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -@@ -472,7 +472,12 @@ public class ChunkRegionLoader { - for (int l = 0; l < k; ++l) { - WorldGenStage.Features worldgenstage_features = aworldgenstage_features[l]; - -- nbttagcompound3.setByteArray(worldgenstage_features.toString(), ichunkaccess.a(worldgenstage_features).toByteArray()); -+ // Paper start - don't create carving mask bitsets if not even at that chunk status yet -+ BitSet mask = protochunk.getCarvingMaskIfSet(worldgenstage_features); -+ if (mask != null) { -+ nbttagcompound3.setByteArray(worldgenstage_features.toString(), mask.toByteArray()); -+ } -+ // Paper end - } - - nbttagcompound1.set("CarvingMasks", nbttagcompound3); -diff --git a/src/main/java/net/minecraft/server/ProtoChunk.java b/src/main/java/net/minecraft/server/ProtoChunk.java -index a78b240621e0407fff67b018224c39fc4f97f4e5..2eb14bbf888f5e5601441743cb7642da6ee1249c 100644 ---- a/src/main/java/net/minecraft/server/ProtoChunk.java -+++ b/src/main/java/net/minecraft/server/ProtoChunk.java -@@ -43,7 +43,8 @@ public class ProtoChunk implements IChunkAccess { - private final ProtoChunkTickList q; - private final ProtoChunkTickList r; - private long s; -- private final Map t; -+ private final Map t;public BitSet getCarvingMaskIfSet(WorldGenStage.Features worldgenstage_features) { return this.t.get(worldgenstage_features); } // Paper -+ // Paper end - private volatile boolean u; - private final World world; // Paper - Anti-Xray - Add world - diff --git a/Spigot-Server-Patches/0541-Fix-piston-physics-inconsistency-MC-188840.patch b/Spigot-Server-Patches/0510-Fix-piston-physics-inconsistency-MC-188840.patch similarity index 88% rename from Spigot-Server-Patches/0541-Fix-piston-physics-inconsistency-MC-188840.patch rename to Spigot-Server-Patches/0510-Fix-piston-physics-inconsistency-MC-188840.patch index 91358261d..33fa3d994 100644 --- a/Spigot-Server-Patches/0541-Fix-piston-physics-inconsistency-MC-188840.patch +++ b/Spigot-Server-Patches/0510-Fix-piston-physics-inconsistency-MC-188840.patch @@ -32,10 +32,10 @@ This patch fixes https://bugs.mojang.com/browse/MC-188840 This patch also fixes rail duping and carpet duping. diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index f0284e81db3ab7c45018de2b446f2d8296df15c3..8444819f071b13e98ba07032520016a664b7b9bc 100644 +index 06adb1fa670e7d755560abae67d46447d63370f0..3b0f3127bcee8e9290b4640bcd4ec0d17fb43f43 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -442,4 +442,9 @@ public class PaperConfig { +@@ -422,4 +422,9 @@ public class PaperConfig { consoleHasAllPermissions = getBoolean("settings.console-has-all-permissions", consoleHasAllPermissions); } @@ -46,10 +46,10 @@ index f0284e81db3ab7c45018de2b446f2d8296df15c3..8444819f071b13e98ba07032520016a6 + } } diff --git a/src/main/java/net/minecraft/server/BlockPiston.java b/src/main/java/net/minecraft/server/BlockPiston.java -index 39cd8ab5925ceb9494e0ac910c73338c24ecda2c..73ac83832121e0390b7c4649681fc247e3d8c30b 100644 +index 6b1253fe7e8d4bb71d4d19c063d3e84c167c4d7b..c3133814f1349b2f70b12967b1b5abc88f71f98c 100644 --- a/src/main/java/net/minecraft/server/BlockPiston.java +++ b/src/main/java/net/minecraft/server/BlockPiston.java -@@ -376,12 +376,24 @@ public class BlockPiston extends BlockDirectional { +@@ -368,12 +368,24 @@ public class BlockPiston extends BlockDirectional { } for (k = list.size() - 1; k >= 0; --k) { @@ -74,14 +74,14 @@ index 39cd8ab5925ceb9494e0ac910c73338c24ecda2c..73ac83832121e0390b7c4649681fc247 + world.setTypeAndData(oldPos, Blocks.AIR.getBlockData(), 2 | 4 | 16 | 1024); // set air to prevent later physics updates from seeing this block + } + // Paper end - fix a variety of piston desync dupes - --j; - aiblockdata[j] = iblockdata1; + aiblockdata[j++] = iblockdata1; } + diff --git a/src/main/java/net/minecraft/server/TileEntityPiston.java b/src/main/java/net/minecraft/server/TileEntityPiston.java -index 489175abd8e582a3c082364fec357c4f061a22d7..d700e8281fe50b1c4131ac260ff6c0d0dd8412f0 100644 +index 5b941321a7fdc561e6b794a1dce5d600083c505d..e7b7e468fc874b0fbcd43f87d816a42420f9b05e 100644 --- a/src/main/java/net/minecraft/server/TileEntityPiston.java +++ b/src/main/java/net/minecraft/server/TileEntityPiston.java -@@ -275,7 +275,7 @@ public class TileEntityPiston extends TileEntity implements ITickable { +@@ -256,7 +256,7 @@ public class TileEntityPiston extends TileEntity implements ITickable { IBlockData iblockdata = Block.b(this.a, (GeneratorAccess) this.world, this.position); if (iblockdata.isAir()) { @@ -89,4 +89,4 @@ index 489175abd8e582a3c082364fec357c4f061a22d7..d700e8281fe50b1c4131ac260ff6c0d0 + this.world.setTypeAndData(this.position, this.a, com.destroystokyo.paper.PaperConfig.allowPistonDuplication ? 84 : (84 | 2)); // Paper - force notify (flag 2), it's possible the set type by the piston block (which doesn't notify) set this block to air Block.a(this.a, iblockdata, this.world, this.position, 3); } else { - if (iblockdata.b((IBlockState) BlockProperties.C) && (Boolean) iblockdata.get(BlockProperties.C)) { + if (iblockdata.b(BlockProperties.C) && (Boolean) iblockdata.get(BlockProperties.C)) { diff --git a/Spigot-Server-Patches/0542-Fix-sand-duping.patch b/Spigot-Server-Patches/0511-Fix-sand-duping.patch similarity index 94% rename from Spigot-Server-Patches/0542-Fix-sand-duping.patch rename to Spigot-Server-Patches/0511-Fix-sand-duping.patch index a42ac1b7f..6cf9476b0 100644 --- a/Spigot-Server-Patches/0542-Fix-sand-duping.patch +++ b/Spigot-Server-Patches/0511-Fix-sand-duping.patch @@ -7,7 +7,7 @@ If the falling block dies during teleportation (entity#move), then we need to detect that by placing a check after the move. diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java -index 6683f7c5f31b88187961335c5f708b8a4f77b5af..243a8c570dd7cc5b1b622ff130c7339f9bcfc79a 100644 +index 40ab0a1e5b8e31f1ef3b2444366784a65f034341..6697b94550054ebbc8d4b3761bd9f36eb7e4ba8a 100644 --- a/src/main/java/net/minecraft/server/EntityFallingBlock.java +++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java @@ -64,6 +64,11 @@ public class EntityFallingBlock extends Entity { diff --git a/Spigot-Server-Patches/0543-Prevent-position-desync-in-playerconnection-causing-.patch b/Spigot-Server-Patches/0512-Prevent-position-desync-in-playerconnection-causing-.patch similarity index 80% rename from Spigot-Server-Patches/0543-Prevent-position-desync-in-playerconnection-causing-.patch rename to Spigot-Server-Patches/0512-Prevent-position-desync-in-playerconnection-causing-.patch index b5b0331a0..218aa2ba9 100644 --- a/Spigot-Server-Patches/0543-Prevent-position-desync-in-playerconnection-causing-.patch +++ b/Spigot-Server-Patches/0512-Prevent-position-desync-in-playerconnection-causing-.patch @@ -14,18 +14,18 @@ behaviour, we need to move all of this dangerous logic outside of the move call and into an appropriate place in the tick method. diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index f9cb87a3be35575ecf3362b10dc7fe5ebadb56ec..2109afc8ca0af636be2d7e7c041e3160448f4a38 100644 +index 6bb2b3520362d056d4d75c65764e4c8dbc1417f9..0ada31b7e5d509409d5d0fb9ac2949f79416ef73 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1080,6 +1080,11 @@ public class PlayerConnection implements PacketListenerPlayIn { - } +@@ -1098,6 +1098,11 @@ public class PlayerConnection implements PacketListenerPlayIn { this.player.move(EnumMoveType.PLAYER, new Vec3D(d7, d8, d9)); + this.player.c(packetplayinflying.b()); // CraftBukkit - SPIGOT-5810, SPIGOT-5835: reset by this.player.move + // Paper start - prevent position desync + if (this.teleportPos != null) { + return; // ... thanks Mojang for letting move calls teleport across dimensions. + } + // Paper end - prevent position desync - this.player.onGround = packetplayinflying.b(); double d12 = d8; + d7 = d4 - this.player.locX(); diff --git a/Spigot-Server-Patches/0513-Ensure-Entity-AABB-s-are-never-invalid.patch b/Spigot-Server-Patches/0513-Ensure-Entity-AABB-s-are-never-invalid.patch deleted file mode 100644 index ed3bac400..000000000 --- a/Spigot-Server-Patches/0513-Ensure-Entity-AABB-s-are-never-invalid.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sun, 10 May 2020 22:12:46 -0400 -Subject: [PATCH] Ensure Entity AABB's are never invalid - -If anything used setPositionRaw, it left potential for an AABB -to be left stale at their old location, which could cause massive -AABB boxes if movement ever then got called on the new position. - -This guarantees any time we set the entities position, we also -update their AABB. - -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index b176dc26d15065aebc91c75e8a96745f589c0b87..c81b9d814d50a026872d2711f76649c00d65888b 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -416,10 +416,11 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - - public void setPosition(double d0, double d1, double d2) { - this.setPositionRaw(d0, d1, d2); -- float f = this.size.width / 2.0F; -- float f1 = this.size.height; -- -- this.a(new AxisAlignedBB(d0 - (double) f, d1, d2 - (double) f, d0 + (double) f, d1 + (double) f1, d2 + (double) f)); -+ // Paper start - move into setPositionRaw -+ //float f = this.size.width / 2.0F; -+ //float f1 = this.size.height; -+ //this.a(new AxisAlignedBB(d0 - (double) f, d1, d2 - (double) f, d0 + (double) f, d1 + (double) f1, d2 + (double) f)); -+ // Paper end - if (valid) ((WorldServer) world).chunkCheck(this); // CraftBukkit - } - -@@ -2981,6 +2982,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - return new AxisAlignedBB(vec3d, vec3d1); - } - -+ public final void setBoundingBox(AxisAlignedBB axisalignedbb) { a(axisalignedbb); } // Paper - OBFHELPER - public void a(AxisAlignedBB axisalignedbb) { - // CraftBukkit start - block invalid bounding boxes - double minX = axisalignedbb.minX, -@@ -3439,6 +3441,14 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - } - - public void setPositionRaw(double d0, double d1, double d2) { -+ // Paper start - never allow AABB to become desynced from position -+ // hanging has its own special logic -+ if (!(this instanceof EntityHanging) && (locX != d0 || locY != d1 || locZ != d2)) { -+ float f = this.size.width / 2.0F; -+ float f1 = this.size.height; -+ this.setBoundingBox(new AxisAlignedBB(d0 - (double) f, d1, d2 - (double) f, d0 + (double) f, d1 + (double) f1, d2 + (double) f)); -+ } -+ // Paper end - this.locX = d0; - this.locY = d1; - this.locZ = d2; diff --git a/Spigot-Server-Patches/0513-Fix-enderdragon-exp-dupe.patch b/Spigot-Server-Patches/0513-Fix-enderdragon-exp-dupe.patch new file mode 100644 index 000000000..654d69e3c --- /dev/null +++ b/Spigot-Server-Patches/0513-Fix-enderdragon-exp-dupe.patch @@ -0,0 +1,28 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Spottedleaf +Date: Fri, 12 Jun 2020 22:25:11 -0700 +Subject: [PATCH] Fix enderdragon exp dupe + +Properly track death stage when unloading/loading in the +dragon + +diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java +index 73e9859e675902d9fc5942547966b52426a496a2..63a759cc18b5b765bc9d34f71dd775fd35dee280 100644 +--- a/src/main/java/net/minecraft/server/EntityEnderDragon.java ++++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java +@@ -830,6 +830,7 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster { + public void saveData(NBTTagCompound nbttagcompound) { + super.saveData(nbttagcompound); + nbttagcompound.setInt("DragonPhase", this.bN.a().getControllerPhase().b()); ++ nbttagcompound.setInt("Paper.DeathTick", this.deathAnimationTicks); // Paper + } + + @Override +@@ -838,6 +839,7 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster { + if (nbttagcompound.hasKey("DragonPhase")) { + this.bN.setControllerPhase(DragonControllerPhase.getById(nbttagcompound.getInt("DragonPhase"))); + } ++ this.deathAnimationTicks = nbttagcompound.getInt("Paper.DeathTick"); // Paper + + } + diff --git a/Spigot-Server-Patches/0545-Inventory-getHolder-method-without-block-snapshot.patch b/Spigot-Server-Patches/0514-Inventory-getHolder-method-without-block-snapshot.patch similarity index 92% rename from Spigot-Server-Patches/0545-Inventory-getHolder-method-without-block-snapshot.patch rename to Spigot-Server-Patches/0514-Inventory-getHolder-method-without-block-snapshot.patch index 24e430cfb..5ea9d7c29 100644 --- a/Spigot-Server-Patches/0545-Inventory-getHolder-method-without-block-snapshot.patch +++ b/Spigot-Server-Patches/0514-Inventory-getHolder-method-without-block-snapshot.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Inventory getHolder method without block snapshot diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java -index 47827fbf1b80f88ffff8a252df10d70758c68703..57858327a4909fe536724371ac25f1cdede8c885 100644 +index a04213325b8266623b076f1233539512a0a0207f..726631348243566654d08abe9b5bf4ab3a2885f9 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java -@@ -519,6 +519,13 @@ public class CraftInventory implements Inventory { +@@ -521,6 +521,13 @@ public class CraftInventory implements Inventory { return inventory.getOwner(); } diff --git a/Spigot-Server-Patches/0546-Expose-Arrow-getItemStack.patch b/Spigot-Server-Patches/0515-Expose-Arrow-getItemStack.patch similarity index 83% rename from Spigot-Server-Patches/0546-Expose-Arrow-getItemStack.patch rename to Spigot-Server-Patches/0515-Expose-Arrow-getItemStack.patch index 2c0aea35c..36652f251 100644 --- a/Spigot-Server-Patches/0546-Expose-Arrow-getItemStack.patch +++ b/Spigot-Server-Patches/0515-Expose-Arrow-getItemStack.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Expose Arrow getItemStack diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java -index 9c97edf9c9e9a8cdf029264f6b563090142c686b..e66f6b30069af5b9031c7c78a2bb3d3a645034c0 100644 +index c552962a9a2c8dac6794ef6698943c7d91ea45c4..6195a45e30d9a9d76e24fbc2493020917a8b87b9 100644 --- a/src/main/java/net/minecraft/server/EntityArrow.java +++ b/src/main/java/net/minecraft/server/EntityArrow.java -@@ -556,6 +556,8 @@ public abstract class EntityArrow extends Entity implements IProjectile { +@@ -520,6 +520,8 @@ public abstract class EntityArrow extends IProjectile { } } @@ -18,7 +18,7 @@ index 9c97edf9c9e9a8cdf029264f6b563090142c686b..e66f6b30069af5b9031c7c78a2bb3d3a @Override diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java -index 29d23db4121bf8cbd98b4d7acce90b13790df245..2e4765ba14c591f995f6ab0a6e3a16158c7ca308 100644 +index cf40d62492dc207815487d6f64e7d11892adc09b..5a0a78d7edead8712090dfb9c53ff904abf5b118 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java @@ -102,6 +102,13 @@ public class CraftArrow extends AbstractProjectile implements AbstractArrow { diff --git a/Spigot-Server-Patches/0547-Add-and-implement-PlayerRecipeBookClickEvent.patch b/Spigot-Server-Patches/0516-Add-and-implement-PlayerRecipeBookClickEvent.patch similarity index 92% rename from Spigot-Server-Patches/0547-Add-and-implement-PlayerRecipeBookClickEvent.patch rename to Spigot-Server-Patches/0516-Add-and-implement-PlayerRecipeBookClickEvent.patch index 13f7bfcdf..5d59af97c 100644 --- a/Spigot-Server-Patches/0547-Add-and-implement-PlayerRecipeBookClickEvent.patch +++ b/Spigot-Server-Patches/0516-Add-and-implement-PlayerRecipeBookClickEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add and implement PlayerRecipeBookClickEvent diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 2109afc8ca0af636be2d7e7c041e3160448f4a38..10e3bf60f13fbc8e26071bcfe8d19cbb635662a9 100644 +index 0ada31b7e5d509409d5d0fb9ac2949f79416ef73..a3a7ee9b69e926e0181301c2714cfe72c50a8599 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -2476,9 +2476,15 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -2516,9 +2516,15 @@ public class PlayerConnection implements PacketListenerPlayIn { PlayerConnectionUtils.ensureMainThread(packetplayinautorecipe, this, this.player.getWorldServer()); this.player.resetIdleTimer(); if (!this.player.isSpectator() && this.player.activeContainer.windowId == packetplayinautorecipe.b() && this.player.activeContainer.c(this.player) && this.player.activeContainer instanceof ContainerRecipeBook) { diff --git a/Spigot-Server-Patches/0516-Optimize-WorldBorder-collision-checks-and-air.patch b/Spigot-Server-Patches/0516-Optimize-WorldBorder-collision-checks-and-air.patch deleted file mode 100644 index 25658a705..000000000 --- a/Spigot-Server-Patches/0516-Optimize-WorldBorder-collision-checks-and-air.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Spottedleaf -Date: Sun, 10 May 2020 22:49:05 -0400 -Subject: [PATCH] Optimize WorldBorder collision checks and air - - -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index c81b9d814d50a026872d2711f76649c00d65888b..e0ab058bf947ea10b37eadf6122292e708bd3809 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -845,7 +845,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - AxisAlignedBB axisalignedbb = this.getBoundingBox(); - VoxelShapeCollision voxelshapecollision = VoxelShapeCollision.a(this); - VoxelShape voxelshape = this.world.getWorldBorder().a(); -- Stream stream = VoxelShapes.c(voxelshape, VoxelShapes.a(axisalignedbb.shrink(1.0E-7D)), OperatorBoolean.AND) ? Stream.empty() : Stream.of(voxelshape); -+ Stream stream = !this.world.getWorldBorder().isInBounds(axisalignedbb) ? Stream.empty() : Stream.of(this.world.getWorldBorder().a()); // Paper - Stream stream1 = this.world.b(this, axisalignedbb.a(vec3d), (Set) ImmutableSet.of()); - StreamAccumulator streamaccumulator = new StreamAccumulator<>(Stream.concat(stream1, stream)); - Vec3D vec3d1 = vec3d.g() == 0.0D ? vec3d : a(this, vec3d, axisalignedbb, this.world, voxelshapecollision, streamaccumulator); -diff --git a/src/main/java/net/minecraft/server/ICollisionAccess.java b/src/main/java/net/minecraft/server/ICollisionAccess.java -index 5a21205a49606b294de4cd27b60438c6a5b3c526..63dd5e98b6af1d9a9fa9d01621ce5bc33c0d7502 100644 ---- a/src/main/java/net/minecraft/server/ICollisionAccess.java -+++ b/src/main/java/net/minecraft/server/ICollisionAccess.java -@@ -95,12 +95,12 @@ public interface ICollisionAccess extends IBlockAccess { - if (true) { //public boolean tryAdvance(Consumer consumer) {*/ // Paper - if (entity != null) { - // Paper end -- VoxelShape voxelshape1 = ICollisionAccess.this.getWorldBorder().a(); -- boolean flag = VoxelShapes.c(voxelshape1, VoxelShapes.a(entity.getBoundingBox().shrink(1.0E-7D)), OperatorBoolean.AND); -- boolean flag1 = VoxelShapes.c(voxelshape1, VoxelShapes.a(entity.getBoundingBox().g(1.0E-7D)), OperatorBoolean.AND); -+ //VoxelShape voxelshape1 = ICollisionAccess.this.getWorldBorder().a(); // Paper - only make if collides -+ boolean flag = !ICollisionAccess.this.getWorldBorder().isInBounds(entity.getBoundingBox().shrink(1.0E-7D)); // Paper -+ boolean flag1 = !ICollisionAccess.this.getWorldBorder().isInBounds(entity.getBoundingBox().g(1.0E-7D)); // Paper - - if (!flag && flag1) { -- collisions.add(voxelshape1);// Paper -+ collisions.add(ICollisionAccess.this.getWorldBorder().a());// Paper - if (returnFast) return collisions; - } - } -@@ -133,7 +133,7 @@ public interface ICollisionAccess extends IBlockAccess { - //IBlockData iblockdata = iblockaccess.getType(blockposition_mutableblockposition); // moved up - // Paper end - -- if ((j2 != 1 || iblockdata.f()) && (j2 != 2 || iblockdata.getBlock() == Blocks.MOVING_PISTON)) { -+ if (!iblockdata.isAir() && (j2 != 1 || iblockdata.f()) && (j2 != 2 || iblockdata.getBlock() == Blocks.MOVING_PISTON)) { // Paper - fast track air - VoxelShape voxelshape2 = iblockdata.b((IBlockAccess) ICollisionAccess.this, blockposition_mutableblockposition, voxelshapecollision); - - // Paper start - Lithium Collision Optimizations -diff --git a/src/main/java/net/minecraft/server/WorldBorder.java b/src/main/java/net/minecraft/server/WorldBorder.java -index 4c20db5a3f9e159997a9851691aca421241d6d95..535d08ffb1d20570b19307c8619cfd39b4541356 100644 ---- a/src/main/java/net/minecraft/server/WorldBorder.java -+++ b/src/main/java/net/minecraft/server/WorldBorder.java -@@ -40,6 +40,7 @@ public class WorldBorder { - return (double) chunkcoordintpair.f() > this.c() && (double) chunkcoordintpair.d() < this.e() && (double) chunkcoordintpair.g() > this.d() && (double) chunkcoordintpair.e() < this.f(); - } - -+ public final boolean isInBounds(AxisAlignedBB aabb) { return this.a(aabb); } // Paper - OBFHELPER - public boolean a(AxisAlignedBB axisalignedbb) { - return axisalignedbb.maxX > this.c() && axisalignedbb.minX < this.e() && axisalignedbb.maxZ > this.d() && axisalignedbb.minZ < this.f(); - } diff --git a/Spigot-Server-Patches/0548-Add-PrepareGrindstoneEvent.patch b/Spigot-Server-Patches/0517-Add-PrepareGrindstoneEvent.patch similarity index 93% rename from Spigot-Server-Patches/0548-Add-PrepareGrindstoneEvent.patch rename to Spigot-Server-Patches/0517-Add-PrepareGrindstoneEvent.patch index f0a00ab8e..a6c0e1687 100644 --- a/Spigot-Server-Patches/0548-Add-PrepareGrindstoneEvent.patch +++ b/Spigot-Server-Patches/0517-Add-PrepareGrindstoneEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add PrepareGrindstoneEvent diff --git a/src/main/java/net/minecraft/server/ContainerGrindstone.java b/src/main/java/net/minecraft/server/ContainerGrindstone.java -index ed88e208d00f3b19b5c5916cf87513ab511a5fb1..83cb0cd64c81eb35fa49eecff93b40f08e0a5606 100644 +index fe9a083b724a8657cac8462b3f44d3cc12a4db58..716304021f85a86a2f9492f5fb98e86bb7f089d2 100644 --- a/src/main/java/net/minecraft/server/ContainerGrindstone.java +++ b/src/main/java/net/minecraft/server/ContainerGrindstone.java @@ -10,6 +10,10 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryGrindstone; diff --git a/Spigot-Server-Patches/0518-Hide-sync-chunk-writes-behind-flag.patch b/Spigot-Server-Patches/0518-Hide-sync-chunk-writes-behind-flag.patch new file mode 100644 index 000000000..143846f23 --- /dev/null +++ b/Spigot-Server-Patches/0518-Hide-sync-chunk-writes-behind-flag.patch @@ -0,0 +1,23 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Spottedleaf +Date: Fri, 26 Jun 2020 22:35:08 -0700 +Subject: [PATCH] Hide sync chunk writes behind flag + +Syncing writes on each write call has terrible performance +on harddrives. + +-DPaper.enable-sync-chunk-writes=true to enable + +diff --git a/src/main/java/net/minecraft/server/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/DedicatedServerProperties.java +index 1122861a8f9c12668e7bd9d65e63fc9166a66d1a..6786fd0947724069366a2375c710ec518a92f2b1 100644 +--- a/src/main/java/net/minecraft/server/DedicatedServerProperties.java ++++ b/src/main/java/net/minecraft/server/DedicatedServerProperties.java +@@ -98,7 +98,7 @@ public class DedicatedServerProperties extends PropertyManager { + return MathHelper.clamp(integer, 1, 29999984); + }, 29999984); +- this.syncChunkWrites = this.getBoolean("sync-chunk-writes", true); ++ this.syncChunkWrites = this.getBoolean("sync-chunk-writes", true) && Boolean.getBoolean("Paper.enable-sync-chunk-writes"); // Paper - hide behind flag + this.enableJmxMonitoring = this.getBoolean("enable-jmx-monitoring", false); + this.enableStatus = this.getBoolean("enable-status", true); + this.entityBroadcastRangePercentage = this.a("entity-broadcast-range-percentage", (integer) -> { diff --git a/Spigot-Server-Patches/0311-Limit-lightning-strike-effect-distance.patch b/Spigot-Server-Patches/0519-Limit-lightning-strike-effect-distance.patch similarity index 64% rename from Spigot-Server-Patches/0311-Limit-lightning-strike-effect-distance.patch rename to Spigot-Server-Patches/0519-Limit-lightning-strike-effect-distance.patch index 417f5f643..5735d85dd 100644 --- a/Spigot-Server-Patches/0311-Limit-lightning-strike-effect-distance.patch +++ b/Spigot-Server-Patches/0519-Limit-lightning-strike-effect-distance.patch @@ -5,13 +5,14 @@ Subject: [PATCH] Limit lightning strike effect distance diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 487b0d5cd608e84a793eba5fdbd50a9f3d95c79b..b8789c8ecc5a6e4117bb7ce0d5487a6e5774b67f 100644 +index 6e6534ab25dbebbad5d2ee848edb88ebcae86d03..e471e764935e2a89560de56959a782b02e5e8fe1 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -@@ -242,6 +242,28 @@ public class PaperWorldConfig { +@@ -643,4 +643,26 @@ public class PaperWorldConfig { + delayChunkUnloadsBy *= 20; } } - ++ + public double sqrMaxThunderDistance; + public double sqrMaxLightningImpactSoundDistance; + public double maxLightningFlashDistance; @@ -33,22 +34,19 @@ index 487b0d5cd608e84a793eba5fdbd50a9f3d95c79b..b8789c8ecc5a6e4117bb7ce0d5487a6e + maxLightningFlashDistance = 512; // Vanilla value + } + } -+ - public int fixedInhabitedTime; - private void fixedInhabitedTime() { - if (PaperConfig.version < 16) { + } diff --git a/src/main/java/net/minecraft/server/EntityLightning.java b/src/main/java/net/minecraft/server/EntityLightning.java -index 7c518983a9c21a9b221e1fa1b0baa3d5c9ccadbf..bdb534deb47a945d5cbfad688eeab5e3388a4df5 100644 +index 6f979e5f1f1567b140e9689298aff85de34f7413..b1b8748fa95aab25562c2f5397cb6454737fa508 100644 --- a/src/main/java/net/minecraft/server/EntityLightning.java +++ b/src/main/java/net/minecraft/server/EntityLightning.java -@@ -64,6 +64,17 @@ public class EntityLightning extends Entity { +@@ -56,6 +56,17 @@ public class EntityLightning extends Entity { double deltaX = this.locX() - player.locX(); double deltaZ = this.locZ() - player.locZ(); double distanceSquared = deltaX * deltaX + deltaZ * deltaZ; + // Paper start - Limit lightning strike effect distance + if (distanceSquared <= this.world.paperConfig.sqrMaxLightningImpactSoundDistance) { + player.playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect(SoundEffects.ENTITY_LIGHTNING_BOLT_IMPACT, -+ SoundCategory.WEATHER, this.locX(), this.locY(), this.locZ(), 2.0f, 0.5F + this.random.nextFloat() * 0.2F)); ++ SoundCategory.WEATHER, this.locX(), this.locY(), this.locZ(), 2.0f, 0.5F + this.random.nextFloat() * 0.2F)); + } + + if (world.paperConfig.sqrMaxThunderDistance != -1 && distanceSquared >= world.paperConfig.sqrMaxThunderDistance) { @@ -59,25 +57,12 @@ index 7c518983a9c21a9b221e1fa1b0baa3d5c9ccadbf..bdb534deb47a945d5cbfad688eeab5e3 if (distanceSquared > viewDistance * viewDistance) { double deltaLength = Math.sqrt(distanceSquared); double relativeX = player.locX() + (deltaX / deltaLength) * viewDistance; -@@ -74,7 +85,7 @@ public class EntityLightning extends Entity { +@@ -66,7 +77,7 @@ public class EntityLightning extends Entity { } } // CraftBukkit end - this.world.playSound((EntityHuman) null, this.locX(), this.locY(), this.locZ(), SoundEffects.ENTITY_LIGHTNING_BOLT_IMPACT, SoundCategory.WEATHER, 2.0F, 0.5F + this.random.nextFloat() * 0.2F); -+ //this.world.playSound((EntityHuman) null, this.locX(), this.locY(), this.locZ(), SoundEffects.ENTITY_LIGHTNING_BOLT_IMPACT, SoundCategory.WEATHER, 2.0F, 0.5F + this.random.nextFloat() * 0.2F); // Paper - Limit lightning strike effect distance (the packet is now sent from inside the loop) ++// this.world.playSound((EntityHuman) null, this.locX(), this.locY(), this.locZ(), SoundEffects.ENTITY_LIGHTNING_BOLT_IMPACT, SoundCategory.WEATHER, 2.0F, 0.5F + this.random.nextFloat() * 0.2F); // Paper - Limit lightning strike effect distance (the packet is now sent from inside the loop) } --this.lifeTicks; -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 6e878c9b9dee511812df5ea2491d953f677c3f58..271a1ef3d0aae7c1d0b373963504e70f2843cd24 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1276,7 +1276,7 @@ public class WorldServer extends World { - } - // CraftBukkit end - this.globalEntityList.add(entitylightning); -- this.server.getPlayerList().sendPacketNearby((EntityHuman) null, entitylightning.locX(), entitylightning.locY(), entitylightning.locZ(), 512.0D, this, new PacketPlayOutSpawnEntityWeather(entitylightning)); // Paper - use world instead of dimension -+ this.server.getPlayerList().sendPacketNearby((EntityHuman) null, entitylightning.locX(), entitylightning.locY(), entitylightning.locZ(), paperConfig.maxLightningFlashDistance, this, new PacketPlayOutSpawnEntityWeather(entitylightning)); // Paper - use world instead of dimension, limit lightning strike effect distance - } - - @Override diff --git a/Spigot-Server-Patches/0524-Add-permission-for-command-blocks.patch b/Spigot-Server-Patches/0520-Add-permission-for-command-blocks.patch similarity index 85% rename from Spigot-Server-Patches/0524-Add-permission-for-command-blocks.patch rename to Spigot-Server-Patches/0520-Add-permission-for-command-blocks.patch index 0a39da8a7..27f5b2035 100644 --- a/Spigot-Server-Patches/0524-Add-permission-for-command-blocks.patch +++ b/Spigot-Server-Patches/0520-Add-permission-for-command-blocks.patch @@ -5,58 +5,58 @@ Subject: [PATCH] Add permission for command blocks diff --git a/src/main/java/net/minecraft/server/BlockCommand.java b/src/main/java/net/minecraft/server/BlockCommand.java -index d0f75c8f93d3ceb1ee358baeb51f64e7e575bbc0..48cc48bd999c02268fa3270401c0df77a327ab13 100644 +index dd7066d1a72f5c6f54c1f40a7b694deb827410dc..6b353a99c04e0312f520f8559c05ddaf51c26aaf 100644 --- a/src/main/java/net/minecraft/server/BlockCommand.java +++ b/src/main/java/net/minecraft/server/BlockCommand.java -@@ -110,7 +110,7 @@ public class BlockCommand extends BlockTileEntity { +@@ -105,7 +105,7 @@ public class BlockCommand extends BlockTileEntity { public EnumInteractionResult interact(IBlockData iblockdata, World world, BlockPosition blockposition, EntityHuman entityhuman, EnumHand enumhand, MovingObjectPositionBlock movingobjectpositionblock) { TileEntity tileentity = world.getTileEntity(blockposition); - if (tileentity instanceof TileEntityCommand && entityhuman.isCreativeAndOp()) { + if (tileentity instanceof TileEntityCommand && (entityhuman.isCreativeAndOp() || (entityhuman.isCreative() && entityhuman.getBukkitEntity().hasPermission("minecraft.commandblock")))) { // Paper - command block permission entityhuman.a((TileEntityCommand) tileentity); - return EnumInteractionResult.SUCCESS; + return EnumInteractionResult.a(world.isClientSide); } else { diff --git a/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java b/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java -index ef2a496eda45ae5ee8fe52ef09e77c2906069d2e..6a0d70033b4eec384795b5cccd76bce2265ffbfc 100644 +index 7e13b1cf6d92c3e0f2dab1ba1d42bd4f250e256c..3820acd65f3cd488dba964e6d9c458852570f4a0 100644 --- a/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java +++ b/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java -@@ -178,7 +178,7 @@ public abstract class CommandBlockListenerAbstract implements ICommandListener { +@@ -179,7 +179,7 @@ public abstract class CommandBlockListenerAbstract implements ICommandListener { } - public boolean a(EntityHuman entityhuman) { + public EnumInteractionResult a(EntityHuman entityhuman) { - if (!entityhuman.isCreativeAndOp()) { + if (!entityhuman.isCreativeAndOp() && !entityhuman.isCreative() && !entityhuman.getBukkitEntity().hasPermission("minecraft.commandblock")) { // Paper - command block permission - return false; + return EnumInteractionResult.PASS; } else { if (entityhuman.getWorld().isClientSide) { diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 1f9d231fb93e30286205f7a0a4c898a0e153bd95..d52fbda79fe1c52d3ddb53c0f1c1f521d7620702 100644 +index a3a7ee9b69e926e0181301c2714cfe72c50a8599..4a99a05ef2d01383553e59833a8723f5364168ed 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -612,7 +612,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -613,7 +613,7 @@ public class PlayerConnection implements PacketListenerPlayIn { PlayerConnectionUtils.ensureMainThread(packetplayinsetcommandblock, this, this.player.getWorldServer()); if (!this.minecraftServer.getEnableCommandBlock()) { - this.player.sendMessage(new ChatMessage("advMode.notEnabled", new Object[0])); + this.player.sendMessage(new ChatMessage("advMode.notEnabled"), SystemUtils.b); - } else if (!this.player.isCreativeAndOp()) { + } else if (!this.player.isCreativeAndOp() && !this.player.isCreative() && !this.player.getBukkitEntity().hasPermission("minecraft.commandblock")) { // Paper - command block permission - this.player.sendMessage(new ChatMessage("advMode.notAllowed", new Object[0])); + this.player.sendMessage(new ChatMessage("advMode.notAllowed"), SystemUtils.b); } else { CommandBlockListenerAbstract commandblocklistenerabstract = null; -@@ -675,7 +675,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -676,7 +676,7 @@ public class PlayerConnection implements PacketListenerPlayIn { PlayerConnectionUtils.ensureMainThread(packetplayinsetcommandminecart, this, this.player.getWorldServer()); if (!this.minecraftServer.getEnableCommandBlock()) { - this.player.sendMessage(new ChatMessage("advMode.notEnabled", new Object[0])); + this.player.sendMessage(new ChatMessage("advMode.notEnabled"), SystemUtils.b); - } else if (!this.player.isCreativeAndOp()) { + } else if (!this.player.isCreativeAndOp() && !this.player.isCreative() && !this.player.getBukkitEntity().hasPermission("minecraft.commandblock")) { // Paper - command block permission - this.player.sendMessage(new ChatMessage("advMode.notAllowed", new Object[0])); + this.player.sendMessage(new ChatMessage("advMode.notAllowed"), SystemUtils.b); } else { CommandBlockListenerAbstract commandblocklistenerabstract = packetplayinsetcommandminecart.a(this.player.world); diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java -index f11ef84df85c1e7ada9c62247b7882f19ae32089..6df8434612d4afe411b2c435f4c847b9183570f8 100644 +index 734855c1db3215d90b2743988f64af68aacb388e..6d192b27440ddfd34555005dafefbce6bbb67236 100644 --- a/src/main/java/net/minecraft/server/PlayerInteractManager.java +++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java -@@ -350,7 +350,7 @@ public class PlayerInteractManager { +@@ -353,7 +353,7 @@ public class PlayerInteractManager { TileEntity tileentity = this.world.getTileEntity(blockposition); Block block = iblockdata.getBlock(); diff --git a/Spigot-Server-Patches/0521-Ensure-Entity-AABB-s-are-never-invalid.patch b/Spigot-Server-Patches/0521-Ensure-Entity-AABB-s-are-never-invalid.patch new file mode 100644 index 000000000..0578d2561 --- /dev/null +++ b/Spigot-Server-Patches/0521-Ensure-Entity-AABB-s-are-never-invalid.patch @@ -0,0 +1,129 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Sun, 10 May 2020 22:12:46 -0400 +Subject: [PATCH] Ensure Entity AABB's are never invalid + + +diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +index 3bbacebc3397f2c1d695f64bf3f4eb2b89b112b6..e5edd801c57e6f678c661193814ce9de07f83b95 100644 +--- a/src/main/java/net/minecraft/server/Entity.java ++++ b/src/main/java/net/minecraft/server/Entity.java +@@ -1,53 +1,54 @@ + package net.minecraft.server; + ++import co.aikar.timings.MinecraftTimings; ++import co.aikar.timings.Timing; + import com.google.common.collect.Iterables; + import com.google.common.collect.Lists; + import com.google.common.collect.Sets; + import it.unimi.dsi.fastutil.objects.Object2DoubleArrayMap; + import it.unimi.dsi.fastutil.objects.Object2DoubleMap; +-import java.util.Arrays; +-import java.util.Collection; +-import java.util.Collections; +-import java.util.Iterator; +-import java.util.List; +-import java.util.Locale; +-import java.util.Optional; +-import java.util.Random; +-import java.util.Set; +-import java.util.UUID; +-import java.util.concurrent.atomic.AtomicInteger; +-import java.util.stream.Stream; +-import javax.annotation.Nullable; + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; +- +-// CraftBukkit start + import org.bukkit.Bukkit; + import org.bukkit.Server; + import org.bukkit.block.BlockFace; + import org.bukkit.command.CommandSender; +-import org.bukkit.entity.Hanging; +-import org.bukkit.entity.LivingEntity; +-import org.bukkit.entity.Vehicle; +-import co.aikar.timings.MinecraftTimings; // Paper +-import co.aikar.timings.Timing; // Paper +-import org.bukkit.event.entity.EntityCombustByEntityEvent; +-import org.bukkit.event.hanging.HangingBreakByEntityEvent; +-import org.bukkit.event.vehicle.VehicleBlockCollisionEvent; +-import org.bukkit.event.vehicle.VehicleEnterEvent; +-import org.bukkit.event.vehicle.VehicleExitEvent; + import org.bukkit.craftbukkit.CraftWorld; + import org.bukkit.craftbukkit.entity.CraftEntity; + import org.bukkit.craftbukkit.entity.CraftPlayer; + import org.bukkit.craftbukkit.event.CraftEventFactory; ++import org.bukkit.entity.Hanging; ++import org.bukkit.entity.LivingEntity; + import org.bukkit.entity.Pose; ++import org.bukkit.entity.Vehicle; + import org.bukkit.event.entity.EntityAirChangeEvent; ++import org.bukkit.event.entity.EntityCombustByEntityEvent; + import org.bukkit.event.entity.EntityCombustEvent; + import org.bukkit.event.entity.EntityDropItemEvent; + import org.bukkit.event.entity.EntityPortalEvent; + import org.bukkit.event.entity.EntityPoseChangeEvent; ++import org.bukkit.event.hanging.HangingBreakByEntityEvent; + import org.bukkit.event.player.PlayerTeleportEvent; ++import org.bukkit.event.vehicle.VehicleBlockCollisionEvent; ++import org.bukkit.event.vehicle.VehicleEnterEvent; ++import org.bukkit.event.vehicle.VehicleExitEvent; + import org.bukkit.plugin.PluginManager; ++ ++import javax.annotation.Nullable; ++import java.util.Arrays; ++import java.util.Collection; ++import java.util.Collections; ++import java.util.Iterator; ++import java.util.List; ++import java.util.Locale; ++import java.util.Optional; ++import java.util.Random; ++import java.util.Set; ++import java.util.UUID; ++import java.util.concurrent.atomic.AtomicInteger; ++import java.util.stream.Stream; ++ ++// CraftBukkit start + // CraftBukkit end + + public abstract class Entity implements INamableTileEntity, ICommandListener, KeyedObject { // Paper +@@ -425,10 +426,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke + + public void setPosition(double d0, double d1, double d2) { + this.setPositionRaw(d0, d1, d2); +- float f = this.size.width / 2.0F; +- float f1 = this.size.height; ++ // Paper start - move into setPositionRaw ++ //float f = this.size.width / 2.0F; ++ //float f1 = this.size.height; + +- this.a(new AxisAlignedBB(d0 - (double) f, d1, d2 - (double) f, d0 + (double) f, d1 + (double) f1, d2 + (double) f)); ++ //this.a(new AxisAlignedBB(d0 - (double) f, d1, d2 - (double) f, d0 + (double) f, d1 + (double) f1, d2 + (double) f)); ++ // Paper end + if (valid) ((WorldServer) world).chunkCheck(this); // CraftBukkit + } + +@@ -2907,6 +2910,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke + return new AxisAlignedBB(vec3d, vec3d1); + } + ++ public final void setBoundingBox(AxisAlignedBB axisalignedbb) { a(axisalignedbb); } // Paper - OBFHELPER + public void a(AxisAlignedBB axisalignedbb) { + // CraftBukkit start - block invalid bounding boxes + double minX = axisalignedbb.minX, +@@ -3345,6 +3349,14 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke + } + + public void setPositionRaw(double d0, double d1, double d2) { ++ // Paper start - never allow AABB to become desynced from position ++ // hanging has its own special logic ++ if (!(this instanceof EntityHanging) && (this.loc.x != d0 || this.loc.y != d1 || this.loc.z != d2)) { ++ float f = this.size.width / 2.0F; ++ float f1 = this.size.height; ++ this.setBoundingBox(new AxisAlignedBB(d0 - (double) f, d1, d2 - (double) f, d0 + (double) f, d1 + (double) f1, d2 + (double) f)); ++ } ++ // Paper end + if (this.loc.x != d0 || this.loc.y != d1 || this.loc.z != d2) { + this.loc = new Vec3D(d0, d1, d2); + int i = MathHelper.floor(d0); diff --git a/Spigot-Server-Patches/0522-Optimize-WorldBorder-collision-checks-and-air.patch b/Spigot-Server-Patches/0522-Optimize-WorldBorder-collision-checks-and-air.patch new file mode 100644 index 000000000..58d0c56ce --- /dev/null +++ b/Spigot-Server-Patches/0522-Optimize-WorldBorder-collision-checks-and-air.patch @@ -0,0 +1,63 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Spottedleaf +Date: Sun, 10 May 2020 22:49:05 -0400 +Subject: [PATCH] Optimize WorldBorder collision checks and air + + +diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +index e5edd801c57e6f678c661193814ce9de07f83b95..fcb3d3adae52fd70e856344a727a344cf78cfce3 100644 +--- a/src/main/java/net/minecraft/server/Entity.java ++++ b/src/main/java/net/minecraft/server/Entity.java +@@ -854,7 +854,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke + AxisAlignedBB axisalignedbb = this.getBoundingBox(); + VoxelShapeCollision voxelshapecollision = VoxelShapeCollision.a(this); + VoxelShape voxelshape = this.world.getWorldBorder().c(); +- Stream stream = VoxelShapes.c(voxelshape, VoxelShapes.a(axisalignedbb.shrink(1.0E-7D)), OperatorBoolean.AND) ? Stream.empty() : Stream.of(voxelshape); ++ Stream stream = !this.world.getWorldBorder().isInBounds(axisalignedbb) ? Stream.empty() : Stream.of(voxelshape); // Paper + Stream stream1 = this.world.c(this, axisalignedbb.b(vec3d), (entity) -> { + return true; + }); +diff --git a/src/main/java/net/minecraft/server/VoxelShapeSpliterator.java b/src/main/java/net/minecraft/server/VoxelShapeSpliterator.java +index ed0f3ddbcb7d6ce8a59ae3829f4cb11ae75046cb..e841611bb7c36dffec44bb9e74a0a9657a113263 100644 +--- a/src/main/java/net/minecraft/server/VoxelShapeSpliterator.java ++++ b/src/main/java/net/minecraft/server/VoxelShapeSpliterator.java +@@ -128,10 +128,10 @@ public class VoxelShapeSpliterator extends AbstractSpliterator { + AxisAlignedBB axisalignedbb = this.a.getBoundingBox(); + + if (!a(worldborder, axisalignedbb)) { +- VoxelShape voxelshape = worldborder.c(); +- +- if (!b(voxelshape, axisalignedbb) && a(voxelshape, axisalignedbb)) { +- consumer.accept(voxelshape); ++ // Paper start ++ if (worldborder.isInBounds(axisalignedbb.shrink(1.0E-7D)) && !worldborder.isInBounds(axisalignedbb.grow(1.0E-7D))) { ++ consumer.accept(worldborder.asVoxelShape()); ++ // Paper end + return true; + } + } +diff --git a/src/main/java/net/minecraft/server/VoxelShapes.java b/src/main/java/net/minecraft/server/VoxelShapes.java +index aeee4f11828e54ff9e873e452e19299822b1ec86..1fa7061f7adb539b6786fa11a0090f2c188ba9f2 100644 +--- a/src/main/java/net/minecraft/server/VoxelShapes.java ++++ b/src/main/java/net/minecraft/server/VoxelShapes.java +@@ -242,7 +242,7 @@ public final class VoxelShapes { + IBlockData iblockdata = iworldreader.getTypeIfLoaded(blockposition_mutableblockposition); // Paper + if (iblockdata == null) return 0.0D; // Paper + +- if ((k2 != 1 || iblockdata.d()) && (k2 != 2 || iblockdata.a(Blocks.MOVING_PISTON))) { ++ if (!iblockdata.isAir() && (k2 != 1 || iblockdata.d()) && (k2 != 2 || iblockdata.a(Blocks.MOVING_PISTON))) { // Paper + d0 = iblockdata.b((IBlockAccess) iworldreader, blockposition_mutableblockposition, voxelshapecollision).a(enumdirection_enumaxis2, axisalignedbb.d((double) (-blockposition_mutableblockposition.getX()), (double) (-blockposition_mutableblockposition.getY()), (double) (-blockposition_mutableblockposition.getZ())), d0); + if (Math.abs(d0) < 1.0E-7D) { + return 0.0D; +diff --git a/src/main/java/net/minecraft/server/WorldBorder.java b/src/main/java/net/minecraft/server/WorldBorder.java +index 0ef92a320d132b443e76276b2c34a4626cf187db..b651eb87bb23deeb2a3f4a1c626ddde9b11a7b9e 100644 +--- a/src/main/java/net/minecraft/server/WorldBorder.java ++++ b/src/main/java/net/minecraft/server/WorldBorder.java +@@ -42,6 +42,7 @@ public class WorldBorder { + return (double) chunkcoordintpair.f() > this.e() && (double) chunkcoordintpair.d() < this.g() && (double) chunkcoordintpair.g() > this.f() && (double) chunkcoordintpair.e() < this.h(); + } + ++ public final boolean isInBounds(AxisAlignedBB aabb) { return this.a(aabb); } // Paper - OBFHELPER + public boolean a(AxisAlignedBB axisalignedbb) { + return axisalignedbb.maxX > this.e() && axisalignedbb.minX < this.g() && axisalignedbb.maxZ > this.f() && axisalignedbb.minZ < this.h(); + } diff --git a/Spigot-Server-Patches/0523-Fix-Per-World-Difficulty-Remembering-Difficulty.patch b/Spigot-Server-Patches/0523-Fix-Per-World-Difficulty-Remembering-Difficulty.patch new file mode 100644 index 000000000..c53afcca9 --- /dev/null +++ b/Spigot-Server-Patches/0523-Fix-Per-World-Difficulty-Remembering-Difficulty.patch @@ -0,0 +1,77 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Sun, 28 Jun 2020 03:59:10 -0400 +Subject: [PATCH] Fix Per World Difficulty / Remembering Difficulty + +Fixes per world difficulty with /difficulty command and also +makes it so that the server keeps the last difficulty used instead +of restoring the server.properties every single load. + +diff --git a/src/main/java/net/minecraft/server/CommandDifficulty.java b/src/main/java/net/minecraft/server/CommandDifficulty.java +index bc71070c670d1a64c60b9f19711a5e8a50ace56e..9efc743e028650ccc9cda5a2c9deb1836253b91d 100644 +--- a/src/main/java/net/minecraft/server/CommandDifficulty.java ++++ b/src/main/java/net/minecraft/server/CommandDifficulty.java +@@ -36,10 +36,11 @@ public class CommandDifficulty { + public static int a(CommandListenerWrapper commandlistenerwrapper, EnumDifficulty enumdifficulty) throws CommandSyntaxException { + MinecraftServer minecraftserver = commandlistenerwrapper.getServer(); + +- if (minecraftserver.getSaveData().getDifficulty() == enumdifficulty) { ++ WorldServer world = commandlistenerwrapper.getWorld(); // Paper ++ if (world.worldDataServer.getDifficulty() == enumdifficulty) { // Paper + throw CommandDifficulty.a.create(enumdifficulty.c()); + } else { +- minecraftserver.a(enumdifficulty, true); ++ minecraftserver.a(world, enumdifficulty, true); // Paper + commandlistenerwrapper.sendMessage(new ChatMessage("commands.difficulty.success", new Object[]{enumdifficulty.b()}), true); + return 0; + } +diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java +index 4c561181a977fd0244325880bb6a8cd6a54dcacc..8b2755a3b95e472e884976195d1d3551fc260e39 100644 +--- a/src/main/java/net/minecraft/server/DedicatedServer.java ++++ b/src/main/java/net/minecraft/server/DedicatedServer.java +@@ -327,7 +327,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer + + @Override + public void updateWorldSettings() { +- this.a(this.getDedicatedServerProperties().difficulty, true); ++ //this.a(this.getDedicatedServerProperties().difficulty, true); // Paper - Don't overwrite level.dat's difficulty, keep current + } + + @Override +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index 7c1c929819c450f853c91618b2853fcb424caa22..26f230a801bd8efa5f8b61dee53fe7b1435f906b 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -1519,11 +1519,14 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant +Date: Sun, 28 Jun 2020 19:27:20 -0400 +Subject: [PATCH] Paper dumpitem command + +Let's you quickly view the item in your hands NBT data + +diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java +index cc3fc5200f75f80a60b4cbc260e3a0bc4bb3a869..6bfcf86d44559849de66a24471e29d93217698bd 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperCommand.java ++++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java +@@ -21,7 +21,9 @@ import org.bukkit.command.CommandSender; + import org.bukkit.craftbukkit.CraftServer; + import org.bukkit.craftbukkit.CraftWorld; + import org.bukkit.craftbukkit.entity.CraftPlayer; ++import org.bukkit.craftbukkit.inventory.CraftItemStack; + import org.bukkit.entity.Player; ++import org.bukkit.inventory.ItemStack; + + import java.io.File; + import java.io.FileOutputStream; +@@ -37,14 +39,14 @@ public class PaperCommand extends Command { + public PaperCommand(String name) { + super(name); + this.description = "Paper related commands"; +- this.usageMessage = "/paper [heap | entity | reload | version | debug | dumpwaiting | chunkinfo | syncloadinfo | fixlight]"; ++ this.usageMessage = "/paper [heap | entity | reload | version | debug | dumpwaiting | chunkinfo | syncloadinfo | fixlight | dumpitem]"; + this.setPermission("bukkit.command.paper"); + } + + @Override + public List tabComplete(CommandSender sender, String alias, String[] args, Location location) throws IllegalArgumentException { + if (args.length <= 1) +- return getListMatchingLast(args, "heap", "entity", "reload", "version", "debug", "dumpwaiting", "chunkinfo", "syncloadinfo", "fixlight"); ++ return getListMatchingLast(args, "heap", "entity", "reload", "version", "debug", "dumpwaiting", "chunkinfo", "syncloadinfo", "fixlight", "dumpitem"); + + switch (args[0].toLowerCase(Locale.ENGLISH)) + { +@@ -133,6 +135,9 @@ public class PaperCommand extends Command { + case "reload": + doReload(sender); + break; ++ case "dumpitem": ++ doDumpItem(sender); ++ break; + case "debug": + doDebug(sender, args); + break; +@@ -164,6 +169,19 @@ public class PaperCommand extends Command { + return true; + } + ++ private void doDumpItem(CommandSender sender) { ++ ItemStack itemInHand = ((CraftPlayer) sender).getItemInHand(); ++ net.minecraft.server.ItemStack itemStack = CraftItemStack.asNMSCopy(itemInHand); ++ NBTTagCompound tag = itemStack.getTag(); ++ if (tag != null) { ++ String nbt = tag.toString(); ++ Bukkit.getConsoleSender().sendMessage(nbt); ++ sender.sendMessage(nbt); ++ } else { ++ sender.sendMessage("Item does not have NBT"); ++ } ++ } ++ + private void doFixLight(CommandSender sender, String[] args) { + if (!(sender instanceof Player)) { + sender.sendMessage("Only players can use this command"); diff --git a/Spigot-Server-Patches/0525-Don-t-allow-null-UUID-s-for-chat.patch b/Spigot-Server-Patches/0525-Don-t-allow-null-UUID-s-for-chat.patch new file mode 100644 index 000000000..306d2a56f --- /dev/null +++ b/Spigot-Server-Patches/0525-Don-t-allow-null-UUID-s-for-chat.patch @@ -0,0 +1,19 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Sun, 28 Jun 2020 19:36:55 -0400 +Subject: [PATCH] Don't allow null UUID's for chat + + +diff --git a/src/main/java/net/minecraft/server/PacketPlayOutChat.java b/src/main/java/net/minecraft/server/PacketPlayOutChat.java +index b9b2ddc1acadb96a0c750aeba0c0f6928f74e2fe..87f6ded6e7410702229ed066b2dcdb510853252d 100644 +--- a/src/main/java/net/minecraft/server/PacketPlayOutChat.java ++++ b/src/main/java/net/minecraft/server/PacketPlayOutChat.java +@@ -15,7 +15,7 @@ public class PacketPlayOutChat implements Packet { + public PacketPlayOutChat(IChatBaseComponent ichatbasecomponent, ChatMessageType chatmessagetype, UUID uuid) { + this.a = ichatbasecomponent; + this.b = chatmessagetype; +- this.c = uuid; ++ this.c = uuid != null ? uuid : SystemUtils.getNullUUID(); // Paper + } + + @Override diff --git a/Spigot-Server-Patches/0526-Improve-Legacy-Component-serialization-size.patch b/Spigot-Server-Patches/0526-Improve-Legacy-Component-serialization-size.patch new file mode 100644 index 000000000..3646572e7 --- /dev/null +++ b/Spigot-Server-Patches/0526-Improve-Legacy-Component-serialization-size.patch @@ -0,0 +1,56 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Sun, 28 Jun 2020 19:08:41 -0400 +Subject: [PATCH] Improve Legacy Component serialization size + +Don't constantly send format: false for all formatting options when parent already +has it false + +diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java +index a423e3bf3906d3114af885c48d0b45d88d7e7d8b..54f6f7d86741c3f318fa76bafe04b55cf420c35b 100644 +--- a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java ++++ b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java +@@ -45,6 +45,7 @@ public final class CraftChatMessage { + // Separate pattern with no group 3, new lines are part of previous string + private static final Pattern INCREMENTAL_PATTERN_KEEP_NEWLINES = Pattern.compile("(" + String.valueOf(org.bukkit.ChatColor.COLOR_CHAR) + "[0-9a-fk-orx])|((?:(?:https?):\\/\\/)?(?:[-\\w_\\.]{2,}\\.[a-z]{2,4}.*?(?=[\\.\\?!,;:]?(?:[" + String.valueOf(org.bukkit.ChatColor.COLOR_CHAR) + " ]|$))))", Pattern.CASE_INSENSITIVE); + // ChatColor.b does not explicitly reset, its more of empty ++ private static final ChatModifier EMPTY = ChatModifier.b.setItalic(false); // Paper - OBFHELPER + private static final ChatModifier RESET = ChatModifier.b.setBold(false).setItalic(false).setUnderline(false).setStrikethrough(false).setRandom(false); + + private final List list = new ArrayList(); +@@ -66,6 +67,7 @@ public final class CraftChatMessage { + Matcher matcher = (keepNewlines ? INCREMENTAL_PATTERN_KEEP_NEWLINES : INCREMENTAL_PATTERN).matcher(message); + String match = null; + boolean needsAdd = false; ++ boolean hasReset = false; // Paper + while (matcher.find()) { + int groupId = 0; + while ((match = matcher.group(++groupId)) == null) { +@@ -111,7 +113,26 @@ public final class CraftChatMessage { + throw new AssertionError("Unexpected message format"); + } + } else { // Color resets formatting +- modifier = RESET.setColor(format); ++ // Paper start - improve legacy formatting ++ ChatModifier previous = modifier; ++ modifier = (!hasReset ? RESET : EMPTY).setColor(format); ++ hasReset = true; ++ if (previous.isBold()) { ++ modifier = modifier.setBold(false); ++ } ++ if (previous.isItalic()) { ++ modifier = modifier.setItalic(false); ++ } ++ if (previous.isRandom()) { ++ modifier = modifier.setRandom(false); ++ } ++ if (previous.isStrikethrough()) { ++ modifier = modifier.setStrikethrough(false); ++ } ++ if (previous.isUnderlined()) { ++ modifier = modifier.setUnderline(false); ++ } ++ // Paper end + } + needsAdd = true; + break; diff --git a/Spigot-Server-Patches/0527-Support-old-UUID-format-for-NBT.patch b/Spigot-Server-Patches/0527-Support-old-UUID-format-for-NBT.patch new file mode 100644 index 000000000..dd0cf3994 --- /dev/null +++ b/Spigot-Server-Patches/0527-Support-old-UUID-format-for-NBT.patch @@ -0,0 +1,64 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Mon, 29 Jun 2020 03:26:17 -0400 +Subject: [PATCH] Support old UUID format for NBT + +We have stored UUID in plenty of places that did not get DFU'd + +So just look for old format and load it if it exists. + +diff --git a/src/main/java/net/minecraft/server/GameProfileSerializer.java b/src/main/java/net/minecraft/server/GameProfileSerializer.java +index 66d503a91665952b98c8cdc06c9ad10782b0558b..dca47422816e0ff5cf56ee73d0aa7e2f74a48060 100644 +--- a/src/main/java/net/minecraft/server/GameProfileSerializer.java ++++ b/src/main/java/net/minecraft/server/GameProfileSerializer.java +@@ -28,6 +28,11 @@ public final class GameProfileSerializer { + s = nbttagcompound.getString("Name"); + } + ++ // Paper start - support string UUID's ++ if (nbttagcompound.hasKeyOfType("Id", 8)) { ++ uuid = UUID.fromString(nbttagcompound.getString("Id")); ++ } ++ // Paper end + if (nbttagcompound.b("Id")) { + uuid = nbttagcompound.a("Id"); + } +diff --git a/src/main/java/net/minecraft/server/NBTTagCompound.java b/src/main/java/net/minecraft/server/NBTTagCompound.java +index f608b35502890650adfc1df35e0794471f57ecbc..436f40bcd7817bedde4f6570c7c47dba7ff7034f 100644 +--- a/src/main/java/net/minecraft/server/NBTTagCompound.java ++++ b/src/main/java/net/minecraft/server/NBTTagCompound.java +@@ -135,6 +135,12 @@ public class NBTTagCompound implements NBTBase { + + public void setUUID(String prefix, UUID uuid) { a(prefix, uuid); } // Paper - OBFHELPER + public void a(String s, UUID uuid) { ++ // Paper start - support old format ++ if (this.hasKeyOfType(s + "Most", 99) && this.hasKeyOfType(s + "Least", 99)) { ++ this.map.remove(s + "Most"); ++ this.map.remove(s + "Least"); ++ } ++ // Paper end + this.map.put(s, GameProfileSerializer.a(uuid)); + } + +@@ -142,11 +148,21 @@ public class NBTTagCompound implements NBTBase { + @Nullable public UUID getUUID(String prefix) { return a(prefix); } // Paper - OBFHELPER + @Nullable + public UUID a(String s) { ++ // Paper start - support old format ++ if (!hasKeyOfType(s, 11) && this.hasKeyOfType(s + "Most", 99) && this.hasKeyOfType(s + "Least", 99)) { ++ return new UUID(this.getLong(s + "Most"), this.getLong(s + "Least")); ++ } ++ // Paper end + return GameProfileSerializer.a(this.get(s)); + } + + public final boolean hasUUID(String s) { return this.b(s); } // Paper - OBFHELPER + public boolean b(String s) { ++ // Paper start - support old format ++ if (this.hasKeyOfType(s + "Most", 99) && this.hasKeyOfType(s + "Least", 99)) { ++ return true; ++ } ++ // Paper end + NBTBase nbtbase = this.get(s); + + return nbtbase != null && nbtbase.b() == NBTTagIntArray.a && ((NBTTagIntArray) nbtbase).getInts().length == 4; diff --git a/Spigot-Server-Patches/0549-Clean-up-duplicated-GameProfile-Properties.patch b/Spigot-Server-Patches/0528-Clean-up-duplicated-GameProfile-Properties.patch similarity index 78% rename from Spigot-Server-Patches/0549-Clean-up-duplicated-GameProfile-Properties.patch rename to Spigot-Server-Patches/0528-Clean-up-duplicated-GameProfile-Properties.patch index 4cc011264..5d2c684b6 100644 --- a/Spigot-Server-Patches/0549-Clean-up-duplicated-GameProfile-Properties.patch +++ b/Spigot-Server-Patches/0528-Clean-up-duplicated-GameProfile-Properties.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Aikar -Date: Wed, 1 Jul 2020 03:18:37 -0400 +Date: Wed, 1 Jul 2020 03:12:06 -0400 Subject: [PATCH] Clean up duplicated GameProfile Properties We had a bug where we accidently cloned properties resulting in skulls @@ -9,20 +9,21 @@ growing to large sizes and preventing login. This now automatically cleans up the extra properties. diff --git a/src/main/java/net/minecraft/server/GameProfileSerializer.java b/src/main/java/net/minecraft/server/GameProfileSerializer.java -index c7d548dad5838410e55948e2a8acc93e5088aac8..b0571c4971666a9651f8c8d36f88bcac9777728f 100644 +index dca47422816e0ff5cf56ee73d0aa7e2f74a48060..1fe44d4a1a1895f5715c720f9d7d7acb10e50f61 100644 --- a/src/main/java/net/minecraft/server/GameProfileSerializer.java +++ b/src/main/java/net/minecraft/server/GameProfileSerializer.java -@@ -51,7 +51,8 @@ public final class GameProfileSerializer { - String s2 = (String) iterator.next(); - NBTTagList nbttaglist = nbttagcompound1.getList(s2, 10); - +@@ -47,8 +47,8 @@ public final class GameProfileSerializer { + while (iterator.hasNext()) { + String s1 = (String) iterator.next(); + NBTTagList nbttaglist = nbttagcompound1.getList(s1, 10); +- - for (int i = 0; i < nbttaglist.size(); ++i) { + if (nbttaglist.size() == 0) continue; // Paper - remove duplicate properties -+ for (int i = nbttaglist.size() -1; i < nbttaglist.size(); ++i) { // Paper - remove duplicate properties ++ for (int i = nbttaglist.size() - 1; i < nbttaglist.size(); ++i) { // Paper - remove duplicate properties NBTTagCompound nbttagcompound2 = nbttaglist.getCompound(i); - String s3 = nbttagcompound2.getString("Value"); + String s2 = nbttagcompound2.getString("Value"); -@@ -231,7 +232,7 @@ public final class GameProfileSerializer { +@@ -234,7 +234,7 @@ public final class GameProfileSerializer { Optional optional = iblockstate.b(nbttagcompound.getString(s)); if (optional.isPresent()) { @@ -31,19 +32,19 @@ index c7d548dad5838410e55948e2a8acc93e5088aac8..b0571c4971666a9651f8c8d36f88bcac } else { GameProfileSerializer.LOGGER.warn("Unable to read property: {} with value: {} for blockstate: {}", s, nbttagcompound.getString(s), nbttagcompound1.toString()); return s0; -@@ -261,8 +262,8 @@ public final class GameProfileSerializer { +@@ -264,8 +264,8 @@ public final class GameProfileSerializer { return nbttagcompound; } - private static > String a(IBlockState iblockstate, Comparable comparable) { - return iblockstate.a(comparable); -+ private static > String a(IBlockState iblockstate, Comparable comparable) { // Paper - decompile error -+ return iblockstate.a((T) comparable); // Paper - decompile error ++ private static > String a(IBlockState iblockstate, Comparable comparable) {// Paper - decompile error ++ return iblockstate.a((T) comparable);// Paper - decompile error } public static NBTTagCompound a(DataFixer datafixer, DataFixTypes datafixtypes, NBTTagCompound nbttagcompound, int i) { diff --git a/src/main/java/net/minecraft/server/ItemSkullPlayer.java b/src/main/java/net/minecraft/server/ItemSkullPlayer.java -index 4e4162dc492731408026a86e5766270d8a3db48a..59b57df2847b5d4bbf214db1eace2bf65d408d2f 100644 +index 28f1ce9031c73d09b55a5c6aac5d34e66e9f7c12..61f4cf9cc62a1b2ba59137b8682cb58834b4abcc 100644 --- a/src/main/java/net/minecraft/server/ItemSkullPlayer.java +++ b/src/main/java/net/minecraft/server/ItemSkullPlayer.java @@ -53,6 +53,18 @@ public class ItemSkullPlayer extends ItemBlockWallable { diff --git a/Spigot-Server-Patches/0529-Convert-legacy-attributes-in-Item-Meta.patch b/Spigot-Server-Patches/0529-Convert-legacy-attributes-in-Item-Meta.patch new file mode 100644 index 000000000..b64212b09 --- /dev/null +++ b/Spigot-Server-Patches/0529-Convert-legacy-attributes-in-Item-Meta.patch @@ -0,0 +1,44 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Wed, 1 Jul 2020 04:50:22 -0400 +Subject: [PATCH] Convert legacy attributes in Item Meta + + +diff --git a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java +index bf3b236b2090fe4dd67e2f87b0b27c8d7186cb48..c5dd25add39298342a6f4b2a05e137de93d1e62b 100644 +--- a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java ++++ b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java +@@ -13,6 +13,20 @@ import org.bukkit.craftbukkit.util.CraftNamespacedKey; + public class CraftAttributeMap implements Attributable { + + private final AttributeMapBase handle; ++ // Paper start - convert legacy attributes ++ private static final com.google.common.collect.ImmutableMap legacyNMS = com.google.common.collect.ImmutableMap.builder().put("generic.maxHealth", "generic.max_health").put("Max Health", "generic.max_health").put("zombie.spawnReinforcements", "zombie.spawn_reinforcements").put("Spawn Reinforcements Chance", "zombie.spawn_reinforcements").put("horse.jumpStrength", "horse.jump_strength").put("Jump Strength", "horse.jump_strength").put("generic.followRange", "generic.follow_range").put("Follow Range", "generic.follow_range").put("generic.knockbackResistance", "generic.knockback_resistance").put("Knockback Resistance", "generic.knockback_resistance").put("generic.movementSpeed", "generic.movement_speed").put("Movement Speed", "generic.movement_speed").put("generic.flyingSpeed", "generic.flying_speed").put("Flying Speed", "generic.flying_speed").put("generic.attackDamage", "generic.attack_damage").put("generic.attackKnockback", "generic.attack_knockback").put("generic.attackSpeed", "generic.attack_speed").put("generic.armorToughness", "generic.armor_toughness").build(); ++ ++ public static String convertIfNeeded(String nms) { ++ if (nms == null) { ++ return null; ++ } ++ nms = legacyNMS.getOrDefault(nms, nms); ++ if (!nms.toLowerCase().equals(nms) || nms.indexOf(' ') != -1) { ++ return null; ++ } ++ return nms; ++ } ++ // Paper end + + public CraftAttributeMap(AttributeMapBase handle) { + this.handle = handle; +diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +index fe4aa562aa5a938dea9cd083ccff8c9cb28a7159..8f48b58c98ba40d5d7deb6775957e2c6b4d334c6 100644 +--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java ++++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +@@ -492,7 +492,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { + + AttributeModifier attribMod = CraftAttributeInstance.convert(nmsModifier); + +- String attributeName = entry.getString(ATTRIBUTES_IDENTIFIER.NBT); ++ String attributeName = CraftAttributeMap.convertIfNeeded(entry.getString(ATTRIBUTES_IDENTIFIER.NBT)); // Paper + if (attributeName == null || attributeName.isEmpty()) { + continue; + } diff --git a/Spigot-Server-Patches/0529-Optimize-sending-packets-to-nearby-locations-sounds-.patch b/Spigot-Server-Patches/0529-Optimize-sending-packets-to-nearby-locations-sounds-.patch deleted file mode 100644 index fe477cdf8..000000000 --- a/Spigot-Server-Patches/0529-Optimize-sending-packets-to-nearby-locations-sounds-.patch +++ /dev/null @@ -1,73 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sat, 23 May 2020 17:03:41 -0400 -Subject: [PATCH] Optimize sending packets to nearby locations (sounds/effects) - -Instead of using the entire world or player list, use the distance -maps to only iterate players who are even seeing the chunk the packet -is originating from. - -This will drastically cut down on packet sending cost for worlds with -lots of players in them. - -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index f133e7baf958b031819c2c72ccd21c52ba9a683d..ab8247eb790be2084be7544f72e5b6661151905d 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -1031,11 +1031,30 @@ public abstract class PlayerList { - world = (WorldServer) entityhuman.world; - } - -- List players1 = world == null ? players : world.players; -- for (int j = 0; j < players1.size(); ++j) { -- EntityHuman entity = players1.get(j); -- if (!(entity instanceof EntityPlayer)) continue; -- EntityPlayer entityplayer = (EntityPlayer) entity; -+ // Paper start -+ if ((world == null || world.chunkProvider == null) && dimensionmanager != null) { -+ world = dimensionmanager.world; -+ } -+ if (world == null) { -+ LOGGER.error("Sending packet to invalid world" + entityhuman + " " + dimensionmanager + " - " + packet.getClass().getName(), new Throwable()); -+ return; // ??? shouldn't happen... -+ } -+ PlayerChunkMap chunkMap = world.chunkMap; -+ Object[] backingSet; -+ if (chunkMap == null) { -+ // Really shouldn't happen... -+ backingSet = world.players.toArray(); -+ } else { -+ com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet nearbyPlayers = chunkMap.playerViewDistanceBroadcastMap.getObjectsInRange(MCUtil.fastFloor(d0) >> 4, MCUtil.fastFloor(d2) >> 4); -+ if (nearbyPlayers == null) { -+ return; -+ } -+ backingSet = nearbyPlayers.getBackingSet(); -+ } -+ -+ for (Object object : backingSet) { -+ if (!(object instanceof EntityPlayer)) continue; -+ EntityPlayer entityplayer = (EntityPlayer) object; - // Paper end - - // CraftBukkit start - Test if player receiving packet can see the source of the packet -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index aaf85a1497de98522e3a01d4f81a267c4b0cc087..2c9acffe5a62af43ff4f4ccdb6962929d645e226 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -70,6 +70,7 @@ public class WorldServer extends World { - } - } - // Paper end -+ public final PlayerChunkMap chunkMap; // Paper - private final MinecraftServer server; - private final WorldNBTStorage dataManager; - public boolean savingDisabled; -@@ -208,6 +209,8 @@ public class WorldServer extends World { - }, gameprofilerfiller, false, gen, env); - this.pvpMode = minecraftserver.getPVP(); - worlddata.world = this; -+ if (chunkProvider == null) { chunkMap = null; new Throwable("World created without a ChunkProvider!").printStackTrace(); } // Paper - figure out if something weird happened here -+ else chunkMap = ((ChunkProviderServer) chunkProvider).playerChunkMap; - // CraftBukkit end - if (com.destroystokyo.paper.PaperConfig.useOptimizedTickList) { - this.nextTickListBlock = new com.destroystokyo.paper.server.ticklist.PaperTickList<>(this, (block) -> { // Paper - optimise TickListServer diff --git a/Spigot-Server-Patches/0530-Remove-some-streams-from-structures.patch b/Spigot-Server-Patches/0530-Remove-some-streams-from-structures.patch new file mode 100644 index 000000000..765a38527 --- /dev/null +++ b/Spigot-Server-Patches/0530-Remove-some-streams-from-structures.patch @@ -0,0 +1,111 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: JRoy +Date: Mon, 29 Jun 2020 17:03:06 -0400 +Subject: [PATCH] Remove some streams from structures + +This showed up a lot in the spark profiler, should have a low-medium performance improvement. + +diff --git a/src/main/java/net/minecraft/server/BiomeBase.java b/src/main/java/net/minecraft/server/BiomeBase.java +index 30aeb45d63394b7d91c2dd7b92cfc9cefa3c088c..db198811ddecc00cbd398f3805bdf51b3239f390 100644 +--- a/src/main/java/net/minecraft/server/BiomeBase.java ++++ b/src/main/java/net/minecraft/server/BiomeBase.java +@@ -339,9 +339,11 @@ public class BiomeBase { + int j1 = l << 4; + + try { +- structuremanager.a(SectionPosition.a(blockposition), structuregenerator).forEach((structurestart) -> { +- structurestart.a(generatoraccessseed, structuremanager, chunkgenerator, seededrandom, new StructureBoundingBox(i1, j1, i1 + 15, j1 + 15), new ChunkCoordIntPair(k, l)); +- }); ++ // Paper start - remove structure streams ++ for (StructureStart structureStart : structuremanager.getFeatureStarts(SectionPosition.a(blockposition), structuregenerator)) { ++ structureStart.a(generatoraccessseed, structuremanager, chunkgenerator, seededrandom, new StructureBoundingBox(i1, j1, i1 + 15, j1 + 15), new ChunkCoordIntPair(k, l)); ++ } ++ // Paper end + } catch (Exception exception) { + CrashReport crashreport = CrashReport.a(exception, "Feature placement"); + +diff --git a/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java b/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java +index 733c6244e08f6b7277006c1ed801f2cfc8fc36e5..45b771e4121f2ef27c67d5a5ba2dadcfc0f944e0 100644 +--- a/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java ++++ b/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java +@@ -417,7 +417,7 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator { + while (iterator.hasNext()) { + StructureGenerator structuregenerator = (StructureGenerator) iterator.next(); + +- structuremanager.a(SectionPosition.a(chunkcoordintpair, 0), structuregenerator).forEach((structurestart) -> { ++ for (StructureStart structurestart : structuremanager.getFeatureStarts(SectionPosition.a(chunkcoordintpair, 0), structuregenerator)) { // Paper - remove structure streams + Iterator iterator1 = structurestart.d().iterator(); + + while (iterator1.hasNext()) { +@@ -449,7 +449,7 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator { + } + } + +- }); ++ } // Paper - remove structure streams + } + + double[][][] adouble = new double[2][this.p + 1][this.o + 1]; +diff --git a/src/main/java/net/minecraft/server/StructureManager.java b/src/main/java/net/minecraft/server/StructureManager.java +index c434427ce7bd206ed5d2efa2560e593b1186c666..6c7804ac0e994ec03b95eda7a24139b65a59db7e 100644 +--- a/src/main/java/net/minecraft/server/StructureManager.java ++++ b/src/main/java/net/minecraft/server/StructureManager.java +@@ -6,7 +6,7 @@ import javax.annotation.Nullable; + + public class StructureManager { + +- private final GeneratorAccess a; ++ private final GeneratorAccess a; public GeneratorAccess getLevel() { return a; } // Paper - OBFHELPER + private final GeneratorSettings b; + + public StructureManager(GeneratorAccess generatoraccess, GeneratorSettings generatorsettings) { +@@ -32,6 +32,20 @@ public class StructureManager { + }); + } + ++ // Paper start - remove structure streams ++ public java.util.List> getFeatureStarts(SectionPosition sectionPosition, StructureGenerator structureGenerator) { ++ java.util.List> list = new it.unimi.dsi.fastutil.objects.ObjectArrayList<>(); ++ for (Long curLong: getLevel().getChunkAt(sectionPosition.a(), sectionPosition.c(), ChunkStatus.STRUCTURE_REFERENCES).b(structureGenerator)) { ++ SectionPosition sectionPosition1 = SectionPosition.a(new ChunkCoordIntPair(curLong), 0); ++ StructureStart structurestart = a(sectionPosition1, structureGenerator, getLevel().getChunkAt(sectionPosition1.a(), sectionPosition1.c(), ChunkStatus.STRUCTURE_STARTS)); ++ if (structurestart != null && structurestart.e()) { ++ list.add(structurestart); ++ } ++ } ++ return list; ++ } ++ // Paper end ++ + @Nullable + public StructureStart a(SectionPosition sectionposition, StructureGenerator structuregenerator, IStructureAccess istructureaccess) { + return istructureaccess.a(structuregenerator); +@@ -50,13 +64,21 @@ public class StructureManager { + } + + public StructureStart a(BlockPosition blockposition, boolean flag, StructureGenerator structuregenerator) { +- return (StructureStart) DataFixUtils.orElse(this.a(SectionPosition.a(blockposition), structuregenerator).filter((structurestart) -> { +- return structurestart.c().b((BaseBlockPosition) blockposition); +- }).filter((structurestart) -> { +- return !flag || structurestart.d().stream().anyMatch((structurepiece) -> { +- return structurepiece.g().b((BaseBlockPosition) blockposition); +- }); +- }).findFirst(), StructureStart.a); ++ // Paper start - remove structure streams ++ for (StructureStart structurestart : getFeatureStarts(SectionPosition.a(blockposition), structuregenerator)) { ++ if (structurestart.c().b(blockposition)) { ++ if (!flag) { ++ return structurestart; ++ } ++ for (StructurePiece structurepiece : structurestart.d()) { ++ if (structurepiece.g().b(blockposition)) { ++ return structurestart; ++ } ++ } ++ } ++ } ++ return StructureStart.a; ++ // Paper end + } + + // Spigot start diff --git a/Spigot-Server-Patches/0531-Support-components-in-ItemMeta.patch b/Spigot-Server-Patches/0531-Support-components-in-ItemMeta.patch new file mode 100644 index 000000000..cfaa7386b --- /dev/null +++ b/Spigot-Server-Patches/0531-Support-components-in-ItemMeta.patch @@ -0,0 +1,95 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: MiniDigger +Date: Sat, 6 Jun 2020 18:13:42 +0200 +Subject: [PATCH] Support components in ItemMeta + + +diff --git a/src/main/java/net/minecraft/server/IChatBaseComponent.java b/src/main/java/net/minecraft/server/IChatBaseComponent.java +index fd3e6cda6a0e7154c50608ba9a4b70f3c43c8f2a..94a6d0ad76b10b8790ffb2019bf6972472b04c3d 100644 +--- a/src/main/java/net/minecraft/server/IChatBaseComponent.java ++++ b/src/main/java/net/minecraft/server/IChatBaseComponent.java +@@ -344,6 +344,7 @@ public interface IChatBaseComponent extends Message, IChatFormatted, Iterable(Lists.transform(this.lore, CraftChatMessage::fromComponent)); + } + ++ // Paper start ++ @Override ++ public List getLoreComponents() { ++ return this.lore == null ? null : new ArrayList<>(this.lore.stream().map(entry -> ++ net.md_5.bungee.chat.ComponentSerializer.parse(IChatBaseComponent.ChatSerializer.componentToJson(entry) ++ )).collect(java.util.stream.Collectors.toList())); ++ } ++ // Paper end + @Override + public void setLore(List lore) { // too tired to think if .clone is better + if (lore == null) { +@@ -1022,6 +1042,21 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { + } + } + ++ // Paper start ++ @Override ++ public void setLoreComponents(List lore) { ++ if (lore == null) { ++ this.lore = null; ++ } else { ++ if (this.lore == null) { ++ safelyAdd(lore, this.lore = new ArrayList<>(lore.size()), Integer.MAX_VALUE); ++ } else { ++ this.lore.clear(); ++ safelyAdd(lore, this.lore, Integer.MAX_VALUE); ++ } ++ } ++ } ++ // Paper end + @Override + public boolean hasCustomModelData() { + return customModelData != null; +@@ -1483,6 +1518,11 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { + } + + for (Object object : addFrom) { ++ // Paper start - support components ++ if(object instanceof net.md_5.bungee.api.chat.BaseComponent[]) { ++ addTo.add(IChatBaseComponent.ChatSerializer.jsonToComponent(net.md_5.bungee.chat.ComponentSerializer.toString((net.md_5.bungee.api.chat.BaseComponent[]) object))); ++ } else ++ // Paper end + if (!(object instanceof String)) { + if (object != null) { + throw new IllegalArgumentException(addFrom + " cannot contain non-string " + object.getClass().getName()); diff --git a/Spigot-Server-Patches/0532-Spawn-player-in-correct-world-on-login.patch b/Spigot-Server-Patches/0532-Spawn-player-in-correct-world-on-login.patch new file mode 100644 index 000000000..588f4781c --- /dev/null +++ b/Spigot-Server-Patches/0532-Spawn-player-in-correct-world-on-login.patch @@ -0,0 +1,30 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Wyatt Childers +Date: Fri, 3 Jul 2020 14:57:05 -0400 +Subject: [PATCH] Spawn player in correct world on login + + +diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java +index f17399a73e0de49d2e7325747a2637f447df78f2..3c2f1f140c3991195bb8147bd65d9cd16a8fd3da 100644 +--- a/src/main/java/net/minecraft/server/PlayerList.java ++++ b/src/main/java/net/minecraft/server/PlayerList.java +@@ -119,7 +119,18 @@ public abstract class PlayerList { + }String lastKnownName = s; // Paper + // CraftBukkit end + +- if (nbttagcompound != null) { ++ // Paper start - move logic in Entity to here, to use bukkit supplied world UUID. ++ if (nbttagcompound != null && nbttagcompound.hasKey("WorldUUIDMost") && nbttagcompound.hasKey("WorldUUIDLeast")) { ++ UUID uid = new UUID(nbttagcompound.getLong("WorldUUIDMost"), nbttagcompound.getLong("WorldUUIDLeast")); ++ org.bukkit.World bWorld = Bukkit.getServer().getWorld(uid); ++ if (bWorld != null) { ++ resourcekey = ((CraftWorld) bWorld).getHandle().getDimensionKey(); ++ } else { ++ resourcekey = World.OVERWORLD; ++ } ++ } else if (nbttagcompound != null) { ++ // Vanilla migration support ++ // Paper end + DataResult dataresult = DimensionManager.a(new Dynamic(DynamicOpsNBT.a, nbttagcompound.get("Dimension"))); + Logger logger = PlayerList.LOGGER; + diff --git a/Spigot-Server-Patches/0544-Fix-enderdragon-exp-dupe.patch b/Spigot-Server-Patches/0544-Fix-enderdragon-exp-dupe.patch deleted file mode 100644 index f37907b17..000000000 --- a/Spigot-Server-Patches/0544-Fix-enderdragon-exp-dupe.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Spottedleaf -Date: Fri, 12 Jun 2020 22:25:11 -0700 -Subject: [PATCH] Fix enderdragon exp dupe - -Properly track death stage when unloading/loading in the -dragon - -diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java -index aecdaacfc7da560759bc513680d76f55820d5046..7daebfdab5c6e258d3e426643c0dbd374774ff5d 100644 ---- a/src/main/java/net/minecraft/server/EntityEnderDragon.java -+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java -@@ -33,7 +33,7 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster { - public float bx; - public float by; - public boolean bz; -- public int bA; -+ public int bA; public final int getDeathTicks() { return this.bA; } public final void setDeathTicks(final int value) { this.bA = value; } // Paper - public float bB; - @Nullable - public EntityEnderCrystal currentEnderCrystal; -@@ -833,6 +833,7 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster { - public void b(NBTTagCompound nbttagcompound) { - super.b(nbttagcompound); - nbttagcompound.setInt("DragonPhase", this.bO.a().getControllerPhase().b()); -+ nbttagcompound.setInt("Paper.DeathTick", this.getDeathTicks()); // Paper - } - - @Override -@@ -841,6 +842,7 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster { - if (nbttagcompound.hasKey("DragonPhase")) { - this.bO.setControllerPhase(DragonControllerPhase.getById(nbttagcompound.getInt("DragonPhase"))); - } -+ this.setDeathTicks(nbttagcompound.getInt("Paper.DeathTick")); // Paper - - } - diff --git a/Spigot-Server-Patches/0298-Support-Overriding-World-Seeds.patch b/removed/1.16/0298-Support-Overriding-World-Seeds.patch similarity index 98% rename from Spigot-Server-Patches/0298-Support-Overriding-World-Seeds.patch rename to removed/1.16/0298-Support-Overriding-World-Seeds.patch index c43edf601..2ff841598 100644 --- a/Spigot-Server-Patches/0298-Support-Overriding-World-Seeds.patch +++ b/removed/1.16/0298-Support-Overriding-World-Seeds.patch @@ -59,7 +59,7 @@ index 214b577b326bc794fa3721deb6171228dd4f25e6..559e6b42ba5bf0ea92cccbabd2ef1d4c + } } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index b7c83cd82ca1c9b6bdaaf566e800b8d15ad7d966..acc5f01d022e49348de0079a9a89455cffc255ee 100644 +index 3b89f62ab0522d23f47fd59c2f06fa7d0eacb7af..85f989829b5ad1d7681b57cf68519a4806b26ea1 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -378,7 +378,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant/dev/null 2>&1 # Special case Windows handling because of ARG_MAX constraint diff --git a/scripts/importmcdev.sh b/scripts/importmcdev.sh index 6fd55da94..269f68bcd 100755 --- a/scripts/importmcdev.sh +++ b/scripts/importmcdev.sh @@ -95,7 +95,6 @@ done # import FileName - ######################################################## ######################################################## ######################################################## diff --git a/scripts/rebuildPatches.sh b/scripts/rebuildPatches.sh index 7dd38d46f..df1934b49 100755 --- a/scripts/rebuildPatches.sh +++ b/scripts/rebuildPatches.sh @@ -9,7 +9,7 @@ gitcmd="git -c commit.gpgsign=false -c core.safecrlf=false" echo "Rebuilding patch files from current fork state..." nofilter="0" -if [ "$2" = "nofilter" ]; then +if [ "$2" == "nofilter" ] || [ "$2" == "noclean" ]; then nofilter="1" fi function cleanupPatches { diff --git a/scripts/testServer.sh b/scripts/testServer.sh index 1ce78a332..834e4a917 100755 --- a/scripts/testServer.sh +++ b/scripts/testServer.sh @@ -87,7 +87,9 @@ fi # JVM FLAGS # -cp "$jar" paper.jar +if [ -f "$jar" ]; then + cp "$jar" paper.jar +fi baseargs="-server -Xms${PAPER_MIN_TEST_MEMORY:-512M} -Xmx${PAPER_TEST_MEMORY:-2G} -Dfile.encoding=UTF-8 -XX:MaxGCPauseMillis=150 -XX:+UseG1GC " baseargs="$baseargs -DIReallyKnowWhatIAmDoingISwear=1 " baseargs="$baseargs -XX:+UnlockExperimentalVMOptions -XX:G1NewSizePercent=40 -XX:G1MaxNewSizePercent=60 " diff --git a/work/BuildData b/work/BuildData index 455d45a42..be3371e67 160000 --- a/work/BuildData +++ b/work/BuildData @@ -1 +1 @@ -Subproject commit 455d45a4244894335cd07451bdda79ccd380aff6 +Subproject commit be3371e67489b5a2293306e24420793106baadc1 diff --git a/work/Bukkit b/work/Bukkit index 149527f7b..a3e223254 160000 --- a/work/Bukkit +++ b/work/Bukkit @@ -1 +1 @@ -Subproject commit 149527f7b10f992ef22186e85f13ded96ab76a63 +Subproject commit a3e223254511014327bf59c76e71b7dfe3b4b850 diff --git a/work/CraftBukkit b/work/CraftBukkit index be6aaf046..b6a876bc3 160000 --- a/work/CraftBukkit +++ b/work/CraftBukkit @@ -1 +1 @@ -Subproject commit be6aaf046eed614b0034ec42d5ef5e6f7de16ff0 +Subproject commit b6a876bc34a0cccbfccb890029a44a61b9853285 diff --git a/work/Spigot b/work/Spigot index a99063f77..ccb012a27 160000 --- a/work/Spigot +++ b/work/Spigot @@ -1 +1 @@ -Subproject commit a99063f77142a462546e31413de6c6190e913f11 +Subproject commit ccb012a27ac070ee5e2f924743bbbd8d29931e93