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 cf0740eeee..6851d93b28 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,33 @@ 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 71f2234fd430ee219da6b3d10b8e679aeac9455c..bfdb57ff56df5d025a7bba9558682089a557c7c9 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 +@@ -2503,7 +2503,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 4027dc7159d3ef93b6123e548520b45534589933..326cbeee1ba59b585a59c3c402cf6d920c88ac13 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 { +@@ -817,7 +817,7 @@ 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 == World.THE_END ? 0 : 16); ++ PlayerPortalEvent event = new PlayerPortalEvent(this.getBukkitEntity(), enter, exit, cause, worldserver.paperConfig.portalSearchRadius, true, resourcekey == World.THE_END ? 0 : worldserver.paperConfig.portalCreateRadius); 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 +61,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 7b1125b288..285b90a42e 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 15ee6ee6e96bb48f73cbb2944eeee8f726914e2d..49889d8c1d1f9b9c79b1d526f4cd9a94944c1c72 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 { +@@ -258,6 +258,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 d94fcaf886..b4466a814e 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 682dd0d53f393c326e3da9b99fbff21953535161..15312df00ea7d88ca1733b5b8a5dd8f204728811 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 { +@@ -762,7 +762,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 06244eb003..89f5a203f8 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 83707fa6ae5cf4f564760ca0fb5e8c1932d4a91e..7464aeb4e2f2cbe177cfd2ac19c45aabac625632 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 83707fa6ae5cf4f564760ca0fb5e8c1932d4a91e..7464aeb4e2f2cbe177cfd2ac19c45aab 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 0bff7dbbb717b51208f581c129d1cc1ff417969f..9816b64c0760f334e508194ccb3f6b3ab54f7695 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 c3632b2607ace821b02895a1668bd6050f6c12d6..50be743513145bd2c8b9c65af219f60099cbb09f 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()); +@@ -263,6 +264,7 @@ public final class SpawnerCreature { + } + } catch (Exception exception) { + SpawnerCreature.LOGGER.warn("Failed to create mob", exception); ++ ServerInternalException.reportInternalException(exception); // Paper + return null; + } + } +@@ -368,6 +370,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 5197cdb3219638b499f0eb2a25f35e789983a3e8..f80b0b95ce650b01ecb10d3a2f7c66421ca29178 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 { +@@ -718,8 +723,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 { +@@ -790,8 +798,10 @@ public abstract class World implements GeneratorAccess, AutoCloseable { consumer.accept(entity); } catch (Throwable throwable) { // Paper start - Prevent tile entity and entity crashes 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 24ec7bf891..cb3b72b349 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 bfdb57ff56df5d025a7bba9558682089a557c7c9..936919c357865b8933dc1395fffa844940099138 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 +@@ -2196,6 +2196,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 b3a1199d736798c295c695aea1152ac9d0a30d29..e763bf1a6486134fe222865d207359c8b868c008 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 3611265103..e63b467a77 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 20ada1ab2bea9fa5bde19cb4768d64f73a4154d2..8c3fa2335cfa1df94eb64bda5b12f1f5858dec27 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 { +@@ -629,4 +629,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 75a6bad4ce..88c0c54360 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 b468182266c39b9defa1aa287290f75f7db44b9a..a0806ddc407d21340c82fe4d00bb7ad120cc09d9 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 { +@@ -1380,7 +1380,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 15312df00ea7d88ca1733b5b8a5dd8f204728811..f2963832700db877af9d4efd5b277348303afe63 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 { +@@ -136,6 +136,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 { +@@ -1769,6 +1773,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 e4ae1be13d..24e5c9f56e 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 c70f3d90a8..44222f2870 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 @@ -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 49889d8c1d1f9b9c79b1d526f4cd9a94944c1c72..2fb96635d7f811fd77a807ae4a4cc1c0ae0af47a 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 { +@@ -394,6 +394,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 { +@@ -413,7 +414,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 234d830bce..126942160a 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 2fb96635d7f811fd77a807ae4a4cc1c0ae0af47a..530c0fb05c4631e8946a7defdf9e5c535bc3ddc2 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 { +@@ -2140,5 +2140,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 a29b0ebb60..541a136a9d 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 530c0fb05c4631e8946a7defdf9e5c535bc3ddc2..f29253ba0fdf30d78dbec58a8c706e219653ddeb 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 { +@@ -848,8 +848,18 @@ public final class CraftServer implements Server { world.paperConfig.init(); // Paper } diff --git a/Spigot-Server-Patches/0063-Undead-horse-leashing.patch b/Spigot-Server-Patches/0063-Undead-horse-leashing.patch index 4c360f1693..6ee9eccf47 100644 --- a/Spigot-Server-Patches/0063-Undead-horse-leashing.patch +++ b/Spigot-Server-Patches/0063-Undead-horse-leashing.patch @@ -20,15 +20,36 @@ index 04430aae52205ee167662004e45c145b9d2e8bed..dd21221534542d0265fa7d2178ab69c2 + } } diff --git a/src/main/java/net/minecraft/server/EntityHorseAbstract.java b/src/main/java/net/minecraft/server/EntityHorseAbstract.java -index b611ade24817a7d6a740bf5366816b6694d79713..c56efe035ac87e5ef49ad39d82499c7348ee8d2f 100644 +index 364697e0155012c300219ad94a3995809e6c2f8f..8afefd8ab17188e542e067ac255634d396405fac 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 +@@ -106,6 +106,13 @@ public abstract class EntityHorseAbstract extends EntityAnimal implements IInven + this.bx = flag; } ++ // Paper start ++ @Override ++ public boolean canLeash(EntityHuman entityhuman) { ++ return world.paperConfig.allowLeashingUndeadHorse ? super.a(entityhuman) : super.a(entityhuman) && this.getMonsterType() != EnumMonsterType.UNDEAD; // Paper ++ } ++ // Paper end ++ @Override + protected void t(float f) { + if (f > 6.0F && this.fa()) { +diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java +index 9715f10c790c0210435622ab9997ac40f98da185..f2cd6824790d7e76f8f10e2630bcd5ebbf2a4238 100644 +--- a/src/main/java/net/minecraft/server/EntityInsentient.java ++++ b/src/main/java/net/minecraft/server/EntityInsentient.java +@@ -1283,6 +1283,11 @@ public abstract class EntityInsentient extends EntityLiving { + } + + public boolean a(EntityHuman entityhuman) { ++ // Paper start - allow overriding ++ return this.canLeash(entityhuman); ++ } ++ public boolean canLeash(EntityHuman entityhuman) { ++ // Paper end - allow overriding + return !this.isLeashed() && !(this instanceof IMonster); + } + diff --git a/Spigot-Server-Patches/0064-Handle-Item-Meta-Inconsistencies.patch b/Spigot-Server-Patches/0064-Handle-Item-Meta-Inconsistencies.patch index d5bf43590c..dd8b0ecd94 100644 --- a/Spigot-Server-Patches/0064-Handle-Item-Meta-Inconsistencies.patch +++ b/Spigot-Server-Patches/0064-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 c59da5b36c158a25ab861b1aaee497b4119feb3e..bbee99c13e66b50401489fa4ea497980b1e50b18 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 dac0bf9c482cdad7a4e94e41a70cd0765e3c5f18..c1a42d04429a4e9587a4907c29f6b917951e659c 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 { +@@ -269,7 +272,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 { +@@ -280,7 +283,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 { +@@ -301,7 +304,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 { +@@ -397,13 +400,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 { +@@ -555,13 +558,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 { +@@ -813,14 +816,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 { +@@ -1201,7 +1204,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 { +@@ -1430,4 +1433,22 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { return HANDLED_TAGS; } } diff --git a/Spigot-Server-Patches/0065-Configurable-Non-Player-Arrow-Despawn-Rate.patch b/Spigot-Server-Patches/0065-Configurable-Non-Player-Arrow-Despawn-Rate.patch index a0208ed0c6..72d298de10 100644 --- a/Spigot-Server-Patches/0065-Configurable-Non-Player-Arrow-Despawn-Rate.patch +++ b/Spigot-Server-Patches/0065-Configurable-Non-Player-Arrow-Despawn-Rate.patch @@ -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/0066-Add-World-Util-Methods.patch b/Spigot-Server-Patches/0066-Add-World-Util-Methods.patch index 48d9cf1d80..c50dd3fcd7 100644 --- a/Spigot-Server-Patches/0066-Add-World-Util-Methods.patch +++ b/Spigot-Server-Patches/0066-Add-World-Util-Methods.patch @@ -6,10 +6,10 @@ 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 6e4329d21d7877e46369361e55954f2f9371bd6e..7f1f0111373fa409e52894e59ac49d5278d0bd58 100644 +index f80b0b95ce650b01ecb10d3a2f7c66421ca29178..2a18a905aef50d23d9e5544f4240b2f719abd8f1 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 { +@@ -283,6 +283,18 @@ public abstract class World implements GeneratorAccess, AutoCloseable { return chunk == null ? null : chunk.getFluid(blockposition); } @@ -29,14 +29,14 @@ index 6e4329d21d7877e46369361e55954f2f9371bd6e..7f1f0111373fa409e52894e59ac49d52 @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 +index d039e715624d33fc3ec9e87d5ad992415e7dc6b9..d5c0d394feaf8bb991245dbdcc6252cf45eac13d 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 { +@@ -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.c() && (double) blockposition.getX() < this.e() && (double) (blockposition.getZ() + 1) > this.d() && (double) blockposition.getZ() < this.f(); + 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/Spigot-Server-Patches/0067-Custom-replacement-for-eaten-items.patch b/Spigot-Server-Patches/0067-Custom-replacement-for-eaten-items.patch index 15692f8ef0..541513885b 100644 --- a/Spigot-Server-Patches/0067-Custom-replacement-for-eaten-items.patch +++ b/Spigot-Server-Patches/0067-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/0068-handle-NaN-health-absorb-values-and-repair-bad-data.patch index 69a2fc25fe..ed71b1160a 100644 --- a/Spigot-Server-Patches/0068-handle-NaN-health-absorb-values-and-repair-bad-data.patch +++ b/Spigot-Server-Patches/0068-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 f2963832700db877af9d4efd5b277348303afe63..5b3c8cc669eef72cec04d36de156405421cd21e5 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 { +@@ -1589,6 +1589,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } public void setRealHealth(double health) { diff --git a/Spigot-Server-Patches/0070-Use-a-Shared-Random-for-Entities.patch b/Spigot-Server-Patches/0070-Use-a-Shared-Random-for-Entities.patch index 9b37704a09..3329238321 100644 --- a/Spigot-Server-Patches/0070-Use-a-Shared-Random-for-Entities.patch +++ b/Spigot-Server-Patches/0070-Use-a-Shared-Random-for-Entities.patch @@ -6,10 +6,10 @@ 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 936919c357865b8933dc1395fffa844940099138..d4e673a70f28b9d29b3d1b16eaa06562b7a5d7bc 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 +@@ -59,6 +59,21 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke return tag.hasKey("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level; } @@ -31,12 +31,12 @@ index 383805926e60f9f2f77e258e9d51ed079549713a..d6fc93b5923096d3f092f561cbefdf26 private CraftEntity bukkitEntity; 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; +@@ -193,7 +208,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke + 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/0071-Configurable-spawn-chances-for-skeleton-horses.patch index 966656b18a..a8b4c0db91 100644 --- a/Spigot-Server-Patches/0071-Configurable-spawn-chances-for-skeleton-horses.patch +++ b/Spigot-Server-Patches/0071-Configurable-spawn-chances-for-skeleton-horses.patch @@ -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 ac66ee26861ffa4795a00f328deefab5962fad88..9e8f22f41889c8592033925c180f46413cfaec14 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/0072-Optimize-isValidLocation-getType-and-getBlockData-fo.patch index 118ea94f04..9723792c8d 100644 --- a/Spigot-Server-Patches/0072-Optimize-isValidLocation-getType-and-getBlockData-fo.patch +++ b/Spigot-Server-Patches/0072-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 2a18a905aef50d23d9e5544f4240b2f719abd8f1..9067fcbf6d35931d31830b91f42f027076426bad 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 { +@@ -179,7 +179,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) { +@@ -195,7 +195,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/0073-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch index 9ad19a252a..49923e401a 100644 --- a/Spigot-Server-Patches/0073-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch +++ b/Spigot-Server-Patches/0073-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 cc3718765ed54f8042a2687e409a51098ebc67a0..3202c171cffed5c5cec74f6b082aedaeae1c7b9d 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 50c2c4b0dc6256d5fbc361ba9b89b4e17bef8acb..9ce4d23aa0af877b383750bbb73b7a93a117d03f 100644 +index 9067fcbf6d35931d31830b91f42f027076426bad..66a4e068f43fad6d8f3858e6665ad70eacbe4617 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 { +@@ -435,7 +435,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 50c2c4b0dc6256d5fbc361ba9b89b4e17bef8acb..9ce4d23aa0af877b383750bbb73b7a93 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 { +@@ -537,7 +537,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { try { // CraftBukkit start CraftWorld world = ((WorldServer) this).getWorld(); @@ -66,14 +66,15 @@ index 50c2c4b0dc6256d5fbc361ba9b89b4e17bef8acb..9ce4d23aa0af877b383750bbb73b7a93 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 9e8f22f41889c8592033925c180f46413cfaec14..cc96ce0cb2e75dd86b413da76e878d511cd4e039 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 { +@@ -83,6 +83,8 @@ public class WorldServer extends World implements GeneratorAccessSeed { + public final Convertable.ConversionSession convertable; + public final UUID uuid; - // CraftBukkit start - private int tickPosition; + 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) { ++ + public Chunk getChunkIfLoaded(int x, int z) { + return this.chunkProvider.getChunkAt(x, z, false); + } diff --git a/Spigot-Server-Patches/0074-Entity-AddTo-RemoveFrom-World-Events.patch b/Spigot-Server-Patches/0074-Entity-AddTo-RemoveFrom-World-Events.patch index a41ea5de8e..f1d7930aff 100644 --- a/Spigot-Server-Patches/0074-Entity-AddTo-RemoveFrom-World-Events.patch +++ b/Spigot-Server-Patches/0074-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 cc96ce0cb2e75dd86b413da76e878d511cd4e039..f6940921dec04eedc393578ec9827e6f8516611c 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 { +@@ -1057,7 +1057,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 { +@@ -1095,6 +1095,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/0075-Configurable-Chunk-Inhabited-Time.patch index 1f592a154c..3273ad6f68 100644 --- a/Spigot-Server-Patches/0075-Configurable-Chunk-Inhabited-Time.patch +++ b/Spigot-Server-Patches/0075-Configurable-Chunk-Inhabited-Time.patch @@ -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/0076-EntityPathfindEvent.patch index cd3e9cc2d2..87db80a591 100644 --- a/Spigot-Server-Patches/0076-EntityPathfindEvent.patch +++ b/Spigot-Server-Patches/0076-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/0077-Sanitise-RegionFileCache-and-make-configurable.patch index ec7d8d24fe..113e0a0b5c 100644 --- a/Spigot-Server-Patches/0077-Sanitise-RegionFileCache-and-make-configurable.patch +++ b/Spigot-Server-Patches/0077-Sanitise-RegionFileCache-and-make-configurable.patch @@ -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/0078-Do-not-load-chunks-for-Pathfinding.patch b/Spigot-Server-Patches/0078-Do-not-load-chunks-for-Pathfinding.patch index d9be283f5c..1a57e503cf 100644 --- a/Spigot-Server-Patches/0078-Do-not-load-chunks-for-Pathfinding.patch +++ b/Spigot-Server-Patches/0078-Do-not-load-chunks-for-Pathfinding.patch @@ -5,64 +5,61 @@ 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 +index 0ed4b1d9c636a9051718f800ba5717e3ae46cdc9..9330e65cbdf2f826528e3c891197fac7860306ec 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 +@@ -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 6199570618d4642b7ca7b2472852cec6af0202d9..67c63cfe333e328cbd00ada970bd81efebfe30b6 100644 +index 8ba6dd459a863717c91dd59f3f2ee5e3a5ed8170..b31d1f73ce0f067e352868b53eab7557c34b17eb 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 +@@ -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) { - 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 +index 7249dd2e6d66b20398103301050ac96ca0c44386..d7f0df123ba716ca8587cbfab2c8e94961164909 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); +@@ -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 (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); + 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 { + } - 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); + 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 diff --git a/Spigot-Server-Patches/0079-Add-PlayerUseUnknownEntityEvent.patch b/Spigot-Server-Patches/0079-Add-PlayerUseUnknownEntityEvent.patch index 6b440af862..228b7d410f 100644 --- a/Spigot-Server-Patches/0079-Add-PlayerUseUnknownEntityEvent.patch +++ b/Spigot-Server-Patches/0079-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 a0806ddc407d21340c82fe4d00bb7ad120cc09d9..1c4ed037e30b367cda6d6500001b56ee502693c0 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 { +@@ -1954,6 +1954,16 @@ public class PlayerConnection implements PacketListenerPlayIn { } } } diff --git a/Spigot-Server-Patches/0080-Fix-reducedDebugInfo-not-initialized-on-client.patch b/Spigot-Server-Patches/0080-Fix-reducedDebugInfo-not-initialized-on-client.patch index 511f55f7a8..ed2c6e14c1 100644 --- a/Spigot-Server-Patches/0080-Fix-reducedDebugInfo-not-initialized-on-client.patch +++ b/Spigot-Server-Patches/0080-Fix-reducedDebugInfo-not-initialized-on-client.patch @@ -5,10 +5,10 @@ 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 6f11111f413914856e6a3622512f00f8a49cdfa2..c0c774d17b81109eaaea2ad726629eca902cfd6c 100644 +index 80fec11079b71569dbfcfd399df325a1e942e8ef..42e7394326237fcb466ac9727b5ac732518cf1b9 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 { +@@ -173,6 +173,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())); diff --git a/Spigot-Server-Patches/0081-Configurable-Grass-Spread-Tick-Rate.patch b/Spigot-Server-Patches/0081-Configurable-Grass-Spread-Tick-Rate.patch index f4c224ea37..cb86ec9a43 100644 --- a/Spigot-Server-Patches/0081-Configurable-Grass-Spread-Tick-Rate.patch +++ b/Spigot-Server-Patches/0081-Configurable-Grass-Spread-Tick-Rate.patch @@ -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/0082-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch index 6ede81f3d3..f6f9834a34 100644 --- a/Spigot-Server-Patches/0082-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch +++ b/Spigot-Server-Patches/0082-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 9ce4d23aa0af877b383750bbb73b7a93a117d03f..1bc4cfea913dd4663bf18ebb31ef24fe07e5ee14 100644 +index 66a4e068f43fad6d8f3858e6665ad70eacbe4617..b9ddbcd0b409352a14c5b8dde14d7eac41e69dc3 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 { +@@ -495,6 +495,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/0083-Remove-Debug-checks-from-DataBits.patch b/Spigot-Server-Patches/0083-Remove-Debug-checks-from-DataBits.patch index c8465b02d2..ff31c66ed5 100644 --- a/Spigot-Server-Patches/0083-Remove-Debug-checks-from-DataBits.patch +++ b/Spigot-Server-Patches/0083-Remove-Debug-checks-from-DataBits.patch @@ -9,46 +9,37 @@ 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 +index 2c3580c1c7bcd6afc83a45550c0f672a592e0c38..48cca2b9a1dbb071615625842123c0c47e281b29 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 { +@@ -53,8 +53,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 { +- 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.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 { +- 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.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; +- 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/0084-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch index 08baaa10a8..f6f7e8e4f6 100644 --- a/Spigot-Server-Patches/0084-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch +++ b/Spigot-Server-Patches/0084-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch @@ -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 1c4ed037e30b367cda6d6500001b56ee502693c0..6fe5f581934647b6f3a51dd63080e720a574de4d 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 { +@@ -1692,7 +1692,16 @@ public class PlayerConnection implements PacketListenerPlayIn { return; } diff --git a/Spigot-Server-Patches/0085-Workaround-for-setting-passengers-on-players.patch b/Spigot-Server-Patches/0085-Workaround-for-setting-passengers-on-players.patch index 0a407b78c0..54bfd5eeb9 100644 --- a/Spigot-Server-Patches/0085-Workaround-for-setting-passengers-on-players.patch +++ b/Spigot-Server-Patches/0085-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 5b3c8cc669eef72cec04d36de156405421cd21e5..cff5600687d88e3eab06a00bdd7810fa35f3c7cc 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 { +@@ -771,6 +771,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/0086-Remove-unused-World-Tile-Entity-List.patch index 6a7d7e006d..df5acb06a2 100644 --- a/Spigot-Server-Patches/0086-Remove-unused-World-Tile-Entity-List.patch +++ b/Spigot-Server-Patches/0086-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 1bc4cfea913dd4663bf18ebb31ef24fe07e5ee14..6647b9aca46b7db5e2466984f14d787a1c5daa10 100644 +index b9ddbcd0b409352a14c5b8dde14d7eac41e69dc3..be3e6b398f20467f843fea8296ad5ceea5efb18a 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 { +@@ -660,9 +660,9 @@ public abstract class World implements GeneratorAccess, AutoCloseable { }, tileentity::getPosition}); } @@ -30,7 +30,7 @@ index 1bc4cfea913dd4663bf18ebb31ef24fe07e5ee14..6647b9aca46b7db5e2466984f14d787a this.tileEntityListTick.add(tileentity); } -@@ -643,7 +643,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -698,7 +698,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 1bc4cfea913dd4663bf18ebb31ef24fe07e5ee14..6647b9aca46b7db5e2466984f14d787a this.tileEntityListUnload.clear(); } -@@ -704,7 +704,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -759,7 +759,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { tilesThisCycle--; this.tileEntityListTick.remove(tileTickPosition--); // Spigot end @@ -48,7 +48,7 @@ index 1bc4cfea913dd4663bf18ebb31ef24fe07e5ee14..6647b9aca46b7db5e2466984f14d787a if (this.isLoaded(tileentity.getPosition())) { this.getChunkAtWorldCoords(tileentity.getPosition()).removeTileEntity(tileentity.getPosition()); } -@@ -734,7 +734,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -789,7 +789,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 1bc4cfea913dd4663bf18ebb31ef24fe07e5ee14..6647b9aca46b7db5e2466984f14d787a this.a(tileentity1); } // CraftBukkit end -@@ -1000,7 +1000,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -931,7 +931,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { } else { if (tileentity != null) { this.tileEntityListPending.remove(tileentity); @@ -67,10 +67,10 @@ index 1bc4cfea913dd4663bf18ebb31ef24fe07e5ee14..6647b9aca46b7db5e2466984f14d787a } 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 f6940921dec04eedc393578ec9827e6f8516611c..e2dfe047e64257b861fa0b168d2790605f09291c 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 { +@@ -1543,7 +1543,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 { +@@ -1682,7 +1682,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/0087-Don-t-tick-Skulls-unused-code.patch index 067640d7e0..1c814d0fdf 100644 --- a/Spigot-Server-Patches/0087-Don-t-tick-Skulls-unused-code.patch +++ b/Spigot-Server-Patches/0087-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/0088-Configurable-Player-Collision.patch index a0776b8008..9864dde934 100644 --- a/Spigot-Server-Patches/0088-Configurable-Player-Collision.patch +++ b/Spigot-Server-Patches/0088-Configurable-Player-Collision.patch @@ -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 3202c171cffed5c5cec74f6b082aedaeae1c7b9d..04429bb6f4d75800425087d8a5463ab9f4f4cef3 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 { +@@ -304,6 +305,13 @@ public abstract class PlayerList { } entityplayer.syncInventory(); @@ -80,9 +80,9 @@ index c0c774d17b81109eaaea2ad726629eca902cfd6c..0f09cacf6d67dab5bc7962f19fcf3eba + } + // 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 { +@@ -421,6 +429,16 @@ public abstract class PlayerList { entityplayer.playerTick(); // SPIGOT-924 // CraftBukkit end @@ -99,7 +99,7 @@ index c0c774d17b81109eaaea2ad726629eca902cfd6c..0f09cacf6d67dab5bc7962f19fcf3eba this.savePlayerFile(entityplayer); if (entityplayer.isPassenger()) { Entity entity = entityplayer.getRootVehicle(); -@@ -1018,6 +1036,13 @@ public abstract class PlayerList { +@@ -1058,6 +1076,13 @@ public abstract class PlayerList { } // CraftBukkit end diff --git a/Spigot-Server-Patches/0089-Add-handshake-event-to-allow-plugins-to-handle-clien.patch b/Spigot-Server-Patches/0089-Add-handshake-event-to-allow-plugins-to-handle-clien.patch index 84ebce0ad8..6b8655969d 100644 --- a/Spigot-Server-Patches/0089-Add-handshake-event-to-allow-plugins-to-handle-clien.patch +++ b/Spigot-Server-Patches/0089-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 bb54632f5036cf6eeaf7d0a08d2b7f57fad3e360..a3b48376b92aee548ec28eec1cdc978925b96df0 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/0090-Configurable-RCON-IP-address.patch index a32a2c1d3c..0aa53ccbbf 100644 --- a/Spigot-Server-Patches/0090-Configurable-RCON-IP-address.patch +++ b/Spigot-Server-Patches/0090-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 { +@@ -220,10 +221,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 { +@@ -269,7 +276,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 { +@@ -287,7 +294,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); } +@@ -298,7 +310,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/0092-Implement-PlayerLocaleChangeEvent.patch index 6a8bc47291..90aa802fc6 100644 --- a/Spigot-Server-Patches/0092-Implement-PlayerLocaleChangeEvent.patch +++ b/Spigot-Server-Patches/0092-Implement-PlayerLocaleChangeEvent.patch @@ -5,25 +5,24 @@ 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 326cbeee1ba59b585a59c3c402cf6d920c88ac13..75757e00edfd11a4a7dc793d5d13355ea713dc01 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 { +@@ -1568,19 +1568,27 @@ 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.clientViewDistance = packetplayinsettings.viewDistance; @@ -31,19 +30,19 @@ index 540048627ef5716be2c9115b162a6eeaf9951ad9..aca885db36a8c93e32b3a2e40c407e4f + // 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 cff5600687d88e3eab06a00bdd7810fa35f3c7cc..20cb63419a049ce9dcaf2f0c99274501ebf9aa8c 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 { +@@ -1772,8 +1772,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public String getLocale() { @@ -56,11 +55,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/0093-EntityRegainHealthEvent-isFastRegen-API.patch index 9d9d47c7c0..e55c1e1ad4 100644 --- a/Spigot-Server-Patches/0093-EntityRegainHealthEvent-isFastRegen-API.patch +++ b/Spigot-Server-Patches/0093-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 d6ef12f1d65e8ab8b1c41bcf06f022f3193df15f..9ba0bf40f823003a5966244e7cdde4e3e11da9ec 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 d6ef12f1d65e8ab8b1c41bcf06f022f3193df15f..9ba0bf40f823003a5966244e7cdde4e3 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/0094-Add-ability-to-configure-frosted_ice-properties.patch index 44ec2804bf..d321b0ce3c 100644 --- a/Spigot-Server-Patches/0094-Add-ability-to-configure-frosted_ice-properties.patch +++ b/Spigot-Server-Patches/0094-Add-ability-to-configure-frosted_ice-properties.patch @@ -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/0095-remove-null-possibility-for-getServer-singleton.patch index c9bf893e44..f811ba0e22 100644 --- a/Spigot-Server-Patches/0095-remove-null-possibility-for-getServer-singleton.patch +++ b/Spigot-Server-Patches/0095-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 04429bb6f4d75800425087d8a5463ab9f4f4cef3..17846ca9190c63671ad616c668aa1fe1367bcac1 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 +@@ -69,6 +69,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 e2dfe047e64257b861fa0b168d2790605f09291c..6fb4c273b4ce2bafe8ba42f1f9e8b0d7838e5804 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 { +@@ -1013,6 +1013,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/0097-LootTable-API-Replenishable-Lootables-Feature.patch index 9b607dcdb5..131c8db439 100644 --- a/Spigot-Server-Patches/0097-LootTable-API-Replenishable-Lootables-Feature.patch +++ b/Spigot-Server-Patches/0097-LootTable-API-Replenishable-Lootables-Feature.patch @@ -520,10 +520,10 @@ 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 d4e673a70f28b9d29b3d1b16eaa06562b7a5d7bc..f873c1574e21c0d935db4d27be8afad6d9b403ee 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 +@@ -74,6 +74,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke }; // Paper end @@ -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/0100-Optimize-UserCache-Thread-Safe.patch b/Spigot-Server-Patches/0100-Optimize-UserCache-Thread-Safe.patch index fcaa937b23..c5a8e6ec8d 100644 --- a/Spigot-Server-Patches/0100-Optimize-UserCache-Thread-Safe.patch +++ b/Spigot-Server-Patches/0100-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 17846ca9190c63671ad616c668aa1fe1367bcac1..800ca2d57295c40853f5f1e58ce15e75f1a5afad 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/0101-Avoid-blocking-on-Network-Manager-creation.patch index d7136ee989..0ef8f2f371 100644 --- a/Spigot-Server-Patches/0101-Avoid-blocking-on-Network-Manager-creation.patch +++ b/Spigot-Server-Patches/0101-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/0102-Optional-TNT-doesn-t-move-in-water.patch index be859d9db6..2e573991e6 100644 --- a/Spigot-Server-Patches/0102-Optional-TNT-doesn-t-move-in-water.patch +++ b/Spigot-Server-Patches/0102-Optional-TNT-doesn-t-move-in-water.patch @@ -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 f873c1574e21c0d935db4d27be8afad6d9b403ee..2175ce0830701568024ed4d45164ba8ae0ec8548 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 +@@ -2647,6 +2647,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/0103-Faster-redstone-torch-rapid-clock-removal.patch index 22ea8b2f2c..a1eba2ad11 100644 --- a/Spigot-Server-Patches/0103-Faster-redstone-torch-rapid-clock-removal.patch +++ b/Spigot-Server-Patches/0103-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 6647b9aca46b7db5e2466984f14d787a1c5daa10..5dd504ea0b0d0ca7e7cd8c33473177f95c54bd8c 100644 +index be3e6b398f20467f843fea8296ad5ceea5efb18a..3e6dc44ede30846b8c612b043c1bd625576980e8 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 { +@@ -89,6 +89,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/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 index 90eea7b3c9..b12ddb26a0 100644 --- 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 @@ -6,38 +6,34 @@ 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 +index d335eb7898dc3a2b1553157d35050112f7b7a426..72a9430789301b264a36c5060ded31ccdc4a1ebf 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) { +@@ -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, new BlockPosition(this), 0); + // this.world.b(1028, this.getChunkCoordinates(), 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()) { ++ //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 -+ // 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 +index 1d725c152a2f96dd12fc3c4e25e142129a783e1b..9331f96f68f121b41ce74904d624520291b7c72e 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; +@@ -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/0106-Fix-Double-World-Add-issues.patch index b364401ac5..d884413c81 100644 --- a/Spigot-Server-Patches/0106-Fix-Double-World-Add-issues.patch +++ b/Spigot-Server-Patches/0106-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 6fb4c273b4ce2bafe8ba42f1f9e8b0d7838e5804..43b588709da17ae779e97d297955edd3425c2a68 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 { +@@ -920,6 +920,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/0107-Fix-Old-Sign-Conversion.patch b/Spigot-Server-Patches/0107-Fix-Old-Sign-Conversion.patch index 9a5e3b777b..2f5a4b5477 100644 --- a/Spigot-Server-Patches/0107-Fix-Old-Sign-Conversion.patch +++ b/Spigot-Server-Patches/0107-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 ab0f9a9d69c801e47002039c41c7c3393fc2f403..967aec7ce9a7fbbb42b51d1ed281db005e107c2c 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/0108-Don-t-lookup-game-profiles-that-have-no-UUID-and-no-.patch index 4d9ee673c5..02a31384e5 100644 --- a/Spigot-Server-Patches/0108-Don-t-lookup-game-profiles-that-have-no-UUID-and-no-.patch +++ b/Spigot-Server-Patches/0108-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/0109-Add-setting-for-proxy-online-mode-status.patch similarity index 90% rename from Spigot-Server-Patches/0110-Add-setting-for-proxy-online-mode-status.patch rename to Spigot-Server-Patches/0109-Add-setting-for-proxy-online-mode-status.patch index 4d768029f5..fa408f1765 100644 --- a/Spigot-Server-Patches/0110-Add-setting-for-proxy-online-mode-status.patch +++ b/Spigot-Server-Patches/0109-Add-setting-for-proxy-online-mode-status.patch @@ -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 f29253ba0fdf30d78dbec58a8c706e219653ddeb..28b3c800683dd42b88d630c9ae83996b7b4f65df 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 { +@@ -1458,7 +1458,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 44c53269c3..0000000000 --- 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 f9b77ec31b466687eaef2b952b01a2dcf38605c1..c00ada6c10529fd50b0d7fbb1763b6e09287a1fc 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 -